diff options
author | Ting Shen <phoenixshen@google.com> | 2019-03-05 11:45:03 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-11 23:52:17 -0700 |
commit | 8b0974714e4de0ef3be0435804f91e157c348dcb (patch) | |
tree | eb392efb3e7c27b58b76368d250c435c3d96abb1 | |
parent | 554ba87174803e1ae52165ad46b9b22500b1ebb8 (diff) | |
download | chrome-ec-8b0974714e4de0ef3be0435804f91e157c348dcb.tar.gz |
driver/bc12/pi3usb9201: move pi3usb9201_mode to header file
Kukui ec controls pi3usb9201 manually, move the constants to header file
so we don't need to redefine them in kukui/board.c.
Also removed PI3USB9201_REG_CTRL_1_MODE, no one is using it, and it's
actually not a 1-bit flag.
BRANCH=None
BUG=None
TEST=make BOARD=hatch
(the only board with CONFIG_BC12_DETECT_PI3USB9201 enabled)
Change-Id: I6a8255d29eb960f9002cb9570fed0ee7b7cdc56a
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1502192
Commit-Ready: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Yilun Lin <yllin@chromium.org>
-rw-r--r-- | driver/bc12/pi3usb9201.c | 13 | ||||
-rw-r--r-- | driver/bc12/pi3usb9201.h | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/driver/bc12/pi3usb9201.c b/driver/bc12/pi3usb9201.c index 3368b1fe25..d70a3e53f6 100644 --- a/driver/bc12/pi3usb9201.c +++ b/driver/bc12/pi3usb9201.c @@ -21,17 +21,6 @@ #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -enum pi3usb9201_mode { - PI3USB9201_POWER_DOWN, - PI3USB9201_SDP_HOST_MODE, - PI3USB9201_DCP_HOST_MODE, - PI3USB9201_CDP_HOST_MODE, - PI3USB9201_CLIENT_MODE, - PI3USB9201_RESERVED_1, - PI3USB9201_RESERVED_2, - PI3USB9201_USB_PATH_ON, -}; - enum pi3usb9201_client_sts { CHG_OTHER = 0, CHG_2_4A, @@ -115,7 +104,7 @@ static int pi3usb9201_set_mode(int port, int desired_mode) { return pi3usb9201_raw(port, PI3USB9201_REG_CTRL_1, PI3USB9201_REG_CTRL_1_MODE_MASK, - desired_mode << 1); + desired_mode << PI3USB9201_REG_CTRL_1_MODE_SHIFT); } static void bc12_update_charge_manager(int port) diff --git a/driver/bc12/pi3usb9201.h b/driver/bc12/pi3usb9201.h index 589aaab83e..a710a5b2e9 100644 --- a/driver/bc12/pi3usb9201.h +++ b/driver/bc12/pi3usb9201.h @@ -18,8 +18,9 @@ /* Control_1 regiter bit definitions */ #define PI3USB9201_REG_CTRL_1_INT_MASK (1 << 0) -#define PI3USB9201_REG_CTRL_1_MODE (1 << 1) -#define PI3USB9201_REG_CTRL_1_MODE_MASK (0x7 << 1) +#define PI3USB9201_REG_CTRL_1_MODE_SHIFT 1 +#define PI3USB9201_REG_CTRL_1_MODE_MASK ( \ + 0x7 << PI3USB9201_REG_CTRL_1_MODE_SHIFT) /* Control_2 regiter bit definitions */ #define PI3USB9201_REG_CTRL_2_AUTO_SW (1 << 1) @@ -35,6 +36,17 @@ struct pi3usb2901_config_t { const int i2c_addr; }; +enum pi3usb9201_mode { + PI3USB9201_POWER_DOWN, + PI3USB9201_SDP_HOST_MODE, + PI3USB9201_DCP_HOST_MODE, + PI3USB9201_CDP_HOST_MODE, + PI3USB9201_CLIENT_MODE, + PI3USB9201_RESERVED_1, + PI3USB9201_RESERVED_2, + PI3USB9201_USB_PATH_ON, +}; + /* Configuration struct defined at board level */ extern const struct pi3usb2901_config_t pi3usb2901_bc12_chips[]; |