Skip to content

Commit edcedf9

Browse files
bjarki-andreasenPerMac
authored andcommitted
nrf_desktop: update dvfs clock control request
HSFLL clocks, like the one used by DVFS in the nrf_desktop app, have a dynamic minimum freq, so support for the get_rate API has been removed from HSFLL clock control drivers. Adapt the DVFS module to not rely on the get_rate API and update comments to document the new presumtions. Ref: NRFX-6890 Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent f0a737b commit edcedf9

File tree

1 file changed

+9
-26
lines changed
  • applications/nrf_desktop/src/modules

1 file changed

+9
-26
lines changed

applications/nrf_desktop/src/modules/dvfs.c

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,14 @@ static void dvfs_notify_work_handler(struct k_work *work)
255255
handle_dvfs_error(res);
256256
return;
257257
}
258-
ret = clock_control_get_rate(dvfs_clock_dev, NULL, &current_freq);
259-
if (ret < 0) {
260-
LOG_ERR("Failed to get current frequency with error: %d", ret);
261-
dvfs_fatal_error();
262-
return;
263-
}
264-
if (requested_freq != current_freq) {
265-
/*
266-
* In current solution it is assumed that no other module
267-
* will change cpu frequency.
268-
*/
269-
LOG_ERR("Requested frequency %" PRIu32
270-
" is not the same as current frequency %" PRIu32,
271-
requested_freq, current_freq);
272-
dvfs_fatal_error();
273-
return;
274-
}
258+
259+
/*
260+
* Clock control request success means current_freq is now at minimum
261+
* requested_freq. In current solution it is assumed that no other
262+
* module will change cpu frequency, so current_freq is effectively
263+
* equal to requested_freq.
264+
*/
265+
current_freq = requested_freq;
275266

276267
dvfs_retry.retries_cnt = 0;
277268
LOG_INF("DVFS completed, current frequency is: %" PRIu32, current_freq);
@@ -364,15 +355,7 @@ static bool app_event_handler(const struct app_event_header *aeh)
364355
k_work_init_delayable(&dvfs_state_timeouts[i].timeout_work,
365356
dvfs_state_timeout_work_handler);
366357
}
367-
int ret = clock_control_get_rate(dvfs_clock_dev,
368-
NULL, &current_freq);
369-
370-
if (ret < 0) {
371-
LOG_ERR("Failed to get current frequency with error: %d",
372-
ret);
373-
dvfs_fatal_error();
374-
return false;
375-
}
358+
376359
module_state = STATE_READY;
377360

378361
if (IS_ENABLED(CONFIG_DESKTOP_DVFS_STATE_INITIALIZING_ENABLE)) {

0 commit comments

Comments
 (0)