diff options
author | Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> | 2020-12-22 14:23:49 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-28 02:08:08 +0000 |
commit | d698b87a77835e6a0d946a77b4deaeca3de12fa5 (patch) | |
tree | 991d9d82d50a5b5bd381b3723ccde7aa0a193715 /board/woomax | |
parent | ebed64c3dc35edc61f58cb46a7a5e5fc59801a30 (diff) | |
download | chrome-ec-d698b87a77835e6a0d946a77b4deaeca3de12fa5.tar.gz |
Woomax: Modify strength value of PS8802 for USB-C signal quality.
Modify strength value of PS8802 for USB-C signal quality.
BUG=b:175350836
BRANCH=zork
TEST=make BOARD=woomax
Signed-off-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
Change-Id: I0f9199f596a27c1913eb650f063493796ac39ba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2599730
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board/woomax')
-rw-r--r-- | board/woomax/board.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c index 6460083e77..eeae681ae7 100644 --- a/board/woomax/board.c +++ b/board/woomax/board.c @@ -15,6 +15,7 @@ #include "driver/accel_kx022.h" #include "driver/retimer/pi3dpx1207.h" #include "driver/retimer/pi3hdx1204.h" +#include "driver/retimer/ps8802.h" #include "driver/retimer/ps8811.h" #include "driver/retimer/ps8818.h" #include "driver/temp_sensor/sb_tsi.h" @@ -343,6 +344,56 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me, return rv; } +static int woomax_ps8802_mux_set(const struct usb_mux *me, + mux_state_t mux_state) +{ + int rv = EC_SUCCESS; + + /* Make sure the PS8802 is awake */ + rv = ps8802_i2c_wake(me); + if (rv) + return rv; + + /* USB specific config */ + if (mux_state & USB_PD_MUX_USB_ENABLED) { + /* Boost the USB gain */ + rv = ps8802_i2c_field_update16(me, + PS8802_REG_PAGE2, + PS8802_REG2_USB_SSEQ_LEVEL, + PS8802_USBEQ_LEVEL_UP_MASK, + PS8802_USBEQ_LEVEL_UP_19DB); + if (rv) + return rv; + } + + /* DP specific config */ + if (mux_state & USB_PD_MUX_DP_ENABLED) { + /*Boost the DP gain */ + rv = ps8802_i2c_field_update16(me, + PS8802_REG_PAGE2, + PS8802_REG2_DPEQ_LEVEL, + PS8802_DPEQ_LEVEL_UP_MASK, + PS8802_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 { + /* Disable IN_HPD on the DB */ + gpio_or_ioex_set_level(board_usbc1_retimer_inhpd, 0); + } + + /* Set extra swing level tuning at 800mV/P0 */ + rv = ps8802_i2c_field_update8(me, + PS8802_REG_PAGE1, + PS8802_800MV_LEVEL_TUNING, + PS8802_EXTRA_SWING_LEVEL_P0_MASK, + PS8802_EXTRA_SWING_LEVEL_P0_UP_1); + + return rv; +} + const struct usb_mux usbc1_woomax_ps8818 = { .usb_port = USBC_PORT_C1, .i2c_port = I2C_PORT_TCPC1, @@ -368,6 +419,7 @@ static void setup_mux(void) /* Set the AMD FP5 as the secondary MUX */ usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux; + usb_muxes[USBC_PORT_C1].board_set = &woomax_ps8802_mux_set; /* Don't have the AMD FP5 flip */ usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP; |