From patchwork Sun Aug 2 04:16:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Duson Lin X-Patchwork-Id: 6924701 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF3B49F373 for ; Sun, 2 Aug 2015 04:16:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1003204A2 for ; Sun, 2 Aug 2015 04:16:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 00CDF203C0 for ; Sun, 2 Aug 2015 04:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750861AbbHBEQr (ORCPT ); Sun, 2 Aug 2015 00:16:47 -0400 Received: from elanic.emc.com.tw ([192.72.220.188]:43354 "EHLO elanic.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbbHBEQr convert rfc822-to-8bit (ORCPT ); Sun, 2 Aug 2015 00:16:47 -0400 Received: from [192.168.33.24] (emcm129.emc.com.tw [192.72.220.129] (may be forged)) (authenticated bits=0) by elanic.emc.com.tw (8.13.8/8.13.8) with ESMTP id t724GbOw004502; Sun, 2 Aug 2015 12:16:37 +0800 From: duson Subject: [PATCH 3/3] Input - elantech: Add special check for fw_version 0x470f01 touchpad Date: Sun, 2 Aug 2015 12:16:41 +0800 Message-Id: Cc: dusonlin@emc.com.tw To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Torokhov Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) X-Mailer: Apple Mail (2.2102) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is no need to check the packet[0] for sanity check when doing elantech_packet_check_v4() function for fw_version = 0x470f01 touchpad. Signed-off by: Duson Lin Reviewed-by: Ulrik De Bie Reviewed-by: Ulrik De Bie --- drivers/input/mouse/elantech.c | 28 +++++++++++++++++++++++++--- drivers/input/mouse/elantech.h | 1 + 2 files changed, 26 insertions(+), 3 deletions(-) -- -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 22b9ca9..5bc3d55 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -785,6 +785,9 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) unsigned char packet_type = packet[3] & 0x03; bool sanity_check; + /* This represents the version of IC body. */ + int ver = (etd->fw_version & 0x0f0000) >> 16; + if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) return PACKET_TRACKPOINT; @@ -796,9 +799,17 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) */ if (etd->crc_enabled) sanity_check = ((packet[3] & 0x08) == 0x00); - else - sanity_check = ((packet[0] & 0x0c) == 0x04 && - (packet[3] & 0x1c) == 0x10); + else { + /* + * The sanity check only need to check packet[3] + * when IC_body = 7 and PID = 0x2A + */ + if (ver == 7 && etd->samples[1] == 0x2A) + sanity_check = ((packet[3] & 0x1c) == 0x10); + else + sanity_check = ((packet[0] & 0x0c) == 0x04 && + (packet[3] & 0x1c) == 0x10); + } if (!sanity_check) return PACKET_UNKNOWN; @@ -1116,6 +1127,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, * Avatar AVIU-145A2 0x361f00 ? clickpad * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons + * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) @@ -1651,6 +1663,16 @@ int elantech_init(struct psmouse *psmouse) etd->capabilities[0], etd->capabilities[1], etd->capabilities[2]); + if (etd->hw_version != 1) { + if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) { + psmouse_err(psmouse, "failed to query sample data\n"); + goto init_fail; + } + psmouse_info(psmouse, + "Elan sample query result %02x, %02x, %02x\n", + etd->samples[0], etd->samples[1], etd->samples[2]); + } + if (elantech_set_absolute_mode(psmouse)) { psmouse_err(psmouse, "failed to put touchpad into absolute mode.\n"); diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index f965d15..e1cbf40 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -129,6 +129,7 @@ struct elantech_data { unsigned char reg_26; unsigned char debug; unsigned char capabilities[3]; + unsigned char samples[3]; bool paritycheck; bool jumpy_cursor; bool reports_pressure;