From patchwork Wed Jan 13 04:05:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 363112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C03A7C433E0 for ; Wed, 13 Jan 2021 04:06:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66DB52312E for ; Wed, 13 Jan 2021 04:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbhAMEGc (ORCPT ); Tue, 12 Jan 2021 23:06:32 -0500 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:44217 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725984AbhAMEGc (ORCPT ); Tue, 12 Jan 2021 23:06:32 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 4F62219E4; Tue, 12 Jan 2021 23:05:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 12 Jan 2021 23:05:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=8xZa4eWx/5sRP OcRJ0U+DRorzREZeUYM6W9yKzDfhJA=; b=nSZutnc2knCRrqObMb91gEV0hS3xW MDb+5vj8UJbYZw/hzJ+q1gg/K+A73Ka3gDBW3Wa+LsgT6/fXX/r74sh4d+wquvjg +0lyZRFqiEIocvmThdrBQ7b2Zu0Im56B/ZhQZvby4xKBgkuIO3FdehnWlC/hZoRH BxkDaOQfr2fX4nuVsKndkryheup3lQaSpT71v6Qkif8grCSpDxNSsWZmTrsTr3mK TlwGAD4V1E6tJkvrjmq5xgHX1v2SxzYOlya9c2jmcjirwJ3fLeFt8PYXjWeJcuoP OSggpxbIikGQAiSUAvNud4INMwlBeqNwoMnjBteFbJZyrGCEk74xshDkQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=8xZa4eWx/5sRPOcRJ0U+DRorzREZeUYM6W9yKzDfhJA=; b=cIWdSwGW LrAuy0t8bQdBhGJ/g/ZYTqQTyapBsu6VkmIEvSWKynTMkofovV4JIZl0Ntcb1GbN +nWku/rSpx2Y1lJ46WVx/zrxoZpk1VBlHi9J6+TyjzKWtGI7p7pJLsILFy4oKtPc wEQOzrgjufB8UXnEYU/tYOJUE4FFJGd0+uMn5WrQin+pdrKyX7XMKa6GxREL5QMK S1/fn2AiFdI2rIA0PMmkixchhE3anXYHkxibRMDn6WGZqeE4iMmhBJCsJI8BNRB0 mDnoG8cplgtldrVv4nzUNNW+yJ9U+T3uU8oCphsL2KqTSA+GK++K9YqPNY++LFk7 yi+czzU1omWIuQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedukedrtddugdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheejvdfg jeehueeinecukfhppeejtddrudefhedrudegkedrudehudenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgrnhgu rdhorhhg X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 2642424005E; Tue, 12 Jan 2021 23:05:44 -0500 (EST) From: Samuel Holland To: Hans de Goede , Dmitry Torokhov , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Samuel Holland Subject: [PATCH v2 1/3] dt-bindings: sun4i-a10-lradc-keys: Accept wakeup-source property Date: Tue, 12 Jan 2021 22:05:40 -0600 Message-Id: <20210113040542.34247-2-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210113040542.34247-1-samuel@sholland.org> References: <20210113040542.34247-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The LRADC provides an interrupt that can be used to wake the system. Signify this by accepting a "wakeup-source" property in the binding. Signed-off-by: Samuel Holland Acked-by: Rob Herring --- .../bindings/input/allwinner,sun4i-a10-lradc-keys.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml b/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml index cffd02028d02..d74f2002409e 100644 --- a/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml +++ b/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml @@ -29,6 +29,8 @@ properties: description: Regulator for the LRADC reference voltage + wakeup-source: true + patternProperties: "^button-[0-9]+$": type: object From patchwork Wed Jan 13 04:05:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 362347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E71C5C433DB for ; Wed, 13 Jan 2021 04:07:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACABE2312E for ; Wed, 13 Jan 2021 04:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbhAMEGy (ORCPT ); Tue, 12 Jan 2021 23:06:54 -0500 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:50987 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726682AbhAMEGw (ORCPT ); Tue, 12 Jan 2021 23:06:52 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id E790719F2; Tue, 12 Jan 2021 23:05:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 12 Jan 2021 23:05:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=L/yNuOxj28hiX +c/tqAQ/Im+opvb6Nb/8TsVGhyxOMw=; b=D0NyJ/OcaJDR4QbYQlR2Cnrz6IOUX yCx2x4x1zXZM2TCMIgsIRE7Yeefvu+PIO2+QqKtZZpU8pwz4Ph/KrqX/Ff3BoIQQ YtrfEII/NBfEoThf3NUPsuWfHYDDORmxQaMCl6C9XhNX9LrSHaZ3mxDZ+IwW8KO8 bsjq5V3mlhfxsluoDRW+4jCvxNr1AS0lrZTead/r3tLRa+lvqz1LzlYFP6o1UbX7 jNhxGJE4bCfgXsZKc6mYF2zNkd9cKhthbLJe/1Dy3nziovvF9ZNJO2rS8mX4jC2d Z2yVzII7wC6ZEWXw9p32NWxvw6WR5W9r/ui3CqNh1VFa3WgiWmua6g4xQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=L/yNuOxj28hiX+c/tqAQ/Im+opvb6Nb/8TsVGhyxOMw=; b=d3klVUa9 XMuyK0GBxz/Ydg8zyowYyUKCjouwHVpPsUfnF9G6V/W7hDJPsaWIup6BwGbDabku JHkAS01fN93JUJj79oycIhnT2KnxB3wOB15Y3vEJHDgPlzT8hpGZZuio9wSjgF9J hzKqG1XKruHVOU0mWLVKYbjnWI3/LxKvbbeAf16zTUB6gsjpCwe2to+iFtZEFUnI WaCACsRRdGJZfo4y3MuAXCFyyiZlEZogqZfugqsIUgZcdWlBmo5Uvz+uUthwHHwB +YZUu1e1U5sCRkWaFOhDnYHaE0koHNNapEl29L5KP9R0PiKJzxeBLIeUN5AD4i4F 6NS8NHNM17+yBw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedukedrtddugdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheejvdfg jeehueeinecukfhppeejtddrudefhedrudegkedrudehudenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgrnhgu rdhorhhg X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 941EC240064; Tue, 12 Jan 2021 23:05:44 -0500 (EST) From: Samuel Holland To: Hans de Goede , Dmitry Torokhov , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Samuel Holland , Ondrej Jirman Subject: [PATCH v2 2/3] input: sun4i-lradc-keys - Add wakup support Date: Tue, 12 Jan 2021 22:05:41 -0600 Message-Id: <20210113040542.34247-3-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210113040542.34247-1-samuel@sholland.org> References: <20210113040542.34247-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Signed-off-by: Samuel Holland --- drivers/input/keyboard/sun4i-lradc-keys.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c index 4a796bed48ac..a1eb2001c088 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,13 @@ 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) { + dev_err(&pdev->dev, "Failed to get IRQ\n"); + return irq; + } + + error = devm_request_irq(dev, irq, sun4i_lradc_irq, 0, "sun4i-a10-lradc-keys", lradc); if (error) return error; @@ -282,6 +288,14 @@ static int sun4i_lradc_probe(struct platform_device *pdev) if (error) return error; + if (device_property_read_bool(dev, "wakeup-source")) { + device_set_wakeup_capable(dev, true); + + error = dev_pm_set_wake_irq(dev, irq); + if (error) + dev_warn(dev, "Failed to set wake IRQ\n"); + } + return 0; } From patchwork Wed Jan 13 04:05:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 362348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE0B9C43381 for ; Wed, 13 Jan 2021 04:06:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A0842311B for ; Wed, 13 Jan 2021 04:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726386AbhAMEGe (ORCPT ); Tue, 12 Jan 2021 23:06:34 -0500 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:52943 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbhAMEGc (ORCPT ); Tue, 12 Jan 2021 23:06:32 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 18EB919F7; Tue, 12 Jan 2021 23:05:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 12 Jan 2021 23:05:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=WaS8/78gDwrUX gmgRZUlIKgc3Lq9AqgE9iKAVPo1S9o=; b=lqGyIJVbl43S9Pjl8Y9VUTa6/RdSK 8t4EYFwiEoSuYOdrc4vOFXSH8onIrj9M0GNdli4oen8ByANid8tRRbO8PEAA1R+e f4YbE2hTUidNuuzxUiPMJnpWJxm0SyfxOGDlruAgZSBbUyPXUnlp33xEbBqXwDoq bwlnMOApElzAyOWBTXKeBcNQSosaQRCOwqYW2Y81LSC/f/ecUMlEeKP4QR9NgZyD qdK9E5jHVP4kFMBavDBaBIomnTzaZJu45LCz+vrpsl+UBQGqvIpQQ6iI7CC7qDGI SoqCxuaMAOlRXQ2IlpWbZPBkIvexamPvIidsQn3hbxIplA+MFi22bTPuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=WaS8/78gDwrUXgmgRZUlIKgc3Lq9AqgE9iKAVPo1S9o=; b=SgBm+OOn wQFbVLzBHL4NPEdfZq/RtaHCO6NLyKr/JmdVAWwm59dI8wjROR40J6EkRTbmKOmy UrCMLLPgMCgvKuYNEm9oc6ujXipf2xRGjMtmIjy8+RbXePLlxH+fQbCdqoHJk+/G fp5aN3OtftGZXOwMfQcZ9VuRMk+C71pyd30BQre/Ng28gonHRqxk769Rc52DXiSC XBZK20X5ET1+fySmaWrZS3CRGT2wRRducb6ribHT3ZhqVDbmv+mAcnmC4LcmyLcU b44Z4Zk1p34QXRB3GG/APrnc5aKgKCcFCnRCmKRgc15dTHBioKq7sWdECiV6OJvf R+P9pIwZF1vC3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedukedrtddugdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheejvdfg jeehueeinecukfhppeejtddrudefhedrudegkedrudehudenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgrnhgu rdhorhhg X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 16EF024005D; Tue, 12 Jan 2021 23:05:45 -0500 (EST) From: Samuel Holland To: Hans de Goede , Dmitry Torokhov , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Samuel Holland Subject: [PATCH v2 3/3] arm64: dts: allwinner: pinephone: Support volume key wakeup Date: Tue, 12 Jan 2021 22:05:42 -0600 Message-Id: <20210113040542.34247-4-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210113040542.34247-1-samuel@sholland.org> References: <20210113040542.34247-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org PinePhone volume keys are connected to the LRADC in the A64. Users may want to use them to wake the device from sleep. Support this by declaring the LRADC as a wakeup source. Signed-off-by: Samuel Holland --- arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi index 2dfe9bae8c67..7f37f9fea0ab 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi @@ -196,6 +196,7 @@ &i2c2 { &lradc { vref-supply = <®_aldo3>; + wakeup-source; status = "okay"; button-200 {