Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp805881rwe; Wed, 31 Aug 2022 11:18:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR6u/EFdSWEGCnZC5YNMj6T43jSK6tGxRxuGLNCfrjpQgb7jAH7pvVSJyJ79BJfEfuvCACA+ X-Received: by 2002:a17:90a:4496:b0:1fa:bbb5:7000 with SMTP id t22-20020a17090a449600b001fabbb57000mr4530574pjg.218.1661969880565; Wed, 31 Aug 2022 11:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661969880; cv=none; d=google.com; s=arc-20160816; b=UU21O9oL39f6Z7OH9X0EDmrwLPotwgy72QhSNYiHGj9IWCQ83XOFY2SxK1k1UhRdHq zRiBXftg8lYl9gfgp2yIu6LEjKsPG1/lEZjjfr8dJkBy1rj6t/lnP5QNvxMkV2plZaxd 2HKf0puDlD6CNpxAeqmawTkfaQwMcYA2H2HqtTNFxh5vVvLf9NwXIzwbyAndDXBqDNTI tfY13MGh7/SO9HbkRyM6EZK7QxVM/gtYbtDBaUvcbC8rwSKOB9xC1mKGa+qkBsrvivcA T/hXQIpTpbqdYwJ+XOabP/LfDRS/lSXFkQneIZnq7oWacwKUM8sI8YAuQP8ESFjYwxq6 DSiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=VVktuC1tHcVjWphKZ83mZSdKAvpz7EcwQZEsdT73H08=; b=OCYKiq//rkSHNIzvoqKh5q8rnfJIo9Emht0t/mvuAqHM2X3UGcY8e1BOnrMnx1fX7J wluQDRBtqWz2VhrpPHCgeD8bVO1XgspDw4XzPwO0p+g5unqTriuiCn/4Nn13zizfk5jn YJVHVzDk7305WW2TK4dSmvrBtj3zo8wSzBM7YPIj8zdi1V29Lne4H2rzs4GpxaSUSk6J 6fEBsvBW0b42h5XL/3wewb69Jd+JbiRWnXePzmIWN0nU5pw0BXY0yyjmLID47+LZ2PqN pPVIzHJdo0lNvKmn4y9sg2s3589arkU+Un+/PRjWRIfqYgFftbMgasb1Cx6JI5rx7AOW 7JYw== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a170902d3c500b00174ef093ad5si6699836plb.156.2022.08.31.11.17.44; Wed, 31 Aug 2022 11:18:00 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbiHaSBa (ORCPT + 99 others); Wed, 31 Aug 2022 14:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbiHaSB0 (ORCPT ); Wed, 31 Aug 2022 14:01:26 -0400 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B026DD4F8; Wed, 31 Aug 2022 11:01:25 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id e71so5309948ybh.9; Wed, 31 Aug 2022 11:01:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=VVktuC1tHcVjWphKZ83mZSdKAvpz7EcwQZEsdT73H08=; b=N+mgdELDMwDQlHKiE039HU2Y7ljzhuiMpRzLxfgU86mrh+N0w57pqKPMA76CdKyE1p 0udP3XFtkJ49zLCx9lSGoMkegDv4S/xQYVYafq4jIqTAmovF8SNJceVhF1/wXbZIEMS2 ailxg8jZCdoAVqE9DjAkOg8uNGrUUryk3b1dnkPAiRcMvxe8nV+ELo/FeQvOMJP/agmj K8dAOUiuNuSbjzY46DohODA+07pp8F/OohK2QqH1viSZ0KTNZEmIAifouFYDRHf84cLc mRu7Py4VCsjLu/S0GsQaIDpSXTxeXdIHtoWugcI0S/uHgVOy1k213P0B91Jltq8L9TsQ O90A== X-Gm-Message-State: ACgBeo2YyGqS9KYpjMwLo0BqvCFM+QUwdHS/pwa9BRzsrsFPHaT/mLlh eSOIALHAJ3cbE93SpJ8NK1YHaRCbl5BrqTCZCT0= X-Received: by 2002:a25:ec0c:0:b0:690:d092:2d56 with SMTP id j12-20020a25ec0c000000b00690d0922d56mr15354533ybh.622.1661968884114; Wed, 31 Aug 2022 11:01:24 -0700 (PDT) MIME-Version: 1.0 References: <20220830231541.1135813-1-rrangel@chromium.org> <20220830171332.1.Id022caf53d01112188308520915798f08a33cd3e@changeid> In-Reply-To: <20220830171332.1.Id022caf53d01112188308520915798f08a33cd3e@changeid> From: "Rafael J. Wysocki" Date: Wed, 31 Aug 2022 20:01:12 +0200 Message-ID: Subject: Re: [PATCH 1/8] Input: elan_i2c - Use PM subsystem to manage wake irq To: Raul E Rangel Cc: ACPI Devel Maling List , linux-input , Hans de Goede , Mario Limonciello , timvp@google.com, "Rafael J. Wysocki" , Dmitry Torokhov , "jingle.wu" , Linux Kernel Mailing List , Tony Lindgren Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 On Wed, Aug 31, 2022 at 1:16 AM Raul E Rangel wrote: > > 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 I like this a lot, but the assumption in the wakeirq code is that the IRQ in question will be dedicated for signaling wakeup. Does it hold here? > --- > > 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); > -- > 2.37.2.672.g94769d06f0-goog >