summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>2020-12-16 10:21:05 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-17 01:59:27 +0000
commitb415b09817b9b500869c6428dbb6ccd3fdf4fbd5 (patch)
tree6662d41caa8e114e8989fb65b15d2f6e7459c5b7
parente66095d53b3b5b5c1951fa19f47ec15dce0bbae8 (diff)
downloadchrome-ec-b415b09817b9b500869c6428dbb6ccd3fdf4fbd5.tar.gz
Woomax: Modify strength value of PS8818 for USB-C signal quality.
Modify strength value of PS8818 for USB-C signal quality depend on b:175351902 comment #1. BUG=b:175351902 BRANCH=zork TEST=make BOARD=woomax Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I62974b5c41257a8f47b8d9217e958f1aad9d55bd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592306 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
-rw-r--r--board/woomax/board.c91
-rw-r--r--driver/retimer/ps8818.h1
2 files changed, 91 insertions, 1 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c
index 1fd0dcd39b..19e346b725 100644
--- a/board/woomax/board.c
+++ b/board/woomax/board.c
@@ -16,6 +16,7 @@
#include "driver/retimer/pi3dpx1207.h"
#include "driver/retimer/pi3hdx1204.h"
#include "driver/retimer/ps8811.h"
+#include "driver/retimer/ps8818.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/usb_mux/amd_fp5.h"
#include "extpower.h"
@@ -262,6 +263,94 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration
*/
+static int woomax_ps8818_mux_set(const struct usb_mux *me,
+ mux_state_t mux_state)
+{
+ int rv = EC_SUCCESS;
+
+ /* USB specific config */
+ if (mux_state & USB_PD_MUX_USB_ENABLED) {
+ /* Boost the USB gain */
+ rv = ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
+ if (rv)
+ return rv;
+
+ rv = ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
+ if (rv)
+ return rv;
+
+ rv = ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
+ if (rv)
+ return rv;
+
+ rv = ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
+ if (rv)
+ return rv;
+ }
+
+ /* DP specific config */
+ if (mux_state & USB_PD_MUX_DP_ENABLED) {
+ /* Boost the DP gain */
+ rv = ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_DPEQ_LEVEL,
+ PS8818_DPEQ_LEVEL_UP_MASK,
+ PS8818_DPEQ_LEVEL_UP_19DB);
+ if (rv)
+ return rv;
+
+ /* Enable IN_HPD on the DB */
+ gpio_or_ioex_set_level(board_usbc1_retimer_inhpd, 1);
+ } else {
+ gpio_or_ioex_set_level(board_usbc1_retimer_inhpd, 0);
+ }
+
+ if (!(mux_state & USB_PD_MUX_POLARITY_INVERTED)) {
+ rv = ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_CRX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
+ rv |= ps8818_i2c_write(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APRX1_DE_LEVEL, 0x02);
+ }
+
+ /* set the RX input termination */
+ rv |= ps8818_i2c_field_update8(me,
+ PS8818_REG_PAGE1,
+ PS8818_REG1_RX_PHY,
+ PS8818_RX_INPUT_TERM_MASK,
+ PS8818_RX_INPUT_TERM_85_OHM);
+ /* set register 0x40 ICP1 for 1G PD loop */
+ rv |= ps8818_i2c_write(me, PS8818_REG_PAGE1, 0x40, 0x84);
+
+ return rv;
+}
+
+const struct usb_mux usbc1_woomax_ps8818 = {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8818_I2C_ADDR_FLAGS,
+ .driver = &ps8818_usb_retimer_driver,
+ .board_set = &woomax_ps8818_mux_set,
+};
+
static void setup_mux(void)
{
if (ec_config_has_usbc1_retimer_ps8802()) {
@@ -297,7 +386,7 @@ static void setup_mux(void)
sizeof(struct usb_mux));
/* Set the PS8818 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818;
+ usb_muxes[USBC_PORT_C1].next_mux = &usbc1_woomax_ps8818;
}
}
diff --git a/driver/retimer/ps8818.h b/driver/retimer/ps8818.h
index 3b509f3e77..b56df4b411 100644
--- a/driver/retimer/ps8818.h
+++ b/driver/retimer/ps8818.h
@@ -39,6 +39,7 @@
#define PS8818_REG1_APTX2EQ_10G_LEVEL 0x02
#define PS8818_REG1_CRX1EQ_10G_LEVEL 0x08
#define PS8818_REG1_CRX2EQ_10G_LEVEL 0x0A
+#define PS8818_REG1_APRX1_DE_LEVEL 0x0C
#define PS8818_REG1_APTX1EQ_5G_LEVEL 0x70
#define PS8818_REG1_APTX2EQ_5G_LEVEL 0x72
#define PS8818_REG1_CRX1EQ_5G_LEVEL 0x78