diff options
author | Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> | 2021-08-18 15:02:50 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-23 22:41:04 +0000 |
commit | bb5e2a541f5188b0ac773846fc08cbea4571fdb6 (patch) | |
tree | ead8b599661d6731a567a855b29885d8edc90f0d | |
parent | 40cf65f43db2d392ccd9eea932a6fb585e1bdf5f (diff) | |
download | chrome-ec-bb5e2a541f5188b0ac773846fc08cbea4571fdb6.tar.gz |
Chronicler: Organize source code
Add a comment for signal setting function
Declared const variables for the port and address
BUG=none
BRANCH=volteer
TEST=Check USB-C1 port working.
Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Change-Id: I3fd4d38195ec2714a1cea6af2fcda525f1c4cf51
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3102342
Reviewed-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r-- | board/chronicler/usbc_config.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/board/chronicler/usbc_config.c b/board/chronicler/usbc_config.c index 60e898aacc..29fb373ae9 100644 --- a/board/chronicler/usbc_config.c +++ b/board/chronicler/usbc_config.c @@ -316,18 +316,17 @@ static void ps8815_reset(void) static void ps8815_setup_eq(void) { int rv; + const int port = tcpc_config[USBC_PORT_C1].i2c_info.port; + const int addr = tcpc_config[USBC_PORT_C1].i2c_info.addr_flags; /* TX1 EQ 19db / TX2 EQ 19db */ - rv = i2c_write8(tcpc_config[USBC_PORT_C1].i2c_info.port, - tcpc_config[USBC_PORT_C1].i2c_info.addr_flags, 0x20, 0x77); + rv = i2c_write8(port, addr, 0x20, 0x77); /* RX1 EQ 12db / RX2 EQ 13db */ - rv |= i2c_write8(tcpc_config[USBC_PORT_C1].i2c_info.port, - tcpc_config[USBC_PORT_C1].i2c_info.addr_flags, 0x22, 0x32); + rv |= i2c_write8(port, addr, 0x22, 0x32); /* Swing level for upstream port output */ - rv |= i2c_write8(tcpc_config[USBC_PORT_C1].i2c_info.port, - tcpc_config[USBC_PORT_C1].i2c_info.addr_flags, 0xc4, 0x03); + rv |= i2c_write8(port, addr, 0xc4, 0x03); if (rv) CPRINTS("%s fail!", __func__); @@ -336,31 +335,25 @@ static void ps8815_setup_eq(void) static void ps8811_setup_eq(void) { int rv; + const int port = I2C_PORT_USB_1_MIX; + const int addr = PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1; /* AEQ 12db */ - rv = i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x01, 0x26); + rv = i2c_write8(port, addr, 0x01, 0x26); /* ADE 2.1db */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x02, 0x60); + rv |= i2c_write8(port, addr, 0x02, 0x60); /* BEQ 10.5db */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x05, 0x16); + rv |= i2c_write8(port, addr, 0x05, 0x16); /* BDE 2.1db */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x06, 0x63); + rv |= i2c_write8(port, addr, 0x06, 0x63); /* Channel A swing level */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x66, 0x20); + rv |= i2c_write8(port, addr, 0x66, 0x20); /* Channel B swing level */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xa4, 0x03); + rv |= i2c_write8(port, addr, 0xa4, 0x03); /* PS level foe B channel */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xa5, 0x83); + rv |= i2c_write8(port, addr, 0xa5, 0x83); /* DE level foe B channel */ - rv |= i2c_write8(I2C_PORT_USB_1_MIX, - PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xa6, 0x14); + rv |= i2c_write8(port, addr, 0xa6, 0x14); if (rv) CPRINTS("%s fail!", __func__); @@ -370,6 +363,10 @@ static void ps8811_setup_eq(void) void board_ps8xxx_init(void) { CPRINTS("%s", __func__); + /* + * Adjust USB3 settings to improve signal integrity. + * See b/194985848. + */ ps8815_setup_eq(); ps8811_setup_eq(); } |