diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-07 12:24:10 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-09 05:10:59 +0000 |
commit | b1b5659062f4ba8ff7de2df4dcebd339084a90e6 (patch) | |
tree | 796ea02c96dd13bbb864996ca450f47070b5376d | |
parent | 2fa27104aa0e97f3c750aa3b04acfc76db5e7123 (diff) | |
download | chrome-ec-b1b5659062f4ba8ff7de2df4dcebd339084a90e6.tar.gz |
Create a public header for pi3usb9201
Add a separate public header for this chip so we can include it from
Zephyr. Update Volteer's usbc_config file to use that header, so it
builds on Zephyr.
BUG=b:175434113
BRANCH=none
TEST=make BOARD=volteer -j30
With a zephyr-chrome CL, build volteer on zephyr
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I45bb196a3c6de9bebefd3d06125d1cedd33666a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615619
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | board/volteer/board.c | 15 | ||||
-rw-r--r-- | board/volteer/usbc_config.c | 15 | ||||
-rw-r--r-- | driver/bc12/pi3usb9201.h | 20 | ||||
-rw-r--r-- | include/driver/bc12/pi3usb9201_public.h | 28 |
4 files changed, 48 insertions, 30 deletions
diff --git a/board/volteer/board.c b/board/volteer/board.c index 2f23635d95..468a3859f5 100644 --- a/board/volteer/board.c +++ b/board/volteer/board.c @@ -12,7 +12,6 @@ #include "driver/accel_bma2x2.h" #include "driver/accelgyro_bmi260.h" #include "driver/als_tcs3400.h" -#include "driver/bc12/pi3usb9201.h" #include "driver/retimer/bb_retimer.h" #include "driver/sync.h" #include "driver/tcpm/ps8xxx.h" @@ -362,20 +361,6 @@ __override void board_cbi_init(void) } /******************************************************************************/ -/* BC1.2 charger detect configuration */ -const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { - [USBC_PORT_C0] = { - .i2c_port = I2C_PORT_USB_C0, - .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, - }, - [USBC_PORT_C1] = { - .i2c_port = I2C_PORT_USB_C1, - .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); - -/******************************************************************************/ /* USBC mux configuration - Tiger Lake includes internal mux */ struct usb_mux usbc1_tcss_usb_mux = { .usb_port = USBC_PORT_C1, diff --git a/board/volteer/usbc_config.c b/board/volteer/usbc_config.c index a731138478..4a6a68a83c 100644 --- a/board/volteer/usbc_config.c +++ b/board/volteer/usbc_config.c @@ -9,6 +9,7 @@ #include "usbc_config.h" #include "usbc_ppc.h" #include "usb_mux.h" +#include "driver/bc12/pi3usb9201_public.h" #include "driver/ppc/sn5s330_public.h" #include "driver/ppc/syv682x_public.h" #include "driver/tcpm/ps8xxx_public.h" @@ -191,3 +192,17 @@ struct tcpc_config_t tcpc_config[] = { }; BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT); BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT); + +/******************************************************************************/ +/* BC1.2 charger detect configuration */ +const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { + [USBC_PORT_C0] = { + .i2c_port = I2C_PORT_USB_C0, + .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, + }, + [USBC_PORT_C1] = { + .i2c_port = I2C_PORT_USB_C1, + .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); diff --git a/driver/bc12/pi3usb9201.h b/driver/bc12/pi3usb9201.h index 6326ee1d49..3163a3eebc 100644 --- a/driver/bc12/pi3usb9201.h +++ b/driver/bc12/pi3usb9201.h @@ -5,11 +5,10 @@ /* PI3USB9201 USB BC 1.2 Charger Detector driver definitions */ -/* I2C address */ -#define PI3USB9201_I2C_ADDR_0_FLAGS 0x5C -#define PI3USB9201_I2C_ADDR_1_FLAGS 0x5D -#define PI3USB9201_I2C_ADDR_2_FLAGS 0x5E -#define PI3USB9201_I2C_ADDR_3_FLAGS 0x5F +#ifndef __CROS_EC_DRIVER_BC12_PI3USB9201_H +#define __CROS_EC_DRIVER_BC12_PI3USB9201_H + +#include "driver/bc12/pi3usb9201_public.h" #define PI3USB9201_REG_CTRL_1 0x0 #define PI3USB9201_REG_CTRL_2 0x1 @@ -34,12 +33,6 @@ #define PI3USB9201_REG_HOST_STS_DEV_PLUG BIT(1) #define PI3USB9201_REG_HOST_STS_DEV_UNPLUG BIT(2) -struct pi3usb9201_config_t { - const int i2c_port; - const int i2c_addr_flags; - const int flags; -}; - enum pi3usb9201_mode { PI3USB9201_POWER_DOWN, PI3USB9201_SDP_HOST_MODE, @@ -51,7 +44,4 @@ enum pi3usb9201_mode { PI3USB9201_USB_PATH_ON, }; -/* Configuration struct defined at board level */ -extern const struct pi3usb9201_config_t pi3usb9201_bc12_chips[]; - -extern const struct bc12_drv pi3usb9201_drv; +#endif /* __CROS_EC_DRIVER_BC12_PI3USB9201_H */ diff --git a/include/driver/bc12/pi3usb9201_public.h b/include/driver/bc12/pi3usb9201_public.h new file mode 100644 index 0000000000..643952ab4a --- /dev/null +++ b/include/driver/bc12/pi3usb9201_public.h @@ -0,0 +1,28 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* PI3USB9201 USB BC 1.2 Charger Detector public definitions */ + +#ifndef __CROS_EC_DRIVER_BC12_PI3USB9201_PUBLIC_H +#define __CROS_EC_DRIVER_BC12_PI3USB9201_PUBLIC_H + +/* I2C address */ +#define PI3USB9201_I2C_ADDR_0_FLAGS 0x5C +#define PI3USB9201_I2C_ADDR_1_FLAGS 0x5D +#define PI3USB9201_I2C_ADDR_2_FLAGS 0x5E +#define PI3USB9201_I2C_ADDR_3_FLAGS 0x5F + +struct pi3usb9201_config_t { + const int i2c_port; + const int i2c_addr_flags; + const int flags; +}; + +/* Configuration struct defined at board level */ +extern const struct pi3usb9201_config_t pi3usb9201_bc12_chips[]; + +extern const struct bc12_drv pi3usb9201_drv; + +#endif /* __CROS_EC_DRIVER_BC12_PI3USB9201_PUBLIC_H */ |