Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp10769pxy; Thu, 29 Apr 2021 21:23:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFD9GNBfJEeTJ1yWuYwZHcnu2ZV4QtFIuL93HGk3zspj6vLB+jpzWW/StVkkkNc7OaLRUr X-Received: by 2002:a17:906:77c5:: with SMTP id m5mr1885327ejn.201.1619756611615; Thu, 29 Apr 2021 21:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619756611; cv=none; d=google.com; s=arc-20160816; b=w7HqoMhhm2feXCjQFKLYApyVeSARswiGkA6FsjUZ4iNdeHN/DSeqxUimlUpCtBDwYS nEtisShCzmj80kRErcoE19a5s4FbVVub1+sdqWBjyfKO2R8Z+xG87aO0KejSjTOir+a4 nUNKyPVKjaeVIK90vEkTK4JQMEpLcLe203Id7dQIQuveqKiFkz0jSSLf0ZNUYLMycR1r ptFeOXKRoXq+Is71/MRf4dudLstvXmElXalDq0b3aikWxXPA4WpSaDF6811jrBQIBszV xpmh5udF3NAMwVzVhbpxrGhSZvj1pE0H8kZsKFcBbRVg5bzlaxW0GZwTtiT7pihHbEdx RDJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=twhTTkXFTaNa0JKFc4hyiam+oxDA9ilOzTNkxYn0QVU=; b=fhegb6Hucrjq0WkuGao7qggJsZp+XEzIDPT5o2PHhjzI2Hbp/15NZvngpdwUiK8+Wu SyUKFIiBXxKf5eNsn3HgVxsuN6LhcdGLEocwmEZ5jzg0VQdSAK1jX7/vqV5qZVxYzKlB riGpNwIzvpxEaorGhIv8JcRwf7UWk0Z62zBiLZyRFAW4yGD+NNsdxuigqLq5me0426Kc WL9eODIVzTQ3Ut47P1Pdz3FILkVDVcOBt6yEHwGFzeZ3TwDZ8PUbk5NWu3A/RCwYg8Hu e8FrniL59Uy0XRnupOVE+ektLXt4sk62MDgvYWoz6aO8RaS5agaZrbFZeQQNCfIP1Wx0 PQSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm2 header.b=AemblQgB; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=CRlHtxq9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si546159edc.411.2021.04.29.21.23.08; Thu, 29 Apr 2021 21:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm2 header.b=AemblQgB; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=CRlHtxq9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbhD3EVe (ORCPT + 99 others); Fri, 30 Apr 2021 00:21:34 -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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; } -- 2.26.3