rtc: Add prescalar configuration option

This patch adds a prescaler configuration option that denotes the
number of RTC ticks per second.  This is used to calculate the value
for 1 second.

Signed-off-by: Andy Gross <agross@kernel.org>
This commit is contained in:
Andy Gross 2018-04-24 13:27:59 -05:00 committed by Kumar Gala
commit 27bdb83308
4 changed files with 11 additions and 24 deletions

View file

@ -18,4 +18,12 @@ config RTC_QMSI_API_REENTRANCY
default n
help
Enable support for RTC shim driver API reentrancy.
config RTC_PRESCALER
int
default 1
prompt "Prescaler size"
help
RTC prescaler used to determine ticks per second
endif

View file

@ -93,7 +93,7 @@ static int rtc_qmsi_set_config(struct device *dev, struct rtc_config *cfg)
* values defined by clk_rtc_div and by QMSI's clk_rtc_div_t match for
* both D2000 and SE.
*/
qm_cfg.prescaler = (clk_rtc_div_t)RTC_DIVIDER;
qm_cfg.prescaler = (clk_rtc_div_t)CONFIG_RTC_PRESCALER;
if (IS_ENABLED(CONFIG_RTC_QMSI_API_REENTRANCY)) {
k_sem_take(RP_GET(dev), K_FOREVER);