Skip to content

Commit 75e7ed5

Browse files
Gokul PraveenUwe Kleine-König
authored andcommitted
pwm: tiehrpwm: Enable pwmchip's parent device before setting configuration
The period and duty cycle configurations on J7200 and J784S4 SoCs does not get reflected after setting them using sysfs nodes. This is because at the end of ehrpwm_pwm_config function, the put_sync function is called which resets the hardware. Hold the PWM controller out of low-power mode during .apply() to make sure it accepts the writes to its registers. This renders the calls to pm_runtime_get_sync() and pm_runtime_put_sync() in ehrpwm_pwm_config() into no-ops, so these can be dropped. Fixes: 5f027d9 ("pwm: tiehrpwm: Implement .apply() callback") Signed-off-by: Gokul Praveen <g-praveen@ti.com> Suggested-by: Uwe Kleine-König <ukleinek@kernel.org> Link: https://patch.msgid.link/20260121061134.15466-1-g-praveen@ti.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
1 parent dcce06f commit 75e7ed5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pwm/pwm-tiehrpwm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
237237
if (period_cycles < 1)
238238
period_cycles = 1;
239239

240-
pm_runtime_get_sync(pwmchip_parent(chip));
241-
242240
/* Update clock prescaler values */
243241
ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_CLKDIV_MASK, tb_divval);
244242

@@ -290,8 +288,6 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
290288
if (!(duty_cycles > period_cycles))
291289
ehrpwm_write(pc->mmio_base, cmp_reg, duty_cycles);
292290

293-
pm_runtime_put_sync(pwmchip_parent(chip));
294-
295291
return 0;
296292
}
297293

@@ -378,6 +374,8 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
378374
int err;
379375
bool enabled = pwm->state.enabled;
380376

377+
guard(pm_runtime_active)(pwmchip_parent(chip));
378+
381379
if (state->polarity != pwm->state.polarity) {
382380
if (enabled) {
383381
ehrpwm_pwm_disable(chip, pwm);

0 commit comments

Comments
 (0)