Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp107820rwn; Wed, 14 Sep 2022 16:59:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mXPkRTvDLYDiwgxo/kZIGjyohXK4Ir5iRSriogQgUwcWiVY1ULn0wTojUPgww7lYy5Lmj X-Received: by 2002:a17:902:ea0b:b0:178:4423:af30 with SMTP id s11-20020a170902ea0b00b001784423af30mr1465357plg.7.1663199971329; Wed, 14 Sep 2022 16:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663199971; cv=none; d=google.com; s=arc-20160816; b=DlH161hap36qxhakuc0BueNnyuv12ZIiW7iDEqXeJ7dFXvTGJppPSeZYH9xE2cHpQf P4ud1T8aWuYVFSeYq7M6h4v3iANli0f8977oC/yJRRCc2+QwS8oA7OjCbm7aQItVug+M brUyGAw/JyyiIAkiRF+jPYT2aJeyFlHWpZarAn6AQxqb/ne+HhZxLeQnJ0yJEbhdUVI6 RPnSgRuuDeuZEPO7R9Esf1dAZb4+Lwuo4prvADT9ZJbscA1AvNnrLp53Hh5jbF8+zHct 6yxs9VQ0bm9URYtfMoP/h92M+uqX3CG6ko67bTNGPhfgi1xLaNOyCo5Z93IzJIkD1z1s 4mxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FeCM68gkQ9FF2bI4ULoqKrlayWCcShzPlt5I44au1/c=; b=BL9ZF3Xe2+axhCvat1Y2tdw/RW8F45xvPVwcmLrQN6Lr8ai6h9mN3DRMeLGhqRMUFv vcLAQJ1mnnEZhYUf3XCAZL5XIa4bbHtCGYhIQs9UHCo1/+bWVO1TqX4ZMxwcmIQB7g20 rNucwsgbc1xYYmELynJBVUX0H9ObMZ2XcYrp9OPNHD2+ZoAwU/IcjJHy+hF6NQlyAr+P 0by8crpMlx5k6CDNCEoS4KtDuaxWAqzQ/R7kXdyZOWpcxU3/FP78L6EJHH47J9f9gmet Ddn57bqe9ETNyixCJoR992tkNhDb+gzi2Y3zdZFqzzRMNhCFRw+kKRa8JsKJ/ITU5bcL nlfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WwUIlBW2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b26-20020a63715a000000b0042b807728e3si9793570pgn.762.2022.09.14.16.59.20; Wed, 14 Sep 2022 16:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WwUIlBW2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiINX6X (ORCPT + 99 others); Wed, 14 Sep 2022 19:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiINX6K (ORCPT ); Wed, 14 Sep 2022 19:58:10 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA49E8981D for ; Wed, 14 Sep 2022 16:58:09 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id i7so4663857ioa.5 for ; Wed, 14 Sep 2022 16:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=FeCM68gkQ9FF2bI4ULoqKrlayWCcShzPlt5I44au1/c=; b=WwUIlBW2sig7QIamYBwg73LnJKD+Q9o8vhKwbMERgHTclYfel0/TF852uzMVCFjU3l BjnIrrNSZXJ0OF5+ZRPoyjG/jDcPrNwFP5trRbFuko7skJuGhClIWa1EqXS7ByWBQ2zI kVzWFLH1uTj9JPViW5z8GNxNaKXwLCsIFpYPQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=FeCM68gkQ9FF2bI4ULoqKrlayWCcShzPlt5I44au1/c=; b=CYMZKRU6WSXk5ZttXP90ELYcpBUuiU3wSEPtyJA7kxIDPxUcCzRARJ/XhxS47mF94t Oix2MtOmJCehm6M4FMI4uX7jOfIlpG6GY2EBB9VL9veb2PrEMHpD4ZRbRKqIaXEO2Fho 3c4cPTVSyg6XuXWN2JKtM5g7qlwrJGFz4m+XYRjmWFpF9dDoWtrINS2dNOeVsQ2zjDcN tcLby9wcxOYh9mxoIBEUDLmQMkCkdtJRR1fEmQYg7+jMA4fK8BQjbkmzWgnnvPXFFGnW Uqx1Ahso8bj+olksJl/rgakY1u4fvHrqscTze8maGhiWZEKere3dzriAdyKLv6ucArdK foTg== X-Gm-Message-State: ACgBeo3teX3s8pLWLqMAf0LooBTJy5eMGUehPZKjk99wi6oCvKmjLe44 VbrQnFa1hLlD+Zckx1Vv3qbpwA== X-Received: by 2002:a05:6638:264b:b0:35a:79c0:932d with SMTP id n11-20020a056638264b00b0035a79c0932dmr735569jat.116.1663199889258; Wed, 14 Sep 2022 16:58:09 -0700 (PDT) Received: from rrangel920.bld.corp.google.com (h24-56-189-219.arvdco.broadband.dynamic.tds.net. [24.56.189.219]) by smtp.gmail.com with ESMTPSA id a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:08 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , linux-kernel@vger.kernel.org Subject: [PATCH v3 02/13] Input: elan_i2c - Use PM subsystem to manage wake irq Date: Wed, 14 Sep 2022 17:57:50 -0600 Message-Id: <20220914155914.v3.2.Id022caf53d01112188308520915798f08a33cd3e@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Elan I2C touchpad driver is currently manually managing the wake IRQ. This change removes the explicit enable_irq_wake/disable_irq_wake and instead relies on the PM subsystem. This is done by calling dev_pm_set_wake_irq. i2c_device_probe already calls dev_pm_set_wake_irq when using device tree, and i2c_device_remove also already calls dev_pm_clear_wake_irq. There could be some device tree systems that have incorrectly declared `wake` capabilities, so this change will set the wake irq if one is missing. This matches the previous behavior. I tested this on an ACPI system where the touchpad doesn't have _PRW defined. I verified I can still wake the system and that the wake source was the touchpad IRQ GPIO. Signed-off-by: Raul E Rangel --- (no changes since v2) Changes in v2: - Set the wake_irq when not configured by the i2c-core. This is different than v1, where the wake_irq was only set for non DT systems. drivers/input/mouse/elan_i2c_core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index e1758d5ffe4218..3947474e93d16a 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -86,8 +87,6 @@ struct elan_tp_data { u16 fw_page_size; u32 fw_signature_address; - bool irq_wake; - u8 min_baseline; u8 max_baseline; bool baseline_ready; @@ -1340,6 +1339,15 @@ static int elan_probe(struct i2c_client *client, if (!dev->of_node) device_init_wakeup(dev, true); + /* + * The wake IRQ should be declared via device tree instead of assuming + * the IRQ can wake the system. This is here for legacy reasons and + * will be removed once the i2c-core supports querying ACPI for wake + * capabilities. + */ + if (!dev->power.wakeirq) + dev_pm_set_wake_irq(dev, client->irq); + return 0; } @@ -1362,8 +1370,6 @@ static int __maybe_unused elan_suspend(struct device *dev) if (device_may_wakeup(dev)) { ret = elan_sleep(data); - /* Enable wake from IRQ */ - data->irq_wake = (enable_irq_wake(client->irq) == 0); } else { ret = elan_set_power(data, false); if (ret) @@ -1394,9 +1400,6 @@ static int __maybe_unused elan_resume(struct device *dev) dev_err(dev, "error %d enabling regulator\n", error); goto err; } - } else if (data->irq_wake) { - disable_irq_wake(client->irq); - data->irq_wake = false; } error = elan_set_power(data, true); -- 2.37.3.968.ga6b4b080e4-goog