OSDN Git Service

rtc: stm32: improve rtc precision
authorChristophe Guibout <christophe.guibout@foss.st.com>
Wed, 5 Jul 2023 17:43:53 +0000 (19:43 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 27 Jul 2023 21:03:34 +0000 (23:03 +0200)
commit2487925731b75961cf4b7d1d0d28d204b63787b9
tree8c86417a2ba2830644aadaa04331ddcc8493f698
parent1c18b8ec52396af6a6e20cd3450dc9bff0781ab8
rtc: stm32: improve rtc precision

The rtc is used to update the stgen counter on wake up from
low power modes, so it needs to be as much accurate as possible.

The maximization of asynchronous divider leads to a 4ms rtc
precision clock.
By decreasing pred_a to 0, it will have pred_s=32767 (when
need_accuracy is true), so stgen clock becomes more accurate
with 30us precision.
Nevertheless this will leads to an increase of power consumption.

Signed-off-by: Christophe Guibout <christophe.guibout@foss.st.com>
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20230705174357.353616-4-valentin.caron@foss.st.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-stm32.c