[PATCH stable 5.4.y] pwm: hibvt: Explicitly set .polarity in .get_state()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ Upstream commit 6f57937980142715e927697a6ffd2050f38ed6f6 ]

The driver only both polarities. Complete the implementation of
.get_state() by setting .polarity according to the configured hardware
state.

Fixes: d09f00810850 ("pwm: Add PWM driver for HiSilicon BVT SOCs")
Link: https://lore.kernel.org/r/20230228135508.1798428-2-u.kleine-koenig@xxxxxxxxxxxxxx
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
Signed-off-by: Thierry Reding <thierry.reding@xxxxxxxxx>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
Hello,

this is a backport to 5.4.257. The original was backported to

- v5.10.179 as commit 155b2586de3f171d46c8a1955990d4676487501e
- v5.15.109 as commit 78559037632b8343b85fb1e2d0b55405c2b73b4a
- v6.1.24 as commit 98ba763cc91c8e0117ccc28e300640eee52f9b44
- v6.2.11 as commit 28ab26f6a95b4bda64cba22704484d209aad5417

A direct

	git cherry-pick 6f57937980142715e927697a6ffd2050f38ed6f6

on 5.4.257 fails with a conflict, but the same happend on 5.10.y and
5.15.y, where it was backported correctly. So

	git cherry-pick 78559037632b8343b85fb1e2d0b55405c2b73b4a

works just fine and results in this patch. Cherry-picking
78559037632b8343b85fb1e2d0b55405c2b73b4a also works fine on for 4.19.y
and 4.14.

Note there is a broken sentence in the commit log, s/only/supports/
would be appropriate. I am unsure however if I'm allowed to fix it or if
the commit log has to be exactly the same as the original.

Best regards
Uwe

 drivers/pwm/pwm-hibvt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c
index ad205fdad372..286e9b119ee5 100644
--- a/drivers/pwm/pwm-hibvt.c
+++ b/drivers/pwm/pwm-hibvt.c
@@ -146,6 +146,7 @@ static void hibvt_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	value = readl(base + PWM_CTRL_ADDR(pwm->hwpwm));
 	state->enabled = (PWM_ENABLE_MASK & value);
+	state->polarity = (PWM_POLARITY_MASK & value) ? PWM_POLARITY_INVERSED : PWM_POLARITY_NORMAL;
 }
 
 static int hibvt_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,

base-commit: a140610d8aff1a06d36f8e4e9e66079b561d043d
-- 
2.40.1




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux