From c9b52beb497821dda34784e2252eacb559aed524 Mon Sep 17 00:00:00 2001 From: Devin Lu Date: Mon, 30 Aug 2021 10:39:47 +0800 Subject: anahera: Remove unnecessary function This patch removes unnecessary function as following: 1. Remove ALS. 2. Remove Accelerometers. 3. Remove PCHG. 4. Remove FAN2. 5. Remove tablet mode. BUG=none BRANCH=none TEST=make BOARD=anahera Signed-off-by: Devin Lu Change-Id: I19c939d9b8359fc58cb56323e0a3e1537f4515a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3127822 Reviewed-by: Boris Mittelberg Reviewed-by: Zick Wei Commit-Queue: Boris Mittelberg --- board/anahera/board.c | 22 ----- board/anahera/board.h | 62 +------------ board/anahera/build.mk | 2 +- board/anahera/ec.tasklist | 2 - board/anahera/fans.c | 22 ----- board/anahera/gpio.inc | 25 +++-- board/anahera/i2c.c | 8 -- board/anahera/pwm.c | 5 - board/anahera/sensors.c | 222 -------------------------------------------- board/anahera/usbc_config.h | 2 +- 10 files changed, 17 insertions(+), 355 deletions(-) (limited to 'board/anahera') diff --git a/board/anahera/board.c b/board/anahera/board.c index 3c0f48f2bd..c1de2df6ac 100644 --- a/board/anahera/board.c +++ b/board/anahera/board.c @@ -13,8 +13,6 @@ #include "gpio.h" #include "gpio_signal.h" #include "hooks.h" -#include "driver/accelgyro_lsm6dsm.h" -#include "driver/als_tcs3400.h" #include "fw_config.h" #include "hooks.h" #include "lid_switch.h" @@ -23,7 +21,6 @@ #include "power.h" #include "registers.h" #include "switch.h" -#include "tablet_mode.h" #include "throttle_ap.h" #include "usbc_config.h" @@ -33,25 +30,6 @@ #define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) #define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) -/* PCHG control */ -#ifdef SECTION_IS_RW -extern struct pchg_drv ctn730_drv; - -struct pchg pchgs[] = { - [0] = { - .cfg = &(const struct pchg_config) { - .drv = &ctn730_drv, - .i2c_port = I2C_PORT_WLC, - .irq_pin = GPIO_PEN_INT_ODL, - .full_percent = 96, - .block_size = 128, - }, - .events = QUEUE_NULL(PCHG_EVENT_QUEUE_SIZE, enum pchg_event), - }, -}; -const int pchg_count = ARRAY_SIZE(pchgs); -#endif - /******************************************************************************/ /* USB-A charging control */ diff --git a/board/anahera/board.h b/board/anahera/board.h index a72b0b58ed..c2a2c09796 100644 --- a/board/anahera/board.h +++ b/board/anahera/board.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* Redrix board configuration */ +/* Anahera board configuration */ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H @@ -20,44 +20,9 @@ #define CONFIG_HIBERNATE_PSL_VCC1_RST_WAKEUP /* Sensors */ -#define CONFIG_ACCEL_BMA255 /* Lid accel */ -#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ -#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL - -/* TCS3400 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) - -/* Enable sensor fifo, must also define the _SIZE and _THRES */ -#define CONFIG_ACCEL_FIFO -/* FIFO size is in power of 2. */ -#define CONFIG_ACCEL_FIFO_SIZE 256 -/* Depends on how fast the AP boots and typical ODRs */ -#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3) - -/* Sensors without hardware FIFO are in forced mode */ -#define CONFIG_ACCEL_FORCE_MODE_MASK \ - (BIT(LID_ACCEL) | BIT(CLEAR_ALS)) - -#define CONFIG_ACCEL_INTERRUPTS - -/* Sensor console commands */ -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO - -/* WLC pins */ -#ifdef SECTION_IS_RW -#define CONFIG_PERIPHERAL_CHARGER -#define CONFIG_DEVICE_EVENT -#define CONFIG_CTN730 -#endif +#undef CONFIG_TABLET_MODE +#undef CONFIG_TABLET_MODE_SWITCH +#undef CONFIG_GMR_TABLET_MODE /* USB Type A Features */ #define USB_PORT_COUNT 1 @@ -106,7 +71,6 @@ #define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST #define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L #define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L -#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L /* * GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup @@ -123,15 +87,10 @@ #define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define GPIO_WP_L GPIO_EC_WP_ODL -#define GPIO_WLC_NRST_CONN GPIO_PEN_RST_L - /* System has back-lit keyboard */ #define CONFIG_PWM_KBLIGHT /* I2C Bus Configuration */ - -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 - #define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0 #define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 @@ -147,7 +106,6 @@ #define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 #define I2C_PORT_CHARGER NPCX_I2C_PORT7_0 #define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_PORT_WLC NPCX_I2C_PORT7_0 #define I2C_ADDR_EEPROM_FLAGS 0x50 @@ -208,15 +166,6 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -enum sensor_id { - LID_ACCEL = 0, - BASE_ACCEL, - BASE_GYRO, - CLEAR_ALS, - RGB_ALS, - SENSOR_COUNT -}; - enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, @@ -232,19 +181,16 @@ enum battery_type { enum pwm_channel { PWM_CH_KBLIGHT = 0, /* PWM3 */ PWM_CH_FAN, /* PWM5 */ - PWM_CH_FAN2, /* PWM7 */ PWM_CH_COUNT }; enum fan_channel { FAN_CH_0 = 0, - FAN_CH_1, FAN_CH_COUNT }; enum mft_channel { MFT_CH_0 = 0, - MFT_CH_1, MFT_CH_COUNT }; diff --git a/board/anahera/build.mk b/board/anahera/build.mk index 84ea934e6f..c7f14ff9d7 100644 --- a/board/anahera/build.mk +++ b/board/anahera/build.mk @@ -3,7 +3,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # -# Redrix board specific files build +# Anahera board specific files build # CHIP:=npcx diff --git a/board/anahera/ec.tasklist b/board/anahera/ec.tasklist index 937fe97ae0..5cf454d4c2 100644 --- a/board/anahera/ec.tasklist +++ b/board/anahera/ec.tasklist @@ -13,11 +13,9 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(LED, led_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS_RW(PCHG, pchg_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/anahera/fans.c b/board/anahera/fans.c index 7d0af30914..c177df5578 100644 --- a/board/anahera/fans.c +++ b/board/anahera/fans.c @@ -20,11 +20,6 @@ const struct mft_t mft_channels[] = { .clk_src = TCKC_LFCLK, .pwm_id = PWM_CH_FAN, }, - [MFT_CH_1] = { - .module = NPCX_MFT_MODULE_2, - .clk_src = TCKC_LFCLK, - .pwm_id = PWM_CH_FAN2, - }, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); @@ -35,13 +30,6 @@ static const struct fan_conf fan_conf_0 = { .enable_gpio = GPIO_EN_PP5000_FAN, }; -static const struct fan_conf fan_conf_1 = { - .flags = FAN_USE_RPM_MODE, - .ch = MFT_CH_1, /* Use MFT id to control fan */ - .pgood_gpio = -1, - .enable_gpio = GPIO_EN_PP5000_FAN2, -}; - /* TOOD(b/193487913): need to update for real fan */ static const struct fan_rpm fan_rpm_0 = { .rpm_min = 2200, @@ -49,20 +37,10 @@ static const struct fan_rpm fan_rpm_0 = { .rpm_max = 7200, }; -static const struct fan_rpm fan_rpm_1 = { - .rpm_min = 2200, - .rpm_start = 2200, - .rpm_max = 7200, -}; - const struct fan_t fans[FAN_CH_COUNT] = { [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, - [FAN_CH_1] = { - .conf = &fan_conf_1, - .rpm = &fan_rpm_1, - }, }; diff --git a/board/anahera/gpio.inc b/board/anahera/gpio.inc index 21f8b51ee1..ceb5087bd4 100644 --- a/board/anahera/gpio.inc +++ b/board/anahera/gpio.inc @@ -9,8 +9,6 @@ /* INTERRUPT GPIOs: */ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt) -GPIO_INT(EC_ALS_RGB_INT_R_L, PIN(D, 4), GPIO_INT_FALLING, tcs3400_interrupt) -GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, lsm6dsm_interrupt) GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt) GPIO_INT(EC_VOLDN_BTN_ODL, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) GPIO_INT(EC_VOLUP_BTN_ODL, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) @@ -23,7 +21,6 @@ GPIO_INT(SEQ_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_ GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt) GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event) GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt) @@ -33,11 +30,6 @@ GPIO_INT(USB_C1_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_inter GPIO_INT(USB_C1_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt) GPIO_INT(USB_C1_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt) -/* WLC interrupt. GPIO_PULL_DOWN ensures no IRQ when WLC chip is off. */ -#ifdef SECTION_IS_RW -GPIO_INT(PEN_INT_ODL, PIN(F, 5), GPIO_INT_RISING | GPIO_PULL_DOWN, pchg_irq) -#endif - /* USED GPIOs: */ GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) GPIO(CHARGER_VAP_OTG_EN, PIN(9, 6), GPIO_OUT_LOW) @@ -50,8 +42,6 @@ GPIO(EC_I2C_BAT_SCL, PIN(3, 3), GPIO_INPUT) GPIO(EC_I2C_BAT_SDA, PIN(3, 6), GPIO_INPUT) GPIO(EC_I2C_MISC_SCL_R, PIN(B, 3), GPIO_INPUT) GPIO(EC_I2C_MISC_SDA_R, PIN(B, 2), GPIO_INPUT) -GPIO(EC_I2C_SENSOR_SCL, PIN(B, 5), GPIO_INPUT | GPIO_SEL_1P8V) -GPIO(EC_I2C_SENSOR_SDA, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(EC_I2C_USB_C0_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT) GPIO(EC_I2C_USB_C0_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT) GPIO(EC_I2C_USB_C0_RT_SCL, PIN(D, 1), GPIO_INPUT) @@ -72,7 +62,6 @@ GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW) GPIO(EC_PCH_WAKE_R_ODL, PIN(C, 0), GPIO_ODR_HIGH) GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH) GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH) -GPIO(EN_PP5000_FAN2, PIN(5, 0), GPIO_OUT_HIGH) GPIO(EN_PP5000_USBA_R, PIN(D, 7), GPIO_OUT_LOW) GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW) GPIO(IMVP9_VRRDY_OD, PIN(4, 3), GPIO_INPUT) @@ -81,7 +70,6 @@ GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH) GPIO(USB_C0_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW) GPIO(USB_C1_TCPC_RST_ODL, PIN(A, 0), GPIO_ODR_LOW) GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW) -GPIO(PEN_RST_L, PIN(0, 2), GPIO_ODR_HIGH) /* LED */ GPIO(C0_CHARGE_LED_AMBER_L, PIN(C, 4), GPIO_OUT_HIGH) /* Amber C0 port */ @@ -98,7 +86,6 @@ ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* GPIO33/I2C5_SCL0 ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* GPIO87/I2C1_SDA0 */ ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* GPIO92/I2C2_SCL0, GPIO91/I2C2_SDA0, GPIO90/I2C1_SCL0 */ ALTERNATE(PIN_MASK(B, 0x0c), 0, MODULE_I2C, 0) /* GPIOB3/I2C7_SCL0/DCD_L, GPIOB2/I2C7_SDA0/DSR_L */ -ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, GPIO_SEL_1P8V) /* GPIOB5/I2C0_SCL0, GPIOB4/I2C0_SDA0 */ ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* GPIOD1/I2C3_SCL0, GPIOD0/I2C3_SDA0 */ ALTERNATE(PIN_MASK(E, 0x18), 0, MODULE_I2C, 0) /* GPIOE4/I2C6_SCL1/I3C_SCL, GPIOE3/I2C6_SDA1/I3C_SDA */ ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */ @@ -106,7 +93,6 @@ ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1 /* PWM alternate functions */ ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */ ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* GPIO73/TA2 */ -ALTERNATE(PIN_MASK(6, 0x01), 0, MODULE_PWM, 0) /* GPIO60/PWM7 */ ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* GPIO80/PWM3 */ ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */ @@ -133,6 +119,17 @@ UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */ UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */ UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */ UNUSED(PIN(6, 6)) /* GPO66/ARM_L_x86 */ +UNUSED(PIN(0, 2)) /* GPIO02/PSL_IN4 */ +UNUSED(PIN(5, 0)) /* GPIO50 */ +UNUSED(PIN(5, 6)) /* GPIO56/CLKRUN_L */ +UNUSED(PIN(6, 0)) /* GPIO60/PWM7 */ +UNUSED(PIN(7, 3)) /* GPIO73/TA2 */ +UNUSED(PIN(8, 1)) /* GPIO81/PECI_DATA */ +UNUSED(PIN(9, 5)) /* GPIO95/SPIP_MISO */ +UNUSED(PIN(B, 4)) /* GPIOB4/I2C0_SDA0 */ +UNUSED(PIN(B, 5)) /* GPIOB5/I2C0_SCL0 */ +UNUSED(PIN(D, 4)) /* GPIOD4/CR_SIN3 */ +UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1 */ /* Pre-configured PSL balls: J8 K6 */ diff --git a/board/anahera/i2c.c b/board/anahera/i2c.c index b993a7978e..74208f4575 100644 --- a/board/anahera/i2c.c +++ b/board/anahera/i2c.c @@ -10,14 +10,6 @@ /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { - { - /* I2C0 */ - .name = "sensor", - .port = I2C_PORT_SENSOR, - .kbps = 400, - .scl = GPIO_EC_I2C_SENSOR_SCL, - .sda = GPIO_EC_I2C_SENSOR_SDA, - }, { /* I2C1 */ .name = "tcpc0", diff --git a/board/anahera/pwm.c b/board/anahera/pwm.c index 8e3d9c4022..54d0d05afb 100644 --- a/board/anahera/pwm.c +++ b/board/anahera/pwm.c @@ -27,10 +27,5 @@ const struct pwm_t pwm_channels[] = { .flags = PWM_CONFIG_OPEN_DRAIN, .freq = 25000 }, - [PWM_CH_FAN2] = { - .channel = 7, - .flags = PWM_CONFIG_OPEN_DRAIN, - .freq = 25000 - }, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); diff --git a/board/anahera/sensors.c b/board/anahera/sensors.c index 0f8484fbf0..43fc7ef045 100644 --- a/board/anahera/sensors.c +++ b/board/anahera/sensors.c @@ -4,13 +4,7 @@ */ #include "common.h" -#include "accelgyro.h" #include "adc_chip.h" -#include "driver/accel_bma2x2.h" -#include "driver/accelgyro_lsm6dsm.h" -#include "driver/als_tcs3400_public.h" -#include "hooks.h" -#include "motion_sense.h" #include "temp_sensor.h" #include "thermal.h" #include "temp_sensor/thermistor.h" @@ -48,222 +42,6 @@ const struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); -K_MUTEX_DEFINE(g_lid_accel_mutex); -K_MUTEX_DEFINE(g_base_accel_mutex); -static struct accelgyro_saved_data_t g_bma253_data; -static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; - -/* TODO(b/184779333): calibrate the orientation matrix on later board stage */ -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)} -}; - -/* TODO(b/184779743): verify orientation matrix */ -static const mat33_fp_t base_standard_ref = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; - -/* 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 from VPD */ - .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */ - }, -}; - -/* - * TODO: b/184702900 need to calibrate ALS/RGB sensor. At default settings, - * shining phone flashlight on sensor pegs all readings at 0xFFFF. - */ -static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { - .calibration.rgb_cal[X] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0), - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - } - }, - .calibration.rgb_cal[Y] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0), - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - }, - }, - .calibration.rgb_cal[Z] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(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, -}; - -struct motion_sensor_t motion_sensors[] = { - [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMA255, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &bma2x2_accel_drv, - .mutex = &g_lid_accel_mutex, - .drv_data = &g_bma253_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS, - .rot_standard_ref = &lid_standard_ref, /* identity matrix */ - .default_range = 2, /* g */ - .min_frequency = BMA255_ACCEL_MIN_FREQ, - .max_frequency = BMA255_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - /* Sensor on for lid angle detection */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - }, - }, - - [BASE_ACCEL] = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LSM6DSM, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &lsm6dsm_drv, - .mutex = &g_base_accel_mutex, - .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, - MOTIONSENSE_TYPE_ACCEL), - .int_signal = GPIO_EC_IMU_INT_R_L, - .flags = MOTIONSENSE_FLAG_INT_SIGNAL, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, - .rot_standard_ref = &base_standard_ref, - .default_range = 4, /* g */ - .min_frequency = LSM6DSM_ODR_MIN_VAL, - .max_frequency = LSM6DSM_ODR_MAX_VAL, - .config = { - [SENSOR_CONFIG_EC_S0] = { - .odr = 13000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - }, - }, - - [BASE_GYRO] = { - .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LSM6DSM, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &lsm6dsm_drv, - .mutex = &g_base_accel_mutex, - .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, - MOTIONSENSE_TYPE_GYRO), - .int_signal = GPIO_EC_IMU_INT_R_L, - .flags = MOTIONSENSE_FLAG_INT_SIGNAL, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, - .default_range = 1000 | ROUND_UP_FLAG, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = LSM6DSM_ODR_MIN_VAL, - .max_frequency = LSM6DSM_ODR_MAX_VAL, - .config = { - [SENSOR_CONFIG_EC_S0] = { - .odr = 13000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - }, - }, - - [CLEAR_ALS] = { - .name = "Clear Light", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_TCS3400, - .type = MOTIONSENSE_TYPE_LIGHT, - .location = MOTIONSENSE_LOC_CAMERA, - .drv = &tcs3400_drv, - .drv_data = &g_tcs3400_data, - .port = I2C_PORT_SENSOR, - .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_CAMERA, - .drv = &tcs3400_rgb_drv, - .drv_data = &g_tcs3400_rgb_data, - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - }, -}; -const 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); - -static void board_sensors_init(void) -{ - /* Enable interrupt for the TCS3400 color light sensor */ - gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_R_L); - /* Enable gpio interrupt for base accelgyro sensor */ - gpio_enable_interrupt(GPIO_EC_IMU_INT_R_L); -} -DECLARE_HOOK(HOOK_INIT, board_sensors_init, HOOK_PRIO_INIT_I2C + 1); - /* Temperature sensor configuration */ const struct temp_sensor_t temp_sensors[] = { [TEMP_SENSOR_1_DDR] = { diff --git a/board/anahera/usbc_config.h b/board/anahera/usbc_config.h index dcaa52d7a9..c314466f77 100644 --- a/board/anahera/usbc_config.h +++ b/board/anahera/usbc_config.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* Redrix board-specific USB-C configuration */ +/* Anahera board-specific USB-C configuration */ #ifndef __CROS_EC_USBC_CONFIG_H #define __CROS_EC_USBC_CONFIG_H -- cgit v1.2.1