From patchwork Mon Oct 28 22:15:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11216729 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1DA6913 for ; Mon, 28 Oct 2019 22:15:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CE67921479 for ; Mon, 28 Oct 2019 22:15:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SgbTcd/c"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="VjETtQHR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE67921479 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fNssk1RsMeEukCawxfqFW+GvVHLlICPaVTOLCzWJq74=; b=SgbTcd/c1ZVz4S NrtYXgOpvvZufu1KyK11+6+SgPSQnTj2T71toqyQO/x3g8cZfyUPgzVTs2PLfRGfNFDP8UfMz24Kx VGm3R4DEyOVcaLrkMgKB3PheV81avIowroO3Qe+2QH3UNHQ9iDf6x55BeVBgRHusCCttJIwxoB5KZ Zb+lxq3mKn8L0cX2+UJrrbeFuLqvaT4UEOdcvP3pSzZ3NDZbAcRTIdxTeX9k0pNS1GUtHwy5uLOB8 Az337lKRY6BRWerPuFWEJbprDF0ZlMEq8J+y79GHyhwrXWUpRyg/3mmXk3EOzIMk7vHLziRoyOT7G SNCSvAIIfnj7WOkqcF9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPDIC-0002ls-Qp; Mon, 28 Oct 2019 22:15:16 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPDI9-0002km-Fv for linux-arm-kernel@lists.infradead.org; Mon, 28 Oct 2019 22:15:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572300911; bh=6cUEPE++PT7bm/+2yXk5OlWnhW9Q2aMhm/b2mJdGUmE=; h=From:To:Cc:Subject:Date:From; b=VjETtQHRQrDTpLtKSrqvJ6yAOr4p44MmViCQBsyKn+J6ifWreBrDcRG72ZYUDn4tS dXzFMwjF+L5F9rBI663kGszmMqFihPdqROZ+SORr+Dx15R+FoQuH71qi4QuJ/b8/MV 0w0J6ISfYXj1nL0btEHSfszfXWFKVg1kht3duTv4= From: Ondrej Jirman To: linux-sunxi@googlegroups.com Subject: [PATCH] input: sun4i-lradc-keys: Add wakup support Date: Mon, 28 Oct 2019 23:15:02 +0100 Message-Id: <20191028221502.3503543-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191028_151513_863387_F8471454 X-CRM114-Status: GOOD ( 10.19 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , Dmitry Torokhov , open list , Maxime Ripard , Hans de Goede , Chen-Yu Tsai , "open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Allow the driver to wakeup the system on key press. Signed-off-by: Ondrej Jirman --- 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..bba679d7b54b 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 i, error, 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; + device_init_wakeup(dev, true); + + error = dev_pm_set_wake_irq(dev, irq); + if (error) { + dev_err(dev, "Could not set wake IRQ\n"); + return error; + } + return 0; }