Skip to content

Commit ab690ac

Browse files
committed
[nrf noup] Bluetooth: Controller: nrf54hx: Initial LF clock control
Added initial implementation for nrf54hx LF clock control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
1 parent 6014a40 commit ab690ac

File tree

1 file changed

+34
-1
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/lll

1 file changed

+34
-1
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_clock.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <zephyr/drivers/clock_control.h>
1111
#include <zephyr/drivers/clock_control/nrf_clock_control.h>
1212

13+
#include "lll_clock.h"
14+
1315
#include "hal/debug.h"
1416

1517
/* Clock setup timeouts are unlikely, below values are experimental */
@@ -19,15 +21,40 @@
1921
static uint16_t const sca_ppm_lut[] = {500, 250, 150, 100, 75, 50, 30, 20};
2022

2123
#if defined(CONFIG_SOC_SERIES_NRF54HX)
22-
#define CLOCK_CONTROL_NRF_K32SRC_ACCURACY 7U
24+
#define CLOCK_CONTROL_NRF_K32SRC_ACCURACY 7U /* FIXME: */
25+
#define NOTIFY_TIMEOUT K_SECONDS(2)
26+
27+
const static struct device *clock_dev_lf = DEVICE_DT_GET(DT_NODELABEL(lfclk));
28+
const static struct nrf_clock_spec clock_req_spec_lf = {
29+
.frequency = 32768,
30+
.accuracy = sca_ppm_lut[CLOCK_CONTROL_NRF_K32SRC_ACCURACY],
31+
.precision = 0, /* 0 for low precision, 1 for high precision */
32+
};
33+
static struct onoff_client clock_cli_lf;
2334

2435
int lll_clock_init(void)
2536
{
37+
int err;
38+
39+
sys_notify_init_spinwait(&clock_cli_lf.notify);
40+
41+
err = nrf_clock_control_request(clock_dev_lf, &clock_req_spec_lf, &clock_cli_lf);
42+
if (err) {
43+
return err;
44+
}
45+
2646
return 0;
2747
}
2848

2949
int lll_clock_deinit(void)
3050
{
51+
int err;
52+
53+
err = nrf_clock_control_release(clock_dev_lf, &clock_req_spec_lf);
54+
if (err) {
55+
return err;
56+
}
57+
3158
return 0;
3259
}
3360

@@ -38,16 +65,22 @@ int lll_clock_wait(void)
3865

3966
int lll_hfclock_on(void)
4067
{
68+
/* TODO: */
69+
4170
return 0;
4271
}
4372

4473
int lll_hfclock_on_wait(void)
4574
{
75+
/* TODO: */
76+
4677
return 0;
4778
}
4879

4980
int lll_hfclock_off(void)
5081
{
82+
/* TODO: */
83+
5184
return 0;
5285
}
5386

0 commit comments

Comments
 (0)