Skip to content

Commit 6aeca71

Browse files
bjarki-andreasenkartben
authored andcommitted
drivers: clock_control: nrf_clock_control: introduce startup time
Introduce get_startup_time API which allows users to request clocks specs to be met in time for an event. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent b1a5588 commit 6aeca71

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

include/zephyr/drivers/clock_control/nrf_clock_control.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ __subsystem struct nrf_clock_control_driver_api {
207207
int (*resolve)(const struct device *dev,
208208
const struct nrf_clock_spec *req_spec,
209209
struct nrf_clock_spec *res_spec);
210+
int (*get_startup_time)(const struct device *dev,
211+
const struct nrf_clock_spec *spec,
212+
uint32_t *startup_time_us);
210213
};
211214

212215
/**
@@ -351,6 +354,29 @@ static inline int nrf_clock_control_resolve(const struct device *dev,
351354
return api->resolve(dev, req_spec, res_spec);
352355
}
353356

357+
/**
358+
* @brief Get the startup timme of a clock.
359+
*
360+
* @param dev Device structure.
361+
* @param startup_time_us Destination for startup time in microseconds.
362+
*
363+
* @retval Successful if successful.
364+
* @retval -errno code if failure.
365+
*/
366+
static inline int nrf_clock_control_get_startup_time(const struct device *dev,
367+
const struct nrf_clock_spec *spec,
368+
uint32_t *startup_time_us)
369+
{
370+
const struct nrf_clock_control_driver_api *api =
371+
(const struct nrf_clock_control_driver_api *)dev->api;
372+
373+
if (api->get_startup_time == NULL) {
374+
return -ENOSYS;
375+
}
376+
377+
return api->get_startup_time(dev, spec, startup_time_us);
378+
}
379+
354380
/** @brief Request the HFXO from Zero Latency Interrupt context.
355381
*
356382
* Function is optimized for use in Zero Latency Interrupt context.

0 commit comments

Comments
 (0)