Commit 23916a8e authored by Jim Cromie's avatar Jim Cromie Committed by Linus Torvalds

[PATCH] chardev: GPIO for SCx200 & PC-8736x: display pin values in/out in gpio_dump

Add current pin settings to gpio_dump() output.  This adds the last 'word' to
the syslog lines, which displays the input and output values that the pin is
set to.

  pc8736x_gpio.0: io00: 0x0044 TS OD PUE  EDGE LO DEBOUNCE        io:1/1

The 2 values may differ for a number of reasons:
1- the pin output circuitry is diaabled, (as the above 'TS' indicates)
2- it needs a pullup resistor to drive the attached circuit,
3- the external circuit needs a pullup so the open-drain has something
   to pull-down
4- the pin is wired to Vcc or Ground

It might be appropriate to add a WARN for 2,3,4, since they could
damage the chip and/or circuit, esp if misconfig goes unnoticed.
Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ec312310
...@@ -26,7 +26,7 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index) ...@@ -26,7 +26,7 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index)
u32 config = amp->gpio_config(index, ~0, 0); u32 config = amp->gpio_config(index, ~0, 0);
/* user requested via 'v' command, so its INFO */ /* user requested via 'v' command, so its INFO */
dev_info(amp->dev, "io%02u: 0x%04x %s %s %s %s %s %s %s\n", dev_info(amp->dev, "io%02u: 0x%04x %s %s %s %s %s %s %s\tio:%d/%d\n",
index, config, index, config,
(config & 1) ? "OE" : "TS", /* output-enabled/tristate */ (config & 1) ? "OE" : "TS", /* output-enabled/tristate */
(config & 2) ? "PP" : "OD", /* push pull / open drain */ (config & 2) ? "PP" : "OD", /* push pull / open drain */
...@@ -34,7 +34,9 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index) ...@@ -34,7 +34,9 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index)
(config & 8) ? "LOCKED" : "", /* locked / unlocked */ (config & 8) ? "LOCKED" : "", /* locked / unlocked */
(config & 16) ? "LEVEL" : "EDGE",/* level/edge input */ (config & 16) ? "LEVEL" : "EDGE",/* level/edge input */
(config & 32) ? "HI" : "LO", /* trigger on rise/fall edge */ (config & 32) ? "HI" : "LO", /* trigger on rise/fall edge */
(config & 64) ? "DEBOUNCE" : ""); /* debounce */ (config & 64) ? "DEBOUNCE" : "", /* debounce */
amp->gpio_get(index), amp->gpio_current(index));
} }
ssize_t nsc_gpio_write(struct file *file, const char __user *data, ssize_t nsc_gpio_write(struct file *file, const char __user *data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment