From patchwork Mon Sep 19 15:59:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607679 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 BDD7EECAAD3 for ; Mon, 19 Sep 2022 15:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbiISP73 (ORCPT ); Mon, 19 Sep 2022 11:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230351AbiISP7Y (ORCPT ); Mon, 19 Sep 2022 11:59:24 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33A414D08 for ; Mon, 19 Sep 2022 08:59:20 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id r134so23247385iod.8 for ; Mon, 19 Sep 2022 08:59:20 -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=hW0QoRs4aWz8hGceJu4a+SyoEP3lH5DdnWRzHluqBu0=; b=JaRo1ZTosTQe/0vWKQtXv0b1sMnT6M3VYtemc310W1+Gv5fsWMXd99UEw6C8wCFm6k qRysnmVAG/l7seml6DPM7LEqmrnIbSXD6Egre0UF4WVNVOGNoQ5A3TPwHK0yTtzVc+Ww 8JdXGOfwDxJjO2Vb9ZBnrlhGDD3o5UyyY7+aM= 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=hW0QoRs4aWz8hGceJu4a+SyoEP3lH5DdnWRzHluqBu0=; b=DN4wJT8VJo44gcluhCeK99wY3BFNYxKBQEeDO5V8bbaaO+85N1Jqegq6skmzV13j1t o6zuoePXYesIskgiZfauUo71j80N6Lu4dBmQ3DpIuncCbO3XC9DRbf1/nm9Kg76dg9A6 OXIaSHR0X3PMDhbhYQAVbZssf0NYPr3ogO3E6bBp7jNyn2iK3xYA9O1aROZQSjYQQTfQ JuInQg6KAgwO6bydeimunUSoQlHE4f1s8H4gYHXmB4N6ZXHKrwt3APM/SrNje4wyyILT THd+fUUVpmLfSkuK8vL4IklhNuQA6NNlFlglqhnac3ctiwSN8FRiglywbTHXsB0+yTt5 wnGA== X-Gm-Message-State: ACrzQf1y+DT/3RudHHMp2t12S1ewcFAFP2YzRSNwNAMaDK5SY9j+IDwx QsH7JcMt5jy3TT8eMYQEwAXOieabve5i8w== X-Google-Smtp-Source: AMsMyM5fGCKLLR+QD3OurBycWEJzSYo4BJhLo9F9vzj6fE4Q9/zHCZGYzeToxkoOFD+g2Q/rO1WIvA== X-Received: by 2002:a05:6638:24cc:b0:35a:5ee3:8f68 with SMTP id y12-20020a05663824cc00b0035a5ee38f68mr8828022jat.255.1663603160022; Mon, 19 Sep 2022 08:59:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:19 -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 , Alistair Francis , Angela Czubak , Bartosz Szczepanek , Benjamin Tissoires , Greg Kroah-Hartman , Jiri Kosina , linux-kernel@vger.kernel.org Subject: [PATCH v4 01/13] HID: i2c-hid: Use PM subsystem to manage wake irq Date: Mon, 19 Sep 2022 09:59:03 -0600 Message-Id: <20220919095504.v4.1.Id4b4bdfe06e2caf2d5a3c9dd4a9b1080c38b539c@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- (no changes since v3) 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-hid-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 { wait_queue_head_t wait; /* For waiting the interrupt */ - bool irq_wake_enabled; struct mutex reset_lock; struct i2chid_ops *ops; @@ -1036,6 +1036,15 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, if (ret < 0) goto err_powered; + /* + * 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 = hid_allocate_device(); if (IS_ERR(hid)) { ret = PTR_ERR(hid); @@ -1119,7 +1128,6 @@ static int i2c_hid_core_suspend(struct device *dev) struct i2c_hid *ihid = i2c_get_clientdata(client); struct hid_device *hid = ihid->hid; int ret; - int wake_status; ret = hid_driver_suspend(hid, PMSG_SUSPEND); if (ret < 0) @@ -1130,16 +1138,8 @@ static int i2c_hid_core_suspend(struct device *dev) disable_irq(client->irq); - if (device_may_wakeup(&client->dev)) { - wake_status = enable_irq_wake(client->irq); - if (!wake_status) - ihid->irq_wake_enabled = 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); - } return 0; } @@ -1150,18 +1150,9 @@ static int i2c_hid_core_resume(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct i2c_hid *ihid = i2c_get_clientdata(client); struct hid_device *hid = ihid->hid; - int wake_status; - 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 = disable_irq_wake(client->irq); - if (!wake_status) - ihid->irq_wake_enabled = false; - else - hid_warn(hid, "Failed to disable irq wake: %d\n", - wake_status); - } enable_irq(client->irq); From patchwork Mon Sep 19 15:59:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607360 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 DA522C54EE9 for ; Mon, 19 Sep 2022 15:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229749AbiISP7a (ORCPT ); Mon, 19 Sep 2022 11:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbiISP71 (ORCPT ); Mon, 19 Sep 2022 11:59:27 -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 E459C27B26 for ; Mon, 19 Sep 2022 08:59:21 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id g8so20599809iob.0 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=qfwv+UFwq1gGUUo3NqAnkC7s6DUwn0FDvRLHTlKeRl1yjbT8heNZHrPIjfKhtu6qUr laG7Zs9iXhvHllVqOhsTFOX21R0OItft3JO/qh7jYoNURntAVg5uAo8rbDYsZEHt7z1U NGkhUqGm85Uwup1BGTa+pGlHIyo9m5EEJv0Ap3BCa//H+N/AjJUu7dimp5SZf5WWy+MK 0BQkpA9v8koa9OrVymAYIVA5NexVdgYqmoNP0WE6e1hjL/b5zskVhiF801vDw6upp9Rq ryk2YOKwYjF+Z7U/pU1O3y+Y2xIIKy0pUuuWHgfTxgN9j0ai3t4QNQqdfJ2oXQ8R5pdH mAuA== X-Gm-Message-State: ACrzQf2WYmnJnbGAId7dDbUAwUZK9WcPLXtXCWjlSHXKBIQOlA5dDmgc BUla47g2lmC3YsJOW+SWLkg1qpo9bQQvhQ== X-Google-Smtp-Source: AMsMyM4uQsbYtHrhy3e1HotDvDIJlDF3CluBTZ2x3HRVtmJdAnjyY6HjDsKlgBnrozxlQumsOE61iQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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); From patchwork Mon Sep 19 15:59:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607678 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 6E887C6FA86 for ; Mon, 19 Sep 2022 15:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbiISP7c (ORCPT ); Mon, 19 Sep 2022 11:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbiISP71 (ORCPT ); Mon, 19 Sep 2022 11:59:27 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 717742E9E0 for ; Mon, 19 Sep 2022 08:59:23 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id m16so1679763iln.9 for ; Mon, 19 Sep 2022 08:59: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=uLFsVomnZ3NOv94HIF7hfztjoJa5WoPp5LmQm5BO1Bo=; b=adhgguZ3/jkoq54Ux4JQdP94x9fs+qUO+1yVoIOE8+jcSOfv7mJJAyhMb/fPqVbrj7 oy3X9S8/qa9d2IhQitudZq3ja1RgmMIFG6U7eWF6IK/0eJdsDwI1tYpjACd6fODEBnbn MYRjib6QiExCxohjxbSw647pAlE7Lq3QbYuoU= 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=r7iUY7B8omcVYwNILnNqJhoGH0/sOeLwgW9F6HvpCPddIpFvJ4HGK6Gn9O4qyGS667 xA2oixTB1vheSpdRopiKhQ+/Iq77C+qlYiEIbZGcJlReVyZvec5yv+j3K0mjp6LcgzmT EDjCRWpdVrMZQxKtxhHKGSUR10s6C0047pTqOE1MD6fpNymcqazdRuzj1Y+ftkn0Ee8+ 3Te6Nx/TZQM066D+CuW4HkBSRVK+cnseVZ7qCPKzsRSNf4+5Su1b7E1WhEHq2j74NMIK 0KwCyY1W1OhV8fF/Ep3u4uFzVxHPm8PqdpZqHXKONwsiPE/s5MXFgB5dEmOs00RQerhV vetg== X-Gm-Message-State: ACrzQf0PP9RIkis4i15TrOZohKbvM3TE4hnemdtOWRaD+Il+sfxDw8ys p7KDZJNMlf6wKyYwcfutvExnyp4eavo6Uw== X-Google-Smtp-Source: AMsMyM46Xy66tHQPUvK53ZwmhKXupAzGSOvhBQpX8Ceb0GWMcSl0Qg8peCV1ERPwHymAU1ifjBDuKQ== X-Received: by 2002:a05:6e02:b2a:b0:2f1:73e7:9e0c with SMTP id e10-20020a056e020b2a00b002f173e79e0cmr7880913ilu.298.1663603162669; Mon, 19 Sep 2022 08:59:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:21 -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 , Cai Huoqing , Douglas Anderson , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH v4 03/13] Input: elants_i2c - Use PM subsystem to manage wake irq Date: Mon, 19 Sep 2022 09:59:05 -0600 Message-Id: <20220919095504.v4.3.I5862429ee3e4de0f9ad5ba01ce07ad99eec10cf0@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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/touchscreen/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; - bool wake_irq_enabled; bool keep_power_in_suspend; /* Must be last to be used for DMA operations */ @@ -1582,6 +1582,15 @@ static int elants_i2c_probe(struct i2c_client *client) 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 = 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 device *dev) * The device will automatically enter idle mode * that has reduced power consumption. */ - ts->wake_irq_enabled = (enable_irq_wake(client->irq) == 0); + return 0; } else if (ts->keep_power_in_suspend) { for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { error = elants_i2c_send(client, set_sleep_cmd, @@ -1655,8 +1664,6 @@ static int __maybe_unused elants_i2c_resume(struct device *dev) int error; 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 = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { From patchwork Mon Sep 19 15:59:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607359 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 9A50DC6FA90 for ; Mon, 19 Sep 2022 15:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbiISP7g (ORCPT ); Mon, 19 Sep 2022 11:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbiISP71 (ORCPT ); Mon, 19 Sep 2022 11:59:27 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83ABC10544 for ; Mon, 19 Sep 2022 08:59:24 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id b23so23102813iof.2 for ; Mon, 19 Sep 2022 08:59:24 -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=ZngUizq7VcFRE2gCSa3EOt3saOcvQwlmUZCyGh1KdqK5/zqA0RnBzsAbsEwNbNR3rX 1pcZv5svW4JXFERWv6dBG7idg/ofdNr4FGr1sQkiVEjxfgf+S5Cn+sKNROVhwYqD/joh sme+ZnMaqEJqX7Qg4cLMZnGCNFCbAIWjtCv/w= 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=K6uqr5al0CX+wYQ2aU06o11bB+dHyyQBwAUCxRtUWKdH98ku1DddtnaSD9asH9EqIB MvhRUjVX5diBCCopm62I2gh+SVYRKIsZ0MQBV0qU8yelybnZQq7KtH8Xlv31VT1tLPXi 54qoGIWEUPPY3fv7Yg9zjbG8ap+KFKcNN3pOArRojbCg2FHuX/PQP4FxYXJWxijAA3od 7RWp5r5nflMvKVPghE/WtOeJKxSRwRhLVKadp67KdR12lletf0uiZUFEBecYSW90DMVt AlXCBoVA3WrybH6eAlfWlpnNQvOzcEY/VYI9g0sjwiThfHVU/sd27uP2m/skN4GLeWzY FGfA== X-Gm-Message-State: ACrzQf38Wetl1ZZxSQCDrO54DS8TwIxRfjhArLtdxQpHXxFYZoWox1Wd TZ/oXp5Q43vh683Kmcb4Os+IWRIlbS/jzg== X-Google-Smtp-Source: AMsMyM5AXRUUhA8MNcZP3YK8Ns1JNtpt92ZScgBH8ZtdCkKrjk0TgtxLbORZBAyGo+iM4LIkMtQBrQ== X-Received: by 2002:a02:c6c6:0:b0:359:b2d9:8838 with SMTP id r6-20020a02c6c6000000b00359b2d98838mr9042501jan.298.1663603163505; Mon, 19 Sep 2022 08:59: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 t70-20020a025449000000b00349fb9b1abesm5634154jaa.106.2022.09.19.08.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:23 -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 , Cai Huoqing , linux-kernel@vger.kernel.org Subject: [PATCH v4 04/13] Input: raydium_ts_i2c - Use PM subsystem to manage wake irq Date: Mon, 19 Sep 2022 09:59:06 -0600 Message-Id: <20220919095504.v4.4.I06b417b274bbecb31775a73993a7a3c1bc80de7b@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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/touchscreen/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; enum raydium_boot_mode boot_mode; - - bool wake_irq_enabled; }; /* @@ -1186,6 +1185,15 @@ static int raydium_i2c_probe(struct i2c_client *client, return error; } + /* + * 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 = 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) if (device_may_wakeup(dev)) { raydium_enter_sleep(client); - - ts->wake_irq_enabled = (enable_irq_wake(client->irq) == 0); } else { raydium_i2c_power_off(ts); } @@ -1237,8 +1243,6 @@ static int __maybe_unused raydium_i2c_resume(struct device *dev) struct raydium_data *ts = i2c_get_clientdata(client); 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); From patchwork Mon Sep 19 15:59:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607676 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 ECD9FC54EE9 for ; Mon, 19 Sep 2022 15:59:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230408AbiISP7m (ORCPT ); Mon, 19 Sep 2022 11:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiISP7g (ORCPT ); Mon, 19 Sep 2022 11:59:36 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC18E3334B for ; Mon, 19 Sep 2022 08:59:25 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id y9so1348106ily.11 for ; Mon, 19 Sep 2022 08:59: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=gXED57WKwVckRdQHbwT2Eq6sa7aYhI4W+2TJa3JDciU=; b=Mf1sBOPNqNg/sKZp2k/opTsjg5aLh8aokxFtkl9Y56d9Q62K2hEgRvMoPz9sxbY5dp apChXkmJxwM5/z8VqJqyaLXqF04qDq0De9EYs+s9zMBIjEEu1kSYEgEn3Wa1kMlUyccX N0TvWQz0ecUKmg3Cuc/frUPAweu2gIZnm803g= 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=gXED57WKwVckRdQHbwT2Eq6sa7aYhI4W+2TJa3JDciU=; b=71Py7bSEX/Np5wsR7F/EMiLrWZOgDDJmviuhzhti1jqrcslc+XhDhrX/+sKXA0427M 3UJQ8EpSVmZY6P6mz0GOEEnZ+Sm4XhNM3lYgIW15z16qDzPTwOtDerAEDPQneqLv692m doq07Q4YwzLPPwqQhARViHpXRKoiXvsISfL28zMyGBcn4AnNlcRBGNAbgoALA7+mFHO2 s35jv7y8v9TZz99z0ioqEAnlTz51am96d5RKXVGZHMBmOXEN3Nw2qDVW6mnK+46SahWT VPehZMmCZTrKdfdySlLWPlUq4aeJSaTVyfj+jwKrq58VNB9fAhfinSpte39XK1f3Nrpi xxEg== X-Gm-Message-State: ACrzQf2pKFxCTleMq/B/ChhRIpi8WRCnj3thzW2ewbGsDpWKGn2Rg664 9VFCdkCXtn5YVZuy482CVw21cCGPAZftbQ== X-Google-Smtp-Source: AMsMyM7c7Kxuux7MVeUl6bcD7vQjd9LVs5yY0daMec3JRJLy/jJIpBqjLIQVjwgBWZqzrNB0WDf3rw== X-Received: by 2002:a92:c60e:0:b0:2f4:c4eb:86a3 with SMTP id p14-20020a92c60e000000b002f4c4eb86a3mr7596822ilm.193.1663603164782; Mon, 19 Sep 2022 08:59: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 t70-20020a025449000000b00349fb9b1abesm5634154jaa.106.2022.09.19.08.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:24 -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 , Bartosz Golaszewski , Len Brown , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 05/13] gpiolib: acpi: Add wake_capable variants of acpi_dev_gpio_irq_get Date: Mon, 19 Sep 2022 09:59:07 -0600 Message-Id: <20220919095504.v4.5.I4ff95ba7e884a486d7814ee888bf864be2ebdef4@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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: Mika Westerberg Reviewed-by: Andy Shevchenko --- Changes in v4: - Added Reviewed-by - Reformatted with 96 char limit 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 | 15 ++++++++++++--- drivers/gpio/gpiolib-acpi.h | 2 ++ include/linux/acpi.h | 21 +++++++++++++++++---- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 9be1376f9a627f..1f2ade475b36cb 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -741,6 +741,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) lookup->info.pin_config = agpio->pin_config; lookup->info.debounce = agpio->debounce_timeout; lookup->info.gpioint = gpioint; + lookup->info.wake_capable = agpio->wake_capable == ACPI_WAKE_CAPABLE; /* * Polarity and triggering are only specified for GpioInt @@ -987,10 +988,11 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, } /** - * 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 Linux 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 +1004,13 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, * The function takes optional @name parameter. If the resource has a property * 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, int index) +int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index, + bool *wake_capable) { int idx, i; unsigned int irq_flags; @@ -1061,13 +1067,16 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int ind dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); } + if (wake_capable) + *wake_capable = info.wake_capable; + return irq; } } return -ENOENT; } -EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get_by); +EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_wake_get_by); 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..cd7371a5f2839b 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, int index); +int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, 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,28 @@ 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 +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); +} + +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 index) { - return acpi_dev_gpio_irq_get_by(adev, NULL, index); + return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, NULL); } /* Device properties */ From patchwork Mon Sep 19 15:59:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607357 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 0C723ECAAD3 for ; Mon, 19 Sep 2022 15:59:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiISP7o (ORCPT ); Mon, 19 Sep 2022 11:59:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbiISP7g (ORCPT ); Mon, 19 Sep 2022 11:59:36 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC64D3684E for ; Mon, 19 Sep 2022 08:59:26 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id v128so23215036ioe.12 for ; Mon, 19 Sep 2022 08:59: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=pUn4t7LGIuBHcn9pbEoX7ny+qFkrwHq72tsErrsS46E=; b=P0QjsPmNe1GW+6RvsHxLh4YKSjvYRvgdviVs/VmaGx6cQgUDsUuaEhYaclxQXdQC9j srhHOvyWc6EQuMQLkK+YFY6O9wEyCL7I3e8Q7C2W5JW8MWhz/Vni7guUOvCtdbkPVpwj 3VVnGh+3KEfaO7Mw4FZM6iVliR5z/6UcYj31k= 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=pUn4t7LGIuBHcn9pbEoX7ny+qFkrwHq72tsErrsS46E=; b=vzT2rhCXQg8dm8f6YNpAMUoNz2VShOJqnGYjKU7imwxKuYle+6GLEacwP+A22110nP vOvNa2SKweh5v2w+MeqDFDmNklViEZxEmObsVr90yOs4ritv9E+K4poRgXwQD7DVcTkw 6GCnldNY22L63vnDLbVml/mhKAaZgtnOhPPLQOGUpxo/Oq7oj/takY1t97iC9pJnsTo1 VU0JCaeY1ijYN14gRKGt+LUSTZHr8Y7nJpyxpiS8iU1T23cv875E5tvcm+lRN3pMMcZf 6MvZ8/Ib0tJLTCLq1Ajt4wpoIt1xBQEljPKH1fKzjAe9PAgVD3jJmtwBFzsREPIQ+5Mo Kg1A== X-Gm-Message-State: ACrzQf2zCz2GFtc4PKQKG5LY9U/ao1CMeVu6r+d9u1kw5bYGbdlDoTWt RLCpoXbviNX/ftHyUYm0M9eDGfaXsGHC/w== X-Google-Smtp-Source: AMsMyM54ITLRKvir8ScMyAek/7DHrz6qcC4/52p/i0m45HVdEc+AJc9Rb849C11H3lKohistgy0q2w== X-Received: by 2002:a02:bb0a:0:b0:35a:100f:74f3 with SMTP id y10-20020a02bb0a000000b0035a100f74f3mr8602064jan.237.1663603165715; Mon, 19 Sep 2022 08:59: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 t70-20020a025449000000b00349fb9b1abesm5634154jaa.106.2022.09.19.08.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:25 -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 , Dan Williams , Greg Kroah-Hartman , Jonathan Cameron , Len Brown , Terry Bowman , linux-kernel@vger.kernel.org Subject: [PATCH v4 06/13] ACPI: resources: Add wake_capable parameter to acpi_dev_irq_flags Date: Mon, 19 Sep 2022 09:59:08 -0600 Message-Id: <20220919095504.v4.6.I8092e417a8152475d13d8d638eb4c5d8ea12ac7b@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 v4: - Added Reviewed-by - Reformatted with 96 char limit Changes in v3: - Fixed bad indent Changes in v2: - Added ability to extract wake bit from Interrupt/IRQ resources drivers/acpi/irq.c | 8 +++++--- drivers/acpi/resource.c | 23 ++++++++++++++++------- drivers/pnp/pnpacpi/rsparser.c | 7 ++++--- include/linux/acpi.h | 2 +- include/linux/ioport.h | 3 ++- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c index dabe45eba055d1..4bb5ab33a5ceb1 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,13 @@ 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 = 0; - *ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable); + *ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable); ctx->fwspec->fwnode = fwnode; ctx->fwspec->param[0] = hwirq; ctx->fwspec->param[1] = acpi_dev_get_irq_type(triggering, polarity); @@ -204,7 +206,7 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares, fwnode = 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 = &ares->data.extended_irq; @@ -218,7 +220,7 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *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; } diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 510cdec375c4d8..fa3439aea76b3e 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -336,8 +336,9 @@ 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; @@ -351,6 +352,9 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable) if (shareable == ACPI_SHARED) flags |= IORESOURCE_IRQ_SHAREABLE; + if (wake_capable == ACPI_WAKE_CAPABLE) + flags |= IORESOURCE_IRQ_WAKECAPABLE; + return flags | IORESOURCE_IRQ; } EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); @@ -442,7 +446,7 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity, 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; @@ -475,7 +479,7 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, } } - res->flags = acpi_dev_irq_flags(triggering, polarity, shareable); + res->flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable); irq = acpi_register_gsi(NULL, gsi, triggering, polarity); if (irq >= 0) { res->start = irq; @@ -523,7 +527,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 = &ares->data.extended_irq; @@ -532,9 +537,13 @@ 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..4f05f610391b00 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -206,7 +206,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, if (i >= 0) { flags = acpi_dev_irq_flags(gpio->triggering, gpio->polarity, - gpio->shareable); + gpio->shareable, + gpio->wake_capable); } else { flags = IORESOURCE_DISABLED; } @@ -315,7 +316,7 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev, if (p->interrupts[i]) __set_bit(p->interrupts[i], map.bits); - flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable); + flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable, p->wake_capable); pnp_register_irq_resource(dev, option_flags, &map, flags); } @@ -339,7 +340,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev, } } - flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable); + flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable, p->wake_capable); pnp_register_irq_resource(dev, option_flags, &map, flags); } diff --git a/include/linux/acpi.h b/include/linux/acpi.h index cd7371a5f2839b..ea2efbdbeee511 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -495,7 +495,7 @@ bool acpi_dev_resource_address_space(struct acpi_resource *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) /* PnP DMA specific bits (IORESOURCE_BITS) */ #define IORESOURCE_DMA_TYPE_MASK (3<<0) From patchwork Mon Sep 19 15:59:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607675 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 0CDDDC6FA92 for ; Mon, 19 Sep 2022 16:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229940AbiISQAQ (ORCPT ); Mon, 19 Sep 2022 12:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbiISP7k (ORCPT ); Mon, 19 Sep 2022 11:59:40 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A562B36862 for ; Mon, 19 Sep 2022 08:59:27 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id a14so3875329ild.0 for ; Mon, 19 Sep 2022 08:59:27 -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=np+bYQjNTwYhnpoJNqqCpGKY3uMFgYXcxvRG8skp7Y0=; b=f6J5udabfckOtiMltORKWVDLFrxLOCAe/2A298h3eQ7mcdOUhZhAE3gYYzkJ17qJdP LsKsqIsaF/1gXvaRaVz8rUwdgyHHCnJ7FMxv+7+Ug+0QpFPV1MWKADBOnBL/vXrZ84fR 9Ex4FjYoktHYXk13q3GhiZjmL53SIF3NNiSxA= 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=np+bYQjNTwYhnpoJNqqCpGKY3uMFgYXcxvRG8skp7Y0=; b=wd0lWmVdX/eZaprJ/hfuFZ5LBTFRh7u1n/fAteiTuFc2N9VUVMj/ReRdL6+3Ynm8Y8 nbjdTgCsCDPZRdKzovXaLnOC6NUf8qQ2bT79JA9ZnqoLsFrmr7OYByIL+2Pg2+1kWhCZ 32CmxvKbkFQZi5kYAXtj/RM1RFGyWhzvU9JILFsPQP0KmTU8WstkC4nu6NrvV0fo7Ivc Vw4B4DnEgUZ5FxctdoHmu/TLOfYwazbfonTM4spU4hCVn8kxa9o22DWUdV5Khj8NKbJr zSV+QdsK+lYrvQdFxEJyjY3QKz2igo6He6hSJKVKHLP6tg0snKLD293B+Joub6gjqana yKXw== X-Gm-Message-State: ACrzQf0urpPG9ly0b/DIQJnLwJnrrXO4/yTqOqE8GjTXlDMjfiSxFHz6 R5L3B3SYs43JJDMF9yCIWOhzrvlJoujEpg== X-Google-Smtp-Source: AMsMyM66heku42IBubUPWwL3kGoFJkxCctl3a4UNY76fCtcoGl8ZeUmubLxzaJtSXGIRyuu82bak4g== X-Received: by 2002:a05:6e02:1b83:b0:2f5:3d65:6bca with SMTP id h3-20020a056e021b8300b002f53d656bcamr4667554ili.279.1663603166567; Mon, 19 Sep 2022 08:59:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:26 -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 , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/13] i2c: acpi: Use ACPI wake capability bit to set wake_irq Date: Mon, 19 Sep 2022 09:59:09 -0600 Message-Id: <20220919095504.v4.7.I8af4282adc72eb9f247adcd03676a43893a020a6@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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: Mika Westerberg Reviewed-by: Andy Shevchenko --- Changes in v4: - Removed unnecessary !! - Removed unrelated whitespace change - Added Reviewed-by - Renamed i2c_acpi_add_resource to i2c_acpi_add_irq_resource - Expanded logic in i2c_acpi_add_i2c_resource to make it easier to read 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 | 37 +++++++++++++++++++++++++++---------- drivers/i2c/i2c-core-base.c | 6 +++++- drivers/i2c/i2c-core.h | 4 ++-- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index c762a879c4cc6b..ba64e505183595 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_device_ids[] = { {} }; +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) { @@ -168,13 +173,19 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, return 0; } -static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data) +static int i2c_acpi_add_irq_resource(struct acpi_resource *ares, void *data) { - int *irq = data; + struct i2c_acpi_irq_context *irq_ctx = data; struct resource r; - if (*irq <= 0 && acpi_dev_resource_interrupt(ares, 0, &r)) - *irq = i2c_dev_irq_from_resources(&r, 1); + if (irq_ctx->irq > 0) + return 1; + + if (!acpi_dev_resource_interrupt(ares, 0, &r)) + return 1; + + irq_ctx->irq = i2c_dev_irq_from_resources(&r, 1); + irq_ctx->wake_capable = r.flags & IORESOURCE_IRQ_WAKECAPABLE; return 1; /* No need to add resource to the list */ } @@ -182,31 +193,37 @@ 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 = ACPI_COMPANION(&client->dev); struct list_head resource_list; - int irq = -ENOENT; + struct i2c_acpi_irq_context irq_ctx = { + .irq = -ENOENT, + }; int ret; INIT_LIST_HEAD(&resource_list); ret = acpi_dev_get_resources(adev, &resource_list, - i2c_acpi_add_resource, &irq); + i2c_acpi_add_irq_resource, &irq_ctx); if (ret < 0) return ret; acpi_dev_free_resource_list(&resource_list); - if (irq == -ENOENT) - irq = acpi_dev_gpio_irq_get(adev, 0); + if (irq_ctx.irq == -ENOENT) + irq_ctx.irq = acpi_dev_gpio_irq_wake_get(adev, 0, &irq_ctx.wake_capable); + + if (wake_capable) + *wake_capable = irq_ctx.wake_capable; - return irq; + return irq_ctx.irq; } 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..fc4b85fb90b1b7 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -487,7 +487,11 @@ static int i2c_device_probe(struct device *dev) if (irq == -EINVAL || irq == -ENODATA) irq = of_irq_get(dev->of_node, 0); } else if (ACPI_COMPANION(dev)) { - irq = i2c_acpi_get_irq(client); + bool wake_capable; + + irq = i2c_acpi_get_irq(client, &wake_capable); + if (irq > 0 && wake_capable) + client->flags |= I2C_CLIENT_WAKE; } if (irq == -EPROBE_DEFER) { status = irq; 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_adapter *adap) #ifdef CONFIG_ACPI void i2c_acpi_register_devices(struct i2c_adapter *adap); -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) { } -static inline int i2c_acpi_get_irq(struct i2c_client *client) +static inline int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable) { return 0; } From patchwork Mon Sep 19 15:59:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607356 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 A09C1ECAAD3 for ; Mon, 19 Sep 2022 16:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbiISQAR (ORCPT ); Mon, 19 Sep 2022 12:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230398AbiISP7l (ORCPT ); Mon, 19 Sep 2022 11:59:41 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D68F51BD for ; Mon, 19 Sep 2022 08:59:28 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id x2so8770626ill.10 for ; Mon, 19 Sep 2022 08:59: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=F4E89pQ2FrSepPnER/REAyEkKBd4VwJQnWtxeznDInw=; b=iFJyZLoTNe7+opOt+z3rUQwztfNt/FK4EYWkMUwYtkKWivqYMWX4oRAj8/WgM8D8hT XLVEJFNpUSuxDT9BKpCVUISLK8n+KtT3pbkARlzUy56+QnmMZDWCDiLULv6kZnJHcmb0 PjpvNExYUFPOiMS/5WO5lEedVMaBChBMXBkDM= 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=plUaoCw1S3CJ1aeq98WkqKl6EpxMnl3bw/rW1oOHCh9mU0JdprUjw/OhLBeI457CGV 6J/61+7cvpGUUSGX+JiB/3ooOhfD9MdryPY+qGX4NJHFjMEemh020ecCbWkLVJmLNEsU hXn2xrnLMtwTcDTT3rIxnPMUZU1KvkB0aeXZC6YgJZeb/d/VY13/TyeUbtafdzVOQpzF CMzSTSonS63ypHvCjuyD5cRf+LVvF96mprIAU8FaNwfryY2GmR26NzGKR0tWFmBu3Xf0 OVXyqoOgyZrpwpZ802qgCRJGWBKn08wI0iMN45zqBcb+pVY+58IXm5Gi8mxq0HyTVIhp Yinw== X-Gm-Message-State: ACrzQf2oEf/sueidK2HMvlsxLmfaqh5zVV1w/5HxI7Thb8f9ZJ2A1EFS U/beoadKOgF4IZ5G9+uMy7VeqWapwdrgqQ== X-Google-Smtp-Source: AMsMyM74MaxgKJOfvmWy1ebOERp87QX10dA8/v0WHA9glnbmsbgaHQWtCcDmpHn38HRQ/7/SP9seeg== X-Received: by 2002:a05:6e02:218d:b0:2f5:45c6:fd12 with SMTP id j13-20020a056e02218d00b002f545c6fd12mr4567137ila.77.1663603167576; Mon, 19 Sep 2022 08:59: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 t70-20020a025449000000b00349fb9b1abesm5634154jaa.106.2022.09.19.08.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:27 -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 , Len Brown , linux-kernel@vger.kernel.org Subject: [PATCH v4 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle Date: Mon, 19 Sep 2022 09:59:10 -0600 Message-Id: <20220919095504.v4.8.I7d9202463f08373feccd6e8fd87482c4f40ece5d@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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, struct acpi_device *adev, d_min = ret; wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= target_state; - } else { - wakeup = adev->wakeup.flags.valid; + } else if (acpi_device_can_wakeup(adev)) { + /* ACPI GPE from specified by _PRW. */ + wakeup = 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 = true; } /* From patchwork Mon Sep 19 15:59:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607674 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 C6691C54EE9 for ; Mon, 19 Sep 2022 16:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbiISQAS (ORCPT ); Mon, 19 Sep 2022 12:00:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbiISP7l (ORCPT ); Mon, 19 Sep 2022 11:59:41 -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 2CCF91F2 for ; Mon, 19 Sep 2022 08:59:29 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id d8so20184455iof.11 for ; Mon, 19 Sep 2022 08:59:29 -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=NBIMcgibUAu7oZkRHm1OvOAcydfmYYjd1S5xzmOpGf/VJKkYGlPabymaNhIKlJ2E/R 6tMkUYfFxArvt8MhQfp3ktkLQBRcUioW/nEIq8xMjZyZpKa5AiVqgkecXAXM1m4VsFzW NNGMZtX0WPdVXbCeoj7jZjzQjds6ezgbRtmN8= 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=U0ZXk1xyx8/I3xn6sH3C+3j3zPzG3fx8ZWXkWsduSPRuY/tkre16z3TEzNb5glQkus TymOErRSac0gIzKEy2ZPoTSC/NP5FrDe0EVvTdY6nDbw1sYH01XzFfCCkZ05IZNjuQ4h Pr97CwBQWBoeeMeDwpGw5l4NGV8lO3HfJMBZzNFULdmbtRd5neK0qAK5/rmk9ATx4qhd UD0/xdYw92z5+LMeyKoFBxqkheV4itDQkq3WsDPrlSlvdMOdba81F7oIizjrRk3xQD3O fkMGabGYA/v3VrZuRivIAxhcs8i1eWKhWBv8mjPFfTnZoH4nLtSFm6BVFttfz7LSd5DE +Hrg== X-Gm-Message-State: ACrzQf2H+KmE3yViviwuKciHXCUBUKFUlAeYPpJnC/hG+tmyZ+l3X8XG v/MFkRTvyfaLJgkmY1zZnI9/k5tFEocuqw== X-Google-Smtp-Source: AMsMyM7x63qHthDCA1vjb9vUh/2k6fjHLP2VBwI9FyxoBwKo9+qvXH5rzrEA+EuROITUQac55CEqrg== X-Received: by 2002:a05:6638:3398:b0:35a:3da9:fc7a with SMTP id h24-20020a056638339800b0035a3da9fc7amr8443874jav.87.1663603168481; Mon, 19 Sep 2022 08:59:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:28 -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 , Alistair Francis , Benjamin Tissoires , Jiri Kosina , Rob Herring , linux-kernel@vger.kernel.org Subject: [PATCH v4 09/13] HID: i2c-hid: acpi: Stop setting wakeup_capable Date: Mon, 19 Sep 2022 09:59:11 -0600 Message-Id: <20220919095504.v4.9.I2efb7f551e0aa2dc4c53b5fd5bbea91a1cdd9b32@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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-hid-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 *client) acpi_device_fix_up_power(adev); - 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); } From patchwork Mon Sep 19 15:59:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607355 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 C47E3ECAAD3 for ; Mon, 19 Sep 2022 16:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230467AbiISQAb (ORCPT ); Mon, 19 Sep 2022 12:00:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiISP74 (ORCPT ); Mon, 19 Sep 2022 11:59:56 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55589299 for ; Mon, 19 Sep 2022 08:59:30 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id g6so2607641ild.6 for ; Mon, 19 Sep 2022 08:59:30 -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=DXGmrXM/FAQkex6T1sl2ujol2NIi1taXqx1n31CU5bFYFLfY3foESYyc7JawaMLuUe JkzOcFWBF84Xv+d9v0uDpPyRQNl3nQ3oVv4OMuzfaTwJCHh9X7yE64PMItpivc9JGQuQ hfdIPTishauaidNJtedqxMS0UDQ30byvm+f4g= 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=Lb6cbSYAmnbTy8afwggEehjTx4YRtXaih35PFRG+kPuxNKXfF68jDj41c+EaVc1J6j UmfZx2IvwizzEJ9KPR/t1H3nQP1ZNUFfAQ2vhaBTu3sfuMIync4X7JFlygmZ4biK/A3g euoIIYMeMgDLacrwZYsqvQQiJHY1cksrk/Nz6MdcLsO2HzKJIJOLg7ZZg/YV9YZ9jJsI TIGljmSRM2ydmRq3vyxJsfqGC6dTdRDJDYQYbUGuvQiDPs5ZkHxR18rmx/vtMJGDa0wZ tsnUakztwC5pnri55XbtufdDK7hNkoHg1WjKjpzQm6FAl3Rr7lh/PfmqskNYvjglMMh4 lf6g== X-Gm-Message-State: ACrzQf3LCI+46X0SL+ttJ+erPftw69HfqmtdhxaTxQSL3fffqmrcXkO1 ThYfZR4UE37IMMxW3u6cRZm44xoFptttxQ== X-Google-Smtp-Source: AMsMyM78kgf44ZgqtryL6XUD05y/uEDkzeurXXhzG3uc3Z8u/CmJu4l1sMGjiyvxdx7sgwzqpK8OyQ== X-Received: by 2002:a92:ca4f:0:b0:2f6:1136:e8f6 with SMTP id q15-20020a92ca4f000000b002f61136e8f6mr785287ilo.154.1663603169461; Mon, 19 Sep 2022 08:59:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:29 -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 , Angela Czubak , Bartosz Szczepanek , Benjamin Tissoires , Jiri Kosina , Yang Li , linux-kernel@vger.kernel.org Subject: [PATCH v4 10/13] HID: i2c-hid: Don't set wake_capable and wake_irq Date: Mon, 19 Sep 2022 09:59:12 -0600 Message-Id: <20220919095504.v4.10.Id22d056440953134d8e8fe2c2aff79c79bc78424@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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-hid-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, struct i2chid_ops *ops, if (ret < 0) goto err_powered; - /* - * 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 = hid_allocate_device(); if (IS_ERR(hid)) { ret = PTR_ERR(hid); From patchwork Mon Sep 19 15:59:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607673 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 9310FC54EE9 for ; Mon, 19 Sep 2022 16:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230402AbiISQAd (ORCPT ); Mon, 19 Sep 2022 12:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbiISP74 (ORCPT ); Mon, 19 Sep 2022 11:59:56 -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 BBF802A3 for ; Mon, 19 Sep 2022 08:59:30 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id e205so19201151iof.1 for ; Mon, 19 Sep 2022 08:59:30 -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=BuHj0aYj11V/uqzAPjciFvNDd0tPx4EwB5NLho7OZ14QYt6P6pPn+/U1G2oP2hOrTG W/tY0awdaDq3v+rcheReD8bKyehbxyXSMhSl0M/Jlt6CA88yU3S0R2cMtm8d5TTk9D97 TnCC3An/UStxFHYuxPuvf38pqX+NkDTNUURDw= 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=1D9SnOud2ukipvF4vdKrUOgOgd3spGTt70CiCa96rnt9TnckD6wSxNfcjRCxOWVD1V mUYClgeMENm5BYheojS4tMTFf8IrGEfmt3j7VlmK3FIPFWa5X31IwH4LuUhtuwE7zCml 0PJa0wQdyZG9m6V7M0gpy4rarLr2CyGNLHZEzWF/sGBKsCoH3MbsvEcNxok70XSou6f5 SRx/4TPTe/NFX9ZZcTIHNFDz0WpYP4P+hUoJGNzR8AcSvf+ueIuz6fh9FvrdJDHZ12zs AG1wibVsqZPpeYecUQNmYVndW/XRqlNNk/Q7VjDAdopp/Cv7AnWOONCo+W49DPzyehuI j0KQ== X-Gm-Message-State: ACrzQf1H8oPErqEN8dI9TqixmdgfbMFxgM2oQZcczkStZMUuceUVMq6A fodFzItFAHb7zp8OD9lcrsaUH20lJ1Fx7w== X-Google-Smtp-Source: AMsMyM4YIquTjh66qbsIX9P21MyXK/1UIiwMITpixcMruE6C/vvNhmUKpt7oGmKFM9QZcrhK266mZQ== X-Received: by 2002:a05:6638:35a1:b0:35a:27ec:b00b with SMTP id v33-20020a05663835a100b0035a27ecb00bmr8540372jal.245.1663603170347; Mon, 19 Sep 2022 08:59:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:30 -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 11/13] Input: elan_i2c - Don't set wake_capable and wake_irq Date: Mon, 19 Sep 2022 09:59:13 -0600 Message-Id: <20220919095504.v4.11.I7309b8f322082437b93581c6e2953886eeb998d7@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 ACPI 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, } } - /* - * 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; } From patchwork Mon Sep 19 15:59:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607677 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 37FC3C6FA94 for ; Mon, 19 Sep 2022 15:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230360AbiISP7h (ORCPT ); Mon, 19 Sep 2022 11:59:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbiISP7f (ORCPT ); Mon, 19 Sep 2022 11:59:35 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65C3BB1E for ; Mon, 19 Sep 2022 08:59:32 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id y9so1348276ily.11 for ; Mon, 19 Sep 2022 08:59:32 -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=UpTKBXkuBWM37p9DyTtjrOvCA5z/HMMyaw60WAuOwM2AGoflxz67wKN1++3S9QO/XY ld88ESs9ahNQ5nbBu7K822/nSihioMxQNdF7jGpSeNAlQsNzqefjpriFkY+hgBXQRXi8 0EDGcgYi6MsFd41l26KL3bA4CZk5YkjUtiwBY= 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=WORT4jv/oGjqIP2zuDN5KVQXCyF2Gk30wtyyNYoFd6lTn58WaRNuEweN8FS5T9uevL iWfKgLYFV5JfDfsOwr2cBaLWueyFFKN9UrpH/ALcTbUFMbbfGZVVitSQ3r0rU1WDJEWx c6Z4o0lPvTwxw9jVTE7oa0iiz0qOfi7D0AhdCDOkbY27TH1dB923/fXnZHWeTUPgvzVg KcJHdB6niOWUdzxzNbGpO/B3FJSZWv3EUwwbcOyMUydNsNFhELBfokjs9QB03N1pZH21 M6IVn2AkAVYMqsPYrMkyFEs3FH+aLRnOX5wdLmzN52NTIjHaVBTwQeys7uq6A2eiG9sa 2FRw== X-Gm-Message-State: ACrzQf25fNSuGdu1MWA9PAWLqHvh/jyjal4TepRiC0pUzbzR22C8l9n6 kiMvmzkDAicgQSUZCgHY/MnlIblo06EgOw== X-Google-Smtp-Source: AMsMyM77uHanVzulzDLGYPAqOw6SCgZuMRfCcGe2wbSoa5ZKFhtsIW4OtUwmS3QHXrlmf5Qn6NzCPg== X-Received: by 2002:a92:b011:0:b0:2ea:ebed:1241 with SMTP id x17-20020a92b011000000b002eaebed1241mr7718925ilh.245.1663603171307; Mon, 19 Sep 2022 08:59:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:31 -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 , Cai Huoqing , Douglas Anderson , Guenter Roeck , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH v4 12/13] Input: elants_i2c - Don't set wake_capable and wake_irq Date: Mon, 19 Sep 2022 09:59:14 -0600 Message-Id: <20220919095504.v4.12.I031ffbe411e1bae20bf16a1876da5baf444c7928@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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/touchscreen/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 *client) return error; } - /* - * 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 = devm_device_add_group(&client->dev, &elants_attribute_group); if (error) { dev_err(&client->dev, "failed to create sysfs attributes: %d\n", From patchwork Mon Sep 19 15:59:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 607358 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 82D9DC6FA86 for ; Mon, 19 Sep 2022 15:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbiISP7k (ORCPT ); Mon, 19 Sep 2022 11:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbiISP7f (ORCPT ); Mon, 19 Sep 2022 11:59:35 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4949BBB8 for ; Mon, 19 Sep 2022 08:59:33 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id a14so3875486ild.0 for ; Mon, 19 Sep 2022 08:59:33 -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=GK6NZXg+SRbg6dlYceBGo3Bdp/8+QXAkMNPp1hBOtDl13ijRJBL7lt2nm1VXjoA8lk c5k+LXWC8GocTjRZSQITTdz9QWBggrsAHr2rlB96VnjYnfOt4sU0EiPRaHKElgg9/K0I jJPJ+xXtUkAMDOO8330oC5RE43uPJHbfzxouE= 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=yANTJ0qc2zNpkImUXtW/6TNXuWUmH8ozzquDlU+WUriBBAPfFre3GrwvrR+fqSsIx9 Ggkf41EpiKIN2CMDycwbvDQtKV75A89taUeiyIE0EnF+Vq0lnofkO2c/4LTJBq1bg3sK JILNmauKShHT/wvR5RSa4ClNfgfQyTcAxwPe0WWi/KKIVvJ11youISFj+Mj6gopgVo0N aSTF1+CvG3cOSPLlLc8QknjgDgqCm6+b+8GGOimgGtnqltfbxnilSL3V80Qt5ScJWxSl UFbvwCabbEDahiJuNHxxDLL8a5TFTsHAkNpTvVjgGlGZ3iRHZAWI5QhIp6yNPDgWVG8J BXBw== X-Gm-Message-State: ACrzQf2dgl0snbvId1auzEuMi1ehI35fLamz7x05TAwUNGK4hEAUO7yF JIm0m/wcQQ0FbAh74Ij7lJ1Svp9ZxV9ZNA== X-Google-Smtp-Source: AMsMyM5ls8r56kVd8P5UbNod0oeDjqkEjXi/yi/ji3Sa3JWilEMSvxaR2aRHwjrDZtRA8WmAXXqiYw== X-Received: by 2002:a05:6e02:f03:b0:2eb:7a76:f9b8 with SMTP id x3-20020a056e020f0300b002eb7a76f9b8mr7612007ilj.41.1663603172286; Mon, 19 Sep 2022 08:59:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 08:59:32 -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 , Cai Huoqing , linux-kernel@vger.kernel.org Subject: [PATCH v4 13/13] Input: raydium_ts_i2c - Don't set wake_capable and wake_irq Date: Mon, 19 Sep 2022 09:59:15 -0600 Message-Id: <20220919095504.v4.13.Ia0b24ab02c22125c5fd686cc25872bd26c27ac23@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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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/touchscreen/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 *client, return error; } - /* - * 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 = devm_device_add_group(&client->dev, &raydium_i2c_attribute_group); if (error) {