Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3180452ybt; Mon, 29 Jun 2020 17:59:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfZed1pRWT20RMj38T/WWrmkUC+uPVsw5KC8MrhKliD0T7aVsLmtur8ibRiuui7zfRQZel X-Received: by 2002:a05:6402:c82:: with SMTP id cm2mr8608630edb.293.1593478742658; Mon, 29 Jun 2020 17:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593478742; cv=none; d=google.com; s=arc-20160816; b=yBJ4zu+OKJWGrRSfJdv/OlfYVRlii5RGPa4coFUBXNJloARRM5jVZ/vyQmuPSRYAQG W+HXaJ4B0k1hCtNWkR4Deh1wvv8EAzo/sRZkE7TkE2pAx/kmbwDAaAGPheD3Zsjv53S+ uac+hmDVO0OMhW64cJYna+/brKK9GREPZFA7EJgozO6NqthaXYTwPoK+xKJ6ZBwx8ySW rkoI03bi24lTb530lgJPoErZFYGS1bbteS3yyJaRPLNfxgsHgVKOU6j/oy2hjwjRnikn HHbHwW2cIpBdfxW2tNd53qNwNvq1gQ1MaAuLTQ/RYmur8iJ3oRO9wdVAy38/afXB24UK Orjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=NeFvl6iJeeHf87XNSUTsRy0UAvKm2bIY45kmfTiQtuI=; b=AT0tH0X4VZuAgxph/8fx13iOxbPUCd8moRa6tO7IiaeK0BQ9Hy9MBkVR1bWOMvu1Bs 4AjEcIcapat0lYN3GtVsEHUuJvqhjScPGxjfy4U7kbOCxocsom/8WvbSSETrljW/AEem vplqEKviZZdhF6wRXN40lwJyKANFO6qSgbPG3ubEFtBLjDtiRJfzcPEyHqJhdG3hRnue Xx8e05sz0k6GSHlvyc3m3zoyxt5FxsudlcvZVv16GzpIkdxLttOBuAAf8x/BWGz/Pc/g vHx533njdHjKB6S1W3C+L7BlpxP9d9BYvDC5+1Y2XdgmTutJqKPtjgM6Ch781I/e81Kv mWKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chromium.org header.s=google header.b="O+qDhqp/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh3si877999ejb.490.2020.06.29.17.58.39; Mon, 29 Jun 2020 17:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@chromium.org header.s=google header.b="O+qDhqp/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbgF3A5T (ORCPT + 99 others); Mon, 29 Jun 2020 20:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725998AbgF3A5T (ORCPT ); Mon, 29 Jun 2020 20:57:19 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9829C061755 for ; Mon, 29 Jun 2020 17:57:17 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id h4so1688154plt.9 for ; Mon, 29 Jun 2020 17:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NeFvl6iJeeHf87XNSUTsRy0UAvKm2bIY45kmfTiQtuI=; b=O+qDhqp/9Z2C6la+HAURaKHJPO36NUGeQF/9Hch0nhYEfSMvLO07Qw7klPURSJEeOO dYLCsFV4aqtI89Cx6vOLLeGR1WaptX+zc45XrmOsoTaqLQpC8lzqW2NptyvATmcPrFEm hrMdn5IaZzALNyVub1B61JYK/T1QAh4ShI2m0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NeFvl6iJeeHf87XNSUTsRy0UAvKm2bIY45kmfTiQtuI=; b=XRzQTMbbNGIQUIe5HXUcbi8GL3+XCT0fCZjWuDDbRMtZmti38xddEfwnpW+2DLXYDU bgwxxjzgGaHemmKRWi8qLnfDZSIS8h/ynW4FzDcBfph1A8Y2TJK9k6o89TxNEhAsJ4Mq csIb9c4wVhl9KOu1Cj3ps2+E0XytJfeKm75tK/A2+OJ/kI+QwvhYSPki159e8+rfz0fM 82vap9pTvc7ok4M498g7lAX2hvhB6LOgVubK5eDnrl+SHaC+EqW6U3YO/fZn6whLW4Nr sIQsKPNKO/OQiKDkMN9hodUXbr7dstisr8p8iXSh5/8ZYQD1fodjT7VysINgUZAIEWwU Sl2g== X-Gm-Message-State: AOAM532aWaBw0JiLGHT2g/+kzOTSINb8IW5pAAh1/iZ9nsyGDZz35nE2 bX8ApGPXtm2n8wltwSV7IG9N2A== X-Received: by 2002:a17:902:fe11:: with SMTP id g17mr15242772plj.145.1593478637408; Mon, 29 Jun 2020 17:57:17 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id x7sm715732pfq.197.2020.06.29.17.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 17:57:16 -0700 (PDT) From: Derek Basehore Cc: dmitry.torokhov@gmail.com, dbasehore@chromium.org, jiada_wang@mentor.com, jeffrey.l.hugo@gmail.com, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: elan_i2c - only increment wakeup count on touch Date: Mon, 29 Jun 2020 17:57:07 -0700 Message-Id: <20200630005707.2181126-1-dbasehore@chromium.org> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This moves the wakeup increment for elan devices to the touch report. This prevents the drivers from incorrectly reporting a wakeup when the resume callback resets then device, which causes an interrupt to occur. This also avoids error messages when these interrupts occur, since this behavior is expected. Signed-off-by: Derek Basehore --- drivers/input/mouse/elan_i2c_core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index cdbe6b38c73c1..6ad53a75f9807 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -49,6 +49,7 @@ #define ETP_MAX_FINGERS 5 #define ETP_FINGER_DATA_LEN 5 +#define ETP_REPORT_LEN_OFFSET 0 #define ETP_REPORT_ID 0x5D #define ETP_TP_REPORT_ID 0x5E #define ETP_REPORT_ID_OFFSET 2 @@ -1018,6 +1019,8 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) u8 hover_info = packet[ETP_HOVER_INFO_OFFSET]; bool contact_valid, hover_event; + pm_wakeup_event(&data->client->dev, 0); + hover_event = hover_info & 0x40; for (i = 0; i < ETP_MAX_FINGERS; i++) { contact_valid = tp_info & (1U << (3 + i)); @@ -1041,6 +1044,8 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report) u8 *packet = &report[ETP_REPORT_ID_OFFSET + 1]; int x, y; + pm_wakeup_event(&data->client->dev, 0); + if (!data->tp_input) { dev_warn_once(&data->client->dev, "received a trackpoint report while no trackpoint device has been created. Please report upstream.\n"); @@ -1065,7 +1070,6 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report) static irqreturn_t elan_isr(int irq, void *dev_id) { struct elan_tp_data *data = dev_id; - struct device *dev = &data->client->dev; int error; u8 report[ETP_MAX_REPORT_LEN]; @@ -1083,7 +1087,13 @@ static irqreturn_t elan_isr(int irq, void *dev_id) if (error) goto out; - pm_wakeup_event(dev, 0); + /* + * Controllers may send a full length report on power on and reset + * cases. There are only meaningless bytes in these reports except for + * report[ETP_REPORT_LEN_OFFSET], which is 0. + */ + if (!report[ETP_REPORT_LEN_OFFSET]) + goto out; switch (report[ETP_REPORT_ID_OFFSET]) { case ETP_REPORT_ID: @@ -1093,7 +1103,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id) elan_report_trackpoint(data, report); break; default: - dev_err(dev, "invalid report id data (%x)\n", + dev_err(&data->client->dev, "invalid report id data (%x)\n", report[ETP_REPORT_ID_OFFSET]); } -- 2.27.0.212.ge8ba1cc988-goog