diff options
author | Caveh Jalali <caveh@chromium.org> | 2020-06-26 18:12:55 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-01 12:42:30 +0000 |
commit | 3ee29520979d9b950f2394f9acc0e26b17c20207 (patch) | |
tree | 5913e2ec7c4328e0282cdb29e10a692539253c4e | |
parent | 5996059bfa7518d46b3c42fac3a68a5517bed04d (diff) | |
download | chrome-ec-3ee29520979d9b950f2394f9acc0e26b17c20207.tar.gz |
ps8xxx: add helper function to access alternate I2C pages
this provides a helper function for computing the I2C page address of
alternate I2C pages available on the ps8xxx family of chips.
[This is 8-bit I2C address scheme used for firmware branch]
BRANCH=none
BUG=b:158857815,b:159289062
TEST=buildall passes
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Change-Id: I121ec9f2beaadf3e4e3c429d177fe38eb2976be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2271700
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2315966
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Marco Chen <marcochen@chromium.org>
Commit-Queue: Marco Chen <marcochen@chromium.org>
-rw-r--r-- | driver/tcpm/ps8xxx.c | 6 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index a2fefbc05b..35f4870e51 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -211,8 +211,7 @@ static int ps8xxx_dci_disable(int port) int p1_addr; /* DCI registers are always accessible on PS8805 */ - p1_addr = tcpc_config[port].i2c_info.addr - - (PS8751_I2C_ADDR1 - PS8751_I2C_ADDR1_P1); + p1_addr = PS8751_P3_TO_P1(tcpc_config[port].i2c_info.addr); return ps8xxx_addr_dci_disable(port, p1_addr, PS8805_P1_REG_MUX_USB_DCI_CFG); } @@ -237,8 +236,7 @@ static int ps8xxx_dci_disable(int port) PS8XXX_REG_I2C_DEBUGGING_ENABLE_ON); /* Disable Auto DCI */ - p1_addr = p3_addr - - (PS8751_I2C_ADDR1 - PS8751_I2C_ADDR1_P1); + p1_addr = PS8751_P3_TO_P1(p3_addr); rv = ps8xxx_addr_dci_disable(port, p1_addr, PS8705_P1_REG_MUX_USB_DCI_CFG); diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h index fe9de1eb23..6895c9b922 100644 --- a/driver/tcpm/ps8xxx.h +++ b/driver/tcpm/ps8xxx.h @@ -15,6 +15,8 @@ #define PS8751_I2C_ADDR3 0x56 #define PS8751_I2C_ADDR4 0x96 +#define PS8751_P3_TO_P1(p3) ((p3) - 4) + /* Minimum Delay for reset assertion */ #define PS8XXX_RESET_DELAY_MS 1 |