• Anton Vorontsov's avatar
    rtc: set wakeup capability for I2C and SPI RTC drivers · 26b3c01f
    Anton Vorontsov authored
    RTC core won't allow wakeup alarms to be set if RTC devices' parent (i.e.
    i2c_client or spi_device) isn't wakeup capable.
    
    For I2C devices there is I2C_CLIENT_WAKE flag exists that we can pass via
    board info, and if set, I2C core will initialize wakeup capability.  For
    SPI devices there is no such flag at all.
    
    I believe that it's not platform code responsibility to allow or disallow
    wakeups, instead, drivers themselves should set the capability if a device
    can trigger wakeups.
    
    That's what drivers/base/power/sysfs.c says:
    
     * It is the responsibility of device drivers to enable (or disable)
     * wakeup signaling as part of changing device power states, respecting
     * the policy choices provided through the driver model.
    
    I2C and SPI RTC devices send wakeup events via interrupt lines, so we
    should set the wakeup capability if IRQ is routed.
    
    Ideally we should also check irq for wakeup capability before setting
    device's capability, i.e.
    
    	if (can_irq_wake...
    26b3c01f
rtc-ds1374.c 10.9 KB