From patchwork Sat Nov 13 19:22:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 322732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oADJMfRp020060 for ; Sat, 13 Nov 2010 19:22:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932091Ab0KMTWU (ORCPT ); Sat, 13 Nov 2010 14:22:20 -0500 Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]:49836 "EHLO mtaout02-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932084Ab0KMTWT (ORCPT ); Sat, 13 Nov 2010 14:22:19 -0500 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20101113192217.OWWW19887.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Sat, 13 Nov 2010 19:22:17 +0000 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20101113192217.ROIS25842.aamtaout02-winn.ispmail.ntl.com@zog.reactivated.net>; Sat, 13 Nov 2010 19:22:17 +0000 Received: by zog.reactivated.net (Postfix, from userid 1000) id 21E189D401B; Sat, 13 Nov 2010 19:22:12 +0000 (GMT) From: Daniel Drake To: dmitry.torokhov@gmail.com To: dtor@mail.ru Cc: linux-input@vger.kernel.org Cc: pgf@laptop.org Subject: [PATCH 2/4] Input: hgpk - Recalibration tweaks Message-Id: <20101113192212.21E189D401B@zog.reactivated.net> Date: Sat, 13 Nov 2010 19:22:11 +0000 (GMT) X-Cloudmark-Analysis: v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=tfGYnyLG1m8A:10 a=Op-mwl0xAAAA:8 a=qO89GWZY1Lp3bbGKHikA:9 a=frYFaC4g-RTAGZf5UiIA:7 a=2J52Y2U_ca3SOtkapqxM7zrVR3QA:4 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 13 Nov 2010 19:22:41 +0000 (UTC) diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 7f6cb32..95cef49 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c @@ -62,16 +62,20 @@ module_param(spew_delay, int, 0644); MODULE_PARM_DESC(spew_delay, "delay (ms) before recal after packet spew detected"); -static int recal_guard_time = 2000; +static int recal_guard_time; module_param(recal_guard_time, int, 0644); MODULE_PARM_DESC(recal_guard_time, "interval (ms) during which recal will be restarted if packet received"); -static int post_interrupt_delay = 1000; +static int post_interrupt_delay = 40; module_param(post_interrupt_delay, int, 0644); MODULE_PARM_DESC(post_interrupt_delay, "delay (ms) before recal after recal interrupt detected"); +static int autorecal = 1; +module_param(autorecal, int, 0644); +MODULE_PARM_DESC(autorecal, "enable recalibration in the driver"); + static char hgpk_mode_name[16]; module_param_string(hgpk_mode, hgpk_mode_name, sizeof(hgpk_mode_name), 0644); MODULE_PARM_DESC(hgpk_mode, @@ -642,6 +646,13 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse) if (psmouse->model < HGPK_MODEL_C) return 0; + if (!autorecal) { + hgpk_dbg(psmouse, "recalibrations disabled, ignoring\n"); + return 0; + } + + hgpk_dbg(psmouse, "recalibrating touchpad..\n"); + /* we don't want to race with the irq handler, nor with resyncs */ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); @@ -662,13 +673,17 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse) psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); + if (tpdebug) + hgpk_dbg(psmouse, "touchpad reactivated\n"); + /* - * After we recalibrate, we shouldn't get any packets for 2s. If - * we do, it's likely that someone's finger was on the touchpad. - * If someone's finger *was* on the touchpad, it's probably - * miscalibrated. So, we should schedule another recalibration + * If we get packets right away after recalibrating, it's likely + * that a finger was on the touchpad. If so, it's probably + * miscalibrated, so we optionally schedule another. */ - priv->recalib_window = jiffies + msecs_to_jiffies(recal_guard_time); + if (recal_guard_time) + priv->recalib_window = jiffies + + msecs_to_jiffies(recal_guard_time); return 0; } @@ -898,8 +913,6 @@ static void hgpk_recalib_work(struct work_struct *work) struct hgpk_data *priv = container_of(w, struct hgpk_data, recalib_wq); struct psmouse *psmouse = priv->psmouse; - hgpk_dbg(psmouse, "recalibrating touchpad..\n"); - if (hgpk_force_recalibrate(psmouse)) hgpk_err(psmouse, "recalibration failed!\n"); }