Files
OpenCellular/board/host/fan.c
Bill Richardson 41cde66516 Samus: Handle fan startup in the EC, not the fan controller
The fans on samus have a recommended minimum duty cycle of 20%
while running, but 30% in order to start. We've been using the
EC's built-in fan controller for the start requirement, but it
has a minimum fast-start duty cycle of 50%. It turns out that
that speed is noticeably noisy.

This change handles the startup with logic in the EC instead, so
that the fan only tries to spin at 30% initially (or if it drops
too much below the minimum turning speed).

BUG=chrome-os-partner:33429
BRANCH=ToT,samus
TEST=make buildall -j

Boot the system, let it idle with the browser windows closed, the
browse a bit, then idle. Listen for changes to the fans.

Before, I could hear the fans kick in and out as the AP load
changed. Now it's much quieter.

Change-Id: Id35215520c064eb6843686ec8bb5f3618dac6cf6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/227658
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-11-06 02:28:22 +00:00

81 lines
1.3 KiB
C

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Mocked fan implementation for tests */
#include "fan.h"
#include "util.h"
const struct fan_t fans[] = {
{.flags = FAN_USE_RPM_MODE,
.rpm_min = 1000,
.rpm_start = 1500,
.rpm_max = 5000,
.ch = 0,
.pgood_gpio = -1,
.enable_gpio = -1,
},
};
BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS);
static int mock_enabled;
void fan_set_enabled(int ch, int enabled)
{
mock_enabled = enabled;
}
int fan_get_enabled(int ch)
{
return mock_enabled;
}
static int mock_percent;
void fan_set_duty(int ch, int percent)
{
mock_percent = percent;
}
int fan_get_duty(int ch)
{
return mock_percent;
}
static int mock_rpm_mode;
void fan_set_rpm_mode(int ch, int rpm_mode)
{
mock_rpm_mode = rpm_mode;
}
int fan_get_rpm_mode(int ch)
{
return mock_rpm_mode;
}
int mock_rpm;
void fan_set_rpm_target(int ch, int rpm)
{
mock_rpm = rpm;
}
int fan_get_rpm_actual(int ch)
{
return mock_rpm;
}
int fan_get_rpm_target(int ch)
{
return mock_rpm;
}
enum fan_status fan_get_status(int ch)
{
return FAN_STATUS_LOCKED;
}
int fan_is_stalled(int ch)
{
return 0;
}
void fan_channel_setup(int ch, unsigned int flags)
{
/* nothing to do */
}