rtc: cros-ec: Detect and report supported alarm window size
authorGuenter Roeck <linux@roeck-us.net>
Thu, 17 Aug 2023 22:55:33 +0000 (15:55 -0700)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 27 Aug 2023 21:50:22 +0000 (23:50 +0200)
commit00c3092d881bc9d63dc36eecd140cdb38962c7ec
treea04f7ef1af530bbcd6cea049b57bd39ad90c83fe
parent781589e40ac5f929f58824c15448e1ba49c3ac32
rtc: cros-ec: Detect and report supported alarm window size

The RTC on some older Chromebooks can only handle alarms less than
24 hours in the future. The only way to find out is to try to set
an alarm further in the future. If that fails, assume that the RTC
connected to the EC can only handle less than 24 hours of alarm
window, and report that value to the RTC core.

After that change, it is no longer necessary to limit the alarm time
when setting it. Report any excessive alarms to the caller instead.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230817225537.4053865-4-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-cros-ec.c