Skip to content

Commit 86fe9be

Browse files
MarekPietarlubos
authored andcommitted
applications: nrf_desktop: Fix setting initial state of QDEC driver
The QDEC driver starts in active state, setting its state to active during module initialization returns -EALREADY. Jira: NCSDK-12129 Signed-off-by: Marek Pieta <[email protected]>
1 parent 6fd1163 commit 86fe9be

File tree

1 file changed

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

1 file changed

+7
-1
lines changed

applications/nrf_desktop/src/hw_interface/wheel.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,13 @@ static int enable_qdec(enum state next_state)
199199
{
200200
__ASSERT_NO_MSG(next_state == STATE_ACTIVE);
201201

202-
int err = pm_device_state_set(qdec_dev, PM_DEVICE_STATE_ACTIVE);
202+
int err = 0;
203+
204+
/* QDEC device driver starts in PM_DEVICE_STATE_ACTIVE state. */
205+
if (state != STATE_DISABLED) {
206+
err = pm_device_state_set(qdec_dev, PM_DEVICE_STATE_ACTIVE);
207+
}
208+
203209
if (err) {
204210
LOG_ERR("Cannot activate QDEC");
205211
return err;

0 commit comments

Comments
 (0)