From patchwork Tue Aug 30 23:15:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 12960072 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 33BC5ECAAD4 for ; Tue, 30 Aug 2022 23:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbiH3XQR (ORCPT ); Tue, 30 Aug 2022 19:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231404AbiH3XQO (ORCPT ); Tue, 30 Aug 2022 19:16:14 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62655789A for ; Tue, 30 Aug 2022 16:16:12 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id s11so3038945iln.12 for ; Tue, 30 Aug 2022 16:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=E5Gu43PGVE7VaKsHNMloj9b2iupdeWYkctb9tALGTWA=; b=calzQ4UJJQNihFU8xJrPTf7HQOsAtNJvL7Jdv2bN4AZQ0Eq8qPzQeFq10UppBuSOgi MUzY50aXsaEIyTwZU9C7C+ZTp308XJV8y7wcAy5q/lQQKqATC2DECYQ8yszRXczw07Rn m7rYPvOXti6+GFoLl2jol+9N+r4nMw50T0uHU= 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=E5Gu43PGVE7VaKsHNMloj9b2iupdeWYkctb9tALGTWA=; b=CYUVO+Nt5hU5Y4903Q/z+u+BwnV70sGJq9igeXK4tVW56haa/0yp++rhyD8Wa6v1Do Sk+3CoyWN3UELOKR8tCa4cxtwvdwTC7wE+1VgVNDbI2sgXyO27Bb07kWqrdjrsnPoEYj L8OK1rKrn/K9JDT7/xfly2VDcPlAZyFzL22SL40a76AZHDHo66/GIEm/gZtcuJ2Xvcf5 /y4KWMCFVGnczDimHvr4HA8AaxBW2ZpH5tGeg1xC7m0bZe+O+akAO6O5fd0kc6oiGsP0 iLkt0u9cjaVe8wVP3vnX1eFhf3QxjkxsnjllTLueDVv6+dX46eojKW8DaGX9Xfyx1Tpu SqRg== X-Gm-Message-State: ACgBeo1C4FFM8uWGPz44ZoiwbRPK7lb/GSKXfXkTngp1H81Akz/1dsZd bLp6dhKJILfCkIWOHZZMDmRFVG2UhQRbaA== X-Google-Smtp-Source: AA6agR7UWrQrF7nrb54KyCGExTs/aPKg2m+FvODWT33fVdouif8eYW5zosvaGTTPJAIvXq36GoKgDg== X-Received: by 2002:a92:cd8f:0:b0:2df:ff82:2e5f with SMTP id r15-20020a92cd8f000000b002dfff822e5fmr13230289ilb.72.1661901372164; Tue, 30 Aug 2022 16:16:12 -0700 (PDT) Received: from rrangel920.bld.corp.google.com (h24-56-189-219.arvdco.broadband.dynamic.tds.net. [24.56.189.219]) by smtp.gmail.com with ESMTPSA id z30-20020a056602081e00b0068b1858c81asm6165821iow.13.2022.08.30.16.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 16:16:11 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: hdegoede@redhat.com, mario.limonciello@amd.com, timvp@google.com, rafael@kernel.org, Raul E Rangel , Dmitry Torokhov , "jingle.wu" , linux-kernel@vger.kernel.org Subject: [PATCH 1/8] Input: elan_i2c - Use PM subsystem to manage wake irq Date: Tue, 30 Aug 2022 17:15:34 -0600 Message-Id: <20220830171332.1.Id022caf53d01112188308520915798f08a33cd3e@changeid> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220830231541.1135813-1-rrangel@chromium.org> References: <20220830231541.1135813-1-rrangel@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The Elan I2C touchpad driver is currently manually managing the wake IRQ. This change removes the explicit enable_irq_wake/disable_irq_wake and instead relies on the PM subsystem. This is done by calling dev_pm_set_wake_irq. i2c_device_probe already calls dev_pm_set_wake_irq when using device tree, so it's only required when using ACPI. The net result is that this change should be a no-op. i2c_device_remove also already calls dev_pm_clear_wake_irq, so we don't need to do that in this driver. 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 Acked-by: Rafael J. Wysocki Acked-by: Dmitry Torokhov Reviewed-by: Tony Lindgren --- drivers/input/mouse/elan_i2c_core.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index e1758d5ffe4218..7d997d2b56436b 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; @@ -1337,8 +1336,10 @@ 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) + if (!dev->of_node) { device_init_wakeup(dev, true); + dev_pm_set_wake_irq(dev, client->irq); + } return 0; } @@ -1362,8 +1363,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 +1393,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);