drivers: clock_control: nrf: start HFXO when using LFSYNTH
When using synthesized low frequency clock, HFXO should be running to ensure correct frequency. Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
This commit is contained in:
parent
f96b78b030
commit
9a47667468
1 changed files with 15 additions and 0 deletions
|
@ -79,6 +79,10 @@ struct nrf_clock_control_config {
|
|||
static atomic_t hfclk_users;
|
||||
static uint64_t hf_start_tstamp;
|
||||
static uint64_t hf_stop_tstamp;
|
||||
#if CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH
|
||||
/* Client to request HFXO to synthesize low frequency clock. */
|
||||
static struct onoff_client lfsynth_cli;
|
||||
#endif
|
||||
|
||||
static struct nrf_clock_control_sub_data *get_sub_data(const struct device *dev,
|
||||
enum clock_control_nrf_type type)
|
||||
|
@ -202,6 +206,12 @@ static void lfclk_start(void)
|
|||
anomaly_132_workaround();
|
||||
}
|
||||
|
||||
#if CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH
|
||||
sys_notify_init_spinwait(&lfsynth_cli.notify);
|
||||
(void)onoff_request(z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF),
|
||||
&lfsynth_cli);
|
||||
#endif
|
||||
|
||||
nrfx_clock_lfclk_start();
|
||||
}
|
||||
|
||||
|
@ -212,6 +222,11 @@ static void lfclk_stop(void)
|
|||
}
|
||||
|
||||
nrfx_clock_lfclk_stop();
|
||||
|
||||
#if CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH
|
||||
(void)onoff_cancel_or_release(z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF),
|
||||
&lfsynth_cli);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hfclk_start(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue