From nobody Thu Apr 2 18:06:25 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 D09E4C433FE for ; Thu, 29 Sep 2022 16:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236211AbiI2QTs (ORCPT ); Thu, 29 Sep 2022 12:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236172AbiI2QT1 (ORCPT ); Thu, 29 Sep 2022 12:19:27 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548551E2749 for ; Thu, 29 Sep 2022 09:19:23 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id d14so952714ilf.2 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=B0r229No2ndloGNnSKqyWtju+ZyoGiLRkamOZbtAkwk=; b=QAZJzlDguy3mKE+zsGgcSFuSfTFJIGz9MKe+jjzBYYHKoqnsbf1JYHAA77B/hA5Y55 HUvOVMQVCf3wZb/K1/E3JTgZdP4DvVPS941/i9eitPOUey8Z9Gc59Juuati4DdUf1HuR eIr87rq4WFT95YPhIMLm/oIQskAsT6JSumqeQ= 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:message-id:reply-to; bh=B0r229No2ndloGNnSKqyWtju+ZyoGiLRkamOZbtAkwk=; b=7qvB7rbXr4u7hKUP6yr1OmpJXv3AXUB3j1YpQ4TmDbBsSh/j/iWsU6HZmVRGjhPHDb 4sjP/RKhxciDVuP1aCXLIWHYZ54bQTpzS59zi7oyc6aCCT9bgshTRPJHwCkV/008f6CF BkjYDV7JTdcGtRRMEqKPz9OhNGNZ38D2RnytvjgNtqnQ+cAUkIPrpQg8/r3v5LJp5bIu Dkjcay5wpzkAV8wglCcHKnWeLBPpzlajizB290/MAmR1FJ67WOhPEO6RHQhQm/2qrMzU XyFdGlbTH186xDBca9CEcMM1YwBXJyqE6Kq3sD9l1er8eWxv5DW8AFakhJRXrCM5H8pz cLCA== X-Gm-Message-State: ACrzQf2KyAkGlDm3aPJpzScJPHSvd+y7oZaYctyhPJQJiCKr2NEFYAu/ BwW+47HzvAPSKpzCor+6Q7VZ/A== X-Google-Smtp-Source: AMsMyM535lSFj6TNZv042EzzBHsymrpAqResKCmnDFb4H7yMFdhlc+N9nOBn1Dt9Kkv1y+yAwM0uxw== X-Received: by 2002:a05:6e02:2186:b0:2f5:cc0b:fb14 with SMTP id j6-20020a056e02218600b002f5cc0bfb14mr2002088ila.315.1664468362253; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:21 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Benjamin Tissoires , Greg Kroah-Hartman , Jiri Kosina , Matthias Kaehlcke , Yang Li , linux-kernel@vger.kernel.org Subject: [PATCH v6 01/13] HID: i2c-hid: Use PM subsystem to manage wake irq Date: Thu, 29 Sep 2022 10:19:05 -0600 Message-Id: <20220929093200.v6.1.Id4b4bdfe06e2caf2d5a3c9dd4a9b1080c38b539c@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 Acked-by: Benjamin Tissoires --- (no changes since v5) Changes in v5: - Added Acked-by: Benjamin Tissoires 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 baa169fadd66321..a2fa40dec04ea59 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 80F25C433F5 for ; Thu, 29 Sep 2022 16:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236219AbiI2QTx (ORCPT ); Thu, 29 Sep 2022 12:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236174AbiI2QT2 (ORCPT ); Thu, 29 Sep 2022 12:19:28 -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 B9E041E2750 for ; Thu, 29 Sep 2022 09:19:24 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id e205so1305979iof.1 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=NYYhfMYuObWAhiYmMGCnsuNWCoDnBmdqmdjnjJmMAKU=; b=YR9QUp+2XjkZ74L/aPGRq732j3ftJ6Jsln7tm/r/Aveg1hCJhPidZHJ/A76yEQGXz+ bZN+UhIPBWYYIlAnJ89DxMTEACvciAizpjX2WuD3Oo1CxDs3l8DHnfhGjd2/h5PdTr0d 6E/opjEVXLf9UA/6pIym2txnw7KIPDUWTSD/Q= 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:message-id:reply-to; bh=NYYhfMYuObWAhiYmMGCnsuNWCoDnBmdqmdjnjJmMAKU=; b=N3/Pgx22JKnhfnkM1KVw0n11orVTYWrlnYPRwWEAo3aVzrFSh91EVvQkTR5CT/1bUI eMeBhiNjjLmtoHvc+mQSVEu1pmeCzKCkpOhc5wq6TLdSEGCsWMRIByVMQPw/0PUJ5Aim y2in69IjHorjjqBGF/4KZTewb+FisHyLD9w89v5uqglgNCagz++mSe2nYuyTKlYetyZL R0SoLmigI0GqDg1Zcx4l5hQLoQPvkoNftTqyKV204IEYGxhhpWiVkV4tRO7v/WjNOLtO zfVSlQEdSfGvA2HQ2i6OoGrACh8e3X7ke1yvko4EC3g0IeZLmH1wkhZ2JlqxIU+ZWOH9 CQ+A== X-Gm-Message-State: ACrzQf29UuQAqf/aFt1YYUyO33ocxtvvTGzpnlf5UCzQSiq34kBaxWWG GlW9mhD11u2KwzCiyVP+Cxw5Hc7ej2jZtA== X-Google-Smtp-Source: AMsMyM69kKtdTZ9M1vSL5osI4q4sy8tylM+deLWVgHOt5tmstPUWzvG59wKEt7eS7JEKCu72InRLcQ== X-Received: by 2002:a05:6638:238a:b0:35a:25b7:a1a7 with SMTP id q10-20020a056638238a00b0035a25b7a1a7mr2350236jat.92.1664468363646; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:23 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v6 02/13] Input: elan_i2c - Use PM subsystem to manage wake irq Date: Thu, 29 Sep 2022 10:19:06 -0600 Message-Id: <20220929093200.v6.2.Id022caf53d01112188308520915798f08a33cd3e@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 e1758d5ffe42183..3947474e93d16ab 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 65A4FC433F5 for ; Thu, 29 Sep 2022 16:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236232AbiI2QUB (ORCPT ); Thu, 29 Sep 2022 12:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236179AbiI2QT3 (ORCPT ); Thu, 29 Sep 2022 12:19:29 -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 655B31E1CDA for ; Thu, 29 Sep 2022 09:19:25 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id n192so1297120iod.3 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=0RZMraw+MSve3FKroio91yFqDKIRTDkX36AHVGBSH9U=; b=SLvL0tRkoTy264/NjkTRX0UVvir6FYfVr0a1FgjGLg/c8SvU6KMs8TjxCjSwvWyu7W ZFvGerSFSh1Bu90dgqxLCIysK8kodRgpQ8wuP8D3OVDKW/d8K/8g/PTEhOvDpKhqdH5j w7HXUJKVC5tFcBKKRQbxrnCW1GvOtLBICm2ck= 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:message-id:reply-to; bh=0RZMraw+MSve3FKroio91yFqDKIRTDkX36AHVGBSH9U=; b=iWLJr5RQBGkUorpO5euWhb6kjBp/wXT6OXYdb0F4FUbIV8wNVZDUEuwp41Arq55j1C y2RpV7vwJTrx56DCljRSXw/r7znJTAU7MBL5EbCpajHm9S5E6coz/IksCZfbc3nLW7Un Ei/CzDvvuMoEhrOdkIfLtXIkSgbHs4hkPUtxJPnhl7Xl0nYajL3rx2jyJboCKY3hJu+W OBRkFUErD8f6ak7cQW4JtL72iKQ9i2gY5w7bQCXGNLtRMn1PO/EE2p1tCSvp+pNpaQeu 4bB08iNOforD79L+jEkjxoE+Ih3t+jyd32WvIcX7W218synzjryXtEojZUoAe3ThM9w4 6X0g== X-Gm-Message-State: ACrzQf2I9z6UbW3qMCzauJmDkQkKxU0VKXvdxARCcqkT45SOiH9FDa7I Ggy9LmcV61sx1AQNBCGdOBFQuA== X-Google-Smtp-Source: AMsMyM6KOCM6DeWWxSe4E0kgqW4Y8qIhdGyRKDMJBSPUZK2c0/KUll1VopnFHSBLbWOFbgpdvOZViQ== X-Received: by 2002:a05:6638:240a:b0:35a:4645:b025 with SMTP id z10-20020a056638240a00b0035a4645b025mr2188882jat.50.1664468364759; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:24 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Douglas Anderson , Guenter Roeck , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH v6 03/13] Input: elants_i2c - Use PM subsystem to manage wake irq Date: Thu, 29 Sep 2022 10:19:07 -0600 Message-Id: <20220929093200.v6.3.I5862429ee3e4de0f9ad5ba01ce07ad99eec10cf0@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 a56f042adf9d829..80e16b533c452a0 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 48F00C433F5 for ; Thu, 29 Sep 2022 16:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236223AbiI2QT5 (ORCPT ); Thu, 29 Sep 2022 12:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236180AbiI2QTa (ORCPT ); Thu, 29 Sep 2022 12:19:30 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024BB1E2766 for ; Thu, 29 Sep 2022 09:19:26 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id q11so425332ilj.10 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=lfop3KAMxguQzK3OXs1UqUTIfKzgEPmF0uqm465dBZs=; b=WG42TYB/+VFKje/aLR/xoYmg40TPUhb4j3NTgVLpf+cu8Y8/MUtTTeGEi3fIrK/73v tm9mbH+hw8aBU5uDlWyh3kFA+fJ0yA5544AfL8iAz+trXO0/pss/x+Kzmdgrzq8iUxyb Ft+Hi1oOzLxmv748U4+JgUIn4Svq8E3Aaq8Fg= 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:message-id:reply-to; bh=lfop3KAMxguQzK3OXs1UqUTIfKzgEPmF0uqm465dBZs=; b=qFmObpKCfl5SDI0LlzeLS+XLUBD2fgrYjL3ImL2T89JoXzV3nbQCQjTGhffGhGgzOw VT8eN89zkTMevYlgwT4JN3gd3it8VP5Ywtz84GhHUglo0AVhQ+kgxu4ThZlyopEeMnQq tV97WKB7HUhCTL1aH4eq2I27Mjj47JfuyrmaAvaR+w6YHPUAcnHbbX6L7fx9Mm4ALt0C WIUzjpb7G+wc8oIiMTgPFtbjAzVKdLj2qJR5GeROSHbrGJ12t04Li0vNHX6SnXknkwJe XQEi1D+PO1m9bPcRxAmX0bxdAI2lScIfSIe9Q/S372VKPBDGzpi3wYSue2WHKV04jT8p lPEQ== X-Gm-Message-State: ACrzQf1uPcAVx/ZNuF+JYnA1awxw+oP7MF2rtlaYllLpNApl3Pcx1V2s lchRbFnS2d3pgFaE5SdMYcDh8A== X-Google-Smtp-Source: AMsMyM6e7vNLxwyelTGYTIIk3LcsSPQYhZtTTP3GlGOItga3IrvZ2Ln3bI/3WZOrki4bXacJsHJESA== X-Received: by 2002:a05:6e02:164d:b0:2f9:46bb:6ffb with SMTP id v13-20020a056e02164d00b002f946bb6ffbmr496112ilu.320.1664468365762; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:25 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v6 04/13] Input: raydium_ts_i2c - Use PM subsystem to manage wake irq Date: Thu, 29 Sep 2022 10:19:08 -0600 Message-Id: <20220929093200.v6.4.I06b417b274bbecb31775a73993a7a3c1bc80de7b@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 3a4952935366f91..66c5b577b791d4f 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 D5E9BC433F5 for ; Thu, 29 Sep 2022 16:20:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236239AbiI2QUF (ORCPT ); Thu, 29 Sep 2022 12:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236152AbiI2QT3 (ORCPT ); Thu, 29 Sep 2022 12:19:29 -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 A3F451E05DA for ; Thu, 29 Sep 2022 09:19:27 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id j7so945110ilu.7 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=tbifdhnu3DLGLXjvettr8aEuyeI86xUz+R1GY8PSjLs=; b=FtP3pMDwImt/olDyHcdPYBplAO3tprF/43+wk9yPhNSJrQyOh8SWcLlHHwRO3m4w91 WdMRUdwAqU+t6gCO4duxOjazgYKakAuI/ekJLlM727hAzat3eGTva2+/adRvyL24S7v0 IM7SBchSbo4Nbu/DwRItvi5LKqerp+Uzt6JKc= 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:message-id:reply-to; bh=tbifdhnu3DLGLXjvettr8aEuyeI86xUz+R1GY8PSjLs=; b=mw/5CHtethHOPrMvoIzhd/gtdLL3zeoJHNJfm5SpBVhnI5FxgvbTMXCDMIODsXnjKm Gt57hHREMKui7rsBlpi6t1tdUDW87NVBQbp4QgpU/41z44vyuBfRdjtopQgpDiF3dgvi Hy3D6rcJLJHhmEXjI9T39X0pZPW+BRwzUp/2xg7zhIv6L81vNZRaA+eq08ND0hyvQXIw fP2qrYgQmn2IHT/0bHFMHFwHXFcWS4CXkkPqO1xp6I2eEGQ+I6Tu/VdC38BhWEo98Ycj iGoPC8cPTAOT3XhpcJ1OLQOVkXwaVBFugFyiuytYp73zOdW7TguH20xkGszxkWDflb3d Vc8Q== X-Gm-Message-State: ACrzQf2SzZGFaUycB/gY0Ea6SzFE4V70cT6IkweNKwHdckDpalwwoVAY mJshwXCvo8celiWci8eNh0vylA== X-Google-Smtp-Source: AMsMyM6T2cgutW5An/lwB3nwdED5XDbDjZApiPPBZPP/5w8FbCFBInJr3SDG020QFb4rq5OUHwtyUQ== X-Received: by 2002:a05:6e02:b45:b0:2f5:85da:c388 with SMTP id f5-20020a056e020b4500b002f585dac388mr2107256ilu.87.1664468366884; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:26 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Bartosz Golaszewski , Len Brown , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 05/13] gpiolib: acpi: Add wake_capable variants of acpi_dev_gpio_irq_get Date: Thu, 29 Sep 2022 10:19:09 -0600 Message-Id: <20220929093200.v6.5.I4ff95ba7e884a486d7814ee888bf864be2ebdef4@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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: Mika Westerberg Reviewed-by: Andy Shevchenko --- (no changes since v4) 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 9be1376f9a627f4..1f2ade475b36cb2 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_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_CAPAB= LE; =20 /* * Polarity and triggering are only specified for GpioInt @@ -987,10 +988,11 @@ 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 +1004,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 +1067,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 e476558d947136d..1ac6816839dbce7 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 6f64b2f3dc54795..cd7371a5f2839bd 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,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 =20 +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 inde= x) { - return acpi_dev_gpio_irq_get_by(adev, NULL, index); + return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, NULL); } =20 /* Device properties */ --=20 2.37.3.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 53CA5C433FE for ; Thu, 29 Sep 2022 16:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236123AbiI2QUJ (ORCPT ); Thu, 29 Sep 2022 12:20:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236090AbiI2QTb (ORCPT ); Thu, 29 Sep 2022 12:19:31 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 777EE1E0C4B for ; Thu, 29 Sep 2022 09:19:28 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id d14so952833ilf.2 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=trAVAQ/Rk+05nanA+Ls+tVQdWt1P+e+XoZ1M5Mz7QPs=; b=ClCJa5EeIpkbGLUnO1iAjuRXn86T2iN6ujl8XRaJrvhJ8kpYKDupSHzyOl+yFht1AK ITKHOMHT71jNBG4ppllwJpnzN5TyyA/7lAgRygqNezwuivEvblef33AlkTVG1OYDz2LE IUHEqhZY2+5M/i6riHlVmhYyC/aicDj6wd9SE= 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:message-id:reply-to; bh=trAVAQ/Rk+05nanA+Ls+tVQdWt1P+e+XoZ1M5Mz7QPs=; b=1w8Lnd26bDUbMGGe+95j/tzg45xQ9nYGJeRmAChoeKnLiWX8rFmXf9lnE8Ety4UaS4 EFEyDvJgMqDF+aovdSfU0W7Ozop0XBNqxoNonYOnBlSm10HRTUhDmmebhi/tTnxeZe0O 4SF3Pq1n8RFVto1tDKbSWE1Nyk9JA7B97vsRcW0rWiBER3FRvcIdiHS3CkUouV4Pejsh LmngP2qBJ5rW5IbmcWYEqY+tg5mt5UfdSa9S8j1UvyvpbdQ1byo8qFTnEgzqVY0TVF5l eORymATW2EZuQNOZO8Ade5M3a7M4xhJurNPhmtxujKQYg5L/1reBQr1OWUFpyBQWkxck YLYg== X-Gm-Message-State: ACrzQf0fmvUU5GqkQsmw8Mlw0t2Z7S0NOt8EeuPvVcD4FqIF0EL3FLyP SmkWJ5XzS3lVsMp47dDfXQ5PiA== X-Google-Smtp-Source: AMsMyM4zClFMoDKbvaeEW+zlLBZjqnVkfst4kRK+81w90pZm1NYPxNwRdJR9ZKhjrxM+yROnPglfzA== X-Received: by 2002:a92:c988:0:b0:2f6:16a8:a4cb with SMTP id y8-20020a92c988000000b002f616a8a4cbmr1947632iln.241.1664468368183; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:27 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Dan Williams , Greg Kroah-Hartman , Jonathan Cameron , Len Brown , Nathan Chancellor , Nick Desaulniers , Terry Bowman , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v6 06/13] ACPI: resources: Add wake_capable parameter to acpi_dev_irq_flags Date: Thu, 29 Sep 2022 10:19:10 -0600 Message-Id: <20220929093200.v6.6.I8092e417a8152475d13d8d638eb4c5d8ea12ac7b@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 --- (no changes since v5) Changes in v5: - Removed clang-format white space changes 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 | 16 +++++++++++----- drivers/pnp/pnpacpi/rsparser.c | 7 ++++--- include/linux/acpi.h | 2 +- include/linux/ioport.h | 3 ++- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c index dabe45eba055d1f..4bb5ab33a5ceb10 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 =3D 0; - *ctx->res_flags =3D acpi_dev_irq_flags(triggering, polarity, shareable); + *ctx->res_flags =3D acpi_dev_irq_flags(triggering, polarity, shareable, w= ake_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 +206,7 @@ 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 +220,7 @@ 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 510cdec375c4d88..81733369f4c1de0 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; =20 @@ -351,6 +352,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 +446,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 +479,7 @@ 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_c= apable); irq =3D acpi_register_gsi(NULL, gsi, triggering, polarity); if (irq >=3D 0) { res->start =3D 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 =3D &ares->data.extended_irq; @@ -534,7 +539,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *= ares, int index, if (is_gsi(ext_irq)) acpi_dev_get_irqresource(res, ext_irq->interrupts[index], ext_irq->triggering, ext_irq->polarity, - ext_irq->shareable, false); + 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 da78dc77aed32e4..4f05f610391b006 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,7 @@ 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 +340,7 @@ 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 cd7371a5f2839bd..ea2efbdbeee5116 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -495,7 +495,7 @@ 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 616b683563a9704..3baeea4d903bfd1 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 B3BD5C433F5 for ; Thu, 29 Sep 2022 16:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236254AbiI2QUT (ORCPT ); Thu, 29 Sep 2022 12:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236143AbiI2QTc (ORCPT ); Thu, 29 Sep 2022 12:19:32 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31741E0C77 for ; Thu, 29 Sep 2022 09:19:29 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id p10so947956iln.4 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=LMKvpZP3OdQdrVmiiZLZPkAEVvKdcz5HzehLoSZW1TY=; b=GA/VCwLIn+ZIC/4nJQ5vOXNrognYTxpixy+JbuF96mRSbP04zGHZyijDmKlzH8v26y iFgyLQayw/CEMtkN0H+5Rdl3z6tGCiWqgqq4elO8fqXnMnYozpaatuA6A4RXDivMvuOR A7qxZKupanQ3YdggEl96ei/fRCTY8ScJxRChs= 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:message-id:reply-to; bh=LMKvpZP3OdQdrVmiiZLZPkAEVvKdcz5HzehLoSZW1TY=; b=BT4Jv8cHFHSsmTKPd8vvz6ZSTVOZSdxh9yZmdMHvSIF79nP2jW1MqyDIIeS4an9Vrs H10lZz5NTA7fZqI80sr1sRZsCuUBx+zRqhixb+3EX6E/uhJXjoNKt18sr4zPgWfZdZPH 3psaY32RQHHWbrcJrqCKkbc8ITENew00MPMJkQ7Po374guN8P4WZ2SH/JyXyLG+eBGYJ VQro7bQYr3VLRmoSD+YO2h6w4RzuzDxmFfYqp8is8A1S0i1YOai/jDSGczIbTy18RSxq JyZueTOivAkNXneW4EDMEFOSJWrXx9H/1iaviT83uSDgEfXVegbAFA1pwi4YyQoU36v0 ILNg== X-Gm-Message-State: ACrzQf3FXMz+vbp/ehzkLfmImSFIxJf6+ocHiazS4CGI4cKdE7KdyD3q zJGIxjS8XLi+WP4muQ6JbCRFiA== X-Google-Smtp-Source: AMsMyM4EW9mh9kAxjlPDj3mAt01KtyUcGpheZmx1ecsi/Qy8/DwcdyHXUlQ9zFtWvonI1Yz5SVIjMg== X-Received: by 2002:a05:6e02:1446:b0:2f2:87e9:65d6 with SMTP id p6-20020a056e02144600b002f287e965d6mr1890585ilo.44.1664468369314; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:28 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 07/13] i2c: acpi: Use ACPI wake capability bit to set wake_irq Date: Thu, 29 Sep 2022 10:19:11 -0600 Message-Id: <20220929093200.v6.7.I8af4282adc72eb9f247adcd03676a43893a020a6@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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: Mika Westerberg Reviewed-by: Andy Shevchenko Acked-by: Wolfram Sang --- Changes in v6: - Return early when irq < 0 Changes in v5: - Check irq return value before updating wake_capable pointer 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 | 40 +++++++++++++++++++++++++++---------- drivers/i2c/i2c-core-base.c | 6 +++++- drivers/i2c/i2c-core.h | 4 ++-- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index c762a879c4cc6b7..10cdf724fd4b2cd 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) { @@ -168,13 +173,19 @@ static int i2c_acpi_do_lookup(struct acpi_device *ade= v, return 0; } =20 -static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data) +static int i2c_acpi_add_irq_resource(struct acpi_resource *ares, void *dat= a) { - 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 > 0) + return 1; + + if (!acpi_dev_resource_interrupt(ares, 0, &r)) + return 1; + + 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 +193,40 @@ 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_irq_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_capabl= e); + + if (irq_ctx.irq < 0) + return irq_ctx.irq; + + 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 91007558bcb2601..fc4b85fb90b1b7b 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 =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; diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 87e2c914f1c57ba..1247e6e6e97517a 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 C621BC4332F for ; Thu, 29 Sep 2022 16:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236282AbiI2QVE (ORCPT ); Thu, 29 Sep 2022 12:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236171AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFF11E1118 for ; Thu, 29 Sep 2022 09:19:31 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id a2so935598iln.13 for ; Thu, 29 Sep 2022 09:19:31 -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 :message-id:reply-to; bh=7X+A3HUjv/AFbiPoz+UjvIQeQtBXjNPEmQGM5tZ7iJk=; b=meJY3jLHRLWTQsoLhEUKky21w26HmTTsiESdfNlO5GSDiaXS4j9Amf1boWrOO0y9d0 ylDxFCo9jLT2b0N5GfRnmspc4uH3ftvwm+Pgusgaa3x287LgoAu4HzLeH8M01gnuQ+WO N4KETVF/8sRbQcAGT7HYjRYAkcenDj/PC7p5c= 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:message-id:reply-to; bh=7X+A3HUjv/AFbiPoz+UjvIQeQtBXjNPEmQGM5tZ7iJk=; b=FE8SxF5GAyvpCPG2lI0NG8YHi9Z8lxu1LeJfvfIhs5OfE2nsizLEfQlE/ZGMntbcMG 9E0UQLRp0uO/FOBpiwxsONkx0YzTnQvHmusevcRVoEgdLydkAcA+DmYY42clB1GVtzKb 7vDXGrP7hhX33XA6vn8O420Qx2hi/obE+CYi0++KHQWrfxwo+4C8hCgzL7WOgPvK3YEk 205NiklW/T8IX/X2QONjiSvMt192XtwRDrlYuWodKt5zFI49J3xPbR70QgFlsItJWCis DmNlCz+w3jDViYsYBBnO7jO6zAkZJSm7ysmdRWHTPobVRI6tEV9OR0IQyul88NYodFKg v0iw== X-Gm-Message-State: ACrzQf2By0AcCR2/5R7cCgZ4slslJS/YfyIRGZFlNQrqMeBWpmHuk6mx dDqDOj6k8Y7Fb6AUGjb63a7DHQ== X-Google-Smtp-Source: AMsMyM5aX7F0SJTzm8JxLI2ppMOvrPSeAeJki/ssVM0GbTND5Fy5gTpiwJ18cDresOqR7V64JL2vZA== X-Received: by 2002:a05:6e02:1bac:b0:2f2:45c2:235c with SMTP id n12-20020a056e021bac00b002f245c2235cmr2076837ili.128.1664468370357; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:30 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Len Brown , linux-kernel@vger.kernel.org Subject: [PATCH v6 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle Date: Thu, 29 Sep 2022 10:19:12 -0600 Message-Id: <20220929093200.v6.8.I7d9202463f08373feccd6e8fd87482c4f40ece5d@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 --- Changes in v6: - Refactored to leave else clause Changes in v5: - Go back to using adev->wakeup.flags.valid to keep the diff cleaner - Fix a typo in comment drivers/acpi/device_pm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 9dce1245689ca25..b657998ce728e4c 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -681,7 +681,22 @@ 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 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; } else { + /* ACPI GPE is specified in _PRW. */ wakeup =3D adev->wakeup.flags.valid; } =20 --=20 2.37.3.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 68010C433FE for ; Thu, 29 Sep 2022 16:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236310AbiI2QVa (ORCPT ); Thu, 29 Sep 2022 12:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236197AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96FDB12 for ; Thu, 29 Sep 2022 09:19:32 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id a4so943156ilj.8 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=B2T8BuI3no24teUYYIo0mu0zp3pTsUlj5QnA0Co7tqM=; b=UwPP1YFFYnXM+Ku/9y9p8KGX0YX47OhXCxxVWY5lkFnmxvZJcYEFbJBsCkG0PgO566 bvD24Zr5UdcNL/cdHYxVmpZTF6SXfmCe+thOLu6AjMnxn5Cd2mu4SpV39hqOI4p48t3o svRAwaOXpRJnpwcv4yvarO7idPNktzR5kQUDU= 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:message-id:reply-to; bh=B2T8BuI3no24teUYYIo0mu0zp3pTsUlj5QnA0Co7tqM=; b=PpjWmacgVw+Q1IAGZdopAHF+Y9FpK5mWrXhIH08uXu89gPFLBZkGTzpmQOJ5iUvk9x x2XO857HqkI0lObDkiP2nPwE2gpZvuUnH4rC3zgw6o8ZaVjuXKCPpIgs/D/GRlzfgr/A Qpp56PDDhrULzy2ZzWjKt/a03EskUQpD847qef7J0vfA/E59iGY70wSbwUodueGgNXim 3RZehvktMip6HT3MpkkFEoFzxYHuPxi9lWZ5unQavuFTVgbIfIP7VPueCHNljfjCa9Ep MGw0n44oQqPHU2HasYIu0RsAU7XxwoyxDCxAaKqGUB2yhfHl9XBc4KfE7A4lPibOshEE TDcQ== X-Gm-Message-State: ACrzQf1agAlwV5v0xM3LbHT2yjXFWumD1mvs6ozdjFeWznK7UFr3CR5I XD5OCINMIOnMNSDyEw9DKHMtTw== X-Google-Smtp-Source: AMsMyM5az6ilUptS6Jcem1rQWz0X20XO2/hi/bE9rH/EA2zlCEfoEO/nwkxfkjunPAyuL5vWVcJHqw== X-Received: by 2002:a05:6e02:1bcf:b0:2f6:a41b:cc11 with SMTP id x15-20020a056e021bcf00b002f6a41bcc11mr1999439ilv.103.1664468371628; Thu, 29 Sep 2022 09:19: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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:31 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Benjamin Tissoires , Alistair Francis , Jiri Kosina , Rob Herring , linux-kernel@vger.kernel.org Subject: [PATCH v6 09/13] HID: i2c-hid: acpi: Stop setting wakeup_capable Date: Thu, 29 Sep 2022 10:19:13 -0600 Message-Id: <20220929093200.v6.9.I2efb7f551e0aa2dc4c53b5fd5bbea91a1cdd9b32@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 Acked-by: Benjamin Tissoires --- (no changes since v5) Changes in v5: - Added Acked-by: Benjamin Tissoires 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 b96ae15e0ad917e..375c77c3db74d92 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 4410FC433F5 for ; Thu, 29 Sep 2022 16:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236288AbiI2QVK (ORCPT ); Thu, 29 Sep 2022 12:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236176AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -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 63AB3E98 for ; Thu, 29 Sep 2022 09:19:33 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id o2so963464ils.0 for ; Thu, 29 Sep 2022 09:19: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 :message-id:reply-to; bh=9+q7R3sPe7VmgkNvugXIKprRovdD1yE7rr86lSl3yYE=; b=hHXdRPsSlArTrcZhEGh+FwbHdpoD0Zz/lT45kQxb7kPLSCF80Rv6xZHpkugsrZ9Y35 swTaT4ZtNOp2Kzg/MKJ2yAdrzE8mDhhaiaH6ZLWb93lnYEQJqMCKGpq0rAZS6yxAl5FT G35obwK/9W2tV2f/4H9kMH79GlQFeG45miAE0= 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:message-id:reply-to; bh=9+q7R3sPe7VmgkNvugXIKprRovdD1yE7rr86lSl3yYE=; b=h2gR1I1UyglGg72d8g59RILfWpjFHEfXh0dJJLA7WEjDOWJ3IGTGqPd46HBibivR7I g2xlAcFD6aJB3oPR6tV/eUP2lh9xcrAz91qFnwIjOFkuZq2obZYB3kj7s0xGuCO2lNgl P+FlVjoOCR7bNDCxNsX94yOTcwXzD9F0ik3OcPk4uJk+lj6Pw7gUBBzdZqsnfmVga/vc ef33iOV6CfZ3bEfhGJ5tyitk1IXCPT1I2HpeYVP1mOgN6SwRkD02Gc/odinpdLhFeMbT ++4Vh/fmfR8tSSr6u6EJD49qJm6TQ6H83TR9DyOnqyFC82buQGXpI3istqg8OUVobnVU cxjw== X-Gm-Message-State: ACrzQf3D/F/UqQucUWgjBYXMnNDFuliVpyRm4qDzUx5Vdi/dJtq5KHn3 kDWCGIsFo+5SdtMW3gzgBv1Eaw== X-Google-Smtp-Source: AMsMyM4QM6Dhgvi1d7W47z3rRkRJFIEV5fIccG1s7sJeFsnUb8qOsrdfVLW3fQZg2w+pvgbF+MNo1g== X-Received: by 2002:a05:6e02:1c46:b0:2f8:e9cc:7ed3 with SMTP id d6-20020a056e021c4600b002f8e9cc7ed3mr2031171ilg.69.1664468373068; Thu, 29 Sep 2022 09:19:33 -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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:32 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Benjamin Tissoires , Alistair Francis , Bartosz Szczepanek , Jiri Kosina , Matthias Kaehlcke , linux-kernel@vger.kernel.org Subject: [PATCH v6 10/13] HID: i2c-hid: Don't set wake_capable and wake_irq Date: Thu, 29 Sep 2022 10:19:14 -0600 Message-Id: <20220929093200.v6.10.Id22d056440953134d8e8fe2c2aff79c79bc78424@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 Acked-by: Benjamin Tissoires --- (no changes since v5) Changes in v5: - Added Acked-by: Benjamin Tissoires 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 a2fa40dec04ea59..65b7a95956866d1 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 10AA4C433FE for ; Thu, 29 Sep 2022 16:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236299AbiI2QVS (ORCPT ); Thu, 29 Sep 2022 12:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236142AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1AD42655 for ; Thu, 29 Sep 2022 09:19:34 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id b23so1302755iof.2 for ; Thu, 29 Sep 2022 09:19:34 -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 :message-id:reply-to; bh=iThYjZd1ViNBfkkSkGo3l96iqlm3APk4Vux0ZrfYlgo=; b=E3IOPc/UPROW7BFpAFuU5Db/HYddtpiIdOykPLTUF/vLxG8l4cl8SUVGPGjEM5LVM4 /H+dvbAtK+UpBwZQh3uQgfbqEEkKpwHNeN/e/mJQaCzGGEw/zWT7Pmjy7VtI2op1Urrr kzOjLE//7EHr8ITY+/+ixrsJgHuVg7bRUje2o= 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:message-id:reply-to; bh=iThYjZd1ViNBfkkSkGo3l96iqlm3APk4Vux0ZrfYlgo=; b=Z2ZLaqa3zLHFD+kb5GGxsybzYacxbtsYj+lmiQgV6THtocrLzG2Lp9HgbQufRCBxIK 63P8Cj5mR4mpzKAREZ3tw61hvod1y7TS8NPJdcKkaHA6LrlSTHWjZPOMZ/P4nEf+rkYh 7e1/OnaeXya6RaLbuCwECkhz6btratiPkOwcNyjTNSVTJjJOK1qIZnJeCXW5f+9CRs+Q IzuvwQ5qpDr1OYRCbF8QsuGPEAkoIJ8bQuvUAbaQJsqJBMgQD+EP9LHR/RBUJlGqpQfw oDZ4l179fVlotA2ET2kN2Ss/vDHcf4XQHf2XFoqNOZXhcwtjtS4S/uc75hw5j1+sZDlq iEeg== X-Gm-Message-State: ACrzQf0M9IQlxYqMbQE07uCQpjOak9PezcNqoijT8lQE1+JqcCBqOOdL w2Kcz1N0uk89Ar8wO6lMgiq7qg== X-Google-Smtp-Source: AMsMyM5VT4z8ZpZ/XHcO/fVXipxSwbfAltCjh8RrdQ6VkDlp3cjJFmSiYJ7hTyk5FlPtoujoiF1oHQ== X-Received: by 2002:a05:6638:40ab:b0:35a:52aa:3ceb with SMTP id m43-20020a05663840ab00b0035a52aa3cebmr2305857jam.130.1664468374095; Thu, 29 Sep 2022 09:19:34 -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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:33 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v6 11/13] Input: elan_i2c - Don't set wake_capable and wake_irq Date: Thu, 29 Sep 2022 10:19:15 -0600 Message-Id: <20220929093200.v6.11.I7309b8f322082437b93581c6e2953886eeb998d7@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 3947474e93d16ab..b25b94aba3e88e5 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 3F3C1C433F5 for ; Thu, 29 Sep 2022 16:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236319AbiI2QVi (ORCPT ); Thu, 29 Sep 2022 12:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236205AbiI2QTo (ORCPT ); Thu, 29 Sep 2022 12:19:44 -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 EFD5E62F9 for ; Thu, 29 Sep 2022 09:19:35 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id j7so945288ilu.7 for ; Thu, 29 Sep 2022 09:19:35 -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 :message-id:reply-to; bh=1YwA9OG5h99U5Mh4Bxi4p8qnOV6bB/36joe3czuhguQ=; b=f8rp6laB5CllBNN6zmwzHaNksz23qPzNXd3klrxB2Tih5E5FbT+lysIU7wKpaPFQVe nHZujXWLGw83SUCABT4xfNixfsQUy/yNPksAaJIujHN1qtOi4kFKYRPwQIcwPJmP9/vE 4+YxGwkFM97QAiup1JSyAimIHlzWLd/C0dD7k= 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:message-id:reply-to; bh=1YwA9OG5h99U5Mh4Bxi4p8qnOV6bB/36joe3czuhguQ=; b=qnw+TnpYaGgMSIZjF+oQPjqeu4kEIGbB+kFHjKkKBZe4IeBMXY2bj0Y8MkmJq+BzwA 5QdHqa3Y4UWDmI+RYqMsjPwiAlmwVFZiYOL3aRv15tn7HprED8T0BQ1PXJsq3/CanFIM 3pmz+1L/FTmTXzTlGzyCg9S3ksLvGdTHlLMpm/ebGGD3VtSAe4QIKNEV2fp9vNlEo3tB NR1c3G+bjofMCZZsR9hVhdwD7CNUlOB1Cz12LHjnTrOqzrwiFM1mC0AA/EGdvN7DgNeu Pdbh7vcZBe3mI1KlMf0mPFy7rHAp3eJgjG6EEzb00klcIvhu5NXZyQyo2cXqVyXkpIi8 dQOA== X-Gm-Message-State: ACrzQf2OvuqgwnXCUEwEXjoMn3Y/ylO11Vhg65OCmtUAg67GZqsDidB3 XZnzqlI3nz/g7qLCTKEtWl2LlA== X-Google-Smtp-Source: AMsMyM6iP4DREWKSAd7Vdivzy9vt5iZuY7Uipiffs7tMY6MVlQJ2rdRra4Y8EvcR+DshtS/kpDdMdw== X-Received: by 2002:a92:6811:0:b0:2f8:f381:1bd5 with SMTP id d17-20020a926811000000b002f8f3811bd5mr2149221ilc.145.1664468375544; Thu, 29 Sep 2022 09:19:35 -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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:35 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , Douglas Anderson , Guenter Roeck , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH v6 12/13] Input: elants_i2c - Don't set wake_capable and wake_irq Date: Thu, 29 Sep 2022 10:19:16 -0600 Message-Id: <20220929093200.v6.12.I031ffbe411e1bae20bf16a1876da5baf444c7928@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 80e16b533c452a0..3500293bb1d8e14 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.998.g577e59143f-goog From nobody Thu Apr 2 18:06:25 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 76351C433FE for ; Thu, 29 Sep 2022 16:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236314AbiI2QVd (ORCPT ); Thu, 29 Sep 2022 12:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236202AbiI2QTo (ORCPT ); Thu, 29 Sep 2022 12:19:44 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F009D6336 for ; Thu, 29 Sep 2022 09:19:36 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id z191so1284910iof.10 for ; Thu, 29 Sep 2022 09:19:36 -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 :message-id:reply-to; bh=DWObYA2TtwBbzJGrssO5YEYPxOnVZ4pCjCKMQhd93g0=; b=U3rIGTmVgdJ7GvqreNNqC0Ws6jBuabrs0OsqDzmY2fYjy6UvTcDXzF9QeKjy4ncJYv XpZi2bIJMCeNZDcoY5p1X44jzergr2XPqcvYjuXC5PdQm2Dn+JjvfnBwRqGwRqY3vilx j6rTCgKQNbk41Fzwvu2lvtHr/CVndEwxMd0r0= 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:message-id:reply-to; bh=DWObYA2TtwBbzJGrssO5YEYPxOnVZ4pCjCKMQhd93g0=; b=Vpfa7abUACDZd28hul9FByPKVEwhkK+znuOZCYNVp9ZgN6tgLgj1SBlC6XVEdz5e+i bPtEoPpj5ICTUWKz5fTXX4jR1WNrpn1rAElAMjI3Og0C8Dvskyk+LlCweq70boUr5NxN WxFM/p9JQnmqrt1ET73BmH1SJNbw7vd/MzigFXYXDnQ6sI3WvatGiORoOQWPjZVgE6sq sqRWvxCSeWdhwpK8HzCX0pGQ5q0c4W1eAFWW65r00rNbEmm62orFD+/tpnYkjLTcLbvg wUAMQoXoNhfulFn2EVwDEPND14xvZ/cJ5cx3f12bM/a8kFsU5F5LVDqyY8ar1qw+9iwe bbOw== X-Gm-Message-State: ACrzQf1BxjXVRoZ2URC5mnK5IICHNviXAB1pNt78tUIhEr41vq0120cD +XGR6VMl/h+on+SBRWwSE32uQA== X-Google-Smtp-Source: AMsMyM4JleXFGDxGYT3hWAGqXSdT1XJlP2po3hrSGBsUsLx93VozTys8BM85TIYiX2bRXPrfOtUKuA== X-Received: by 2002:a05:6638:1407:b0:35a:4d1c:10ef with SMTP id k7-20020a056638140700b0035a4d1c10efmr2231570jad.119.1664468376672; Thu, 29 Sep 2022 09:19:36 -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 f12-20020a02848c000000b0035aab2f1ab1sm2965451jai.134.2022.09.29.09.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:19:36 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, rafael@kernel.org, mika.westerberg@linux.intel.com, mario.limonciello@amd.com, timvp@google.com, linus.walleij@linaro.org, jingle.wu@emc.com.tw, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v6 13/13] Input: raydium_ts_i2c - Don't set wake_capable and wake_irq Date: Thu, 29 Sep 2022 10:19:17 -0600 Message-Id: <20220929093200.v6.13.Ia0b24ab02c22125c5fd686cc25872bd26c27ac23@changeid> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220929161917.2348231-1-rrangel@chromium.org> References: <20220929161917.2348231-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 66c5b577b791d4f..88d187dc5d325f6 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.998.g577e59143f-goog