Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Issue 3333016: Add ability to change gpio directions. (Closed)

Created:
10 years, 3 months ago by vb
Modified:
9 years, 6 months ago
CC:
chromium-os-reviews_chromium.org, Mandeep Singh Baines, vb
Visibility:
Public.

Description

Add 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
Unified diffs Side-by-side diffs Delta from patch set Stats (+92 lines, -21 lines) Patch
M drivers/gpio/nm10_gpio.c View 5 chunks +92 lines, -21 lines 1 comment Download

Messages

Total messages: 3 (0 generated)
vb
10 years, 3 months ago (2010-09-03 18:51:53 UTC) #1
Olof Johansson
Hi, Not a big fan of the fill-in functions. See below. :) http://codereview.chromium.org/3333016/diff/4001/5001 File drivers/gpio/nm10_gpio.c ...
10 years, 3 months ago (2010-09-03 19:35:13 UTC) #2
Randall Spangler
10 years, 3 months ago (2010-09-03 20:01:09 UTC) #3
LGTM

Powered by Google App Engine
This is Rietveld 408576698