mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
pwm: 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. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmhtdYQACgkQj4D7WH0S /k4kvQf/fLD1Q3NIGw1bgsvfgaiSqIGzKrIdg8TgiVxNRnT5GNhRnRcD9gkBfICe gfCBLNqCGETFvnL/W8hLXSeUyHDJqPcKLxUUfajU9pjNdqzb4/1Lik0BW4eI7c9o BWBvslFG0X60gqzAIpRfcXP0jyF7lKTFK8R85tp2lY3EoGwSnpReMtO7Z1Cto190 o87t6+U96eJ61RQfI52EiX+IbUOQC/2Lj41nIw1E28eo7Y6TeHp1xOXagS8wTGDq SVVhObmUyOU/iRpY+CmwZWw6oylGps34MhlJBF+IpNVJRvEBH//IZRaNC53ZO2x5 LrGMBACjfB17UU0O1AE/Qwc6yzmS/g== =yu7G -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
733923397f
|
|
@ -596,7 +596,7 @@ static bool pwm_state_valid(const struct pwm_state *state)
|
|||
* and supposed to be ignored. So also ignore any strange values and
|
||||
* consider the state ok.
|
||||
*/
|
||||
if (state->enabled)
|
||||
if (!state->enabled)
|
||||
return true;
|
||||
|
||||
if (!state->period)
|
||||
|
|
|
|||
|
|
@ -130,8 +130,10 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
return ret;
|
||||
|
||||
clk_rate = clk_get_rate(pc->clk_pwms[pwm->hwpwm]);
|
||||
if (!clk_rate)
|
||||
return -EINVAL;
|
||||
if (!clk_rate) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Make sure we use the bus clock and not the 26MHz clock */
|
||||
if (pc->soc->has_ck_26m_sel)
|
||||
|
|
@ -150,9 +152,9 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
}
|
||||
|
||||
if (clkdiv > PWM_CLK_DIV_MAX) {
|
||||
pwm_mediatek_clk_disable(chip, pwm);
|
||||
dev_err(pwmchip_parent(chip), "period of %d ns not supported\n", period_ns);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pc->soc->pwm45_fixup && pwm->hwpwm > 2) {
|
||||
|
|
@ -169,9 +171,10 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period);
|
||||
pwm_mediatek_writel(pc, pwm->hwpwm, reg_thres, cnt_duty);
|
||||
|
||||
out:
|
||||
pwm_mediatek_clk_disable(chip, pwm);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pwm_mediatek_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user