diff options
-rw-r--r-- | board/quawks/build.mk | 2 | ||||
-rw-r--r-- | board/quawks/thermal_shutdown.c | 47 |
2 files changed, 48 insertions, 1 deletions
diff --git a/board/quawks/build.mk b/board/quawks/build.mk index d3bca1d912..94cb6192a2 100644 --- a/board/quawks/build.mk +++ b/board/quawks/build.mk @@ -9,4 +9,4 @@ # the IC is TI Stellaris LM4 CHIP:=lm4 -board-y=battery.o board.o led.o +board-y=battery.o board.o led.o thermal_shutdown.o diff --git a/board/quawks/thermal_shutdown.c b/board/quawks/thermal_shutdown.c new file mode 100644 index 0000000000..9730363d9e --- /dev/null +++ b/board/quawks/thermal_shutdown.c @@ -0,0 +1,47 @@ +/* Copyright (c) 2014 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. + */ + +/* + * Pure hardware thermal shutdown via TMP432 for Quawks. + */ + +#include "board.h" +#include "console.h" +#include "hooks.h" +#include "tmp432.h" +#include "i2c.h" + +#define CPRINTF(format, args...) cprintf(CC_THERMAL, format, ## args) + +#define THERMAL_SHUTDOWN_TEMP 76 + +/** + * Set pure hardware thermal shutdown temperature via TMP432. + * + * The target temperature value is set in board.h. + */ +static void set_pure_hardware_thermal_shutdown_temp(void) +{ + int value; + + if ( i2c_write8( + I2C_PORT_THERMAL, + TMP432_I2C_ADDR, + TMP432_LOCAL_THERM_LIMIT, THERMAL_SHUTDOWN_TEMP) >= 0 && + i2c_read8( + I2C_PORT_THERMAL, + TMP432_I2C_ADDR, + TMP432_LOCAL_THERM_LIMIT, &value) >= 0) + { + CPRINTF("[%T TMP432_LOCAL_THERM_LIMIT now = %dC]\n", value); + } + else + { + CPRINTF("[%T Failed to set shutdown temp!!]\n"); + } +} +DECLARE_HOOK( HOOK_CHIPSET_STARTUP, + set_pure_hardware_thermal_shutdown_temp, + HOOK_PRIO_DEFAULT); |