Unverified Commit 6ae97be5 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Stephen Boyd
Browse files

clk: pwm: Let .get_duty_cycle() return the real duty cycle



pwm_get_state() returns the last requested pwm_state which might differ
from what the lowlevel PWM driver actually implemented. For the purpose
of .get_duty_cycle() the latter is the more interesting info, so use
that to determine the output parameter.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/3db08ded39c09aaa5004b3b8b1238111f199e819.1746006578.git.ukleinek@baylibre.com


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 19272b37
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -48,8 +48,11 @@ static int clk_pwm_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
{
	struct clk_pwm *clk_pwm = to_clk_pwm(hw);
	struct pwm_state state;
	int ret;

	pwm_get_state(clk_pwm->pwm, &state);
	ret = pwm_get_state_hw(clk_pwm->pwm, &state);
	if (ret)
		return ret;

	duty->num = state.duty_cycle;
	duty->den = state.period;