aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2006-06-27 05:54:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:42 -0400
commit9550a339e1ab1709dd53d92a1b76eecae2df9f3c (patch)
treea5bea006ebb482c6f4468816486254c401803282
parentd424aa8744b7b7db1d32476ae6c8015d10eebe1c (diff)
[PATCH] chardev: GPIO for SCx200 & PC-8736x: add 'v' command to device-file
Add a new driver command: 'v' which calls gpio_dump() on the pin. The output goes to the log, like all other INFO messages in the original driver. Giving the user control over the feedback they 'need' is construed to be a user-friendly feature, and allows us (later) to dial down many INFO messages to DEBUG log-level. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/i386/kernel/scx200.c3
-rw-r--r--drivers/char/scx200_gpio.c16
2 files changed, 17 insertions, 2 deletions
diff --git a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c
index 9e96a785dd05..009e6aa16f73 100644
--- a/arch/i386/kernel/scx200.c
+++ b/arch/i386/kernel/scx200.c
@@ -105,7 +105,6 @@ u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits)
105 return config; 105 return config;
106} 106}
107 107
108#if 0
109void scx200_gpio_dump(unsigned index) 108void scx200_gpio_dump(unsigned index)
110{ 109{
111 u32 config = scx200_gpio_configure(index, ~0, 0); 110 u32 config = scx200_gpio_configure(index, ~0, 0);
@@ -120,7 +119,6 @@ void scx200_gpio_dump(unsigned index)
120 (config & 32) ? "HI" : "LO", /* trigger on rising/falling edge */ 119 (config & 32) ? "HI" : "LO", /* trigger on rising/falling edge */
121 (config & 64) ? "DEBOUNCE" : ""); /* debounce */ 120 (config & 64) ? "DEBOUNCE" : ""); /* debounce */
122} 121}
123#endif /* 0 */
124 122
125static int __init scx200_init(void) 123static int __init scx200_init(void)
126{ 124{
@@ -141,4 +139,5 @@ module_exit(scx200_cleanup);
141EXPORT_SYMBOL(scx200_gpio_base); 139EXPORT_SYMBOL(scx200_gpio_base);
142EXPORT_SYMBOL(scx200_gpio_shadow); 140EXPORT_SYMBOL(scx200_gpio_shadow);
143EXPORT_SYMBOL(scx200_gpio_configure); 141EXPORT_SYMBOL(scx200_gpio_configure);
142EXPORT_SYMBOL(scx200_gpio_dump);
144EXPORT_SYMBOL(scx200_cb_base); 143EXPORT_SYMBOL(scx200_cb_base);
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
index e6e52c48697b..a1a56c5c8a84 100644
--- a/drivers/char/scx200_gpio.c
+++ b/drivers/char/scx200_gpio.c
@@ -41,6 +41,7 @@ static ssize_t scx200_gpio_write(struct file *file, const char __user *data,
41{ 41{
42 unsigned m = iminor(file->f_dentry->d_inode); 42 unsigned m = iminor(file->f_dentry->d_inode);
43 size_t i; 43 size_t i;
44 int err = 0;
44 45
45 for (i = 0; i < len; ++i) { 46 for (i = 0; i < len; ++i) {
46 char c; 47 char c;
@@ -77,8 +78,23 @@ static ssize_t scx200_gpio_write(struct file *file, const char __user *data,
77 printk(KERN_INFO NAME ": GPIO%d pull up disabled\n", m); 78 printk(KERN_INFO NAME ": GPIO%d pull up disabled\n", m);
78 scx200_gpio_configure(m, ~4, 0); 79 scx200_gpio_configure(m, ~4, 0);
79 break; 80 break;
81
82 case 'v':
83 /* View Current pin settings */
84 scx200_gpio_dump(m);
85 break;
86 case '\n':
87 /* end of settings string, do nothing */
88 break;
89 default:
90 printk(KERN_ERR NAME
91 ": GPIO-%2d bad setting: chr<0x%2x>\n", m,
92 (int)c);
93 err++;
80 } 94 }
81 } 95 }
96 if (err)
97 return -EINVAL; /* full string handled, report error */
82 98
83 return len; 99 return len;
84} 100}