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

Fabrice Gasnier fabrice.gasnier at foss.st.com
Fri Sep 6 05:40:01 PDT 2024



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 at 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 at 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



More information about the linux-arm-kernel mailing list