* [PATCH 0/4] pwm: Ensure .polarity is set in .get_state()
@ 2023-02-28 13:55 Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 1/4] pwm: hibvt: Explicitly set .polarity " Uwe Kleine-König
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-02-28 13:55 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Jiancheng Xue, yuanjian,
Rob Herring, Benson Leung, Orson Zhai, Baolin Wang,
Chunyan Zhang
Cc: linux-pwm, linux-kernel, Guenter Roeck, chrome-platform, kernel
Hello,
in the context of the discussion with Munehisa Kamata about the meson driver
not setting .polarity in .get_state() I checked the other drivers for the same
issue. The identified drivers are fixed here. For three of them
zero-initializing *state would be good enough, still I think setting the
polarity explicitly is a good idea. For the hibvt driver (that supports
both polarities) the change is a real improvement.
Note I didn't touch the meson driver here that requires some non-trivial
updates that I don't want to tackle without hardware to test.
Best regards
Uwe
Uwe Kleine-König (4):
pwm: hibvt: Explicitly set .polarity in .get_state()
pwm: cros-ec: Explicitly set .polarity in .get_state()
pwm: iqs620a: Explicitly set .polarity in .get_state()
pwm: sprd: Explicitly set .polarity in .get_state()
drivers/pwm/pwm-cros-ec.c | 1 +
drivers/pwm/pwm-hibvt.c | 1 +
drivers/pwm/pwm-iqs620a.c | 1 +
drivers/pwm/pwm-sprd.c | 1 +
4 files changed, 4 insertions(+)
base-commit: 7a77daf8223e772a225d6aa6202a5b1ae2392caf
--
2.39.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] pwm: hibvt: Explicitly set .polarity in .get_state()
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
@ 2023-02-28 13:55 ` Uwe Kleine-König
2023-03-10 18:59 ` Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 2/4] pwm: cros-ec: " Uwe Kleine-König
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-02-28 13:55 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Jiancheng Xue, yuanjian, Rob Herring
Cc: linux-pwm, linux-kernel, kernel
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")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
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 12c05c155cab..1b9274c5ad87 100644
--- a/drivers/pwm/pwm-hibvt.c
+++ b/drivers/pwm/pwm-hibvt.c
@@ -146,6 +146,7 @@ static int 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;
return 0;
}
--
2.39.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] pwm: cros-ec: Explicitly set .polarity in .get_state()
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 1/4] pwm: hibvt: Explicitly set .polarity " Uwe Kleine-König
@ 2023-02-28 13:55 ` Uwe Kleine-König
2023-02-28 16:19 ` Guenter Roeck
2023-03-10 18:50 ` Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 3/4] pwm: iqs620a: " Uwe Kleine-König
` (3 subsequent siblings)
5 siblings, 2 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-02-28 13:55 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Benson Leung
Cc: Guenter Roeck, linux-pwm, chrome-platform, linux-kernel, kernel
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-cros-ec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
index 86df6702cb83..ad18b0ebe3f1 100644
--- a/drivers/pwm/pwm-cros-ec.c
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -198,6 +198,7 @@ static int cros_ec_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
state->enabled = (ret > 0);
state->period = EC_PWM_MAX_DUTY;
+ state->polarity = PWM_POLARITY_NORMAL;
/*
* Note that "disabled" and "duty cycle == 0" are treated the same. If
--
2.39.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] pwm: iqs620a: Explicitly set .polarity in .get_state()
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 1/4] pwm: hibvt: Explicitly set .polarity " Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 2/4] pwm: cros-ec: " Uwe Kleine-König
@ 2023-02-28 13:55 ` Uwe Kleine-König
2023-03-10 18:48 ` Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 4/4] pwm: sprd: " Uwe Kleine-König
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-02-28 13:55 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata; +Cc: linux-pwm, linux-kernel, kernel
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-iqs620a.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pwm/pwm-iqs620a.c b/drivers/pwm/pwm-iqs620a.c
index 8362b4870c66..47b3141135f3 100644
--- a/drivers/pwm/pwm-iqs620a.c
+++ b/drivers/pwm/pwm-iqs620a.c
@@ -126,6 +126,7 @@ static int iqs620_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
mutex_unlock(&iqs620_pwm->lock);
state->period = IQS620_PWM_PERIOD_NS;
+ state->polarity = PWM_POLARITY_NORMAL;
return 0;
}
--
2.39.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] pwm: sprd: Explicitly set .polarity in .get_state()
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
` (2 preceding siblings ...)
2023-02-28 13:55 ` [PATCH 3/4] pwm: iqs620a: " Uwe Kleine-König
@ 2023-02-28 13:55 ` Uwe Kleine-König
2023-03-10 18:43 ` Uwe Kleine-König
2023-05-08 3:45 ` [PATCH 0/4] pwm: Ensure .polarity is set " patchwork-bot+chrome-platform
2023-05-08 3:56 ` patchwork-bot+chrome-platform
5 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-02-28 13:55 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Orson Zhai, Baolin Wang, Chunyan Zhang
Cc: linux-pwm, linux-kernel, kernel
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
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] pwm: cros-ec: Explicitly set .polarity in .get_state()
2023-02-28 13:55 ` [PATCH 2/4] pwm: cros-ec: " Uwe Kleine-König
@ 2023-02-28 16:19 ` Guenter Roeck
2023-03-10 18:50 ` Uwe Kleine-König
1 sibling, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2023-02-28 16:19 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Thierry Reding, Munehisa Kamata, Benson Leung, Guenter Roeck,
linux-pwm, chrome-platform, linux-kernel, kernel
On Tue, Feb 28, 2023 at 5:55 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> 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>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
> ---
> drivers/pwm/pwm-cros-ec.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
> index 86df6702cb83..ad18b0ebe3f1 100644
> --- a/drivers/pwm/pwm-cros-ec.c
> +++ b/drivers/pwm/pwm-cros-ec.c
> @@ -198,6 +198,7 @@ static int cros_ec_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
>
> state->enabled = (ret > 0);
> state->period = EC_PWM_MAX_DUTY;
> + state->polarity = PWM_POLARITY_NORMAL;
>
> /*
> * Note that "disabled" and "duty cycle == 0" are treated the same. If
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] pwm: sprd: Explicitly set .polarity in .get_state()
2023-02-28 13:55 ` [PATCH 4/4] pwm: sprd: " Uwe Kleine-König
@ 2023-03-10 18:43 ` Uwe Kleine-König
0 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-03-10 18:43 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Orson Zhai, Baolin Wang, Chunyan Zhang
Cc: linux-pwm, linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
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/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] pwm: iqs620a: Explicitly set .polarity in .get_state()
2023-02-28 13:55 ` [PATCH 3/4] pwm: iqs620a: " Uwe Kleine-König
@ 2023-03-10 18:48 ` Uwe Kleine-König
2023-03-10 23:29 ` Jeff LaBundy
0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-03-10 18:48 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Jeff LaBundy
Cc: linux-pwm, linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 673 bytes --]
[To += Jeff LaBundy]
On Tue, Feb 28, 2023 at 02:55:07PM +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: 6f0841a8197b ("pwm: Add support for Azoteq IQS620A PWM generator")
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] pwm: cros-ec: Explicitly set .polarity in .get_state()
2023-02-28 13:55 ` [PATCH 2/4] pwm: cros-ec: " Uwe Kleine-König
2023-02-28 16:19 ` Guenter Roeck
@ 2023-03-10 18:50 ` Uwe Kleine-König
1 sibling, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-03-10 18:50 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Benson Leung
Cc: Guenter Roeck, linux-pwm, linux-kernel, kernel, chrome-platform
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
On Tue, Feb 28, 2023 at 02:55:06PM +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: 1f0d3bb02785 ("pwm: Add ChromeOS EC PWM driver")
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] pwm: hibvt: Explicitly set .polarity in .get_state()
2023-02-28 13:55 ` [PATCH 1/4] pwm: hibvt: Explicitly set .polarity " Uwe Kleine-König
@ 2023-03-10 18:59 ` Uwe Kleine-König
0 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-03-10 18:59 UTC (permalink / raw)
To: Thierry Reding, Munehisa Kamata, Jiancheng Xue, Rob Herring
Cc: linux-pwm, linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
[dropped yuanjian from To, as their address bounced when I submitted
this patch]
On Tue, Feb 28, 2023 at 02:55:05PM +0100, Uwe Kleine-König wrote:
> The driver only both polarities. Complete the implementation of
s/only/supports/
> .get_state() by setting .polarity according to the configured hardware
> state.
>
> Fixes: d09f00810850 ("pwm: Add PWM driver for HiSilicon BVT SOCs")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] pwm: iqs620a: Explicitly set .polarity in .get_state()
2023-03-10 18:48 ` Uwe Kleine-König
@ 2023-03-10 23:29 ` Jeff LaBundy
0 siblings, 0 replies; 13+ messages in thread
From: Jeff LaBundy @ 2023-03-10 23:29 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Thierry Reding, Munehisa Kamata, linux-pwm, linux-kernel, kernel
On Fri, Mar 10, 2023 at 07:48:15PM +0100, Uwe Kleine-König wrote:
> [To += Jeff LaBundy]
>
> On Tue, Feb 28, 2023 at 02:55:07PM +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: 6f0841a8197b ("pwm: Add support for Azoteq IQS620A PWM generator")
Reviewed-by: Jeff LaBundy <jeff@labundy.com>
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | https://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] pwm: Ensure .polarity is set in .get_state()
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
` (3 preceding siblings ...)
2023-02-28 13:55 ` [PATCH 4/4] pwm: sprd: " Uwe Kleine-König
@ 2023-05-08 3:45 ` patchwork-bot+chrome-platform
2023-05-08 3:56 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 13+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-05-08 3:45 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: thierry.reding, kamatam, xuejiancheng, yuanjian12, robh, bleung,
orsonzhai, baolin.wang, zhang.lyra, linux-pwm, linux-kernel,
groeck, chrome-platform, kernel
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci)
by Thierry Reding <thierry.reding@gmail.com>:
On Tue, 28 Feb 2023 14:55:04 +0100 you wrote:
> Hello,
>
> in the context of the discussion with Munehisa Kamata about the meson driver
> not setting .polarity in .get_state() I checked the other drivers for the same
> issue. The identified drivers are fixed here. For three of them
> zero-initializing *state would be good enough, still I think setting the
> polarity explicitly is a good idea. For the hibvt driver (that supports
> both polarities) the change is a real improvement.
>
> [...]
Here is the summary with links:
- [2/4] pwm: cros-ec: Explicitly set .polarity in .get_state()
https://git.kernel.org/chrome-platform/c/30006b77c7e1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] pwm: Ensure .polarity is set in .get_state()
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
` (4 preceding siblings ...)
2023-05-08 3:45 ` [PATCH 0/4] pwm: Ensure .polarity is set " patchwork-bot+chrome-platform
@ 2023-05-08 3:56 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 13+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-05-08 3:56 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: thierry.reding, kamatam, xuejiancheng, yuanjian12, robh, bleung,
orsonzhai, baolin.wang, zhang.lyra, linux-pwm, linux-kernel,
groeck, chrome-platform, kernel
Hello:
This patch was applied to chrome-platform/linux.git (for-next)
by Thierry Reding <thierry.reding@gmail.com>:
On Tue, 28 Feb 2023 14:55:04 +0100 you wrote:
> Hello,
>
> in the context of the discussion with Munehisa Kamata about the meson driver
> not setting .polarity in .get_state() I checked the other drivers for the same
> issue. The identified drivers are fixed here. For three of them
> zero-initializing *state would be good enough, still I think setting the
> polarity explicitly is a good idea. For the hibvt driver (that supports
> both polarities) the change is a real improvement.
>
> [...]
Here is the summary with links:
- [2/4] pwm: cros-ec: Explicitly set .polarity in .get_state()
https://git.kernel.org/chrome-platform/c/30006b77c7e1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-05-08 3:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 13:55 [PATCH 0/4] pwm: Ensure .polarity is set in .get_state() Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 1/4] pwm: hibvt: Explicitly set .polarity " Uwe Kleine-König
2023-03-10 18:59 ` Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 2/4] pwm: cros-ec: " Uwe Kleine-König
2023-02-28 16:19 ` Guenter Roeck
2023-03-10 18:50 ` Uwe Kleine-König
2023-02-28 13:55 ` [PATCH 3/4] pwm: iqs620a: " Uwe Kleine-König
2023-03-10 18:48 ` Uwe Kleine-König
2023-03-10 23:29 ` Jeff LaBundy
2023-02-28 13:55 ` [PATCH 4/4] pwm: sprd: " Uwe Kleine-König
2023-03-10 18:43 ` Uwe Kleine-König
2023-05-08 3:45 ` [PATCH 0/4] pwm: Ensure .polarity is set " patchwork-bot+chrome-platform
2023-05-08 3:56 ` patchwork-bot+chrome-platform
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).