From a206d3b51d6116181f774a279e783df5dfabc9be Mon Sep 17 00:00:00 2001 From: Daniel Geiger Date: Wed, 6 Sep 2017 12:29:30 -0500 Subject: Handle monitoring chassis fans having a maximum rpm other than 2000. Licensed under the GPLv2+. --- common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp b/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp index 55fa5ca..7faec4c 100644 --- a/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp +++ b/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp @@ -289,6 +289,7 @@ int fan_to_pwm_map[] = {0, 1}; #define REAR_FAN_OFFSET 1 #elif defined(CONFIG_ASUS) +float fan_scale_speed_map[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; // Chassis fans may have a different max rpm than 2000; scale the stock profile accordingly. int fan_population_map[] = {1, 1, 1, 1, 1, 1, 1, 1}; // 1 == fan populated, 0 == fan disconnected int fan_to_rpm_map[] = {1, 2, 3, 4, 5, 6, 7, 8}; int fan_to_pwm_map[] = {1, 1, 2, 2, 2, 2, 2, 2}; // 1 == 4 pin fans, 2 == 3 pin fans @@ -818,7 +819,8 @@ int fan_speed_okay(const int fan, const int speed, const int slop) { front_pct = fan_rpm_to_pct(rpm_front_map, FRONT_MAP_SIZE, real_fan_speed); } else { - front_pct = fan_rpm_to_pct(rpm_rear_map, REAR_MAP_SIZE, real_fan_speed); + float scale = fan_scale_speed_map[fan]; + front_pct = fan_rpm_to_pct(rpm_rear_map, REAR_MAP_SIZE, (int)(((float)real_fan_speed) / scale)); } front_fan = real_fan_speed; #else -- cgit v1.1