diff mbox series

pwm: stm32: Use the right CCxNP bit in stm32_pwm_enable()

Message ID 20240905090627.197536-2-u.kleine-koenig@baylibre.com (mailing list archive)
State New, archived
Headers show
Series pwm: stm32: Use the right CCxNP bit in stm32_pwm_enable() | expand

Commit Message

Uwe Kleine-König Sept. 5, 2024, 9:06 a.m. UTC
The pwm devices for a pwm_chip are numbered starting at 0, the first hw
channel however has the number 1. While introducing a parametrised macro
to simplify register bit usage and making that offset explicit, one of
the usages was converted wrongly. This is fixed here.

Fixes: 7cea05ae1d4e ("pwm-stm32: Make use of parametrised register definitions")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

during review of a patch to the stm32 pwm driver Fabrice pointed out a
wrong usage of TIM_CCER_CCxNE. While (I think) we both assumed this was
a problem in said patch, that problem existed already before and the
proposed change just moved the problem around. So instead of (only)
updating the patch later, here comes a separate fix for the driver.

I intend to send this to Linus tomorrow to get it into 6.11-rc7.

Best regards
Uwe

 drivers/pwm/pwm-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b

Comments

Fabrice Gasnier Sept. 6, 2024, 12:40 p.m. UTC | #1
On 9/5/24 11:06, Uwe Kleine-König wrote:
> The pwm devices for a pwm_chip are numbered starting at 0, the first hw
> channel however has the number 1. While introducing a parametrised macro
> to simplify register bit usage and making that offset explicit, one of
> the usages was converted wrongly. This is fixed here.
> 
> Fixes: 7cea05ae1d4e ("pwm-stm32: Make use of parametrised register definitions")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> during review of a patch to the stm32 pwm driver Fabrice pointed out a
> wrong usage of TIM_CCER_CCxNE. While (I think) we both assumed this was
> a problem in said patch, that problem existed already before and the
> proposed change just moved the problem around. So instead of (only)
> updating the patch later, here comes a separate fix for the driver.
> 
> I intend to send this to Linus tomorrow to get it into 6.11-rc7.

Hi UWe,

Good catch, I haven't noticed this has been introduced in earlier patch.

You can add my:
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Does it need to be CC'ed to stable list also ?

Thanks,
BR,
Fabrice

> 
> Best regards
> Uwe
> 
>  drivers/pwm/pwm-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
> index fd754a99cf2e..f85eb41cb084 100644
> --- a/drivers/pwm/pwm-stm32.c
> +++ b/drivers/pwm/pwm-stm32.c
> @@ -412,7 +412,7 @@ static int stm32_pwm_enable(struct stm32_pwm *priv, unsigned int ch)
>  	/* Enable channel */
>  	mask = TIM_CCER_CCxE(ch + 1);
>  	if (priv->have_complementary_output)
> -		mask |= TIM_CCER_CCxNE(ch);
> +		mask |= TIM_CCER_CCxNE(ch + 1);
>  
>  	regmap_set_bits(priv->regmap, TIM_CCER, mask);
>  
> base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b
Uwe Kleine-König Sept. 6, 2024, 3:59 p.m. UTC | #2
On Fri, Sep 06, 2024 at 02:40:01PM +0200, Fabrice Gasnier wrote:
> Good catch, I haven't noticed this has been introduced in earlier patch.

Well, wasn't so difficult to find. When I tried to fix my conversion to
the new waveform callbacks it was quickly obvious that the patch base
was already broken.

> You can add my:
> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

thanks, but I was to quick. I already sent a pull request to Linus
(https://lore.kernel.org/linux-pwm/25x74hglxoyb33fphdrtxrpmvsqe5227d7vy6uo6ez77hjbrn6@dh637q6cvzax/)

> Does it need to be CC'ed to stable list also ?

No, the issue was introduced in 7cea05ae1d4e which is only in mainline
since v6.11-rc1. So assuming the fix will make it in before v6.11 there
is no need for stable backports.

Best regards and thanks once more for your feedback,
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index fd754a99cf2e..f85eb41cb084 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -412,7 +412,7 @@  static int stm32_pwm_enable(struct stm32_pwm *priv, unsigned int ch)
 	/* Enable channel */
 	mask = TIM_CCER_CCxE(ch + 1);
 	if (priv->have_complementary_output)
-		mask |= TIM_CCER_CCxNE(ch);
+		mask |= TIM_CCER_CCxNE(ch + 1);
 
 	regmap_set_bits(priv->regmap, TIM_CCER, mask);