diff options
Diffstat (limited to 'board/volmar')
-rw-r--r-- | board/volmar/battery.c | 107 | ||||
-rw-r--r-- | board/volmar/board.c | 23 | ||||
-rw-r--r-- | board/volmar/board.h | 123 | ||||
-rw-r--r-- | board/volmar/build.mk | 2 | ||||
-rw-r--r-- | board/volmar/charger.c | 12 | ||||
-rw-r--r-- | board/volmar/ec.tasklist | 2 | ||||
-rw-r--r-- | board/volmar/fans.c | 10 | ||||
-rw-r--r-- | board/volmar/fw_config.c | 4 | ||||
-rw-r--r-- | board/volmar/fw_config.h | 14 | ||||
-rw-r--r-- | board/volmar/gpio.inc | 4 | ||||
-rw-r--r-- | board/volmar/i2c.c | 4 | ||||
-rw-r--r-- | board/volmar/keyboard.c | 6 | ||||
-rw-r--r-- | board/volmar/led.c | 39 | ||||
-rw-r--r-- | board/volmar/pwm.c | 2 | ||||
-rw-r--r-- | board/volmar/sensors.c | 44 | ||||
-rw-r--r-- | board/volmar/usbc_config.c | 44 | ||||
-rw-r--r-- | board/volmar/usbc_config.h | 10 |
17 files changed, 280 insertions, 170 deletions
diff --git a/board/volmar/battery.c b/board/volmar/battery.c index 3832fd8edf..852ed4b137 100644 --- a/board/volmar/battery.c +++ b/board/volmar/battery.c @@ -1,12 +1,16 @@ -/* 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. * * Battery pack vendor provided charging profile */ +#include "battery.h" #include "battery_fuel_gauge.h" #include "cbi.h" +#include "charge_ramp.h" +#include "charge_state.h" +#include "charger_profile_override.h" #include "common.h" #include "compile_time_macros.h" #include "gpio.h" @@ -64,6 +68,37 @@ const struct board_batt_params board_battery_info[] = { .discharging_max_c = 75, }, }, + /* COSMX AP20CBL Battery Information (new firmware ver) */ + [BATTERY_COSMX_AP20CBL_004] = { + .fuel_gauge = { + .manuf_name = "COSMX KT0030B004", + .device_name = "AP20CBL", + .ship_mode = { + .reg_addr = 0x3A, + .reg_data = { 0xC574, 0xC574 }, + }, + .fet = { + .mfgacc_support = 1, + .reg_addr = 0x0, + .reg_mask = 0x2000, + .disconnect_val = 0x2000, + .cfet_mask = 0x4000, + .cfet_off_val = 0x4000, + }, + }, + .batt_info = { + .voltage_max = 13200, + .voltage_normal = 11550, + .voltage_min = 9000, + .precharge_current = 256, + .start_charging_min_c = 0, + .start_charging_max_c = 50, + .charging_min_c = 0, + .charging_max_c = 60, + .discharging_min_c = -20, + .discharging_max_c = 75, + }, + }, /* LGC AP18C8K Battery Information */ [BATTERY_LGC_AP18C8K] = { .fuel_gauge = { @@ -131,3 +166,73 @@ enum battery_present battery_hw_present(void) /* The GPIO is low when the battery is physically present */ return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES; } + +static int charger_should_discharge_on_ac(struct charge_state_data *curr) +{ + /* can not discharge on AC without battery */ + if (curr->batt.is_present != BP_YES) + return 0; + + /* Do not discharge when battery disconnect */ + if (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED) + return 0; + + /* Do not discharge on AC if the battery is still waking up */ + if ((curr->batt.flags & BATT_FLAG_BAD_STATUS) || + (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) && + !(curr->batt.status & STATUS_FULLY_CHARGED))) + return 0; + + /* + * In heavy load (>3A being withdrawn from VSYS) the DCDC of the + * charger operates on hybrid mode. This causes a slight voltage + * ripple on VSYS that falls in the audible noise frequency (single + * digit kHz range). This small ripple generates audible noise in + * the output ceramic capacitors (caps on VSYS and any input of + * DCDC under VSYS). + * + * To overcome this issue, force battery discharging when battery + * full, So the battery MOS of NVDC charger will turn on always, + * it make the Vsys same as Vbat and the noise has been improved. + */ + if (!battery_is_cut_off() && + !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) && + (curr->batt.status & STATUS_FULLY_CHARGED)) + return 1; + + return 0; +} + +/* + * This can override the smart battery's charging profile. To make a change, + * modify one or more of requested_voltage, requested_current, or state. + * Leave everything else unchanged. + * + * Return the next poll period in usec, or zero to use the default (which is + * state dependent). + */ +int charger_profile_override(struct charge_state_data *curr) +{ + int disch_on_ac = charger_should_discharge_on_ac(curr); + + charger_discharge_on_ac(disch_on_ac); + + if (disch_on_ac) { + curr->state = ST_DISCHARGE; + return 0; + } + + return 0; +} + +enum ec_status charger_profile_override_get_param(uint32_t param, + uint32_t *value) +{ + return EC_RES_INVALID_PARAM; +} + +enum ec_status charger_profile_override_set_param(uint32_t param, + uint32_t value) +{ + return EC_RES_INVALID_PARAM; +} diff --git a/board/volmar/board.c b/board/volmar/board.c index 8875d49caf..865e1ce5bb 100644 --- a/board/volmar/board.c +++ b/board/volmar/board.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. */ @@ -20,15 +20,14 @@ #include "power.h" #include "registers.h" #include "switch.h" -#include "tablet_mode.h" #include "throttle_ap.h" #include "usbc_config.h" #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) __override void board_cbi_init(void) { @@ -53,7 +52,6 @@ static void board_chipset_suspend(void) } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); - /* keyboard factory test */ #ifdef CONFIG_KEYBOARD_FACTORY_TEST /* @@ -62,15 +60,14 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); * that we don't have pin 0. */ const int keyboard_factory_scan_pins[][2] = { - {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6}, - {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3}, - {-1, -1}, {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}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1}, - {-1, -1}, + { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 }, + { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 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 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -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/volmar/board.h b/board/volmar/board.h index e8b355d4b5..12561dc314 100644 --- a/board/volmar/board.h +++ b/board/volmar/board.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. */ @@ -21,11 +21,16 @@ #define CONFIG_MP2964 +/* Tablet mode is not supported */ +#undef CONFIG_TABLET_MODE +#undef CONFIG_TABLET_MODE_SWITCH +#undef CONFIG_LID_ANGLE + /* LED */ #define CONFIG_LED_ONOFF_STATES /* 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 */ @@ -46,17 +51,20 @@ #define CONFIG_USBC_PPC_SYV682X /* TODO: b/177608416 - measure and check these values on brya */ -#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 + +#define CONFIG_CHARGER_PROFILE_OVERRIDE +#define CONFIG_PWR_STATE_DISCHARGE_FULL /* * Macros for GPIO signals used in common code that don't match the @@ -64,60 +72,60 @@ * 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_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 /* 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_C2_TCPC NPCX_I2C_PORT1_0 -#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 +#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0 +#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 -#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1 +#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_MP2964 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_MP2964 NPCX_I2C_PORT7_0 -#define I2C_ADDR_EEPROM_FLAGS 0x50 +#define I2C_ADDR_EEPROM_FLAGS 0x50 -#define I2C_ADDR_MP2964_FLAGS 0x20 +#define I2C_ADDR_MP2964_FLAGS 0x20 /* Thermal features */ #define CONFIG_THERMISTOR @@ -125,15 +133,15 @@ #define CONFIG_TEMP_SENSOR_POWER #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B -#define CONFIG_FANS FAN_CH_COUNT +#define CONFIG_FANS FAN_CH_COUNT /* Charger defines */ #define CONFIG_CHARGER_ISL9241 #define CONFIG_CHARGE_RAMP_SW -#define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 +#define CONFIG_CHARGER_SENSE_RESISTOR 10 +#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 -#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT +#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT #define CONFIG_POWER_BUTTON_INIT_TIMEOUT 2 /* Keyboard */ @@ -142,7 +150,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" @@ -162,26 +170,21 @@ enum temp_sensor_id { enum battery_type { BATTERY_COSMX_AP20CBL, + BATTERY_COSMX_AP20CBL_004, BATTERY_LGC_AP18C8K, BATTERY_AP19B8M, BATTERY_TYPE_COUNT }; enum pwm_channel { - PWM_CH_KBLIGHT = 0, /* PWM3 */ - PWM_CH_FAN, /* PWM5 */ + PWM_CH_KBLIGHT = 0, /* PWM3 */ + PWM_CH_FAN, /* PWM5 */ PWM_CH_COUNT }; -enum fan_channel { - FAN_CH_0 = 0, - FAN_CH_COUNT -}; +enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT }; -enum mft_channel { - MFT_CH_0 = 0, - MFT_CH_COUNT -}; +enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT }; #ifdef CONFIG_KEYBOARD_FACTORY_TEST extern const int keyboard_factory_scan_pins[][2]; diff --git a/board/volmar/build.mk b/board/volmar/build.mk index 82ffaa9fe2..ed25f9c9aa 100644 --- a/board/volmar/build.mk +++ b/board/volmar/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# 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/volmar/charger.c b/board/volmar/charger.c index 85e0de90fe..88f5b85a41 100644 --- a/board/volmar/charger.c +++ b/board/volmar/charger.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. */ @@ -15,9 +15,8 @@ #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) +#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) /* Charger Chip Configuration */ const struct charger_config_t chg_chips[] = { @@ -84,7 +83,6 @@ int board_set_active_charge_port(int port) __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); + charge_set_input_current_limit( + MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } diff --git a/board/volmar/ec.tasklist b/board/volmar/ec.tasklist index b6470bf76b..70b64bc757 100644 --- a/board/volmar/ec.tasklist +++ b/board/volmar/ec.tasklist @@ -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/volmar/fans.c b/board/volmar/fans.c index 4fb92f2cf4..404e6f60df 100644 --- a/board/volmar/fans.c +++ b/board/volmar/fans.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. */ @@ -25,7 +25,7 @@ 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, }; @@ -38,9 +38,9 @@ static const struct fan_conf fan_conf_0 = { * boards as well. */ static const struct fan_rpm fan_rpm_0 = { - .rpm_min = 0, - .rpm_start = 5000, - .rpm_max = 6500, + .rpm_min = 3000, + .rpm_start = 3000, + .rpm_max = 6000, }; const struct fan_t fans[FAN_CH_COUNT] = { diff --git a/board/volmar/fw_config.c b/board/volmar/fw_config.c index da56362496..5c62ed17b8 100644 --- a/board/volmar/fw_config.c +++ b/board/volmar/fw_config.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. */ @@ -10,7 +10,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 volmar_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); diff --git a/board/volmar/fw_config.h b/board/volmar/fw_config.h index ba8c807a66..4dddec9273 100644 --- a/board/volmar/fw_config.h +++ b/board/volmar/fw_config.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. */ @@ -27,12 +27,12 @@ enum ec_cfg_keyboard_backlight_type { union volmar_cbi_fw_config { struct { - enum ec_cfg_usb_db_type usb_db : 4; - enum ec_cfg_keyboard_backlight_type kb_bl : 1; - uint32_t audio : 3; - uint32_t boot_nvme_mask : 1; - uint32_t boot_emmc_mask : 1; - uint32_t reserved_1 : 22; + enum ec_cfg_usb_db_type usb_db : 4; + enum ec_cfg_keyboard_backlight_type kb_bl : 1; + uint32_t audio : 3; + uint32_t boot_nvme_mask : 1; + uint32_t boot_emmc_mask : 1; + uint32_t reserved_1 : 22; }; uint32_t raw_value; }; diff --git a/board/volmar/gpio.inc b/board/volmar/gpio.inc index ac5be5fb17..b1d4e8c3dc 100644 --- a/board/volmar/gpio.inc +++ b/board/volmar/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * 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. */ @@ -21,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_C2_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) @@ -124,6 +123,7 @@ UNUSED(PIN(5, 6)) /* GPIO56 */ UNUSED(PIN(B, 1)) /* GPIOB1 */ UNUSED(PIN(D, 0)) /* GPIOD0/I2C3_SDA0 */ UNUSED(PIN(D, 1)) /* GPIOD1/I2C3_SCL0 */ +UNUSED(PIN(9, 5)) /* GPIO95 */ /* Pre-configured PSL balls: J8 K6 */ diff --git a/board/volmar/i2c.c b/board/volmar/i2c.c index 890a578788..29dd2904c1 100644 --- a/board/volmar/i2c.c +++ b/board/volmar/i2c.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. */ @@ -8,7 +8,7 @@ #include "hooks.h" #include "i2c.h" -#define BOARD_ID_FAST_PLUS_CAPABLE 2 +#define BOARD_ID_FAST_PLUS_CAPABLE 2 /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { diff --git a/board/volmar/keyboard.c b/board/volmar/keyboard.c index 598e187d00..16857b53c9 100644 --- a/board/volmar/keyboard.c +++ b/board/volmar/keyboard.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. */ @@ -40,8 +40,8 @@ static const struct ec_response_keybd_config volmar_kb = { }, .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 &volmar_kb; } diff --git a/board/volmar/led.c b/board/volmar/led.c index 7634437b0d..6c8c20299b 100644 --- a/board/volmar/led.c +++ b/board/volmar/led.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. * Power and battery LED control for volmar @@ -21,23 +21,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/volmar/pwm.c b/board/volmar/pwm.c index 47986f1ec8..ad4093ed0e 100644 --- a/board/volmar/pwm.c +++ b/board/volmar/pwm.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/volmar/sensors.c b/board/volmar/sensors.c index 720771c360..f03469cef4 100644 --- a/board/volmar/sensors.c +++ b/board/volmar/sensors.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. */ @@ -70,17 +70,17 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * 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(85), \ }, \ .temp_host_release = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ }, \ - .temp_fan_off = C_TO_K(25), \ - .temp_fan_max = C_TO_K(50), \ + .temp_fan_off = C_TO_K(30), \ + .temp_fan_max = C_TO_K(84), \ } __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; @@ -100,17 +100,17 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_FAN \ - { \ +#define THERMAL_FAN \ + { \ .temp_host = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ - [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = 0, \ }, \ .temp_host_release = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HIGH] = 0, \ }, \ - .temp_fan_off = C_TO_K(25), \ - .temp_fan_max = C_TO_K(50), \ + .temp_fan_off = 0, \ + .temp_fan_max = 0, \ } __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; @@ -128,25 +128,25 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CHARGER \ - { \ +#define THERMAL_CHARGER \ + { \ .temp_host = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ - [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = 0, \ }, \ .temp_host_release = { \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HIGH] = 0, \ }, \ - .temp_fan_off = C_TO_K(25), \ - .temp_fan_max = C_TO_K(50), \ + .temp_fan_off = 0, \ + .temp_fan_max = 0, \ } __maybe_unused static const struct ec_thermal_config thermal_charger = - THERMAL_CHARGER; + THERMAL_CHARGER; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, [TEMP_SENSOR_2_FAN] = THERMAL_FAN, - [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER, + [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/volmar/usbc_config.c b/board/volmar/usbc_config.c index 5f70a16c21..6a6c5c709f 100644 --- a/board/volmar/usbc_config.c +++ b/board/volmar/usbc_config.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. */ @@ -34,8 +34,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[] = { @@ -97,24 +97,31 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); * to the virtual_usb_mux_driver so the AP gets notified of mux changes * and updates the TCSS configuration on state changes. */ -static const struct usb_mux usbc1_usb3_db_retimer = { - .usb_port = USBC_PORT_C1, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, +static const struct usb_mux_chain usbc1_usb3_db_retimer = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C1, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, }; -const struct usb_mux usb_muxes[] = { +const struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C0, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }, [USBC_PORT_C1] = { - /* PS8815 DB */ - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb3_db_retimer, + .mux = &(const struct usb_mux) { + /* PS8815 DB */ + .usb_port = USBC_PORT_C1, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, + .next = &usbc1_usb3_db_retimer, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -156,8 +163,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state) } if (voltage < BC12_MIN_VOLTAGE) { - CPRINTS("%s: port %d: vbus %d lower than %d", __func__, - port, voltage, BC12_MIN_VOLTAGE); + CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port, + voltage, BC12_MIN_VOLTAGE); return 1; } @@ -177,7 +184,6 @@ void config_usb_db_type(void) CPRINTS("Configured USB DB type number is %d", db_type); } - void board_reset_pd_mcu(void) { /* diff --git a/board/volmar/usbc_config.h b/board/volmar/usbc_config.h index 69300a9354..0722d00d6b 100644 --- a/board/volmar/usbc_config.h +++ b/board/volmar/usbc_config.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. */ @@ -8,13 +8,9 @@ #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 }; void config_usb_db_type(void); |