Re: [PATCH v3 4/4] gpio: brcmstb: support wakeup from S5 cold boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 13, 2015 at 6:03 AM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> On Thu, Jun 18, 2015 at 3:00 AM, Gregory Fong <gregory.0xf0@xxxxxxxxx> wrote:
>
>> For wake from S5, we need to:
>> - register a reboot handler
>> - set wakeup capability before requesting IRQ so wakeup count is
>>   incremented
>> - mask all GPIO IRQs and clear any pending interrupts during driver
>>   probe to since no driver will yet be registered to handle any IRQs
>>   carried over from boot at that time, and it's possible that the
>>   booted kernel does not request the same IRQ anyway.
>>
>> This means that /sys/.../power/wakeup_count is valid at boot time, and
>> we can properly account for S5 wakeup stats. e.g.:
>>
>>   ### After waking from S5 from a GPIO key
>>   # cat /sys/bus/platform/drivers/brcmstb-gpio/f04172c0.gpio/power/wakeup
>>   enabled
>>   # cat /sys/bus/platform/drivers/brcmstb-gpio/f04172c0.gpio/power/wakeup_count
>>   1
>>
>> Signed-off-by: Gregory Fong <gregory.0xf0@xxxxxxxxx>
>
> (...)
>> -static int brcmstb_gpio_irq_set_wake(struct irq_data *d, unsigned int enable)
>> +static int __brcmstb_gpio_irq_set_wake(struct brcmstb_gpio_priv *priv,
>> +               unsigned int enable)
>>  {
>> -       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
>> -       struct brcmstb_gpio_priv *priv = brcmstb_gpio_gc_to_priv(gc);
>>         int ret = 0;
>
> I don't usually like to refactor code with __foo wrapper functions with
> underscores or double underscores in front of them.
>
> Is it possible to give this a more unique name?

Sure, just have to come up with a good one :-).

>
>> +               /*
>> +                * Mask all interrupts by default, since wakeup interrupts may
>> +                * be retained from S5 cold boot
>> +                */
>> +               bank->bgc.write_reg(reg_base + GIO_MASK(bank->id), 0);
>
> Aha I see, that's some clever code, nice.
>
> Yours,
> Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux