]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: pcf2127: handle timestamp interrupts
authorMian Yousaf Kaukab <ykaukab@suse.de>
Tue, 29 Jun 2021 15:06:43 +0000 (17:06 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 10 Jul 2021 00:58:31 +0000 (02:58 +0200)
commit33dfc636cb5f9d18d0d3451a1d0146d10f30f89f
treec832f56ee347eb057be9f040d67bde40b2047aaa
parentcacc8068b9e09189b8b43de2c38509ae9454ccae
rtc: pcf2127: handle timestamp interrupts

commit 9e5ed8c715d5 ("rtc: pcf2127: add tamper detection support")
added support for timestamp interrupts. However they are not being
handled in the irq handler. If a timestamp interrupt occurs it
results in kernel disabling the interrupt and displaying the call
trace:

[  121.145580] irq 78: nobody cared (try booting with the "irqpoll" option)
...
[  121.238087] [<00000000c4d69393>] irq_default_primary_handler threaded [<000000000a90d25b>] pcf2127_rtc_irq [rtc_pcf2127]
[  121.248971] Disabling IRQ #78

Handle timestamp interrupts in pcf2127_rtc_irq(). Save time stamp
before clearing TSF1 and TSF2 flags so that it can't be overwritten.
Set a flag to mark if the timestamp is valid and only report to sysfs
if the flag is set. To mimic the hardware behavior, don’t save
another timestamp until the first one has been read by the userspace.

However, if the alarm irq is not configured, keep the old way of
handling timestamp interrupt in the timestamp0 sysfs calls.

Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Tested-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210629150643.31551-1-ykaukab@suse.de
drivers/rtc/rtc-pcf2127.c