diff options
author | xiong.huang <xiong.huang@bitland.corp-partner.google.com> | 2019-08-01 16:44:25 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-14 12:17:16 +0000 |
commit | e2d08fb1da6b3236db844b61a5ee55194706c48a (patch) | |
tree | d7d4611d0525f9d624c05967b2fe13887ab26696 /board | |
parent | ce1a0c9bdfa0b35455b9619fdb1b5794caa63894 (diff) | |
download | chrome-ec-e2d08fb1da6b3236db844b61a5ee55194706c48a.tar.gz |
kodama: Remove unused chip drivers
Kodama doesn't use tcs3400, bmm150 and pi3usb9201 chips. It needs remove
ALS, RGB, MAG and BC1.2 drivers.
BUG=b:136977971
BRANCH=master
TEST=build and deploy on kodama, AP can boot.
Change-Id: I43d97b4d1848fcd4513ec4de8202b9b889a08249
Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730377
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/kodama/board.c | 185 | ||||
-rw-r--r-- | board/kodama/board.h | 26 | ||||
-rw-r--r-- | board/kodama/gpio.inc | 7 |
3 files changed, 13 insertions, 205 deletions
diff --git a/board/kodama/board.c b/board/kodama/board.c index eb7c327432..23c98fde71 100644 --- a/board/kodama/board.c +++ b/board/kodama/board.c @@ -14,8 +14,6 @@ #include "common.h" #include "console.h" #include "driver/accelgyro_bmi160.h" -#include "driver/als_tcs3400.h" -#include "driver/bc12/pi3usb9201.h" #include "driver/charger/rt946x.h" #include "driver/sync.h" #include "driver/tcpm/mt6370.h" @@ -48,11 +46,6 @@ static void tcpc_alert_event(enum gpio_signal signal) schedule_deferred_pd_interrupt(0 /* port */); } -static void gauge_interrupt(enum gpio_signal signal) -{ - task_wake(TASK_ID_CHARGER); -} - #include "gpio_list.h" /******************************************************************************/ @@ -68,17 +61,11 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /******************************************************************************/ /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"charger", I2C_PORT_CHARGER, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, - {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, - {"battery", I2C_PORT_BATTERY, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, - {"accelgyro", I2C_PORT_ACCEL, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, - {"bc12", I2C_PORT_BC12, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, - {"als", I2C_PORT_ALS, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, + {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, + {"other", 1, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -#define BC12_I2C_ADDR_FLAGS PI3USB9201_I2C_ADDR_3_FLAGS - /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"}, @@ -121,17 +108,6 @@ uint16_t tcpc_get_alert_status(void) return status; } -static void board_pogo_charge_init(void) -{ - int i; - - /* Initialize all charge suppliers to 0 */ - for (i = 0; i < CHARGE_SUPPLIER_COUNT; i++) - charge_manager_update_charge(i, CHARGE_PORT_POGO, NULL); -} -DECLARE_HOOK(HOOK_INIT, board_pogo_charge_init, - HOOK_PRIO_CHARGE_MANAGER_INIT + 1); - static int force_discharge; int board_set_active_charge_port(int charge_port) @@ -147,12 +123,6 @@ int board_set_active_charge_port(int charge_port) /* Don't charge from a source port */ if (board_vbus_source_enabled(charge_port)) return -1; - gpio_set_level(GPIO_EN_POGO_CHARGE_L, 1); - gpio_set_level(GPIO_EN_USBC_CHARGE_L, 0); - break; - case CHARGE_PORT_POGO: - gpio_set_level(GPIO_EN_USBC_CHARGE_L, 1); - gpio_set_level(GPIO_EN_POGO_CHARGE_L, 0); break; case CHARGE_PORT_NONE: /* @@ -160,8 +130,6 @@ int board_set_active_charge_port(int charge_port) * even when battery is disconnected, keep VBAT rail on but * set the charging current to minimum. */ - gpio_set_level(GPIO_EN_POGO_CHARGE_L, 1); - gpio_set_level(GPIO_EN_USBC_CHARGE_L, 1); charger_set_current(0); break; default: @@ -213,7 +181,7 @@ int extpower_is_present(void) else usb_c_extpower_present = tcpm_get_vbus_level(CHARGE_PORT_USB_C); - return usb_c_extpower_present || gpio_get_level(GPIO_POGO_VBUS_PRESENT); + return usb_c_extpower_present; } int pd_snk_is_vbus_provided(int port) @@ -260,57 +228,20 @@ static void board_init(void) /* Enable interrupt from PMIC. */ gpio_enable_interrupt(GPIO_PMIC_EC_RESETB); - /* Enable gauge interrupt from max17055 */ - gpio_enable_interrupt(GPIO_GAUGE_INT_ODL); - /* Enable pogo interrupt */ gpio_enable_interrupt(GPIO_POGO_ADC_INT_L); - if (IS_ENABLED(BOARD_KRANE)) { - /* Display bias settings. */ - mt6370_db_set_voltages(6000, 5800, 5800); - - /* - * Fix backlight led maximum current: - * tolerance 120mA * 0.75 = 90mA. - * (b/133655155) - */ - mt6370_backlight_set_dim(MT6370_BLDIM_DEFAULT * 3 / 4); - } - - /* Enable pogo charging signal */ - gpio_enable_interrupt(GPIO_POGO_VBUS_PRESENT); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -static void board_rev_init(void) -{ - /* Board revision specific configs. */ + /* Display bias settings. */ + mt6370_db_set_voltages(6000, 5800, 5800); /* - * It's a P1 pin BOOTBLOCK_MUX_OE, also a P2 pin BC12_DET_EN. - * Keep this pin defaults to P1 setting since that eMMC enabled with - * High-Z stat. + * Fix backlight led maximum current: + * tolerance 120mA * 0.75 = 90mA. + * (b/133655155) */ - if (IS_ENABLED(BOARD_KUKUI) && board_get_version() == 1) - gpio_set_flags(GPIO_BC12_DET_EN, GPIO_ODR_HIGH); - - if (board_get_version() >= 2) { - /* - * Enable MT6370 DB_POSVOUT/DB_NEGVOUT (controlled by _EN pins). - */ - mt6370_db_external_control(1); - } - - if (board_get_version() == 2) { - /* configure PI3USB9201 to USB Path ON Mode */ - i2c_write8(I2C_PORT_BC12, BC12_I2C_ADDR_FLAGS, - PI3USB9201_REG_CTRL_1, - (PI3USB9201_USB_PATH_ON << - PI3USB9201_REG_CTRL_1_MODE_SHIFT)); - } + mt6370_backlight_set_dim(MT6370_BLDIM_DEFAULT * 3 / 4); } -DECLARE_HOOK(HOOK_INIT, board_rev_init, HOOK_PRIO_INIT_ADC + 1); +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); /* Motion sensors */ /* Mutexes */ @@ -319,52 +250,12 @@ static struct mutex g_lid_mutex; static struct bmi160_drv_data_t g_bmi160_data; -static struct als_drv_data_t g_tcs3400_data = { - .als_cal.scale = 1, - .als_cal.uscale = 0, - .als_cal.offset = 0, -}; - -static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { - .device_scale = 1, - .device_uscale = 0, - .rgb_cal[X] = { - .scale = ALS_CHANNEL_SCALE(1), - .offset = 0, - }, - .rgb_cal[Y] = { - .scale = ALS_CHANNEL_SCALE(1), - .offset = 0, - }, - .rgb_cal[Z] = { - .scale = ALS_CHANNEL_SCALE(1), - .offset = 0, - }, -}; - /* Matrix to rotate accelerometer into standard reference frame */ -#ifdef BOARD_KUKUI static const mat33_fp_t lid_standard_ref = { {FLOAT_TO_FP(1), 0, 0}, {0, FLOAT_TO_FP(1), 0}, {0, 0, FLOAT_TO_FP(1)} }; -#else -static const mat33_fp_t lid_standard_ref = { - {0, FLOAT_TO_FP(-1), 0}, - {FLOAT_TO_FP(1), 0, 0}, - {0, 0, FLOAT_TO_FP(1)} -}; -#endif /* BOARD_KUKUI */ - -#ifdef CONFIG_MAG_BMI160_BMM150 -/* Matrix to rotate accelrator into standard reference frame */ -static const mat33_fp_t mag_standard_ref = { - {0, FLOAT_TO_FP(-1), 0}, - {FLOAT_TO_FP(-1), 0, 0}, - {0, 0, FLOAT_TO_FP(-1)} -}; -#endif /* CONFIG_MAG_BMI160_BMM150 */ struct motion_sensor_t motion_sensors[] = { /* @@ -411,59 +302,6 @@ struct motion_sensor_t motion_sensors[] = { .min_frequency = BMI160_GYRO_MIN_FREQ, .max_frequency = BMI160_GYRO_MAX_FREQ, }, -#ifdef CONFIG_MAG_BMI160_BMM150 - [LID_MAG] = { - .name = "Lid Mag", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI160, - .type = MOTIONSENSE_TYPE_MAG, - .location = MOTIONSENSE_LOC_LID, - .drv = &bmi160_drv, - .mutex = &g_lid_mutex, - .drv_data = &g_bmi160_data, - .port = I2C_PORT_ACCEL, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .default_range = BIT(11), /* 16LSB / uT, fixed */ - .rot_standard_ref = &mag_standard_ref, - .min_frequency = BMM150_MAG_MIN_FREQ, - .max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL), - }, -#endif /* CONFIG_MAG_BMI160_BMM150 */ - [CLEAR_ALS] = { - .name = "Clear Light", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_TCS3400, - .type = MOTIONSENSE_TYPE_LIGHT, - .location = MOTIONSENSE_LOC_LID, - .drv = &tcs3400_drv, - .drv_data = &g_tcs3400_data, - .port = I2C_PORT_ALS, - .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS, - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - .min_frequency = TCS3400_LIGHT_MIN_FREQ, - .max_frequency = TCS3400_LIGHT_MAX_FREQ, - .config = { - /* Run ALS sensor in S0 */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 1000, - }, - }, - }, - [RGB_ALS] = { - .name = "RGB Light", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_TCS3400, - .type = MOTIONSENSE_TYPE_LIGHT_RGB, - .location = MOTIONSENSE_LOC_LID, - .drv = &tcs3400_rgb_drv, - .drv_data = &g_tcs3400_rgb_data, - /*.port = I2C_PORT_ALS,*/ /* Unused. RGB channels read by CLEAR_ALS. */ - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - .min_frequency = 0, /* 0 indicates we should not use sensor directly */ - .max_frequency = 0, /* 0 indicates we should not use sensor directly */ - }, [VSYNC] = { .name = "Camera vsync", .active_mask = SENSOR_ACTIVE_S0, @@ -477,9 +315,6 @@ struct motion_sensor_t motion_sensors[] = { }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); -const struct motion_sensor_t *motion_als_sensors[] = { - &motion_sensors[CLEAR_ALS], -}; #endif /* SECTION_IS_RW */ void usb_charger_set_switches(int port, enum usb_switch setting) diff --git a/board/kodama/board.h b/board/kodama/board.h index d3bd064a50..4b57d12c9c 100644 --- a/board/kodama/board.h +++ b/board/kodama/board.h @@ -28,32 +28,14 @@ #define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */ #endif /* BOARD_KRANE */ -#ifdef BOARD_KRANE #define CONFIG_CHARGER_MT6370_BACKLIGHT -#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT -#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1 -#define DEDICATED_CHARGE_PORT 1 -#endif /* BOARD_KRANE */ /* Motion Sensors */ #ifdef SECTION_IS_RW -#ifndef BOARD_KRANE -#define CONFIG_MAG_BMI160_BMM150 -#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS -#define CONFIG_MAG_CALIBRATE -#endif /* !BOARD_KRANE */ #define CONFIG_ACCELGYRO_BMI160 #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL) -#define CONFIG_ALS - -#define ALS_COUNT 1 -#define CONFIG_ALS_TCS3400 -#define CONFIG_ALS_TCS3400_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS) -#define CONFIG_ALS_TCS3400_EMULATED_IRQ_EVENT -#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(CLEAR_ALS) /* Camera VSYNC */ #define CONFIG_SYNC @@ -68,8 +50,6 @@ #define I2C_PORT_BATTERY 1 #define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY #define I2C_PORT_ACCEL 1 -#define I2C_PORT_BC12 1 -#define I2C_PORT_ALS 1 /* Route sbs host requests to virtual battery driver */ #define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B @@ -103,18 +83,12 @@ enum power_signal { enum sensor_id { LID_ACCEL = 0, LID_GYRO, -#ifdef CONFIG_MAG_BMI160_BMM150 - LID_MAG, -#endif /* CONFIG_MAG_BMI160_BMM150 */ - CLEAR_ALS, - RGB_ALS, VSYNC, SENSOR_COUNT, }; enum charge_port { CHARGE_PORT_USB_C, - CHARGE_PORT_POGO, }; #include "ec_commands.h" diff --git a/board/kodama/gpio.inc b/board/kodama/gpio.inc index ad67b3352b..ebf6e67ee5 100644 --- a/board/kodama/gpio.inc +++ b/board/kodama/gpio.inc @@ -41,8 +41,6 @@ GPIO_INT_RW(SYNC_INT, PIN(A, 8), GPIO_INT_RISING | GPIO_PULL_DOWN, sync_interrupt) GPIO_INT(HALL_INT_L, PIN(C, 5), GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(GAUGE_INT_ODL, PIN(C, 9), GPIO_INT_FALLING | GPIO_PULL_UP, - gauge_interrupt) GPIO_INT(POGO_ADC_INT_L, PIN(A, 6), GPIO_INT_BOTH, pogo_adc_interrupt) @@ -86,10 +84,11 @@ GPIO(BOOTBLOCK_EN_L, PIN(C, 1), GPIO_ODR_HIGH) GPIO(USB_C0_DP_OE_L, PIN(A, 5), GPIO_OUT_HIGH) GPIO(EN_PP3300_POGO, PIN(A, 13), GPIO_OUT_LOW) GPIO(EN_POGO_CHARGE_L, PIN(B, 6), GPIO_OUT_HIGH) -GPIO(EN_USBC_CHARGE_L, PIN(C, 7), GPIO_OUT_LOW) -GPIO(EN_PP5000_USBC, PIN(D, 2), GPIO_OUT_LOW) GPIO(BC12_DET_EN, PIN(C, 4), GPIO_OUT_LOW) +UNIMPLEMENTED(EN_PP5000_USBC) +UNIMPLEMENTED(EN_USBC_CHARGE_L) + /* USART1: PA9/PA10 */ ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* I2C MASTER: PB8/9 */ |