Re: pca953x GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

This mail is to let everybody notice that since kernel version 3.1, the pca953x module handles properly the chip WITHOUT the need of platform specific data. This means that, from user space, you can manage the pins through the /sys/class/gpio interface (provided by kernel's gpiolib framework) without building a new kernel with the platform code. You just need to read / write to the correct files. E.g.

# Register the chip on the proper bus.
# A new directory should whose name ends with a chip number N:
#   /sys/class/gpio/gpiochip240
echo pca9555 0x20 > /sys/bus/i2c/devices/i2c-0/new_device

# Request the wanted pin number M on the chip number N (chip number + pin number).
# A new directory should appear:
#   /sys/class/gpio/gpioN+M
echo 240 > /sys/class/gpio/export
echo 241 > /sys/class/gpio/export

# Get the pin state:
cat /sys/class/gpio/gpio240/value

# Set pin direction:
echo 'out' > /sys/class/gpio/gpio241/direction

# Set pin state:
echo '1' > /sys/class/gpio/gpio241/value

Regards,

--
Joan Pau Beltran
Grup de Sistemes, Robòtica i Visió - DMI
Universitat de les Illes Balears
Ctra. Valldemossa, km 7.5 07122 Palma
Campus Universitari, edifici Anselm Turmeda
Telf (+34) 971 17 28 13
Fax (+34) 971 17 30 03

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux