Skip to content

Commit d152a84

Browse files
committed
[nrf fromlist] drivers: pwm: nrf: fix nrfx instance being zeroed on suspend
PWM driver clears its runtime state on each suspend event. However, since nrfx 4.0 integration nrfx driver instance is part of the runtime state structure, so clear action must be limited. Upstream PR #: 100309 Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent d3409c6 commit d152a84

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/pwm/pwm_nrfx.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ static int pwm_suspend(const struct device *dev)
354354
while (!nrfx_pwm_stopped_check(&data->pwm)) {
355355
}
356356

357-
memset(dev->data, 0, sizeof(struct pwm_nrfx_data));
357+
/* Explicitly clear driver state that might be invalid after subsequent resume. */
358+
data->period_cycles = 0;
359+
data->pwm_needed = 0;
360+
data->prescaler = 0;
361+
data->stop_requested = 0;
358362
(void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
359363

360364
return 0;

0 commit comments

Comments
 (0)