summaryrefslogtreecommitdiff
path: root/board/morphius/thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/morphius/thermal.c')
-rw-r--r--board/morphius/thermal.c223
1 files changed, 123 insertions, 100 deletions
diff --git a/board/morphius/thermal.c b/board/morphius/thermal.c
index e7f976f681..019e377aca 100644
--- a/board/morphius/thermal.c
+++ b/board/morphius/thermal.c
@@ -55,39 +55,39 @@ static const struct fan_step fan1_table_clamshell[] = {
},
{
/* level 2 */
- .on = {-1, -1, 47, -1},
- .off = {-1, -1, 45, -1},
- .rpm = {2600},
+ .on = {-1, -1, 45, -1},
+ .off = {-1, -1, 43, -1},
+ .rpm = {2900},
},
{
/* level 3 */
- .on = {-1, -1, 50, -1},
- .off = {-1, -1, 48, -1},
- .rpm = {3400},
+ .on = {-1, -1, 48, -1},
+ .off = {-1, -1, 46, -1},
+ .rpm = {3200},
},
{
/* level 4 */
- .on = {-1, -1, 53, -1},
- .off = {-1, -1, 51, -1},
- .rpm = {3800},
+ .on = {-1, -1, 51, -1},
+ .off = {-1, -1, 49, -1},
+ .rpm = {3550},
},
{
/* level 5 */
- .on = {-1, -1, 56, -1},
- .off = {-1, -1, 54, -1},
- .rpm = {4200},
+ .on = {-1, -1, 54, -1},
+ .off = {-1, -1, 52, -1},
+ .rpm = {3950},
},
{
/* level 6 */
- .on = {-1, -1, 59, -1},
- .off = {-1, -1, 57, -1},
- .rpm = {4500},
+ .on = {-1, -1, 57, -1},
+ .off = {-1, -1, 55, -1},
+ .rpm = {4250},
},
{
/* level 7 */
- .on = {-1, -1, 62, -1},
- .off = {-1, -1, 60, -1},
- .rpm = {4850},
+ .on = {-1, -1, 60, -1},
+ .off = {-1, -1, 58, -1},
+ .rpm = {4650},
},
};
@@ -100,44 +100,44 @@ static const struct fan_step fan1_table_tablet[] = {
},
{
/* level 1 */
- .on = {-1, -1, 45, -1},
+ .on = {-1, -1, 41, -1},
.off = {-1, -1, 31, -1},
- .rpm = {1900},
+ .rpm = {2100},
},
{
/* level 2 */
- .on = {-1, -1, 48, -1},
- .off = {-1, -1, 46, -1},
+ .on = {-1, -1, 50, -1},
+ .off = {-1, -1, 48, -1},
.rpm = {2600},
},
{
/* level 3 */
- .on = {-1, -1, 52, -1},
- .off = {-1, -1, 49, -1},
- .rpm = {3000},
+ .on = {-1, -1, 54, -1},
+ .off = {-1, -1, 52, -1},
+ .rpm = {2800},
},
{
/* level 4 */
- .on = {-1, -1, 56, -1},
- .off = {-1, -1, 53, -1},
- .rpm = {3400},
+ .on = {-1, -1, 57, -1},
+ .off = {-1, -1, 55, -1},
+ .rpm = {3300},
},
{
/* level 5 */
.on = {-1, -1, 60, -1},
- .off = {-1, -1, 57, -1},
- .rpm = {3750},
+ .off = {-1, -1, 58, -1},
+ .rpm = {3800},
},
{
/* level 6 */
- .on = {-1, -1, 64, -1},
- .off = {-1, -1, 61, -1},
+ .on = {-1, -1, 72, -1},
+ .off = {-1, -1, 69, -1},
.rpm = {4000},
},
{
/* level 7 */
- .on = {-1, -1, 68, -1},
- .off = {-1, -1, 65, -1},
+ .on = {-1, -1, 74, -1},
+ .off = {-1, -1, 73, -1},
.rpm = {4300},
},
};
@@ -151,45 +151,45 @@ static const struct fan_step fan1_table_stand[] = {
},
{
/* level 1 */
- .on = {-1, -1, 38, -1},
+ .on = {-1, -1, 34, -1},
.off = {-1, -1, 31, -1},
.rpm = {1850},
},
{
/* level 2 */
- .on = {-1, -1, 45, -1},
- .off = {-1, -1, 42, -1},
+ .on = {-1, -1, 42, -1},
+ .off = {-1, -1, 39, -1},
.rpm = {2550},
},
{
/* level 3 */
.on = {-1, -1, 49, -1},
- .off = {-1, -1, 46, -1},
- .rpm = {3000},
+ .off = {-1, -1, 48, -1},
+ .rpm = {2900},
},
{
/* level 4 */
- .on = {-1, -1, 53, -1},
+ .on = {-1, -1, 51, -1},
.off = {-1, -1, 50, -1},
- .rpm = {3450},
+ .rpm = {3350},
},
{
/* level 5 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 54, -1},
- .rpm = {3800},
+ .on = {-1, -1, 53, -1},
+ .off = {-1, -1, 52, -1},
+ .rpm = {3700},
},
{
/* level 6 */
- .on = {-1, -1, 61, -1},
- .off = {-1, -1, 58, -1},
- .rpm = {4050},
+ .on = {-1, -1, 55, -1},
+ .off = {-1, -1, 54, -1},
+ .rpm = {3900},
},
{
/* level 7 */
- .on = {-1, -1, 65, -1},
- .off = {-1, -1, 62, -1},
- .rpm = {4400},
+ .on = {-1, -1, 57, -1},
+ .off = {-1, -1, 56, -1},
+ .rpm = {4250},
},
};
@@ -202,45 +202,45 @@ static const struct fan_step fan0_table_clamshell[] = {
},
{
/* level 1 */
- .on = {-1, -1, 40, -1},
+ .on = {-1, -1, 41, -1},
.off = {-1, -1, 31, -1},
- .rpm = {2200},
+ .rpm = {2350},
},
{
/* level 2 */
+ .on = {-1, -1, 44, -1},
+ .off = {-1, -1, 42, -1},
+ .rpm = {3300},
+ },
+ {
+ /* level 3 */
.on = {-1, -1, 47, -1},
.off = {-1, -1, 45, -1},
- .rpm = {3000},
+ .rpm = {3600},
},
{
- /* level 3 */
+ /* level 4 */
.on = {-1, -1, 50, -1},
.off = {-1, -1, 48, -1},
- .rpm = {3350},
+ .rpm = {4050},
},
{
- /* level 4 */
+ /* level 5 */
.on = {-1, -1, 53, -1},
.off = {-1, -1, 51, -1},
- .rpm = {4000},
- },
- {
- /* level 5 */
- .on = {-1, -1, 56, -1},
- .off = {-1, -1, 54, -1},
.rpm = {4450},
},
{
/* level 6 */
- .on = {-1, -1, 59, -1},
- .off = {-1, -1, 57, -1},
+ .on = {-1, -1, 56, -1},
+ .off = {-1, -1, 54, -1},
.rpm = {4750},
},
{
/* level 7 */
- .on = {-1, -1, 62, -1},
- .off = {-1, -1, 60, -1},
- .rpm = {5000},
+ .on = {-1, -1, 59, -1},
+ .off = {-1, -1, 57, -1},
+ .rpm = {5150},
},
};
@@ -253,45 +253,45 @@ static const struct fan_step fan0_table_tablet[] = {
},
{
/* level 1 */
- .on = {-1, -1, 45, -1},
+ .on = {-1, -1, 41, -1},
.off = {-1, -1, 31, -1},
- .rpm = {2200},
+ .rpm = {2250},
},
{
/* level 2 */
- .on = {-1, -1, 48, -1},
- .off = {-1, -1, 46, -1},
+ .on = {-1, -1, 50, -1},
+ .off = {-1, -1, 48, -1},
.rpm = {2850},
},
{
/* level 3 */
- .on = {-1, -1, 52, -1},
- .off = {-1, -1, 49, -1},
- .rpm = {3200},
+ .on = {-1, -1, 54, -1},
+ .off = {-1, -1, 51, -1},
+ .rpm = {3100},
},
{
/* level 4 */
- .on = {-1, -1, 56, -1},
- .off = {-1, -1, 53, -1},
- .rpm = {3600},
+ .on = {-1, -1, 57, -1},
+ .off = {-1, -1, 55, -1},
+ .rpm = {3500},
},
{
/* level 5 */
.on = {-1, -1, 60, -1},
- .off = {-1, -1, 57, -1},
- .rpm = {4000},
+ .off = {-1, -1, 58, -1},
+ .rpm = {3900},
},
{
/* level 6 */
- .on = {-1, -1, 64, -1},
- .off = {-1, -1, 61, -1},
- .rpm = {4300},
+ .on = {-1, -1, 72, -1},
+ .off = {-1, -1, 69, -1},
+ .rpm = {4150},
},
{
/* level 7 */
- .on = {-1, -1, 68, -1},
- .off = {-1, -1, 65, -1},
- .rpm = {4550},
+ .on = {-1, -1, 74, -1},
+ .off = {-1, -1, 73, -1},
+ .rpm = {4400},
},
};
@@ -304,51 +304,52 @@ static const struct fan_step fan0_table_stand[] = {
},
{
/* level 1 */
- .on = {-1, -1, 38, -1},
+ .on = {-1, -1, 34, -1},
.off = {-1, -1, 31, -1},
- .rpm = {2150},
+ .rpm = {2250},
},
{
/* level 2 */
- .on = {-1, -1, 45, -1},
- .off = {-1, -1, 42, -1},
- .rpm = {2900},
+ .on = {-1, -1, 42, -1},
+ .off = {-1, -1, 39, -1},
+ .rpm = {2800},
},
{
/* level 3 */
.on = {-1, -1, 49, -1},
- .off = {-1, -1, 46, -1},
+ .off = {-1, -1, 48, -1},
.rpm = {3150},
},
{
/* level 4 */
- .on = {-1, -1, 53, -1},
+ .on = {-1, -1, 51, -1},
.off = {-1, -1, 50, -1},
- .rpm = {3600},
+ .rpm = {3550},
},
{
/* level 5 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 54, -1},
+ .on = {-1, -1, 53, -1},
+ .off = {-1, -1, 52, -1},
.rpm = {3900},
},
{
/* level 6 */
- .on = {-1, -1, 61, -1},
- .off = {-1, -1, 58, -1},
+ .on = {-1, -1, 55, -1},
+ .off = {-1, -1, 54, -1},
.rpm = {4150},
},
{
/* level 7 */
- .on = {-1, -1, 65, -1},
- .off = {-1, -1, 62, -1},
- .rpm = {4450},
+ .on = {-1, -1, 57, -1},
+ .off = {-1, -1, 56, -1},
+ .rpm = {4400},
},
};
#define NUM_FAN_LEVELS ARRAY_SIZE(fan1_table_clamshell)
#define lid_angle_tablet 340
+static int throttle_on;
BUILD_ASSERT(ARRAY_SIZE(fan1_table_clamshell) ==
ARRAY_SIZE(fan1_table_tablet));
@@ -491,3 +492,25 @@ void board_override_fan_control(int fan, int *tmp)
}
}
}
+
+void thermal_protect(void)
+{
+ int thermal_sensor1, thermal_sensor2;
+
+ temp_sensor_read(TEMP_SENSOR_5V_REGULATOR, &thermal_sensor1);
+ temp_sensor_read(TEMP_SENSOR_CPU, &thermal_sensor2);
+
+ if ((!lid_is_open()) && (!extpower_is_present())) {
+ if (thermal_sensor2 > C_TO_K(70)) {
+ chipset_throttle_cpu(1);
+ throttle_on = 1;
+ } else if (thermal_sensor2 < C_TO_K(60) && throttle_on) {
+ chipset_throttle_cpu(0);
+ throttle_on = 0;
+ }
+
+ if (thermal_sensor1 > C_TO_K(51))
+ chipset_force_shutdown(CHIPSET_SHUTDOWN_THERMAL);
+ }
+}
+DECLARE_HOOK(HOOK_SECOND, thermal_protect, HOOK_PRIO_DEFAULT);