[PATCH] rtc: Set wakeup capability for I2C and SPI RTC drivers

Anton Vorontsov avorontsov at ru.mvista.com
Fri Aug 28 10:30:10 EST 2009

On Fri, Aug 28, 2009 at 03:19:25AM +0400, Anton Vorontsov wrote:
> > That is why platform code should device_init_wakeup() and
> > drivers should check device_can_wakeup(dev) ...
> They should (and do) check may_wakeup() (i.e. should_wakeup) before
> suspending, not can_wakeup().
> static int ds1374_suspend(struct i2c_client *client, pm_message_t state)
> {
>         if (client->irq >= 0 && device_may_wakeup(&client->dev))
>                 enable_irq_wake(client->irq);
>         return 0;
> }
> (quite funny, they issue enable_irq_wake(), assuming that otherwise
> IRQ line won't trigger CPU wakeup. But in reality, there are interrupt
> controllers that you can't control in that regard: any IRQ activity
> will always resume CPU. And so 'echo disable > /sys/.../wakeup' won't
> guarantee anything. Unreliable, nasty? Could be.)

BTW, of course we can fix this by masking interrupts before
suspending, but nobody actually do this (but should, I think).

And if RTC's IRQ is wired to power switch you're in trouble
without any way to fix this.

Anton Vorontsov
email: cbouatmailru at gmail.com

More information about the Linuxppc-dev mailing list