From e259d069568d5737e8be7519cf6da9e4d7be1865 Mon Sep 17 00:00:00 2001 From: Tommy Chung Date: Wed, 15 Mar 2023 21:13:46 +0800 Subject: lantis: Enable 2nd TCPC source PS8805 for port 1 Used the SSFC bits to judge which source driver needs to be loaded. BUG=b:273637804 BRANCH=none TEST=verifying DUT with PS8705 or PS8805 in th daughter-board can charging and displaying, and verifying multiple Docks also works. Change-Id: I3f924f17145cf68e2eef863c47b1a46228c1c2cd Signed-off-by: Tommy Chung Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4340870 Reviewed-by: Diana Z Reviewed-by: Devin Lu --- board/lantis/board.c | 16 ++++++++++++++++ board/lantis/board.h | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/board/lantis/board.c b/board/lantis/board.c index 5ec54802d6..92c030def1 100644 --- a/board/lantis/board.c +++ b/board/lantis/board.c @@ -780,6 +780,22 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) charger_set_otg_current_voltage(port, current, 5000); } +__override uint16_t board_get_ps8xxx_product_id(int port) +{ + /* Lantis variant doesn't have ps8xxx product in the port 0 */ + if (port == 0) + return 0; + + switch (get_cbi_ssfc_tcpc_p1()) { + case SSFC_TCPC_P1_PS8805: + return PS8805_PRODUCT_ID; + case SSFC_TCPC_P1_DEFAULT: + case SSFC_TCPC_P1_PS8705: + default: + return PS8705_PRODUCT_ID; + } +} + /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = { .channel = 0, diff --git a/board/lantis/board.h b/board/lantis/board.h index bda4b01280..007da07461 100644 --- a/board/lantis/board.h +++ b/board/lantis/board.h @@ -72,7 +72,9 @@ /* TCPC */ #define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */ -#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/ +#define CONFIG_USB_PD_TCPM_MULTI_PS8XXX +#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC */ +#define CONFIG_USB_PD_TCPM_PS8805 /* C1: second source PS8805 TCPC */ #define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1 #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_TCPC_LOW_POWER -- cgit v1.2.1