summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2015-11-23 14:28:11 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-24 11:02:49 -0800
commit3df2228c147728b516e85f8d010b0905be182045 (patch)
tree6e40715b1f46ab195d139ccfa93c492cfe06050e /driver
parent1ea9dece80cd020a0cea2adc63daea086aba43b8 (diff)
downloadchrome-ec-3df2228c147728b516e85f8d010b0905be182045.tar.gz
ps8740: Add a function to tune USB EQ settings
This adds a new function that can be use to apply USB EQ settings to the mux. It currently only exposes the Tx and Rx channel loss compensation. BUG=chrome-os-partner:47074 BRANCH=none TEST=build and boot on chell Change-Id: I1ec83cdcbb17da8e7289e6633509b64f01b14348 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/313747 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/ps8740.h32
-rw-r--r--driver/usb_mux_ps8740.c11
2 files changed, 43 insertions, 0 deletions
diff --git a/driver/ps8740.h b/driver/ps8740.h
index ec27a7bf50..94076e7921 100644
--- a/driver/ps8740.h
+++ b/driver/ps8740.h
@@ -32,4 +32,36 @@
#define PS8740_REG_CHIP_ID2 0xf3
#define PS8740_CHIP_ID2 0x87
+/* USB equalization settings for Host to Mux */
+#define PS8740_REG_USB_EQ_TX 0x32
+#define PS8740_USB_EQ_TX_10_1_DB 0x00
+#define PS8740_USB_EQ_TX_14_3_DB 0x20
+#define PS8740_USB_EQ_TX_8_5_DB 0x40
+#define PS8740_USB_EQ_TX_6_5_DB 0x60
+#define PS8740_USB_EQ_TX_11_5_DB 0x80
+#define PS8740_USB_EQ_TX_9_5_DB 0xc0
+#define PS8740_USB_EQ_TX_7_5_DB 0xe0
+#define PS8740_USB_EQ_TERM_100_OHM (0 << 2)
+#define PS8740_USB_EQ_TERM_85_OHM (1 << 2)
+
+/* USB equalization settings for Connector to Mux */
+#define PS8740_REG_USB_EQ_RX 0x3b
+#define PS8740_USB_EQ_RX_4_4_DB 0x00
+#define PS8740_USB_EQ_RX_7_0_DB 0x10
+#define PS8740_USB_EQ_RX_8_2_DB 0x20
+#define PS8740_USB_EQ_RX_9_4_DB 0x30
+#define PS8740_USB_EQ_RX_10_2_DB 0x40
+#define PS8740_USB_EQ_RX_11_4_DB 0x50
+#define PS8740_USB_EQ_RX_14_3_DB 0x60
+#define PS8740_USB_EQ_RX_14_8_DB 0x70
+#define PS8740_USB_EQ_RX_15_2_DB 0x80
+#define PS8740_USB_EQ_RX_15_5_DB 0x90
+#define PS8740_USB_EQ_RX_16_2_DB 0xa0
+#define PS8740_USB_EQ_RX_17_3_DB 0xb0
+#define PS8740_USB_EQ_RX_18_4_DB 0xc0
+#define PS8740_USB_EQ_RX_20_1_DB 0xd0
+#define PS8740_USB_EQ_RX_21_3_DB 0xe0
+
+int ps8740_tune_usb_eq(int i2c_addr, uint8_t tx, uint8_t rx);
+
#endif /* __CROS_EC_PS8740_H */
diff --git a/driver/usb_mux_ps8740.c b/driver/usb_mux_ps8740.c
index dfe111bf31..dada5368f6 100644
--- a/driver/usb_mux_ps8740.c
+++ b/driver/usb_mux_ps8740.c
@@ -107,6 +107,17 @@ static int ps8740_get_mux(int i2c_addr, mux_state_t *mux_state)
return EC_SUCCESS;
}
+/* Tune USB Tx/Rx Equalization */
+int ps8740_tune_usb_eq(int i2c_addr, uint8_t tx, uint8_t rx)
+{
+ int ret = 0;
+
+ ret |= ps8740_write(i2c_addr, PS8740_REG_USB_EQ_TX, tx);
+ ret |= ps8740_write(i2c_addr, PS8740_REG_USB_EQ_RX, rx);
+
+ return ret;
+}
+
const struct usb_mux_driver ps8740_usb_mux_driver = {
.init = ps8740_init,
.set = ps8740_set_mux,