diff options
Diffstat (limited to 'driver/usb_mux')
-rw-r--r-- | driver/usb_mux/ps8743.c | 22 | ||||
-rw-r--r-- | driver/usb_mux/ps8743.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/driver/usb_mux/ps8743.c b/driver/usb_mux/ps8743.c index 264b79fecc..68bb0428d3 100644 --- a/driver/usb_mux/ps8743.c +++ b/driver/usb_mux/ps8743.c @@ -23,6 +23,28 @@ int ps8743_write(const struct usb_mux *me, uint8_t reg, uint8_t val) reg, val); } +int ps8743_check_chip_id(const struct usb_mux *me, int *val) +{ + int id1; + int id2; + int res; + + /* + * Verify chip ID registers. + */ + res = ps8743_read(me, PS8743_REG_CHIP_ID1, &id1); + if (res) + return res; + + res = ps8743_read(me, PS8743_REG_CHIP_ID2, &id2); + if (res) + return res; + + *val = (id2 << 8) + id1; + + return EC_SUCCESS; +} + static int ps8743_init(const struct usb_mux *me) { int id1; diff --git a/driver/usb_mux/ps8743.h b/driver/usb_mux/ps8743.h index bdb3e9a885..70a47bdb9b 100644 --- a/driver/usb_mux/ps8743.h +++ b/driver/usb_mux/ps8743.h @@ -78,5 +78,6 @@ int ps8743_tune_usb_eq(const struct usb_mux *me, uint8_t tx, uint8_t rx); int ps8743_write(const struct usb_mux *me, uint8_t reg, uint8_t val); int ps8743_read(const struct usb_mux *me, uint8_t reg, int *val); +int ps8743_check_chip_id(const struct usb_mux *me, int *val); #endif /* __CROS_EC_PS8743_H */ |