aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-14 23:51:54 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-22 23:23:35 -0400
commit1e0c5b1275a0e59747349745da8778523a9dcd18 (patch)
treed04a856ddbc15256436ba2ee521b8bc094be3e43 /drivers
parentc0338c15973c1b6de2b42808a071bf3af948d595 (diff)
Input: ALPS - force stream mode
ALPS appears to need SETSTREAM command after reset, otherwise it does not produce any data. Now that we do not request stream mode by default individual drivers need to take care of it. [Jason Riedy <ejr@cs.berkeley.edu> - fix oops] Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mouse/alps.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cf3e4664e72b..2c5f11a4f6b4 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -251,11 +251,15 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
251 251
252 dbg("E7 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]); 252 dbg("E7 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]);
253 253
254 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++); 254 if (version) {
255 *version = (param[0] << 8) | (param[1] << 4) | i; 255 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++)
256 /* empty */;
257 *version = (param[0] << 8) | (param[1] << 4) | i;
258 }
256 259
257 for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) 260 for (i = 0; i < ARRAY_SIZE(alps_model_data); i++)
258 if (!memcmp(param, alps_model_data[i].signature, sizeof(alps_model_data[i].signature))) 261 if (!memcmp(param, alps_model_data[i].signature,
262 sizeof(alps_model_data[i].signature)))
259 return alps_model_data + i; 263 return alps_model_data + i;
260 264
261 return NULL; 265 return NULL;
@@ -380,32 +384,46 @@ static int alps_poll(struct psmouse *psmouse)
380 return 0; 384 return 0;
381} 385}
382 386
383static int alps_reconnect(struct psmouse *psmouse) 387static int alps_hw_init(struct psmouse *psmouse, int *version)
384{ 388{
385 struct alps_data *priv = psmouse->private; 389 struct alps_data *priv = psmouse->private;
386 int version;
387
388 psmouse_reset(psmouse);
389 390
390 if (!(priv->i = alps_get_model(psmouse, &version))) 391 priv->i = alps_get_model(psmouse, version);
392 if (!priv->i)
391 return -1; 393 return -1;
392 394
393 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) 395 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
394 return -1; 396 return -1;
395 397
396 if (alps_tap_mode(psmouse, 1)) { 398 if (alps_tap_mode(psmouse, 1)) {
397 printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n"); 399 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
398 return -1; 400 return -1;
399 } 401 }
400 402
401 if (alps_absolute_mode(psmouse)) { 403 if (alps_absolute_mode(psmouse)) {
402 printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n"); 404 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
403 return -1; 405 return -1;
404 } 406 }
405 407
406 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0)) 408 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
407 return -1; 409 return -1;
408 410
411 /* ALPS needs stream mode, otherwise it won't report any data */
412 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) {
413 printk(KERN_ERR "alps.c: Failed to enable stream mode\n");
414 return -1;
415 }
416
417 return 0;
418}
419
420static int alps_reconnect(struct psmouse *psmouse)
421{
422 psmouse_reset(psmouse);
423
424 if (alps_hw_init(psmouse, NULL))
425 return -1;
426
409 return 0; 427 return 0;
410} 428}
411 429
@@ -430,23 +448,9 @@ int alps_init(struct psmouse *psmouse)
430 goto init_fail; 448 goto init_fail;
431 449
432 priv->dev2 = dev2; 450 priv->dev2 = dev2;
451 psmouse->private = priv;
433 452
434 priv->i = alps_get_model(psmouse, &version); 453 if (alps_hw_init(psmouse, &version))
435 if (!priv->i)
436 goto init_fail;
437
438 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
439 goto init_fail;
440
441 if (alps_tap_mode(psmouse, 1))
442 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
443
444 if (alps_absolute_mode(psmouse)) {
445 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
446 goto init_fail;
447 }
448
449 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
450 goto init_fail; 454 goto init_fail;
451 455
452 dev1->evbit[LONG(EV_KEY)] |= BIT(EV_KEY); 456 dev1->evbit[LONG(EV_KEY)] |= BIT(EV_KEY);
@@ -493,13 +497,13 @@ int alps_init(struct psmouse *psmouse)
493 /* We are having trouble resyncing ALPS touchpads so disable it for now */ 497 /* We are having trouble resyncing ALPS touchpads so disable it for now */
494 psmouse->resync_time = 0; 498 psmouse->resync_time = 0;
495 499
496 psmouse->private = priv;
497 return 0; 500 return 0;
498 501
499init_fail: 502init_fail:
500 psmouse_reset(psmouse); 503 psmouse_reset(psmouse);
501 input_free_device(dev2); 504 input_free_device(dev2);
502 kfree(priv); 505 kfree(priv);
506 psmouse->private = NULL;
503 return -1; 507 return -1;
504} 508}
505 509