summaryrefslogtreecommitdiff
path: root/driver/retimer/ps8818.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2020-01-27 09:51:30 -0700
committerCommit Bot <commit-bot@chromium.org>2020-01-30 17:45:29 +0000
commit85902285e20f4e6d8390d944b48ccb96ee252f40 (patch)
tree692f65fd81fe17dce5850fd9c14dd6cb2d475f31 /driver/retimer/ps8818.c
parent7dec638eb577aaa3a00d0551d73c276b94ebacb2 (diff)
downloadchrome-ec-85902285e20f4e6d8390d944b48ccb96ee252f40.tar.gz
ps8818: allow access to all of the register pages
Added possible registers that we may need to adjust and many of them are not on page0. So changed the base code to handle different pages BUG=none BRANCH=none TEST=verify different pages can be accessed Change-Id: If6a7a2e141d9c052dfa8da612b9e5268d21630a7 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2022915 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/retimer/ps8818.c')
-rw-r--r--driver/retimer/ps8818.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/driver/retimer/ps8818.c b/driver/retimer/ps8818.c
index 99802b7fcc..d9c89ef7e4 100644
--- a/driver/retimer/ps8818.c
+++ b/driver/retimer/ps8818.c
@@ -14,17 +14,17 @@
#include "ps8818.h"
#include "usb_mux.h"
-static int ps8818_i2c_read(int port, int offset, int *data)
+static int ps8818_i2c_read(int port, int page, int offset, int *data)
{
return i2c_read8(usb_retimers[port].i2c_port,
- usb_retimers[port].i2c_addr_flags,
+ usb_retimers[port].i2c_addr_flags + page,
offset, data);
}
-static int ps8818_i2c_write(int port, int offset, int data)
+static int ps8818_i2c_write(int port, int page, int offset, int data)
{
return i2c_write8(usb_retimers[port].i2c_port,
- usb_retimers[port].i2c_addr_flags,
+ usb_retimers[port].i2c_addr_flags + page,
offset, data);
}
@@ -35,7 +35,10 @@ int ps8818_detect(int port)
/* Detected if we are powered and can read the device */
if (!chipset_in_state(CHIPSET_STATE_HARD_OFF))
- rv = ps8818_i2c_read(port, PS8818_REG_FLIP, &val);
+ rv = ps8818_i2c_read(port,
+ PS8818_REG_PAGE0,
+ PS8818_REG0_FLIP,
+ &val);
return rv;
}
@@ -54,7 +57,10 @@ static int ps8818_set_mux(int port, mux_state_t mux_state)
if (mux_state & USB_PD_MUX_DP_ENABLED)
val |= PS8818_MODE_DP_ENABLE;
- rv = ps8818_i2c_write(port, PS8818_REG_MODE, val);
+ rv = ps8818_i2c_write(port,
+ PS8818_REG_PAGE0,
+ PS8818_REG0_MODE,
+ val);
if (rv)
return rv;
@@ -62,7 +68,10 @@ static int ps8818_set_mux(int port, mux_state_t mux_state)
if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
val |= PS8818_FLIP_CONFIG;
- return ps8818_i2c_write(port, PS8818_REG_FLIP, val);
+ return ps8818_i2c_write(port,
+ PS8818_REG_PAGE0,
+ PS8818_REG0_FLIP,
+ val);
}
const struct usb_retimer_driver ps8818_usb_retimer = {