diff options
Diffstat (limited to 'board/nipperkin')
-rw-r--r-- | board/nipperkin/board.c | 29 | ||||
-rw-r--r-- | board/nipperkin/board.h | 10 | ||||
-rw-r--r-- | board/nipperkin/led.c | 24 | ||||
-rw-r--r-- | board/nipperkin/thermal.c | 19 |
4 files changed, 62 insertions, 20 deletions
diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c index a065dad5c0..3fe31fdfd8 100644 --- a/board/nipperkin/board.c +++ b/board/nipperkin/board.c @@ -16,7 +16,7 @@ #include "driver/retimer/ps8811.h" #include "driver/retimer/ps8818.h" #include "driver/temp_sensor/sb_tsi.h" -#include "driver/temp_sensor/tmp112.h" +#include "driver/temp_sensor/pct2075.h" #include "extpower.h" #include "gpio.h" #include "hooks.h" @@ -28,7 +28,6 @@ #include "tablet_mode.h" #include "temp_sensor.h" #include "temp_sensor/thermistor.h" -#include "temp_sensor/tmp112.h" #include "thermal.h" #include "timer.h" #include "usb_mux.h" @@ -127,10 +126,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me, return rv; /* Enable HPD on the DB */ - gpio_set_level(GPIO_USB_C1_HPD, 1); + ioex_set_level(IOEX_USB_C1_IN_HPD, 1); } else { /* Disable HPD on the DB */ - gpio_set_level(GPIO_USB_C1_HPD, 0); + ioex_set_level(IOEX_USB_C1_IN_HPD, 0); } return rv; @@ -146,7 +145,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); static void board_chipset_startup(void) { if (get_board_version() > 1) - tmp112_init(); + pct2075_init(); } DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT); @@ -156,7 +155,7 @@ int board_get_soc_temp_k(int idx, int *temp_k) if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) return EC_ERROR_NOT_POWERED; - return tmp112_get_val_k(idx, temp_k); + return pct2075_get_val_k(idx, temp_k); } int board_get_soc_temp_mk(int *temp_mk) @@ -164,7 +163,7 @@ int board_get_soc_temp_mk(int *temp_mk) if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) return EC_ERROR_NOT_POWERED; - return tmp112_get_val_mk(TMP112_SOC, temp_mk); + return pct2075_get_val_mk(PCT2075_SOC, temp_mk); } int board_get_ambient_temp_mk(int *temp_mk) @@ -172,7 +171,7 @@ int board_get_ambient_temp_mk(int *temp_mk) if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) return EC_ERROR_NOT_POWERED; - return tmp112_get_val_mk(TMP112_AMB, temp_mk); + return pct2075_get_val_mk(PCT2075_AMB, temp_mk); } /* ADC Channels */ @@ -218,18 +217,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* Temp Sensors */ static int board_get_temp(int, int *); -const struct tmp112_sensor_t tmp112_sensors[] = { - { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS0 }, - { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS1 }, +const struct pct2075_sensor_t pct2075_sensors[] = { + { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS0 }, + { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS7 }, }; -BUILD_ASSERT(ARRAY_SIZE(tmp112_sensors) == TMP112_COUNT); +BUILD_ASSERT(ARRAY_SIZE(pct2075_sensors) == PCT2075_COUNT); const struct temp_sensor_t temp_sensors[] = { [TEMP_SENSOR_SOC] = { .name = "SOC", .type = TEMP_SENSOR_TYPE_BOARD, .read = board_get_soc_temp_k, - .idx = TMP112_SOC, + .idx = PCT2075_SOC, }, [TEMP_SENSOR_CHARGER] = { .name = "Charger", @@ -258,8 +257,8 @@ const struct temp_sensor_t temp_sensors[] = { [TEMP_SENSOR_AMBIENT] = { .name = "Ambient", .type = TEMP_SENSOR_TYPE_BOARD, - .read = tmp112_get_val_k, - .idx = TMP112_AMB, + .read = pct2075_get_val_k, + .idx = PCT2075_AMB, }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); diff --git a/board/nipperkin/board.h b/board/nipperkin/board.h index f9495857d5..6521188c20 100644 --- a/board/nipperkin/board.h +++ b/board/nipperkin/board.h @@ -40,6 +40,9 @@ #define CONFIG_LED_COMMON #define CONFIG_LED_ONOFF_STATES +/* Thermal Config */ +#define CONFIG_TEMP_SENSOR_PCT2075 + #ifndef __ASSEMBLER__ #include "gpio_signal.h" @@ -73,6 +76,13 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; +/* PCT2075 sensors */ +enum pct2075_sensor { + PCT2075_SOC, + PCT2075_AMB, + PCT2075_COUNT, +}; + #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ diff --git a/board/nipperkin/led.c b/board/nipperkin/led.c index 59d03dbe83..93131400d2 100644 --- a/board/nipperkin/led.c +++ b/board/nipperkin/led.c @@ -167,18 +167,32 @@ static void led_set_battery(void) if (charge_get_percent() < 10) led_set_color_battery(LED_RIGHT_PORT, (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_WHITE : LED_OFF); + < LED_ON_TICKS) ? LED_AMBER : LED_OFF); else led_set_color_battery(LED_RIGHT_PORT, LED_OFF); } - if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) - led_set_color_battery(LED_LEFT_PORT, LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { + if (charge_get_percent() < 10) + led_set_color_battery(LED_LEFT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE + < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + else + led_set_color_battery(LED_LEFT_PORT, LED_OFF); + } break; case PWR_STATE_ERROR: - set_active_port_color((battery_ticks & 0x2) ? - LED_WHITE : LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { + led_set_color_battery(LED_RIGHT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); + } + + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { + led_set_color_battery(LED_LEFT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); + } break; + case PWR_STATE_CHARGE_NEAR_FULL: set_active_port_color(LED_WHITE); break; diff --git a/board/nipperkin/thermal.c b/board/nipperkin/thermal.c index 7266e80b14..3ead6da3e5 100644 --- a/board/nipperkin/thermal.c +++ b/board/nipperkin/thermal.c @@ -18,6 +18,25 @@ #define CPUTS(outstr) cputs(CC_THERMAL, outstr) #define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args) +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = MFT_CH_0, /* Use MFT id to control fan */ + .pgood_gpio = GPIO_S0_PGOOD, + .enable_gpio = -1, +}; +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 6500, +}; +const struct fan_t fans[] = { + [FAN_CH_0] = { + .conf = &fan_conf_0, + .rpm = &fan_rpm_0, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); + struct fan_step { /* * Sensor 1~4 trigger point, set -1 if we're not using this |