Chromium Code Reviews
DescriptionAdd ability to change gpio directions.
This CL adds nm10_gpio.c driver methods to allow changing of
GPIO pin directions. The driver code is being refactored to
separate common input parameters check.
Once the new methods are added, the gpiolib.c layer adss the
appropriate attribute (direction) to every enabled nm10 gpio
pin in /sys/class/gpio.
Writing "in" or "out" into the direction attribute sets the
pin's direction.
Change-Id: I4116542c7424dfb7f5c6fdc35930caf0a5d2e11b
BUG=chrome-os-partner:970
chromium-os:3612
TEST=see below
1. Install the new driver version on the system
2. Enable all GPIO pins
localhost tmp # i=0; while [ "$i" != "64" ] ; do gpio=$(expr $i \+ 192) ; i=$(expr $i \+ 1) ; echo $gpio > /sys/class/gpio/export ; done
2. define a shell function to display gpio pins' status:
gpiodump() { i=0; while [ "$i" != "64" ]; do gpio=$(expr $i \+ 192) ; i=$(expr $i \+ 1) ; cat /sys/class/gpio/gpio$gpio/value ; done | awk '{ if (i == 8) {print ""; i = 0;} printf " %s", $1; i = i + 1} END { print "" }' ; }
3. Set the recovery mode pin direction to output:
localhost tmp # echo out > /sys/class/gpio/gpio230/direction
4. Run gpiodump with the button pressed and released,
observe that there is no difference in the output.
5. Set the recovery mode pin direction to input:
localhost tmp # echo in > /sys/class/gpio/gpio230/direction
6. Run gpiodump with the button released and the pressed,
observe that there is difference in the output value of pin38:
localhost tmp # gpiodump
0 0 0 0 0 1 1 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0
0 1 0 0 0 0 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
localhost tmp # gpiodump
0 0 0 0 0 1 1 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0
0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Patch Set 1 : Add support to change of GPIO pins' directions to NM10 driver. #
Total comments: 1
Messages
Total messages: 3 (0 generated)
|
|||||||||||||||||||