Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2722649rwb; Mon, 19 Sep 2022 09:02:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mDWXEwhrNbVaUDsdsJtZhViarYHB1ERQeGXoc+duIfYJ53atzMy7nc3Rfm9Z2ZWMfK69b X-Received: by 2002:a17:90b:1a90:b0:202:ff17:4a80 with SMTP id ng16-20020a17090b1a9000b00202ff174a80mr31946762pjb.213.1663603375480; Mon, 19 Sep 2022 09:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663603375; cv=none; d=google.com; s=arc-20160816; b=0FJF4eDGtuIQhxzOK/bA60xyqEWlm2SF2Xz90W00cTlj8FWzwmWLprW/JmVKqjXFbo u/JdXj0/KakhtxPi7Ujfz1kByxp9n7lzqXZSJf0SuWpdqUdrBkV/Ti/9scIElZThv8tS A1Wyz1pv+7YdIjWmXitDSXpeqJ9sPL4tNkfPn0NVNMO7FlmiYXP4FXRdavfeJBLK0bMP TLy8nYSDnSOMMU4uHyDxDuUeDtqUSSaqgQO1Ukj2Gu9gyK7om7WWPZqAWft17tnJZzLK MJkbHxgSKVLUtzwYp8QsUWo/VxJlFEqdHlXD60/tTXbwuakeN8TDMQA6FuTHk0ocMXpr lv7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FeCM68gkQ9FF2bI4ULoqKrlayWCcShzPlt5I44au1/c=; b=iKqnMHOZPwMP/RRsoPgO6dXiX6qrSZYfqRwHfPZFDL+3u8QGJmA5eU6KqNNMyqphJT efKqbBJ3TETNLHQGMLNig3i9yVkNhypHZLTv5Mm1IBxfuCG9jDNuAB9lcRJaHJrOaFvp 037n4cEkGAAWVf/shv1hLfVjfcf49kGoQPQsUYhnLSaHQRofKt09Csinq0ubeUdfVJ5L SRXLBPXD/FMDhlFmU03nSOEumsa0n703Rdc3GNgi3JumzNRsoGODtsuxqQLkJKaxrXCo 8fOJLxrmB5k6Kcb6/3WzdH5O/MX39uVj/cTlRL/PTQZfBhpsUkP/hoqk5DgctoD8OK+6 WAEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BkoiLi25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l184-20020a6391c1000000b0043457129bf7si6559pge.809.2022.09.19.09.02.42; Mon, 19 Sep 2022 09:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BkoiLi25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230377AbiISP7m (ORCPT + 99 others); Mon, 19 Sep 2022 11:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbiISP70 (ORCPT ); Mon, 19 Sep 2022 11:59:26 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A470025E8B for ; Mon, 19 Sep 2022 08:59:21 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id e205so19200633iof.1 for ; Mon, 19 Sep 2022 08:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=FeCM68gkQ9FF2bI4ULoqKrlayWCcShzPlt5I44au1/c=; b=BkoiLi25B9I8aHEcetjwQrrc6ffGJaNixtdj0y9GapFZT9pk9xuiuOjKhbFKzyPki3 dnC/lynaq2cypzHuPEMpcvOES5YmxJHmyIpSl7GQs2G0seIr3CVZdpsvNvqXucdsc7e1 5VHdX9boUcDBorL2W/h7n6K8E6AwhDGFhZ9G0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=FeCM68gkQ9FF2bI4ULoqKrlayWCcShzPlt5I44au1/c=; b=biGXD0DNoxx95IROZdnL0/P46MZBstaIjWxUvSKxnTO0VnJFeMg413S5gs8Fs4yKeK OkEGw43mpoBLRxSD1R79pRWB3hxQfYNo//P32ksuBowaHNRIORorIEIYcFgKViZzOvpw E+YJu6hEJoK+SM6zOVOohJgtUQ4YKjdcTOk1+9hcgf0s0g48Q/SnGJsNOEAo7+hKEOz2 /APO/ZRVD7JaJzg8JWDfLXU3yFHcQQBW0+dOz1df23Fp/ZSflIAsdRvw6eEQZ7vc9gRO Qq4mUX+8Mx/rgwxrwbLg5Eti4RWgM72+d4+qe9huh1Tp/6cD3kbbwj0nSKJc2AoBfKri CaxQ== X-Gm-Message-State: ACrzQf29YzSujKQc0rXuoataO3yPihsiNAeLEPYvJUe0XKrWeZLu063c IiBUgtKmtdINh/sgQps6qMhn2A== X-Received: by 2002:a05:6638:3492:b0:35a:9829:6ff6 with SMTP id t18-20020a056638349200b0035a98296ff6mr6966249jal.57.1663603161047; Mon, 19 Sep 2022 08:59:21 -0700 (PDT) Received: from rrangel920.bld.corp.google.com (h24-56-189-219.arvdco.broadband.dynamic.tds.net. [24.56.189.219]) by smtp.gmail.com with ESMTPSA id t70-20020a025449000000b00349fb9b1abesm5634154jaa.106.2022.09.19.08.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:20 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: timvp@google.com, hdegoede@redhat.com, andriy.shevchenko@linux.intel.com, rafael@kernel.org, mario.limonciello@amd.com, jingle.wu@emc.com.tw, mika.westerberg@linux.intel.com, dmitry.torokhov@gmail.com, linus.walleij@linaro.org, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v4 02/13] Input: elan_i2c - Use PM subsystem to manage wake irq Date: Mon, 19 Sep 2022 09:59:04 -0600 Message-Id: <20220919095504.v4.2.Id022caf53d01112188308520915798f08a33cd3e@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220919155916.1044219-1-rrangel@chromium.org> References: <20220919155916.1044219-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Elan I2C touchpad driver is currently manually managing the wake IRQ. This change removes the explicit enable_irq_wake/disable_irq_wake and instead relies on the PM subsystem. This is done by calling dev_pm_set_wake_irq. i2c_device_probe already calls dev_pm_set_wake_irq when using device tree, and i2c_device_remove also already calls dev_pm_clear_wake_irq. There could be some device tree systems that have incorrectly declared `wake` capabilities, so this change will set the wake irq if one is missing. This matches the previous behavior. I tested this on an ACPI system where the touchpad doesn't have _PRW defined. I verified I can still wake the system and that the wake source was the touchpad IRQ GPIO. Signed-off-by: Raul E Rangel --- (no changes since v2) Changes in v2: - Set the wake_irq when not configured by the i2c-core. This is different than v1, where the wake_irq was only set for non DT systems. drivers/input/mouse/elan_i2c_core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index e1758d5ffe4218..3947474e93d16a 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -86,8 +87,6 @@ struct elan_tp_data { u16 fw_page_size; u32 fw_signature_address; - bool irq_wake; - u8 min_baseline; u8 max_baseline; bool baseline_ready; @@ -1340,6 +1339,15 @@ static int elan_probe(struct i2c_client *client, if (!dev->of_node) device_init_wakeup(dev, true); + /* + * The wake IRQ should be declared via device tree instead of assuming + * the IRQ can wake the system. This is here for legacy reasons and + * will be removed once the i2c-core supports querying ACPI for wake + * capabilities. + */ + if (!dev->power.wakeirq) + dev_pm_set_wake_irq(dev, client->irq); + return 0; } @@ -1362,8 +1370,6 @@ static int __maybe_unused elan_suspend(struct device *dev) if (device_may_wakeup(dev)) { ret = elan_sleep(data); - /* Enable wake from IRQ */ - data->irq_wake = (enable_irq_wake(client->irq) == 0); } else { ret = elan_set_power(data, false); if (ret) @@ -1394,9 +1400,6 @@ static int __maybe_unused elan_resume(struct device *dev) dev_err(dev, "error %d enabling regulator\n", error); goto err; } - } else if (data->irq_wake) { - disable_irq_wake(client->irq); - data->irq_wake = false; } error = elan_set_power(data, true); -- 2.37.3.968.ga6b4b080e4-goog