diff options
-rw-r--r-- | baseboard/kalista/baseboard.c | 64 | ||||
-rw-r--r-- | baseboard/kalista/baseboard.h | 23 | ||||
-rw-r--r-- | baseboard/kalista/usb_pd_policy.c | 71 | ||||
-rw-r--r-- | board/karma/gpio.inc | 1 |
4 files changed, 5 insertions, 154 deletions
diff --git a/baseboard/kalista/baseboard.c b/baseboard/kalista/baseboard.c index f7c4cb7962..c31ec24c84 100644 --- a/baseboard/kalista/baseboard.c +++ b/baseboard/kalista/baseboard.c @@ -12,9 +12,6 @@ #include "bd99992gw.h" #include "board_config.h" #include "button.h" -#include "charge_manager.h" -#include "charge_state.h" -#include "charger.h" #include "chipset.h" #include "console.h" #include "cros_board_info.h" @@ -77,12 +74,6 @@ enum bj_adapter { */ #define BJ_ADAPTER_135W_MASK (1 << 4 | 1 << 5 | 1 << 6 | 1 << 3 | 1 << 2) -/* BJ adapter specs */ -static const struct charge_port_info bj_adapters[] = { - [BJ_90W_19V] = { .current = 4740, .voltage = 19000 }, - [BJ_135W_19V] = { .current = 7100, .voltage = 19000 }, -}; - static void tcpc_alert_event(enum gpio_signal signal) { if (!gpio_get_level(GPIO_USB_C0_PD_RST_ODL)) @@ -418,30 +409,6 @@ static void board_extpower(void) } DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT); -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) -{ - int u22 = 0; - /* - * Turn on/off power shortage alert. Performs the same check as - * system_can_boot_ap(). It's repeated here because charge_manager - * hasn't updated charge_current/voltage when board_set_charge_limit - * is called. - */ - led_alert(charge_ma * charge_mv < - CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000); - - /* - * Kalista has two types of charger: 90W, 135W. - * 135W charger offers 7.1A/19V. - * 90W charger offers 4.74A/19V. - */ - if (charge_ma < bj_adapters[BJ_135W_19V].current) - /* GPIO_U22_90W high means 90W charger */ - u22 = 1; - gpio_set_level(GPIO_U22_90W, u22); -} - enum battery_present battery_is_present(void) { return BP_NO; @@ -504,40 +471,13 @@ static void setup_bj(void) { enum bj_adapter bj = (BJ_ADAPTER_135W_MASK & (1 << sku)) ? BJ_135W_19V : BJ_90W_19V; - - charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, - DEDICATED_CHARGE_PORT, &bj_adapters[bj]); + gpio_set_level(GPIO_U22_90W, bj == BJ_90W_19V); } -/* - * Kalista has no battery and power is sourced only from a BJ adapter. - * Kalista operates in continuous safe mode (charge_manager_leave_safe_mode() - * will never be called), which modifies port / ILIM selection as follows: - * - * - Dual-role / dedicated capability of the port partner is ignored. - * - Charge ceiling on PD voltage transition is ignored. - * - CHARGE_PORT_NONE will never be selected. - * - * TODO: Set USB-C port as source only. - */ -static void board_charge_manager_init(void) +static void board_init(void) { - int i, j; - - /* Initialize all charge suppliers to 0 */ - for (i = 0; i < CHARGE_PORT_COUNT; i++) { - for (j = 0; j < CHARGE_SUPPLIER_COUNT; j++) - charge_manager_update_charge(j, i, NULL); - } - setup_bj(); -} -DECLARE_HOOK(HOOK_INIT, board_charge_manager_init, - HOOK_PRIO_CHARGE_MANAGER_INIT + 1); -static void board_init(void) -{ - /* Provide AC status to the PCH */ board_extpower(); gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L); diff --git a/baseboard/kalista/baseboard.h b/baseboard/kalista/baseboard.h index 6b271575b3..7d7fe10a7e 100644 --- a/baseboard/kalista/baseboard.h +++ b/baseboard/kalista/baseboard.h @@ -73,11 +73,6 @@ */ #define CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS -/* Charger */ -#define CONFIG_CHARGE_MANAGER - -#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 50000 - #define CONFIG_CMD_PD_CONTROL #define CONFIG_EXTPOWER_GPIO #undef CONFIG_EXTPOWER_DEBOUNCE_MS @@ -94,30 +89,19 @@ #define CONFIG_TEMP_SENSOR_TMP432 /* USB */ -#undef CONFIG_USB_CHARGER /* dnojiri: verify */ #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DISCHARGE_TCPC -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_PORT_COUNT 1 #define CONFIG_USB_PD_VBUS_DETECT_GPIO -#define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX #define CONFIG_USB_PD_TCPM_TCPCI #define CONFIG_USB_PD_TCPM_PS8751 -#define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_POWER_DELIVERY #define CONFIG_USBC_SS_MUX #define CONFIG_USBC_SS_MUX_DFP_ONLY #define CONFIG_USBC_VCONN -#define CONFIG_USBC_VCONN_SWAP - -/* Charge ports */ -#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT -#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1 -#define DEDICATED_CHARGE_PORT 1 /* USB-A config */ #define CONFIG_USB_PORT_POWER_DUMB @@ -253,13 +237,6 @@ enum OEM_ID { /* delay to turn on/off vconn */ #define PD_VCONN_SWAP_DELAY 5000 /* us */ -/* Define typical operating power. Since Kalista doesn't have a battery, - * we're not interested in any power lower than the AP power-on threshold. */ -#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON -#define PD_MAX_POWER_MW 100000 -#define PD_MAX_CURRENT_MA 5000 -#define PD_MAX_VOLTAGE_MV 20000 - /* Board specific handlers */ void board_reset_pd_mcu(void); void board_set_tcpc_power_mode(int port, int mode); diff --git a/baseboard/kalista/usb_pd_policy.c b/baseboard/kalista/usb_pd_policy.c index d6fe6ab6a3..107543a82a 100644 --- a/baseboard/kalista/usb_pd_policy.c +++ b/baseboard/kalista/usb_pd_policy.c @@ -25,7 +25,8 @@ #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) -#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\ +#define PDO_FIXED_FLAGS (PDO_FIXED_EXTERNAL | \ + PDO_FIXED_DATA_SWAP | \ PDO_FIXED_COMM_CAP) const uint32_t pd_src_pdo[] = { @@ -33,18 +34,6 @@ const uint32_t pd_src_pdo[] = { }; const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo); -const uint32_t pd_snk_pdo[] = { - PDO_FIXED(5000, 500, PDO_FIXED_FLAGS), - PDO_BATT(4750, 21000, 50000), - PDO_VAR(4750, 21000, 3000), -}; -const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); - -int pd_is_valid_input_voltage(int mv) -{ - return 1; -} - void pd_transition_voltage(int idx) { /* No-operation: we are always 5V */ @@ -59,9 +48,6 @@ int board_vbus_source_enabled(int port) int pd_set_power_supply_ready(int port) { - /* Disable charging */ - gpio_set_level(GPIO_USB_C0_CHARGE_L, 1); - /* Enable VBUS source */ gpio_set_level(GPIO_USB_C0_5V_EN, 1); @@ -90,55 +76,18 @@ int pd_board_checks(void) return EC_SUCCESS; } -int pd_check_power_swap(int port) -{ - /* If type-c port is supplying power, we never swap PR (to source) */ - if (port == charge_manager_get_active_charge_port()) - return 0; - /* - * Allow power swap as long as we are acting as a dual role device, - * otherwise assume our role is fixed (not in S0 or console command - * to fix our role). - */ - return pd_get_dual_role(port) == PD_DRP_TOGGLE_ON ? 1 : 0; -} - int pd_check_data_swap(int port, int data_role) { /* Allow data swap if we are a UFP, otherwise don't allow */ return (data_role == PD_ROLE_UFP) ? 1 : 0; } -int pd_check_vconn_swap(int port) -{ - /* in G3, do not allow vconn swap since pp5000_A rail is off */ - return gpio_get_level(GPIO_PMIC_SLP_SUS_L); -} - void pd_execute_data_swap(int port, int data_role) { - /* Do nothing */ } void pd_check_pr_role(int port, int pr_role, int flags) { - /* - * If partner is dual-role power and dualrole toggling is on, consider - * if a power swap is necessary. - */ - if ((flags & PD_FLAGS_PARTNER_DR_POWER) && - pd_get_dual_role(port) == PD_DRP_TOGGLE_ON) { - /* - * If we are a sink and partner is not externally powered, then - * swap to become a source. If we are source and partner is - * externally powered, swap to become a sink. - */ - int partner_extpower = flags & PD_FLAGS_PARTNER_EXTPOWER; - - if ((!partner_extpower && pr_role == PD_ROLE_SINK) || - (partner_extpower && pr_role == PD_ROLE_SOURCE)) - pd_request_power_swap(port); - } } void pd_check_dr_role(int port, int dr_role, int flags) @@ -147,6 +96,7 @@ void pd_check_dr_role(int port, int dr_role, int flags) if ((flags & PD_FLAGS_PARTNER_DR_DATA) && dr_role == PD_ROLE_UFP) pd_request_data_swap(port); } + /* ----------------- Vendor Defined Messages ------------------ */ const struct svdm_response svdm_rsp = { .identity = NULL, @@ -218,20 +168,6 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, return 0; } -int board_set_active_charge_port(int port) -{ - if (port < 0 || CHARGE_PORT_COUNT <= port) - return EC_ERROR_INVAL; - CPRINTS("New charger p%d", port); - return EC_SUCCESS; -} - -int board_get_battery_soc(void) -{ - return 100; -} - -#ifdef CONFIG_USB_PD_ALT_MODE_DFP static int dp_flags[CONFIG_USB_PD_PORT_COUNT]; static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT]; @@ -382,4 +318,3 @@ const struct svdm_amode_fx supported_modes[] = { } }; const int supported_modes_cnt = ARRAY_SIZE(supported_modes); -#endif /* CONFIG_USB_PD_ALT_MODE_DFP */ diff --git a/board/karma/gpio.inc b/board/karma/gpio.inc index 12a7fef919..461547f43e 100644 --- a/board/karma/gpio.inc +++ b/board/karma/gpio.inc @@ -64,7 +64,6 @@ GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_THEM_SDA */ /* 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A */ GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW | GPIO_PULL_UP) /* C0 5V Enable */ -GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */ GPIO(USB_C0_PD_RST_ODL, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */ GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */ GPIO(USB_C0_TCPC_PWR, PIN(8, 4), GPIO_OUT_LOW) /* Enable C0 TCPC Power */ |