From 5f387dc61b6727b0971ab8bbaa795f275ec2e8c2 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 30 Aug 2017 13:58:59 -0500 Subject: Add platform fan present map to fand --- common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp | 32 +++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp b/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp index a7ebfd6..55fa5ca 100644 --- a/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp +++ b/common/recipes-core/fan-ctrl/fan-ctrl/fand.cpp @@ -264,30 +264,34 @@ const char *fan_led[] = {FAN0_LED, FAN1_LED, FAN2_LED, FAN3_LED, */ #if defined(CONFIG_WEDGE100) -int fan_to_rpm_map[] = {1, 3, 5, 7, 9}; -int fan_to_pwm_map[] = {1, 2, 3, 4, 5}; +int fan_population_map[] = {1, 1, 1, 1, 1}; +int fan_to_rpm_map[] = {1, 3, 5, 7, 9}; +int fan_to_pwm_map[] = {1, 2, 3, 4, 5}; #define FANS 5 // Tacho offset between front and rear fans: #define REAR_FAN_OFFSET 1 #define BACK_TO_BACK_FANS #elif defined(CONFIG_WEDGE) -int fan_to_rpm_map[] = {3, 2, 0, 1}; -int fan_to_pwm_map[] = {7, 6, 0, 1}; +int fan_population_map[] = {1, 1, 1, 1}; +int fan_to_rpm_map[] = {3, 2, 0, 1}; +int fan_to_pwm_map[] = {7, 6, 0, 1}; #define FANS 4 // Tacho offset between front and rear fans: #define REAR_FAN_OFFSET 4 #define BACK_TO_BACK_FANS #elif defined(CONFIG_YOSEMITE) -int fan_to_rpm_map[] = {0, 1}; -int fan_to_pwm_map[] = {0, 1}; +int fan_population_map[] = {1, 1}; +int fan_to_rpm_map[] = {0, 1}; +int fan_to_pwm_map[] = {0, 1}; #define FANS 2 // Tacho offset between front and rear fans: #define REAR_FAN_OFFSET 1 #elif defined(CONFIG_ASUS) -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 +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 #define FANS 8 #endif @@ -1523,6 +1527,9 @@ int main(int argc, char **argv) { if (!cpu2_installed && (fan == 1)) { continue; } + if (fan_population_map[fan] == 0) { + continue; + } /* * Make sure that we're within some percentage * of the requested speed. @@ -1553,6 +1560,9 @@ int main(int argc, char **argv) { if (!cpu2_installed && (fan == 1)) { continue; } + if (fan_population_map[fan] == 0) { + continue; + } if (fan_bad[fan] > FAN_FAILURE_THRESHOLD) { fan_failure++; write_fan_led(fan + fan_offset, FAN_LED_RED); @@ -1580,6 +1590,9 @@ int main(int argc, char **argv) { if (!cpu2_installed && (fan == 1)) { continue; } + if (fan_population_map[fan] == 0) { + continue; + } write_fan_speed(fan + fan_offset, fan_max); } @@ -1598,6 +1611,9 @@ int main(int argc, char **argv) { if (!cpu2_installed && (fan == 1)) { continue; } + if (fan_population_map[fan] == 0) { + continue; + } if (fan_bad[fan] > FAN_SHUTDOWN_THRESHOLD) count++; } -- cgit v1.1