diff options
-rw-r--r-- | driver/retimer/ps8802.c | 15 | ||||
-rw-r--r-- | driver/retimer/ps8802.h | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/driver/retimer/ps8802.c b/driver/retimer/ps8802.c index cb81b84f4e..190bed8873 100644 --- a/driver/retimer/ps8802.c +++ b/driver/retimer/ps8802.c @@ -273,3 +273,18 @@ const struct usb_mux_driver ps8802_usb_mux_driver = { .set = ps8802_set_mux, .get = ps8802_get_mux, }; + +/* + * If PS8802 I2c slave address was conflicted, change + * the I2c slave address in page 0x0A, offset 0xB0 + * switch to 0x50 slave address + */ +int ps8802_chg_i2c_addr(int i2c_port) +{ + int rv; + + rv = i2c_write8(i2c_port, + PS8802_P1_ADDR, PS8802_ADDR_CFG, PS8802_I2C_SLAV_ADDR); + + return rv; +} diff --git a/driver/retimer/ps8802.h b/driver/retimer/ps8802.h index bdcf44dea8..4429db92ad 100644 --- a/driver/retimer/ps8802.h +++ b/driver/retimer/ps8802.h @@ -16,6 +16,12 @@ #define PS8802_I2C_ADDR_FLAGS 0x08 /* + * PS8802 uses 7-bit I2C addresses 0x28 to 0x37. + * Page 0 = 0x028, Page 1 = 0x29, Page 2 = 0x2A. + */ +#define PS8802_I2C_ADDR_FLAGS_CUSTOM 0x28 + +/* * PAGE 0 Register Definitions */ #define PS8802_REG_PAGE0 0x00 @@ -64,6 +70,9 @@ #define PS8802_DPEQ_LEVEL_UP_21DB 0x08 #define PS8802_DPEQ_LEVEL_UP_MASK 0x0F +#define PS8802_P1_ADDR 0x0A +#define PS8802_ADDR_CFG 0xB0 +#define PS8802_I2C_SLAV_ADDR 0x50 extern const struct usb_mux_driver ps8802_usb_mux_driver; @@ -76,5 +85,6 @@ int ps8802_i2c_field_update8(const struct usb_mux *me, int page, int offset, uint8_t field_mask, uint8_t set_value); int ps8802_i2c_field_update16(const struct usb_mux *me, int page, int offset, uint16_t field_mask, uint16_t set_value); +int ps8802_chg_i2c_addr(int i2c_port); #endif /* __CROS_EC_USB_RETIMER_PS8802_H */ |