• Uwe Kleine-König's avatar
    rtc: s35390a: improve irq handling · 3bd32722
    Uwe Kleine-König authored
    On some QNAP NAS devices the rtc can wake the machine. Several people
    noticed that once the machine was woken this way it fails to shut down.
    That's because the driver fails to acknowledge the interrupt and so it
    keeps active and restarts the machine immediatly after shutdown. See
    https://bugs.debian.org/794266 for a bug report.
    
    Doing this correctly requires to interpret the INT2 flag of the first read
    of the STATUS1 register because this bit is cleared by read.
    
    Note this is not maximally robust though because a pending irq isn't
    detected when the STATUS1 register was already read (and so INT2 is not
    set) but the irq was not disabled. But that is a hardware imposed problem
    that cannot easily be fixed by software.
    Signed-off-by: default avatarUwe Kleine-König <uwe@kleine-koenig.org>
    Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
    3bd32722
rtc-s35390a.c 12.5 KB