Skip to content

Commit

Permalink
hwmon: (max31790) Fix fan speed reporting for fan7..12
Browse files Browse the repository at this point in the history
[ Upstream commit cbbf244 ]

Fans 7..12 do not have their own set of configuration registers.
So far the code ignored that and read beyond the end of the configuration
register range to get the tachometer period. This resulted in more or less
random fan speed values for those fans.

The datasheet is quite vague when it comes to defining the tachometer
period for fans 7..12. Experiments confirm that the period is the same
for both fans associated with a given set of configuration registers.

Fixes: 54187ff ("hwmon: (max31790) Convert to use new hwmon registration API")
Fixes: 195a4b4 ("hwmon: Driver for Maxim MAX31790")
Cc: Jan Kundrát <jan.kundrat@cesnet.cz>
Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Cc: Václav Kubernát <kubernat@cesnet.cz>
Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210526154022.3223012-2-linux@roeck-us.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
groeck authored and gregkh committed Jul 14, 2021
1 parent dee0472 commit 23c5200
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/max31790.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int max31790_read_fan(struct device *dev, u32 attr, int channel,

switch (attr) {
case hwmon_fan_input:
sr = get_tach_period(data->fan_dynamics[channel]);
sr = get_tach_period(data->fan_dynamics[channel % NR_CHANNEL]);
rpm = RPM_FROM_REG(data->tach[channel], sr);
*val = rpm;
return 0;
Expand Down

0 comments on commit 23c5200

Please sign in to comment.