From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACFA37A for ; Mon, 25 Apr 2022 03:59:27 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id j8so24172371pll.11 for ; Sun, 24 Apr 2022 20:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=560ZyjDjMjw/eukwNXu0xmzkhr36IsOK1UcMliQ6ixc=; b=prb9unJJzjMB0mP9+M1FA3lUC7YakIWgMe7cz6wtisEGlAZ4W/UuGfIR/krAV0qFCo efB88t2a18IQSEgzl2Fq0IF31F5wCiRqsBJ3v4zGnqN1ZCxucEFdqjR+l58YQw+VmFw9 fdqVgbyQIhBYe6/oQSpS3qVFtMnQpBXouJbZJ/77qHalJUupcRNzhG7HsocUZY0Dntem g+EdHc+F64NmfgCc9cPHHrc/SO8U45jmIOPqzYx5/kCAKIl3o1a4sWM0GtMEcT5P6bXc lIHe/c3u1YeWpxNhYikhEsnG5wHSiqAVTArFzjH4RYEHQ+MBh4xWWIe30D7o4L85I6sR QdPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=560ZyjDjMjw/eukwNXu0xmzkhr36IsOK1UcMliQ6ixc=; b=YcukC3vVxHVEntyzegSPsynsgVitVaFEvXv/GhFmWBOMogCbPXGgzKypHoiPMvk6Md mKCaC5mqQ1JX/2bstaxT7aN+zcnBRdmDycWy7YdWD2pYjyUMfII2qsnW7oabhWb5Qx8P kRTAucppAmtsH4s1bg979Bx9SJOxd8raqQ1nrSbpzfa65m+Hq88GCuC/mKB5d/LC1SCh EJaVQlYScZ6en9v7cC1jWuJeZDWaDEiRDdrjWDwrTLSQnzaxqmEgCy64GiD0l0NVew8F iQnkeGMq62V8Q1q7tWDz9tGtM1HXkgsh/HAwzBPWaFBdoBf03eN2xL3vYqzW36iw6pfS gjaA== X-Gm-Message-State: AOAM532g7CBwjtbbx9nZqk3KuNAF6uslS0kqJohB7eWfWAU+Ten9Rssu LaHiolk9g9+sdFgRJZZBw9A= X-Google-Smtp-Source: ABdhPJxymPMSMsVhlIAj5Ciak9kOFIqoLkksDgND3qhOb2ScEzBn83mdGxCMXvRU32+KSGX0rgDmNw== X-Received: by 2002:a17:902:7009:b0:158:3bcf:b774 with SMTP id y9-20020a170902700900b001583bcfb774mr15946121plk.103.1650859167020; Sun, 24 Apr 2022 20:59:27 -0700 (PDT) Received: from google.com ([2620:15c:202:201:282a:d50e:e0fc:c145]) by smtp.gmail.com with ESMTPSA id c2-20020aa781c2000000b0050a7ff01d2bsm9431985pfn.30.2022.04.24.20.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 20:59:25 -0700 (PDT) Date: Sun, 24 Apr 2022 20:59:23 -0700 From: Dmitry Torokhov To: Samuel Holland Cc: Hans de Goede , Ondrej Jirman , Jernej Skrabec , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v5] Input: sun4i-lradc-keys - Add wakeup support Message-ID: References: <20220424161328.61103-1-samuel@sholland.org> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220424161328.61103-1-samuel@sholland.org> On Sun, Apr 24, 2022 at 11:13:27AM -0500, Samuel Holland wrote: > From: Ondrej Jirman > > Allow the driver to wake the system on key press if the "wakeup-source" > property is provided in the device tree. Using the LRADC as a wakeup > source requires keeping the AVCC domain active during sleep. Since this > has a nontrivial impact on power consumption (sometimes doubling it), > disable the LRADC wakeup source by default. > > Signed-off-by: Ondrej Jirman > Acked-by: Jernej Skrabec > Signed-off-by: Samuel Holland > --- > > Changes in v5: > - Fix typo in commit subject > - Update Ondrej's e-mail address per his request > > Changes in v4: > - Only mark device as wakeup capable if setting the wakeirq succeeds > - An entirely different, but equivalent, DT binding patch was merged, > so there is only one patch left > > Changes in v3: > - Dropped unnecessary pr_err in platform_get_irq() error path > - Dropped patch 3 (DT update) as it was merged > - Added Acked-by/Reviewed-by tags > > Changes in v2: > - Add requisite DT binding change > - Only add wakeup capability if "wakeup-source" is present > - Warn but do not error out if setting the wake IRQ fails > - Add "wakeup-source" property to PinePhone device tree > > drivers/input/keyboard/sun4i-lradc-keys.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c > index 4a796bed48ac..781f9b053115 100644 > --- a/drivers/input/keyboard/sun4i-lradc-keys.c > +++ b/drivers/input/keyboard/sun4i-lradc-keys.c > @@ -22,6 +22,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > @@ -226,8 +228,7 @@ static int sun4i_lradc_probe(struct platform_device *pdev) > { > struct sun4i_lradc_data *lradc; > struct device *dev = &pdev->dev; > - int i; > - int error; > + int error, i, irq; > > lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); > if (!lradc) > @@ -272,8 +273,11 @@ static int sun4i_lradc_probe(struct platform_device *pdev) > if (IS_ERR(lradc->base)) > return PTR_ERR(lradc->base); > > - error = devm_request_irq(dev, platform_get_irq(pdev, 0), > - sun4i_lradc_irq, 0, > + irq = platform_get_irq(pdev, 0); > + if (irq < 0) > + return irq; > + > + error = devm_request_irq(dev, irq, sun4i_lradc_irq, 0, > "sun4i-a10-lradc-keys", lradc); > if (error) > return error; > @@ -282,6 +286,14 @@ static int sun4i_lradc_probe(struct platform_device *pdev) > if (error) > return error; > > + if (device_property_read_bool(dev, "wakeup-source")) { > + error = dev_pm_set_wake_irq(dev, irq); > + if (error) > + dev_warn(dev, "Failed to set wake IRQ\n"); I extended the warning message with irq number and error code and applied, thank you. -- Dmitry From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CDBFC433F5 for ; Mon, 25 Apr 2022 04:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YqDGmLjfA+aUOIXeg2hvCbrnV8a+ha/QYPvWU8yb2Uk=; b=FZOLtnD4pnTSFQ JynH2hmlHR9forau5M4rrjKuJiosn17uuKpDNzR7cBwwlKPiLqSZCx9pslKw1S2e91B945TD+1Pyb nyOdNZZ7+vk+WdC3thny/FzNU/k12zsQfRLLFsiUSDapcHK7aefuG2fP42dStmHQnmLz5E7Lxx02I E4pWtcZqBxFwiHXeXNvRJXBWN1yufFqtFSBhj8/1I7ZR3wfqMNcktgLpF+M12i9qqaB0q9lZElKZN C3HsnS3WW8SJ1/yRfmHMh/KySWcGf+khIdwYUcOYeCh5UA9FmdOl4i9sxdN+ikdKcVfiYxSZaoOtn Ke5D4Mb9cuRFNf3h37lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nipsp-0083qT-Tv; Mon, 25 Apr 2022 03:59:32 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nipsm-0083q0-MC for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2022 03:59:30 +0000 Received: by mail-pl1-x635.google.com with SMTP id q8so1019911plx.3 for ; Sun, 24 Apr 2022 20:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=560ZyjDjMjw/eukwNXu0xmzkhr36IsOK1UcMliQ6ixc=; b=prb9unJJzjMB0mP9+M1FA3lUC7YakIWgMe7cz6wtisEGlAZ4W/UuGfIR/krAV0qFCo efB88t2a18IQSEgzl2Fq0IF31F5wCiRqsBJ3v4zGnqN1ZCxucEFdqjR+l58YQw+VmFw9 fdqVgbyQIhBYe6/oQSpS3qVFtMnQpBXouJbZJ/77qHalJUupcRNzhG7HsocUZY0Dntem g+EdHc+F64NmfgCc9cPHHrc/SO8U45jmIOPqzYx5/kCAKIl3o1a4sWM0GtMEcT5P6bXc lIHe/c3u1YeWpxNhYikhEsnG5wHSiqAVTArFzjH4RYEHQ+MBh4xWWIe30D7o4L85I6sR QdPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=560ZyjDjMjw/eukwNXu0xmzkhr36IsOK1UcMliQ6ixc=; b=Uhow0ossDKqj0DtLU3rvutF1xdE1LCCR5CXzq83fMTsaMVyYH+BpiNOV8iYS0+Y6c1 4JYVZhDLf4+u3M6ZRTHMrcDAvhwH8t9sj+suuysUab607/xlwwfGJZ1m+6HYddFGWiGL W/yU9n52pRczjIKLV+cACkmh3PUWCn8aYPat7FImtqxiwivFNZc9r/nQiloXXhe1AUDs SlPXi6X2loPI88VDctRUaksOeMLpnNm50qE21bZuZpOeUMltEEYdjZAabGnxe2WZ/l29 JC3UUEzhw5jsZKKE4Env/CQ+9QxLFMB32EngrDtZEjQl9lhxTc9FiqC41ZGgEibXMrsk B2ww== X-Gm-Message-State: AOAM532GhpQkoCC3othDcdBLBV/qUQxHjMvrBhuakAiUR9cogEdu4nGS ThW1+LDiPbBnPKi1b85fW6c= X-Google-Smtp-Source: ABdhPJxymPMSMsVhlIAj5Ciak9kOFIqoLkksDgND3qhOb2ScEzBn83mdGxCMXvRU32+KSGX0rgDmNw== X-Received: by 2002:a17:902:7009:b0:158:3bcf:b774 with SMTP id y9-20020a170902700900b001583bcfb774mr15946121plk.103.1650859167020; Sun, 24 Apr 2022 20:59:27 -0700 (PDT) Received: from google.com ([2620:15c:202:201:282a:d50e:e0fc:c145]) by smtp.gmail.com with ESMTPSA id c2-20020aa781c2000000b0050a7ff01d2bsm9431985pfn.30.2022.04.24.20.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 20:59:25 -0700 (PDT) Date: Sun, 24 Apr 2022 20:59:23 -0700 From: Dmitry Torokhov To: Samuel Holland Cc: Hans de Goede , Ondrej Jirman , Jernej Skrabec , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v5] Input: sun4i-lradc-keys - Add wakeup support Message-ID: References: <20220424161328.61103-1-samuel@sholland.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220424161328.61103-1-samuel@sholland.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_205928_765306_02C1FDD0 X-CRM114-Status: GOOD ( 28.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Apr 24, 2022 at 11:13:27AM -0500, Samuel Holland wrote: > From: Ondrej Jirman > > Allow the driver to wake the system on key press if the "wakeup-source" > property is provided in the device tree. Using the LRADC as a wakeup > source requires keeping the AVCC domain active during sleep. Since this > has a nontrivial impact on power consumption (sometimes doubling it), > disable the LRADC wakeup source by default. > > Signed-off-by: Ondrej Jirman > Acked-by: Jernej Skrabec > Signed-off-by: Samuel Holland > --- > > Changes in v5: > - Fix typo in commit subject > - Update Ondrej's e-mail address per his request > > Changes in v4: > - Only mark device as wakeup capable if setting the wakeirq succeeds > - An entirely different, but equivalent, DT binding patch was merged, > so there is only one patch left > > Changes in v3: > - Dropped unnecessary pr_err in platform_get_irq() error path > - Dropped patch 3 (DT update) as it was merged > - Added Acked-by/Reviewed-by tags > > Changes in v2: > - Add requisite DT binding change > - Only add wakeup capability if "wakeup-source" is present > - Warn but do not error out if setting the wake IRQ fails > - Add "wakeup-source" property to PinePhone device tree > > drivers/input/keyboard/sun4i-lradc-keys.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c > index 4a796bed48ac..781f9b053115 100644 > --- a/drivers/input/keyboard/sun4i-lradc-keys.c > +++ b/drivers/input/keyboard/sun4i-lradc-keys.c > @@ -22,6 +22,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > @@ -226,8 +228,7 @@ static int sun4i_lradc_probe(struct platform_device *pdev) > { > struct sun4i_lradc_data *lradc; > struct device *dev = &pdev->dev; > - int i; > - int error; > + int error, i, irq; > > lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); > if (!lradc) > @@ -272,8 +273,11 @@ static int sun4i_lradc_probe(struct platform_device *pdev) > if (IS_ERR(lradc->base)) > return PTR_ERR(lradc->base); > > - error = devm_request_irq(dev, platform_get_irq(pdev, 0), > - sun4i_lradc_irq, 0, > + irq = platform_get_irq(pdev, 0); > + if (irq < 0) > + return irq; > + > + error = devm_request_irq(dev, irq, sun4i_lradc_irq, 0, > "sun4i-a10-lradc-keys", lradc); > if (error) > return error; > @@ -282,6 +286,14 @@ static int sun4i_lradc_probe(struct platform_device *pdev) > if (error) > return error; > > + if (device_property_read_bool(dev, "wakeup-source")) { > + error = dev_pm_set_wake_irq(dev, irq); > + if (error) > + dev_warn(dev, "Failed to set wake IRQ\n"); I extended the warning message with irq number and error code and applied, thank you. -- Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel