Skip to content

Commit 5828ba5

Browse files
fimohamecfriedt
authored andcommitted
driver: pwm: pwm_silabs_siwx91x: fix pm actions when PM is enabled
This fix addresses the issue encountered when power management (pm) is enabled, as the PWM test suites utilize the GPIO driver, which now incorporates the latest power domain enhancements and requires CONFIG_POWER_DOMAIN to be enabled. Power domain functionality manages device power actions such as turning on and off. Accordingly, the pm device support for the pwm_silabs_siwx91x driver has been updated to align with the recent power domain improvements. Signed-off-by: S Mohamed Fiaz <[email protected]>
1 parent 440b0c0 commit 5828ba5

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

drivers/pwm/pwm_silabs_siwx91x.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ static int pwm_siwx91x_pm_action(const struct device *dev, enum pm_device_action
188188
uint32_t pwm_frequency;
189189
int ret;
190190

191-
if (action == PM_DEVICE_ACTION_RESUME) {
191+
switch (action) {
192+
case PM_DEVICE_ACTION_RESUME:
193+
break;
194+
case PM_DEVICE_ACTION_SUSPEND:
195+
break;
196+
case PM_DEVICE_ACTION_TURN_ON:
192197
ret = clock_control_on(config->clock_dev, config->clock_subsys);
193198
if (ret) {
194199
return ret;
@@ -214,9 +219,10 @@ static int pwm_siwx91x_pm_action(const struct device *dev, enum pm_device_action
214219
if (ret) {
215220
return -EINVAL;
216221
}
217-
} else if (IS_ENABLED(CONFIG_PM_DEVICE) && (action == PM_DEVICE_ACTION_SUSPEND)) {
218-
return 0;
219-
} else {
222+
break;
223+
case PM_DEVICE_ACTION_TURN_OFF:
224+
break;
225+
default:
220226
return -ENOTSUP;
221227
}
222228

dts/arm/silabs/siwg917.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@
361361
clocks = <&clock0 SIWX91X_CLK_PWM>;
362362
#pwm-cells = <2>;
363363
silabs,ch-prescaler = <64 64 64 64>;
364+
power-domains = <&siwx91x_soc_pd>;
365+
zephyr,pm-device-runtime-auto;
364366
status = "disabled";
365367
};
366368

0 commit comments

Comments
 (0)