Skip to content

Commit 8eea788

Browse files
[nrf fromlist] tests: drivers: clock_control: nrf: add global hsfll clock
Extend test suite to test global HSFLL clock. Upstream PR #: 81735 Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent c581652 commit 8eea788

File tree

1 file changed

+34
-2
lines changed
  • tests/drivers/clock_control/nrf_clock_control/src

1 file changed

+34
-2
lines changed

tests/drivers/clock_control/nrf_clock_control/src/main.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,29 @@ static const struct test_clk_context cpurad_hsfll_test_clk_contexts[] = {
104104
};
105105
#endif
106106

107+
const struct nrf_clock_spec test_clk_specs_global_hsfll[] = {
108+
{
109+
.frequency = MHZ(320),
110+
},
111+
{
112+
.frequency = MHZ(256),
113+
},
114+
{
115+
.frequency = MHZ(128),
116+
},
117+
{
118+
.frequency = MHZ(64),
119+
},
120+
};
121+
122+
static const struct test_clk_context global_hsfll_test_clk_contexts[] = {
123+
{
124+
.clk_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120)),
125+
.clk_specs = test_clk_specs_global_hsfll,
126+
.clk_specs_size = ARRAY_SIZE(test_clk_specs_global_hsfll),
127+
},
128+
};
129+
107130
const struct nrf_clock_spec test_clk_specs_lfclk[] = {
108131
{
109132
.frequency = 32768,
@@ -151,8 +174,10 @@ static void test_request_release_clock_spec(const struct device *clk_dev,
151174
zassert_ok(ret);
152175
zassert_ok(res);
153176
ret = clock_control_get_rate(clk_dev, NULL, &rate);
154-
zassert_ok(ret);
155-
zassert_equal(rate, clk_spec->frequency);
177+
if (ret != -ENOSYS) {
178+
zassert_ok(ret);
179+
zassert_equal(rate, clk_spec->frequency);
180+
}
156181
k_msleep(1000);
157182
ret = nrf_clock_control_release(clk_dev, clk_spec);
158183
zassert_equal(ret, ONOFF_STATE_ON);
@@ -249,6 +274,13 @@ ZTEST(nrf2_clock_control, test_lfclk_control)
249274
test_clock_control_request(lfclk_test_clk_contexts, ARRAY_SIZE(lfclk_test_clk_contexts));
250275
}
251276

277+
ZTEST(nrf2_clock_control, test_global_hsfll_control)
278+
{
279+
TC_PRINT("Global HSFLL test\n");
280+
test_clock_control_request(global_hsfll_test_clk_contexts,
281+
ARRAY_SIZE(global_hsfll_test_clk_contexts));
282+
}
283+
252284
ZTEST(nrf2_clock_control, test_safe_request_cancellation)
253285
{
254286
int ret = 0;

0 commit comments

Comments
 (0)