diff options
author | Denis Brockus <dbrockus@chromium.org> | 2020-01-31 07:37:05 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-01 00:17:51 +0000 |
commit | 949f80604eec3c4f6d4a6fcfb2970461b221f00e (patch) | |
tree | 24d0d3cda2f6ad19b042b039b68707dad37e858f /baseboard/zork | |
parent | 42ca68d3cdf74193dd041d336b698bfe3ae1221a (diff) | |
download | chrome-ec-949f80604eec3c4f6d4a6fcfb2970461b221f00e.tar.gz |
PS8818: use read/modify/write for regs with reserved bits
PS88xx has a tendency to document undocumented register
bits as reserved. Some of these are reserved and others
should not be reset to 0 and should remain the value
they were previously. The gain control appears to be
of the latter type on the PS8818
BUG=b:146394157
BRANCH=none
TEST=verify USB-C1 DP and USB connections
Change-Id: Ia67824c9b2676ad9984e4a8535ddd37bb8f2190b
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2033304
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'baseboard/zork')
-rw-r--r-- | baseboard/zork/baseboard.c | 90 |
1 files changed, 50 insertions, 40 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index 8f2a324185..8927b7a2a7 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -535,59 +535,67 @@ static int ps8818_tune_mux(int port, mux_state_t mux_state) /* USB specific config */ if (mux_state & USB_PD_MUX_USB_ENABLED) { /* Boost the USB gain */ - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_APTX1EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_APTX1EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_APTX2EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_APTX2EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_APTX1EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_APTX1EQ_5G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_APTX2EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_APTX2EQ_5G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_CRX1EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_CRX1EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_CRX2EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_CRX2EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_CRX1EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_CRX1EQ_5G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_CRX2EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_CRX2EQ_5G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_21DB); if (rv) return rv; } @@ -597,10 +605,11 @@ static int ps8818_tune_mux(int port, mux_state_t mux_state) int val; /* Boost the DP gain */ - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE1, - PS8818_REG1_DPEQ_LEVEL, - PS8818_DPEQ_LEVEL_UP_21DB); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE1, + PS8818_REG1_DPEQ_LEVEL, + PS8818_DPEQ_LEVEL_UP_MASK, + PS8818_DPEQ_LEVEL_UP_21DB); if (rv) return rv; @@ -609,10 +618,11 @@ static int ps8818_tune_mux(int port, mux_state_t mux_state) ? PS8818_LANE_COUNT_SET_2_LANE : PS8818_LANE_COUNT_SET_4_LANE; - rv = ps8818_i2c_write(port, - PS8818_REG_PAGE2, - PS8818_REG2_LANE_COUNT_SET, - val); + rv = ps8818_i2c_field_update8(port, + PS8818_REG_PAGE2, + PS8818_REG2_LANE_COUNT_SET, + PS8818_LANE_COUNT_SET_MASK, + val); if (rv) return rv; } |