From patchwork Thu Sep 29 16:19: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: 610702 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 39A11C4321E for ; Thu, 29 Sep 2022 16:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236147AbiI2QTi (ORCPT ); Thu, 29 Sep 2022 12:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236140AbiI2QT1 (ORCPT ); Thu, 29 Sep 2022 12:19:27 -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 771831E274D for ; Thu, 29 Sep 2022 09:19:23 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id o2so963235ils.0 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=h0cuae9vWyVCHXtx8/pkHt0KV6Ho28pcJQUBZXBL4qX7QfKJYJqof/tCxr/iL14I3W M8zxLl4hDwWOays+sq2bvQSCyZVacupERvaYvbAXd0qi1AzbLQlaQwCnympljen+025w 6rk62l8P2i+rbCA/b+nzzAeZzBFXfpYWJg0Mx2YfsO8UXObrxdK6oyqyOFxyHIqfRs04 b7aWkxYuIdlg0zi2IAf6k2fvdhFVKcifrx2a3l+zy+Wr2MBvD0ktcspRlKY5kxibmt09 qdPxFzR4lNvli36kGi+l4eoVBS8hVnRWr4zrqR0UJbQRwikaoNcgSn8k+ItyWk897jH0 i/ew== X-Gm-Message-State: ACrzQf0cikWHns3PUutP91o4QXnDXrD6jBbKjoInZs7om1fhBgWWHjVS +9oTHM0SxCB55O+87LEDtYDXTJSyGxiw7A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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-hid-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 { 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 Thu Sep 29 16:19: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: 610701 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 1FA2AC433F5 for ; Thu, 29 Sep 2022 16:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236133AbiI2QTl (ORCPT ); Thu, 29 Sep 2022 12:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236142AbiI2QT3 (ORCPT ); Thu, 29 Sep 2022 12:19:29 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D8A1E274F for ; Thu, 29 Sep 2022 09:19:24 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id y141so1296366iof.5 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=hvP/2rfnCE14ia8q0GOiGJJEhd+unLpugYskg6aKknOC7avZX3F8Fennc90uIqE5Hb AkMuQjq6RkF8lemu0zCj4NO5gA/l69PeMrCtSjQ2UJJOzcsxlhWzNINlaDA4Oh1CEOzm elff1b3mbcoWNa08KKPRsAjSG1EXBJnGB6UfHjzXX37uu4Jfgn4k9Z4t/E3EHsnasGDf oHSYNZSq6FCDhCIluOV9UcvQFYnP4/xyGL0qRmbvYfWBljf8EZCrJpZ484OZKslq4RoD o8kmQnsH/ZSBN95XBFMUya6vvSNDQT05dGwBiaXBG2/4uppLgl5Wo96b8sNLau6tH/JF F7bg== X-Gm-Message-State: ACrzQf1l6IBvagAo3XFwO5KixSR2K4HrR6LHH9jui8WAObMgYSnd+HZ3 5dSs8A7Owqxsd+Nu7bG0BwMcTQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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; - 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 Thu Sep 29 16:19: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: 611197 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 1A3B8C433F5 for ; Thu, 29 Sep 2022 16:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236149AbiI2QTj (ORCPT ); Thu, 29 Sep 2022 12:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236176AbiI2QT3 (ORCPT ); Thu, 29 Sep 2022 12:19:29 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662951E2756 for ; Thu, 29 Sep 2022 09:19:25 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id h194so1297278iof.4 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=GXnmUJ0+odpVWHLckPCJudO9Z3wtI/ZaOZD3wCOaNXeQiLTKyKf9DzY6WirjBb4WNx zq/5lHdLdijjBmiSrdR+3OBD6VI9lVLo4F+MXRpTlvMmcMrGdTBZT3JVHd/Se6QTn3wO dwp0AiDLUwLEOMgK1jVlK3cZyD8ByCYzA1xXIWzqkpIhHR8CsRxyr2tXvVH0agwdPfLb d5MHNNlapv5f9qaVpoPUqpKk3BrId6+qcJb1nDuc7/AKLIyyEcqIsGqq6k12sNntojpg zrB/XXqbjqrS16WNAShlMiE8+HzXqY/rPdhMRZOsXcDoUdnGicli5h44qqv2afpi6nY/ vMGw== X-Gm-Message-State: ACrzQf3f5R5AOQOVFBsDo1c5SQNOIvp9x3adJMuAWdTehsutHtbFPjp0 uPtjn+98ceW31nWZ12FgBJfPxg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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; - 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 Thu Sep 29 16:19: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: 611196 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 E0735C433F5 for ; Thu, 29 Sep 2022 16:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236212AbiI2QTs (ORCPT ); Thu, 29 Sep 2022 12:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiI2QTa (ORCPT ); Thu, 29 Sep 2022 12:19:30 -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 025291E2767 for ; Thu, 29 Sep 2022 09:19:26 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id j7so945087ilu.7 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=63EogFXE3tktob2S1OYrSerquH4fRJ+eStHnMAWMsFprLh5HNSGmtikSKCJffSGovt QSxg7A/bl8cZ4QGvBsWfbP8utpMJCAXo7ZBpyF0SMdey27glEVuAPRzdGy3BJ+jRzf3j ueHEcaieuCHj9gAZYBzqLW5ABZrRsNfCjcHU83+SFM+RAXy/9x157/uTqO/fIAtRnr89 ZRnIUBRN9XaT/kmrdtw7b0PgHLyLn4v9EZGEH8LYhRolZi1wUoyALtYmhyAl7h10Gekk BbKyyfOHy23ItwtQecPgLEHe9JE5AhGQfxUfdeTWsSiDQ4SNSItmzDzRMHGmlN/5OQpB DqFg== X-Gm-Message-State: ACrzQf3mJzYwpdwQwAtPTbzhyio9yBa55GfCZNjutUpbl/CAAEOdx5Xi 7DEN+UeOPozWAU/CpYaguGRyvg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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; 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 Thu Sep 29 16:19: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: 610700 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 B04FFC4332F for ; Thu, 29 Sep 2022 16:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236234AbiI2QUC (ORCPT ); Thu, 29 Sep 2022 12:20:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236120AbiI2QTb (ORCPT ); Thu, 29 Sep 2022 12:19:31 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDBC71E0C49 for ; Thu, 29 Sep 2022 09:19:27 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id i9so687213ilv.9 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=cvJ/lGoOpUZD5cCxU7q//P0Wojpi783jgYap9M0M0TPi8ep9TbFb2iBQoKWRANFyRJ 1XaLc4S72KWMfqYK8Ppcb9JEI8nqX1fX4AgiS/xTInNqPk5vhkscPOBWjnnCWZINWYC2 WUFpGtByQQlQ0jqvlgn4vKV0iAVJT5RB3Vv4lYXGjZAIN1xXPRI4X2RGem0j8ZTiMwrr Ymryg5/ptCugOsHIHAkhO22Tt2wIxXeVVpRVeOAB+E/a5bmCo/i03TVOn3YSJqXOPUZ1 THhVVxRtPTQqdmIyJv4kn/qyP4kWVxGSkIAAiHRXw1Ocipez9mzHlAwFpPqbPcutR+yT mTMw== X-Gm-Message-State: ACrzQf2h+ViqoM9euQMdzPy1wzviXwHMuMjW8Vw65n3qYbY5cAQFY9e7 dNHuswxDizBYMD5PGTVPvX7l2OYfZNwFRg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 --- (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_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 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, 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 Thu Sep 29 16:19: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: 611195 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 338B4C433F5 for ; Thu, 29 Sep 2022 16:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236245AbiI2QUI (ORCPT ); Thu, 29 Sep 2022 12:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236123AbiI2QTb (ORCPT ); Thu, 29 Sep 2022 12:19:31 -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 C1A4B1E1CDD for ; Thu, 29 Sep 2022 09:19:28 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id a17so458741ilq.1 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=VeFK3g8BjM87t6eoR5B3Mws1d9b1AkCaZVY4p9D0v4prQzr4CAJVbDshA+EXYUEe21 Vg8z9NTooeV7JP1sHHn+WuBi8bupYE03ULrbpmG9HIZFm0uuQcuTNYruxcnHuxhWhztR vJDJ4P3d/GYocYuZX5QATdtOJ37YoDQ8NUTmo/E5rK1tnb2J4ZbxHATcJogoVARslbGy q2Dw4BTt/NOeCGhZcw8J+5fa6GAXs/tmdHP3nOmSsbTcA/KXmewiyDVhDEWCWdbmmT/0 qg4SQWj8VIdqfYXJ/CmvurW69IrUGx5Rt7s4kdCAUr1hwD0dBnaTWMLrALGF79WkaNfv a11A== X-Gm-Message-State: ACrzQf3URWWUqmKbCazxPqlGaKwZqfoAuR/HayGcvT4EaJzeVf9Afbou cnYLYAfF3NUfFyWwGeHeYA9cWQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 --- (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 = 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 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; @@ -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; @@ -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 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 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_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 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) /* PnP DMA specific bits (IORESOURCE_BITS) */ #define IORESOURCE_DMA_TYPE_MASK (3<<0) From patchwork Thu Sep 29 16:19: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: 610698 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 DEA81C4332F for ; Thu, 29 Sep 2022 16:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236182AbiI2QVM (ORCPT ); Thu, 29 Sep 2022 12:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236192AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -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 E331C1E110D for ; Thu, 29 Sep 2022 09:19:29 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id a4so943094ilj.8 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=E563y19G70Zy84KmQ7m1SrRtcMkt8WYIHuUVKvdUZ7gDLDSVu4bZc6odCXIh1N8YbB pV6YnPS+/nSLQLsnVH79GPwlNPliwFu8AWiM0j6O11xiUhnmGlnng95rIcSFhaMr3pm2 ZXXvo4ZnlILqjLoLFfNiKbOwMwNQ5GbPq1zi19IsJoW+/6vWTNLykHbTkzkw63D14yX3 7o9As6P9o5+QMZINWmjv5qV/eOCMZCsH+tKFoQx42xtnkQX8QX9kSPsWObIR+PCBghfJ x1bi5Rxl/aoycLQ456M8+1CjeeVTAjKy++XaYBrkgZaaH4izl2llyPtX5ONTKNImWrQ0 plzQ== X-Gm-Message-State: ACrzQf1sqczzjXN1MEQl3QyGrJG5jzX6DKoiQobgg9SuxTwFFsDYjNkW 6CDIiu5KdvaAnpAmRph8IqgtAw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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_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,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 = 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 (irq_ctx.irq < 0) + return irq_ctx.irq; + + 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 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 == -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 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_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 Thu Sep 29 16:19: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: 610699 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 98215C433FE for ; Thu, 29 Sep 2022 16:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236266AbiI2QU4 (ORCPT ); Thu, 29 Sep 2022 12:20:56 -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 S236165AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185E61E1110 for ; Thu, 29 Sep 2022 09:19:31 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id a4so943130ilj.8 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=dGOjVcnhGjqItizqKdk3DpURwXQVInCNY4Wgay7j0C3iRLuqV+QSP3I0WDQ1GE4t4N UZ/5A+dwXnNTNcQZPoPtraVybus9d7uZceL0P8vM+VARLUpEI9OnUysLRToOHhrpO50p i10Ou4rVgf+2MHT/ZbjNIabmp9DjEz5mfsc2BSRkt+u1mwUcN1olC64/ml0vYEdsRov/ 9xmPNELVp6i2IzEO3qFhZNwYgrR8zPRMBKmiaDc+mw3VAPp5BRhNsponsUzWdlTJm8dG Iem2BmS19ENV+3taBmaZTUb4QC3cmiVPjWPm+PK7zsXa64Yb1M0wiDxc4pyrQIWOFICq Yvuw== X-Gm-Message-State: ACrzQf2D5jD6C2ze3/l1nVl79UHk6sV62Xnoa99uM9ymCPsUW22492bN ajEuZiTOh4uv+KNkoX72zjT6nw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 --- 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, struct acpi_device *adev, d_min = ret; wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= 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 = true; } else { + /* ACPI GPE is specified in _PRW. */ wakeup = adev->wakeup.flags.valid; } From patchwork Thu Sep 29 16:19: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: 611194 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 AE0BDC433F5 for ; Thu, 29 Sep 2022 16:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236283AbiI2QVE (ORCPT ); Thu, 29 Sep 2022 12:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236189AbiI2QTm (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 1B590D77 for ; Thu, 29 Sep 2022 09:19:31 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id a17so458814ilq.1 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=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=jsZPVCWumRyhV/yWDh7GI20P4jGaUs1wFKl2gFaGugu0pthV+K4bBHED+ai/LQP6YS XhEO2OKwgz4nc/+RvRXCoAcM1MOTxkJ7vcTuaoM9CaKJftjsvOPLyINFT68QXPGndylr 0TqKFIbaxKxcWx2ilWGUUE8uwH3SmU1OpSFwyP4C12LgjlpXCyUWCTSHCP4OLZB9mmjR cLkb0i2x3SAKt8+kv6sAknVVhX60yEnpk5SycZSBqJUu3/l9DlBDHux6l+mDSXZ93V8J xBDf4ailevaCj9mR2xNbjERyyDRdVKY9EygIw/rbCThULJjy6clxJy9rctxS6kWAX9VV y7cg== X-Gm-Message-State: ACrzQf0QZ9pVGyvQimFCWTLuvMcj8AupCjPmdSEFiAEBgtZ1T261XHA9 NyDAKIQ8iB7CJsXS+lATiodWPw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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-hid-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 *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 Thu Sep 29 16:19: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: 610697 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 C902DC4332F for ; Thu, 29 Sep 2022 16:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236300AbiI2QVS (ORCPT ); Thu, 29 Sep 2022 12:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236195AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFD3D10B5 for ; Thu, 29 Sep 2022 09:19:33 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id a2so935647iln.13 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=w/vpyl7+RS50Hw4wzbTzxDUsQuRUryTSryrcCpLtH4iDkJ2WzpHOHYBrrWnqHg60bR 48FmFTd9+M40KvoX4RDuNQ3eYjMvq3NyeOCbC9GWmAUcKRQYSmk44Lw2wKLFxw/+azz6 0PpMADaLWfNVmlsrdCI1vJ3RMy1mOXSjikLtg2eFjnah/4iRL1dF+5mxQx1XMW8PXwMF 6AaGNW7WE28Z5kS9Y+D+3L+oRJUNlNtU38RTQ/eis/EwDmUJz9EhUe85M/0vIjlhLFSn q+uDFbfPV3sUl5LvF3oU5nj13CxJN09guJrdvQxt2iflMvpXeXxsXj1G4GKSxHuMSCyR d6bw== X-Gm-Message-State: ACrzQf2M+hGnZA0+4dpFWLpz4ygLZM/AtiB2ppQhGUKLZm2r/OVrb7U1 OXkjtdIWzzqZ1VvhHdhFNsY98w== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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-hid-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, 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 Thu Sep 29 16:19: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: 611193 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 D890EC43217 for ; Thu, 29 Sep 2022 16:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236193AbiI2QVN (ORCPT ); Thu, 29 Sep 2022 12:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236190AbiI2QTm (ORCPT ); Thu, 29 Sep 2022 12:19:42 -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 B17AF25ED for ; Thu, 29 Sep 2022 09:19:34 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id n192so1297481iod.3 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=UIaYsXHW5RUhUZf1uL5XqnOAUHUOnph+QE2KL30rvx3uRBQ8w8nzUFQtWtQGnxOnh9 vJ3A3A7dkYSKBVtgitKajlBmslAihhd4luIyWQJ10PvCz49ZJ1yovfmZB1VAhq3oTqM/ cxX9Aeh8q2PZqtrIGCpw2QqyWcUAqklk7TD9+q8u54toF41wtpEMvVetxW1o344UbI3Z PsRwKfzSxYOsKwDNetutPGF9RmswkmuV/RxjJ+NFAQjEiMy0xOgPs66Zy0s5zW38xlYX NrWLzugqDJshz7ciKY/utqlB8gG8z8lrxhSXbRJmA8JlP3Bf5uqLQGLtm00zbyE0l1RS o4Sg== X-Gm-Message-State: ACrzQf2LlrfwRz8PUB3CrGSEXI9fQ5LBLHiXdyoEPK48mDB1N8H5CRY2 JTn45Ln6wH3L8fmHDSlgP5jPrw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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, } } - /* - * 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 Thu Sep 29 16:19:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 610696 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 3268FC4332F for ; Thu, 29 Sep 2022 16:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236213AbiI2QVn (ORCPT ); Thu, 29 Sep 2022 12:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236216AbiI2QTs (ORCPT ); Thu, 29 Sep 2022 12:19:48 -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 C40D3BF76 for ; Thu, 29 Sep 2022 09:19:36 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id o2so963515ils.0 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=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=rQtfNlwoukAVK0SGzYlA/SnkKj6YzhZljGyc4GHYJFFbVJ6snJ4MG8RBfvGwtmIhqh OFTEGq6oxHfbXJvSnJfp3kAivrslFbzbcljZw8nTHEHszcEwT86CAkSP+EFKhHT/XTQD kxYk+jNFegMipUKDX4M8IKQBbDRS1omQ4jzaMia0+31bzSSTAaOl0OWAji467cO6slGU GUw9V9jIl3qvedh8H/v28hbPrOuSVu0+uAhgM8GHbVieNEc8/ndL6iQb/4FFTqgqo61U i2wf9WP0F1as+NVexu7X8XQSD8Xdkx8K4/EctZvzrZtXzx8GywRbaWl1BFd9Mpw30vVT eBsA== X-Gm-Message-State: ACrzQf2xn/v5RFOi3/Zg3zdBZrgZ25BvWbbK1Ln7cfaWdiTFX6eXBB8W 7iDDwyS0cTOPhK6jM9fqksU1hQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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 *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 Thu Sep 29 16:19:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 611192 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 969B4C4332F for ; Thu, 29 Sep 2022 16:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236204AbiI2QVa (ORCPT ); Thu, 29 Sep 2022 12:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236203AbiI2QTo (ORCPT ); Thu, 29 Sep 2022 12:19:44 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F01A36348 for ; Thu, 29 Sep 2022 09:19:37 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id h194so1297731iof.4 for ; Thu, 29 Sep 2022 09:19:37 -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=SUzGIxBjPHh3ZorNLUz8QhUBzE5hMU6CuSUeokwOFVixqduPG39ZzaCrAMiJRbQGGt BeBLrFuUiLyVvmzjB9DpwJR9I1m0i9ywnQLNcsnb1OCIly3m+A0tz/dBM7L56bO3Nmcb omsrV41iqgsujq3OspCf37e5IQ3vkhr32f3/htOZ9IKflktnjvlDOw/hmmHuWmmHlZ0q +aVEHyTvXygtMsSy/CEkucC9oC1CqvQlCD56FAlVPHunYxzKsRObdLK9hEkJsihlvKb/ OWoPeHIseUL/r+wGBVc3ApNNCB/F2L6g5mO1EGawJuLy69UZpswgOsyVU5yl9UsoWgXp i8tQ== X-Gm-Message-State: ACrzQf09jc0ovm7q7S+gOevZbZeQf9xrDQ8qS1X0PGmmo3yvoj7iPYj3 q9I8UVT1UW3camn5xARIb5lY1A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 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 *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) {