From patchwork Fri Apr 30 04:20:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 429974 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, 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 78362C43603 for ; Fri, 30 Apr 2021 04:20:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61EDD61449 for ; Fri, 30 Apr 2021 04:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbhD3EVZ (ORCPT ); Fri, 30 Apr 2021 00:21:25 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:34699 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbhD3EVW (ORCPT ); Fri, 30 Apr 2021 00:21:22 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id D2823580991; Fri, 30 Apr 2021 00:20:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 30 Apr 2021 00:20:06 -0400 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=fm2; bh=ixJR37E3oo8sQ iV9OOsAEkbJU5R3uGTBiHNDIg4hTj4=; b=OZ3GbLuVHYHFZUp9cSvbFChyafdNS Y3Lzc2JXLozfV9ebsvxnh4IRT/9m6EL08qmJYLXSgtDb8ga0SpcX2qsZen7IKA+m HBMpU3gpbDDW7m6um+V7xRFvFNk9a2FaI7iiNbFW4NbyShGzqFxdKASBE88hxi7N G+5ul8Cewi1k2/i0Fy0y4GBHyH32OZy4rYvgPFYBf9ssHQbAiTE0xJDANh91iArS fNmsG6S/7YDowsNsAkgy0k0sPr4FcLmFCk3y6u/6YZm8sgvlypYDDIuRvo/uFYsC xMCR6Ak0WFQ3FZNw/UAT7ivNQNfoRNTYNB2yDffG8fHU6hKDpXBBtt/yw== 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= fm2; bh=ixJR37E3oo8sQiV9OOsAEkbJU5R3uGTBiHNDIg4hTj4=; b=lnyyeyBK fn/EriU24sC/PrnvrMdpo0PSRvJzwg+lGtdiv6pnO3zTfg0PbKYctruR8xCVRvEb QvzrvHf6m5f6CqqiRlXUsVcJaBWXGqlOwfRjTLI+7l4xWAH7Z4y818L157QikO6t zN3Ax9L4ynozpDMG8V26ofy4DwRqhJSEn2vIAdk3qKmMZU3lHkMdPnMyCMyuqBnq bpe0L2eTnQSHbaAfg9deOfFrrD7rIykrjlxepdh8gIubRuEK8L/FK6evAAsiAJ+3 2QY/Y7/z1XvLv0JLwsenQgawsA2ADjAr8h32YBlbxEih9IOgOLpSws0I3QWu+M8/ 7O67/GE+ralYVQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddvhedgkeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh 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; Fri, 30 Apr 2021 00:20:05 -0400 (EDT) From: Samuel Holland To: Dmitry Torokhov Cc: Hans de Goede , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Samuel Holland , Rob Herring Subject: [PATCH v3 1/2] dt-bindings: sun4i-a10-lradc-keys: Accept wakeup-source property Date: Thu, 29 Apr 2021 23:20:02 -0500 Message-Id: <20210430042003.4591-2-samuel@sholland.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210430042003.4591-1-samuel@sholland.org> References: <20210430042003.4591-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. Acked-by: Rob Herring Acked-by: Maxime Ripard Reviewed-by: Hans de Goede Signed-off-by: Samuel Holland --- .../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 Fri Apr 30 04:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 430311 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.7 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 8B8E2C43461 for ; Fri, 30 Apr 2021 04:20:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B8E361449 for ; Fri, 30 Apr 2021 04:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbhD3EVY (ORCPT ); Fri, 30 Apr 2021 00:21:24 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:57571 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbhD3EVW (ORCPT ); Fri, 30 Apr 2021 00:21:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id BDB58580993; Fri, 30 Apr 2021 00:20:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 30 Apr 2021 00:20:08 -0400 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=fm2; bh=twhTTkXFTaNa0 JKFc4hyiam+oxDA9ilOzTNkxYn0QVU=; b=AemblQgBcosekkAPjsBiAJYZ2qsA4 Ls41ugrHWHudRTImhc1D4HO5BZcyCGXWC8A413LCs/AhrSnzZVgq1CmtwcN4beP9 UJg2TnfrjtKMsAEAkFmCz6XcJSDGiHh6vKNrdnofZMxTltERL4C5lB/INGV15L00 Bs2WZDzC8m7YdQWa+M8mczBxOAk6W3kOV7/OO6pLinIECmea23UG6LlNullSO6fu 6aiH68BJJwI04B1Qfs/YdMPYfXrcNoeYAUy9CsWDCQFEiyDr//BbSwGsc7tOjSuo s6IqiNiCeu/nbS8oAvt7Twqlm8uWpAHbkDp+Z0CGDn8r2V6hQ4rUEyNMw== 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= fm2; bh=twhTTkXFTaNa0JKFc4hyiam+oxDA9ilOzTNkxYn0QVU=; b=CRlHtxq9 VwytTOKr1W++ddkmojnjbEDmHxViZ6V+gpEndeD//KP6Kfo9fRuzrBVD0Th17M5J WAdoI85tl0186vUTntkqoXTbZGwvZ4ZbgBfC5HN5wKHiI4/oS32rC+U/k+Ei6teS YBfvG26T5GmFp7fX5k+g2sNubzW+iBU4IlmCQdBMdeaeyZeOhNC8py6l6pKYJGWy YkiOAT8rEZQIT9yPiOUy/LEddpmOI4MgCPNo5W4v/0FNK+9iKaGBMWD4M9ycKzn8 2WVsMn3uWS+dnJD29DlcuixR0IZkZ+vnF8yOInaP5WXrxqSK12ALOgrjuvR0xqMA eJTRbJE4I5POLQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddvhedgkeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh 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; Fri, 30 Apr 2021 00:20:06 -0400 (EDT) From: Samuel Holland To: Dmitry Torokhov Cc: Hans de Goede , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Samuel Holland , Ondrej Jirman Subject: [PATCH v3 2/2] input: sun4i-lradc-keys - Add wakup support Date: Thu, 29 Apr 2021 23:20:03 -0500 Message-Id: <20210430042003.4591-3-samuel@sholland.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210430042003.4591-1-samuel@sholland.org> References: <20210430042003.4591-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. Acked-by: Maxime Ripard Reviewed-by: Hans de Goede Signed-off-by: Ondrej Jirman Signed-off-by: Samuel Holland --- 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..af1683d68c8c 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")) { + 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; }