Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3656656ybg; Mon, 28 Oct 2019 16:43:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwz/lypVYwmBT3RLlss5HorhL9pDHs0vjF4ojl5kJKf0jScvOUKZBinrPn6BWt/4y5kHGEw X-Received: by 2002:a17:906:4d45:: with SMTP id b5mr453148ejv.157.1572306194974; Mon, 28 Oct 2019 16:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572306194; cv=none; d=google.com; s=arc-20160816; b=xBb9sMM+67rcV/yga3XxaOze6cAzgj/kuzI26jVAiFvW6DMtu+S5KJAEnvGrJITqxk 71x+APHvGTTNLLSpcpJy98VZvaE4Dfh/X45vejscbI2FhHJUtUEpEDHdlxm/cKRd3C8e 3rbJOGauC3bXBGR9eg4w6P3dGJ1LDIfLrj6pdK5P1iAuFyTCuSGIwc2TedDkb36ZhI0u v+LQcarkWktEoe08YcYa6LpDf/IvVZ3pkb3rIjGXhNKVcHAEU1bpIKm71HV1hx3AvNax TlDVwAOAIAvMh2JU08Y8QOXdLxgCSy44n7HuLvATVYBgminIU+5Y99ooQFC+NiM+1EEm iv7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nRlpVolqDqeo0tcWOyfHvRwXIc9INrHUuY8ulWLxsZU=; b=W7jtu0tUkC+c7RcLMLR3tm+x9Un/OAhI/jGr1eXuN3DL3qR+iTLv0a0ayZ+tbXQCV9 N5zJJIlwpsO/VMmfO8bPNKkh2c9OBcIx146xqtlrGgBRk4SfRUCqWum6Ld1sxn7Ku6Tu 64CK+c4Ui0f/MuEyWHpUqWIgenGdKT8iLKPDkY5xm/VVEX4sC+1rHm57w8O1WiSFzsX4 AZgOnxEFmGGs6vXvltcAz7KOPXxOLBu5Aj/VFP7fDe8zXmp1Nugz36C3vjjeGat8kSEC YxJwG3A+j5wOpVuG7K+zkkNMdNJCYnw66MH+XecqdloaWkAJD/2KMUXQGOLerUrPJkiC aSRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=VjETtQHR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si8248059edc.97.2019.10.28.16.42.51; Mon, 28 Oct 2019 16:43:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=VjETtQHR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727282AbfJ1WPO (ORCPT + 99 others); Mon, 28 Oct 2019 18:15:14 -0400 Received: from vps.xff.cz ([195.181.215.36]:50408 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfJ1WPN (ORCPT ); Mon, 28 Oct 2019 18:15:13 -0400 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 Cc: Ondrej Jirman , Hans de Goede , Dmitry Torokhov , Maxime Ripard , Chen-Yu Tsai , linux-input@vger.kernel.org (open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; } -- 2.23.0