Skip to content

Commit

Permalink
hwmon: (mlxreg-fan) Modify PWM connectivity validation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vadimp-nvidia authored and groeck committed Oct 12, 2021
1 parent 1508fb2 commit b1c2423
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/hwmon/mlxreg-fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,14 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
return -EINVAL;
}

err = mlxreg_pwm_connect_verify(fan, data);
if (err)
return err;
/* Validate if more then one PWM is connected. */
if (pwm_num) {
err = mlxreg_pwm_connect_verify(fan, data);
if (err < 0)
return err;
else if (!err)
continue;
}

fan->pwm[pwm_num].reg = data->reg;
fan->pwm[pwm_num].connected = true;
Expand Down

0 comments on commit b1c2423

Please sign in to comment.