diff options
Diffstat (limited to 'board/nipperkin')
-rw-r--r-- | board/nipperkin/battery.c | 92 | ||||
-rw-r--r-- | board/nipperkin/board.c | 339 | ||||
-rw-r--r-- | board/nipperkin/board.h | 71 | ||||
-rw-r--r-- | board/nipperkin/board_fw_config.c | 30 | ||||
-rw-r--r-- | board/nipperkin/board_fw_config.h | 35 | ||||
-rw-r--r-- | board/nipperkin/build.mk | 12 | ||||
-rw-r--r-- | board/nipperkin/ec.tasklist | 25 | ||||
-rw-r--r-- | board/nipperkin/gpio.inc | 29 | ||||
-rw-r--r-- | board/nipperkin/led.c | 204 | ||||
-rw-r--r-- | board/nipperkin/vif_override.xml | 3 |
10 files changed, 0 insertions, 840 deletions
diff --git a/board/nipperkin/battery.c b/board/nipperkin/battery.c deleted file mode 100644 index 5a3656c734..0000000000 --- a/board/nipperkin/battery.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2021 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. - * - * Battery pack vendor provided charging profile - */ - -#include "battery_fuel_gauge.h" - -/* - * Battery info for all Guybrush battery types. Note that the fields - * start_charging_min/max and charging_min/max are not used for the charger. - * The effective temperature limits are given by discharging_min/max_c. - * - * Fuel Gauge (FG) parameters which are used for determining if the battery - * is connected, the appropriate ship mode (battery cutoff) command, and the - * charge/discharge FETs status. - * - * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery - * register. For some batteries, the charge/discharge FET bits are set when - * charging/discharging is active, in other types, these bits set mean that - * charging/discharging is disabled. Therefore, in addition to the mask for - * these bits, a disconnect value must be specified. Note that for TI fuel - * gauge, the charge/discharge FET status is found in Operation Status (0x54), - * but a read of Manufacturer Access (0x00) will return the lower 16 bits of - * Operation status which contains the FET status bits. - * - * The assumption for battery types supported is that the charge/discharge FET - * status can be read with a sb_read() command and therefore, only the register - * address, mask, and disconnect value need to be provided. - */ -const struct board_batt_params board_battery_info[] = { - /* SMP 996QA193H Battery Information */ - [BATTERY_SIMPLO_HIGHPOWER] = { - .fuel_gauge = { - .manuf_name = "333-1D-11-A", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 13200, /* mV */ - .voltage_normal = 11550, /* mV */ - .voltage_min = 9000, /* mV */ - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -20, - .discharging_max_c = 60, - }, - }, -/* Cosmx CA407792G Battery Information */ - [BATTERY_COSMX] = { - .fuel_gauge = { - .manuf_name = "333-AC-11-A", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 13200, /* mV */ - .voltage_normal = 11550, /* mV */ - .voltage_min = 9000, /* mV */ - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); - -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SIMPLO_HIGHPOWER; diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c deleted file mode 100644 index 42df3c312b..0000000000 --- a/board/nipperkin/board.c +++ /dev/null @@ -1,339 +0,0 @@ -/* Copyright 2021 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. - */ - -/* Nipperkin board-specific configuration */ - -#include "adc.h" -#include "base_fw_config.h" -#include "board_fw_config.h" -#include "button.h" -#include "chipset.h" -#include "common.h" -#include "cros_board_info.h" -#include "driver/retimer/ps8811.h" -#include "driver/retimer/ps8818.h" -#include "driver/temp_sensor/sb_tsi.h" -#include "driver/temp_sensor/tmp112.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "power.h" -#include "power_button.h" -#include "switch.h" -#include "tablet_mode.h" -#include "temp_sensor.h" -#include "temp_sensor/thermistor.h" -#include "temp_sensor/tmp112.h" -#include "thermal.h" -#include "usb_mux.h" - -#include "gpio_list.h" /* Must come after other header files. */ - -/* - * We have total 30 pins for keyboard connecter {-1, -1} mean - * the N/A pin that don't consider it and reserve index 0 area - * that we don't have pin 0. - */ -const int keyboard_factory_scan_pins[][2] = { - {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6}, - {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3}, - {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0}, - {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4}, - {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0}, - {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1}, - {-1, -1}, -}; -const int keyboard_factory_scan_pins_used = - ARRAY_SIZE(keyboard_factory_scan_pins); - -__override enum ec_error_list -board_a1_ps8811_retimer_init(const struct usb_mux *me) -{ - return EC_SUCCESS; -} - -/* - * PS8818 set mux board tuning. - * Adds in board specific gain and DP lane count configuration - * TODO(b/179036200): Adjust PS8818 tuning for guybrush reference - */ -__override int board_c1_ps8818_mux_set(const struct usb_mux *me, - mux_state_t mux_state) -{ - int rv = EC_SUCCESS; - - /* USB specific config */ - if (mux_state & USB_PD_MUX_USB_ENABLED) { - /* Boost the USB gain */ - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX1EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); - if (rv) - return rv; - - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX2EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); - if (rv) - return rv; - - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX1EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); - if (rv) - return rv; - - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX2EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); - if (rv) - return rv; - - /* Set the RX input termination */ - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_RX_PHY, - PS8818_RX_INPUT_TERM_MASK, - PS8818_RX_INPUT_TERM_112_OHM); - if (rv) - return rv; - } - - /* DP specific config */ - if (mux_state & USB_PD_MUX_DP_ENABLED) { - /* Boost the DP gain */ - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_DPEQ_LEVEL, - PS8818_DPEQ_LEVEL_UP_MASK, - PS8818_DPEQ_LEVEL_UP_19DB); - if (rv) - return rv; - - /* Enable HPD on the DB */ - gpio_set_level(GPIO_USB_C1_HPD, 1); - } else { - /* Disable HPD on the DB */ - gpio_set_level(GPIO_USB_C1_HPD, 0); - } - - return rv; -} - -static void board_init(void) -{ -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -static void board_chipset_startup(void) -{ - if (get_board_version() > 1) - tmp112_init(); -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, - HOOK_PRIO_DEFAULT); - -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); -} - -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); -} - -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); -} - -/* ADC Channels */ -const struct adc_t adc_channels[] = { - [ADC_TEMP_SENSOR_MEMORY] = { - .name = "MEMORY", - .input_ch = NPCX_ADC_CH0, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_TEMP_SENSOR_CHARGER] = { - .name = "CHARGER", - .input_ch = NPCX_ADC_CH1, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_TEMP_SENSOR_5V_REGULATOR] = { - .name = "5V_REGULATOR", - .input_ch = NPCX_ADC_CH2, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_CORE_IMON1] = { - .name = "CORE_I", - .input_ch = NPCX_ADC_CH3, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_SOC_IMON2] = { - .name = "SOC_I", - .input_ch = NPCX_ADC_CH4, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, -}; -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 }, -}; -BUILD_ASSERT(ARRAY_SIZE(tmp112_sensors) == TMP112_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, - }, - [TEMP_SENSOR_CHARGER] = { - .name = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_CHARGER, - }, - [TEMP_SENSOR_MEMORY] = { - .name = "Memory", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = board_get_temp, - .idx = ADC_TEMP_SENSOR_MEMORY, - }, - [TEMP_SENSOR_5V_REGULATOR] = { - .name = "5V_REGULATOR", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = board_get_temp, - .idx = ADC_TEMP_SENSOR_5V_REGULATOR, - }, - [TEMP_SENSOR_CPU] = { - .name = "CPU", - .type = TEMP_SENSOR_TYPE_CPU, - .read = sb_tsi_get_val, - .idx = 0, - }, - [TEMP_SENSOR_AMBIENT] = { - .name = "Ambient", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = tmp112_get_val_k, - .idx = TMP112_AMB, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = { - [TEMP_SENSOR_SOC] = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(100), - [EC_TEMP_THRESH_HALT] = C_TO_K(105), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - /* TODO: Setting fan off to 0 so it's allways on */ - .temp_fan_off = C_TO_K(0), - .temp_fan_max = C_TO_K(70), - }, - [TEMP_SENSOR_CHARGER] = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(100), - [EC_TEMP_THRESH_HALT] = C_TO_K(105), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - .temp_fan_off = 0, - .temp_fan_max = 0, - }, - [TEMP_SENSOR_MEMORY] = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(100), - [EC_TEMP_THRESH_HALT] = C_TO_K(105), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - .temp_fan_off = 0, - .temp_fan_max = 0, - }, - [TEMP_SENSOR_CPU] = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(100), - [EC_TEMP_THRESH_HALT] = C_TO_K(105), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - /* - * CPU temp sensor fan thresholds are high because they are a - * backup for the SOC temp sensor fan thresholds. - */ - .temp_fan_off = C_TO_K(60), - .temp_fan_max = C_TO_K(90), - }, - /* - * Note: Leave ambient entries at 0, both as it does not represent a - * hotspot and as not all boards have this sensor - */ -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -static int board_get_temp(int idx, int *temp_k) -{ - if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) - return EC_ERROR_NOT_POWERED; - return get_temp_3v3_30k9_47k_4050b(idx, temp_k); -} - -/* Called on AP resume to S0 */ -static void board_chipset_resume(void) -{ - ioex_set_level(IOEX_HDMI_DATA_EN, 1); - ioex_set_level(IOEX_EN_PWR_HDMI, 1); -} -DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); - -/* Called on AP suspend */ -static void board_chipset_suspend(void) -{ - ioex_set_level(IOEX_EN_PWR_HDMI, 0); - ioex_set_level(IOEX_HDMI_DATA_EN, 0); -} -DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); diff --git a/board/nipperkin/board.h b/board/nipperkin/board.h deleted file mode 100644 index df57cade06..0000000000 --- a/board/nipperkin/board.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2021 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. - */ - -/* Guybrush board configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - -/* Baseboard features */ -#include "baseboard.h" - -/* Motion sensing drivers */ - -/* Keyboard features */ -#define CONFIG_KEYBOARD_FACTORY_TEST - -/* EC console commands */ -#define CONFIG_CMD_BUTTON - -/* USB Type C and USB PD defines */ - -/* USB Type A Features */ - -/* BC 1.2 */ - -/* Volume Button feature */ - -/* Fan features */ - -/* LED features */ -#define CONFIG_LED_COMMON -#define CONFIG_LED_ONOFF_STATES - -#ifndef __ASSEMBLER__ - -#include "gpio_signal.h" -#include "registers.h" - -/* Battery Types */ -enum battery_type { - BATTERY_SIMPLO_HIGHPOWER, - BATTERY_COSMX, - BATTERY_TYPE_COUNT, -}; - -/* ADC Channels */ -enum adc_channel { - ADC_TEMP_SENSOR_MEMORY = 0, - ADC_TEMP_SENSOR_CHARGER, - ADC_TEMP_SENSOR_5V_REGULATOR, - ADC_CORE_IMON1, - ADC_SOC_IMON2, - ADC_CH_COUNT -}; - -/* Temp Sensors */ -enum temp_sensor_id { - TEMP_SENSOR_SOC = 0, - TEMP_SENSOR_CHARGER, - TEMP_SENSOR_MEMORY, - TEMP_SENSOR_5V_REGULATOR, - TEMP_SENSOR_CPU, - TEMP_SENSOR_AMBIENT, - TEMP_SENSOR_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/nipperkin/board_fw_config.c b/board/nipperkin/board_fw_config.c deleted file mode 100644 index c9fa01bc7a..0000000000 --- a/board/nipperkin/board_fw_config.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2021 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. - */ - -#include "base_fw_config.h" -#include "board_fw_config.h" - -bool board_has_kblight(void) -{ - return (get_fw_config_field(FW_CONFIG_KBLIGHT_OFFSET, - FW_CONFIG_KBLIGHT_WIDTH) == FW_CONFIG_KBLIGHT_YES); -} - -enum board_usb_c1_mux board_get_usb_c1_mux(void) -{ - return USB_C1_MUX_PS8818; -}; - -enum board_usb_a1_retimer board_get_usb_a1_retimer(void) -{ - return USB_A1_RETIMER_PS8811; -}; - -bool board_has_privacy_panel(void) -{ - return (get_fw_config_field(FW_CONFIG_KEYBOARD_OFFSET, - FW_CONFIG_KEYBOARD_WIDTH) == - FW_CONFIG_KEYBOARD_PRIVACY_YES); -} diff --git a/board/nipperkin/board_fw_config.h b/board/nipperkin/board_fw_config.h deleted file mode 100644 index 77306ccb6f..0000000000 --- a/board/nipperkin/board_fw_config.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2021 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. - */ - -#ifndef _NIPPERKIN_BOARD_FW_CONFIG__H_ -#define _NIPPERKIN_BOARD_FW_CONFIG__H_ - -/**************************************************************************** - * Nipperkin CBI FW Configuration - */ - -/* - * Keyboard Backlight (1 bit) - */ -#define FW_CONFIG_KBLIGHT_OFFSET 0 -#define FW_CONFIG_KBLIGHT_WIDTH 1 -#define FW_CONFIG_KBLIGHT_NO 0 -#define FW_CONFIG_KBLIGHT_YES 1 - -/* - * Bit 1 ~ 6 not related to EC function - */ - -/* - * Keyboard (1 bit) - */ -#define FW_CONFIG_KEYBOARD_OFFSET 7 -#define FW_CONFIG_KEYBOARD_WIDTH 1 -#define FW_CONFIG_KEYBOARD_PRIVACY_YES 0 -#define FW_CONFIG_KEYBOARD_PRIVACY_NO 1 - -bool board_has_privacy_panel(void); - -#endif /* _NIPPERKIN_BOARD_FW_CONFIG__H_ */ diff --git a/board/nipperkin/build.mk b/board/nipperkin/build.mk deleted file mode 100644 index e4fdcf4afd..0000000000 --- a/board/nipperkin/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# Copyright 2021 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. -# -# Board specific files build -# - -BASEBOARD:=guybrush - -board-y=board.o -board-y+=board_fw_config.o led.o battery.o diff --git a/board/nipperkin/ec.tasklist b/board/nipperkin/ec.tasklist deleted file mode 100644 index ccdff9847c..0000000000 --- a/board/nipperkin/ec.tasklist +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2021 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. - */ - -/* - * See CONFIG_TASK_LIST in config.h for details. - */ - -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, VENTI_TASK_STACK_SIZE) diff --git a/board/nipperkin/gpio.inc b/board/nipperkin/gpio.inc deleted file mode 100644 index ec35ce6c2c..0000000000 --- a/board/nipperkin/gpio.inc +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2021 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. - */ - -/* Declare symbolic names for all the board GPIOs that we care about. */ - -#include "base_gpio.inc" - -/* LED Signals */ -GPIO(C0_CHARGE_LED_AMBER_L, PIN(C, 4), GPIO_OUT_HIGH) -GPIO(C0_CHARGE_LED_WHITE_L, PIN(8, 0), GPIO_OUT_HIGH) -GPIO(C1_CHARGE_LED_AMBER_L, PIN(6, 7), GPIO_OUT_HIGH) -GPIO(C1_CHARGE_LED_WHITE_L, PIN(7, 0), GPIO_OUT_HIGH) - -/* HDMI */ -IOEX(EN_PWR_HDMI, EXPIN(USBC_PORT_C0, 0, 3), GPIO_OUT_LOW) -IOEX(HDMI_DATA_EN, EXPIN(USBC_PORT_C0, 1, 4), GPIO_OUT_LOW) - -/* Test Points */ -GPIO(EC_GPIO56, PIN(5, 6), GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_PS2_RST, PIN(6, 2), GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_GPIOB0, PIN(B, 0), GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_GPIO81, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_FLPRG2, PIN(8, 6), GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_PSL_GPO, PIN(D, 7), GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_PWM7, PIN(6, 0), GPIO_INPUT | GPIO_PULL_UP) diff --git a/board/nipperkin/led.c b/board/nipperkin/led.c deleted file mode 100644 index 68a9d11b62..0000000000 --- a/board/nipperkin/led.c +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright 2021 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. - */ - -#include "battery.h" -#include "charge_manager.h" -#include "charge_state.h" -#include "chipset.h" -#include "ec_commands.h" -#include "gpio.h" -#include "host_command.h" -#include "led_common.h" -#include "hooks.h" - -#define BAT_LED_ON 0 -#define BAT_LED_OFF 1 - -#define POWER_LED_ON 0 -#define POWER_LED_OFF 1 - -#define LED_TICKS_PER_CYCLE 10 -#define LED_TICKS_PER_CYCLE_S3 10 -#define LED_ON_TICKS 5 -#define POWER_LED_ON_S3_TICKS 5 - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_LEFT_LED, - EC_LED_ID_RIGHT_LED, -}; - -const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); - -enum led_color { - LED_OFF = 0, - LED_AMBER, - LED_WHITE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ -}; - -enum led_port { - LED_RIGHT_PORT = 0, - LED_LEFT_PORT -}; - -static void led_set_color_battery(enum led_port port, enum led_color color) -{ - enum gpio_signal amber_led, white_led; - - amber_led = (port == LED_RIGHT_PORT ? GPIO_C0_CHARGE_LED_AMBER_L : - GPIO_C1_CHARGE_LED_AMBER_L); - white_led = (port == LED_RIGHT_PORT ? GPIO_C0_CHARGE_LED_WHITE_L : - GPIO_C1_CHARGE_LED_WHITE_L); - - switch (color) { - case LED_WHITE: - gpio_set_level(white_led, BAT_LED_ON); - gpio_set_level(amber_led, BAT_LED_OFF); - break; - case LED_AMBER: - gpio_set_level(white_led, BAT_LED_OFF); - gpio_set_level(amber_led, BAT_LED_ON); - break; - case LED_OFF: - gpio_set_level(white_led, BAT_LED_OFF); - gpio_set_level(amber_led, BAT_LED_OFF); - break; - default: - break; - } -} - -void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) -{ - switch (led_id) { - case EC_LED_ID_LEFT_LED: - brightness_range[EC_LED_COLOR_WHITE] = 1; - brightness_range[EC_LED_COLOR_AMBER] = 1; - break; - case EC_LED_ID_RIGHT_LED: - brightness_range[EC_LED_COLOR_WHITE] = 1; - brightness_range[EC_LED_COLOR_AMBER] = 1; - break; - default: - break; - } -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - switch (led_id) { - case EC_LED_ID_LEFT_LED: - if (brightness[EC_LED_COLOR_WHITE] != 0) - led_set_color_battery(LED_LEFT_PORT, LED_WHITE); - else if (brightness[EC_LED_COLOR_AMBER] != 0) - led_set_color_battery(LED_LEFT_PORT, LED_AMBER); - else - led_set_color_battery(LED_LEFT_PORT, LED_OFF); - break; - case EC_LED_ID_RIGHT_LED: - if (brightness[EC_LED_COLOR_WHITE] != 0) - led_set_color_battery(LED_RIGHT_PORT, LED_WHITE); - else if (brightness[EC_LED_COLOR_AMBER] != 0) - led_set_color_battery(LED_RIGHT_PORT, LED_AMBER); - else - led_set_color_battery(LED_RIGHT_PORT, LED_OFF); - break; - default: - return EC_ERROR_PARAM1; - } - - return EC_SUCCESS; -} - -/* - * Set active charge port color to the parameter, turn off all others. - * If no port is active (-1), turn off all LEDs. - */ -static void set_active_port_color(enum led_color color) -{ - int port = charge_manager_get_active_charge_port(); - - if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) - led_set_color_battery(LED_RIGHT_PORT, - (port == LED_RIGHT_PORT) ? color : LED_OFF); - if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) - led_set_color_battery(LED_LEFT_PORT, - (port == LED_LEFT_PORT) ? color : LED_OFF); -} - -static void led_set_battery(void) -{ - static int battery_ticks; - static int power_ticks; - uint32_t chflags = charge_get_flags(); - - battery_ticks++; - - /* - * Override battery LEDs for Nipperkin, Nipperkin is non-power LED - * design, blinking both two side battery white LEDs to indicate - * system suspend with non-charging state. - */ - if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) && - charge_get_state() != PWR_STATE_CHARGE) { - - power_ticks++; - - led_set_color_battery(LED_RIGHT_PORT, power_ticks - % LED_TICKS_PER_CYCLE_S3 < POWER_LED_ON_S3_TICKS - ? LED_WHITE : LED_OFF); - led_set_color_battery(LED_LEFT_PORT, power_ticks - % LED_TICKS_PER_CYCLE_S3 < POWER_LED_ON_S3_TICKS - ? LED_WHITE : LED_OFF); - return; - } - - power_ticks = 0; - - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - /* Always indicate when charging, even in suspend. */ - set_active_port_color(LED_AMBER); - break; - case PWR_STATE_DISCHARGE: - if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { - 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); - 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); - break; - case PWR_STATE_ERROR: - set_active_port_color((battery_ticks & 0x2) ? - LED_WHITE : LED_OFF); - break; - case PWR_STATE_CHARGE_NEAR_FULL: - set_active_port_color(LED_WHITE); - break; - case PWR_STATE_IDLE: /* External power connected in IDLE */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - set_active_port_color((battery_ticks % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); - else - set_active_port_color(LED_WHITE); - break; - default: - /* Other states don't alter LED behavior */ - break; - } -} - -/* Called by hook task every TICK */ -static void led_tick(void) -{ - led_set_battery(); -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); diff --git a/board/nipperkin/vif_override.xml b/board/nipperkin/vif_override.xml deleted file mode 100644 index 32736caf64..0000000000 --- a/board/nipperkin/vif_override.xml +++ /dev/null @@ -1,3 +0,0 @@ -<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File - Definition from the USB-IF. ---> |