From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 145C7C6FA82 for ; Wed, 14 Sep 2022 23:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229480AbiINX6S (ORCPT ); Wed, 14 Sep 2022 19:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbiINX6J (ORCPT ); Wed, 14 Sep 2022 19:58:09 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26FF38980E for ; Wed, 14 Sep 2022 16:58:08 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id i7so4663812ioa.5 for ; Wed, 14 Sep 2022 16:58:08 -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=tlb/jBBoBszWVk5wX7JgxKdayuraWLIogIZ7IhePa+U=; b=jjEy/jgKElInFwZkF0H4qzh1Q/dsUBj7KWr9+3FYwBTsMsk2yDGnQJjKAg/jULKS0O VfP9f78UxOUG1kr5qyCqi/ARy8WNzF1kqECKwodoaEpLJtCQ4txtDDv9a7aT2Zw0E/bJ m6xVm3MlXV++OLTNvp0uJ5Vnr6xJ3zZpbvbVg= 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=tlb/jBBoBszWVk5wX7JgxKdayuraWLIogIZ7IhePa+U=; b=wQuvjg1GqHi2PQZd7yXUbV5zLTD8EbWAryf0HXMbxwRMoMEJ8h0WxSp71yu2J6D3YO uKrK4SIP6T/+g5VDKikzxF1eYdFVhCm+YISmyFyUxkbrJhIKE3OcGpI/TToxGNiN8gkl pukmH1fChVjsqv9vvYuplPxYNKOTwnsMp/9xL3KeB7lL7q++OXphGD+HOK2V4XEFtV7m Mw+RhC3AyMeovQGleGxvm7kYiCdll+4KO5rtf/1CZo0vfG0tXut8K08N8rPSfpckjOYN GV7DCQY7yckZYMHKkmtV9ZxOFmmU6kp5nU7/qbg/OCd5+xu7DAcb/owMVgy0jHjJUViN Rnvw== X-Gm-Message-State: ACgBeo1jN8L1OPnYv79iz5isspaHpUHnAuod6F5J6/oSYysLn13LPmhc hMLojG7ULNWl1PePKBJyoFmvww== X-Google-Smtp-Source: AA6agR6gY3ZcUPrnEf8WQJxDLCEZo/qOuujp3KFniSoMv0/CGDI3Qj8ODnVpXeVxk4mLouo+iwScRQ== X-Received: by 2002:a05:6638:22c5:b0:346:dc09:b0f5 with SMTP id j5-20020a05663822c500b00346dc09b0f5mr20279429jat.194.1663199887469; Wed, 14 Sep 2022 16:58:07 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:06 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Alistair Francis , Angela Czubak , Benjamin Tissoires , Jiri Kosina , linux-kernel@vger.kernel.org Subject: [PATCH v3 01/13] HID: i2c-hid: Use PM subsystem to manage wake irq Date: Wed, 14 Sep 2022 17:57:49 -0600 Message-Id: <20220914155914.v3.1.Id4b4bdfe06e2caf2d5a3c9dd4a9b1080c38b539c@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The I2C hid 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 that has a HID touchscreen and verified the IRQ was armed for wake on suspend. Signed-off-by: Raul E Rangel --- Changes in v3: - Fixed typo in if condition 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/hid/i2c-hid/i2c-hid-core.c | 33 +++++++++++------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-h= id-core.c index baa169fadd6632..a2fa40dec04ea5 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -116,7 +117,6 @@ struct i2c_hid { =20 wait_queue_head_t wait; /* For waiting the interrupt */ =20 - bool irq_wake_enabled; struct mutex reset_lock; =20 struct i2chid_ops *ops; @@ -1036,6 +1036,15 @@ int i2c_hid_core_probe(struct i2c_client *client, st= ruct i2chid_ops *ops, if (ret < 0) goto err_powered; =20 + /* + * 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 (!client->dev.power.wakeirq) + dev_pm_set_wake_irq(&client->dev, client->irq); + hid =3D hid_allocate_device(); if (IS_ERR(hid)) { ret =3D PTR_ERR(hid); @@ -1119,7 +1128,6 @@ static int i2c_hid_core_suspend(struct device *dev) struct i2c_hid *ihid =3D i2c_get_clientdata(client); struct hid_device *hid =3D ihid->hid; int ret; - int wake_status; =20 ret =3D hid_driver_suspend(hid, PMSG_SUSPEND); if (ret < 0) @@ -1130,16 +1138,8 @@ static int i2c_hid_core_suspend(struct device *dev) =20 disable_irq(client->irq); =20 - if (device_may_wakeup(&client->dev)) { - wake_status =3D enable_irq_wake(client->irq); - if (!wake_status) - ihid->irq_wake_enabled =3D true; - else - hid_warn(hid, "Failed to enable irq wake: %d\n", - wake_status); - } else { + if (!device_may_wakeup(&client->dev)) i2c_hid_core_power_down(ihid); - } =20 return 0; } @@ -1150,18 +1150,9 @@ static int i2c_hid_core_resume(struct device *dev) struct i2c_client *client =3D to_i2c_client(dev); struct i2c_hid *ihid =3D i2c_get_clientdata(client); struct hid_device *hid =3D ihid->hid; - int wake_status; =20 - if (!device_may_wakeup(&client->dev)) { + if (!device_may_wakeup(&client->dev)) i2c_hid_core_power_up(ihid); - } else if (ihid->irq_wake_enabled) { - wake_status =3D disable_irq_wake(client->irq); - if (!wake_status) - ihid->irq_wake_enabled =3D false; - else - hid_warn(hid, "Failed to disable irq wake: %d\n", - wake_status); - } =20 enable_irq(client->irq); =20 --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D0CAECAAD3 for ; Wed, 14 Sep 2022 23:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbiINX6Y (ORCPT ); Wed, 14 Sep 2022 19:58:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiINX6K (ORCPT ); Wed, 14 Sep 2022 19:58:10 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA49E8981D for ; Wed, 14 Sep 2022 16:58:09 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id i7so4663857ioa.5 for ; Wed, 14 Sep 2022 16:58:09 -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=WwUIlBW2sig7QIamYBwg73LnJKD+Q9o8vhKwbMERgHTclYfel0/TF852uzMVCFjU3l BjnIrrNSZXJ0OF5+ZRPoyjG/jDcPrNwFP5trRbFuko7skJuGhClIWa1EqXS7ByWBQ2zI kVzWFLH1uTj9JPViW5z8GNxNaKXwLCsIFpYPQ= 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=CYMZKRU6WSXk5ZttXP90ELYcpBUuiU3wSEPtyJA7kxIDPxUcCzRARJ/XhxS47mF94t Oix2MtOmJCehm6M4FMI4uX7jOfIlpG6GY2EBB9VL9veb2PrEMHpD4ZRbRKqIaXEO2Fho 3c4cPTVSyg6XuXWN2JKtM5g7qlwrJGFz4m+XYRjmWFpF9dDoWtrINS2dNOeVsQ2zjDcN tcLby9wcxOYh9mxoIBEUDLmQMkCkdtJRR1fEmQYg7+jMA4fK8BQjbkmzWgnnvPXFFGnW Uqx1Ahso8bj+olksJl/rgakY1u4fvHrqscTze8maGhiWZEKere3dzriAdyKLv6ucArdK foTg== X-Gm-Message-State: ACgBeo3teX3s8pLWLqMAf0LooBTJy5eMGUehPZKjk99wi6oCvKmjLe44 VbrQnFa1hLlD+Zckx1Vv3qbpwA== X-Google-Smtp-Source: AA6agR7uCyzIsdzm4G24LKdVf+tpy2liBA3YlXhpjZjCHqSBfRdi/8ekYE4tng2DP3z6nBBdASTu6g== X-Received: by 2002:a05:6638:264b:b0:35a:79c0:932d with SMTP id n11-20020a056638264b00b0035a79c0932dmr735569jat.116.1663199889258; Wed, 14 Sep 2022 16:58:09 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:08 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v3 02/13] Input: elan_i2c - Use PM subsystem to manage wake irq Date: Wed, 14 Sep 2022 17:57:50 -0600 Message-Id: <20220914155914.v3.2.Id022caf53d01112188308520915798f08a33cd3e@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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; =20 - 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); =20 + /* + * 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; } =20 @@ -1362,8 +1370,6 @@ static int __maybe_unused elan_suspend(struct device = *dev) =20 if (device_may_wakeup(dev)) { ret =3D elan_sleep(data); - /* Enable wake from IRQ */ - data->irq_wake =3D (enable_irq_wake(client->irq) =3D=3D 0); } else { ret =3D 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 =3D false; } =20 error =3D elan_set_power(data, true); --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC4EC6FA82 for ; Wed, 14 Sep 2022 23:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229459AbiINX6i (ORCPT ); Wed, 14 Sep 2022 19:58:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbiINX6M (ORCPT ); Wed, 14 Sep 2022 19:58:12 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53F58981D for ; Wed, 14 Sep 2022 16:58:11 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id z191so13658021iof.10 for ; Wed, 14 Sep 2022 16:58:11 -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=uLFsVomnZ3NOv94HIF7hfztjoJa5WoPp5LmQm5BO1Bo=; b=EpH8pFpdO3xx3hvO3BSYcXVAywxj6PJQIgEpmQ6BF6AGJ2bg7E/C4hcBZ0rilevnND uW7yaSxKjUSoRUYuNLkKMMquKKgHpXLOwDFJnQL0HYx79jBHtdfC7sqv2bfxvUfdLfxl Tqtwjn91EwT3rQdk9dJSboqBGHankwVOk4gkw= 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=uLFsVomnZ3NOv94HIF7hfztjoJa5WoPp5LmQm5BO1Bo=; b=ePYOBGrzgxi3TgzmQgaRK06h8l0ZvYFhgU/gX6ud3w7qdzu8XAg29IhybGzafcCZzl apoBTB53zTG/iLnH4v7Lh2/c/g832djiK18nmmauOSitOQMzmwYnnSlZaryzksiEmCpn SWAivd+AdcB91BURIuZGhDoz1uerZ4xjSdXlYxeVti5Y4lzjauAbX5qt+4Hqruhp5PQo iURmCpMPPlQy6wNWXdqAXY0oNcyxuEyNi6SiaSqPG3MxabfMIzikL2cPd9piFHB4dm1k MxfgwpkBeg8SruVeeR7875RxCby0elC7VYlbKrznms9WusC01LEJDLy6iVWw+phXNLdr JwDQ== X-Gm-Message-State: ACgBeo23oTH9W25C1XizTyFC5PXhQIOK4xgCNakq7HkU9YBPqi3/kXOs ENP0Ez0d8NBGjkCcoX5yYL6nkQ== X-Google-Smtp-Source: AA6agR7cbKJmmVVP/0cwP0lPpWKLXXVbFI05Uy6WXiwVFJ056epbGbRbQNZdBbMOM4ZuMsl3Ric7lw== X-Received: by 2002:a05:6602:408c:b0:6a1:3fda:5633 with SMTP id bl12-20020a056602408c00b006a13fda5633mr7407200iob.194.1663199891047; Wed, 14 Sep 2022 16:58:11 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:10 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Cai Huoqing , Douglas Anderson , Guenter Roeck , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH v3 03/13] Input: elants_i2c - Use PM subsystem to manage wake irq Date: Wed, 14 Sep 2022 17:57:51 -0600 Message-Id: <20220914155914.v3.3.I5862429ee3e4de0f9ad5ba01ce07ad99eec10cf0@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The Elan I2C touchscreen 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. Signed-off-by: Raul E Rangel --- (no changes since v2) Changes in v2: - Added elants_i2c to series drivers/input/touchscreen/elants_i2c.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchsc= reen/elants_i2c.c index a56f042adf9d82..80e16b533c452a 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -180,7 +181,6 @@ struct elants_data { u8 cmd_resp[HEADER_SIZE]; struct completion cmd_done; =20 - bool wake_irq_enabled; bool keep_power_in_suspend; =20 /* Must be last to be used for DMA operations */ @@ -1582,6 +1582,15 @@ static int elants_i2c_probe(struct i2c_client *clien= t) if (!client->dev.of_node) device_init_wakeup(&client->dev, true); =20 + /* + * 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 (!client->dev.power.wakeirq) + dev_pm_set_wake_irq(&client->dev, client->irq); + error =3D devm_device_add_group(&client->dev, &elants_attribute_group); if (error) { dev_err(&client->dev, "failed to create sysfs attributes: %d\n", @@ -1626,7 +1635,7 @@ static int __maybe_unused elants_i2c_suspend(struct d= evice *dev) * The device will automatically enter idle mode * that has reduced power consumption. */ - ts->wake_irq_enabled =3D (enable_irq_wake(client->irq) =3D=3D 0); + return 0; } else if (ts->keep_power_in_suspend) { for (retry_cnt =3D 0; retry_cnt < MAX_RETRIES; retry_cnt++) { error =3D elants_i2c_send(client, set_sleep_cmd, @@ -1655,8 +1664,6 @@ static int __maybe_unused elants_i2c_resume(struct de= vice *dev) int error; =20 if (device_may_wakeup(dev)) { - if (ts->wake_irq_enabled) - disable_irq_wake(client->irq); elants_i2c_sw_reset(client); } else if (ts->keep_power_in_suspend) { for (retry_cnt =3D 0; retry_cnt < MAX_RETRIES; retry_cnt++) { --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E512ECAAD3 for ; Wed, 14 Sep 2022 23:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiINX6o (ORCPT ); Wed, 14 Sep 2022 19:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiINX6N (ORCPT ); Wed, 14 Sep 2022 19:58:13 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF278895EB for ; Wed, 14 Sep 2022 16:58:12 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id i7so4663933ioa.5 for ; Wed, 14 Sep 2022 16:58:12 -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=bZ+qtxPfho04MrKrUszJh9/TiBJm28a0YpVnjrNGpL8=; b=Z1Mz0AVWyZV1x9kWPMTtSH9m15d65yOz28rOukX+iiKK5sxgljOg3AjuAL/fLsty0o Fwa0dv08IN+GgMhpT+RyBQm3sV+RzvmA8dqscyc/19CjC4pLE94A2fFRclaQAS0I46JL UdrAR6GegAHt4ty+yIDzUTVeFW3q5rZ9lWSWE= 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=bZ+qtxPfho04MrKrUszJh9/TiBJm28a0YpVnjrNGpL8=; b=HnBdCwHILbdc10Z2yk4A38KlQ/XvV64vfjBxo8yaHelJU2+4znnO+jxuuhbacxq0fP QTQK7eXM1+rT7WNj2o75UwGDG3EcwOuEA0iLvMEV3Ys6A8i+phUIJV2X2+rp1+qCminV sqTNFzNbwcwRYLvAe/siWm81d1COZY6pNmmf7f83T6fYfcFELvxUOmd/bsK2EsMRDmAj q0O/RDe5fxBdGabMF5uzzoZCWe1Ma8Wu/kvidhkgi4Eq4jeqtLNji/y04E13ispQiupH ZOGqS7QdovFFKHpAEqrYQWTKJQo1lzK+YHfWjEeCjEZfr+p6CDtPccWpLrn3LzvWoBGF MVTw== X-Gm-Message-State: ACgBeo2j2LUh2LZ9VevyaZcMdLI0HthJDIRFzZdNVrMyfL3Pdm803htc vFNjk7Jl6xb4xdYQxdlFn+UjaA== X-Google-Smtp-Source: AA6agR70f91KueYcy3vW2OijG0ZdXL3W9DFkLxN83/mUwr80g2n2bX09vzEmq41z5yQX9KMMR9ZMag== X-Received: by 2002:a6b:3f08:0:b0:6a1:ebef:805f with SMTP id m8-20020a6b3f08000000b006a1ebef805fmr1796981ioa.116.1663199892392; Wed, 14 Sep 2022 16:58:12 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:11 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Cai Huoqing , linux-kernel@vger.kernel.org Subject: [PATCH v3 04/13] Input: raydium_ts_i2c - Use PM subsystem to manage wake irq Date: Wed, 14 Sep 2022 17:57:52 -0600 Message-Id: <20220914155914.v3.4.I06b417b274bbecb31775a73993a7a3c1bc80de7b@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The raydium I2C touchscreen 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. Signed-off-by: Raul E Rangel --- (no changes since v2) Changes in v2: - Added raydium_ts_i2c to series drivers/input/touchscreen/raydium_i2c_ts.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/tou= chscreen/raydium_i2c_ts.c index 3a4952935366f9..66c5b577b791d4 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -134,8 +135,6 @@ struct raydium_data { u8 pkg_size; =20 enum raydium_boot_mode boot_mode; - - bool wake_irq_enabled; }; =20 /* @@ -1186,6 +1185,15 @@ static int raydium_i2c_probe(struct i2c_client *clie= nt, return error; } =20 + /* + * 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 (!client->dev.power.wakeirq) + dev_pm_set_wake_irq(&client->dev, client->irq); + error =3D devm_device_add_group(&client->dev, &raydium_i2c_attribute_group); if (error) { @@ -1222,8 +1230,6 @@ static int __maybe_unused raydium_i2c_suspend(struct = device *dev) =20 if (device_may_wakeup(dev)) { raydium_enter_sleep(client); - - ts->wake_irq_enabled =3D (enable_irq_wake(client->irq) =3D=3D 0); } else { raydium_i2c_power_off(ts); } @@ -1237,8 +1243,6 @@ static int __maybe_unused raydium_i2c_resume(struct d= evice *dev) struct raydium_data *ts =3D i2c_get_clientdata(client); =20 if (device_may_wakeup(dev)) { - if (ts->wake_irq_enabled) - disable_irq_wake(client->irq); raydium_i2c_sw_reset(client); } else { raydium_i2c_power_on(ts); --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66D76ECAAD3 for ; Wed, 14 Sep 2022 23:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiINX6v (ORCPT ); Wed, 14 Sep 2022 19:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiINX6g (ORCPT ); Wed, 14 Sep 2022 19:58:36 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6CEA8983E for ; Wed, 14 Sep 2022 16:58:14 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id n81so13220200iod.6 for ; Wed, 14 Sep 2022 16:58:14 -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=weBnQ0QpP5GmpITHPCxwi39XWMtQ1xxsLUWjH8IbvVA=; b=NCI1qH9jveKDXncAk6HScGzcKJxjHGgdLhM/38URe/NK1PwO0347geW9jGEWRPuan3 Nyk55gqLYsWaNnaTiesN09/mWhoHvWdVenY9SPt012t/Bto5qLlXRAihjvRZG5oznkdn weFqe3hRGlRjOdkxJcZMkNc9v9047Eh5ss25I= 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=weBnQ0QpP5GmpITHPCxwi39XWMtQ1xxsLUWjH8IbvVA=; b=kf1dHFKNf2ja3r9sJfjhPb5EbYSHLp/dc50PUdeuK7uV0k2lOFnoQGq8XkKx6v+U77 2DTsg36vc0plAkouST/nu6jWGFt9wgeiwxezYrXVovDqcT55nc+PsdSC0C/jHLERJ+67 YV6i5z0CKJUJ6OBYYIdGu0vdHczfPY7dMkNEHIe8y+AH9Zym2M8uLpqAJoqUUB9oJN30 YJk3xbtU/WeuNIZ4mDTFaAifZ0gz4A8XXrGv01tllMOcZ1dOXJvQMp7/38jQ2JAHavaZ o3uVI5AMY/2YL+il6tTU3SRcataMnXlhX6QLieFtPZaMP6vi+GOKtxKnLoyMP9Ow/5S3 nv0A== X-Gm-Message-State: ACgBeo0fJqIsfpUQRX8GZnWJadUVX1z8GM1iefssDQjWHyHJ2udv4lgG B7mdPhHb45/ot4h2PjakzlePsg== X-Google-Smtp-Source: AA6agR62n7lPldjnhqzxv1tCULUdyRzyhbSrXdbJarDbGnR8SVPVcFSEfRE3+kA1tw4NIwP6SHeL5Q== X-Received: by 2002:a6b:e60f:0:b0:6a1:75d7:271e with SMTP id g15-20020a6be60f000000b006a175d7271emr5783978ioh.79.1663199894205; Wed, 14 Sep 2022 16:58:14 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:13 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Bartosz Golaszewski , Len Brown , Mika Westerberg , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/13] gpiolib: acpi: Add wake_capable variants of acpi_dev_gpio_irq_get Date: Wed, 14 Sep 2022 17:57:53 -0600 Message-Id: <20220914155914.v3.5.I4ff95ba7e884a486d7814ee888bf864be2ebdef4@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The ACPI spec defines the SharedAndWake and ExclusiveAndWake share type keywords. This is an indication that the GPIO IRQ can also be used as a wake source. This change exposes the wake_capable bit so drivers can correctly enable wake functionality instead of making an assumption. Signed-off-by: Raul E Rangel Reviewed-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- Changes in v3: - Kept `acpi_dev_gpio_irq_get_by` unchanged to avoid having to touch unrelated drivers. - Converted wake_capable parameter to bool. Changes in v2: - Fixed call site in mlxbf_gige_probe drivers/gpio/gpiolib-acpi.c | 17 ++++++++++++++--- drivers/gpio/gpiolib-acpi.h | 2 ++ include/linux/acpi.h | 22 ++++++++++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 9be1376f9a627f..c703f095993a2c 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -741,6 +741,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resour= ce *ares, void *data) lookup->info.pin_config =3D agpio->pin_config; lookup->info.debounce =3D agpio->debounce_timeout; lookup->info.gpioint =3D gpioint; + lookup->info.wake_capable =3D agpio->wake_capable =3D=3D + ACPI_WAKE_CAPABLE; =20 /* * Polarity and triggering are only specified for GpioInt @@ -987,10 +989,12 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_h= andle *fwnode, } =20 /** - * acpi_dev_gpio_irq_get_by() - Find GpioInt and translate it to Linux IRQ= number + * acpi_dev_gpio_irq_wake_get_by() - Find GpioInt and translate it to Linu= x IRQ + * number * @adev: pointer to a ACPI device to get IRQ from * @name: optional name of GpioInt resource * @index: index of GpioInt resource (starting from %0) + * @wake_capable: Set to true if the IRQ is wake capable * * If the device has one or more GpioInt resources, this function can be * used to translate from the GPIO offset in the resource to the Linux IRQ @@ -1002,9 +1006,13 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_= handle *fwnode, * The function takes optional @name parameter. If the resource has a prop= erty * name, then only those will be taken into account. * + * The GPIO is considered wake capable if the GpioInt resource specifies + * SharedAndWake or ExclusiveAndWake. + * * Return: Linux IRQ number (> %0) on success, negative errno on failure. */ -int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, i= nt index) +int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *na= me, + int index, bool *wake_capable) { int idx, i; unsigned int irq_flags; @@ -1061,13 +1069,16 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *ad= ev, const char *name, int ind dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); } =20 + if (wake_capable) + *wake_capable =3D info.wake_capable; + return irq; } =20 } return -ENOENT; } -EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get_by); +EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_wake_get_by); =20 static acpi_status acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, diff --git a/drivers/gpio/gpiolib-acpi.h b/drivers/gpio/gpiolib-acpi.h index e476558d947136..1ac6816839dbce 100644 --- a/drivers/gpio/gpiolib-acpi.h +++ b/drivers/gpio/gpiolib-acpi.h @@ -18,6 +18,7 @@ struct acpi_device; * @pin_config: pin bias as provided by ACPI * @polarity: interrupt polarity as provided by ACPI * @triggering: triggering type as provided by ACPI + * @wake_capable: wake capability as provided by ACPI * @debounce: debounce timeout as provided by ACPI * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping */ @@ -28,6 +29,7 @@ struct acpi_gpio_info { int pin_config; int polarity; int triggering; + bool wake_capable; unsigned int debounce; unsigned int quirks; }; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6f64b2f3dc5479..d3121cef6cc3bc 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1202,7 +1202,8 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource = *ares, struct acpi_resource_gpio **agpio); bool acpi_gpio_get_io_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio); -int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, i= nt index); +int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *na= me, + int index, bool *wake_capable); #else static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio) @@ -1214,16 +1215,29 @@ static inline bool acpi_gpio_get_io_resource(struct= acpi_resource *ares, { return false; } -static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, - const char *name, int index) +static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, + const char *name, int index, + bool *wake_capable) { return -ENXIO; } #endif =20 +static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, + const char *name, int index) +{ + return acpi_dev_gpio_irq_wake_get_by(adev, name, index, NULL); +} + static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int inde= x) { - return acpi_dev_gpio_irq_get_by(adev, NULL, index); + return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, NULL); +} + +static inline int acpi_dev_gpio_irq_wake_get(struct acpi_device *adev, + int index, bool *wake_capable) +{ + return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, wake_capable); } =20 /* Device properties */ --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9562FECAAD3 for ; Wed, 14 Sep 2022 23:59:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbiINX7E (ORCPT ); Wed, 14 Sep 2022 19:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbiINX6s (ORCPT ); Wed, 14 Sep 2022 19:58:48 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467B18990D for ; Wed, 14 Sep 2022 16:58:16 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id n81so13220246iod.6 for ; Wed, 14 Sep 2022 16:58:16 -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=9uatTu5uzABoJ+uXuOsYVkAp1GYbf5ed0R7Bs8VHVbA=; b=cisarhOQ8C1eADnNJXCTY303v+IbXRSokjTupgme1fmmCxkeoWZtoWaZY7T1amK5H7 WBtAhMB7WofJQMSpgUM46yop4MUKlY0710Q7Sd3OEQqa4PuQeGLHGHu9xlyqeZNGnGqF cj9npfrZLzAQuPvTt/hY7dEbhqg43LWHJrw5w= 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=9uatTu5uzABoJ+uXuOsYVkAp1GYbf5ed0R7Bs8VHVbA=; b=uWl7olsgb0fwd5tES/RY2iGIzNT67BDhPg/VjbuSyC1j2x9EbwiP5q0rFIMdDdtVNI kXXJbVI0xVG0vQwahWCZpoueJ2nT6xJsAzQP19ty4B7MqtRzzK2fkZrNwThHTeWDSJ7K LUdpiWNL3rltdp3qlOr5Mg6/0dePl5IOMQqTO5ORjIsMhvAttC/EnNqMwi0xy6+mmht8 SD/NxgURkYx4vIg/BlbvCjSpP2KQNrhGJLKKuFVxBSgEaiFXZ2eAcpX7PGdcGwAXybvB eU5dK5MEmHFA9CPHuMSdFwHwEnLLyCataexHMeLqMXmM+NmVjhvyYu9Cr8hAb1yRrAum wa4w== X-Gm-Message-State: ACgBeo2q5VVGPIaMn5xzgy2+gpChNjjLqvC2Yw4asmfwaqeCTEhWbQdN 752rNBjoK/VhcZ8tvaS92eZD5w== X-Google-Smtp-Source: AA6agR4U0dBwgMhkzsqfbOfUgbXKyVEIU5zarCUPT0jf92o404OIWBfSVZeYtrSoa5SySGRCPCPgew== X-Received: by 2002:a05:6602:368e:b0:6a1:5efe:8955 with SMTP id bf14-20020a056602368e00b006a15efe8955mr6480548iob.4.1663199895973; Wed, 14 Sep 2022 16:58:15 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:15 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Andy Shevchenko , Dan Williams , Greg Kroah-Hartman , Jonathan Cameron , Len Brown , Terry Bowman , linux-kernel@vger.kernel.org Subject: [PATCH v3 06/13] ACPI: resources: Add wake_capable parameter to acpi_dev_irq_flags Date: Wed, 14 Sep 2022 17:57:54 -0600 Message-Id: <20220914155914.v3.6.I8092e417a8152475d13d8d638eb4c5d8ea12ac7b@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" ACPI IRQ/Interrupt resources contain a bit that describes if the interrupt should wake the system. This change exposes that bit via a new IORESOURCE_IRQ_WAKECAPABLE flag. Drivers should check this flag before arming an IRQ to wake the system. Signed-off-by: Raul E Rangel Reviewed-by: Andy Shevchenko --- Changes in v3: - Fixed bad indent Changes in v2: - Added ability to extract wake bit from Interrupt/IRQ resources drivers/acpi/irq.c | 11 ++++++++--- drivers/acpi/resource.c | 24 +++++++++++++++++------- drivers/pnp/pnpacpi/rsparser.c | 9 ++++++--- include/linux/acpi.h | 3 ++- include/linux/ioport.h | 3 ++- 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c index dabe45eba055d1..5483cf9a28e3a0 100644 --- a/drivers/acpi/irq.c +++ b/drivers/acpi/irq.c @@ -147,6 +147,7 @@ struct acpi_irq_parse_one_ctx { * @polarity: polarity attributes of hwirq * @polarity: polarity attributes of hwirq * @shareable: shareable attributes of hwirq + * @wake_capable: wake capable attribute of hwirq * @ctx: acpi_irq_parse_one_ctx updated by this function * * Description: @@ -156,12 +157,14 @@ struct acpi_irq_parse_one_ctx { static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode, u32 hwirq, u8 triggering, u8 polarity, u8 shareable, + u8 wake_capable, struct acpi_irq_parse_one_ctx *ctx) { if (!fwnode) return; ctx->rc =3D 0; - *ctx->res_flags =3D acpi_dev_irq_flags(triggering, polarity, shareable); + *ctx->res_flags =3D acpi_dev_irq_flags(triggering, polarity, shareable, + wake_capable); ctx->fwspec->fwnode =3D fwnode; ctx->fwspec->param[0] =3D hwirq; ctx->fwspec->param[1] =3D acpi_dev_get_irq_type(triggering, polarity); @@ -204,7 +207,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_re= source *ares, fwnode =3D acpi_get_gsi_domain_id(irq->interrupts[ctx->index]); acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index], irq->triggering, irq->polarity, - irq->shareable, ctx); + irq->shareable, irq->wake_capable, + ctx); return AE_CTRL_TERMINATE; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: eirq =3D &ares->data.extended_irq; @@ -218,7 +222,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_re= source *ares, eirq->interrupts[ctx->index]); acpi_irq_parse_one_match(fwnode, eirq->interrupts[ctx->index], eirq->triggering, eirq->polarity, - eirq->shareable, ctx); + eirq->shareable, eirq->wake_capable, + ctx); return AE_CTRL_TERMINATE; } =20 diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 510cdec375c4d8..6a1c008a348902 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -336,8 +336,10 @@ EXPORT_SYMBOL_GPL(acpi_dev_resource_ext_address_space); * @triggering: Triggering type as provided by ACPI. * @polarity: Interrupt polarity as provided by ACPI. * @shareable: Whether or not the interrupt is shareable. + * @wake_capable: Wake capability as provided by ACPI. */ -unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable) +unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, + u8 wake_capable) { unsigned long flags; =20 @@ -351,6 +353,9 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 pola= rity, u8 shareable) if (shareable =3D=3D ACPI_SHARED) flags |=3D IORESOURCE_IRQ_SHAREABLE; =20 + if (wake_capable =3D=3D ACPI_WAKE_CAPABLE) + flags |=3D IORESOURCE_IRQ_WAKECAPABLE; + return flags | IORESOURCE_IRQ; } EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); @@ -442,7 +447,7 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggerin= g, u8 polarity, =20 static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, u8 triggering, u8 polarity, u8 shareable, - bool check_override) + u8 wake_capable, bool check_override) { int irq, p, t; =20 @@ -475,7 +480,8 @@ static void acpi_dev_get_irqresource(struct resource *r= es, u32 gsi, } } =20 - res->flags =3D acpi_dev_irq_flags(triggering, polarity, shareable); + res->flags =3D acpi_dev_irq_flags(triggering, polarity, shareable, + wake_capable); irq =3D acpi_register_gsi(NULL, gsi, triggering, polarity); if (irq >=3D 0) { res->start =3D irq; @@ -523,7 +529,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *= ares, int index, } acpi_dev_get_irqresource(res, irq->interrupts[index], irq->triggering, irq->polarity, - irq->shareable, true); + irq->shareable, irq->wake_capable, + true); break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: ext_irq =3D &ares->data.extended_irq; @@ -532,9 +539,12 @@ bool acpi_dev_resource_interrupt(struct acpi_resource = *ares, int index, return false; } if (is_gsi(ext_irq)) - acpi_dev_get_irqresource(res, ext_irq->interrupts[index], - ext_irq->triggering, ext_irq->polarity, - ext_irq->shareable, false); + acpi_dev_get_irqresource(res, + ext_irq->interrupts[index], + ext_irq->triggering, + ext_irq->polarity, + ext_irq->shareable, + ext_irq->wake_capable, false); else irqresource_disabled(res, 0); break; diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index da78dc77aed32e..55b28fc0a94042 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -206,7 +206,8 @@ static acpi_status pnpacpi_allocated_resource(struct ac= pi_resource *res, if (i >=3D 0) { flags =3D acpi_dev_irq_flags(gpio->triggering, gpio->polarity, - gpio->shareable); + gpio->shareable, + gpio->wake_capable); } else { flags =3D IORESOURCE_DISABLED; } @@ -315,7 +316,8 @@ static __init void pnpacpi_parse_irq_option(struct pnp_= dev *dev, if (p->interrupts[i]) __set_bit(p->interrupts[i], map.bits); =20 - flags =3D acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable); + flags =3D acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable, + p->wake_capable); pnp_register_irq_resource(dev, option_flags, &map, flags); } =20 @@ -339,7 +341,8 @@ static __init void pnpacpi_parse_ext_irq_option(struct = pnp_dev *dev, } } =20 - flags =3D acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable); + flags =3D acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable, + p->wake_capable); pnp_register_irq_resource(dev, option_flags, &map, flags); } =20 diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d3121cef6cc3bc..9f7947ee1b006f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -495,7 +495,8 @@ bool acpi_dev_resource_address_space(struct acpi_resour= ce *ares, struct resource_win *win); bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, struct resource_win *win); -unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); +unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, + u8 wake_capable); unsigned int acpi_dev_get_irq_type(int triggering, int polarity); bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, struct resource *res); diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 616b683563a970..3baeea4d903bfd 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -79,7 +79,8 @@ struct resource { #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) #define IORESOURCE_IRQ_LOWLEVEL (1<<3) #define IORESOURCE_IRQ_SHAREABLE (1<<4) -#define IORESOURCE_IRQ_OPTIONAL (1<<5) +#define IORESOURCE_IRQ_OPTIONAL (1<<5) +#define IORESOURCE_IRQ_WAKECAPABLE (1<<6) =20 /* PnP DMA specific bits (IORESOURCE_BITS) */ #define IORESOURCE_DMA_TYPE_MASK (3<<0) --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4ACC6FA82 for ; Wed, 14 Sep 2022 23:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbiINX7R (ORCPT ); Wed, 14 Sep 2022 19:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbiINX6t (ORCPT ); Wed, 14 Sep 2022 19:58:49 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDD9689922 for ; Wed, 14 Sep 2022 16:58:18 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id h194so11834975iof.4 for ; Wed, 14 Sep 2022 16:58:18 -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=IrPBaJhayTsmQaagjn3kGBNWcqMGVL6PSHf+mDSmAT8=; b=Y1rMEYUcGoMoMTmL0vNyZ/Dgi1ZPxTfb5SvVMCj/7FkWYfPrlBpw1G7bZh6wigSRWv dxIFsKThKju72lgMlIwoi+FSFG3YR1VVGwXGinDnM8cT9dAcz0w4yHNOdSLctMO3Nse/ gxvjDIMcRXW3Gh43U9XEz5nWl2/OCb1LxfEv0= 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=IrPBaJhayTsmQaagjn3kGBNWcqMGVL6PSHf+mDSmAT8=; b=6M/ZZS0YXswOKruREPvN6Z4xsNXynBdU3erIdbisQSZupHgNZNBYK9B7eEDYta4rZC mnBuQeRkTljpxwo57LAinWUAugVjfysKGtQIG8M7q98xxXj04W5TbBJIqtFke8N81GLz ivgwlW+kAFEK2VB4lbJW+ddYZsjanWk1vVSmn4gcl27MFj2QgKaJG0jcAIqbGbKoC7wr nFlNB9gQ4tgdKjPXqrOWaCtqCxZplkld2L8x7LjH+yKgX29jBM82hZJIS4wfBjliO0UU 3vDHGZZkSfzgEkIlkQojycC+dZ4HuF9/obkEtcN+OE+4zPi5HYsG+4hJV4fysxWSuv8L SFxQ== X-Gm-Message-State: ACgBeo1bSlUoR4iBMi0bsMDKrNiqnwqV786BghOmOKC+H7wR5ALOd+7N 7JxD0j6/7OS1lI8SsC46VUsS5g== X-Google-Smtp-Source: AA6agR5OMRFoje682GJ6kTpBwCWXG3yxx27f4f7Npbvq1pC39ftjUh8MPD+aKo/IsYS/pNqhTAlPBQ== X-Received: by 2002:a02:29c2:0:b0:34a:195e:9574 with SMTP id p185-20020a0229c2000000b0034a195e9574mr20424069jap.79.1663199898203; Wed, 14 Sep 2022 16:58:18 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:17 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Mika Westerberg , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/13] i2c: acpi: Use ACPI wake capability bit to set wake_irq Date: Wed, 14 Sep 2022 17:57:55 -0600 Message-Id: <20220914155914.v3.7.I8af4282adc72eb9f247adcd03676a43893a020a6@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Device tree already has a mechanism to pass the wake_irq. It does this by looking for the wakeup-source property and setting the I2C_CLIENT_WAKE flag. This CL adds the ACPI equivalent. It uses the ACPI interrupt wake flag to determine if the interrupt can be used to wake the system. Previously the i2c drivers had to make assumptions and blindly enable the wake IRQ. This can cause spurious wake events. e.g., If there is a device with an Active Low interrupt and the device gets powered off while suspending, the interrupt line will go low since it's no longer powered and wakes the system. For this reason we should respect the board designers wishes and honor the wake bit defined on the interrupt. Signed-off-by: Raul E Rangel Reviewed-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- Changes in v3: - Convert wake_capable to bool - Only update wake_capable pointer once - Move wake_capable local into local block Changes in v2: - Look at wake_cabple bit for IRQ/Interrupt resources drivers/i2c/i2c-core-acpi.c | 33 ++++++++++++++++++++++++--------- drivers/i2c/i2c-core-base.c | 8 +++++++- drivers/i2c/i2c-core.h | 4 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index c762a879c4cc6b..b3d68a9659ff4f 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -137,6 +137,11 @@ static const struct acpi_device_id i2c_acpi_ignored_de= vice_ids[] =3D { {} }; =20 +struct i2c_acpi_irq_context { + int irq; + bool wake_capable; +}; + static int i2c_acpi_do_lookup(struct acpi_device *adev, struct i2c_acpi_lookup *lookup) { @@ -170,11 +175,14 @@ static int i2c_acpi_do_lookup(struct acpi_device *ade= v, =20 static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data) { - int *irq =3D data; + struct i2c_acpi_irq_context *irq_ctx =3D data; struct resource r; =20 - if (*irq <=3D 0 && acpi_dev_resource_interrupt(ares, 0, &r)) - *irq =3D i2c_dev_irq_from_resources(&r, 1); + if (irq_ctx->irq <=3D 0 && acpi_dev_resource_interrupt(ares, 0, &r)) { + irq_ctx->irq =3D i2c_dev_irq_from_resources(&r, 1); + irq_ctx->wake_capable =3D + !!(r.flags & IORESOURCE_IRQ_WAKECAPABLE); + } =20 return 1; /* No need to add resource to the list */ } @@ -182,31 +190,38 @@ static int i2c_acpi_add_resource(struct acpi_resource= *ares, void *data) /** * i2c_acpi_get_irq - get device IRQ number from ACPI * @client: Pointer to the I2C client device + * @wake_capable: Set to true if the IRQ is wake capable * * Find the IRQ number used by a specific client device. * * Return: The IRQ number or an error code. */ -int i2c_acpi_get_irq(struct i2c_client *client) +int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable) { struct acpi_device *adev =3D ACPI_COMPANION(&client->dev); struct list_head resource_list; - int irq =3D -ENOENT; + struct i2c_acpi_irq_context irq_ctx =3D { + .irq =3D -ENOENT, + }; int ret; =20 INIT_LIST_HEAD(&resource_list); =20 ret =3D acpi_dev_get_resources(adev, &resource_list, - i2c_acpi_add_resource, &irq); + i2c_acpi_add_resource, &irq_ctx); if (ret < 0) return ret; =20 acpi_dev_free_resource_list(&resource_list); =20 - if (irq =3D=3D -ENOENT) - irq =3D acpi_dev_gpio_irq_get(adev, 0); + if (irq_ctx.irq =3D=3D -ENOENT) + irq_ctx.irq =3D acpi_dev_gpio_irq_wake_get(adev, 0, + &irq_ctx.wake_capable); + + if (wake_capable) + *wake_capable =3D irq_ctx.wake_capable; =20 - return irq; + return irq_ctx.irq; } =20 static int i2c_acpi_get_info(struct acpi_device *adev, diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 91007558bcb260..c4debd46c6340f 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -487,8 +487,14 @@ static int i2c_device_probe(struct device *dev) if (irq =3D=3D -EINVAL || irq =3D=3D -ENODATA) irq =3D of_irq_get(dev->of_node, 0); } else if (ACPI_COMPANION(dev)) { - irq =3D i2c_acpi_get_irq(client); + bool wake_capable; + + irq =3D i2c_acpi_get_irq(client, &wake_capable); + + if (irq > 0 && wake_capable) + client->flags |=3D I2C_CLIENT_WAKE; } + if (irq =3D=3D -EPROBE_DEFER) { status =3D irq; goto put_sync_adapter; diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 87e2c914f1c57b..1247e6e6e97517 100644 --- a/drivers/i2c/i2c-core.h +++ b/drivers/i2c/i2c-core.h @@ -61,11 +61,11 @@ static inline int __i2c_check_suspended(struct i2c_adap= ter *adap) #ifdef CONFIG_ACPI void i2c_acpi_register_devices(struct i2c_adapter *adap); =20 -int i2c_acpi_get_irq(struct i2c_client *client); +int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable); #else /* CONFIG_ACPI */ static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } =20 -static inline int i2c_acpi_get_irq(struct i2c_client *client) +static inline int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_c= apable) { return 0; } --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3816C6FA89 for ; Wed, 14 Sep 2022 23:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbiINX7V (ORCPT ); Wed, 14 Sep 2022 19:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbiINX7A (ORCPT ); Wed, 14 Sep 2022 19:59:00 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 212EF89933 for ; Wed, 14 Sep 2022 16:58:19 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id n81so13220338iod.6 for ; Wed, 14 Sep 2022 16:58:19 -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=F4E89pQ2FrSepPnER/REAyEkKBd4VwJQnWtxeznDInw=; b=gIASrLgf9OZ8PhCuu5JVaGjTRHApQbKQ2UubkA8t7hWpqS7r2E/RwDlv7HQWzQ6LKL 6+JM6MNE9aTtuT9HqVQ6yw1x4Qq5HE5cVQWl+oPEpoTnD1HyKjgxUHHc7TcGO4Yo0txa Kr8d3LFOQUiPV7G76rXMBecTPmCqhBTW03g/8= 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=F4E89pQ2FrSepPnER/REAyEkKBd4VwJQnWtxeznDInw=; b=kdi0euZ0QqxLGoNYGuf43uRmHbIAfe6EMw9e0FRDB+VenLwrz4uJOUpDjBGSTq8IkJ K7djxrI+WDjDYbtOS5HjbZADFeoHnOgj0pQ5c/DaIgzoXP0cYjM/XesoJvA3tdmKbtl/ T849zu5vCSsc9ipw14AHeLsK+OUGBYTyrzaXaVpEMXxYhG7riVvb7203SNvAEe2fP5TA 26pBzgOrg1byiwfFG0FV/rLaZmM0IjSuu9UnFe86j+UuM/GJzyklmJ7MY/nZ77Cw7ujV RbXX2bSakAwhJu47wnUdeAMcsEmfq5FiC0eK4595JdCCFbUc2OgZej82Q7BHL1EA7VVr Z6Jw== X-Gm-Message-State: ACgBeo19ISzT5SjHGmREiQbKq2ZMsKa4ezYJs/UBDAuJZ4s3+GFlQMEK aMxtOSht8aql4MD/j9bVRXnGIA== X-Google-Smtp-Source: AA6agR4JGY5A/brDWXhKfOsB5rBjLJjaRvPL9vy0Xiv7IbO9ITalfAZiHczbd/6pH+4/aoTa1Eicog== X-Received: by 2002:a05:6602:2a47:b0:689:e971:8e67 with SMTP id k7-20020a0566022a4700b00689e9718e67mr16872002iov.47.1663199899601; Wed, 14 Sep 2022 16:58:19 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:19 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Len Brown , linux-kernel@vger.kernel.org Subject: [PATCH v3 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle Date: Wed, 14 Sep 2022 17:57:56 -0600 Message-Id: <20220914155914.v3.8.I7d9202463f08373feccd6e8fd87482c4f40ece5d@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This change adds support for ACPI devices that use ExclusiveAndWake or SharedAndWake in their _CRS GpioInt definition (instead of using _PRW), and also provide power resources. Previously the ACPI subsystem had no idea if the device had a wake capable interrupt armed. This resulted in the ACPI device PM system placing the device into D3Cold, and thus cutting power to the device. With this change we will now query the _S0W method to figure out the appropriate wake capable D-state. Signed-off-by: Raul E Rangel --- (no changes since v1) drivers/acpi/device_pm.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 9dce1245689ca2..6bc81f525d5160 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -681,8 +681,23 @@ static int acpi_dev_pm_get_state(struct device *dev, s= truct acpi_device *adev, d_min =3D ret; wakeup =3D device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >=3D target_state; - } else { - wakeup =3D adev->wakeup.flags.valid; + } else if (acpi_device_can_wakeup(adev)) { + /* ACPI GPE from specified by _PRW. */ + wakeup =3D true; + } else if (device_may_wakeup(dev) && dev->power.wakeirq) { + /* + * The ACPI subsystem doesn't manage the wake bit for IRQs + * defined with ExclusiveAndWake and SharedAndWake. Instead we + * expect them to be managed via the PM subsystem. Drivers + * should call dev_pm_set_wake_irq to register an IRQ as a wake + * source. + * + * If a device has a wake IRQ attached we need to check the + * _S0W method to get the correct wake D-state. Otherwise we + * end up putting the device into D3Cold which will more than + * likely disable wake functionality. + */ + wakeup =3D true; } =20 /* --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B32C2C6FA8D for ; Wed, 14 Sep 2022 23:59:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbiINX7h (ORCPT ); Wed, 14 Sep 2022 19:59:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiINX7M (ORCPT ); Wed, 14 Sep 2022 19:59:12 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D756B89CD4 for ; Wed, 14 Sep 2022 16:58:22 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id i7so4664139ioa.5 for ; Wed, 14 Sep 2022 16:58:22 -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=rcvDP2WJ+fQZJ5qsY5Dl3GZhszdSslMkj/qO46b14mU=; b=kDCQFccX2w7tlX6d2bXrWMrcaaS35CZD/Vo0cp8z8vLHUxNox+MW9MuYtm0sNXoyMy bqHFfJsYkqcfgCkg5RQOj0p6TD9nX4rjmahMnQJdT1WPBFPjCIBI5vL1/QoluEsfwB2y s7ejhz0ldATLHLOq141U+zdmMdaUc3g9XeRNA= 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=rcvDP2WJ+fQZJ5qsY5Dl3GZhszdSslMkj/qO46b14mU=; b=bI4cO4gM0F6YWJDf/4IN53aaehI0ElEKI9NidZcWyrOz8l+n26VF4FMqqdcS9U1cNB Hc17DTiWmZKQINWJuDlniU3I4p1j/BbhpyYo5Uiqqo6T3/MCY51IERtJl7dCVN6QhQ26 oxg5Nw7EuB+CHAWRHcpxdGDZRGS+nyGy6OPqJwg78ZXWtpLvXr6p3iIwCRiCOjg95K+7 WfWD0PbBc1ykf469XnNuwnIK/BuAVSnEoAfMwCM5y003iQ2qxJvgf799/HBZMnYx8+UC R/KXxylU9HQRTyOKDFYcBMF9s3t+TbCqTVMe8S/d+NKJY07eyghC0x5/dmmTLgiUFSp+ TZ1Q== X-Gm-Message-State: ACgBeo3LnCw54KVWgiM4LWRJgs3zXkaAiyBM+wNSTc1NYawfGO1+YfYZ 0XLtthRws7Pdd21lZf/Wk9U1KQ== X-Google-Smtp-Source: AA6agR7RCrayZe6uYU6txqlWKyIA7Yzw/43TVXUadSMJuymKB6iwV3TNib0B3yWzAVCT8sb/tC8agQ== X-Received: by 2002:a05:6638:1492:b0:35a:5484:b8db with SMTP id j18-20020a056638149200b0035a5484b8dbmr5460661jak.236.1663199901611; Wed, 14 Sep 2022 16:58: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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:20 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Alistair Francis , Benjamin Tissoires , Jiri Kosina , Rob Herring , linux-kernel@vger.kernel.org Subject: [PATCH v3 09/13] HID: i2c-hid: acpi: Stop setting wakeup_capable Date: Wed, 14 Sep 2022 17:57:57 -0600 Message-Id: <20220914155914.v3.9.I2efb7f551e0aa2dc4c53b5fd5bbea91a1cdd9b32@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This is now handled by the i2c-core driver. Signed-off-by: Raul E Rangel --- (no changes since v1) drivers/hid/i2c-hid/i2c-hid-acpi.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-h= id-acpi.c index b96ae15e0ad917..375c77c3db74d9 100644 --- a/drivers/hid/i2c-hid/i2c-hid-acpi.c +++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c @@ -105,11 +105,6 @@ static int i2c_hid_acpi_probe(struct i2c_client *clien= t) =20 acpi_device_fix_up_power(adev); =20 - if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) { - device_set_wakeup_capable(dev, true); - device_set_wakeup_enable(dev, false); - } - return i2c_hid_core_probe(client, &ihid_acpi->ops, hid_descriptor_address, 0); } --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87A56C6FA82 for ; Thu, 15 Sep 2022 00:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbiINX77 (ORCPT ); Wed, 14 Sep 2022 19:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbiINX7Q (ORCPT ); Wed, 14 Sep 2022 19:59:16 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E6489CE6 for ; Wed, 14 Sep 2022 16:58:24 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id q83so11598424iod.7 for ; Wed, 14 Sep 2022 16:58:23 -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=Tzm/qE0nIcj5tRamCrRt6njHA6IRj7QMwAd5TFMNttM=; b=f+uY/ykQ2N1q+rdYu8jKDpUxlM3M+rtbNbs4D9RuWOKew6gZaVJ3lWicXvGpa/XlQv 4P26C3WsM5OzkXp4sYO+Io0NP/b7YfZKRCmnVeyvsTKawrGXyE98bMF/UH8ZNBNV0iYs M+81ec/KLITJHp2ZZzavFjJV/x50IaUXJvyps= 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=Tzm/qE0nIcj5tRamCrRt6njHA6IRj7QMwAd5TFMNttM=; b=OtkySyv39Eb/j/I40ADyWZ8iaz80Os/XBVd3HdzKXCrJ55QmmIUkka4k1gULHtSeoq A/RxBHJi6aZ2S84g/KWk/nAfUa2p2wNwffa9u7xPts2Wt2zdIGovAw83NgXFel8IHxmt EM7/CbDAJKdKabbZ/lXUJCm8AdiuPRWDvm86U20EvAatH6Tp4dYtChMd8bbFLsDK9H6j F6QzhAswbs3nxv4AJpVuVxxWJ29D0CwlBVEyPh21/vGWHC3fS3OSQQ0uxMUFNBCYYEDb Bl1Nc053jp8jlu7Y3W5o41FTqe/F6vmEG0kPoBDp8TMqfPIRVhbzvr0cJ4EIAf9MeDDb aFGQ== X-Gm-Message-State: ACgBeo1bH5rwIr8KaJmdEJ26bo7+WjX7mVQywWVigXg9VPXgIyEoubOe 1AifYFtoXGQNEUzyEO3FDur51A== X-Google-Smtp-Source: AA6agR6aE4wqc9ke7SPbqL8w3vmm6itl3pgxCmCedNuAqe/EnMEiQCxXSA0p93LMJLkGd0PZ8MoQ0A== X-Received: by 2002:a05:6638:3470:b0:35a:1b16:f140 with SMTP id q48-20020a056638347000b0035a1b16f140mr10963554jav.150.1663199903108; Wed, 14 Sep 2022 16:58:23 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:22 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Alistair Francis , Angela Czubak , Benjamin Tissoires , Jiri Kosina , Radoslaw Biernacki , Yang Li , linux-kernel@vger.kernel.org Subject: [PATCH v3 10/13] HID: i2c-hid: Don't set wake_capable and wake_irq Date: Wed, 14 Sep 2022 17:57:58 -0600 Message-Id: <20220914155914.v3.10.Id22d056440953134d8e8fe2c2aff79c79bc78424@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The i2c-core will now handle setting the wake_irq for DT and ACPI systems. Signed-off-by: Raul E Rangel --- (no changes since v1) drivers/hid/i2c-hid/i2c-hid-core.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-h= id-core.c index a2fa40dec04ea5..65b7a95956866d 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -1036,15 +1036,6 @@ int i2c_hid_core_probe(struct i2c_client *client, st= ruct i2chid_ops *ops, if (ret < 0) goto err_powered; =20 - /* - * 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 (!client->dev.power.wakeirq) - dev_pm_set_wake_irq(&client->dev, client->irq); - hid =3D hid_allocate_device(); if (IS_ERR(hid)) { ret =3D PTR_ERR(hid); --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFCFDC6FA82 for ; Wed, 14 Sep 2022 23:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229768AbiINX7q (ORCPT ); Wed, 14 Sep 2022 19:59:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbiINX7P (ORCPT ); Wed, 14 Sep 2022 19:59:15 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FBC989CEF for ; Wed, 14 Sep 2022 16:58:25 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id k2so8844729ilu.9 for ; Wed, 14 Sep 2022 16:58:25 -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=H54d0G6AAErtN9paRV2+6Wo2Il0gAFeOcBLywRUXXa0=; b=KKodXfjiFWL8hO25Cc/Etaa8UU5/33Qel0Ut/93Dd4jFqU1m4zVtYj9oryjfKZXV+1 SQH08v978uhL8OKjdw72ZoFUvOyKL23NvujZmenkJYBdgBBPzl8PgFPnPvmDXd4qPy4p DKxG6UM6GG2c7X5o80ffKWILUsl3cYsiVRciI= 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=H54d0G6AAErtN9paRV2+6Wo2Il0gAFeOcBLywRUXXa0=; b=0mH5laNnVaRxAj7wCLgugq/UpryqhDZtKo5YT637U6H1Ei/quxyYtLSPutd9SSEzlb 00Mcx2Wkuk6aR4CsYKv+egCcUANScI5/dePGvLrJ4M3mN84Rf7VqXxC/5q4k4peFyvGA JRUjxUerRNiPlvaHLr3gnev+d3SZKC1+t9lh0HeLHm0Srf2NoyMUDWlRhYMYKnFeCe2+ LJ0ecjm7mDnAqCNli5AWkEMws7pYW5eZfvvLEHZkxiWzLBkCqgTJX4ZtAjpz2KN2bi4Z +FKR7PUqrpUMebGvOjY8/KJcgzc0Ee5N/ZfxeV2D8zFxars8SkrBx39L1mNM7Pfnn+Iz nZMg== X-Gm-Message-State: ACgBeo00NP4sSBvRhJMJDIJBBOqvu+4/BBMQ043AGxOYck5ud8I/mgZA raTayzPTThhY343zl0P7zkCiUg== X-Google-Smtp-Source: AA6agR77Y9L4Cs5c5NRnJj3AxXZXt2uIl+CPQ8FXJ/1cBBUpbTm6gMAL8RdFcXZFMGBt4hdpYAgA9g== X-Received: by 2002:a05:6e02:15c9:b0:2da:c33e:49c7 with SMTP id q9-20020a056e0215c900b002dac33e49c7mr15445970ilu.26.1663199904317; Wed, 14 Sep 2022 16:58:24 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:23 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v3 11/13] Input: elan_i2c - Don't set wake_capable and wake_irq Date: Wed, 14 Sep 2022 17:57:59 -0600 Message-Id: <20220914155914.v3.11.I7309b8f322082437b93581c6e2953886eeb998d7@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The i2c-core will now handle setting the wake_irq and wake capability for DT and ACPI systems. Signed-off-by: Raul E Rangel --- (no changes since v2) Changes in v2: - I chose not to keep the legacy code around since systems without DT or AC= PI should be rare. drivers/input/mouse/elan_i2c_core.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan= _i2c_core.c index 3947474e93d16a..b25b94aba3e88e 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1332,22 +1332,6 @@ static int elan_probe(struct i2c_client *client, } } =20 - /* - * Systems using device tree should set up wakeup via DTS, - * the rest will configure device as wakeup source by default. - */ - 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; } =20 --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D05ECECAAD3 for ; Wed, 14 Sep 2022 23:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbiINX7y (ORCPT ); Wed, 14 Sep 2022 19:59:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbiINX7P (ORCPT ); Wed, 14 Sep 2022 19:59:15 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 594E889CF9 for ; Wed, 14 Sep 2022 16:58:26 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id h194so11835149iof.4 for ; Wed, 14 Sep 2022 16:58:26 -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=ETp6lHAE1kwX97QdZzpHEsClO/L2A3yvzqUq+PQbIOE=; b=Nes0kQOFzscL0Qf9zV4Hrr4MiAQ6+jxqLLdB+8yC192cawXtalPd3EcEcMoBVjRT3Y T3/c/9YRh9Io5qmYle40ANr086Sy/CUbJT6RTvzGkEt5GruOugDUvKZtaiUsHzb42/Jy 2iiVSV5FY+xSEYlohMd4dab/lBKwWtAVu9EU4= 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=ETp6lHAE1kwX97QdZzpHEsClO/L2A3yvzqUq+PQbIOE=; b=21c1HaoV8Egcl3EtozoC7fKJLw4jznjKMD6H6nrvX0g8cEGu215KOMUgOXPaKVbxkX BpIXtl4hrOBpCEiFKnXxev54eSj6xaoEFsr7u/DvsZPB65LM2IbX36BgCwECG7y+Iiry g2ixHgZwr8ObNPnF63d7RDJuEzbg3BKRUaw+8g5B/bJLXIVJFdDSgmtnOmNSNzMdr8yE xQTgZPbByaTPtIMRf5bA0P5cqSsuYdaEKXkKTh3LBJTLOSfyBDQAyYkpIFfc+DSaZgB9 wenRvOaCjVClc4sRV6tZZSOGMfnr/d81Yq87IhPp+5ATgE6cbV/zb5jEdZd76kCH1GQG 1lEA== X-Gm-Message-State: ACgBeo09Ty7oRvCOdB9w4MXfkYcq5XHTCG0wkOtiNg5KMbg2cHJQZWj9 RzIfZj0gDDIcf1jsGDOalEp2uQ== X-Google-Smtp-Source: AA6agR5mTcH2fkavtZgo9Ruoe0xjaaOwQFLXmjLNc53nYsPlGtxolxjy0T1nW4+5zCmUvu58MldqKg== X-Received: by 2002:a05:6602:2e0e:b0:684:e4f9:734a with SMTP id o14-20020a0566022e0e00b00684e4f9734amr16433045iow.200.1663199905827; Wed, 14 Sep 2022 16:58:25 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:25 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Cai Huoqing , Douglas Anderson , Guenter Roeck , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH v3 12/13] Input: elants_i2c - Don't set wake_capable and wake_irq Date: Wed, 14 Sep 2022 17:58:00 -0600 Message-Id: <20220914155914.v3.12.I031ffbe411e1bae20bf16a1876da5baf444c7928@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The i2c-core will now handle setting the wake_irq and wake capability for DT and ACPI systems. Signed-off-by: Raul E Rangel --- (no changes since v1) drivers/input/touchscreen/elants_i2c.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchsc= reen/elants_i2c.c index 80e16b533c452a..3500293bb1d8e1 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -1575,22 +1575,6 @@ static int elants_i2c_probe(struct i2c_client *clien= t) return error; } =20 - /* - * Systems using device tree should set up wakeup via DTS, - * the rest will configure device as wakeup source by default. - */ - if (!client->dev.of_node) - device_init_wakeup(&client->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 (!client->dev.power.wakeirq) - dev_pm_set_wake_irq(&client->dev, client->irq); - error =3D devm_device_add_group(&client->dev, &elants_attribute_group); if (error) { dev_err(&client->dev, "failed to create sysfs attributes: %d\n", --=20 2.37.3.968.ga6b4b080e4-goog From nobody Fri Apr 3 06:41:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B622BECAAD3 for ; Thu, 15 Sep 2022 00:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbiIOAAX (ORCPT ); Wed, 14 Sep 2022 20:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbiINX7T (ORCPT ); Wed, 14 Sep 2022 19:59:19 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2AC38A1DC for ; Wed, 14 Sep 2022 16:58:28 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id b17so8870164ilh.0 for ; Wed, 14 Sep 2022 16:58:28 -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=uhn02vEcgNMuC4NDL/sdnIiKkA3NV83noPVamoKM5ng=; b=CUY+j8lfqODpV6DVbuXvgKk/Ghv9VtblK0owray+MH9wC6UJNBrLrCh9A9Yyywkhlm yaAi8kGepOFd43VgdkMBlZDFmoErxsdPdjxgvgTbmzPE0a6muHa33Z5uQhjAExy6SiiR XUFcUXayPecAeAVe07X1tc+re030iwcVilHCc= 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=uhn02vEcgNMuC4NDL/sdnIiKkA3NV83noPVamoKM5ng=; b=ihQUp7h2nm0JDc7EYo46tZJKcTkMIKESusbOWxKNQgq8UYvFDSdv9iGc2xizCQtWWV U3uF1sLg3KRSVxPKiBydPkOLGKz1NZYS6mvJ49OcqvfwWnxtUUPVOBOq2JorZQDjGT2l ByDrzQgNxFd3Kk+RFVu2krCkhCg9OITMsXt1XvD1zEfxJEJCDxGpHYgNWa9O5zxZaDte 6rv52NUT1vmYBZ/kIgY3nw6q3oVyuxR/8fIuce0muoAGvZ7hZee0Rd1Z4FlcbL5G/eXo sRFhMklan2jpDUBFChFqZldpOTobJ/LGoZ0w1SGMUjPj7dj1FHc/jfseWkFGopuk0/v/ RwGg== X-Gm-Message-State: ACgBeo0nL6/9l6LjBSFHlePasIfbyW+a448GQTkn0/Aqtx3T2Op04KoC IAeIChb4r0P2/sXwsjqRAeL+Gw== X-Google-Smtp-Source: AA6agR6hBuemwCwJosU43o/dcXHSnguus+BYHG6PYVnm3q74Ihk+SI6tjIeZ7CFKssUKKX5eQ2TTgw== X-Received: by 2002:a05:6e02:16cc:b0:2f1:b896:efbf with SMTP id 12-20020a056e0216cc00b002f1b896efbfmr15983168ilx.102.1663199907391; Wed, 14 Sep 2022 16:58:27 -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 a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:26 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Cai Huoqing , linux-kernel@vger.kernel.org Subject: [PATCH v3 13/13] Input: raydium_ts_i2c - Don't set wake_capable and wake_irq Date: Wed, 14 Sep 2022 17:58:01 -0600 Message-Id: <20220914155914.v3.13.Ia0b24ab02c22125c5fd686cc25872bd26c27ac23@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The i2c-core will now handle setting the wake_irq and wake capability for DT and ACPI systems. Signed-off-by: Raul E Rangel --- (no changes since v1) drivers/input/touchscreen/raydium_i2c_ts.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/tou= chscreen/raydium_i2c_ts.c index 66c5b577b791d4..88d187dc5d325f 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -1185,15 +1185,6 @@ static int raydium_i2c_probe(struct i2c_client *clie= nt, return error; } =20 - /* - * 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 (!client->dev.power.wakeirq) - dev_pm_set_wake_irq(&client->dev, client->irq); - error =3D devm_device_add_group(&client->dev, &raydium_i2c_attribute_group); if (error) { --=20 2.37.3.968.ga6b4b080e4-goog