summaryrefslogtreecommitdiff
path: root/chip/it83xx
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-10-30 10:55:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-11-19 19:13:54 -0800
commitd38c44b7fd4b0fa3ab742f456994f1a1ef188094 (patch)
tree1e2280470cd48ace5584cd1cbbc5bbf240c5c9a5 /chip/it83xx
parent65b8dcf6da612c774d372c3c29e16923d7f6f379 (diff)
downloadchrome-ec-d38c44b7fd4b0fa3ab742f456994f1a1ef188094.tar.gz
Fan: Allow fan count to be set dynamically
Currently, the fan count is statically set. This patch allows it to be set dynamically so that a single binary can support devices with a different number of fans (including fan-less). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:116588924 BRANCH=none TEST=Boot Fizz with OEM=8. Verify fan spins with OEM=1. Change-Id: I77fc4e07ce2a1be2e288df145857a79c0003542f Reviewed-on: https://chromium-review.googlesource.com/1308257 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'chip/it83xx')
-rw-r--r--chip/it83xx/fan.c8
-rw-r--r--chip/it83xx/pwm.c1
2 files changed, 4 insertions, 5 deletions
diff --git a/chip/it83xx/fan.c b/chip/it83xx/fan.c
index d8cf010695..adb3985025 100644
--- a/chip/it83xx/fan.c
+++ b/chip/it83xx/fan.c
@@ -97,12 +97,12 @@ static int fan_all_disabled(void)
{
int fan, all_disabled = 0;
- for (fan = 0; fan < CONFIG_FANS; fan++) {
+ for (fan = 0; fan < fan_get_count(); fan++) {
if (!fan_get_enabled(FAN_CH(fan)))
all_disabled++;
}
- if (all_disabled >= CONFIG_FANS)
+ if (all_disabled >= fan_get_count())
return 1;
return 0;
@@ -422,7 +422,7 @@ void fan_ext_timer_interrupt(void)
task_clear_pending_irq(et_ctrl_regs[FAN_CTRL_EXT_TIMER].irq);
- for (fan = 0; fan < CONFIG_FANS; fan++) {
+ for (fan = 0; fan < fan_get_count(); fan++) {
if (fan_get_enabled(FAN_CH(fan))) {
proc_tach(FAN_CH(fan));
fan_ctrl(FAN_CH(fan));
@@ -435,7 +435,7 @@ static void fan_init(void)
int ch, rpm_re, fan_p, s_duty;
enum tach_ch_sel tach_ch;
- for (ch = 0; ch < CONFIG_FANS; ch++) {
+ for (ch = 0; ch < fan_get_count(); ch++) {
rpm_re = fan_tach[pwm_channels[FAN_CH(ch)].channel].rpm_re;
fan_p = fan_tach[pwm_channels[FAN_CH(ch)].channel].fan_p;
diff --git a/chip/it83xx/pwm.c b/chip/it83xx/pwm.c
index a2214c127a..fbf9a3f413 100644
--- a/chip/it83xx/pwm.c
+++ b/chip/it83xx/pwm.c
@@ -6,7 +6,6 @@
/* PWM control module for IT83xx. */
#include "clock.h"
-#include "fan.h"
#include "gpio.h"
#include "hooks.h"
#include "pwm.h"