aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-11-15 04:33:22 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-11-15 04:33:51 -0500
commit34caed2082105a6d9f5aaba1cf4e02760cbee14e (patch)
tree188404bdeb8741de297419f73bd9fcf5efb54d6b /drivers/input/mouse
parent67f56bb0f4997b55291c162077e02e4f29639fc2 (diff)
Input: hgpk - recalibration tweaks
Disable the recalibration guard where new recalibrations are triggered if we detect a packet too soon after calibrating - we found that this results in erroneous recalibrations, and if the recalibration failed then the rest of our badness-detection code will request another. Add a module option disabling all of the recalibration code, in case an OLPC deployment thinks all of the workarounds we have are doing more damage than good and wants to experiment with them all disabled. Based on work by Paul Fox. Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/hgpk.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index 7f6cb32d177a..1beb5da4f0f3 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -62,16 +62,20 @@ module_param(spew_delay, int, 0644);
62MODULE_PARM_DESC(spew_delay, 62MODULE_PARM_DESC(spew_delay,
63 "delay (ms) before recal after packet spew detected"); 63 "delay (ms) before recal after packet spew detected");
64 64
65static int recal_guard_time = 2000; 65static int recal_guard_time;
66module_param(recal_guard_time, int, 0644); 66module_param(recal_guard_time, int, 0644);
67MODULE_PARM_DESC(recal_guard_time, 67MODULE_PARM_DESC(recal_guard_time,
68 "interval (ms) during which recal will be restarted if packet received"); 68 "interval (ms) during which recal will be restarted if packet received");
69 69
70static int post_interrupt_delay = 1000; 70static int post_interrupt_delay = 40;
71module_param(post_interrupt_delay, int, 0644); 71module_param(post_interrupt_delay, int, 0644);
72MODULE_PARM_DESC(post_interrupt_delay, 72MODULE_PARM_DESC(post_interrupt_delay,
73 "delay (ms) before recal after recal interrupt detected"); 73 "delay (ms) before recal after recal interrupt detected");
74 74
75static bool autorecal = true;
76module_param(autorecal, bool, 0644);
77MODULE_PARM_DESC(autorecal, "enable recalibration in the driver");
78
75static char hgpk_mode_name[16]; 79static char hgpk_mode_name[16];
76module_param_string(hgpk_mode, hgpk_mode_name, sizeof(hgpk_mode_name), 0644); 80module_param_string(hgpk_mode, hgpk_mode_name, sizeof(hgpk_mode_name), 0644);
77MODULE_PARM_DESC(hgpk_mode, 81MODULE_PARM_DESC(hgpk_mode,
@@ -642,6 +646,13 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
642 if (psmouse->model < HGPK_MODEL_C) 646 if (psmouse->model < HGPK_MODEL_C)
643 return 0; 647 return 0;
644 648
649 if (!autorecal) {
650 hgpk_dbg(psmouse, "recalibrations disabled, ignoring\n");
651 return 0;
652 }
653
654 hgpk_dbg(psmouse, "recalibrating touchpad..\n");
655
645 /* we don't want to race with the irq handler, nor with resyncs */ 656 /* we don't want to race with the irq handler, nor with resyncs */
646 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); 657 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
647 658
@@ -662,13 +673,17 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
662 673
663 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); 674 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
664 675
676 if (tpdebug)
677 hgpk_dbg(psmouse, "touchpad reactivated\n");
678
665 /* 679 /*
666 * After we recalibrate, we shouldn't get any packets for 2s. If 680 * If we get packets right away after recalibrating, it's likely
667 * we do, it's likely that someone's finger was on the touchpad. 681 * that a finger was on the touchpad. If so, it's probably
668 * If someone's finger *was* on the touchpad, it's probably 682 * miscalibrated, so we optionally schedule another.
669 * miscalibrated. So, we should schedule another recalibration
670 */ 683 */
671 priv->recalib_window = jiffies + msecs_to_jiffies(recal_guard_time); 684 if (recal_guard_time)
685 priv->recalib_window = jiffies +
686 msecs_to_jiffies(recal_guard_time);
672 687
673 return 0; 688 return 0;
674} 689}
@@ -898,8 +913,6 @@ static void hgpk_recalib_work(struct work_struct *work)
898 struct hgpk_data *priv = container_of(w, struct hgpk_data, recalib_wq); 913 struct hgpk_data *priv = container_of(w, struct hgpk_data, recalib_wq);
899 struct psmouse *psmouse = priv->psmouse; 914 struct psmouse *psmouse = priv->psmouse;
900 915
901 hgpk_dbg(psmouse, "recalibrating touchpad..\n");
902
903 if (hgpk_force_recalibrate(psmouse)) 916 if (hgpk_force_recalibrate(psmouse))
904 hgpk_err(psmouse, "recalibration failed!\n"); 917 hgpk_err(psmouse, "recalibration failed!\n");
905} 918}