mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-31 02:51:26 +00:00
samus: Only update fan speeds every N seconds
This adds CONFIG_FAN_UPDATE_PERIOD to limit the frequency at which the fan speeds are updated. Short version: the CPU core temp fluctuates rapidly, causing the fans turn off and on annoyingly often (assuming you have good hearing and are in a quiet room). With this CL, we limit the speed changes to only once every N seconds. N should be long enough to be less annoying, yet short enough that the CPU doesn't overheat while we're not looking. BUG=chrome-os-partner:34789 BRANCH=ToT,samus TEST=manual Let it sit quietly, then visit a busy webpage, then let it sit a while. The fan speed should only change every 10 seconds or so, not every second. Change-Id: Id985350394f24d56dc4a1e51af09487ac643285b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/250501 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
a573a6c0fd
commit
d64bb99149
@@ -53,6 +53,7 @@
|
||||
#define CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
|
||||
#define CONFIG_FANS 2
|
||||
#define CONFIG_FAN_UPDATE_PERIOD 10
|
||||
#define CONFIG_GESTURE_DETECTION
|
||||
#define CONFIG_GESTURE_SAMPLING_INTERVAL_MS 5
|
||||
#undef CONFIG_HIBERNATE_DELAY_SEC
|
||||
|
||||
12
common/fan.c
12
common/fan.c
@@ -19,6 +19,11 @@
|
||||
* things manually. */
|
||||
static int thermal_control_enabled[CONFIG_FANS];
|
||||
|
||||
#ifdef CONFIG_FAN_UPDATE_PERIOD
|
||||
/* Should we ignore the fans for a while? */
|
||||
static int fan_update_counter[CONFIG_FANS];
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_FAN_RPM_CUSTOM
|
||||
/* This is the default implementation. It's only called over [0,100].
|
||||
* Convert the percentage to a target RPM. We can't simply scale all
|
||||
@@ -49,6 +54,13 @@ test_mockable void fan_set_percent_needed(int fan, int pct)
|
||||
if (!thermal_control_enabled[fan])
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_FAN_UPDATE_PERIOD
|
||||
/* Only set each fan every so often, to avoid rapid changes. */
|
||||
fan_update_counter[fan] %= CONFIG_FAN_UPDATE_PERIOD;
|
||||
if (fan_update_counter[fan]++)
|
||||
return;
|
||||
#endif
|
||||
|
||||
new_rpm = fan_percent_to_rpm(fan, pct);
|
||||
actual_rpm = fan_get_rpm_actual(fans[fan].ch);
|
||||
|
||||
|
||||
@@ -551,6 +551,13 @@
|
||||
*/
|
||||
#undef CONFIG_FAN_RPM_CUSTOM
|
||||
|
||||
/*
|
||||
* We normally check and update the fans once per second (HOOK_SECOND). If this
|
||||
* is #defined to a postive integer N, we will only update the fans every N
|
||||
* seconds instead.
|
||||
*/
|
||||
#undef CONFIG_FAN_UPDATE_PERIOD
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Flash configuration */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user