From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 E419ECA9EC2 for ; Mon, 28 Oct 2019 23:56:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B645F20880 for ; Mon, 28 Oct 2019 23:56:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=megous.com header.i=@megous.com header.b="YufQZxIn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728695AbfJ1X43 (ORCPT ); Mon, 28 Oct 2019 19:56:29 -0400 Received: from vps.xff.cz ([195.181.215.36]:51132 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726154AbfJ1X43 (ORCPT ); Mon, 28 Oct 2019 19:56:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572306987; bh=VBiEzOAOkY+HDeeyqrk83KEuJjLXMJSGG+CM5QrE39g=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=YufQZxInPttFYT6kzs3T5+jAucMqqOWMW/BQdx8nH+P1aKOpk54J+TJTZCy5axAgP aB3T2T6Et0qFkkNERhYiJSCfK6LYbfnyVbP8svit4mwtQiSAcK8UTI7BW639zK7Efp JL4dB+NkMq9L5KuxC0cywXAqiUAYULDboPx7Qz8M= Date: Tue, 29 Oct 2019 00:56:26 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Dmitry Torokhov Cc: linux-sunxi@googlegroups.com, Hans de Goede , Maxime Ripard , Chen-Yu Tsai , "open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" , open list Subject: Re: [PATCH] input: sun4i-lradc-keys: Add wakup support Message-ID: <20191028235626.5afvszxtppsieywi@core.my.home> Mail-Followup-To: Dmitry Torokhov , linux-sunxi@googlegroups.com, Hans de Goede , Maxime Ripard , Chen-Yu Tsai , "open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" , open list References: <20191028221502.3503543-1-megous@megous.com> <20191028233828.GA57214@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191028233828.GA57214@dtor-ws> X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Dmitry, On Mon, Oct 28, 2019 at 04:38:28PM -0700, Dmitry Torokhov wrote: > Hi Ondrej, > > On Mon, Oct 28, 2019 at 11:15:02PM +0100, Ondrej Jirman wrote: > > 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); > > I do not think we want to do this unconditionally. Can we maybe key off > "wakeup-source" device property. Sure thing. > > + > > + error = dev_pm_set_wake_irq(dev, irq); > > + if (error) { > > + dev_err(dev, "Could not set wake IRQ\n"); > > + return error; > > + } > > + > > I wonder if we could teach platform driver core to handle this for us. Not sure, some drivers do enable/disable wake_irq by hand in suspend/resume callbacks, so it would probably need to be opt-in somehow. I guess calling the function like this is one way to make it opt-in. The other way may be by passing a flag somewhere, like to request_threaded_irq. Did you have something more concrete in mind? regards, o. > Thanks. > > -- > Dmitry From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 CC782CA9EC0 for ; Mon, 28 Oct 2019 23:56:41 +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 9D0EE20880 for ; Mon, 28 Oct 2019 23:56:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cHXYH/Cq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="YufQZxIn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D0EE20880 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+infradead-linux-arm-kernel=archiver.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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C3yCtcThKH4AHs2NrYJsk+G4SNvWZeF/EVnnT5/g+Yk=; b=cHXYH/CqCZaMSk sJ+zRU5YDkDs60oAu85XeZPdZ9p86nsvTTM/4XHJ4cA6P+SJnTvPhP4F2bI4IQZ9bcerSNvSm9CHl Nxxdnhj2Su8OKWgUB5p+GEDZ+PpHnRr8pn1qhVQW83rRhs676HsVVADssIJA1b9Gyx1Me0FfZrg7O T68Zz0BSInW2vYWjs6IYRNXhxenF0E/PVdnw2ED/FQlPBWZehYL3ZtR2wPX4vLcsB+mcJTj+RHe0l 1Bt7qfkqSz2cIhxf3yluI747TnjVQ1+3cdzWuAIc8q4mWVcvqeelBD88wTMLIg+tWogsrKGUd+VQ6 nUIBed1pbrFruW/UWRwA==; 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 1iPEsC-0004hL-SS; Mon, 28 Oct 2019 23:56:32 +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 1iPEs9-0004gp-C7 for linux-arm-kernel@lists.infradead.org; Mon, 28 Oct 2019 23:56:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572306987; bh=VBiEzOAOkY+HDeeyqrk83KEuJjLXMJSGG+CM5QrE39g=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=YufQZxInPttFYT6kzs3T5+jAucMqqOWMW/BQdx8nH+P1aKOpk54J+TJTZCy5axAgP aB3T2T6Et0qFkkNERhYiJSCfK6LYbfnyVbP8svit4mwtQiSAcK8UTI7BW639zK7Efp JL4dB+NkMq9L5KuxC0cywXAqiUAYULDboPx7Qz8M= Date: Tue, 29 Oct 2019 00:56:26 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Dmitry Torokhov Subject: Re: [PATCH] input: sun4i-lradc-keys: Add wakup support Message-ID: <20191028235626.5afvszxtppsieywi@core.my.home> Mail-Followup-To: Dmitry Torokhov , linux-sunxi@googlegroups.com, Hans de Goede , Maxime Ripard , Chen-Yu Tsai , "open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" , open list References: <20191028221502.3503543-1-megous@megous.com> <20191028233828.GA57214@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191028233828.GA57214@dtor-ws> X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191028_165629_731902_F857C130 X-CRM114-Status: GOOD ( 19.54 ) 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: Chen-Yu Tsai , Maxime Ripard , open list , Hans de Goede , linux-sunxi@googlegroups.com, "open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Dmitry, On Mon, Oct 28, 2019 at 04:38:28PM -0700, Dmitry Torokhov wrote: > Hi Ondrej, > > On Mon, Oct 28, 2019 at 11:15:02PM +0100, Ondrej Jirman wrote: > > 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); > > I do not think we want to do this unconditionally. Can we maybe key off > "wakeup-source" device property. Sure thing. > > + > > + error = dev_pm_set_wake_irq(dev, irq); > > + if (error) { > > + dev_err(dev, "Could not set wake IRQ\n"); > > + return error; > > + } > > + > > I wonder if we could teach platform driver core to handle this for us. Not sure, some drivers do enable/disable wake_irq by hand in suspend/resume callbacks, so it would probably need to be opt-in somehow. I guess calling the function like this is one way to make it opt-in. The other way may be by passing a flag somewhere, like to request_threaded_irq. Did you have something more concrete in mind? regards, o. > Thanks. > > -- > Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel