aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/joystick/iforce/iforce-ff.c36
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c14
-rw-r--r--drivers/input/joystick/iforce/iforce-packets.c8
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c2
-rw-r--r--drivers/input/joystick/xpad.c6
-rw-r--r--drivers/input/keyboard/corgikbd.c6
-rw-r--r--drivers/input/keyboard/omap-keypad.c29
-rw-r--r--drivers/input/keyboard/spitzkbd.c6
-rw-r--r--drivers/input/keyboard/tosakbd.c6
-rw-r--r--drivers/input/misc/ati_remote.c20
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c10
-rw-r--r--drivers/input/misc/sparcspkr.c4
-rw-r--r--drivers/input/misc/yealink.c3
-rw-r--r--drivers/input/serio/hp_sdc.c2
-rw-r--r--drivers/input/serio/i8042-io.h2
-rw-r--r--drivers/input/serio/i8042-sparcio.h2
-rw-r--r--drivers/input/tablet/acecad.c3
-rw-r--r--drivers/input/tablet/aiptek.c26
-rw-r--r--drivers/input/tablet/gtco.c4
-rw-r--r--drivers/input/tablet/kbtab.c3
-rw-r--r--drivers/input/tablet/wacom_sys.c3
-rw-r--r--drivers/input/touchscreen/Kconfig9
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c2
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c382
-rw-r--r--drivers/input/xen-kbdfront.c4
25 files changed, 253 insertions, 339 deletions
diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c
index 7839b7b6fa96..0de9a0943a9e 100644
--- a/drivers/input/joystick/iforce/iforce-ff.c
+++ b/drivers/input/joystick/iforce/iforce-ff.c
@@ -197,13 +197,16 @@ static unsigned char find_button(struct iforce *iforce, signed short button)
197 * Analyse the changes in an effect, and tell if we need to send an condition 197 * Analyse the changes in an effect, and tell if we need to send an condition
198 * parameter packet 198 * parameter packet
199 */ 199 */
200static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) 200static int need_condition_modifier(struct iforce *iforce,
201 struct ff_effect *old,
202 struct ff_effect *new)
201{ 203{
202 int ret = 0; 204 int ret = 0;
203 int i; 205 int i;
204 206
205 if (new->type != FF_SPRING && new->type != FF_FRICTION) { 207 if (new->type != FF_SPRING && new->type != FF_FRICTION) {
206 warn("bad effect type in need_condition_modifier"); 208 dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
209 __func__);
207 return 0; 210 return 0;
208 } 211 }
209 212
@@ -222,10 +225,13 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
222 * Analyse the changes in an effect, and tell if we need to send a magnitude 225 * Analyse the changes in an effect, and tell if we need to send a magnitude
223 * parameter packet 226 * parameter packet
224 */ 227 */
225static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) 228static int need_magnitude_modifier(struct iforce *iforce,
229 struct ff_effect *old,
230 struct ff_effect *effect)
226{ 231{
227 if (effect->type != FF_CONSTANT) { 232 if (effect->type != FF_CONSTANT) {
228 warn("bad effect type in need_envelope_modifier"); 233 dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
234 __func__);
229 return 0; 235 return 0;
230 } 236 }
231 237
@@ -236,7 +242,8 @@ static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effe
236 * Analyse the changes in an effect, and tell if we need to send an envelope 242 * Analyse the changes in an effect, and tell if we need to send an envelope
237 * parameter packet 243 * parameter packet
238 */ 244 */
239static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effect) 245static int need_envelope_modifier(struct iforce *iforce, struct ff_effect *old,
246 struct ff_effect *effect)
240{ 247{
241 switch (effect->type) { 248 switch (effect->type) {
242 case FF_CONSTANT: 249 case FF_CONSTANT:
@@ -256,7 +263,8 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
256 break; 263 break;
257 264
258 default: 265 default:
259 warn("bad effect type in need_envelope_modifier"); 266 dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
267 __func__);
260 } 268 }
261 269
262 return 0; 270 return 0;
@@ -266,10 +274,12 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
266 * Analyse the changes in an effect, and tell if we need to send a periodic 274 * Analyse the changes in an effect, and tell if we need to send a periodic
267 * parameter effect 275 * parameter effect
268 */ 276 */
269static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) 277static int need_period_modifier(struct iforce *iforce, struct ff_effect *old,
278 struct ff_effect *new)
270{ 279{
271 if (new->type != FF_PERIODIC) { 280 if (new->type != FF_PERIODIC) {
272 warn("bad effect type in need_period_modifier"); 281 dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
282 __func__);
273 return 0; 283 return 0;
274 } 284 }
275 return (old->u.periodic.period != new->u.periodic.period 285 return (old->u.periodic.period != new->u.periodic.period
@@ -355,7 +365,7 @@ int iforce_upload_periodic(struct iforce *iforce, struct ff_effect *effect, stru
355 int param2_err = 1; 365 int param2_err = 1;
356 int core_err = 0; 366 int core_err = 0;
357 367
358 if (!old || need_period_modifier(old, effect)) { 368 if (!old || need_period_modifier(iforce, old, effect)) {
359 param1_err = make_period_modifier(iforce, mod1_chunk, 369 param1_err = make_period_modifier(iforce, mod1_chunk,
360 old != NULL, 370 old != NULL,
361 effect->u.periodic.magnitude, effect->u.periodic.offset, 371 effect->u.periodic.magnitude, effect->u.periodic.offset,
@@ -365,7 +375,7 @@ int iforce_upload_periodic(struct iforce *iforce, struct ff_effect *effect, stru
365 set_bit(FF_MOD1_IS_USED, core_effect->flags); 375 set_bit(FF_MOD1_IS_USED, core_effect->flags);
366 } 376 }
367 377
368 if (!old || need_envelope_modifier(old, effect)) { 378 if (!old || need_envelope_modifier(iforce, old, effect)) {
369 param2_err = make_envelope_modifier(iforce, mod2_chunk, 379 param2_err = make_envelope_modifier(iforce, mod2_chunk,
370 old !=NULL, 380 old !=NULL,
371 effect->u.periodic.envelope.attack_length, 381 effect->u.periodic.envelope.attack_length,
@@ -425,7 +435,7 @@ int iforce_upload_constant(struct iforce *iforce, struct ff_effect *effect, stru
425 int param2_err = 1; 435 int param2_err = 1;
426 int core_err = 0; 436 int core_err = 0;
427 437
428 if (!old || need_magnitude_modifier(old, effect)) { 438 if (!old || need_magnitude_modifier(iforce, old, effect)) {
429 param1_err = make_magnitude_modifier(iforce, mod1_chunk, 439 param1_err = make_magnitude_modifier(iforce, mod1_chunk,
430 old != NULL, 440 old != NULL,
431 effect->u.constant.level); 441 effect->u.constant.level);
@@ -434,7 +444,7 @@ int iforce_upload_constant(struct iforce *iforce, struct ff_effect *effect, stru
434 set_bit(FF_MOD1_IS_USED, core_effect->flags); 444 set_bit(FF_MOD1_IS_USED, core_effect->flags);
435 } 445 }
436 446
437 if (!old || need_envelope_modifier(old, effect)) { 447 if (!old || need_envelope_modifier(iforce, old, effect)) {
438 param2_err = make_envelope_modifier(iforce, mod2_chunk, 448 param2_err = make_envelope_modifier(iforce, mod2_chunk,
439 old != NULL, 449 old != NULL,
440 effect->u.constant.envelope.attack_length, 450 effect->u.constant.envelope.attack_length,
@@ -487,7 +497,7 @@ int iforce_upload_condition(struct iforce *iforce, struct ff_effect *effect, str
487 default: return -1; 497 default: return -1;
488 } 498 }
489 499
490 if (!old || need_condition_modifier(old, effect)) { 500 if (!old || need_condition_modifier(iforce, old, effect)) {
491 param_err = make_condition_modifier(iforce, mod1_chunk, 501 param_err = make_condition_modifier(iforce, mod1_chunk,
492 old != NULL, 502 old != NULL,
493 effect->u.condition[0].right_saturation, 503 effect->u.condition[0].right_saturation,
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index 61ee6e38739d..baabf8302645 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -218,7 +218,9 @@ static void iforce_release(struct input_dev *dev)
218 /* Check: no effects should be present in memory */ 218 /* Check: no effects should be present in memory */
219 for (i = 0; i < dev->ff->max_effects; i++) { 219 for (i = 0; i < dev->ff->max_effects; i++) {
220 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { 220 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) {
221 warn("iforce_release: Device still owns effects"); 221 dev_warn(&dev->dev,
222 "%s: Device still owns effects\n",
223 __func__);
222 break; 224 break;
223 } 225 }
224 } 226 }
@@ -335,26 +337,26 @@ int iforce_init_device(struct iforce *iforce)
335 if (!iforce_get_id_packet(iforce, "M")) 337 if (!iforce_get_id_packet(iforce, "M"))
336 input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; 338 input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1];
337 else 339 else
338 warn("Device does not respond to id packet M"); 340 dev_warn(&iforce->dev->dev, "Device does not respond to id packet M\n");
339 341
340 if (!iforce_get_id_packet(iforce, "P")) 342 if (!iforce_get_id_packet(iforce, "P"))
341 input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; 343 input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1];
342 else 344 else
343 warn("Device does not respond to id packet P"); 345 dev_warn(&iforce->dev->dev, "Device does not respond to id packet P\n");
344 346
345 if (!iforce_get_id_packet(iforce, "B")) 347 if (!iforce_get_id_packet(iforce, "B"))
346 iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; 348 iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1];
347 else 349 else
348 warn("Device does not respond to id packet B"); 350 dev_warn(&iforce->dev->dev, "Device does not respond to id packet B\n");
349 351
350 if (!iforce_get_id_packet(iforce, "N")) 352 if (!iforce_get_id_packet(iforce, "N"))
351 ff_effects = iforce->edata[1]; 353 ff_effects = iforce->edata[1];
352 else 354 else
353 warn("Device does not respond to id packet N"); 355 dev_warn(&iforce->dev->dev, "Device does not respond to id packet N\n");
354 356
355 /* Check if the device can store more effects than the driver can really handle */ 357 /* Check if the device can store more effects than the driver can really handle */
356 if (ff_effects > IFORCE_EFFECTS_MAX) { 358 if (ff_effects > IFORCE_EFFECTS_MAX) {
357 warn("Limiting number of effects to %d (device reports %d)", 359 dev_warn(&iforce->dev->dev, "Limiting number of effects to %d (device reports %d)\n",
358 IFORCE_EFFECTS_MAX, ff_effects); 360 IFORCE_EFFECTS_MAX, ff_effects);
359 ff_effects = IFORCE_EFFECTS_MAX; 361 ff_effects = IFORCE_EFFECTS_MAX;
360 } 362 }
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c
index 015b50aa76fc..a17b50016009 100644
--- a/drivers/input/joystick/iforce/iforce-packets.c
+++ b/drivers/input/joystick/iforce/iforce-packets.c
@@ -65,7 +65,8 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
65 65
66 66
67 if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { 67 if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {
68 warn("not enough space in xmit buffer to send new packet"); 68 dev_warn(&iforce->dev->dev,
69 "not enough space in xmit buffer to send new packet\n");
69 spin_unlock_irqrestore(&iforce->xmit_lock, flags); 70 spin_unlock_irqrestore(&iforce->xmit_lock, flags);
70 return -1; 71 return -1;
71 } 72 }
@@ -148,7 +149,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr)
148 return 0; 149 return 0;
149 } 150 }
150 } 151 }
151 warn("unused effect %04x updated !!!", addr); 152 dev_warn(&iforce->dev->dev, "unused effect %04x updated !!!\n", addr);
152 return -1; 153 return -1;
153} 154}
154 155
@@ -159,7 +160,8 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
159 static int being_used = 0; 160 static int being_used = 0;
160 161
161 if (being_used) 162 if (being_used)
162 warn("re-entrant call to iforce_process %d", being_used); 163 dev_warn(&iforce->dev->dev,
164 "re-entrant call to iforce_process %d\n", being_used);
163 being_used++; 165 being_used++;
164 166
165#ifdef CONFIG_JOYSTICK_IFORCE_232 167#ifdef CONFIG_JOYSTICK_IFORCE_232
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 851cc4087c2f..f83185aeb511 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -64,7 +64,7 @@ void iforce_usb_xmit(struct iforce *iforce)
64 64
65 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { 65 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) {
66 clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 66 clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
67 warn("usb_submit_urb failed %d\n", n); 67 dev_warn(&iforce->dev->dev, "usb_submit_urb failed %d\n", n);
68 } 68 }
69 69
70 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. 70 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended.
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 6791be81eb29..b868b8d5fbb3 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -455,10 +455,10 @@ static void xpad_bulk_out(struct urb *urb)
455 case -ENOENT: 455 case -ENOENT:
456 case -ESHUTDOWN: 456 case -ESHUTDOWN:
457 /* this urb is terminated, clean up */ 457 /* this urb is terminated, clean up */
458 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 458 dbg("%s - urb shutting down with status: %d", __func__, urb->status);
459 break; 459 break;
460 default: 460 default:
461 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 461 dbg("%s - nonzero urb status received: %d", __func__, urb->status);
462 } 462 }
463} 463}
464 464
@@ -911,7 +911,7 @@ static int __init usb_xpad_init(void)
911{ 911{
912 int result = usb_register(&xpad_driver); 912 int result = usb_register(&xpad_driver);
913 if (result == 0) 913 if (result == 0)
914 info(DRIVER_DESC); 914 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
915 return result; 915 return result;
916} 916}
917 917
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index 134e67bf6a90..c8ed065ea0cb 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -80,9 +80,9 @@ struct corgikbd {
80#define KB_ACTIVATE_DELAY 10 80#define KB_ACTIVATE_DELAY 10
81 81
82/* Helper functions for reading the keyboard matrix 82/* Helper functions for reading the keyboard matrix
83 * Note: We should really be using pxa_gpio_mode to alter GPDR but it 83 * Note: We should really be using the generic gpio functions to alter
84 * requires a function call per GPIO bit which is excessive 84 * GPDR but it requires a function call per GPIO bit which is
85 * when we need to access 12 bits at once multiple times. 85 * excessive when we need to access 12 bits at once, multiple times.
86 * These functions must be called within local_irq_save()/local_irq_restore() 86 * These functions must be called within local_irq_save()/local_irq_restore()
87 * or similar. 87 * or similar.
88 */ 88 */
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index dcea87a0bc56..69e674ecf19a 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -62,7 +62,7 @@ struct omap_kp {
62 unsigned int debounce; 62 unsigned int debounce;
63}; 63};
64 64
65DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); 65static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
66 66
67static int *keymap; 67static int *keymap;
68static unsigned int *row_gpios; 68static unsigned int *row_gpios;
@@ -72,12 +72,9 @@ static unsigned int *col_gpios;
72static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value) 72static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value)
73{ 73{
74 int col; 74 int col;
75 for (col = 0; col < omap_kp->cols; col++) { 75
76 if (value & (1 << col)) 76 for (col = 0; col < omap_kp->cols; col++)
77 omap_set_gpio_dataout(col_gpios[col], 1); 77 gpio_set_value(col_gpios[col], value & (1 << col));
78 else
79 omap_set_gpio_dataout(col_gpios[col], 0);
80 }
81} 78}
82 79
83static u8 get_row_gpio_val(struct omap_kp *omap_kp) 80static u8 get_row_gpio_val(struct omap_kp *omap_kp)
@@ -86,7 +83,7 @@ static u8 get_row_gpio_val(struct omap_kp *omap_kp)
86 u8 value = 0; 83 u8 value = 0;
87 84
88 for (row = 0; row < omap_kp->rows; row++) { 85 for (row = 0; row < omap_kp->rows; row++) {
89 if (omap_get_gpio_datain(row_gpios[row])) 86 if (gpio_get_value(row_gpios[row]))
90 value |= (1 << row); 87 value |= (1 << row);
91 } 88 }
92 return value; 89 return value;
@@ -333,23 +330,23 @@ static int __init omap_kp_probe(struct platform_device *pdev)
333 if (cpu_is_omap24xx()) { 330 if (cpu_is_omap24xx()) {
334 /* Cols: outputs */ 331 /* Cols: outputs */
335 for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) { 332 for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
336 if (omap_request_gpio(col_gpios[col_idx]) < 0) { 333 if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) {
337 printk(KERN_ERR "Failed to request" 334 printk(KERN_ERR "Failed to request"
338 "GPIO%d for keypad\n", 335 "GPIO%d for keypad\n",
339 col_gpios[col_idx]); 336 col_gpios[col_idx]);
340 goto err1; 337 goto err1;
341 } 338 }
342 omap_set_gpio_direction(col_gpios[col_idx], 0); 339 gpio_direction_output(col_gpios[col_idx], 0);
343 } 340 }
344 /* Rows: inputs */ 341 /* Rows: inputs */
345 for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) { 342 for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) {
346 if (omap_request_gpio(row_gpios[row_idx]) < 0) { 343 if (gpio_request(row_gpios[row_idx], "omap_kp_row") < 0) {
347 printk(KERN_ERR "Failed to request" 344 printk(KERN_ERR "Failed to request"
348 "GPIO%d for keypad\n", 345 "GPIO%d for keypad\n",
349 row_gpios[row_idx]); 346 row_gpios[row_idx]);
350 goto err2; 347 goto err2;
351 } 348 }
352 omap_set_gpio_direction(row_gpios[row_idx], 1); 349 gpio_direction_input(row_gpios[row_idx]);
353 } 350 }
354 } else { 351 } else {
355 col_idx = 0; 352 col_idx = 0;
@@ -418,10 +415,10 @@ err3:
418 device_remove_file(&pdev->dev, &dev_attr_enable); 415 device_remove_file(&pdev->dev, &dev_attr_enable);
419err2: 416err2:
420 for (i = row_idx - 1; i >=0; i--) 417 for (i = row_idx - 1; i >=0; i--)
421 omap_free_gpio(row_gpios[i]); 418 gpio_free(row_gpios[i]);
422err1: 419err1:
423 for (i = col_idx - 1; i >=0; i--) 420 for (i = col_idx - 1; i >=0; i--)
424 omap_free_gpio(col_gpios[i]); 421 gpio_free(col_gpios[i]);
425 422
426 kfree(omap_kp); 423 kfree(omap_kp);
427 input_free_device(input_dev); 424 input_free_device(input_dev);
@@ -438,9 +435,9 @@ static int omap_kp_remove(struct platform_device *pdev)
438 if (cpu_is_omap24xx()) { 435 if (cpu_is_omap24xx()) {
439 int i; 436 int i;
440 for (i = 0; i < omap_kp->cols; i++) 437 for (i = 0; i < omap_kp->cols; i++)
441 omap_free_gpio(col_gpios[i]); 438 gpio_free(col_gpios[i]);
442 for (i = 0; i < omap_kp->rows; i++) { 439 for (i = 0; i < omap_kp->rows; i++) {
443 omap_free_gpio(row_gpios[i]); 440 gpio_free(row_gpios[i]);
444 free_irq(OMAP_GPIO_IRQ(row_gpios[i]), 0); 441 free_irq(OMAP_GPIO_IRQ(row_gpios[i]), 0);
445 } 442 }
446 } else { 443 } else {
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index de67b8e0a799..c48b76a46a58 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -101,9 +101,9 @@ struct spitzkbd {
101#define KB_ACTIVATE_DELAY 10 101#define KB_ACTIVATE_DELAY 10
102 102
103/* Helper functions for reading the keyboard matrix 103/* Helper functions for reading the keyboard matrix
104 * Note: We should really be using pxa_gpio_mode to alter GPDR but it 104 * Note: We should really be using the generic gpio functions to alter
105 * requires a function call per GPIO bit which is excessive 105 * GPDR but it requires a function call per GPIO bit which is
106 * when we need to access 11 bits at once, multiple times. 106 * excessive when we need to access 11 bits at once, multiple times.
107 * These functions must be called within local_irq_save()/local_irq_restore() 107 * These functions must be called within local_irq_save()/local_irq_restore()
108 * or similar. 108 * or similar.
109 */ 109 */
diff --git a/drivers/input/keyboard/tosakbd.c b/drivers/input/keyboard/tosakbd.c
index 44cb50af3ce9..677276b12020 100644
--- a/drivers/input/keyboard/tosakbd.c
+++ b/drivers/input/keyboard/tosakbd.c
@@ -59,9 +59,9 @@ struct tosakbd {
59 59
60 60
61/* Helper functions for reading the keyboard matrix 61/* Helper functions for reading the keyboard matrix
62 * Note: We should really be using pxa_gpio_mode to alter GPDR but it 62 * Note: We should really be using the generic gpio functions to alter
63 * requires a function call per GPIO bit which is excessive 63 * GPDR but it requires a function call per GPIO bit which is
64 * when we need to access 12 bits at once, multiple times. 64 * excessive when we need to access 12 bits at once, multiple times.
65 * These functions must be called within local_irq_save()/local_irq_restore() 65 * These functions must be called within local_irq_save()/local_irq_restore()
66 * or similar. 66 * or similar.
67 */ 67 */
diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c
index debfc1af9d95..e290fde35e74 100644
--- a/drivers/input/misc/ati_remote.c
+++ b/drivers/input/misc/ati_remote.c
@@ -285,7 +285,6 @@ static const struct {
285}; 285};
286 286
287/* Local function prototypes */ 287/* Local function prototypes */
288static void ati_remote_dump (unsigned char *data, unsigned int actual_length);
289static int ati_remote_open (struct input_dev *inputdev); 288static int ati_remote_open (struct input_dev *inputdev);
290static void ati_remote_close (struct input_dev *inputdev); 289static void ati_remote_close (struct input_dev *inputdev);
291static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data); 290static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data);
@@ -307,15 +306,16 @@ static struct usb_driver ati_remote_driver = {
307/* 306/*
308 * ati_remote_dump_input 307 * ati_remote_dump_input
309 */ 308 */
310static void ati_remote_dump(unsigned char *data, unsigned int len) 309static void ati_remote_dump(struct device *dev, unsigned char *data,
310 unsigned int len)
311{ 311{
312 if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00)) 312 if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00))
313 warn("Weird byte 0x%02x", data[0]); 313 dev_warn(dev, "Weird byte 0x%02x\n", data[0]);
314 else if (len == 4) 314 else if (len == 4)
315 warn("Weird key %02x %02x %02x %02x", 315 dev_warn(dev, "Weird key %02x %02x %02x %02x\n",
316 data[0], data[1], data[2], data[3]); 316 data[0], data[1], data[2], data[3]);
317 else 317 else
318 warn("Weird data, len=%d %02x %02x %02x %02x %02x %02x ...", 318 dev_warn(dev, "Weird data, len=%d %02x %02x %02x %02x %02x %02x ...\n",
319 len, data[0], data[1], data[2], data[3], data[4], data[5]); 319 len, data[0], data[1], data[2], data[3], data[4], data[5]);
320} 320}
321 321
@@ -470,7 +470,7 @@ static void ati_remote_input_report(struct urb *urb)
470 /* Deal with strange looking inputs */ 470 /* Deal with strange looking inputs */
471 if ( (urb->actual_length != 4) || (data[0] != 0x14) || 471 if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
472 ((data[3] & 0x0f) != 0x00) ) { 472 ((data[3] & 0x0f) != 0x00) ) {
473 ati_remote_dump(data, urb->actual_length); 473 ati_remote_dump(&urb->dev->dev, data, urb->actual_length);
474 return; 474 return;
475 } 475 }
476 476
@@ -814,7 +814,7 @@ static void ati_remote_disconnect(struct usb_interface *interface)
814 ati_remote = usb_get_intfdata(interface); 814 ati_remote = usb_get_intfdata(interface);
815 usb_set_intfdata(interface, NULL); 815 usb_set_intfdata(interface, NULL);
816 if (!ati_remote) { 816 if (!ati_remote) {
817 warn("%s - null device?\n", __func__); 817 dev_warn(&interface->dev, "%s - null device?\n", __func__);
818 return; 818 return;
819 } 819 }
820 820
@@ -834,9 +834,11 @@ static int __init ati_remote_init(void)
834 834
835 result = usb_register(&ati_remote_driver); 835 result = usb_register(&ati_remote_driver);
836 if (result) 836 if (result)
837 err("usb_register error #%d\n", result); 837 printk(KERN_ERR KBUILD_MODNAME
838 ": usb_register error #%d\n", result);
838 else 839 else
839 info("Registered USB driver " DRIVER_DESC " v. " DRIVER_VERSION); 840 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
841 DRIVER_DESC "\n");
840 842
841 return result; 843 return result;
842} 844}
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index daa9d4220331..82ec6b1b6467 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -458,35 +458,35 @@ static int hp_sdc_rtc_proc_output (char *buf)
458 p += sprintf(p, "i8042 rtc\t: READ FAILED!\n"); 458 p += sprintf(p, "i8042 rtc\t: READ FAILED!\n");
459 } else { 459 } else {
460 p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n", 460 p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n",
461 tv.tv_sec, tv.tv_usec/1000); 461 tv.tv_sec, (int)tv.tv_usec/1000);
462 } 462 }
463 463
464 if (hp_sdc_rtc_read_fhs(&tv)) { 464 if (hp_sdc_rtc_read_fhs(&tv)) {
465 p += sprintf(p, "handshake\t: READ FAILED!\n"); 465 p += sprintf(p, "handshake\t: READ FAILED!\n");
466 } else { 466 } else {
467 p += sprintf(p, "handshake\t: %ld.%02d seconds\n", 467 p += sprintf(p, "handshake\t: %ld.%02d seconds\n",
468 tv.tv_sec, tv.tv_usec/1000); 468 tv.tv_sec, (int)tv.tv_usec/1000);
469 } 469 }
470 470
471 if (hp_sdc_rtc_read_mt(&tv)) { 471 if (hp_sdc_rtc_read_mt(&tv)) {
472 p += sprintf(p, "alarm\t\t: READ FAILED!\n"); 472 p += sprintf(p, "alarm\t\t: READ FAILED!\n");
473 } else { 473 } else {
474 p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n", 474 p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n",
475 tv.tv_sec, tv.tv_usec/1000); 475 tv.tv_sec, (int)tv.tv_usec/1000);
476 } 476 }
477 477
478 if (hp_sdc_rtc_read_dt(&tv)) { 478 if (hp_sdc_rtc_read_dt(&tv)) {
479 p += sprintf(p, "delay\t\t: READ FAILED!\n"); 479 p += sprintf(p, "delay\t\t: READ FAILED!\n");
480 } else { 480 } else {
481 p += sprintf(p, "delay\t\t: %ld.%02d seconds\n", 481 p += sprintf(p, "delay\t\t: %ld.%02d seconds\n",
482 tv.tv_sec, tv.tv_usec/1000); 482 tv.tv_sec, (int)tv.tv_usec/1000);
483 } 483 }
484 484
485 if (hp_sdc_rtc_read_ct(&tv)) { 485 if (hp_sdc_rtc_read_ct(&tv)) {
486 p += sprintf(p, "periodic\t: READ FAILED!\n"); 486 p += sprintf(p, "periodic\t: READ FAILED!\n");
487 } else { 487 } else {
488 p += sprintf(p, "periodic\t: %ld.%02d seconds\n", 488 p += sprintf(p, "periodic\t: %ld.%02d seconds\n",
489 tv.tv_sec, tv.tv_usec/1000); 489 tv.tv_sec, (int)tv.tv_usec/1000);
490 } 490 }
491 491
492 p += sprintf(p, 492 p += sprintf(p,
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index d8765cc93d27..c4f42311fdec 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -249,7 +249,7 @@ static int bbc_remove(struct of_device *op)
249 return 0; 249 return 0;
250} 250}
251 251
252static struct of_device_id bbc_beep_match[] = { 252static const struct of_device_id bbc_beep_match[] = {
253 { 253 {
254 .name = "beep", 254 .name = "beep",
255 .compatible = "SUNW,bbc-beep", 255 .compatible = "SUNW,bbc-beep",
@@ -328,7 +328,7 @@ static int grover_remove(struct of_device *op)
328 return 0; 328 return 0;
329} 329}
330 330
331static struct of_device_id grover_beep_match[] = { 331static const struct of_device_id grover_beep_match[] = {
332 { 332 {
333 .name = "beep", 333 .name = "beep",
334 .compatible = "SUNW,smbus-beep", 334 .compatible = "SUNW,smbus-beep",
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 11b5c7e84ed1..93a22ac0f88c 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -999,7 +999,8 @@ static int __init yealink_dev_init(void)
999{ 999{
1000 int ret = usb_register(&yealink_driver); 1000 int ret = usb_register(&yealink_driver);
1001 if (ret == 0) 1001 if (ret == 0)
1002 info(DRIVER_DESC ":" DRIVER_VERSION); 1002 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1003 DRIVER_DESC "\n");
1003 return ret; 1004 return ret;
1004} 1005}
1005 1006
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index 0d395979b2d1..bfe49243f38b 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -323,7 +323,7 @@ static void hp_sdc_tasklet(unsigned long foo)
323 * it back to the application. and be less verbose. 323 * it back to the application. and be less verbose.
324 */ 324 */
325 printk(KERN_WARNING PREFIX "read timeout (%ius)!\n", 325 printk(KERN_WARNING PREFIX "read timeout (%ius)!\n",
326 tv.tv_usec - hp_sdc.rtv.tv_usec); 326 (int)(tv.tv_usec - hp_sdc.rtv.tv_usec));
327 curr->idx += hp_sdc.rqty; 327 curr->idx += hp_sdc.rqty;
328 hp_sdc.rqty = 0; 328 hp_sdc.rqty = 0;
329 tmp = curr->seq[curr->actidx]; 329 tmp = curr->seq[curr->actidx];
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h
index f451c7351a9d..847f4aad7ed5 100644
--- a/drivers/input/serio/i8042-io.h
+++ b/drivers/input/serio/i8042-io.h
@@ -67,7 +67,7 @@ static inline int i8042_platform_init(void)
67 * On some platforms touching the i8042 data register region can do really 67 * On some platforms touching the i8042 data register region can do really
68 * bad things. Because of this the region is always reserved on such boxes. 68 * bad things. Because of this the region is always reserved on such boxes.
69 */ 69 */
70#if defined(CONFIG_PPC_MERGE) 70#if defined(CONFIG_PPC)
71 if (check_legacy_ioport(I8042_DATA_REG)) 71 if (check_legacy_ioport(I8042_DATA_REG))
72 return -ENODEV; 72 return -ENODEV;
73#endif 73#endif
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index 692a79ec2a22..5071af2c0604 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -87,7 +87,7 @@ static int __devexit sparc_i8042_remove(struct of_device *op)
87 return 0; 87 return 0;
88} 88}
89 89
90static struct of_device_id sparc_i8042_match[] = { 90static const struct of_device_id sparc_i8042_match[] = {
91 { 91 {
92 .name = "8042", 92 .name = "8042",
93 }, 93 },
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index 570e0e83ac46..670c61c5a516 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -280,7 +280,8 @@ static int __init usb_acecad_init(void)
280{ 280{
281 int result = usb_register(&usb_acecad_driver); 281 int result = usb_register(&usb_acecad_driver);
282 if (result == 0) 282 if (result == 0)
283 info(DRIVER_VERSION ":" DRIVER_DESC); 283 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
284 DRIVER_DESC "\n");
284 return result; 285 return result;
285} 286}
286 287
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index e53c838f1866..7d005a3616d7 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1706,20 +1706,21 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1706 aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL); 1706 aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL);
1707 inputdev = input_allocate_device(); 1707 inputdev = input_allocate_device();
1708 if (!aiptek || !inputdev) { 1708 if (!aiptek || !inputdev) {
1709 warn("aiptek: cannot allocate memory or input device"); 1709 dev_warn(&intf->dev,
1710 "cannot allocate memory or input device\n");
1710 goto fail1; 1711 goto fail1;
1711 } 1712 }
1712 1713
1713 aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, 1714 aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH,
1714 GFP_ATOMIC, &aiptek->data_dma); 1715 GFP_ATOMIC, &aiptek->data_dma);
1715 if (!aiptek->data) { 1716 if (!aiptek->data) {
1716 warn("aiptek: cannot allocate usb buffer"); 1717 dev_warn(&intf->dev, "cannot allocate usb buffer\n");
1717 goto fail1; 1718 goto fail1;
1718 } 1719 }
1719 1720
1720 aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); 1721 aiptek->urb = usb_alloc_urb(0, GFP_KERNEL);
1721 if (!aiptek->urb) { 1722 if (!aiptek->urb) {
1722 warn("aiptek: cannot allocate urb"); 1723 dev_warn(&intf->dev, "cannot allocate urb\n");
1723 goto fail2; 1724 goto fail2;
1724 } 1725 }
1725 1726
@@ -1843,8 +1844,9 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1843 aiptek->curSetting.programmableDelay = speeds[i]; 1844 aiptek->curSetting.programmableDelay = speeds[i];
1844 (void)aiptek_program_tablet(aiptek); 1845 (void)aiptek_program_tablet(aiptek);
1845 if (aiptek->inputdev->absmax[ABS_X] > 0) { 1846 if (aiptek->inputdev->absmax[ABS_X] > 0) {
1846 info("input: Aiptek using %d ms programming speed\n", 1847 dev_info(&intf->dev,
1847 aiptek->curSetting.programmableDelay); 1848 "Aiptek using %d ms programming speed\n",
1849 aiptek->curSetting.programmableDelay);
1848 break; 1850 break;
1849 } 1851 }
1850 } 1852 }
@@ -1852,7 +1854,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1852 /* Murphy says that some day someone will have a tablet that fails the 1854 /* Murphy says that some day someone will have a tablet that fails the
1853 above test. That's you, Frederic Rodrigo */ 1855 above test. That's you, Frederic Rodrigo */
1854 if (i == ARRAY_SIZE(speeds)) { 1856 if (i == ARRAY_SIZE(speeds)) {
1855 info("input: Aiptek tried all speeds, no sane response"); 1857 dev_info(&intf->dev,
1858 "Aiptek tried all speeds, no sane response\n");
1856 goto fail2; 1859 goto fail2;
1857 } 1860 }
1858 1861
@@ -1864,7 +1867,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1864 */ 1867 */
1865 err = sysfs_create_group(&intf->dev.kobj, &aiptek_attribute_group); 1868 err = sysfs_create_group(&intf->dev.kobj, &aiptek_attribute_group);
1866 if (err) { 1869 if (err) {
1867 warn("aiptek: cannot create sysfs group err: %d", err); 1870 dev_warn(&intf->dev, "cannot create sysfs group err: %d\n",
1871 err);
1868 goto fail3; 1872 goto fail3;
1869 } 1873 }
1870 1874
@@ -1872,7 +1876,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1872 */ 1876 */
1873 err = input_register_device(aiptek->inputdev); 1877 err = input_register_device(aiptek->inputdev);
1874 if (err) { 1878 if (err) {
1875 warn("aiptek: input_register_device returned err: %d", err); 1879 dev_warn(&intf->dev,
1880 "input_register_device returned err: %d\n", err);
1876 goto fail4; 1881 goto fail4;
1877 } 1882 }
1878 return 0; 1883 return 0;
@@ -1922,8 +1927,9 @@ static int __init aiptek_init(void)
1922{ 1927{
1923 int result = usb_register(&aiptek_driver); 1928 int result = usb_register(&aiptek_driver);
1924 if (result == 0) { 1929 if (result == 0) {
1925 info(DRIVER_VERSION ": " DRIVER_AUTHOR); 1930 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1926 info(DRIVER_DESC); 1931 DRIVER_DESC "\n");
1932 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_AUTHOR "\n");
1927 } 1933 }
1928 return result; 1934 return result;
1929} 1935}
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index 7df0228e836e..5524e01dbb1a 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -2,7 +2,7 @@
2 2
3GTCO digitizer USB driver 3GTCO digitizer USB driver
4 4
5Use the err(), dbg() and info() macros from usb.h for system logging 5Use the err() and dbg() macros from usb.h for system logging
6 6
7TO CHECK: Is pressure done right on report 5? 7TO CHECK: Is pressure done right on report 5?
8 8
@@ -1010,7 +1010,7 @@ static void gtco_disconnect(struct usb_interface *interface)
1010 kfree(gtco); 1010 kfree(gtco);
1011 } 1011 }
1012 1012
1013 info("gtco driver disconnected"); 1013 dev_info(&interface->dev, "gtco driver disconnected\n");
1014} 1014}
1015 1015
1016/* STANDARD MODULE LOAD ROUTINES */ 1016/* STANDARD MODULE LOAD ROUTINES */
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index d89112fa6e6b..6682b17bf844 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -215,7 +215,8 @@ static int __init kbtab_init(void)
215 retval = usb_register(&kbtab_driver); 215 retval = usb_register(&kbtab_driver);
216 if (retval) 216 if (retval)
217 goto out; 217 goto out;
218 info(DRIVER_VERSION ":" DRIVER_DESC); 218 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
219 DRIVER_DESC "\n");
219out: 220out:
220 return retval; 221 return retval;
221} 222}
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 5fbc463baf5a..09e227aa0d49 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -385,7 +385,8 @@ static int __init wacom_init(void)
385 wacom_driver.id_table = get_device_table(); 385 wacom_driver.id_table = get_device_table();
386 result = usb_register(&wacom_driver); 386 result = usb_register(&wacom_driver);
387 if (result == 0) 387 if (result == 0)
388 info(DRIVER_VERSION ":" DRIVER_DESC); 388 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
389 DRIVER_DESC "\n");
389 return result; 390 return result;
390} 391}
391 392
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 25287e80e236..3d1ab8fa9acc 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -42,8 +42,9 @@ config TOUCHSCREEN_BITSY
42 module will be called h3600_ts_input. 42 module will be called h3600_ts_input.
43 43
44config TOUCHSCREEN_CORGI 44config TOUCHSCREEN_CORGI
45 tristate "SharpSL (Corgi and Spitz series) touchscreen driver" 45 tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)"
46 depends on PXA_SHARPSL 46 depends on PXA_SHARPSL
47 select CORGI_SSP_DEPRECATED
47 default y 48 default y
48 help 49 help
49 Say Y here to enable the driver for the touchscreen on the 50 Say Y here to enable the driver for the touchscreen on the
@@ -54,6 +55,9 @@ config TOUCHSCREEN_CORGI
54 To compile this driver as a module, choose M here: the 55 To compile this driver as a module, choose M here: the
55 module will be called corgi_ts. 56 module will be called corgi_ts.
56 57
58 NOTE: this driver is deprecated, try enable SPI and generic
59 ADS7846-based touchscreen driver.
60
57config TOUCHSCREEN_FUJITSU 61config TOUCHSCREEN_FUJITSU
58 tristate "Fujitsu serial touchscreen" 62 tristate "Fujitsu serial touchscreen"
59 select SERIO 63 select SERIO
@@ -219,7 +223,8 @@ config TOUCHSCREEN_ATMEL_TSADCC
219 223
220config TOUCHSCREEN_UCB1400 224config TOUCHSCREEN_UCB1400
221 tristate "Philips UCB1400 touchscreen" 225 tristate "Philips UCB1400 touchscreen"
222 select AC97_BUS 226 depends on AC97_BUS
227 depends on UCB1400_CORE
223 help 228 help
224 This enables support for the Philips UCB1400 touchscreen interface. 229 This enables support for the Philips UCB1400 touchscreen interface.
225 The UCB1400 is an AC97 audio codec. The touchscreen interface 230 The UCB1400 is an AC97 audio codec. The touchscreen interface
diff --git a/drivers/input/touchscreen/hp680_ts_input.c b/drivers/input/touchscreen/hp680_ts_input.c
index c38d4e0f95c6..a89700e7ace4 100644
--- a/drivers/input/touchscreen/hp680_ts_input.c
+++ b/drivers/input/touchscreen/hp680_ts_input.c
@@ -5,7 +5,7 @@
5#include <asm/io.h> 5#include <asm/io.h>
6#include <asm/delay.h> 6#include <asm/delay.h>
7#include <asm/adc.h> 7#include <asm/adc.h>
8#include <asm/hp6xx.h> 8#include <mach/hp6xx.h>
9 9
10#define MODNAME "hp680_ts_input" 10#define MODNAME "hp680_ts_input"
11 11
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index bce018e45bce..54986627def0 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -5,6 +5,10 @@
5 * Created: September 25, 2006 5 * Created: September 25, 2006
6 * Copyright: MontaVista Software, Inc. 6 * Copyright: MontaVista Software, Inc.
7 * 7 *
8 * Spliting done by: Marek Vasut <marek.vasut@gmail.com>
9 * If something doesnt work and it worked before spliting, e-mail me,
10 * dont bother Nicolas please ;-)
11 *
8 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
@@ -25,124 +29,16 @@
25#include <linux/slab.h> 29#include <linux/slab.h>
26#include <linux/kthread.h> 30#include <linux/kthread.h>
27#include <linux/freezer.h> 31#include <linux/freezer.h>
28 32#include <linux/ucb1400.h>
29#include <sound/core.h>
30#include <sound/ac97_codec.h>
31
32
33/*
34 * Interesting UCB1400 AC-link registers
35 */
36
37#define UCB_IE_RIS 0x5e
38#define UCB_IE_FAL 0x60
39#define UCB_IE_STATUS 0x62
40#define UCB_IE_CLEAR 0x62
41#define UCB_IE_ADC (1 << 11)
42#define UCB_IE_TSPX (1 << 12)
43
44#define UCB_TS_CR 0x64
45#define UCB_TS_CR_TSMX_POW (1 << 0)
46#define UCB_TS_CR_TSPX_POW (1 << 1)
47#define UCB_TS_CR_TSMY_POW (1 << 2)
48#define UCB_TS_CR_TSPY_POW (1 << 3)
49#define UCB_TS_CR_TSMX_GND (1 << 4)
50#define UCB_TS_CR_TSPX_GND (1 << 5)
51#define UCB_TS_CR_TSMY_GND (1 << 6)
52#define UCB_TS_CR_TSPY_GND (1 << 7)
53#define UCB_TS_CR_MODE_INT (0 << 8)
54#define UCB_TS_CR_MODE_PRES (1 << 8)
55#define UCB_TS_CR_MODE_POS (2 << 8)
56#define UCB_TS_CR_BIAS_ENA (1 << 11)
57#define UCB_TS_CR_TSPX_LOW (1 << 12)
58#define UCB_TS_CR_TSMX_LOW (1 << 13)
59
60#define UCB_ADC_CR 0x66
61#define UCB_ADC_SYNC_ENA (1 << 0)
62#define UCB_ADC_VREFBYP_CON (1 << 1)
63#define UCB_ADC_INP_TSPX (0 << 2)
64#define UCB_ADC_INP_TSMX (1 << 2)
65#define UCB_ADC_INP_TSPY (2 << 2)
66#define UCB_ADC_INP_TSMY (3 << 2)
67#define UCB_ADC_INP_AD0 (4 << 2)
68#define UCB_ADC_INP_AD1 (5 << 2)
69#define UCB_ADC_INP_AD2 (6 << 2)
70#define UCB_ADC_INP_AD3 (7 << 2)
71#define UCB_ADC_EXT_REF (1 << 5)
72#define UCB_ADC_START (1 << 7)
73#define UCB_ADC_ENA (1 << 15)
74
75#define UCB_ADC_DATA 0x68
76#define UCB_ADC_DAT_VALID (1 << 15)
77#define UCB_ADC_DAT_VALUE(x) ((x) & 0x3ff)
78
79#define UCB_ID 0x7e
80#define UCB_ID_1400 0x4304
81
82
83struct ucb1400 {
84 struct snd_ac97 *ac97;
85 struct input_dev *ts_idev;
86
87 int irq;
88
89 wait_queue_head_t ts_wait;
90 struct task_struct *ts_task;
91
92 unsigned int irq_pending; /* not bit field shared */
93 unsigned int ts_restart:1;
94 unsigned int adcsync:1;
95};
96 33
97static int adcsync; 34static int adcsync;
98static int ts_delay = 55; /* us */ 35static int ts_delay = 55; /* us */
99static int ts_delay_pressure; /* us */ 36static int ts_delay_pressure; /* us */
100 37
101static inline u16 ucb1400_reg_read(struct ucb1400 *ucb, u16 reg)
102{
103 return ucb->ac97->bus->ops->read(ucb->ac97, reg);
104}
105
106static inline void ucb1400_reg_write(struct ucb1400 *ucb, u16 reg, u16 val)
107{
108 ucb->ac97->bus->ops->write(ucb->ac97, reg, val);
109}
110
111static inline void ucb1400_adc_enable(struct ucb1400 *ucb)
112{
113 ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA);
114}
115
116static unsigned int ucb1400_adc_read(struct ucb1400 *ucb, u16 adc_channel)
117{
118 unsigned int val;
119
120 if (ucb->adcsync)
121 adc_channel |= UCB_ADC_SYNC_ENA;
122
123 ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
124 ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA | adc_channel | UCB_ADC_START);
125
126 for (;;) {
127 val = ucb1400_reg_read(ucb, UCB_ADC_DATA);
128 if (val & UCB_ADC_DAT_VALID)
129 break;
130 /* yield to other processes */
131 schedule_timeout_uninterruptible(1);
132 }
133
134 return UCB_ADC_DAT_VALUE(val);
135}
136
137static inline void ucb1400_adc_disable(struct ucb1400 *ucb)
138{
139 ucb1400_reg_write(ucb, UCB_ADC_CR, 0);
140}
141
142/* Switch to interrupt mode. */ 38/* Switch to interrupt mode. */
143static inline void ucb1400_ts_mode_int(struct ucb1400 *ucb) 39static inline void ucb1400_ts_mode_int(struct snd_ac97 *ac97)
144{ 40{
145 ucb1400_reg_write(ucb, UCB_TS_CR, 41 ucb1400_reg_write(ac97, UCB_TS_CR,
146 UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | 42 UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW |
147 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | 43 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
148 UCB_TS_CR_MODE_INT); 44 UCB_TS_CR_MODE_INT);
@@ -152,14 +48,14 @@ static inline void ucb1400_ts_mode_int(struct ucb1400 *ucb)
152 * Switch to pressure mode, and read pressure. We don't need to wait 48 * Switch to pressure mode, and read pressure. We don't need to wait
153 * here, since both plates are being driven. 49 * here, since both plates are being driven.
154 */ 50 */
155static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400 *ucb) 51static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb)
156{ 52{
157 ucb1400_reg_write(ucb, UCB_TS_CR, 53 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
158 UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | 54 UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW |
159 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | 55 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
160 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 56 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
161 udelay(ts_delay_pressure); 57 udelay(ts_delay_pressure);
162 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY); 58 return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync);
163} 59}
164 60
165/* 61/*
@@ -168,21 +64,21 @@ static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400 *ucb)
168 * gives a faster response time. Even so, we need to wait about 55us 64 * gives a faster response time. Even so, we need to wait about 55us
169 * for things to stabilise. 65 * for things to stabilise.
170 */ 66 */
171static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400 *ucb) 67static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb)
172{ 68{
173 ucb1400_reg_write(ucb, UCB_TS_CR, 69 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
174 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | 70 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
175 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 71 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
176 ucb1400_reg_write(ucb, UCB_TS_CR, 72 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
177 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | 73 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
178 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 74 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
179 ucb1400_reg_write(ucb, UCB_TS_CR, 75 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
180 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | 76 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
181 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); 77 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
182 78
183 udelay(ts_delay); 79 udelay(ts_delay);
184 80
185 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY); 81 return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync);
186} 82}
187 83
188/* 84/*
@@ -191,63 +87,63 @@ static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400 *ucb)
191 * gives a faster response time. Even so, we need to wait about 55us 87 * gives a faster response time. Even so, we need to wait about 55us
192 * for things to stabilise. 88 * for things to stabilise.
193 */ 89 */
194static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400 *ucb) 90static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb)
195{ 91{
196 ucb1400_reg_write(ucb, UCB_TS_CR, 92 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
197 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | 93 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
198 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 94 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
199 ucb1400_reg_write(ucb, UCB_TS_CR, 95 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
200 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | 96 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
201 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 97 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
202 ucb1400_reg_write(ucb, UCB_TS_CR, 98 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
203 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | 99 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
204 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); 100 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
205 101
206 udelay(ts_delay); 102 udelay(ts_delay);
207 103
208 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPX); 104 return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPX, adcsync);
209} 105}
210 106
211/* 107/*
212 * Switch to X plate resistance mode. Set MX to ground, PX to 108 * Switch to X plate resistance mode. Set MX to ground, PX to
213 * supply. Measure current. 109 * supply. Measure current.
214 */ 110 */
215static inline unsigned int ucb1400_ts_read_xres(struct ucb1400 *ucb) 111static inline unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb)
216{ 112{
217 ucb1400_reg_write(ucb, UCB_TS_CR, 113 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
218 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | 114 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
219 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 115 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
220 return ucb1400_adc_read(ucb, 0); 116 return ucb1400_adc_read(ucb->ac97, 0, adcsync);
221} 117}
222 118
223/* 119/*
224 * Switch to Y plate resistance mode. Set MY to ground, PY to 120 * Switch to Y plate resistance mode. Set MY to ground, PY to
225 * supply. Measure current. 121 * supply. Measure current.
226 */ 122 */
227static inline unsigned int ucb1400_ts_read_yres(struct ucb1400 *ucb) 123static inline unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb)
228{ 124{
229 ucb1400_reg_write(ucb, UCB_TS_CR, 125 ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
230 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | 126 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
231 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 127 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
232 return ucb1400_adc_read(ucb, 0); 128 return ucb1400_adc_read(ucb->ac97, 0, adcsync);
233} 129}
234 130
235static inline int ucb1400_ts_pen_down(struct ucb1400 *ucb) 131static inline int ucb1400_ts_pen_down(struct snd_ac97 *ac97)
236{ 132{
237 unsigned short val = ucb1400_reg_read(ucb, UCB_TS_CR); 133 unsigned short val = ucb1400_reg_read(ac97, UCB_TS_CR);
238 return (val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW)); 134 return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW);
239} 135}
240 136
241static inline void ucb1400_ts_irq_enable(struct ucb1400 *ucb) 137static inline void ucb1400_ts_irq_enable(struct snd_ac97 *ac97)
242{ 138{
243 ucb1400_reg_write(ucb, UCB_IE_CLEAR, UCB_IE_TSPX); 139 ucb1400_reg_write(ac97, UCB_IE_CLEAR, UCB_IE_TSPX);
244 ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0); 140 ucb1400_reg_write(ac97, UCB_IE_CLEAR, 0);
245 ucb1400_reg_write(ucb, UCB_IE_FAL, UCB_IE_TSPX); 141 ucb1400_reg_write(ac97, UCB_IE_FAL, UCB_IE_TSPX);
246} 142}
247 143
248static inline void ucb1400_ts_irq_disable(struct ucb1400 *ucb) 144static inline void ucb1400_ts_irq_disable(struct snd_ac97 *ac97)
249{ 145{
250 ucb1400_reg_write(ucb, UCB_IE_FAL, 0); 146 ucb1400_reg_write(ac97, UCB_IE_FAL, 0);
251} 147}
252 148
253static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16 y) 149static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16 y)
@@ -264,25 +160,24 @@ static void ucb1400_ts_event_release(struct input_dev *idev)
264 input_sync(idev); 160 input_sync(idev);
265} 161}
266 162
267static void ucb1400_handle_pending_irq(struct ucb1400 *ucb) 163static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb)
268{ 164{
269 unsigned int isr; 165 unsigned int isr;
270 166
271 isr = ucb1400_reg_read(ucb, UCB_IE_STATUS); 167 isr = ucb1400_reg_read(ucb->ac97, UCB_IE_STATUS);
272 ucb1400_reg_write(ucb, UCB_IE_CLEAR, isr); 168 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, isr);
273 ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0); 169 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0);
274 170
275 if (isr & UCB_IE_TSPX) 171 if (isr & UCB_IE_TSPX) {
276 ucb1400_ts_irq_disable(ucb); 172 ucb1400_ts_irq_disable(ucb->ac97);
277 else 173 enable_irq(ucb->irq);
174 } else
278 printk(KERN_ERR "ucb1400: unexpected IE_STATUS = %#x\n", isr); 175 printk(KERN_ERR "ucb1400: unexpected IE_STATUS = %#x\n", isr);
279
280 enable_irq(ucb->irq);
281} 176}
282 177
283static int ucb1400_ts_thread(void *_ucb) 178static int ucb1400_ts_thread(void *_ucb)
284{ 179{
285 struct ucb1400 *ucb = _ucb; 180 struct ucb1400_ts *ucb = _ucb;
286 struct task_struct *tsk = current; 181 struct task_struct *tsk = current;
287 int valid = 0; 182 int valid = 0;
288 struct sched_param param = { .sched_priority = 1 }; 183 struct sched_param param = { .sched_priority = 1 };
@@ -301,19 +196,19 @@ static int ucb1400_ts_thread(void *_ucb)
301 ucb1400_handle_pending_irq(ucb); 196 ucb1400_handle_pending_irq(ucb);
302 } 197 }
303 198
304 ucb1400_adc_enable(ucb); 199 ucb1400_adc_enable(ucb->ac97);
305 x = ucb1400_ts_read_xpos(ucb); 200 x = ucb1400_ts_read_xpos(ucb);
306 y = ucb1400_ts_read_ypos(ucb); 201 y = ucb1400_ts_read_ypos(ucb);
307 p = ucb1400_ts_read_pressure(ucb); 202 p = ucb1400_ts_read_pressure(ucb);
308 ucb1400_adc_disable(ucb); 203 ucb1400_adc_disable(ucb->ac97);
309 204
310 /* Switch back to interrupt mode. */ 205 /* Switch back to interrupt mode. */
311 ucb1400_ts_mode_int(ucb); 206 ucb1400_ts_mode_int(ucb->ac97);
312 207
313 msleep(10); 208 msleep(10);
314 209
315 if (ucb1400_ts_pen_down(ucb)) { 210 if (ucb1400_ts_pen_down(ucb->ac97)) {
316 ucb1400_ts_irq_enable(ucb); 211 ucb1400_ts_irq_enable(ucb->ac97);
317 212
318 /* 213 /*
319 * If we spat out a valid sample set last time, 214 * If we spat out a valid sample set last time,
@@ -332,8 +227,8 @@ static int ucb1400_ts_thread(void *_ucb)
332 } 227 }
333 228
334 wait_event_freezable_timeout(ucb->ts_wait, 229 wait_event_freezable_timeout(ucb->ts_wait,
335 ucb->irq_pending || ucb->ts_restart || kthread_should_stop(), 230 ucb->irq_pending || ucb->ts_restart ||
336 timeout); 231 kthread_should_stop(), timeout);
337 } 232 }
338 233
339 /* Send the "pen off" if we are stopping with the pen still active */ 234 /* Send the "pen off" if we are stopping with the pen still active */
@@ -356,7 +251,7 @@ static int ucb1400_ts_thread(void *_ucb)
356 */ 251 */
357static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid) 252static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid)
358{ 253{
359 struct ucb1400 *ucb = devid; 254 struct ucb1400_ts *ucb = devid;
360 255
361 if (irqnr == ucb->irq) { 256 if (irqnr == ucb->irq) {
362 disable_irq(ucb->irq); 257 disable_irq(ucb->irq);
@@ -369,7 +264,7 @@ static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid)
369 264
370static int ucb1400_ts_open(struct input_dev *idev) 265static int ucb1400_ts_open(struct input_dev *idev)
371{ 266{
372 struct ucb1400 *ucb = input_get_drvdata(idev); 267 struct ucb1400_ts *ucb = input_get_drvdata(idev);
373 int ret = 0; 268 int ret = 0;
374 269
375 BUG_ON(ucb->ts_task); 270 BUG_ON(ucb->ts_task);
@@ -385,34 +280,14 @@ static int ucb1400_ts_open(struct input_dev *idev)
385 280
386static void ucb1400_ts_close(struct input_dev *idev) 281static void ucb1400_ts_close(struct input_dev *idev)
387{ 282{
388 struct ucb1400 *ucb = input_get_drvdata(idev); 283 struct ucb1400_ts *ucb = input_get_drvdata(idev);
389 284
390 if (ucb->ts_task) 285 if (ucb->ts_task)
391 kthread_stop(ucb->ts_task); 286 kthread_stop(ucb->ts_task);
392 287
393 ucb1400_ts_irq_disable(ucb); 288 ucb1400_ts_irq_disable(ucb->ac97);
394 ucb1400_reg_write(ucb, UCB_TS_CR, 0); 289 ucb1400_reg_write(ucb->ac97, UCB_TS_CR, 0);
395}
396
397#ifdef CONFIG_PM
398static int ucb1400_ts_resume(struct device *dev)
399{
400 struct ucb1400 *ucb = dev_get_drvdata(dev);
401
402 if (ucb->ts_task) {
403 /*
404 * Restart the TS thread to ensure the
405 * TS interrupt mode is set up again
406 * after sleep.
407 */
408 ucb->ts_restart = 1;
409 wake_up(&ucb->ts_wait);
410 }
411 return 0;
412} 290}
413#else
414#define ucb1400_ts_resume NULL
415#endif
416 291
417#ifndef NO_IRQ 292#ifndef NO_IRQ
418#define NO_IRQ 0 293#define NO_IRQ 0
@@ -422,25 +297,26 @@ static int ucb1400_ts_resume(struct device *dev)
422 * Try to probe our interrupt, rather than relying on lots of 297 * Try to probe our interrupt, rather than relying on lots of
423 * hard-coded machine dependencies. 298 * hard-coded machine dependencies.
424 */ 299 */
425static int ucb1400_detect_irq(struct ucb1400 *ucb) 300static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb)
426{ 301{
427 unsigned long mask, timeout; 302 unsigned long mask, timeout;
428 303
429 mask = probe_irq_on(); 304 mask = probe_irq_on();
430 305
431 /* Enable the ADC interrupt. */ 306 /* Enable the ADC interrupt. */
432 ucb1400_reg_write(ucb, UCB_IE_RIS, UCB_IE_ADC); 307 ucb1400_reg_write(ucb->ac97, UCB_IE_RIS, UCB_IE_ADC);
433 ucb1400_reg_write(ucb, UCB_IE_FAL, UCB_IE_ADC); 308 ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, UCB_IE_ADC);
434 ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0xffff); 309 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0xffff);
435 ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0); 310 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0);
436 311
437 /* Cause an ADC interrupt. */ 312 /* Cause an ADC interrupt. */
438 ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA); 313 ucb1400_reg_write(ucb->ac97, UCB_ADC_CR, UCB_ADC_ENA);
439 ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA | UCB_ADC_START); 314 ucb1400_reg_write(ucb->ac97, UCB_ADC_CR, UCB_ADC_ENA | UCB_ADC_START);
440 315
441 /* Wait for the conversion to complete. */ 316 /* Wait for the conversion to complete. */
442 timeout = jiffies + HZ/2; 317 timeout = jiffies + HZ/2;
443 while (!(ucb1400_reg_read(ucb, UCB_ADC_DATA) & UCB_ADC_DAT_VALID)) { 318 while (!(ucb1400_reg_read(ucb->ac97, UCB_ADC_DATA) &
319 UCB_ADC_DAT_VALID)) {
444 cpu_relax(); 320 cpu_relax();
445 if (time_after(jiffies, timeout)) { 321 if (time_after(jiffies, timeout)) {
446 printk(KERN_ERR "ucb1400: timed out in IRQ probe\n"); 322 printk(KERN_ERR "ucb1400: timed out in IRQ probe\n");
@@ -448,13 +324,13 @@ static int ucb1400_detect_irq(struct ucb1400 *ucb)
448 return -ENODEV; 324 return -ENODEV;
449 } 325 }
450 } 326 }
451 ucb1400_reg_write(ucb, UCB_ADC_CR, 0); 327 ucb1400_reg_write(ucb->ac97, UCB_ADC_CR, 0);
452 328
453 /* Disable and clear interrupt. */ 329 /* Disable and clear interrupt. */
454 ucb1400_reg_write(ucb, UCB_IE_RIS, 0); 330 ucb1400_reg_write(ucb->ac97, UCB_IE_RIS, 0);
455 ucb1400_reg_write(ucb, UCB_IE_FAL, 0); 331 ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, 0);
456 ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0xffff); 332 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0xffff);
457 ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0); 333 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0);
458 334
459 /* Read triggered interrupt. */ 335 /* Read triggered interrupt. */
460 ucb->irq = probe_irq_off(mask); 336 ucb->irq = probe_irq_off(mask);
@@ -464,36 +340,25 @@ static int ucb1400_detect_irq(struct ucb1400 *ucb)
464 return 0; 340 return 0;
465} 341}
466 342
467static int ucb1400_ts_probe(struct device *dev) 343static int ucb1400_ts_probe(struct platform_device *dev)
468{ 344{
469 struct ucb1400 *ucb; 345 int error, x_res, y_res;
470 struct input_dev *idev; 346 struct ucb1400_ts *ucb = dev->dev.platform_data;
471 int error, id, x_res, y_res;
472 347
473 ucb = kzalloc(sizeof(struct ucb1400), GFP_KERNEL); 348 ucb->ts_idev = input_allocate_device();
474 idev = input_allocate_device(); 349 if (!ucb->ts_idev) {
475 if (!ucb || !idev) {
476 error = -ENOMEM; 350 error = -ENOMEM;
477 goto err_free_devs; 351 goto err;
478 } 352 }
479 353
480 ucb->ts_idev = idev; 354 error = ucb1400_ts_detect_irq(ucb);
481 ucb->adcsync = adcsync;
482 ucb->ac97 = to_ac97_t(dev);
483 init_waitqueue_head(&ucb->ts_wait);
484
485 id = ucb1400_reg_read(ucb, UCB_ID);
486 if (id != UCB_ID_1400) {
487 error = -ENODEV;
488 goto err_free_devs;
489 }
490
491 error = ucb1400_detect_irq(ucb);
492 if (error) { 355 if (error) {
493 printk(KERN_ERR "UCB1400: IRQ probe failed\n"); 356 printk(KERN_ERR "UCB1400: IRQ probe failed\n");
494 goto err_free_devs; 357 goto err_free_devs;
495 } 358 }
496 359
360 init_waitqueue_head(&ucb->ts_wait);
361
497 error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING, 362 error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING,
498 "UCB1400", ucb); 363 "UCB1400", ucb);
499 if (error) { 364 if (error) {
@@ -503,80 +368,101 @@ static int ucb1400_ts_probe(struct device *dev)
503 } 368 }
504 printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq); 369 printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq);
505 370
506 input_set_drvdata(idev, ucb); 371 input_set_drvdata(ucb->ts_idev, ucb);
507 372
508 idev->dev.parent = dev; 373 ucb->ts_idev->dev.parent = &dev->dev;
509 idev->name = "UCB1400 touchscreen interface"; 374 ucb->ts_idev->name = "UCB1400 touchscreen interface";
510 idev->id.vendor = ucb1400_reg_read(ucb, AC97_VENDOR_ID1); 375 ucb->ts_idev->id.vendor = ucb1400_reg_read(ucb->ac97,
511 idev->id.product = id; 376 AC97_VENDOR_ID1);
512 idev->open = ucb1400_ts_open; 377 ucb->ts_idev->id.product = ucb->id;
513 idev->close = ucb1400_ts_close; 378 ucb->ts_idev->open = ucb1400_ts_open;
514 idev->evbit[0] = BIT_MASK(EV_ABS); 379 ucb->ts_idev->close = ucb1400_ts_close;
380 ucb->ts_idev->evbit[0] = BIT_MASK(EV_ABS);
515 381
516 ucb1400_adc_enable(ucb); 382 ucb1400_adc_enable(ucb->ac97);
517 x_res = ucb1400_ts_read_xres(ucb); 383 x_res = ucb1400_ts_read_xres(ucb);
518 y_res = ucb1400_ts_read_yres(ucb); 384 y_res = ucb1400_ts_read_yres(ucb);
519 ucb1400_adc_disable(ucb); 385 ucb1400_adc_disable(ucb->ac97);
520 printk(KERN_DEBUG "UCB1400: x/y = %d/%d\n", x_res, y_res); 386 printk(KERN_DEBUG "UCB1400: x/y = %d/%d\n", x_res, y_res);
521 387
522 input_set_abs_params(idev, ABS_X, 0, x_res, 0, 0); 388 input_set_abs_params(ucb->ts_idev, ABS_X, 0, x_res, 0, 0);
523 input_set_abs_params(idev, ABS_Y, 0, y_res, 0, 0); 389 input_set_abs_params(ucb->ts_idev, ABS_Y, 0, y_res, 0, 0);
524 input_set_abs_params(idev, ABS_PRESSURE, 0, 0, 0, 0); 390 input_set_abs_params(ucb->ts_idev, ABS_PRESSURE, 0, 0, 0, 0);
525 391
526 error = input_register_device(idev); 392 error = input_register_device(ucb->ts_idev);
527 if (error) 393 if (error)
528 goto err_free_irq; 394 goto err_free_irq;
529 395
530 dev_set_drvdata(dev, ucb);
531 return 0; 396 return 0;
532 397
533 err_free_irq: 398err_free_irq:
534 free_irq(ucb->irq, ucb); 399 free_irq(ucb->irq, ucb);
535 err_free_devs: 400err_free_devs:
536 input_free_device(idev); 401 input_free_device(ucb->ts_idev);
537 kfree(ucb); 402err:
538 return error; 403 return error;
404
539} 405}
540 406
541static int ucb1400_ts_remove(struct device *dev) 407static int ucb1400_ts_remove(struct platform_device *dev)
542{ 408{
543 struct ucb1400 *ucb = dev_get_drvdata(dev); 409 struct ucb1400_ts *ucb = dev->dev.platform_data;
544 410
545 free_irq(ucb->irq, ucb); 411 free_irq(ucb->irq, ucb);
546 input_unregister_device(ucb->ts_idev); 412 input_unregister_device(ucb->ts_idev);
547 dev_set_drvdata(dev, NULL);
548 kfree(ucb);
549 return 0; 413 return 0;
550} 414}
551 415
552static struct device_driver ucb1400_ts_driver = { 416#ifdef CONFIG_PM
553 .name = "ucb1400_ts", 417static int ucb1400_ts_resume(struct platform_device *dev)
554 .owner = THIS_MODULE, 418{
555 .bus = &ac97_bus_type, 419 struct ucb1400_ts *ucb = platform_get_drvdata(dev);
556 .probe = ucb1400_ts_probe, 420
557 .remove = ucb1400_ts_remove, 421 if (ucb->ts_task) {
558 .resume = ucb1400_ts_resume, 422 /*
423 * Restart the TS thread to ensure the
424 * TS interrupt mode is set up again
425 * after sleep.
426 */
427 ucb->ts_restart = 1;
428 wake_up(&ucb->ts_wait);
429 }
430 return 0;
431}
432#else
433#define ucb1400_ts_resume NULL
434#endif
435
436static struct platform_driver ucb1400_ts_driver = {
437 .probe = ucb1400_ts_probe,
438 .remove = ucb1400_ts_remove,
439 .resume = ucb1400_ts_resume,
440 .driver = {
441 .name = "ucb1400_ts",
442 },
559}; 443};
560 444
561static int __init ucb1400_ts_init(void) 445static int __init ucb1400_ts_init(void)
562{ 446{
563 return driver_register(&ucb1400_ts_driver); 447 return platform_driver_register(&ucb1400_ts_driver);
564} 448}
565 449
566static void __exit ucb1400_ts_exit(void) 450static void __exit ucb1400_ts_exit(void)
567{ 451{
568 driver_unregister(&ucb1400_ts_driver); 452 platform_driver_unregister(&ucb1400_ts_driver);
569} 453}
570 454
571module_param(adcsync, bool, 0444); 455module_param(adcsync, bool, 0444);
572MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin."); 456MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin.");
573 457
574module_param(ts_delay, int, 0444); 458module_param(ts_delay, int, 0444);
575MODULE_PARM_DESC(ts_delay, "Delay between panel setup and position read. Default = 55us."); 459MODULE_PARM_DESC(ts_delay, "Delay between panel setup and"
460 " position read. Default = 55us.");
576 461
577module_param(ts_delay_pressure, int, 0444); 462module_param(ts_delay_pressure, int, 0444);
578MODULE_PARM_DESC(ts_delay_pressure, 463MODULE_PARM_DESC(ts_delay_pressure,
579 "delay between panel setup and pressure read. Default = 0us."); 464 "delay between panel setup and pressure read."
465 " Default = 0us.");
580 466
581module_init(ucb1400_ts_init); 467module_init(ucb1400_ts_init);
582module_exit(ucb1400_ts_exit); 468module_exit(ucb1400_ts_exit);
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index 9ce3b3baf3a2..3ab6362f043c 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -335,11 +335,11 @@ static struct xenbus_driver xenkbd = {
335 335
336static int __init xenkbd_init(void) 336static int __init xenkbd_init(void)
337{ 337{
338 if (!is_running_on_xen()) 338 if (!xen_domain())
339 return -ENODEV; 339 return -ENODEV;
340 340
341 /* Nothing to do if running in dom0. */ 341 /* Nothing to do if running in dom0. */
342 if (is_initial_xendomain()) 342 if (xen_initial_domain())
343 return -ENODEV; 343 return -ENODEV;
344 344
345 return xenbus_register_frontend(&xenkbd); 345 return xenbus_register_frontend(&xenkbd);