You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
drivers: clock_control: nrf2_lfclk: Fix selecting lowest power clock
The application or drivers can request the LFCLK with a given
precision and accuracy.
The driver should select the clock source which has
the lowest power consumption and still satisfies the requested
accuracy and precision.
Before this commit, this was not the case.
Consider the case where the BICR has configured the system
to have LFXO with accuracy of 20 ppm.
The existing code would have ordered the clock options as following:
```
[0] = {LFLPRC, 1000 ppm},
[1] = {LFRC, 500 ppm},
[2] = {SYNTH, 30 ppm},
[3] = {LFXO_PIERCE, 20 ppm},
[4] = {LFXO_PIERCE_HP, 20 ppm}
```
**Example 1**: The user requests the clock with an accuracy of 30 ppm.
The existing code would request the power hungry "SYNTH".
**Example 2**: The user requests a clock with an accuracy of 500 ppm.
The existing code would request the LFRC which consumes more power than
the LFXO.
This commit fixes this issue by ordering the clock sources according
to power consumption.
For the examples above we user request would result in requesting the
20 ppm LFXO.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
0 commit comments