summaryrefslogtreecommitdiff
path: root/baseboard/zork/baseboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'baseboard/zork/baseboard.c')
-rw-r--r--baseboard/zork/baseboard.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 213a323c6e..8d966369ea 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -25,6 +25,8 @@
#include "driver/temp_sensor/sb_tsi.h"
#include "ec_commands.h"
#include "extpower.h"
+#include "fan.h"
+#include "fan_chip.h"
#include "gpio.h"
#include "hooks.h"
#include "ioexpander.h"
@@ -169,9 +171,44 @@ const struct pwm_t pwm_channels[] = {
.flags = PWM_CONFIG_DSLEEP,
.freq = 100,
},
+ [PWM_CH_FAN] = {
+ .channel = 2,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+/* Physical fans. These are logically separate from pwm_channels. */
+const struct fan_conf fan_conf_0 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .pgood_gpio = -1,
+ .enable_gpio = -1,
+};
+const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 3100,
+ .rpm_start = 3100,
+ .rpm_max = 6900,
+};
+struct fan_t fans[] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
+
+/* MFT channels. These are logically separate from pwm_channels. */
+const struct mft_t mft_channels[] = {
+ [MFT_CH_0] = {
+ .module = NPCX_MFT_MODULE_1,
+ .clk_src = TCKC_LFCLK,
+ .pwm_id = PWM_CH_FAN,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
+
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
[USBC_PORT_C0] = {
.i2c_port = I2C_PORT_TCPC0,
@@ -538,6 +575,27 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
+const static struct ec_thermal_config thermal_a = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(80),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(65),
+ },
+ .temp_fan_off = C_TO_K(25),
+ .temp_fan_max = C_TO_K(50),
+};
+
+struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
+
+static void setup_fans(void)
+{
+ thermal_params[TEMP_SENSOR_CHARGER] = thermal_a;
+ thermal_params[TEMP_SENSOR_SOC] = thermal_a;
+ thermal_params[TEMP_SENSOR_CPU] = thermal_a;
+}
+
#ifdef HAS_TASK_MOTIONSENSE
/* Motion sensors */
@@ -715,3 +773,10 @@ void board_overcurrent_event(int port, int is_overcurrented)
break;
}
}
+
+static void baseboard_init(void)
+{
+ /* Initialize Fans */
+ setup_fans();
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_DEFAULT);