From patchwork Thu Sep 6 08:01:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tee Hao Wei X-Patchwork-Id: 10589985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6274D921 for ; Thu, 6 Sep 2018 08:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 444AE2A2F3 for ; Thu, 6 Sep 2018 08:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 357E72A5C3; Thu, 6 Sep 2018 08:01:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1A8E2A2F3 for ; Thu, 6 Sep 2018 08:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbeIFMfa (ORCPT ); Thu, 6 Sep 2018 08:35:30 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42619 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727750AbeIFMfa (ORCPT ); Thu, 6 Sep 2018 08:35:30 -0400 Received: by mail-pf1-f194.google.com with SMTP id l9-v6so4867708pff.9 for ; Thu, 06 Sep 2018 01:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in04.sg; s=google; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6yhTAeLxz42CaG90Y7tJcORUk2yR2Z7RGLpfJ/Nuit0=; b=cNNHpE1PoRvVQsJp1krThoGltj7EJPSwoEtRDkhlCUY3GtDaTk2MO+q220RXcIY4xN CTp7pPsuEPJSDND8CXeKflVL908Ql3RbOsRqM+kPJXlDDQoqJQmEPkEt063UysfWk13q WGJhmTSW2oDr0KKUqGDGb5uobjabGTK3CYB8nOqlPNd0o/OnV1G3AbtDHChcq8SdusJr qIHC/Le1PFp7+6F/3IH7aELPogBPcUFteDmSlgWgt/Rw5MAUyFIvQLV3wkjtL4obSuiv lVHifhFRcWFAbE9gQMRiOWhuIg/1g90wSlefc8euYUvJh7SuYvrM1efrO+jC6NpMz1Mn cXJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6yhTAeLxz42CaG90Y7tJcORUk2yR2Z7RGLpfJ/Nuit0=; b=AudJy/qxPqPOGgscY385SWc5OS73CdaJo2Hbauelkf/UgcyyCI9NOWOy4AyJ/1D5aW VCVgpTkRaJdpTnzYBSaPXBiuNwfSoYTw1gJbS439QG67hVKCpfPfj11rGmA3rQS8nrw5 pZyLo4YZFGwAz6IDYwSrV3zUyeUW5woieS31n3a7BTvIF4tMmRt00QzArjqEbYlRtIFz EpKTQXRrCdld6biWFhfo9dsn+8bKQVSKcbj0FrTmiNWh5hhqJYIJKH2YMr1TF/hkBPzW repygVdc/ZMr8+v4WVaPJ5TOZ/twAP4nt6EkWP8uIO6FEQiJdzWPiC1edU5AfWUcgu3E sPmA== X-Gm-Message-State: APzg51A+A3Vj9/rLjzcCo2qyAdt4lTLu66CMBHpdeDhypwux8FV3h3mp Dx4fDtKAIXHwVrPjdeVzTA+myg== X-Google-Smtp-Source: ANB0VdZnzXZGTCQk6MInwMlPE8v3DsOW5KygszBwoNFw04AB/GMdlOxVqkA++8Yz4YfFYPiTPQ/z3A== X-Received: by 2002:a63:2787:: with SMTP id n129-v6mr1521107pgn.220.1536220878186; Thu, 06 Sep 2018 01:01:18 -0700 (PDT) Received: from [172.31.137.197] ([137.132.45.72]) by smtp.gmail.com with ESMTPSA id h190-v6sm10168742pge.18.2018.09.06.01.01.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 01:01:17 -0700 (PDT) From: Hao Wei Tee Subject: elan_i2c trackpad on T480s not reporting as clickpad To: linux-input@vger.kernel.org References: <00a601d43e95$e5895960$b09c0c20$@emc.com.tw> Cc: =?utf-8?b?5buW5bSH5qau?= Message-ID: <961c2ef9-7917-2c32-d764-7089d8cb3480@in04.sg> Date: Thu, 6 Sep 2018 16:01:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <00a601d43e95$e5895960$b09c0c20$@emc.com.tw> Content-Language: en-US Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, I have a Lenovo T480s with an Elantech one-button trackpad (aka clickpad) but for some reason the kernel is not reporting it as a clickpad. It appears that the module checks the SM version for a bit and reports it as a clickpad if the bit is set, but my trackpad is reporting a SM version of 0, so the flag on L184 here[1] is false. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/tree/drivers/input/mouse/elan_i2c_smbus.c#n168 I am wondering if there is some other flag in some other field that may indicate this is a clickpad. Here is the other information reported by the trackpad: elan_i2c 6-0015: Elan Touchpad: Module ID: 0x0020, Firmware: 0x0001, Sample: 0x0000, IAP: 0x0000 elan_i2c 6-0015: Elan Touchpad Extra Information: Max ABS X,Y: 3052,1888 Width X,Y: 127,125 Resolution X,Y: 31,31 (dots/mm) ic type: 0x20 info pattern: 0x0 This crude patch setting `clickpad = 1` works fine on my T480s. I'm pretty sure there is some way to actually check for a clickpad instead of special-casing this particular module/product ID. --- Has anyone else run into this issue, or does anyone know anything about this? Thanks. -- Hao Wei diff --git a/elan_i2c_core.c b/elan_i2c_core.c index f5ae248..718cb19 100644 --- a/elan_i2c_core.c +++ b/elan_i2c_core.c @@ -241,6 +241,16 @@ static int elan_check_ASUS_special_fw(struct elan_tp_data *data) return false; } +static void elan_check_clickpad(struct elan_tp_data *data) +{ + if (data->ic_type == 0x20 + && data->product_id == 0x20 + && data->sm_version == 0) { + data->clickpad = 1; + } + return; +} + static int __elan_initialize(struct elan_tp_data *data) { struct i2c_client *client = data->client; @@ -257,6 +267,8 @@ static int __elan_initialize(struct elan_tp_data *data) if (error) return error; + elan_check_clickpad(data); + /* * Some ASUS devices were shipped with firmware that requires * touchpads to be woken up first, before attempting to switch