[PATCH] hwmon: (max6639) fix inverted polarity

Olivier Sobrie posted 1 patch 1 month ago
drivers/hwmon/max6639.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hwmon: (max6639) fix inverted polarity
Posted by Olivier Sobrie 1 month ago
According to MAX6639 documentation:

  D1: PWM Output Polarity. PWM output is low at
  100% duty cycle when this bit is set to zero. PWM
  output is high at 100% duty cycle when this bit is set
  to 1.

Up to commit 0f33272b60ed ("hwmon: (max6639) : Update hwmon init using
info structure"), the polarity was set to high (0x2) when no platform
data was set. After the patch, the polarity register wasn't set anymore
if no platform data was specified. Nowadays, since commit 7506ebcd662b
("hwmon: (max6639) : Configure based on DT property"), it is always set
to low which doesn't match with the comment above and change the
behavior compared to versions prior 0f33272b60ed.

Fixes: 0f33272b60ed ("hwmon: (max6639) : Update hwmon init using info structure")
Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
---
 drivers/hwmon/max6639.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
index a0a1dbbda887..9a3c515efe2e 100644
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -607,7 +607,7 @@ static int max6639_init_client(struct i2c_client *client,
 			return err;
 
 		/* Fans PWM polarity high by default */
-		err = regmap_write(data->regmap, MAX6639_REG_FAN_CONFIG2a(i), 0x00);
+		err = regmap_write(data->regmap, MAX6639_REG_FAN_CONFIG2a(i), 0x02);
 		if (err)
 			return err;
 
-- 
2.53.0
Re: [PATCH] hwmon: (max6639) fix inverted polarity
Posted by Guenter Roeck 1 month ago
On Wed, Mar 04, 2026 at 10:20:39PM +0100, Olivier Sobrie wrote:
> According to MAX6639 documentation:
> 
>   D1: PWM Output Polarity. PWM output is low at
>   100% duty cycle when this bit is set to zero. PWM
>   output is high at 100% duty cycle when this bit is set
>   to 1.
> 
> Up to commit 0f33272b60ed ("hwmon: (max6639) : Update hwmon init using
> info structure"), the polarity was set to high (0x2) when no platform
> data was set. After the patch, the polarity register wasn't set anymore
> if no platform data was specified. Nowadays, since commit 7506ebcd662b
> ("hwmon: (max6639) : Configure based on DT property"), it is always set
> to low which doesn't match with the comment above and change the
> behavior compared to versions prior 0f33272b60ed.
> 
> Fixes: 0f33272b60ed ("hwmon: (max6639) : Update hwmon init using info structure")
> Signed-off-by: Olivier Sobrie <olivier@sobrie.be>

Applied.

Thanks,
Guenter