summaryrefslogtreecommitdiff
path: root/board/gimble/thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/gimble/thermal.c')
-rw-r--r--board/gimble/thermal.c68
1 files changed, 32 insertions, 36 deletions
diff --git a/board/gimble/thermal.c b/board/gimble/thermal.c
index 25e7bf2c00..37184f92f2 100644
--- a/board/gimble/thermal.c
+++ b/board/gimble/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,7 @@
#include "util.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
-
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -42,45 +40,45 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {43, -1, -1},
- .off = {0, -1, -1},
- .rpm = {0},
- .rpm_tablet = {0},
+ .on = { 43, -1, -1 },
+ .off = { 0, -1, -1 },
+ .rpm = { 0 },
+ .rpm_tablet = { 0 },
},
{
/* level 1 */
- .on = {45, -1, -1},
- .off = {43, -1, -1},
- .rpm = {3400},
- .rpm_tablet = {3400},
+ .on = { 45, -1, -1 },
+ .off = { 43, -1, -1 },
+ .rpm = { 3400 },
+ .rpm_tablet = { 3400 },
},
{
/* level 2 */
- .on = {46, -1, -1},
- .off = {44, -1, -1},
- .rpm = {3800},
- .rpm_tablet = {3700},
+ .on = { 46, -1, -1 },
+ .off = { 44, -1, -1 },
+ .rpm = { 3800 },
+ .rpm_tablet = { 3700 },
},
{
/* level 3 */
- .on = {48, -1, -1},
- .off = {45, -1, -1},
- .rpm = {4200},
- .rpm_tablet = {4100},
+ .on = { 48, -1, -1 },
+ .off = { 45, -1, -1 },
+ .rpm = { 4200 },
+ .rpm_tablet = { 4100 },
},
{
/* level 4 */
- .on = {50, -1, -1},
- .off = {47, -1, -1},
- .rpm = {4800},
- .rpm_tablet = {4800},
+ .on = { 50, -1, -1 },
+ .off = { 47, -1, -1 },
+ .rpm = { 4800 },
+ .rpm_tablet = { 4800 },
},
{
/* level 5 */
- .on = {52, -1, -1},
- .off = {49, -1, -1},
- .rpm = {5400},
- .rpm_tablet = {5200},
+ .on = { 52, -1, -1 },
+ .off = { 49, -1, -1 },
+ .rpm = { 5400 },
+ .rpm_tablet = { 5200 },
},
};
const int num_fan_levels = ARRAY_SIZE(fan_table);
@@ -106,18 +104,15 @@ int fan_table_to_rpm(int fan, int *temp, enum temp_sensor_id temp_sensor)
*/
if (temp[temp_sensor] < prev_temp[temp_sensor]) {
for (i = current_level; i > 0; i--) {
- if (temp[temp_sensor] <
- fan_table[i].off[temp_sensor])
+ if (temp[temp_sensor] < fan_table[i].off[temp_sensor])
current_level = i - 1;
else
break;
}
- } else if (temp[temp_sensor] >
- prev_temp[temp_sensor]) {
+ } else if (temp[temp_sensor] > prev_temp[temp_sensor]) {
for (i = current_level; i < num_fan_levels; i++) {
- if (temp[temp_sensor] >
- fan_table[i].on[temp_sensor])
- current_level = i + 1;
+ if (temp[temp_sensor] >= fan_table[i].on[temp_sensor])
+ current_level = i;
else
break;
}
@@ -151,7 +146,8 @@ void board_override_fan_control(int fan, int *temp)
if (chipset_in_state(CHIPSET_STATE_ON)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(FAN_CH(fan), temp, TEMP_SENSOR_1_DDR_SOC));
+ fan_table_to_rpm(FAN_CH(fan), temp,
+ TEMP_SENSOR_1_DDR_SOC));
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Stop fan when enter S0ix */
fan_set_rpm_mode(FAN_CH(fan), 1);