From 88503ab4ec8f68c19d36ec4b6d3516848d71404a Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Fri, 1 Nov 2013 11:11:09 -0700 Subject: Provide multiple fan support within the EC itself This adds explicit "int fan" args to the exported functions from common/fan.c: fan_set_percent_needed() and fan_percent_to_rpm(). Within that file, multiple fans are handled independently. This is not complete, though. Host commands and sysjump support still only handle a single fan, so at the moment multiple fans are treated identically in those cases. BUG=chrome-os-partner:23530 BRANCH=none TEST=manual All boards build, "make runtests" passes. On a multi-fan system, the EC command "faninfo" displays multiple results: > faninfo Fan 0 Actual: 0 rpm Fan 0 Target: 0 rpm Fan 0 Duty: 0% Fan 0 Status: 0 (not spinning) Fan 0 Mode: rpm Fan 0 Auto: yes Fan 0 Enable: yes Fan 1 Actual: 0 rpm Fan 1 Target: 0 rpm Fan 1 Duty: 0% Fan 1 Status: 0 (not spinning) Fan 1 Mode: rpm Fan 1 Auto: no Fan 1 Enable: no > and the "fanduty", "fanset", and "fanauto" all require the fan number as the first arg: > fanduty 0 30 Setting fan 0 duty cycle to 30% > fanset 1 2000 Setting fan 1 rpm target to 2000 > fanauto 0 > fanauto 1 On single-fan systems, there is no visible change. Change-Id: Idb8b818122e157960d56779b2a86e5ba433bee1b Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/175368 Reviewed-by: Randall Spangler --- common/thermal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'common/thermal.c') diff --git a/common/thermal.c b/common/thermal.c index 92b6e170ab..c7840065de 100644 --- a/common/thermal.c +++ b/common/thermal.c @@ -155,8 +155,13 @@ static void thermal_control(void) } #ifdef CONFIG_FANS - /* Max fan needed is what's needed. */ - fan_set_percent_needed(fmax); + /* TODO(crosbug.com/p/23797): For now, we just treat all fans the + * same. It would be better if we could assign different thermal + * profiles to each fan - in case one fan cools the CPU while another + * cools the radios or battery. + */ + for (i = 0; i < CONFIG_FANS; i++) + fan_set_percent_needed(i, fmax); #endif } -- cgit v1.2.1