]> git.ipfire.org Git - thirdparty/linux.git/commit
hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Tue, 28 Jul 2026 00:22:20 +0000 (21:22 -0300)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 28 Jul 2026 00:56:50 +0000 (17:56 -0700)
commita3850231521b06bbbb18c8ebea100320c14a08be
tree71f81feed0a1dc3db707efedec3111eda2e29964
parent1a18c79c4bc44cc5349c60e16b0b744dc6ec5f77
hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks

The ADT7470_PWM3_AUTO_MASK and ADT7470_PWM4_AUTO_MASK macros are
currently defined with swapped bit values.

According to Table 22 of the ADT7470 datasheet, the Fan Control Mode
Configuration for register 0x69 follows the exact same bit position
layout as register 0x68:
- 0x68 Bit[7] corresponds to BHVR1 (PWM1) -> 0x80
- 0x68 Bit[6] corresponds to BHVR2 (PWM2) -> 0x40
- 0x69 Bit[7] corresponds to BHVR3 (PWM3) -> 0x80
- 0x69 Bit[6] corresponds to BHVR4 (PWM4) -> 0x40

Consequently, PWM3 should use mask 0x80 and PWM4 should use 0x40.

This typo did not cause any functional bugs because these specific
macros are never referenced in the driver code. Instead, the driver
correctly applies the configuration by relying on the modulo parity of
the channel index (e.g., `channel % 2`) to selectively apply either
ADT7470_PWM1_AUTO_MASK (0x80) or ADT7470_PWM2_AUTO_MASK (0x40).
Since the bit layout is identical between the two configuration
registers, the hardware is currently configured correctly.

Fix the macro definitions to reflect the datasheet accurately and
prevent future bugs or confusion during code review and refactoring.
As this is a purely cosmetic fix with no functional impact, a backport
to stable kernels is not necessary.

Fixes: 6f9703d0be16 ("hwmon: add support for adt7470")
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-4-598e38a46ba6@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adt7470.c