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

Merge tag 'pwm/for-5.14-rc2' of...

Merge tag 'pwm/for-5.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm

Pull pwm fixes from Thierry Reding:
 "A couple of fixes from Uwe that I missed for v5.14-rc1"

* tag 'pwm/for-5.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
  pwm: ep93xx: Ensure configuring period and duty_cycle isn't wrongly skipped
  pwm: berlin: Ensure configuring period and duty_cycle isn't wrongly skipped
  pwm: tiecap: Ensure configuring period and duty_cycle isn't wrongly skipped
  pwm: spear: Ensure configuring period and duty_cycle isn't wrongly skipped
  pwm: sprd: Ensure configuring period and duty_cycle isn't wrongly skipped
parents e9338abf f4a8e31e
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -190,12 +190,9 @@ static int berlin_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
		return 0;
	}

	if (state->period != pwm->state.period ||
	    state->duty_cycle != pwm->state.duty_cycle) {
	err = berlin_pwm_config(chip, pwm, state->duty_cycle, state->period);
	if (err)
		return err;
	}

	if (!enabled)
		return berlin_pwm_enable(chip, pwm);
+40 −45
Original line number Diff line number Diff line
@@ -64,6 +64,11 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
	int ret;
	struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
	bool enabled = state->enabled;
	void __iomem *base = ep93xx_pwm->base;
	unsigned long long c;
	unsigned long period_cycles;
	unsigned long duty_cycles;
	unsigned long term;

	if (state->polarity != pwm->state.polarity) {
		if (enabled) {
@@ -97,15 +102,6 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
		return 0;
	}

	if (state->period != pwm->state.period ||
	    state->duty_cycle != pwm->state.duty_cycle) {
		struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
		void __iomem *base = ep93xx_pwm->base;
		unsigned long long c;
		unsigned long period_cycles;
		unsigned long duty_cycles;
		unsigned long term;

	/*
	 * The clock needs to be enabled to access the PWM registers.
	 * Configuration can be changed at any time.
@@ -147,7 +143,6 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,

	if (ret)
		return ret;
	}

	if (!enabled) {
		ret = clk_prepare_enable(ep93xx_pwm->clk);
+3 −6
Original line number Diff line number Diff line
@@ -177,12 +177,9 @@ static int spear_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
		return 0;
	}

	if (state->period != pwm->state.period ||
	    state->duty_cycle != pwm->state.duty_cycle) {
	err = spear_pwm_config(chip, pwm, state->duty_cycle, state->period);
	if (err)
		return err;
	}

	if (!pwm->state.enabled)
		return spear_pwm_enable(chip, pwm);
+4 −7
Original line number Diff line number Diff line
@@ -183,13 +183,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
			}
		}

		if (state->period != cstate->period ||
		    state->duty_cycle != cstate->duty_cycle) {
		ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
				      state->period);
		if (ret)
			return ret;
		}

		sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1);
	} else if (cstate->enabled) {
+6 −9
Original line number Diff line number Diff line
@@ -189,8 +189,6 @@ static int ecap_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
		return 0;
	}

	if (state->period != pwm->state.period ||
	    state->duty_cycle != pwm->state.duty_cycle) {
	if (state->period > NSEC_PER_SEC)
		return -ERANGE;

@@ -198,7 +196,6 @@ static int ecap_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
			      state->period, enabled);
	if (err)
		return err;
	}

	if (!enabled)
		return ecap_pwm_enable(chip, pwm);