[PATCH 4/4] pwm: sprd: Explicitly set .polarity in .get_state()

Uwe Kleine-König posted 4 patches 2 years, 6 months ago
[PATCH 4/4] pwm: sprd: Explicitly set .polarity in .get_state()
Posted by Uwe Kleine-König 2 years, 6 months ago
The driver only supports normal polarity. Complete the implementation of
.get_state() by setting .polarity accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-sprd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
index d866ce345f97..bde579a338c2 100644
--- a/drivers/pwm/pwm-sprd.c
+++ b/drivers/pwm/pwm-sprd.c
@@ -109,6 +109,7 @@ static int sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
 	duty = val & SPRD_PWM_DUTY_MSK;
 	tmp = (prescale + 1) * NSEC_PER_SEC * duty;
 	state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, chn->clk_rate);
+	state->polarity = PWM_POLARITY_NORMAL;
 
 	/* Disable PWM clocks if the PWM channel is not in enable state. */
 	if (!state->enabled)
-- 
2.39.1

Re: [PATCH 4/4] pwm: sprd: Explicitly set .polarity in .get_state()
Posted by Uwe Kleine-König 2 years, 6 months ago
On Tue, Feb 28, 2023 at 02:55:08PM +0100, Uwe Kleine-König wrote:
> The driver only supports normal polarity. Complete the implementation of
> .get_state() by setting .polarity accordingly.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

I think we should apply this patch as a fix to prevent similar failures
as reported for the meson driver. To justify that:

Fixes: 8aae4b02e8a6 ("pwm: sprd: Add Spreadtrum PWM support")

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |