mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 23:51:39 +00:00
pwm: Fix an off-by-one in the stm32 driver
Hardware engineers tend to start counting at 1 while the software guys usually start with 0. This isn't so nice because that results in drivers where pwm device #2 needs to use the hardware registers with index 3. With the commits796b942f65
("mfd: stm32-timers: Add some register definitions with a parameter")7cea05ae1d
("pwm-stm32: Make use of parametrised register definitions") (merged for v6.11-rc1) I tried to improve the situation and make this counting mismatch more explicit and transparent. However in one instance I failed to add the needed +1. This was noticed by Fabrice Gasnier (however in a way that made me hesitate to add a "Reported-by:" tag, see https://lore.kernel.org/linux-pwm/3515a8f3-436e-4d14-9bac-dfe6aa869819@foss.st.com), thanks to him for catching the issue. A small patch fixing that mismatch is the only change included here. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmbavHoACgkQj4D7WH0S /k71QAf/YE64gkrQZ1nlYWrU0XLH49d+GDI92Q3qYgU0HLontdH+k1hoBra3SgvR OSKeyJdXM9ffQ5MDqYE+wKiriAdx87bnqlIp1eUeIcZmmSpR7x1XEKGRclpYJXPz MFEuK5cxzQAP2bihWavkcl1Ws5LmuTKJMJUbtrDW5R6jYQUesRx5Dxt/U+e8s8cu HL205kNWGpCcyuLmiUNeu3mlP0qX4EbCa9iuhMvkuz7nNjrNSZ3Mdsc0bIEzKxKc NL3yLYqPcOO7z6whGH/05SjRFtKpRrZJ1Pnn4VpEfmfoWINIGDslqPmsxeodMux3 emkXmTWpmu+ptnk9Bgzl6NAqGijFMQ== =d3K/ -----END PGP SIGNATURE----- Merge tag 'pwm/for-6.11-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux Pull pwm fix from Uwe Kleine-König: "Fix an off-by-one in the stm32 driver. Hardware engineers tend to start counting at 1 while the software guys usually start with 0. This isn't so nice because that results in drivers where pwm device #2 needs to use the hardware registers with index 3. This was noticed by Fabrice Gasnier. A small patch fixing that mismatch is the only change included here" * tag 'pwm/for-6.11-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: pwm: stm32: Use the right CCxNP bit in stm32_pwm_enable()
This commit is contained in:
commit
8654fa5ca3
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user