summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacky Wang <jacky5_wang@pegatron.corp-partner.google.com>2020-11-13 16:11:25 +0800
committerCommit Bot <commit-bot@chromium.org>2020-11-18 03:32:50 +0000
commit8705e537da56c8cd1a55fbd775bf7985e8949e41 (patch)
treee1ac0b7e7800d5e0f223d67e1b0de023039b4bd4
parent1dcfc09283df045a0071d549d90de04bd90a60f0 (diff)
downloadchrome-ec-8705e537da56c8cd1a55fbd775bf7985e8949e41.tar.gz
woomax: Fine tune Type-C retimer PI3DPX1207 EQ
Modify strength value of PI3DPX1207C for USB-C0 signal quality. BUG=b:172040000 BRANCH=firmware-zork-13434.B TEST=make BOARD=woomax Signed-off-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Change-Id: I7b0dd80af0bf44fd9256e2d4d0c49d755014661e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2515426 Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r--board/woomax/board.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c
index 80d9329a71..860fbaf29b 100644
--- a/board/woomax/board.c
+++ b/board/woomax/board.c
@@ -301,6 +301,98 @@ static void setup_mux(void)
}
}
+enum pi3dpx1207_usb_conf {
+ USB_DP = 0,
+ USB_DP_INV,
+ USB,
+ USB_INV,
+ DP,
+ DP_INV
+};
+
+static uint8_t pi3dpx1207_picasso_eq[] = {
+ /*usb_dp*/
+ 0x13, 0x11, 0x20, 0x62, 0x06, 0x5B, 0x5B,
+ 0x07, 0x03, 0x40, 0xFC, 0x42, 0x71,
+ /*usb_dp_inv */
+ 0x13, 0x11, 0x20, 0x72, 0x06, 0x03, 0x07,
+ 0x5B, 0x5B, 0x23, 0xFC, 0x42, 0x71,
+ /*usb*/
+ 0x13, 0x11, 0x20, 0x42, 0x00, 0x03, 0x07,
+ 0x07, 0x03, 0x00, 0x42, 0x42, 0x71,
+ /*usb_inv*/
+ 0x13, 0x11, 0x20, 0x52, 0x00, 0x03, 0x07,
+ 0x07, 0x03, 0x02, 0x42, 0x42, 0x71,
+ /*dp*/
+ 0x13, 0x11, 0x20, 0x22, 0x06, 0x5B, 0x5B,
+ 0x5B, 0x5B, 0x60, 0xFC, 0xFC, 0x71,
+ /*dp_inv*/
+ 0x13, 0x11, 0x20, 0x32, 0x06, 0x5B, 0x5B,
+ 0x5B, 0x5B, 0x63, 0xFC, 0xFC, 0x71,
+};
+static uint8_t pi3dpx1207_dali_eq[] = {
+ /*usb_dp*/
+ 0x13, 0x11, 0x20, 0x62, 0x06, 0x5B, 0x5B,
+ 0x07, 0x07, 0x40, 0xFC, 0x42, 0x71,
+ /*usb_dp_inv*/
+ 0x13, 0x11, 0x20, 0x72, 0x06, 0x07, 0x07,
+ 0x5B, 0x5B, 0x23, 0xFC, 0x42, 0x71,
+ /*usb*/
+ 0x13, 0x11, 0x20, 0x42, 0x00, 0x07, 0x07,
+ 0x07, 0x07, 0x00, 0x42, 0x42, 0x71,
+ /*usb_inv*/
+ 0x13, 0x11, 0x20, 0x52, 0x00, 0x07, 0x07,
+ 0x07, 0x07, 0x02, 0x42, 0x42, 0x71,
+ /*dp*/
+ 0x13, 0x11, 0x20, 0x22, 0x06, 0x5B, 0x5B,
+ 0x5B, 0x5B, 0x60, 0xFC, 0xFC, 0x71,
+ /*dp_inv*/
+ 0x13, 0x11, 0x20, 0x32, 0x06, 0x5B, 0x5B,
+ 0x5B, 0x5B, 0x63, 0xFC, 0xFC, 0x71,
+};
+
+static int board_pi3dpx1207_mux_set(const struct usb_mux *me,
+ mux_state_t mux_state)
+{
+ int rv = EC_SUCCESS;
+ enum pi3dpx1207_usb_conf usb_mode = 0;
+
+ /* USB */
+ if (mux_state & USB_PD_MUX_USB_ENABLED) {
+ /* USB with DP */
+ if (mux_state & USB_PD_MUX_DP_ENABLED) {
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
+ ? USB_DP_INV
+ : USB_DP;
+ }
+ /* USB without DP */
+ else {
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
+ ? USB_INV
+ : USB;
+ }
+ }
+ /* DP without USB */
+ else if (mux_state & USB_PD_MUX_DP_ENABLED) {
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
+ ? DP_INV
+ : DP;
+ }
+ /* Nothing enabled */
+ else
+ return EC_SUCCESS;
+
+ /* Write the retimer config byte */
+ if (ec_config_has_usbc1_retimer_ps8802())
+ rv = i2c_xfer(me->i2c_port, me->i2c_addr_flags,
+ &pi3dpx1207_dali_eq[usb_mode*13], 13, NULL, 0);
+ else
+ rv = i2c_xfer(me->i2c_port, me->i2c_addr_flags,
+ &pi3dpx1207_picasso_eq[usb_mode*13], 13, NULL, 0);
+
+ return rv;
+}
+
const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = {
[USBC_PORT_C0] = {
.enable_gpio = IOEX_USB_C0_DATA_EN,
@@ -316,6 +408,7 @@ const struct usb_mux usbc0_pi3dpx1207_usb_retimer = {
.i2c_port = I2C_PORT_TCPC0,
.i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
.driver = &pi3dpx1207_usb_retimer,
+ .board_set = &board_pi3dpx1207_mux_set,
};
struct usb_mux usb_muxes[] = {