diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/locomokbd.c | 73 | ||||
-rw-r--r-- | drivers/input/mouse/appletouch.c | 13 | ||||
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 22 |
3 files changed, 70 insertions, 38 deletions
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c index 5a0ca18d6755..9caed30f3bbb 100644 --- a/drivers/input/keyboard/locomokbd.c +++ b/drivers/input/keyboard/locomokbd.c | |||
@@ -1,14 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2005 John Lenz | 2 | * LoCoMo keyboard driver for Linux-based ARM PDAs: |
3 | * - SHARP Zaurus Collie (SL-5500) | ||
4 | * - SHARP Zaurus Poodle (SL-5600) | ||
3 | * | 5 | * |
6 | * Copyright (c) 2005 John Lenz | ||
4 | * Based on from xtkbd.c | 7 | * Based on from xtkbd.c |
5 | */ | 8 | * |
6 | 9 | * | |
7 | /* | ||
8 | * LoCoMo keyboard driver for Linux/ARM | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
@@ -47,7 +45,8 @@ MODULE_LICENSE("GPL"); | |||
47 | #define KEY_CONTACT KEY_F18 | 45 | #define KEY_CONTACT KEY_F18 |
48 | #define KEY_CENTER KEY_F15 | 46 | #define KEY_CENTER KEY_F15 |
49 | 47 | ||
50 | static unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS] = { | 48 | static const unsigned char |
49 | locomokbd_keycode[LOCOMOKBD_NUMKEYS] __devinitconst = { | ||
51 | 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ | 50 | 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ |
52 | 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */ | 51 | 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */ |
53 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ | 52 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ |
@@ -67,22 +66,21 @@ static unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS] = { | |||
67 | #define KB_COLS 8 | 66 | #define KB_COLS 8 |
68 | #define KB_ROWMASK(r) (1 << (r)) | 67 | #define KB_ROWMASK(r) (1 << (r)) |
69 | #define SCANCODE(c,r) ( ((c)<<4) + (r) + 1 ) | 68 | #define SCANCODE(c,r) ( ((c)<<4) + (r) + 1 ) |
70 | #define NR_SCANCODES 128 | ||
71 | 69 | ||
72 | #define KB_DELAY 8 | 70 | #define KB_DELAY 8 |
73 | #define SCAN_INTERVAL (HZ/10) | 71 | #define SCAN_INTERVAL (HZ/10) |
74 | #define LOCOMOKBD_PRESSED 1 | ||
75 | 72 | ||
76 | struct locomokbd { | 73 | struct locomokbd { |
77 | unsigned char keycode[LOCOMOKBD_NUMKEYS]; | 74 | unsigned char keycode[LOCOMOKBD_NUMKEYS]; |
78 | struct input_dev *input; | 75 | struct input_dev *input; |
79 | char phys[32]; | 76 | char phys[32]; |
80 | 77 | ||
81 | struct locomo_dev *ldev; | ||
82 | unsigned long base; | 78 | unsigned long base; |
83 | spinlock_t lock; | 79 | spinlock_t lock; |
84 | 80 | ||
85 | struct timer_list timer; | 81 | struct timer_list timer; |
82 | unsigned long suspend_jiffies; | ||
83 | unsigned int count_cancel; | ||
86 | }; | 84 | }; |
87 | 85 | ||
88 | /* helper functions for reading the keyboard matrix */ | 86 | /* helper functions for reading the keyboard matrix */ |
@@ -128,7 +126,7 @@ static inline void locomokbd_reset_col(unsigned long membase, int col) | |||
128 | /* Scan the hardware keyboard and push any changes up through the input layer */ | 126 | /* Scan the hardware keyboard and push any changes up through the input layer */ |
129 | static void locomokbd_scankeyboard(struct locomokbd *locomokbd) | 127 | static void locomokbd_scankeyboard(struct locomokbd *locomokbd) |
130 | { | 128 | { |
131 | unsigned int row, col, rowd, scancode; | 129 | unsigned int row, col, rowd; |
132 | unsigned long flags; | 130 | unsigned long flags; |
133 | unsigned int num_pressed; | 131 | unsigned int num_pressed; |
134 | unsigned long membase = locomokbd->base; | 132 | unsigned long membase = locomokbd->base; |
@@ -145,13 +143,33 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd) | |||
145 | 143 | ||
146 | rowd = ~locomo_readl(membase + LOCOMO_KIB); | 144 | rowd = ~locomo_readl(membase + LOCOMO_KIB); |
147 | for (row = 0; row < KB_ROWS; row++) { | 145 | for (row = 0; row < KB_ROWS; row++) { |
146 | unsigned int scancode, pressed, key; | ||
147 | |||
148 | scancode = SCANCODE(col, row); | 148 | scancode = SCANCODE(col, row); |
149 | if (rowd & KB_ROWMASK(row)) { | 149 | pressed = rowd & KB_ROWMASK(row); |
150 | num_pressed += 1; | 150 | key = locomokbd->keycode[scancode]; |
151 | input_report_key(locomokbd->input, locomokbd->keycode[scancode], 1); | 151 | |
152 | } else { | 152 | input_report_key(locomokbd->input, key, pressed); |
153 | input_report_key(locomokbd->input, locomokbd->keycode[scancode], 0); | 153 | if (likely(!pressed)) |
154 | } | 154 | continue; |
155 | |||
156 | num_pressed++; | ||
157 | |||
158 | /* The "Cancel/ESC" key is labeled "On/Off" on | ||
159 | * Collie and Poodle and should suspend the device | ||
160 | * if it was pressed for more than a second. */ | ||
161 | if (unlikely(key == KEY_ESC)) { | ||
162 | if (!time_after(jiffies, | ||
163 | locomokbd->suspend_jiffies + HZ)) | ||
164 | continue; | ||
165 | if (locomokbd->count_cancel++ | ||
166 | != (HZ/SCAN_INTERVAL + 1)) | ||
167 | continue; | ||
168 | input_event(locomokbd->input, EV_PWR, | ||
169 | KEY_SUSPEND, 1); | ||
170 | locomokbd->suspend_jiffies = jiffies; | ||
171 | } else | ||
172 | locomokbd->count_cancel = 0; | ||
155 | } | 173 | } |
156 | locomokbd_reset_col(membase, col); | 174 | locomokbd_reset_col(membase, col); |
157 | } | 175 | } |
@@ -162,6 +180,8 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd) | |||
162 | /* if any keys are pressed, enable the timer */ | 180 | /* if any keys are pressed, enable the timer */ |
163 | if (num_pressed) | 181 | if (num_pressed) |
164 | mod_timer(&locomokbd->timer, jiffies + SCAN_INTERVAL); | 182 | mod_timer(&locomokbd->timer, jiffies + SCAN_INTERVAL); |
183 | else | ||
184 | locomokbd->count_cancel = 0; | ||
165 | 185 | ||
166 | spin_unlock_irqrestore(&locomokbd->lock, flags); | 186 | spin_unlock_irqrestore(&locomokbd->lock, flags); |
167 | } | 187 | } |
@@ -186,10 +206,11 @@ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id) | |||
186 | static void locomokbd_timer_callback(unsigned long data) | 206 | static void locomokbd_timer_callback(unsigned long data) |
187 | { | 207 | { |
188 | struct locomokbd *locomokbd = (struct locomokbd *) data; | 208 | struct locomokbd *locomokbd = (struct locomokbd *) data; |
209 | |||
189 | locomokbd_scankeyboard(locomokbd); | 210 | locomokbd_scankeyboard(locomokbd); |
190 | } | 211 | } |
191 | 212 | ||
192 | static int locomokbd_probe(struct locomo_dev *dev) | 213 | static int __devinit locomokbd_probe(struct locomo_dev *dev) |
193 | { | 214 | { |
194 | struct locomokbd *locomokbd; | 215 | struct locomokbd *locomokbd; |
195 | struct input_dev *input_dev; | 216 | struct input_dev *input_dev; |
@@ -211,7 +232,6 @@ static int locomokbd_probe(struct locomo_dev *dev) | |||
211 | goto err_free_mem; | 232 | goto err_free_mem; |
212 | } | 233 | } |
213 | 234 | ||
214 | locomokbd->ldev = dev; | ||
215 | locomo_set_drvdata(dev, locomokbd); | 235 | locomo_set_drvdata(dev, locomokbd); |
216 | 236 | ||
217 | locomokbd->base = (unsigned long) dev->mapbase; | 237 | locomokbd->base = (unsigned long) dev->mapbase; |
@@ -222,6 +242,8 @@ static int locomokbd_probe(struct locomo_dev *dev) | |||
222 | locomokbd->timer.function = locomokbd_timer_callback; | 242 | locomokbd->timer.function = locomokbd_timer_callback; |
223 | locomokbd->timer.data = (unsigned long) locomokbd; | 243 | locomokbd->timer.data = (unsigned long) locomokbd; |
224 | 244 | ||
245 | locomokbd->suspend_jiffies = jiffies; | ||
246 | |||
225 | locomokbd->input = input_dev; | 247 | locomokbd->input = input_dev; |
226 | strcpy(locomokbd->phys, "locomokbd/input0"); | 248 | strcpy(locomokbd->phys, "locomokbd/input0"); |
227 | 249 | ||
@@ -233,9 +255,10 @@ static int locomokbd_probe(struct locomo_dev *dev) | |||
233 | input_dev->id.version = 0x0100; | 255 | input_dev->id.version = 0x0100; |
234 | input_dev->dev.parent = &dev->dev; | 256 | input_dev->dev.parent = &dev->dev; |
235 | 257 | ||
236 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 258 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | |
259 | BIT_MASK(EV_PWR); | ||
237 | input_dev->keycode = locomokbd->keycode; | 260 | input_dev->keycode = locomokbd->keycode; |
238 | input_dev->keycodesize = sizeof(unsigned char); | 261 | input_dev->keycodesize = sizeof(locomokbd_keycode[0]); |
239 | input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode); | 262 | input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode); |
240 | 263 | ||
241 | memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode)); | 264 | memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode)); |
@@ -268,7 +291,7 @@ static int locomokbd_probe(struct locomo_dev *dev) | |||
268 | return err; | 291 | return err; |
269 | } | 292 | } |
270 | 293 | ||
271 | static int locomokbd_remove(struct locomo_dev *dev) | 294 | static int __devexit locomokbd_remove(struct locomo_dev *dev) |
272 | { | 295 | { |
273 | struct locomokbd *locomokbd = locomo_get_drvdata(dev); | 296 | struct locomokbd *locomokbd = locomo_get_drvdata(dev); |
274 | 297 | ||
@@ -292,7 +315,7 @@ static struct locomo_driver keyboard_driver = { | |||
292 | }, | 315 | }, |
293 | .devid = LOCOMO_DEVID_KEYBOARD, | 316 | .devid = LOCOMO_DEVID_KEYBOARD, |
294 | .probe = locomokbd_probe, | 317 | .probe = locomokbd_probe, |
295 | .remove = locomokbd_remove, | 318 | .remove = __devexit_p(locomokbd_remove), |
296 | }; | 319 | }; |
297 | 320 | ||
298 | static int __init locomokbd_init(void) | 321 | static int __init locomokbd_init(void) |
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index b4423a471f02..8dd3942f3022 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
@@ -62,6 +62,10 @@ | |||
62 | #define GEYSER4_ISO_PRODUCT_ID 0x021B | 62 | #define GEYSER4_ISO_PRODUCT_ID 0x021B |
63 | #define GEYSER4_JIS_PRODUCT_ID 0x021C | 63 | #define GEYSER4_JIS_PRODUCT_ID 0x021C |
64 | 64 | ||
65 | #define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229 | ||
66 | #define GEYSER4_HF_ISO_PRODUCT_ID 0x022A | ||
67 | #define GEYSER4_HF_JIS_PRODUCT_ID 0x022B | ||
68 | |||
65 | #define ATP_DEVICE(prod) \ | 69 | #define ATP_DEVICE(prod) \ |
66 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | 70 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
67 | USB_DEVICE_ID_MATCH_INT_CLASS | \ | 71 | USB_DEVICE_ID_MATCH_INT_CLASS | \ |
@@ -93,6 +97,10 @@ static struct usb_device_id atp_table [] = { | |||
93 | { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) }, | 97 | { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) }, |
94 | { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) }, | 98 | { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) }, |
95 | 99 | ||
100 | { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) }, | ||
101 | { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) }, | ||
102 | { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) }, | ||
103 | |||
96 | /* Terminating entry */ | 104 | /* Terminating entry */ |
97 | { } | 105 | { } |
98 | }; | 106 | }; |
@@ -217,7 +225,10 @@ static inline int atp_is_geyser_3(struct atp *dev) | |||
217 | (productId == GEYSER3_JIS_PRODUCT_ID) || | 225 | (productId == GEYSER3_JIS_PRODUCT_ID) || |
218 | (productId == GEYSER4_ANSI_PRODUCT_ID) || | 226 | (productId == GEYSER4_ANSI_PRODUCT_ID) || |
219 | (productId == GEYSER4_ISO_PRODUCT_ID) || | 227 | (productId == GEYSER4_ISO_PRODUCT_ID) || |
220 | (productId == GEYSER4_JIS_PRODUCT_ID); | 228 | (productId == GEYSER4_JIS_PRODUCT_ID) || |
229 | (productId == GEYSER4_HF_ANSI_PRODUCT_ID) || | ||
230 | (productId == GEYSER4_HF_ISO_PRODUCT_ID) || | ||
231 | (productId == GEYSER4_HF_JIS_PRODUCT_ID); | ||
221 | } | 232 | } |
222 | 233 | ||
223 | /* | 234 | /* |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 57a1c28bf122..a571aa965da0 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -87,6 +87,7 @@ struct ads7846 { | |||
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | u16 model; | 89 | u16 model; |
90 | u16 vref_mv; | ||
90 | u16 vref_delay_usecs; | 91 | u16 vref_delay_usecs; |
91 | u16 x_plate_ohms; | 92 | u16 x_plate_ohms; |
92 | u16 pressure_max; | 93 | u16 pressure_max; |
@@ -184,9 +185,6 @@ struct ads7846 { | |||
184 | * The range is GND..vREF. The ads7843 and ads7835 must use external vREF; | 185 | * The range is GND..vREF. The ads7843 and ads7835 must use external vREF; |
185 | * ads7846 lets that pin be unconnected, to use internal vREF. | 186 | * ads7846 lets that pin be unconnected, to use internal vREF. |
186 | */ | 187 | */ |
187 | static unsigned vREF_mV; | ||
188 | module_param(vREF_mV, uint, 0); | ||
189 | MODULE_PARM_DESC(vREF_mV, "external vREF voltage, in milliVolts"); | ||
190 | 188 | ||
191 | struct ser_req { | 189 | struct ser_req { |
192 | u8 ref_on; | 190 | u8 ref_on; |
@@ -213,7 +211,6 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
213 | struct ads7846 *ts = dev_get_drvdata(dev); | 211 | struct ads7846 *ts = dev_get_drvdata(dev); |
214 | struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); | 212 | struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); |
215 | int status; | 213 | int status; |
216 | int uninitialized_var(sample); | ||
217 | int use_internal; | 214 | int use_internal; |
218 | 215 | ||
219 | if (!req) | 216 | if (!req) |
@@ -270,13 +267,13 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
270 | 267 | ||
271 | if (status == 0) { | 268 | if (status == 0) { |
272 | /* on-wire is a must-ignore bit, a BE12 value, then padding */ | 269 | /* on-wire is a must-ignore bit, a BE12 value, then padding */ |
273 | sample = be16_to_cpu(req->sample); | 270 | status = be16_to_cpu(req->sample); |
274 | sample = sample >> 3; | 271 | status = status >> 3; |
275 | sample &= 0x0fff; | 272 | status &= 0x0fff; |
276 | } | 273 | } |
277 | 274 | ||
278 | kfree(req); | 275 | kfree(req); |
279 | return status ? status : sample; | 276 | return status; |
280 | } | 277 | } |
281 | 278 | ||
282 | #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) | 279 | #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) |
@@ -317,7 +314,7 @@ static inline unsigned vaux_adjust(struct ads7846 *ts, ssize_t v) | |||
317 | unsigned retval = v; | 314 | unsigned retval = v; |
318 | 315 | ||
319 | /* external resistors may scale vAUX into 0..vREF */ | 316 | /* external resistors may scale vAUX into 0..vREF */ |
320 | retval *= vREF_mV; | 317 | retval *= ts->vref_mv; |
321 | retval = retval >> 12; | 318 | retval = retval >> 12; |
322 | return retval; | 319 | return retval; |
323 | } | 320 | } |
@@ -375,14 +372,14 @@ static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts) | |||
375 | /* hwmon sensors need a reference voltage */ | 372 | /* hwmon sensors need a reference voltage */ |
376 | switch (ts->model) { | 373 | switch (ts->model) { |
377 | case 7846: | 374 | case 7846: |
378 | if (!vREF_mV) { | 375 | if (!ts->vref_mv) { |
379 | dev_dbg(&spi->dev, "assuming 2.5V internal vREF\n"); | 376 | dev_dbg(&spi->dev, "assuming 2.5V internal vREF\n"); |
380 | vREF_mV = 2500; | 377 | ts->vref_mv = 2500; |
381 | } | 378 | } |
382 | break; | 379 | break; |
383 | case 7845: | 380 | case 7845: |
384 | case 7843: | 381 | case 7843: |
385 | if (!vREF_mV) { | 382 | if (!ts->vref_mv) { |
386 | dev_warn(&spi->dev, | 383 | dev_warn(&spi->dev, |
387 | "external vREF for ADS%d not specified\n", | 384 | "external vREF for ADS%d not specified\n", |
388 | ts->model); | 385 | ts->model); |
@@ -875,6 +872,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
875 | 872 | ||
876 | ts->spi = spi; | 873 | ts->spi = spi; |
877 | ts->input = input_dev; | 874 | ts->input = input_dev; |
875 | ts->vref_mv = pdata->vref_mv; | ||
878 | 876 | ||
879 | hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 877 | hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
880 | ts->timer.function = ads7846_timer; | 878 | ts->timer.function = ads7846_timer; |