diff options
Diffstat (limited to 'board/shuboz')
-rw-r--r-- | board/shuboz/battery.c | 4 | ||||
-rw-r--r-- | board/shuboz/board.c | 89 | ||||
-rw-r--r-- | board/shuboz/board.h | 89 | ||||
-rw-r--r-- | board/shuboz/build.mk | 2 | ||||
-rw-r--r-- | board/shuboz/ec.tasklist | 2 | ||||
-rw-r--r-- | board/shuboz/gpio.inc | 2 | ||||
-rw-r--r-- | board/shuboz/led.c | 45 |
7 files changed, 111 insertions, 122 deletions
diff --git a/board/shuboz/battery.c b/board/shuboz/battery.c index 155cadab41..f24c50d931 100644 --- a/board/shuboz/battery.c +++ b/board/shuboz/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -133,7 +133,7 @@ int charger_profile_override(struct charge_state_data *curr) return 0; if (current_level != 0) { - if (curr->requested_current > current_table[current_level-1]) + if (curr->requested_current > current_table[current_level - 1]) curr->requested_current = current_table[current_level - 1]; } diff --git a/board/shuboz/board.c b/board/shuboz/board.c index 027a6ee634..41d985df7c 100644 --- a/board/shuboz/board.c +++ b/board/shuboz/board.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -13,7 +13,7 @@ #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" #include "driver/bc12/pi3usb9201.h" -#include "driver/ppc/aoz1380.h" +#include "driver/ppc/aoz1380_public.h" #include "driver/ppc/nx20p348x.h" #include "driver/tcpm/nct38xx.h" #include "driver/usb_mux/amd_fp5.h" @@ -39,8 +39,8 @@ #include "usb_pd_tcpm.h" #include "usbc_ppc.h" -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) /* This I2C moved. Temporarily detect and support the V0 HW. */ int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1; @@ -62,15 +62,13 @@ static const mat33_fp_t lid_standard_ref = { { 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 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 base_standard_ref_icm = { - {FLOAT_TO_FP(1), 0, 0}, - {0, FLOAT_TO_FP(-1), 0}, - {0, 0, FLOAT_TO_FP(-1)}, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(-1) }, }; /* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ @@ -226,8 +224,7 @@ static void board_chipset_suspend(void) } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); -static int board_ps8743_mux_set(const struct usb_mux *me, - mux_state_t mux_state) +static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state) { int res; @@ -242,7 +239,6 @@ static int board_ps8743_mux_set(const struct usb_mux *me, return res; } - /***************************************************************************** * USB-C */ @@ -280,34 +276,44 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = { * Since FSUSB42UMX is not a i2c device, .i2c_port and * .i2c_addr_flags are not required here. */ -const struct usb_mux usbc0_sbu_mux = { - .usb_port = USBC_PORT_C0, - .driver = &usbc0_sbu_mux_driver, +const struct usb_mux_chain usbc0_sbu_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C0, + .driver = &usbc0_sbu_mux_driver, + }, }; -struct usb_mux usbc1_amd_fp5_usb_mux = { - .usb_port = USBC_PORT_C1, - .i2c_port = I2C_PORT_USB_AP_MUX, - .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, - .driver = &amd_fp5_usb_mux_driver, - .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP, +struct usb_mux_chain usbc1_amd_fp5_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C1, + .i2c_port = I2C_PORT_USB_AP_MUX, + .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, + .driver = &amd_fp5_usb_mux_driver, + .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP, + }, }; -struct usb_mux usb_muxes[] = { +struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .i2c_port = I2C_PORT_USB_AP_MUX, - .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, - .driver = &amd_fp5_usb_mux_driver, - .next_mux = &usbc0_sbu_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C0, + .i2c_port = I2C_PORT_USB_AP_MUX, + .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, + .driver = &amd_fp5_usb_mux_driver, + }, + .next = &usbc0_sbu_mux, }, [USBC_PORT_C1] = { - .usb_port = USBC_PORT_C1, - .i2c_port = I2C_PORT_TCPC1, - .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG, - .driver = &ps8743_usb_mux_driver, - .board_set = &board_ps8743_mux_set, - .next_mux = &usbc1_amd_fp5_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C1, + .i2c_port = I2C_PORT_TCPC1, + .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG, + .driver = &ps8743_usb_mux_driver, + .board_set = &board_ps8743_mux_set, + }, + .next = &usbc1_amd_fp5_usb_mux, } }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -350,8 +356,7 @@ void ppc_interrupt(enum gpio_signal signal) int board_set_active_charge_port(int port) { - int is_valid_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_MAX_COUNT); + int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; if (port == CHARGE_PORT_NONE) { @@ -372,7 +377,6 @@ int board_set_active_charge_port(int port) return EC_ERROR_INVAL; } - /* Check if the port is sourcing VBUS. */ if (ppc_is_sourcing_vbus(port)) { CPRINTFUSB("Skip enable C%d", port); @@ -474,7 +478,6 @@ static void reset_nct38xx_port(int port) msleep(NCT3807_RESET_POST_DELAY_MS); } - void board_reset_pd_mcu(void) { /* Reset TCPC0 */ @@ -545,11 +548,9 @@ int board_pd_set_frs_enable(int port, int enable) /* Use the TCPC to enable fast switch when FRS included */ if (port == USBC_PORT_C0) { - rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, - !!enable); + rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable); } else { - rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, - !!enable); + rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, !!enable); } return rv; diff --git a/board/shuboz/board.h b/board/shuboz/board.h index 6573273b93..ada5b1499d 100644 --- a/board/shuboz/board.h +++ b/board/shuboz/board.h @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -21,11 +21,11 @@ #define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PORT_ENABLE_DYNAMIC -#undef PD_MAX_POWER_MW -#define PD_MAX_POWER_MW 45000 -#undef PD_MAX_CURRENT_MA -#define PD_MAX_CURRENT_MA 3000 -#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON +#undef PD_MAX_POWER_MW +#define PD_MAX_POWER_MW 45000 +#undef PD_MAX_CURRENT_MA +#define PD_MAX_CURRENT_MA 3000 +#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON #define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 40000 #define CONFIG_CHARGER_PROFILE_OVERRIDE @@ -61,59 +61,46 @@ #define CONFIG_POWER_BUTTON_INIT_TIMEOUT 5 /* GPIO mapping from board specific name to EC common name. */ -#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL -#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL -#define GPIO_AC_PRESENT GPIO_ACOK_OD -#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL -#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL -#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE -#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW -#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV -#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L -#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L -#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L -#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L -#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK -#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L -#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL -#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD -#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD -#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L -#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL -#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL -#define GPIO_WP_L GPIO_EC_WP_L -#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE +#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL +#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL +#define GPIO_AC_PRESENT GPIO_ACOK_OD +#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL +#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL +#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE +#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW +#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV +#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L +#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L +#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L +#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L +#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK +#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L +#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL +#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD +#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD +#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L +#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL +#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL +#define GPIO_WP_L GPIO_EC_WP_L +#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE #ifndef __ASSEMBLER__ /* This I2C moved. Temporarily detect and support the V0 HW. */ extern int I2C_PORT_BATTERY; -enum adc_channel { - ADC_TEMP_SENSOR_CHARGER, - ADC_TEMP_SENSOR_SOC, - ADC_CH_COUNT -}; +enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT }; enum battery_type { BATTERY_CM1500, BATTERY_TYPE_COUNT, }; -enum pwm_channel { - PWM_CH_KBLIGHT = 0, - PWM_CH_COUNT -}; +enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT }; -enum ioex_port { - IOEX_C0_NCT3807 = 0, - IOEX_C1_NCT3807, - IOEX_PORT_COUNT -}; +enum ioex_port { IOEX_C0_NCT3807 = 0, IOEX_C1_NCT3807, IOEX_PORT_COUNT }; -#define PORT_TO_HPD(port) ((port == 0) \ - ? GPIO_USB3_C0_DP2_HPD \ - : GPIO_DP1_HPD) +#define PORT_TO_HPD(port) ((port == 0) ? GPIO_USB3_C0_DP2_HPD : GPIO_DP1_HPD) enum temp_sensor_id { TEMP_SENSOR_CHARGER = 0, @@ -122,17 +109,9 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -enum usba_port { - USBA_PORT_A0 = 0, - USBA_PORT_A1, - USBA_PORT_COUNT -}; +enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT }; -enum usbc_port { - USBC_PORT_C0 = 0, - USBC_PORT_C1, - USBC_PORT_COUNT -}; +enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT }; /***************************************************************************** * CBI EC FW Configuration diff --git a/board/shuboz/build.mk b/board/shuboz/build.mk index 1c0cbc4f63..45c71f962c 100644 --- a/board/shuboz/build.mk +++ b/board/shuboz/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright 2020 The Chromium OS Authors. All rights reserved. +# Copyright 2020 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/shuboz/ec.tasklist b/board/shuboz/ec.tasklist index d9c1606eb2..abc796f74f 100644 --- a/board/shuboz/ec.tasklist +++ b/board/shuboz/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 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/shuboz/gpio.inc b/board/shuboz/gpio.inc index b093a7e6d6..c824a80cd4 100644 --- a/board/shuboz/gpio.inc +++ b/board/shuboz/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2020 The Chromium OS Authors. All rights reserved. + * Copyright 2020 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/shuboz/led.c b/board/shuboz/led.c index af91f32ec6..dc3361ba5a 100644 --- a/board/shuboz/led.c +++ b/board/shuboz/led.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -9,28 +9,37 @@ #include "led_common.h" #include "led_onoff_states.h" -#define LED_OFF_LVL 1 -#define LED_ON_LVL 0 +#define LED_OFF_LVL 1 +#define LED_ON_LVL 0 __override const int led_charge_lvl_1; __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_WHITE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 3 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC}, - {LED_OFF, 2 * 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_WHITE, 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_WHITE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 3 * LED_ONE_SEC } }, + [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE, + 2 * LED_ONE_SEC }, + { LED_OFF, 2 * 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_WHITE, + 2 * LED_ONE_SEC }, + { EC_LED_COLOR_AMBER, + 2 * LED_ONE_SEC } }, + }; BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES); |