Skip to content
/ linux Public

Commit b1c2423

Browse files
vadimp-nvidiagroeck
authored andcommitted
hwmon: (mlxreg-fan) Modify PWM connectivity validation
Validate PWM connectivity only for additional PWM - "pwm1" is connected on all systems, while "pwm2" - "pwm4" are optional. Validate connectivity only for optional attributes by reading of related "pwm{n}" registers - in case "pwm{n}" is not connected, register value is supposed to be 0xff. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20210926053541.1806937-2-vadimp@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 1508fb2 commit b1c2423

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/hwmon/mlxreg-fan.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,14 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
488488
return -EINVAL;
489489
}
490490

491-
err = mlxreg_pwm_connect_verify(fan, data);
492-
if (err)
493-
return err;
491+
/* Validate if more then one PWM is connected. */
492+
if (pwm_num) {
493+
err = mlxreg_pwm_connect_verify(fan, data);
494+
if (err < 0)
495+
return err;
496+
else if (!err)
497+
continue;
498+
}
494499

495500
fan->pwm[pwm_num].reg = data->reg;
496501
fan->pwm[pwm_num].connected = true;

0 commit comments

Comments
 (0)