From b0209f71f6d438fd8aeaf78c1748b7ade742dfd2 Mon Sep 17 00:00:00 2001 From: Marco Chen Date: Wed, 26 Aug 2020 22:16:42 +0800 Subject: meep: enable 2nd TCPC source PS8755 for port 1 The original TCPC in the port 1 is PS8751 and this CL adds another option of PS8755. These two are all supported by ps8xxx.c and the board function board_get_ps8xxx_product_id is implemented to judge the source by checking the SSFC bits field in the CBI. BUG=b:159082424, b:163922535 BRANCH=octopus TEST=verify DUT with PS8755 or PS8751 in the sub-board can work correctly in sink and source roles. Signed-off-by: Marco Chen Change-Id: I0cba58eb7b22c95aac1344f1b3a68ce5dac43ab0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2377060 Reviewed-by: Diana Z Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2383924 Reviewed-by: Edward Hill Commit-Queue: Edward Hill Tested-by: Edward Hill --- board/meep/board.c | 17 +++++++++++++++++ board/meep/board.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/board/meep/board.c b/board/meep/board.c index a497e337fb..01b4d0f089 100644 --- a/board/meep/board.c +++ b/board/meep/board.c @@ -9,6 +9,7 @@ #include "adc_chip.h" #include "battery.h" #include "button.h" +#include "cbi_ssfc.h" #include "charge_manager.h" #include "charge_state.h" #include "common.h" @@ -348,6 +349,22 @@ __override uint32_t board_override_feature_flags0(uint32_t flags0) return (flags0 &= ~EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB)); } +__override uint16_t board_get_ps8xxx_product_id(int port) +{ + /* Meep variant doesn't have ps8xxx product in the port 0 */ + if (port == 0) + return 0; + + switch (get_cbi_ssfc_tcpc_p1()) { + case TCPC_P1_PS8755: + return PS8755_PRODUCT_ID; + case TCPC_P1_DEFAULT: + case TCPC_P1_PS8751: + default: + return PS8751_PRODUCT_ID; + } +} + const struct ppc_config_t ppc_syv682x_port0 = { .i2c_port = I2C_PORT_TCPC0, .i2c_addr_flags = SYV682X_ADDR0_FLAGS, diff --git a/board/meep/board.h b/board/meep/board.h index fdc6604b3f..c0e33b1b58 100644 --- a/board/meep/board.h +++ b/board/meep/board.h @@ -54,6 +54,10 @@ /* Additional PPC second source */ #define CONFIG_USBC_PPC_SYV682X +/* Additional TCPC second source in Port 1 */ +#define CONFIG_USB_PD_TCPM_MULTI_PS8XXX +#define CONFIG_USB_PD_TCPM_PS8755 + #ifndef __ASSEMBLER__ #include "gpio_signal.h" -- cgit v1.2.1