Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp568835ybt; Mon, 6 Jul 2020 16:53:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrwHvATlwR/NoKLu13BuqzDFrYR5TCjhEY4bYHYwg0naUFelubIO3WySWrPE1WAACmhk/5 X-Received: by 2002:a17:906:b292:: with SMTP id q18mr47135327ejz.253.1594079628585; Mon, 06 Jul 2020 16:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594079628; cv=none; d=google.com; s=arc-20160816; b=I13BpNHo1KNfgLNr5ag1OUjpHNnCCLSYBXCY+cyJthN+fRp5hJ35x6RGgdaiSrNG7G gaosmAx9/TakH6OUH3j1e12RgXk3J9Vsv7qAiPjMayQhEBHsNSl3iqgnpoDdQtpm0eSc 6lR7EsBHsDIiqQKzhWTeM2qddoI9v2xpnonGdKQLdZi7HFyrHWkLfsO3eIHcXainUGpX Kb2LR2t3Bbd1DtBfyOt3YP9Uh4Thz7hOadie8ztX4tbaxt4uDhf3Qb8g2bV7/Yveq/O0 zLh1Lvr2znNQ1shdokcsOw+mgIv8YrgkmNiRDUjROBwnLUBIRH9WTyZkAtkfs/l4c+H9 UJJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=l5yLMA0bO8aht8FZuYrcOO7KiK+q7Iemo//4lIfDKr8=; b=oNgoS6vZeMnS73IyuiSsh7pn/NNsC4ealENdleIRn+O5d18McNzxPg/Ug9RjojzCPS hjoAiFpigA2JIPW94RKfo5K/6sE/NoKBNFH3qH+1KwZCPcbX14mdTgS01Q9vsqDBlW8f 1+biqbuuZx9fqn4ajwhVe1l39zumX/Ws5bwk5DpBxdaI57Sz1pW48MjCXFTXxZy9gEcq FNv3bmU9P230iGLo2hFwfZ8goxXTWm7NVz+rJ7W/dzlvPCSeDOqGpSpVOuFgImfWtANN kQqGvwn+ZpwxFSzX2UYs+gMmI/TMN0Zmq33/RPPYc95+467BYstilqHXH0uCL9so/tMn 2RSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Q+/4in86"; 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=pass (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 cz22si13317883edb.148.2020.07.06.16.53.24; Mon, 06 Jul 2020 16:53:48 -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=pass header.i=@chromium.org header.s=google header.b="Q+/4in86"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727072AbgGFXux (ORCPT + 99 others); Mon, 6 Jul 2020 19:50:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbgGFXux (ORCPT ); Mon, 6 Jul 2020 19:50:53 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBBDAC061794 for ; Mon, 6 Jul 2020 16:50:51 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id ch3so2506434pjb.5 for ; Mon, 06 Jul 2020 16:50:51 -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=l5yLMA0bO8aht8FZuYrcOO7KiK+q7Iemo//4lIfDKr8=; b=Q+/4in86Ak5nmQ4TbwEh515hpfyJnt5gGVfPFEd9TBvTTlOKyFmFyb4FELvoKnJk43 V21F/NEjRxaUA0/zdadSwkREh+zFcJ8cmE+Vmh6WCt59I9RhkPc7XSq2jHN/H/wXTw+I eV9E48qqlXNFqhuReljhaecu8nVXIhU5wJMy4= 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=l5yLMA0bO8aht8FZuYrcOO7KiK+q7Iemo//4lIfDKr8=; b=XNSH36ntf4Wozl1mMsNRUNDD0IbOhuB7RisPhG6WbGzRRAPSo9GlwE6S/ldITY1Sjf 2AqNaEXbk8UZkuZlmFYpNBo2GGL3ZYPAR7NK1G0TpDgZrs3ntKmd7afY5rR/vxNGI+qQ FthzWvxLmsxLe9bxeOmc3VVXpCwjC7dZrX+TOrTzoCkNNAeJF++J7nfc9odx98V/p74p t2r8IDi0lncj4g2/zteMDmogFykKayrBg3cLaUKpmwQ3oaZLgwGxznDLzxHFVOsFWFxu Owi2BYjYz2JK6SHBlXqhS5hwBIM7GGhi4436xR6GO7r78gUh9hgpDgJ76hYmp7+Qe1Nb 3J2Q== X-Gm-Message-State: AOAM531iJOdm/vFnh/6WnUgU9zUna3H4Fx5ehtD2qqS3OBHpBJIF1eg+ bNgtCoodIwcKagApjXPlM61zJvPYadM= X-Received: by 2002:a17:902:bccc:: with SMTP id o12mr45379828pls.29.1594079451057; Mon, 06 Jul 2020 16:50:51 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:a28c:fdff:feeb:4a32]) by smtp.gmail.com with ESMTPSA id c27sm20014383pfj.163.2020.07.06.16.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 16:50:50 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, jiada_wang@mentor.com, dmitry.torokhov@gmail.com, dbasehore@chromium.org Subject: [PATCH v2] Input: elan_i2c - only increment wakeup count on touch Date: Mon, 6 Jul 2020 16:50:46 -0700 Message-Id: <20200706235046.1984283-1-dbasehore@chromium.org> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Derek Basehore --- drivers/input/mouse/elan_i2c_core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 3f9354baac4b..6291fb5fa015 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -951,6 +951,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)); @@ -974,6 +976,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"); @@ -998,7 +1002,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]; @@ -1016,8 +1019,6 @@ static irqreturn_t elan_isr(int irq, void *dev_id) if (error) goto out; - pm_wakeup_event(dev, 0); - switch (report[ETP_REPORT_ID_OFFSET]) { case ETP_REPORT_ID: elan_report_absolute(data, report); @@ -1026,7 +1027,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.383.g050319c2ae-goog