summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2020-09-04 17:31:46 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-11 01:46:26 +0000
commit09fd4554bfbc055f67a7a51a4858b27f6bebc878 (patch)
tree88c88b13fa5f9cdba7d1e8905cd03105f52c4e1a
parent585dd16a32ab67f2bd6ef2134f77adb287fca155 (diff)
downloadchrome-ec-09fd4554bfbc055f67a7a51a4858b27f6bebc878.tar.gz
careena/barla: enable 2nd TCPC source PS8755 for port 1
This patch adds one more TCPC PS8755 in the port 1. 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 TCPC ID pin. BUG=b:157298401, b:158983814 BRANCH=firmware-grunt-11031.B TEST=Verify DUT with PS8755 or PS8751 in the sub-board can work correctly in sink and source roles. Verify USBC charger is able to charging. Change-Id: I867e925ee5bb54597ba09539743a0048c220e298 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393407 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
-rw-r--r--board/careena/board.c22
-rw-r--r--board/careena/board.h4
-rw-r--r--board/careena/gpio.inc1
3 files changed, 27 insertions, 0 deletions
diff --git a/board/careena/board.c b/board/careena/board.c
index 7f037ae131..4e601ba532 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -6,6 +6,7 @@
/* Careena board-specific configuration */
#include "button.h"
+#include "driver/tcpm/ps8xxx.h"
#include "extpower.h"
#include "i2c.h"
#include "lid_switch.h"
@@ -61,4 +62,25 @@ const int keyboard_factory_scan_pins[][2] = {
const int keyboard_factory_scan_pins_used =
ARRAY_SIZE(keyboard_factory_scan_pins);
+
+static int board_is_support_ps8755_tcpc(void)
+{
+ /*
+ * 0: PS8751
+ * 1: PS8755
+ */
+ return gpio_get_level(GPIO_TCPC_ID);
+}
+
+__override uint16_t board_get_ps8xxx_product_id(int port)
+{
+ /* Careena variant doesn't have ps8xxx product in the port 0 */
+ if (port == 0)
+ return 0;
+
+ if (board_is_support_ps8755_tcpc())
+ return PS8755_PRODUCT_ID;
+
+ return PS8751_PRODUCT_ID;
+}
#endif
diff --git a/board/careena/board.h b/board/careena/board.h
index ed7e636ce3..4ae5153f47 100644
--- a/board/careena/board.h
+++ b/board/careena/board.h
@@ -29,6 +29,10 @@
#define CONFIG_BATTERY_MEASURE_IMBALANCE
#define CONFIG_BATTERY_BQ4050
+/* Additional TCPC second source in Port 1 */
+#define CONFIG_USB_PD_TCPM_MULTI_PS8XXX
+#define CONFIG_USB_PD_TCPM_PS8755
+
#ifndef __ASSEMBLER__
enum pwm_channel {
diff --git a/board/careena/gpio.inc b/board/careena/gpio.inc
index 4b9efe9f09..eeccf9f50d 100644
--- a/board/careena/gpio.inc
+++ b/board/careena/gpio.inc
@@ -41,6 +41,7 @@ GPIO(PCH_SYS_PWROK, PIN(D, 6), GPIO_OUT_LOW) /* Power OK to SOC */
GPIO(CPU_PROCHOT, PIN(3, 4), GPIO_INPUT | GPIO_SEL_1P8V) /* PROCHOT to SOC */
GPIO(APU_ALERT_L, PIN(A, 2), GPIO_INPUT) /* Alert to SOC */
GPIO(3AXIS_INT_L, PIN(5, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* 3 Axis Accel */
+GPIO(TCPC_ID, PIN(E, 0), GPIO_INPUT | GPIO_PULL_DOWN) /* TCPC ID pin */
GPIO(BAT_LED_AMBER_L, PIN(C, 3), GPIO_OUT_HIGH)
GPIO(BAT_LED_WHITE_L, PIN(C, 4), GPIO_OUT_HIGH)