Skip to content

Commit 6ae97be

Browse files
ukleinekbebarino
authored andcommitted
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: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/3db08ded39c09aaa5004b3b8b1238111f199e819.1746006578.git.ukleinek@baylibre.com Signed-off-by: Stephen Boyd <[email protected]>
1 parent 19272b3 commit 6ae97be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/clk/clk-pwm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ static int clk_pwm_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
4848
{
4949
struct clk_pwm *clk_pwm = to_clk_pwm(hw);
5050
struct pwm_state state;
51+
int ret;
5152

52-
pwm_get_state(clk_pwm->pwm, &state);
53+
ret = pwm_get_state_hw(clk_pwm->pwm, &state);
54+
if (ret)
55+
return ret;
5356

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

0 commit comments

Comments
 (0)