Received: by 10.213.65.68 with SMTP id h4csp2367552imn; Mon, 9 Apr 2018 02:15:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lEErhZLETzy3qY2Fb/Ra38bOQ1wpP2SeDdflOL4tlpwDojT4yrcubVWMAt8EZaO8otK3l X-Received: by 10.101.97.208 with SMTP id j16mr24733348pgv.431.1523265301024; Mon, 09 Apr 2018 02:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523265300; cv=none; d=google.com; s=arc-20160816; b=GcE1h6a7strU20WUsI6fpbRClGkSi3F0SKTwLeyhV3yT2XjuaFgVPGj5d5+BX0X8BU 22Maosaf3cz6auw2DKRQ1UPJv1qgzmpQrkPgkH9BRUDjLmO8J/2sbZHp3TBauyEB7hgj qmtkxU53DbLklINQyg1YrTtjEhRodCFBfTorQcFUhN/qZME/V9cGhEoG8PT/tlOkJpdi qomgFeiDlYf5c6xPbPaHAA6RNS8PL3MAxOT9307UgYQ/e8ZElUmEiLGmQTd5WQpteCYI 0F3B4a6L8+HUL4yO/NTH8jnSGVxOYYItRW0n+N4AEC4U9LYMgLzp5Qzk4nk1WuiIAAZ4 3GmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=7ZbtGn4SicSrKdX2FwifkQsxoLQbhWyoTrJBBvhzj1k=; b=mNuH55yo+BnwyCXs0hkwsa9L+N9EmmrkeshODStTysNqlLeTzRM1/fmgvR6pqiVDyt 8H7KBPjiaDWAqT3wop47OYsLcxVwDC2dhs/hTmxZBem2Z554mVSLwfQlwxLaIHGcfZ/R V5JmbUrkvlc/aqQ1TjfnokM04Ygmjn5tMrHDdsuUNulLp8OvgUPxsQeMDdNDo+iC+toL qzIHJ7rgXJZy1Q11Wzk0Fp2tXaUZmL1gY4OSYSV6X84iW6grAIVGefu8bqNJq+aqHtz8 ustW08QlqzS+GlhilGaZhr+SBg71hpdmtWq291BsO/8OS3Avp3qLmhgtTFhRL9q301n6 PIWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f67si6617466pgc.114.2018.04.09.02.14.22; Mon, 09 Apr 2018 02:15:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752211AbeDIJLZ (ORCPT + 99 others); Mon, 9 Apr 2018 05:11:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751348AbeDIJLV (ORCPT ); Mon, 9 Apr 2018 05:11:21 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1DD640201A3; Mon, 9 Apr 2018 09:11:20 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-117-29.ams2.redhat.com [10.36.117.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13C2CD7E07; Mon, 9 Apr 2018 09:11:14 +0000 (UTC) From: Benjamin Tissoires To: Dmitry Torokhov Cc: kt.liao@emc.com.tw, Oliver Haessler , Benjamin Berg , Rob Herring , devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH v2 8/9] Input: elantech - detect new ICs and setup Host Notify for them Date: Mon, 9 Apr 2018 11:10:50 +0200 Message-Id: <20180409091051.2944-9-benjamin.tissoires@redhat.com> In-Reply-To: <20180409091051.2944-1-benjamin.tissoires@redhat.com> References: <20180409091051.2944-1-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 09 Apr 2018 09:11:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 09 Apr 2018 09:11:21 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'benjamin.tissoires@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org New ICs are using a different scheme for the alternate bus parameter. Given that they are new and are only using either PS2 only or PS2 + SMBus Host Notify, we force those new ICs to use the SMBus solution for enhanced reporting. This allows the touchpad found on the Lenovo T480s to report 5 fingers every 8 ms, instead of having a limit of 2 every 8 ms. Signed-off-by: Benjamin Tissoires --- no changes in v2 drivers/input/mouse/elantech.c | 11 +++++++---- drivers/input/mouse/elantech.h | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 510e7c0622d3..07e40a58e66c 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1793,11 +1793,11 @@ static int elantech_setup_smbus(struct psmouse *psmouse, if (elantech_smbus == ELANTECH_SMBUS_NOT_SET) { /* - * FIXME: - * constraint the I2C capable devices by using FW version, - * board version, or by using DMI matching + * New ICs are enabled by default. + * Old ICs are up to the user to decide. */ - return -ENXIO; + if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) + return -ENXIO; } psmouse_info(psmouse, "Trying to set up SMBus access\n"); @@ -1818,6 +1818,9 @@ static int elantech_setup_smbus(struct psmouse *psmouse, static bool elantech_use_host_notify(struct psmouse *psmouse, struct elantech_device_info *info) { + if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) + return true; + switch (info->bus) { case ETP_BUS_PS2_ONLY: /* expected case */ diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index f9b1c485e8d9..119727085a60 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -115,6 +115,21 @@ #define ETP_BUS_PS2_SMB_ALERT 3 #define ETP_BUS_PS2_SMB_HST_NTFY 4 +/* + * New ICs are either using SMBus Host Notify or just plain PS2. + * + * ETP_FW_VERSION_QUERY is: + * Byte 1: + * - bit 0..3: IC BODY + * Byte 2: + * - bit 4: HiddenButton + * - bit 5: PS2_SMBUS_NOTIFY + * - bit 6: PS2CRCCheck + */ +#define ETP_NEW_IC_SMBUS_HOST_NOTIFY(fw_version) \ + ((((fw_version) & 0x0f2000) == 0x0f2000) && \ + ((fw_version) & 0x0000ff) > 0) + /* * The base position for one finger, v4 hardware */ -- 2.14.3