From patchwork Sat May 14 06:46:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4PigLByaWMgUGllbA==?= X-Patchwork-Id: 784972 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4EB8Fmu009023 for ; Sat, 14 May 2011 11:08:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755723Ab1ENLIQ (ORCPT ); Sat, 14 May 2011 07:08:16 -0400 Received: from mailservice.tudelft.nl ([130.161.131.5]:55141 "EHLO mailservice.tudelft.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755951Ab1ENLIM (ORCPT ); Sat, 14 May 2011 07:08:12 -0400 Received: from localhost (localhost [127.0.0.1]) by amavis (Postfix) with ESMTP id 587D6108C062; Sat, 14 May 2011 12:43:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at tudelft.nl X-Spam-Flag: NO X-Spam-Score: -9.315 X-Spam-Level: X-Spam-Status: No, score=-9.315 tagged_above=-99 required=5 tests=[BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, PROLO_LEO3=0.01, RCVD_IN_PBL=10, RCVD_IN_SORBS_DUL=0.001, RDNS_DYNAMIC=0.982, TUD_REL01=-20] autolearn=ham Received: from mailservice.tudelft.nl ([130.161.131.74]) by localhost (tudelft.nl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id BWjAQotFv7Fw; Sat, 14 May 2011 12:43:09 +0200 (CEST) Received: from smtp-a.tudelft.nl (smtp-a.tudelft.nl [130.161.180.7]) by mx3.tudelft.nl (Postfix) with ESMTP id 7A730108C063; Sat, 14 May 2011 12:43:09 +0200 (CEST) Received: from [192.168.1.33] (212-123-168-131.ip.telfort.nl [212.123.168.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-a.tudelft.nl (Postfix) with ESMTP id 1F782B3A62; Sat, 14 May 2011 12:43:09 +0200 (CEST) Message-ID: <4DCE252E.2040403@tudelft.nl> Date: Sat, 14 May 2011 08:46:06 +0200 From: =?ISO-8859-1?Q?=C9ric_Piel?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Mandriva/3.1.10-1 (2011.0) Thunderbird/3.1.10 MIME-Version: 1.0 To: Dmitry Torokhov CC: "linux-input@vger.kernel.org" , Henrik Rydberg , Chris Bagwell , Florian Ragwitz Subject: [PATCH 2/6] elantech: distinguish various hardware/firmware versions 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.6 (demeter2.kernel.org [140.211.167.43]); Sat, 14 May 2011 11:08:17 +0000 (UTC) According to the protocol document, there are a couple of different versions of the hardware and firmware. Using the version number, it should be possible to distinguish between them, at least for the properties we care about. Signed-off-by: Éric Piel --- drivers/input/mouse/elantech.c | 34 +++++++++++++++++++++------------- drivers/input/mouse/elantech.h | 10 +++++++++- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 04d9bf3..badb2ea 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -719,15 +719,32 @@ int elantech_init(struct psmouse *psmouse) * Assume every version greater than this is new EeePC style * hardware with 6 byte packets */ - if (etd->fw_version >= 0x020030) { + if (etd->fw_version >= 0x020800) { etd->hw_version = 2; /* For now show extra debug information */ etd->debug = 1; - /* Don't know how to do parity checking for version 2 */ - etd->paritycheck = 0; + etd->paritycheck = ETP_CONST_CHECK; + etd->reports_pres = 1; + } else if (etd->fw_version == 0x020030) { + etd->hw_version = 2; + /* For now show extra debug information */ + etd->debug = 1; + etd->paritycheck = ETP_EF113_CHECK; + etd->reports_pres = 0; + } else if ((etd->fw_version == 0x020022) || (etd->fw_version == 0x020600)) { + /* + * This firmware suffers from misreporting coordinates when + * a touch action starts causing the mouse cursor or scrolled page + * to jump. Enable a workaround. + */ + pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n"); + etd->jumpy_cursor = 1; + etd->debug = 1; + etd->hw_version = 1; + etd->paritycheck = ETP_FULL_PC; } else { etd->hw_version = 1; - etd->paritycheck = 1; + etd->paritycheck = ETP_FULL_PC; } pr_info("assuming hardware version %d, firmware version %d.%d.%d\n", @@ -741,15 +758,6 @@ int elantech_init(struct psmouse *psmouse) param[0], param[1], param[2]); etd->capabilities = param[0]; - /* - * This firmware suffers from misreporting coordinates when - * a touch action starts causing the mouse cursor or scrolled page - * to jump. Enable a workaround. - */ - if (etd->fw_version == 0x020022 || etd->fw_version == 0x020600) { - pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n"); - etd->jumpy_cursor = true; - } if (elantech_set_absolute_mode(psmouse)) { pr_err("failed to put touchpad into absolute mode.\n"); diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index aa4aac5..257d419 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -100,14 +100,22 @@ struct elantech_data { unsigned char reg_26; unsigned char debug; unsigned char capabilities; - bool paritycheck; + unsigned char paritycheck; bool jumpy_cursor; + unsigned char reports_pres :1; unsigned char hw_version; unsigned int fw_version; unsigned int single_finger_reports; unsigned char parity[256]; }; +enum paritycheck_types { + ETP_NOT_CHECK = 0, + ETP_FULL_PC, /* used in 4-byte protocol */ + ETP_EF113_CHECK, /* check used only on the EF113 */ + ETP_CONST_CHECK, /* used in 6-byte protocol, only checking constant bits */ +}; + #ifdef CONFIG_MOUSE_PS2_ELANTECH int elantech_detect(struct psmouse *psmouse, bool set_properties); int elantech_init(struct psmouse *psmouse);