diff options
Diffstat (limited to 'board/redrix')
-rw-r--r-- | board/redrix/battery.c | 2 | ||||
-rw-r--r-- | board/redrix/board.c | 6 | ||||
-rw-r--r-- | board/redrix/board.h | 158 | ||||
-rw-r--r-- | board/redrix/build.mk | 2 | ||||
-rw-r--r-- | board/redrix/cbi_ssfc.c | 2 | ||||
-rw-r--r-- | board/redrix/cbi_ssfc.h | 2 | ||||
-rw-r--r--[l---------] | board/redrix/charger.c | 91 | ||||
-rw-r--r-- | board/redrix/ec.tasklist | 2 | ||||
-rw-r--r-- | board/redrix/fans.c | 6 | ||||
-rw-r--r-- | board/redrix/fw_config.c | 4 | ||||
-rw-r--r-- | board/redrix/fw_config.h | 21 | ||||
-rw-r--r-- | board/redrix/gpio.inc | 2 | ||||
-rw-r--r-- | board/redrix/i2c.c | 2 | ||||
-rw-r--r-- | board/redrix/keyboard.c | 15 | ||||
-rw-r--r-- | board/redrix/led.c | 77 | ||||
-rw-r--r-- | board/redrix/pwm.c | 2 | ||||
-rw-r--r-- | board/redrix/sensors.c | 76 | ||||
-rw-r--r-- | board/redrix/thermal.c | 116 | ||||
-rw-r--r-- | board/redrix/usbc_config.c | 58 | ||||
-rw-r--r-- | board/redrix/usbc_config.h | 10 |
20 files changed, 360 insertions, 294 deletions
diff --git a/board/redrix/battery.c b/board/redrix/battery.c index 4e74b92acb..c5c144113b 100644 --- a/board/redrix/battery.c +++ b/board/redrix/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/redrix/board.c b/board/redrix/board.c index 5cf76b5447..e66a1ce518 100644 --- a/board/redrix/board.c +++ b/board/redrix/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. */ @@ -31,8 +31,8 @@ #include "gpio_list.h" /* Must come after other header files. */ /* Console output macros */ -#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) -#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) +#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args) +#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args) /* Battery discharging over-current limit is 8A */ #define BATT_OC_LIMIT -8000 diff --git a/board/redrix/board.h b/board/redrix/board.h index 96b48bd6be..211af39816 100644 --- a/board/redrix/board.h +++ b/board/redrix/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. */ @@ -23,15 +23,15 @@ #define CONFIG_CHIPSET_RESUME_INIT_HOOK /* Sensors */ -#define CONFIG_ACCEL_BMA255 /* Lid accel */ -#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */ -#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ +#define CONFIG_ACCEL_BMA255 /* Lid accel */ +#define CONFIG_ACCEL_BMA4XX /* 2nd source 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_UPDATE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL +#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL /* TCS3400 ALS */ #define CONFIG_ALS @@ -48,9 +48,7 @@ #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_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS)) /* Sensor console commands */ #define CONFIG_CMD_ACCELS @@ -65,7 +63,7 @@ #endif /* USB Type A Features */ -#define USB_PORT_COUNT 1 +#define USB_PORT_COUNT 1 #define CONFIG_USB_PORT_POWER_DUMB /* USB Type C and USB PD defines */ @@ -73,7 +71,7 @@ #define CONFIG_IO_EXPANDER #define CONFIG_IO_EXPANDER_NCT38XX -#define CONFIG_IO_EXPANDER_PORT_COUNT 2 +#define CONFIG_IO_EXPANDER_PORT_COUNT 2 #define CONFIG_USB_PD_FRS_PPC @@ -83,17 +81,17 @@ #define CONFIG_USBC_PPC_NX20P3483 /* TODO: b/193452481 - measure and check these values on redrix */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */ -#define PD_VCONN_SWAP_DELAY 5000 /* us */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ +#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */ +#define PD_VCONN_SWAP_DELAY 5000 /* us */ /* * Passive USB-C cables only support up to 60W. */ -#define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_POWER_MW 60000 -#define PD_MAX_CURRENT_MA 3000 -#define PD_MAX_VOLTAGE_MV 20000 +#define PD_OPERATING_POWER_MW 15000 +#define PD_MAX_POWER_MW 60000 +#define PD_MAX_CURRENT_MA 3000 +#define PD_MAX_VOLTAGE_MV 20000 /* * Macros for GPIO signals used in common code that don't match the @@ -101,73 +99,74 @@ * then redefined here to so it's more clear which signal is being used for * which purpose. */ -#define GPIO_AC_PRESENT GPIO_ACOK_OD -#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL -#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL -#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL -#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW -#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV -#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE -#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL -#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L -#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 GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK +#define GPIO_AC_PRESENT GPIO_ACOK_OD +#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL +#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL +#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL +#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW +#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV +#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE +#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL +#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L +#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 GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK /* * GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup * signal. */ -#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL -#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG -#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK -#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL -#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL -#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL -#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL -#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 +#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL +#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG +#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK +#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL +#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL +#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL +#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL +#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_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 +#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0 +#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 -#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0 -#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1 -#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_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 +#define I2C_ADDR_EEPROM_FLAGS 0x50 /* * see b/174768555#comment22 */ -#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56 -#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x58 +#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56 +#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x58 /* Enabling Thunderbolt-compatible mode */ #define CONFIG_USB_PD_TBT_COMPAT_MODE /* Enabling USB4 mode */ #define CONFIG_USB_PD_USB4 +#define CONFIG_USB_PD_DATA_RESET_MSG /* Retimer */ #define CONFIG_USBC_RETIMER_FW_UPDATE @@ -179,9 +178,9 @@ #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B /* Fan features */ -#define CONFIG_FANS FAN_CH_COUNT +#define CONFIG_FANS FAN_CH_COUNT #define CONFIG_CUSTOM_FAN_CONTROL -#define RPM_DEVIATION 1 +#define RPM_DEVIATION 1 /* Charger defines */ #define CONFIG_CHARGER_BQ25720 @@ -192,12 +191,12 @@ * discharge current limit and what was tested to prevent the AP * rebooting with low charge level batteries. */ -#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 8192 +#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 8192 #define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM -#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70 +#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70 #define CONFIG_CHARGE_RAMP_HW -#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10 +#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10 +#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10 #define CONFIG_CHARGER_PROFILE_OVERRIDE /* Keyboard features */ @@ -207,7 +206,7 @@ #ifndef __ASSEMBLER__ -#include "gpio_signal.h" /* needed by registers.h */ +#include "gpio_signal.h" /* needed by registers.h */ #include "registers.h" #include "usbc_config.h" @@ -236,35 +235,20 @@ enum sensor_id { SENSOR_COUNT }; -enum ioex_port { - IOEX_C0_NCT38XX = 0, - IOEX_C1_NCT38XX, - IOEX_PORT_COUNT -}; +enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT }; -enum battery_type { - BATTERY_DYNAPACK_COS, - BATTERY_TYPE_COUNT -}; +enum battery_type { BATTERY_DYNAPACK_COS, BATTERY_TYPE_COUNT }; enum pwm_channel { - PWM_CH_KBLIGHT = 0, /* PWM3 */ - PWM_CH_FAN, /* PWM5 */ - PWM_CH_FAN2, /* PWM7 */ + 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 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 -}; +enum mft_channel { MFT_CH_0 = 0, MFT_CH_1, MFT_CH_COUNT }; #ifdef CONFIG_KEYBOARD_FACTORY_TEST extern const int keyboard_factory_scan_pins[][2]; diff --git a/board/redrix/build.mk b/board/redrix/build.mk index 7177a844ad..e021ebc4f4 100644 --- a/board/redrix/build.mk +++ b/board/redrix/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/redrix/cbi_ssfc.c b/board/redrix/cbi_ssfc.c index 364b3d96fe..e0e954a7a6 100644 --- a/board/redrix/cbi_ssfc.c +++ b/board/redrix/cbi_ssfc.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 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/redrix/cbi_ssfc.h b/board/redrix/cbi_ssfc.h index ddcfbb9281..724daa3782 100644 --- a/board/redrix/cbi_ssfc.h +++ b/board/redrix/cbi_ssfc.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 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/redrix/charger.c b/board/redrix/charger.c index 476ce97df2..a4fa209246 120000..100644 --- a/board/redrix/charger.c +++ b/board/redrix/charger.c @@ -1 +1,90 @@ -../../baseboard/brya/charger_bq25720.c
\ No newline at end of file +/* 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. + */ + +#include "common.h" + +#include "charge_manager.h" +#include "charge_state_v2.h" +#include "charger.h" +#include "compile_time_macros.h" +#include "console.h" +#include "driver/charger/bq25710.h" +#include "usbc_ppc.h" +#include "usb_pd.h" +#include "util.h" + +#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) + +#ifndef CONFIG_ZEPHYR +/* Charger Chip Configuration */ +const struct charger_config_t chg_chips[] = { + { + .i2c_port = I2C_PORT_CHARGER, + .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS, + .drv = &bq25710_drv, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM); +#endif + +int board_set_active_charge_port(int port) +{ + int is_valid_port = board_is_usb_pd_port_present(port); + int i; + + if (port == CHARGE_PORT_NONE) { + CPRINTSUSB("Disabling all charger ports"); + + /* Disable all ports. */ + for (i = 0; i < ppc_cnt; i++) { + /* + * Do not return early if one fails otherwise we can + * get into a boot loop assertion failure. + */ + if (ppc_vbus_sink_enable(i, 0)) + CPRINTSUSB("Disabling C%d as sink failed.", i); + } + + return EC_SUCCESS; + } else if (!is_valid_port) { + return EC_ERROR_INVAL; + } + + /* Check if the port is sourcing VBUS. */ + if (ppc_is_sourcing_vbus(port)) { + CPRINTFUSB("Skip enable C%d", port); + return EC_ERROR_INVAL; + } + + CPRINTSUSB("New charge port: C%d", port); + + /* + * Turn off the other ports' sink path FETs, before enabling the + * requested charge port. + */ + for (i = 0; i < ppc_cnt; i++) { + if (i == port) + continue; + + if (ppc_vbus_sink_enable(i, 0)) + CPRINTSUSB("C%d: sink path disable failed.", i); + } + + /* Enable requested charge port. */ + if (ppc_vbus_sink_enable(port, 1)) { + CPRINTSUSB("C%d: sink path enable failed.", port); + return EC_ERROR_UNKNOWN; + } + + return EC_SUCCESS; +} + +__overridable void board_set_charge_limit(int port, int supplier, int charge_ma, + int max_ma, int charge_mv) +{ + charge_set_input_current_limit( + MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); +} diff --git a/board/redrix/ec.tasklist b/board/redrix/ec.tasklist index cfc1fea6ea..f755b40858 100644 --- a/board/redrix/ec.tasklist +++ b/board/redrix/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/redrix/fans.c b/board/redrix/fans.c index d464eeab67..9adf3cabce 100644 --- a/board/redrix/fans.c +++ b/board/redrix/fans.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. */ @@ -30,14 +30,14 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); static const struct fan_conf fan_conf_0 = { .flags = FAN_USE_RPM_MODE, - .ch = MFT_CH_0, /* Use MFT id to control fan */ + .ch = MFT_CH_0, /* Use MFT id to control fan */ .pgood_gpio = -1, .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 */ + .ch = MFT_CH_1, /* Use MFT id to control fan */ .pgood_gpio = -1, .enable_gpio = GPIO_EN_PP5000_FAN2, }; diff --git a/board/redrix/fw_config.c b/board/redrix/fw_config.c index e59688b17d..cfbf46291c 100644 --- a/board/redrix/fw_config.c +++ b/board/redrix/fw_config.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. */ @@ -9,7 +9,7 @@ #include "cros_board_info.h" #include "fw_config.h" -#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args) static union redrix_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); diff --git a/board/redrix/fw_config.h b/board/redrix/fw_config.h index 9a73890f7d..02157bf23e 100644 --- a/board/redrix/fw_config.h +++ b/board/redrix/fw_config.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. */ @@ -19,20 +19,17 @@ enum ec_cfg_keyboard_backlight_type { KEYBOARD_BACKLIGHT_ENABLED = 1 }; -enum ec_cfg_eps_type { - EPS_DISABLED = 0, - EPS_ENABLED = 1 -}; +enum ec_cfg_eps_type { EPS_DISABLED = 0, EPS_ENABLED = 1 }; union redrix_cbi_fw_config { struct { - uint32_t sd_db : 2; - enum ec_cfg_keyboard_backlight_type kb_bl : 1; - uint32_t audio : 3; - uint32_t lte_db : 2; - uint32_t ufc : 2; - enum ec_cfg_eps_type eps : 1; - uint32_t reserved_1 : 21; + uint32_t sd_db : 2; + enum ec_cfg_keyboard_backlight_type kb_bl : 1; + uint32_t audio : 3; + uint32_t lte_db : 2; + uint32_t ufc : 2; + enum ec_cfg_eps_type eps : 1; + uint32_t reserved_1 : 21; }; uint32_t raw_value; }; diff --git a/board/redrix/gpio.inc b/board/redrix/gpio.inc index 99f5237003..0f39efe33b 100644 --- a/board/redrix/gpio.inc +++ b/board/redrix/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/redrix/i2c.c b/board/redrix/i2c.c index 5b71c4eb71..0d6f92ad90 100644 --- a/board/redrix/i2c.c +++ b/board/redrix/i2c.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/redrix/keyboard.c b/board/redrix/keyboard.c index e1a5381a6c..11cfaaa02d 100644 --- a/board/redrix/keyboard.c +++ b/board/redrix/keyboard.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. */ @@ -74,7 +74,6 @@ board_vivaldi_keybd_config(void) return &keybd2; } - #ifdef CONFIG_KEYBOARD_FACTORY_TEST /* * Map keyboard connector pins to EC GPIO pins for factory test. @@ -82,13 +81,13 @@ board_vivaldi_keybd_config(void) * The connector has 24 pins total, and there is no pin 0. */ const int keyboard_factory_scan_pins[][2] = { - {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6}, - {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7}, - {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7}, - {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3}, - {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1}, + { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, + { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 }, + { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 }, + { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, + { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, }; const int keyboard_factory_scan_pins_used = - ARRAY_SIZE(keyboard_factory_scan_pins); + ARRAY_SIZE(keyboard_factory_scan_pins); #endif diff --git a/board/redrix/led.c b/board/redrix/led.c index 86e60b725a..c8654b3589 100644 --- a/board/redrix/led.c +++ b/board/redrix/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. * @@ -24,16 +24,14 @@ #define POWER_LED_OFF 1 #define LED_TICK_INTERVAL_MS (500 * MSEC) -#define LED_CYCLE_TIME_MS (2000 * MSEC) -#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS) -#define LED_ON_TIME_MS (1000 * MSEC) -#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS) - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_LEFT_LED, - EC_LED_ID_RIGHT_LED, - EC_LED_ID_POWER_LED -}; +#define LED_CYCLE_TIME_MS (2000 * MSEC) +#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS) +#define LED_ON_TIME_MS (1000 * MSEC) +#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS) + +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED, + EC_LED_ID_RIGHT_LED, + EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -41,22 +39,19 @@ enum led_color { LED_OFF = 0, LED_AMBER, LED_WHITE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ + LED_COLOR_COUNT /* Number of colors, not a color itself */ }; -enum led_port { - LEFT_PORT = 0, - RIGHT_PORT -}; +enum led_port { LEFT_PORT = 0, RIGHT_PORT }; static void led_set_color_battery(int port, enum led_color color) { enum gpio_signal amber_led, white_led; amber_led = (port == RIGHT_PORT ? GPIO_C1_CHARGE_LED_AMBER_L : - GPIO_C0_CHARGE_LED_AMBER_L); + GPIO_C0_CHARGE_LED_AMBER_L); white_led = (port == RIGHT_PORT ? GPIO_C1_CHARGE_LED_WHITE_L : - GPIO_C0_CHARGE_LED_WHITE_L); + GPIO_C0_CHARGE_LED_WHITE_L); switch (color) { case LED_WHITE: @@ -151,16 +146,15 @@ static void set_active_port_color(enum led_color color) if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) led_set_color_battery(RIGHT_PORT, - (port == RIGHT_PORT) ? color : LED_OFF); + (port == RIGHT_PORT) ? color : LED_OFF); if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) led_set_color_battery(LEFT_PORT, - (port == LEFT_PORT) ? color : LED_OFF); + (port == LEFT_PORT) ? color : LED_OFF); } static void led_set_battery(void) { static unsigned int battery_ticks; - uint32_t chflags = charge_get_flags(); battery_ticks++; @@ -172,43 +166,52 @@ static void led_set_battery(void) case PWR_STATE_DISCHARGE: if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { if (charge_get_percent() < 10) - led_set_color_battery(RIGHT_PORT, - (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + led_set_color_battery( + RIGHT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else led_set_color_battery(RIGHT_PORT, LED_OFF); } if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { if (charge_get_percent() < 10) - led_set_color_battery(LEFT_PORT, - (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + led_set_color_battery( + LEFT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else led_set_color_battery(LEFT_PORT, LED_OFF); } break; case PWR_STATE_ERROR: if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { - led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1) - ? LED_AMBER : LED_OFF); + led_set_color_battery( + RIGHT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); } if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { - led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) - ? LED_AMBER : LED_OFF); + led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) ? + LED_AMBER : + LED_OFF); } break; case PWR_STATE_CHARGE_NEAR_FULL: set_active_port_color(LED_WHITE); break; case PWR_STATE_IDLE: /* External power connected in IDLE */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - set_active_port_color((battery_ticks % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); - else - set_active_port_color(LED_WHITE); + set_active_port_color(LED_WHITE); + break; + case PWR_STATE_FORCED_IDLE: + set_active_port_color( + (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); break; default: /* Other states don't alter LED behavior */ diff --git a/board/redrix/pwm.c b/board/redrix/pwm.c index 8e3d9c4022..dac3991526 100644 --- a/board/redrix/pwm.c +++ b/board/redrix/pwm.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/redrix/sensors.c b/board/redrix/sensors.c index df0e94f518..db645e5942 100644 --- a/board/redrix/sensors.c +++ b/board/redrix/sensors.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. */ @@ -57,17 +57,13 @@ static struct accelgyro_saved_data_t g_bma253_data; static struct accelgyro_saved_data_t g_bma422_data; static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; -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 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 = { - { 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 = { { 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 = { @@ -118,7 +114,7 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { .cover_scale = ALS_CHANNEL_SCALE(1.6) } }, - .calibration.irt = INT_TO_FP(0.41), + .calibration.irt = FLOAT_TO_FP(0.41), .saturation.again = TCS_DEFAULT_AGAIN, .saturation.atime = TCS_DEFAULT_ATIME, }; @@ -291,38 +287,30 @@ 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] = { - .name = "DDR", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_1_DDR - }, - [TEMP_SENSOR_2_SOC] = { - .name = "SOC", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_2_SOC - }, - [TEMP_SENSOR_3_CHARGER] = { - .name = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_3_CHARGER - }, - [TEMP_SENSOR_4_REGULATOR] = { - .name = "Regulator", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_4_REGULATOR - }, + [TEMP_SENSOR_1_DDR] = { .name = "DDR", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_1_DDR }, + [TEMP_SENSOR_2_SOC] = { .name = "SOC", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_2_SOC }, + [TEMP_SENSOR_3_CHARGER] = { .name = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_3_CHARGER }, + [TEMP_SENSOR_4_REGULATOR] = { .name = "Regulator", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_4_REGULATOR }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_DDR \ - { \ +#define THERMAL_DDR \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ @@ -341,8 +329,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ddr = THERMAL_DDR; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CPU \ - { \ +#define THERMAL_CPU \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ @@ -356,8 +344,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CHARGER \ - { \ +#define THERMAL_CHARGER \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ @@ -372,8 +360,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger = /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_REGULATOR \ - { \ +#define THERMAL_REGULATOR \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ diff --git a/board/redrix/thermal.c b/board/redrix/thermal.c index 71902a5430..e192157943 100644 --- a/board/redrix/thermal.c +++ b/board/redrix/thermal.c @@ -1,8 +1,9 @@ -/* 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. */ +#include "builtin/assert.h" #include "chipset.h" #include "common.h" #include "console.h" @@ -16,7 +17,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_THERMAL, outstr) -#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args) +#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args) struct fan_step { /* @@ -40,97 +41,96 @@ static const struct fan_step *fan_step_table; static const struct fan_step fan_table_clamshell[] = { { /* level 0 */ - .on = {53, 53, 0, -1}, - .off = {99, 99, 99, -1}, - .rpm = {0, 0}, + .on = { 53, 53, 0, -1 }, + .off = { 99, 99, 99, -1 }, + .rpm = { 0, 0 }, }, { /* level 1 */ - .on = {54, 54, 0, -1}, - .off = {53, 53, 99, -1}, - .rpm = {3900, 4300}, + .on = { 54, 54, 0, -1 }, + .off = { 53, 53, 99, -1 }, + .rpm = { 3900, 4300 }, }, { /* level 2 */ - .on = {55, 55, 0, -1}, - .off = {54, 54, 99, -1}, - .rpm = {4800, 5200}, + .on = { 55, 55, 0, -1 }, + .off = { 54, 54, 99, -1 }, + .rpm = { 4800, 5200 }, }, { /* level 3 */ - .on = {56, 56, 0, -1}, - .off = {54, 55, 99, -1}, - .rpm = {5000, 5500}, + .on = { 56, 56, 0, -1 }, + .off = { 54, 55, 99, -1 }, + .rpm = { 5000, 5500 }, }, { /* level 4 */ - .on = {57, 57, 61, -1}, - .off = {56, 56, 59, -1}, - .rpm = {5200, 5700}, + .on = { 57, 57, 61, -1 }, + .off = { 56, 56, 59, -1 }, + .rpm = { 5200, 5700 }, }, { /* level 5 */ - .on = {58, 58, 63, -1}, - .off = {57, 57, 61, -1}, - .rpm = {5700, 6200}, + .on = { 58, 58, 63, -1 }, + .off = { 57, 57, 61, -1 }, + .rpm = { 5700, 6200 }, }, { /* level 6 */ - .on = {100, 100, 100, -1}, - .off = {58, 58, 63, -1}, - .rpm = {6200, 6400}, + .on = { 100, 100, 100, -1 }, + .off = { 58, 58, 63, -1 }, + .rpm = { 6200, 6400 }, }, }; static const struct fan_step fan_table_tablet[] = { { /* level 0 */ - .on = {52, 55, 0, -1}, - .off = {99, 99, 99, -1}, - .rpm = {0, 0}, + .on = { 52, 55, 0, -1 }, + .off = { 99, 99, 99, -1 }, + .rpm = { 0, 0 }, }, { /* level 1 */ - .on = {53, 56, 0, -1}, - .off = {52, 55, 99, -1}, - .rpm = {4100, 4200}, + .on = { 53, 56, 0, -1 }, + .off = { 52, 55, 99, -1 }, + .rpm = { 4100, 4200 }, }, { /* level 2 */ - .on = {54, 57, 0, -1}, - .off = {53, 56, 99, -1}, - .rpm = {4500, 4800}, + .on = { 54, 57, 0, -1 }, + .off = { 53, 56, 99, -1 }, + .rpm = { 4500, 4800 }, }, { /* level 3 */ - .on = {55, 58, 0, -1}, - .off = {54, 57, 99, -1}, - .rpm = {4800, 5200}, + .on = { 55, 58, 0, -1 }, + .off = { 54, 57, 99, -1 }, + .rpm = { 4800, 5200 }, }, { /* level 4 */ - .on = {56, 59, 61, -1}, - .off = {55, 58, 59, -1}, - .rpm = {5100, 5400}, + .on = { 56, 59, 61, -1 }, + .off = { 55, 58, 59, -1 }, + .rpm = { 5100, 5400 }, }, { /* level 5 */ - .on = {57, 60, 63, -1}, - .off = {56, 59, 61, -1}, - .rpm = {5500, 5800}, + .on = { 57, 60, 63, -1 }, + .off = { 56, 59, 61, -1 }, + .rpm = { 5500, 5800 }, }, { /* level 6 */ - .on = {100, 100, 100, -1}, - .off = {57, 60, 63, -1}, - .rpm = {6000, 6200}, + .on = { 100, 100, 100, -1 }, + .off = { 57, 60, 63, -1 }, + .rpm = { 6000, 6200 }, }, }; #define NUM_FAN_LEVELS ARRAY_SIZE(fan_table_clamshell) -BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == - ARRAY_SIZE(fan_table_tablet)); +BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == ARRAY_SIZE(fan_table_tablet)); int fan_table_to_rpm(int fan, int *temp) { @@ -156,11 +156,12 @@ int fan_table_to_rpm(int fan, int *temp) temp[TEMP_SENSOR_3_CHARGER] < prev_tmp[TEMP_SENSOR_3_CHARGER]) { for (i = current_level; i > 0; i--) { if (temp[TEMP_SENSOR_1_DDR] < - fan_step_table[i].off[TEMP_SENSOR_1_DDR] && + fan_step_table[i].off[TEMP_SENSOR_1_DDR] && temp[TEMP_SENSOR_3_CHARGER] < - fan_step_table[i].off[TEMP_SENSOR_3_CHARGER] && + fan_step_table[i] + .off[TEMP_SENSOR_3_CHARGER] && temp[TEMP_SENSOR_2_SOC] < - fan_step_table[i].off[TEMP_SENSOR_2_SOC]) + fan_step_table[i].off[TEMP_SENSOR_2_SOC]) current_level = i - 1; else break; @@ -168,14 +169,15 @@ int fan_table_to_rpm(int fan, int *temp) } else if (temp[TEMP_SENSOR_1_DDR] > prev_tmp[TEMP_SENSOR_1_DDR] || temp[TEMP_SENSOR_2_SOC] > prev_tmp[TEMP_SENSOR_2_SOC] || temp[TEMP_SENSOR_3_CHARGER] > - prev_tmp[TEMP_SENSOR_3_CHARGER]) { + prev_tmp[TEMP_SENSOR_3_CHARGER]) { for (i = current_level; i < NUM_FAN_LEVELS; i++) { if ((temp[TEMP_SENSOR_1_DDR] > - fan_step_table[i].on[TEMP_SENSOR_1_DDR] && - temp[TEMP_SENSOR_3_CHARGER] > - fan_step_table[i].on[TEMP_SENSOR_3_CHARGER]) || + fan_step_table[i].on[TEMP_SENSOR_1_DDR] && + temp[TEMP_SENSOR_3_CHARGER] > + fan_step_table[i] + .on[TEMP_SENSOR_3_CHARGER]) || temp[TEMP_SENSOR_2_SOC] > - fan_step_table[i].on[TEMP_SENSOR_2_SOC]) + fan_step_table[i].on[TEMP_SENSOR_2_SOC]) current_level = i + 1; else break; @@ -206,10 +208,8 @@ int fan_table_to_rpm(int fan, int *temp) void board_override_fan_control(int fan, int *tmp) { - if (chipset_in_state(CHIPSET_STATE_ON | - CHIPSET_STATE_ANY_SUSPEND)) { + if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) { fan_set_rpm_mode(FAN_CH(fan), 1); - fan_set_rpm_target(FAN_CH(fan), - fan_table_to_rpm(fan, tmp)); + fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp)); } } diff --git a/board/redrix/usbc_config.c b/board/redrix/usbc_config.c index e463c15da1..a53e2c8909 100644 --- a/board/redrix/usbc_config.c +++ b/board/redrix/usbc_config.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. */ @@ -31,8 +31,8 @@ #include "usb_pd.h" #include "usb_pd_tcpm.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) /* USBC TCPC configuration */ const struct tcpc_config_t tcpc_config[] = { @@ -78,33 +78,43 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT); unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /* USBC mux configuration - Alder Lake includes internal mux */ -static const struct usb_mux usbc0_tcss_usb_mux = { - .usb_port = USBC_PORT_C0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, +static const struct usb_mux_chain usbc0_tcss_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C0, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; -static const struct usb_mux usbc1_tcss_usb_mux = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, +static const struct usb_mux_chain usbc1_tcss_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C1, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; -const struct usb_mux usb_muxes[] = { +const struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C0_MUX, - .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc0_tcss_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C0, + .driver = &bb_usb_retimer, + .hpd_update = bb_retimer_hpd_update, + .i2c_port = I2C_PORT_USB_C0_MUX, + .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, + }, + .next = &usbc0_tcss_usb_mux, }, [USBC_PORT_C1] = { - .usb_port = USBC_PORT_C1, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C1_MUX, - .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc1_tcss_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C1, + .driver = &bb_usb_retimer, + .hpd_update = bb_retimer_hpd_update, + .i2c_port = I2C_PORT_USB_C1_MUX, + .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, + }, + .next = &usbc1_tcss_usb_mux, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); diff --git a/board/redrix/usbc_config.h b/board/redrix/usbc_config.h index dcaa52d7a9..248e697572 100644 --- a/board/redrix/usbc_config.h +++ b/board/redrix/usbc_config.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. */ @@ -8,12 +8,8 @@ #ifndef __CROS_EC_USBC_CONFIG_H #define __CROS_EC_USBC_CONFIG_H -#define CONFIG_USB_PD_PORT_MAX_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 -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 }; #endif /* __CROS_EC_USBC_CONFIG_H */ |