GPIO SUPPORT FOR SCx200 & PC8736x
This patch-set reworks the 2.4 vintage scx200_gpio driver for modern
2.6, and refactors GPIO support to reuse it in a new driver for the
GPIO on PC-8736x chips.
16/19. patch.devdbg-nscgpio
Use of dev_dbg() and friends is considered good practice. dev_dbg()
needs a struct device *devp, but nsc_gpio is only a helper module, so
it doesnt have its own. To provide devp to the user-modules
(scx200 & pc8736x _gpio), we add it to their vtables, and set it during
module inits
Also adjust nsc_gpio_dump() format for tighter syslog entries:
[ 199.259879] pc8736x_gpio.0: io09: 0x0044 TS OD PUE EDGE LO DEBOUNCE
Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
diffstat patch.devdbg-nscgpio
drivers/char/nsc_gpio.c | 45
+++++++++++++++++++++++--------------------
drivers/char/pc8736x_gpio.c | 3 +-
drivers/char/scx200_gpio.c | 10 +--------
include/linux/nsc_gpio.h | 6 ++++-
4 files changed, 33 insertions(+), 31 deletions(-)
17/19. patch.pin-config-view
Add another user-query command, to show more about pin-state. Maybe
this should be combined with previous patch, in one 'v' command.
[ 199.266564] pc8736x_gpio.0: io 9: driven 1, input 0
Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
diffstat patch.pin-config-view
nsc_gpio.c | 5 +++++
1 files changed, 5 insertions(+)
diff -ruNp -X dontdiff -X exclude-diffs ac-17/drivers/char/nsc_gpio.c
ac-18/drivers/char/nsc_gpio.c
--- ac-17/drivers/char/nsc_gpio.c 2006-05-28 22:52:49.000000000 -0600
+++ ac-18/drivers/char/nsc_gpio.c 2006-05-28 23:09:35.000000000 -0600
@@ -86,6 +86,11 @@ ssize_t nsc_gpio_write(struct file *file
/* View Current pin settings */
amp->gpio_dump(amp, m);
break;
+ case 'c':
+ /* view pin's current values: driven and read */
+ dev_info(amp->dev, "io%02d: driven %d, input %d\n",
+ m, amp->gpio_current(m), amp->gpio_get(m));
+ break;
case '\n':
/* end of settings string, do nothing */
break;
|