From 86f7710d983c222539d643a3b8c680f5eb51c2c0 Mon Sep 17 00:00:00 2001 From: Josh Tsai Date: Thu, 26 Dec 2019 14:25:34 +0800 Subject: stryke: remove ALS support Stryke of the hatch family do not include any ALS sensor. Remove it entirely, both to save space and to disable some factory tests. BUG=b:146868242 BRANCH=none TEST=make BOARD=stryke Change-Id: Idaf1ffdd5085586b615d643b033be34f22fc469f Signed-off-by: Josh Tsai Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1982306 Reviewed-by: Ruby Lee Reviewed-by: Tim Wawrzynczak --- board/stryke/board.c | 84 --------------------------------------------------- board/stryke/board.h | 11 +------ board/stryke/gpio.inc | 1 - 3 files changed, 1 insertion(+), 95 deletions(-) diff --git a/board/stryke/board.c b/board/stryke/board.c index b0400c95d0..f7df3b6989 100644 --- a/board/stryke/board.c +++ b/board/stryke/board.c @@ -12,7 +12,6 @@ #include "cros_board_info.h" #include "driver/accel_bma2x2.h" #include "driver/accelgyro_bmi160.h" -#include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" @@ -180,44 +179,6 @@ static struct bmi160_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; -/* TCS3400 private data */ -static struct als_drv_data_t g_tcs3400_data = { - .als_cal.scale = 1, - .als_cal.uscale = 0, - .als_cal.offset = 0, - .als_cal.channel_scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc */ - .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */ - }, -}; - -static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { - .calibration.rgb_cal[X] = { - .offset = 0, - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - }, - }, - .calibration.rgb_cal[Y] = { - .offset = 0, - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - }, - }, - .calibration.rgb_cal[Z] = { - .offset = 0, - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - }, - }, - .calibration.irt = INT_TO_FP(1), - .saturation.again = TCS_DEFAULT_AGAIN, - .saturation.atime = TCS_DEFAULT_ATIME, -}; - /* Matrix to rotate accelrator into standard reference frame */ static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0}, @@ -307,52 +268,9 @@ struct motion_sensor_t motion_sensors[] = { .max_frequency = BMI160_GYRO_MAX_FREQ, }, - [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] = { - /* - * RGB channels read by CLEAR_ALS and so the i2c port and - * address do not need to be defined for 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, - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); -/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */ -const struct motion_sensor_t *motion_als_sensors[] = { - &motion_sensors[CLEAR_ALS], -}; -BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT); - /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ @@ -474,8 +392,6 @@ static void board_init(void) setup_fans(); /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); - /* Enable interrupt for the TCS3400 color light sensor */ - gpio_enable_interrupt(GPIO_TCS3400_INT_ODL); /* Enable HDMI HPD interrupt. */ gpio_enable_interrupt(GPIO_HDMI_CONN_HPD); /* Select correct gpio signal for PP5000_A control */ diff --git a/board/stryke/board.h b/board/stryke/board.h index e1b7ce7414..cace15efe3 100644 --- a/board/stryke/board.h +++ b/board/stryke/board.h @@ -34,18 +34,11 @@ #define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT /* BMA253 Lid accel */ #define CONFIG_ACCEL_BMA255 -#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS)) +#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL #define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL #define CONFIG_LID_ANGLE_UPDATE -/* TC3400 ALS */ -#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 I2C_PORT_ALS I2C_PORT_SENSOR /* USB Type C and USB PD defines */ #define CONFIG_USB_PD_COMM_LOCKED @@ -137,8 +130,6 @@ enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, - CLEAR_ALS, - RGB_ALS, SENSOR_COUNT, }; diff --git a/board/stryke/gpio.inc b/board/stryke/gpio.inc index 8c7977f585..8b241b2850 100644 --- a/board/stryke/gpio.inc +++ b/board/stryke/gpio.inc @@ -28,7 +28,6 @@ GPIO_INT(PP5000_A_PG_OD, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt) /* Sensor Interrupts */ GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING, bmi160_interrupt) -GPIO_INT(TCS3400_INT_ODL, PIN(F, 1), GPIO_INT_FALLING, tcs3400_interrupt) /* USB-C interrupts */ GPIO_INT(USB_C0_PPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt) -- cgit v1.2.1