Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pwm/for-6.16-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm fixes from Uwe Kleine-König:
"Two fixes for v6.16-rc6

The first patch fixes an embarrassing bug in the pwm core. I really
wonder this wasn't found earlier since it's introduction in v6.11-rc1
as it greatly disturbs driving a PWM via sysfs.

The second and last patch fixes a clock balance issue in an error path
of the Mediatek PWM driver"

* tag 'pwm/for-6.16-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
pwm: mediatek: Ensure to disable clocks in error path
pwm: Fix invalid state detection

+9 -6
+1 -1
drivers/pwm/core.c
··· 596 596 * and supposed to be ignored. So also ignore any strange values and 597 597 * consider the state ok. 598 598 */ 599 - if (state->enabled) 599 + if (!state->enabled) 600 600 return true; 601 601 602 602 if (!state->period)
+8 -5
drivers/pwm/pwm-mediatek.c
··· 130 130 return ret; 131 131 132 132 clk_rate = clk_get_rate(pc->clk_pwms[pwm->hwpwm]); 133 - if (!clk_rate) 134 - return -EINVAL; 133 + if (!clk_rate) { 134 + ret = -EINVAL; 135 + goto out; 136 + } 135 137 136 138 /* Make sure we use the bus clock and not the 26MHz clock */ 137 139 if (pc->soc->has_ck_26m_sel) ··· 152 150 } 153 151 154 152 if (clkdiv > PWM_CLK_DIV_MAX) { 155 - pwm_mediatek_clk_disable(chip, pwm); 156 153 dev_err(pwmchip_parent(chip), "period of %d ns not supported\n", period_ns); 157 - return -EINVAL; 154 + ret = -EINVAL; 155 + goto out; 158 156 } 159 157 160 158 if (pc->soc->pwm45_fixup && pwm->hwpwm > 2) { ··· 171 169 pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period); 172 170 pwm_mediatek_writel(pc, pwm->hwpwm, reg_thres, cnt_duty); 173 171 172 + out: 174 173 pwm_mediatek_clk_disable(chip, pwm); 175 174 176 - return 0; 175 + return ret; 177 176 } 178 177 179 178 static int pwm_mediatek_enable(struct pwm_chip *chip, struct pwm_device *pwm)