From 9c6aeea883776d4f759fe476a0d379223d63952b Mon Sep 17 00:00:00 2001 From: Ting Shen Date: Tue, 14 Sep 2021 16:13:48 +0800 Subject: cherry: code cleanup 1) remove board_overcurrent_event since CL:2532676 added a default empty implementation 2) remove GPIO_EN_KB_BL control since it's already handled in keyboard_backlight.c 3) remove unused header includes 4) remove unused it5205 sbu handler BUG=none TEST=make BRANCH=main Signed-off-by: Ting Shen Change-Id: I0231ba6c6bf16fa0fc1bf52fd77815271e79dcbb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160456 Tested-by: Ting Shen Auto-Submit: Ting Shen Reviewed-by: Rong Chang Commit-Queue: Rong Chang --- baseboard/cherry/baseboard.c | 15 ---------- baseboard/cherry/it5205_sbu.c | 68 ------------------------------------------- board/cherry/battery.c | 6 ---- board/cherry/board.c | 32 -------------------- 4 files changed, 121 deletions(-) delete mode 100644 baseboard/cherry/it5205_sbu.c diff --git a/baseboard/cherry/baseboard.c b/baseboard/cherry/baseboard.c index 1195169bc9..4b20681455 100644 --- a/baseboard/cherry/baseboard.c +++ b/baseboard/cherry/baseboard.c @@ -14,10 +14,7 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "driver/accel_kionix.h" -#include "driver/accel_kx022.h" #include "driver/accelgyro_icm42607.h" -#include "driver/accelgyro_icm_common.h" #include "driver/bc12/mt6360.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" @@ -34,7 +31,6 @@ #include "i2c.h" #include "keyboard_scan.h" #include "lid_switch.h" -#include "motion_sense.h" #include "power_button.h" #include "power.h" #include "pwm_chip.h" @@ -232,9 +228,6 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); static void board_chipset_resume(void) { gpio_set_level(GPIO_EC_BL_EN_OD, 1); - if (IS_ENABLED(CONFIG_PWM_KBLIGHT)) - gpio_set_level(GPIO_EN_KB_BL, 1); - } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -242,8 +235,6 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); static void board_chipset_suspend(void) { gpio_set_level(GPIO_EC_BL_EN_OD, 0); - if (IS_ENABLED(CONFIG_PWM_KBLIGHT)) - gpio_set_level(GPIO_EN_KB_BL, 0); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -363,12 +354,6 @@ int board_allow_i2c_passthru(int port) return (port == I2C_PORT_VIRTUAL_BATTERY); } - -void board_overcurrent_event(int port, int is_overcurrented) -{ - /* TODO: check correct operation for Cherry */ -} - /* TCPC */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { diff --git a/baseboard/cherry/it5205_sbu.c b/baseboard/cherry/it5205_sbu.c deleted file mode 100644 index 61a996fcbe..0000000000 --- a/baseboard/cherry/it5205_sbu.c +++ /dev/null @@ -1,68 +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. - * - * IT5205 Type-C SBU OVP handler - */ - -#include "console.h" -#include "hooks.h" -#include "it5205.h" -#include "stdbool.h" -#include "timer.h" -#include "usb_mux.h" - -#define CPRINTS(format, args...) cprints(CC_USB, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args) - -#define OVP_RETRY_DELAY_US_MIN (100 * MSEC) - -static unsigned int ovp_retry_delay_us = OVP_RETRY_DELAY_US_MIN; - -static void reset_retry_delay(void) -{ - CPRINTS("IT5205 SBU OVP cleared"); - ovp_retry_delay_us = OVP_RETRY_DELAY_US_MIN; -} -DECLARE_DEFERRED(reset_retry_delay); - -static void reset_csbu(void) -{ - /* double the retry time up to 1 minute */ - ovp_retry_delay_us = MIN(ovp_retry_delay_us * 2, MINUTE); - /* and reset it if interrupt not triggered in a short period */ - hook_call_deferred(&reset_retry_delay_data, 500 * MSEC); - - /* re-enable sbu interrupt */ - it5205h_enable_csbu_switch(&usb_muxes[0], false); - it5205h_enable_csbu_switch(&usb_muxes[0], true); -} -DECLARE_DEFERRED(reset_csbu); - -static void it5205h_hook_ac_change(void) -{ - int reg; - - /* Check if the board has IT5205H, and read its ovp status */ - if (i2c_read8(I2C_PORT_USB_MUX0, IT5205H_SBU_I2C_ADDR_FLAGS, - IT5205H_REG_ISR, ®)) - return; - - /* - * Re-poll ovp status immediately if AC detached, because ovp will - * likely be recovered. - * - * Always perform the re-poll even when this hook is triggered by - * unrelated events. - */ - if (reg & IT5205H_ISR_CSBU_OVP) - hook_call_deferred(&reset_csbu_data, 0); -} -DECLARE_HOOK(HOOK_AC_CHANGE, it5205h_hook_ac_change, HOOK_PRIO_DEFAULT); - -void it5205h_sbu_interrupt(enum gpio_signal signal) -{ - CPRINTS("IT5205 SBU OVP triggered"); - hook_call_deferred(&reset_csbu_data, ovp_retry_delay_us); - hook_call_deferred(&reset_retry_delay_data, -1); -} diff --git a/board/cherry/battery.c b/board/cherry/battery.c index 00404ce63c..612a1d4bc2 100644 --- a/board/cherry/battery.c +++ b/board/cherry/battery.c @@ -6,12 +6,6 @@ #include "battery.h" #include "battery_fuel_gauge.h" #include "battery_smart.h" -#include "charge_manager.h" -#include "chipset.h" -#include "gpio.h" -#include "hooks.h" -#include "system.h" -#include "usb_pd.h" const struct board_batt_params board_battery_info[] = { /* Panasonic AP16L5J Battery Information */ diff --git a/board/cherry/board.c b/board/cherry/board.c index 479c998b23..8e456e2c80 100644 --- a/board/cherry/board.c +++ b/board/cherry/board.c @@ -4,12 +4,6 @@ */ /* Cherry board configuration */ -#include "adc.h" -#include "button.h" -#include "charge_manager.h" -#include "charge_state_v2.h" -#include "charger.h" -#include "chipset.h" #include "common.h" #include "console.h" #include "driver/accel_bma422.h" @@ -17,38 +11,12 @@ #include "driver/accel_kx022.h" #include "driver/accelgyro_icm42607.h" #include "driver/accelgyro_icm_common.h" -#include "driver/bc12/mt6360.h" -#include "driver/bc12/pi3usb9201.h" -#include "driver/charger/isl923x.h" -#include "driver/ppc/syv682x.h" -#include "driver/tcpm/it83xx_pd.h" -#include "driver/temp_sensor/thermistor.h" -#include "driver/usb_mux/it5205.h" -#include "driver/usb_mux/ps8743.h" -#include "extpower.h" #include "gpio.h" #include "hooks.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "lid_switch.h" #include "motion_sense.h" -#include "power.h" -#include "power_button.h" #include "pwm.h" #include "pwm_chip.h" -#include "regulator.h" -#include "spi.h" -#include "switch.h" #include "system.h" -#include "tablet_mode.h" -#include "task.h" -#include "temp_sensor.h" -#include "timer.h" -#include "uart.h" -#include "usb_charge.h" -#include "usb_mux.h" -#include "usb_pd_tcpm.h" -#include "usbc_ppc.h" #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) -- cgit v1.2.1