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>
This commit is contained in:
Duncan Laurie
2015-11-23 14:28:11 -08:00
committed by chrome-bot
parent 1ea9dece80
commit 3df2228c14
2 changed files with 43 additions and 0 deletions

View File

@@ -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 */

View File

@@ -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,