From patchwork Tue Jan 8 07:30:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5buW5bSH5qau?= X-Patchwork-Id: 10751521 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 9B4B86C5 for ; Tue, 8 Jan 2019 07:40:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 888B828B65 for ; Tue, 8 Jan 2019 07:40:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C7BD28B6B; Tue, 8 Jan 2019 07:40:39 +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=-7.9 required=2.0 tests=BAYES_00,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 8F51528B65 for ; Tue, 8 Jan 2019 07:40:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727295AbfAHHki (ORCPT ); Tue, 8 Jan 2019 02:40:38 -0500 Received: from emcscan.emc.com.tw ([192.72.220.5]:24844 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727368AbfAHHki (ORCPT ); Tue, 8 Jan 2019 02:40:38 -0500 X-Greylist: delayed 585 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2019 02:40:37 EST Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with SMTP; 08 Jan 2019 15:30:50 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(2808:0:AUTH_RELAY) (envelope-from ); Tue, 08 Jan 2019 15:30:49 +0800 (CST) Received: from 192.168.82.59 by webmail.emc.com.tw with Mail2000 ESMTPA Server V7.00(2481:0:AUTH_LOGIN) (envelope-from ); Tue, 08 Jan 2019 15:30:48 +0800 (CST) From: KT Liao To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com, ulrik.debie-os@e2big.org Cc: kt.liao@emc.com.tw Subject: [PATCH] Input: elan_i2c - Add auto recovery handle for absolute mode Date: Tue, 8 Jan 2019 15:30:42 +0800 Message-Id: <1546932642-3621-1-git-send-email-kt.liao@emc.com.tw> X-Mailer: git-send-email 2.7.4 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 Sometimes touchpad will be reset to mouse mode unexpectedly. And cause invalid report detection. I add a mouse report detection and send mode-switching command again. Signed-off-by: KT Liao --- drivers/input/mouse/elan_i2c_core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 2690a4b..56b5766 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -51,6 +51,7 @@ #define ETP_MAX_FINGERS 5 #define ETP_FINGER_DATA_LEN 5 +#define ETP_MOUSE_REPORT_ID 0x01 #define ETP_REPORT_ID 0x5D #define ETP_TP_REPORT_ID 0x5E #define ETP_REPORT_ID_OFFSET 2 @@ -988,6 +989,14 @@ static irqreturn_t elan_isr(int irq, void *dev_id) case ETP_TP_REPORT_ID: elan_report_trackpoint(data, report); break; + case ETP_MOUSE_REPORT_ID: + dev_info(dev, "Mouse report now, mode switch again\n"); + data->mode |= ETP_ENABLE_ABS; + error = data->ops->set_mode(data->client, data->mode); + if (error) + dev_err(dev, "fail to switch to absolute mode(%d)\n", + error); + break; default: dev_err(dev, "invalid report id data (%x)\n", report[ETP_REPORT_ID_OFFSET]);