From patchwork Mon Jun 21 21:03:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?w4PigLByaWMgUGllbA==?= X-Patchwork-Id: 107253 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5LL80UI017344 for ; Mon, 21 Jun 2010 21:08:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758567Ab0FUVIF (ORCPT ); Mon, 21 Jun 2010 17:08:05 -0400 Received: from mailservice.tudelft.nl ([130.161.131.5]:40218 "EHLO mailservice.tudelft.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758439Ab0FUVIC (ORCPT ); Mon, 21 Jun 2010 17:08:02 -0400 Received: from localhost (localhost [127.0.0.1]) by amavis (Postfix) with ESMTP id 17C0C108C17F; Mon, 21 Jun 2010 23:08:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at tudelft.nl X-Spam-Flag: NO X-Spam-Score: -12.589 X-Spam-Level: X-Spam-Status: No, score=-12.589 tagged_above=-99 required=5 tests=[BAYES_00=-2.599, PROLO_LEO3=0.01, TUD_REL01=-10] 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 ptQOu-ftm+BQ; Mon, 21 Jun 2010 23:08:01 +0200 (CEST) Received: from smtp-a.tudelft.nl (smtp-a.tudelft.nl [130.161.180.7]) by mx3.tudelft.nl (Postfix) with ESMTP id 18885108C179; Mon, 21 Jun 2010 23:08:01 +0200 (CEST) Received: from [172.19.3.21] (63-103-dsl.ipact.nl [84.35.103.63]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-a.tudelft.nl (Postfix) with ESMTP id DA8C8B3A62; Mon, 21 Jun 2010 23:08:00 +0200 (CEST) Message-ID: <4C1FD399.4000500@tudelft.nl> Date: Mon, 21 Jun 2010 23:03:21 +0200 From: =?UTF-8?B?w4lyaWMgUGllbA==?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100614 Mandriva/3.0.4-11mdv2010.1 (2010.1) Thunderbird/3.0.4 MIME-Version: 1.0 To: Dmitry Torokhov , "linux-input@vger.kernel.org" CC: Florian Ragwitz Subject: [PATCH 3/7] elantech: distinguish various hardware/firmware versions References: <4C1FD2B0.1080504@tudelft.nl> In-Reply-To: <4C1FD2B0.1080504@tudelft.nl> X-Enigmail-Version: 1.0.1 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 (demeter.kernel.org [140.211.167.41]); Mon, 21 Jun 2010 21:08:06 +0000 (UTC) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 1c1d065..f32ffda 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -709,15 +709,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; - /* Parity check is only for 4 byte protocol */ - 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", @@ -731,15 +748,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 = 1; - } 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 ac57bde..b98c3c2 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -101,12 +101,20 @@ struct elantech_data { unsigned char debug; unsigned char capabilities; unsigned char paritycheck; - unsigned char jumpy_cursor; + unsigned char jumpy_cursor :1; + unsigned char reports_pres :1; unsigned char hw_version; unsigned int fw_version; 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);