diff options
Diffstat (limited to 'board/lalala')
-rw-r--r-- | board/lalala/battery.c | 2 | ||||
-rw-r--r-- | board/lalala/board.c | 121 | ||||
-rw-r--r-- | board/lalala/board.h | 56 | ||||
-rw-r--r-- | board/lalala/build.mk | 2 | ||||
-rw-r--r-- | board/lalala/cbi_ssfc.c | 6 | ||||
-rw-r--r-- | board/lalala/cbi_ssfc.h | 3 | ||||
-rw-r--r-- | board/lalala/ec.tasklist | 2 | ||||
-rw-r--r-- | board/lalala/gpio.inc | 2 | ||||
-rw-r--r-- | board/lalala/led.c | 39 | ||||
-rw-r--r-- | board/lalala/usb_pd_policy.c | 6 |
10 files changed, 116 insertions, 123 deletions
diff --git a/board/lalala/battery.c b/board/lalala/battery.c index 326ac93a6b..4edf5fa864 100644 --- a/board/lalala/battery.c +++ b/board/lalala/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * diff --git a/board/lalala/board.c b/board/lalala/board.c index 59eb9fd4a8..78404d6821 100644 --- a/board/lalala/board.c +++ b/board/lalala/board.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -51,13 +51,13 @@ #include "usb_pd.h" #include "usb_pd_tcpm.h" -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args) #define INT_RECHECK_US 5000 -#define ADC_VOL_UP_MASK BIT(0) -#define ADC_VOL_DOWN_MASK BIT(1) +#define ADC_VOL_UP_MASK BIT(0) +#define ADC_VOL_DOWN_MASK BIT(1) static uint8_t new_adc_key_state; @@ -110,8 +110,8 @@ static const struct ec_response_keybd_config lalala_keybd = { .capabilities = KEYBD_CAP_SCRNLOCK_KEY, }; -__override const struct ec_response_keybd_config -*board_vivaldi_keybd_config(void) +__override const struct ec_response_keybd_config * +board_vivaldi_keybd_config(void) { return &lalala_keybd; } @@ -152,7 +152,6 @@ static void usb_c0_interrupt(enum gpio_signal s) /* Check the line again in 5ms */ hook_call_deferred(&check_c0_line_data, INT_RECHECK_US); - } /* C1 interrupt line shared by BC 1.2, TCPC, and charger */ @@ -226,22 +225,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* Thermistors */ const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_1] = {.name = "Memory", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_1}, - [TEMP_SENSOR_2] = {.name = "Ambient", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_2}, + [TEMP_SENSOR_1] = { .name = "Memory", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_1 }, + [TEMP_SENSOR_2] = { .name = "Ambient", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_2 }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_A \ - { \ +#define THERMAL_A \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = 0, \ [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ @@ -258,8 +257,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_B \ - { \ +#define THERMAL_B \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = 0, \ [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ @@ -334,13 +333,11 @@ int board_is_sourcing_vbus(int port) tcpc_read(port, TCPC_REG_POWER_STATUS, ®val); return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS); - } int board_set_active_charge_port(int port) { - int is_real_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_MAX_COUNT); + int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; int old_port; @@ -400,8 +397,8 @@ int board_set_active_charge_port(int port) return EC_SUCCESS; } -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) +void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, + int charge_mv) { int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT); @@ -426,18 +423,13 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; /* Matrices to rotate accelerometers into the standard reference. */ -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)} -}; - -static const mat33_fp_t base_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +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) } }; +static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 }, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; /* BMA253 private data */ static struct accelgyro_saved_data_t g_bma253_data; @@ -445,11 +437,9 @@ static struct accelgyro_saved_data_t g_bma253_data; /* BMI160 private data */ static struct bmi_drv_data_t g_bmi160_data; -static const mat33_fp_t base_icm_ref = { - { FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 }, + { 0, FLOAT_TO_FP(1), 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; /* ICM426 private data */ static struct icm_drv_data_t g_icm426xx_data; @@ -633,7 +623,7 @@ void board_init(void) gmr_tablet_switch_disable(); /* Base accel is not stuffed, don't allow line to float */ gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L, - GPIO_INPUT | GPIO_PULL_DOWN); + GPIO_INPUT | GPIO_PULL_DOWN); } /* Turn on 5V if the system is on, otherwise turn it off. */ @@ -648,20 +638,19 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void motion_interrupt(enum gpio_signal signal) { - switch (get_cbi_ssfc_base_sensor()) { - case SSFC_SENSOR_ICM426XX: - icm426xx_interrupt(signal); - break; - case SSFC_SENSOR_BMI160: - default: - bmi160_interrupt(signal); - break; - } + switch (get_cbi_ssfc_base_sensor()) { + case SSFC_SENSOR_ICM426XX: + icm426xx_interrupt(signal); + break; + case SSFC_SENSOR_BMI160: + default: + bmi160_interrupt(signal); + break; + } } -__override void ocpc_get_pid_constants(int *kp, int *kp_div, - int *ki, int *ki_div, - int *kd, int *kd_div) +__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki, + int *ki_div, int *kd, int *kd_div) { *kp = 1; *kp_div = 20; @@ -737,18 +726,24 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { }, }; -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { +const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { - .usb_port = 0, - .i2c_port = I2C_PORT_USB_C0, - .i2c_addr_flags = PI3USB3X532_I2C_ADDR0, - .driver = &pi3usb3x532_usb_mux_driver, + .mux = + &(const struct usb_mux){ + .usb_port = 0, + .i2c_port = I2C_PORT_USB_C0, + .i2c_addr_flags = PI3USB3X532_I2C_ADDR0, + .driver = &pi3usb3x532_usb_mux_driver, + }, }, { - .usb_port = 1, - .i2c_port = I2C_PORT_SUB_USB_C1, - .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM, - .driver = &ps8802_usb_mux_driver, + .mux = + &(const struct usb_mux){ + .usb_port = 1, + .i2c_port = I2C_PORT_SUB_USB_C1, + .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM, + .driver = &ps8802_usb_mux_driver, + }, } }; diff --git a/board/lalala/board.h b/board/lalala/board.h index c8f40d518d..4967e49752 100644 --- a/board/lalala/board.h +++ b/board/lalala/board.h @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -22,11 +22,14 @@ /* Charger */ #define CONFIG_CHARGER_RAA489000 +#define PD_MAX_VOLTAGE_MV 20000 #define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 #define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */ +#define CONFIG_OCPC_DEF_RBATT_MOHMS \ + 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \ + */ #define CONFIG_OCPC -#undef CONFIG_CHARGER_SINGLE_CHIP +#undef CONFIG_CHARGER_SINGLE_CHIP #undef CONFIG_CMD_CHARGER_DUMP #undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE #define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC) @@ -44,7 +47,7 @@ /* PWM */ #define CONFIG_PWM -#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */ +#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */ /* Temp sensor */ #define CONFIG_TEMP_SENSOR @@ -81,16 +84,16 @@ #define CONFIG_USB_PD_5V_EN_CUSTOM /* I2C configuration */ -#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 -#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 +#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 +#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 +#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 +#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 #define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 +#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* TODO(b:147440290): Need to handle multiple charger ICs */ -#define I2C_PORT_CHARGER I2C_PORT_USB_C0 +#define I2C_PORT_CHARGER I2C_PORT_USB_C0 -#define I2C_PORT_ACCEL I2C_PORT_SENSOR +#define I2C_PORT_ACCEL I2C_PORT_SENSOR #define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */ @@ -99,15 +102,15 @@ #define CONFIG_CMD_ACCEL_INFO #define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT -#define CONFIG_ACCEL_BMA255 /* Lid accel */ -#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ -#define CONFIG_ACCEL_KX022 /* Lid accel */ -#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/ +#define CONFIG_ACCEL_BMA255 /* Lid accel */ +#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ +#define CONFIG_ACCEL_KX022 /* Lid accel */ +#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/ /* Lid operates in forced mode, base in FIFO */ #define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) #define CONFIG_ACCEL_FIFO -#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */ +#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */ #define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3) #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ @@ -143,25 +146,16 @@ enum chg_id { }; enum adc_channel { - ADC_TEMP_SENSOR_1, /* ADC0 */ - ADC_TEMP_SENSOR_2, /* ADC1 */ - ADC_SUB_ANALOG, /* ADC2 */ - ADC_VSNS_PP3300_A, /* ADC9 */ + ADC_TEMP_SENSOR_1, /* ADC0 */ + ADC_TEMP_SENSOR_2, /* ADC1 */ + ADC_SUB_ANALOG, /* ADC2 */ + ADC_VSNS_PP3300_A, /* ADC9 */ ADC_CH_COUNT }; -enum temp_sensor_id { - TEMP_SENSOR_1, - TEMP_SENSOR_2, - TEMP_SENSOR_COUNT -}; +enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT }; -enum sensor_id { - LID_ACCEL, - BASE_ACCEL, - BASE_GYRO, - SENSOR_COUNT -}; +enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT }; enum pwm_channel { PWM_CH_KBLIGHT, diff --git a/board/lalala/build.mk b/board/lalala/build.mk index b012d8d502..eb422dae93 100644 --- a/board/lalala/build.mk +++ b/board/lalala/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Copyright 2021 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # diff --git a/board/lalala/cbi_ssfc.c b/board/lalala/cbi_ssfc.c index c4b859f133..81f3ee0dad 100644 --- a/board/lalala/cbi_ssfc.c +++ b/board/lalala/cbi_ssfc.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST); enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void) { - return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor; + return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor; } enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void) { - return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor; + return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor; } diff --git a/board/lalala/cbi_ssfc.h b/board/lalala/cbi_ssfc.h index 935049b6ae..bf8853a43a 100644 --- a/board/lalala/cbi_ssfc.h +++ b/board/lalala/cbi_ssfc.h @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void); */ enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void); - #endif /* _DEDEDE_CBI_SSFC__H_ */ diff --git a/board/lalala/ec.tasklist b/board/lalala/ec.tasklist index d4fb416bce..29666dd959 100644 --- a/board/lalala/ec.tasklist +++ b/board/lalala/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/board/lalala/gpio.inc b/board/lalala/gpio.inc index 3d81cd089d..8d37079ca4 100644 --- a/board/lalala/gpio.inc +++ b/board/lalala/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2021 The Chromium OS Authors. All rights reserved. + * Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/board/lalala/led.c b/board/lalala/led.c index cfe6f9eb6a..db36e2cb0b 100644 --- a/board/lalala/led.c +++ b/board/lalala/led.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5; __override const int led_charge_lvl_2 = 95; __override struct led_descriptor - led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { - [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 3 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, - [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC}, - {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} }, -}; + led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { + [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER, + LED_INDEFINITE } }, + [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER, + LED_INDEFINITE } }, + [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 3 * LED_ONE_SEC } }, + [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC }, + { EC_LED_COLOR_AMBER, + 2 * LED_ONE_SEC } }, + }; -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED -}; +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); diff --git a/board/lalala/usb_pd_policy.c b/board/lalala/usb_pd_policy.c index fd9018a3f0..3410726e87 100644 --- a/board/lalala/usb_pd_policy.c +++ b/board/lalala/usb_pd_policy.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,8 +10,8 @@ #include "driver/tcpm/tcpci.h" #include "usb_pd.h" -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) -#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args) int pd_check_vconn_swap(int port) { |