Commit 73392339 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 72782127 505b730e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+8 −5
Original line number Diff line number Diff line
@@ -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)