Skip to content

Commit c509075

Browse files
nrf_desktop: refactor to use pm device runtime
Refactor nrf_desktop to use pm device runtime. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent f3bcd32 commit c509075

File tree

1 file changed

+7
-7
lines changed
  • applications/nrf_desktop/src/hw_interface

1 file changed

+7
-7
lines changed

applications/nrf_desktop/src/hw_interface/wheel.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <zephyr/device.h>
1313
#include <zephyr/drivers/sensor.h>
1414
#include <zephyr/drivers/gpio.h>
15-
#include <zephyr/pm/device.h>
15+
#include <zephyr/pm/device_runtime.h>
1616
#include <pinctrl_soc.h>
1717

1818
#include <app_event_manager.h>
@@ -262,13 +262,13 @@ static int enable_qdec(enum state next_state)
262262

263263
int err = 0;
264264

265-
/* QDEC device driver starts in PM_DEVICE_STATE_ACTIVE state. */
266-
if (state != STATE_DISABLED) {
267-
err = pm_device_action_run(qdec_dev, PM_DEVICE_ACTION_RESUME);
265+
/* QDEC device driver starts in PM_DEVICE_STATE_SUSPENDED state. */
266+
if (state == STATE_DISABLED) {
267+
err = pm_device_runtime_get(qdec_dev);
268268
}
269269

270270
if (err) {
271-
LOG_ERR("Cannot resume QDEC");
271+
LOG_ERR("Cannot get QDEC");
272272
return err;
273273
}
274274

@@ -304,9 +304,9 @@ static int disable_qdec(enum state next_state)
304304
return err;
305305
}
306306

307-
err = pm_device_action_run(qdec_dev, PM_DEVICE_ACTION_SUSPEND);
307+
err = pm_device_runtime_put(qdec_dev);
308308
if (err) {
309-
LOG_ERR("Cannot suspend QDEC");
309+
LOG_ERR("Cannot put QDEC");
310310
} else {
311311
err = setup_wakeup();
312312
if (!err) {

0 commit comments

Comments
 (0)