drivers: clock_control: nrf: add zero-latency-isr safe APIs

Add zero latency interrupt safe APIs to allow requesting and
releasing HFXO. These will be used from components running
in zero latency interrupt context, like the bluetooth stack.

Co-authored-by: Piotr Pryga <piotr.pryga@nordicsemi.no>

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Bjarki Arge Andreasen 2024-12-03 12:38:04 +01:00 committed by Benjamin Cabé
parent 90b2aa8c22
commit 2aec438b43

View file

@ -317,6 +317,30 @@ int nrf_clock_control_cancel_or_release(const struct device *dev,
return api->cancel_or_release(dev, spec, cli);
}
/** @brief Request the HFXO from Zero Latency Interrupt context.
*
* Function is optimized for use in Zero Latency Interrupt context.
* It does not give notification when the HFXO is ready, so each
* user must put the request early enough to make sure the HFXO
* ramp-up has finished on time.
*
* This function uses reference counting so the caller must ensure
* that every nrf_clock_control_hfxo_request() call has a matching
* nrf_clock_control_hfxo_release() call.
*/
void nrf_clock_control_hfxo_request(void);
/** @brief Release the HFXO from Zero Latency Interrupt context.
*
* Function is optimized for use in Zero Latency Interrupt context.
*
* Calls to this function must be coupled with prior calls
* to nrf_clock_control_hfxo_request(), because it uses basic
* reference counting to make sure the HFXO is released when
* there are no more pending requests.
*/
void nrf_clock_control_hfxo_release(void);
#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */
#ifdef __cplusplus