summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-03-05 09:49:40 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-06 09:59:21 -0800
commit7f4018c41f875c7fbdff03ee4a489753d541b0a9 (patch)
treecf8542ac7aac61530afecbc5161a660ccf335ccf /chip
parent9ea3cbecb8d3fca58baf4aff8d7e97480fe25860 (diff)
downloadchrome-ec-7f4018c41f875c7fbdff03ee4a489753d541b0a9.tar.gz
fan: Allow board to configure fans at run time
This patch splits struct fan_t into two parts: base configuration and RPM configuration. RPMs are expected to be different from model to model while a base configuration is most likely shared. BUG=b:73720175 BRANCH=none TEST=make buildall Change-Id: Iff17573f110e07e88d097dd848cf91ee98b83176 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949382 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/it83xx/fan.c16
-rw-r--r--chip/npcx/fan.c8
2 files changed, 12 insertions, 12 deletions
diff --git a/chip/it83xx/fan.c b/chip/it83xx/fan.c
index d412e14123..d8cf010695 100644
--- a/chip/it83xx/fan.c
+++ b/chip/it83xx/fan.c
@@ -98,7 +98,7 @@ static int fan_all_disabled(void)
int fan, all_disabled = 0;
for (fan = 0; fan < CONFIG_FANS; fan++) {
- if (!fan_get_enabled(fans[fan].ch))
+ if (!fan_get_enabled(FAN_CH(fan)))
all_disabled++;
}
@@ -423,9 +423,9 @@ 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++) {
- if (fan_get_enabled(fans[fan].ch)) {
- proc_tach(fans[fan].ch);
- fan_ctrl(fans[fan].ch);
+ if (fan_get_enabled(FAN_CH(fan))) {
+ proc_tach(FAN_CH(fan));
+ fan_ctrl(FAN_CH(fan));
}
}
}
@@ -437,10 +437,10 @@ static void fan_init(void)
for (ch = 0; ch < CONFIG_FANS; ch++) {
- rpm_re = fan_tach[pwm_channels[fans[ch].ch].channel].rpm_re;
- fan_p = fan_tach[pwm_channels[fans[ch].ch].channel].fan_p;
- s_duty = fan_tach[pwm_channels[fans[ch].ch].channel].s_duty;
- tach_ch = tach_bind(fans[ch].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;
+ s_duty = fan_tach[pwm_channels[FAN_CH(ch)].channel].s_duty;
+ tach_ch = tach_bind(FAN_CH(ch));
if (tach_ch < TACH_CH_COUNT) {
diff --git a/chip/npcx/fan.c b/chip/npcx/fan.c
index db5abd1742..4f0e555426 100644
--- a/chip/npcx/fan.c
+++ b/chip/npcx/fan.c
@@ -491,10 +491,10 @@ void fan_set_rpm_target(int ch, int rpm)
/* If rpm = 0, disable PWM */
if (rpm == 0)
fan_set_duty(ch, 0);
- else if (rpm > fans[ch].rpm_max)
- rpm = fans[ch].rpm_max;
- else if (rpm < fans[ch].rpm_min)
- rpm = fans[ch].rpm_min;
+ else if (rpm > fans[ch].rpm->rpm_max)
+ rpm = fans[ch].rpm->rpm_max;
+ else if (rpm < fans[ch].rpm->rpm_min)
+ rpm = fans[ch].rpm->rpm_min;
/* Set target rpm */
fan_status[ch].rpm_target = rpm;