Re: [PATCH v2 1/2] pinctrl: rockchip: Handle wakeup pins

From: Linus Walleij
Date: Fri Nov 28 2014 - 03:06:03 EST


On Wed, Nov 19, 2014 at 11:51 PM, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:

> The rockchip pinctrl driver was using irq_gc_set_wake() as its
> implementation of irq_set_wake() but was totally ignoring everything
> that irq_gc_set_wake() did (which is to upkeep gc->wake_active).
>
> Let's fix that by setting gc->wake_active as GPIO_INTEN at suspend
> time and restoring GPIO_INTEN at resume time.
>
> NOTE a few quirks when thinking about this patch:
> - Rockchip pinctrl hardware supports both "disable/enable" and
> "mask/unmask". Right now we only use "disable/enable" and present
> those to Linux as "mask/unmask". This should be OK because
> enable/disable is optional and Linux will implement it in terms of
> mask/unmask. At the moment we always tell hardware all interrupts
> are unmasked (the boot default).
> - At suspend time Linux tries to call "disable" on all interrupts and
> also enables wakeup on all wakeup interrupts. One would think that
> since "disable" is implemented as "mask" when "disable" isn't
> provided and that since we were ignoring gc->wake_active that
> nothing would have woken us up. That's not the case since Linux
> "optimizes" things and just leaves interrutps unmasked, assuming it
> could mask them later when they go off. That meant that at suspend
> time all interrupts were actually being left enabled.
>
> With this patch random non-wakeup interrupts no longer wake the system
> up. Wakeup interrupts still wake the system up.
>
> Signed-off-by: Doug Anderson <dianders@xxxxxxxxxxxx>
> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> Reviewed-by: Heiko Stuebner <heiko@xxxxxxxxx>
> ---
> Changes in v2: None

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/