[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130729180441.GF4964@radagast>
Date: Mon, 29 Jul 2013 21:04:41 +0300
From: Felipe Balbi <balbi@...com>
To: Illia Smyrnov <illia.smyrnov@...com>
CC: Dmitry Torokhov <dmitry.torokhov@...il.com>,
<linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-omap@...r.kernel.org>, Felipe Balbi <balbi@...com>
Subject: Re: [PATCH v3 1/3] Input: omap-keypad: Enable wakeup capability for
keypad.
Hi,
On Mon, Jul 29, 2013 at 07:45:09PM +0300, Illia Smyrnov wrote:
> Enable/disable IRQ wake in suspend/resume handlers
> to make the keypad wakeup capable.
>
> Signed-off-by: Illia Smyrnov <illia.smyrnov@...com>
> ---
> drivers/input/keyboard/omap4-keypad.c | 43 +++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index 0244262..feab00f 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -74,6 +74,7 @@ struct omap4_keypad {
> struct input_dev *input;
>
> void __iomem *base;
> + bool irq_wake_enabled;
this flag is a bit weird... but I can't find a better way to handle this
situation. In one way, you shouldn't prevent system suspend, so you can
error out in case enable_irq_wake() fails, otoh if enable_irq_wake()
fails and you return 0, on resume disable_irq_wake() will throw
unbalanced calls warning. Maybe someone else has a better idea.
> @@ -439,12 +444,50 @@ static const struct of_device_id omap_keypad_dt_match[] = {
> MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
> #endif
>
> +#ifdef CONFIG_PM_SLEEP
> +static int omap4_keypad_suspend(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
you don't need to access the platform_device...
> + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
... since this can become:
struct omap4_keypad *keypad_data = dev_get_drvdata(dev);
> + int error;
> +
> + if (device_may_wakeup(&pdev->dev)) {
> + error = enable_irq_wake(keypad_data->irq);
> + if (!error)
> + keypad_data->irq_wake_enabled = true;
> + }
> +
> + return 0;
> +}
> +
> +static int omap4_keypad_resume(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
ditto, use dev_get_drvdata() instead.
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists