From patchwork Sat Aug 30 14:10:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrik De Bie X-Patchwork-Id: 4813521 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7C39DC0338 for ; Sat, 30 Aug 2014 14:11:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A93D2012D for ; Sat, 30 Aug 2014 14:11:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93C6A200E5 for ; Sat, 30 Aug 2014 14:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751732AbaH3OLf (ORCPT ); Sat, 30 Aug 2014 10:11:35 -0400 Received: from e2big.org ([198.61.226.133]:47767 "EHLO e2big.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751674AbaH3OLe (ORCPT ); Sat, 30 Aug 2014 10:11:34 -0400 Received: from 78-23-174-213.access.telenet.be ([78.23.174.213] helo=lantern.debie) by e2big.org with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1XNjNN-0001XH-GF; Sat, 30 Aug 2014 16:11:33 +0200 From: Ulrik De Bie To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Hans de Goede , David Herrmann , ulrik.debie-os@e2big.org Subject: [PATCH 2/5] Input: elantech - Fix crc_enabled for Fujitsu H730 Date: Sat, 30 Aug 2014 16:10:43 +0200 Message-Id: <1409407846-15449-3-git-send-email-ulrik.debie-os@e2big.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1409407846-15449-1-git-send-email-ulrik.debie-os@e2big.org> References: <1409407846-15449-1-git-send-email-ulrik.debie-os@e2big.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 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 The Fujitsu H730 does not work with crc_enabled = 0, even though the crc_enabled bit in the firmware version indicated it would. When switching this value to crc_enabled to 1, the touchpad works. This patch uses DMI to detect H730. Reported-by: Stefan Valouch Tested-by: Stefan Valouch Tested-by: Alfredo Gemma Signed-off-by: Ulrik De Bie --- drivers/input/mouse/elantech.c | 65 ++++++++++++++++++++++++++++++------------ drivers/input/mouse/elantech.h | 2 +- 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index f0a55b4d..67d56c0 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1235,6 +1235,52 @@ static int elantech_set_input_params(struct psmouse *psmouse) return 0; } +/* + * Some hw_version 3 models go into error state when we try to set + * bit 3 and/or bit 1 of r10. + */ +static const struct dmi_system_id no_hw_res_dmi_table[] = { +#if defined(CONFIG_DMI) && defined(CONFIG_X86) + { + /* Gigabyte U2442 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), + DMI_MATCH(DMI_PRODUCT_NAME, "U2442"), + }, + }, +#endif + { } +}; + +/* + * Some hw_version 4 models do not work with crc_disabled + */ +static const struct dmi_system_id elantech_dmi_crc_enabled[] = { +#if defined(CONFIG_DMI) && defined(CONFIG_X86) + { + /* Fujitsu H730 does not work with crc_enabled == 0 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), + }, + }, +#endif + { } +}; + +/* + * Autodetect crc_enabled and verify override DMI table + */ +static unsigned char elantech_detect_crc_enabled(struct elantech_data *etd) +{ + +#if defined(CONFIG_DMI) && defined(CONFIG_X86) + if (dmi_check_system(elantech_dmi_crc_enabled)) + return 1; +#endif /* CONFIG_X86 */ + + return ((etd->fw_version & 0x4000) == 0x4000); +} struct elantech_attr_data { size_t field_offset; unsigned char reg; @@ -1444,23 +1490,6 @@ static int elantech_reconnect(struct psmouse *psmouse) } /* - * Some hw_version 3 models go into error state when we try to set - * bit 3 and/or bit 1 of r10. - */ -static const struct dmi_system_id no_hw_res_dmi_table[] = { -#if defined(CONFIG_DMI) && defined(CONFIG_X86) - { - /* Gigabyte U2442 */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), - DMI_MATCH(DMI_PRODUCT_NAME, "U2442"), - }, - }, -#endif - { } -}; - -/* * determine hardware version and set some properties according to it. */ static int elantech_set_properties(struct elantech_data *etd) @@ -1518,7 +1547,7 @@ static int elantech_set_properties(struct elantech_data *etd) * The signatures of v3 and v4 packets change depending on the * value of this hardware flag. */ - etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000); + etd->crc_enabled = elantech_detect_crc_enabled(etd); /* Enable real hardware resolution on hw_version 3 ? */ etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index 6f3afec..c25127a 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -128,11 +128,11 @@ struct elantech_data { unsigned char reg_25; unsigned char reg_26; unsigned char debug; + unsigned char crc_enabled; unsigned char capabilities[3]; bool paritycheck; bool jumpy_cursor; bool reports_pressure; - bool crc_enabled; bool set_hw_resolution; unsigned char hw_version; unsigned int fw_version;