summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2018-09-27 12:56:07 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-02 05:19:05 -0700
commit3b7ac6bedfa39ee10e000c705a400e2ede8fa4e5 (patch)
tree52d26f25605bb13180c37543bf7267c20b0f5702
parentb729f9f10151438a86779d6c939b86572c0c1cda (diff)
downloadchrome-ec-3b7ac6bedfa39ee10e000c705a400e2ede8fa4e5.tar.gz
bc12: rename bq24392 driver to max14637
The MAX14637 BC 1.2 USB charger detection chip is functionally similar to the bq24392 and can use the same driver. Rather than have 2 copies of the same driver, or a generic named driver than can be used for both chips, rename the existing bq24392 driver to max14637 as that's the BC 1.2 chip that our current designs are using. BUG=b:113267982 BRANCH=none TEST=make -j buildall Change-Id: I03cfb4918513d756c2a41341001a8162652a29b6 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1250031 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--baseboard/grunt/baseboard.c8
-rw-r--r--baseboard/grunt/baseboard.h2
-rw-r--r--baseboard/octopus/baseboard.c8
-rw-r--r--baseboard/octopus/baseboard.h2
-rw-r--r--board/aleena/board.c1
-rw-r--r--board/ampton/board.c1
-rw-r--r--board/bip/board.c1
-rw-r--r--board/bobba/board.c1
-rw-r--r--board/careena/board.c1
-rw-r--r--board/fleex/board.c1
-rw-r--r--board/grunt/board.c1
-rw-r--r--board/liara/board.c1
-rw-r--r--board/meep/board.c1
-rw-r--r--board/yorp/board.c1
-rw-r--r--board/zoombini/board.c10
-rw-r--r--board/zoombini/board.h2
-rw-r--r--docs/low_battery_startup.md2
-rw-r--r--driver/bc12/max14637.c (renamed from driver/bc12/bq24392.c)26
-rw-r--r--driver/bc12/max14637.h (renamed from driver/bc12/bq24392.h)16
-rw-r--r--driver/build.mk2
-rw-r--r--include/config.h2
21 files changed, 41 insertions, 49 deletions
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index 503b989a32..8243106a0a 100644
--- a/baseboard/grunt/baseboard.c
+++ b/baseboard/grunt/baseboard.c
@@ -17,7 +17,7 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/bc12/bq24392.h"
+#include "driver/bc12/max14637.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8xxx.h"
@@ -147,16 +147,16 @@ struct ppc_config_t ppc_chips[] = {
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* BC 1.2 chip Configuration */
-const struct bq24392_config_t bq24392_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON_L,
.chg_det_pin = GPIO_USB_C0_BC12_CHG_DET,
- .flags = BQ24392_FLAGS_ENABLE_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_ENABLE_ACTIVE_LOW,
},
[USB_PD_PORT_PS8751] = {
.chip_enable_pin = GPIO_USB_C1_BC12_VBUS_ON_L,
.chg_det_pin = GPIO_USB_C1_BC12_CHG_DET,
- .flags = BQ24392_FLAGS_ENABLE_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_ENABLE_ACTIVE_LOW,
},
};
diff --git a/baseboard/grunt/baseboard.h b/baseboard/grunt/baseboard.h
index fdb0752c39..975c5fde36 100644
--- a/baseboard/grunt/baseboard.h
+++ b/baseboard/grunt/baseboard.h
@@ -52,7 +52,7 @@
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_SMART
-#define CONFIG_BC12_DETECT_BQ24392
+#define CONFIG_BC12_DETECT_MAX14637
#define CONFIG_CHARGER
#define CONFIG_CHARGER_V2
#define CONFIG_CHARGE_MANAGER
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c
index b1f8b11fb0..beb2e1754d 100644
--- a/baseboard/octopus/baseboard.c
+++ b/baseboard/octopus/baseboard.c
@@ -10,7 +10,7 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
-#include "driver/bc12/bq24392.h"
+#include "driver/bc12/max14637.h"
#include "driver/ppc/nx20p348x.h"
#include "gpio.h"
#include "hooks.h"
@@ -76,16 +76,16 @@ const int usb_port_enable[USB_PORT_COUNT] = {
/******************************************************************************/
/* BC 1.2 chip Configuration */
-const struct bq24392_config_t bq24392_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = {
{
.chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON,
.chg_det_pin = GPIO_USB_C0_BC12_CHG_DET_L,
- .flags = BQ24392_FLAGS_CHG_DET_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_CHG_DET_ACTIVE_LOW,
},
{
.chip_enable_pin = GPIO_USB_C1_BC12_VBUS_ON,
.chg_det_pin = GPIO_USB_C1_BC12_CHG_DET_L,
- .flags = BQ24392_FLAGS_CHG_DET_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_CHG_DET_ACTIVE_LOW,
},
};
diff --git a/baseboard/octopus/baseboard.h b/baseboard/octopus/baseboard.h
index 9311ab39ba..f1d3bc0d0f 100644
--- a/baseboard/octopus/baseboard.h
+++ b/baseboard/octopus/baseboard.h
@@ -187,7 +187,7 @@
#define CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_BC12_DETECT_BQ24392
+#define CONFIG_BC12_DETECT_MAX14637
#define CONFIG_CMD_PD_CONTROL
#define CONFIG_CMD_PPC_DUMP
diff --git a/board/aleena/board.c b/board/aleena/board.c
index e2929e9ead..d84d3a5bb5 100644
--- a/board/aleena/board.c
+++ b/board/aleena/board.c
@@ -17,7 +17,6 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/bc12/bq24392.h"
#include "driver/led/lm3630a.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 0552be05a6..be6c20f1d3 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -10,7 +10,6 @@
#include "button.h"
#include "charge_state.h"
#include "common.h"
-#include "driver/bc12/bq24392.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/it83xx_pd.h"
#include "driver/tcpm/ps8xxx.h"
diff --git a/board/bip/board.c b/board/bip/board.c
index 1222cd00ba..f82d0c41d9 100644
--- a/board/bip/board.c
+++ b/board/bip/board.c
@@ -9,7 +9,6 @@
#include "adc_chip.h"
#include "charge_state.h"
#include "common.h"
-#include "driver/bc12/bq24392.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/it83xx_pd.h"
#include "driver/tcpm/ps8xxx.h"
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 6c3e3d1a23..a4ef7dadc9 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -15,7 +15,6 @@
#include "cros_board_info.h"
#include "driver/accel_kionix.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/bc12/bq24392.h"
#include "driver/charger/bd9995x.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/anx7447.h"
diff --git a/board/careena/board.c b/board/careena/board.c
index bb1c19cbc7..a54acb8a17 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -17,7 +17,6 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/bc12/bq24392.h"
#include "driver/led/lm3630a.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
diff --git a/board/fleex/board.c b/board/fleex/board.c
index a6e430217c..3d8e7b8e09 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -16,7 +16,6 @@
#include "cros_board_info.h"
#include "driver/accel_lis2dh.h"
#include "driver/accelgyro_lsm6dsm.h"
-#include "driver/bc12/bq24392.h"
#include "driver/charger/bd9995x.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/anx7447.h"
diff --git a/board/grunt/board.c b/board/grunt/board.c
index 9dda591189..c3b0d05dcf 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -17,7 +17,6 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/bc12/bq24392.h"
#include "driver/led/lm3630a.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
diff --git a/board/liara/board.c b/board/liara/board.c
index 63f083b78b..6450ad034b 100644
--- a/board/liara/board.c
+++ b/board/liara/board.c
@@ -17,7 +17,6 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/bc12/bq24392.h"
#include "driver/led/lm3630a.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
diff --git a/board/meep/board.c b/board/meep/board.c
index bb93e606ba..29352c3924 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -16,7 +16,6 @@
#include "cros_board_info.h"
#include "driver/accel_kionix.h"
#include "driver/accelgyro_lsm6dsm.h"
-#include "driver/bc12/bq24392.h"
#include "driver/charger/bd9995x.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/anx7447.h"
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 5cbce8d72f..7d4ee431e8 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -14,7 +14,6 @@
#include "cros_board_info.h"
#include "driver/accel_kionix.h"
#include "driver/accelgyro_lsm6dsm.h"
-#include "driver/bc12/bq24392.h"
#include "driver/charger/bd9995x.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/anx7447.h"
diff --git a/board/zoombini/board.c b/board/zoombini/board.c
index a17d1465f4..66ea5b4156 100644
--- a/board/zoombini/board.c
+++ b/board/zoombini/board.c
@@ -15,7 +15,7 @@
#include "compile_time_macros.h"
#include "driver/accelgyro_lsm6dsm.h"
#include "driver/als_opt3001.h"
-#include "driver/bc12/bq24392.h"
+#include "driver/bc12/max14637.h"
#include "driver/led/lm3630a.h"
#include "driver/pmic_tps650x30.h"
#include "driver/ppc/sn5s330.h"
@@ -329,21 +329,21 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
#ifdef BOARD_ZOOMBINI
/* BC 1.2 chip Configuration */
-const struct bq24392_config_t bq24392_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = {
{
.chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON_L,
.chg_det_pin = GPIO_USB_C0_BC12_CHG_DET,
- .flags = BQ24392_FLAGS_ENABLE_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_ENABLE_ACTIVE_LOW,
},
{
.chip_enable_pin = GPIO_USB_C1_BC12_VBUS_ON_L,
.chg_det_pin = GPIO_USB_C1_BC12_CHG_DET,
- .flags = BQ24392_FLAGS_ENABLE_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_ENABLE_ACTIVE_LOW,
},
{
.chip_enable_pin = GPIO_USB_C2_BC12_VBUS_ON_L,
.chg_det_pin = GPIO_USB_C2_BC12_CHG_DET,
- .flags = BQ24392_FLAGS_ENABLE_ACTIVE_LOW,
+ .flags = MAX14637_FLAGS_ENABLE_ACTIVE_LOW,
},
};
diff --git a/board/zoombini/board.h b/board/zoombini/board.h
index 8a2e99d5a4..2369362de1 100644
--- a/board/zoombini/board.h
+++ b/board/zoombini/board.h
@@ -94,7 +94,7 @@
#endif /* defined(BOARD_MEOWTH) */
#ifdef BOARD_ZOOMBINI
-#define CONFIG_BC12_DETECT_BQ24392
+#define CONFIG_BC12_DETECT_MAX14637
#endif /* defined(BOARD_ZOOMBINI) */
#define CONFIG_CHARGER
#define CONFIG_CHARGER_V2
diff --git a/docs/low_battery_startup.md b/docs/low_battery_startup.md
index 451136f80e..82f5c8c6ab 100644
--- a/docs/low_battery_startup.md
+++ b/docs/low_battery_startup.md
@@ -63,7 +63,7 @@ input voltage-regulation mode.
In effect, the EC limits to both a maximum current of 2.4A and minimum voltage
of 4.5V, for about 12W of power draw from a BC1.2 source.
-See also `driver/bc12/bq24392.c:bc12_detect()`.
+See also `driver/bc12/max14637.c:bc12_detect()`.
#### USB-PD Sources
diff --git a/driver/bc12/bq24392.c b/driver/bc12/max14637.c
index b74781f221..4085ae4fe5 100644
--- a/driver/bc12/bq24392.c
+++ b/driver/bc12/max14637.c
@@ -4,7 +4,7 @@
*/
/*
- * BQ24392 USB BC 1.2 Charger Detector driver.
+ * MAX14637 USB BC 1.2 Charger Detector driver.
*
* NOTE: The driver assumes that CHG_AL_N and SW_OPEN are not connected,
* therefore the value of CHG_DET indicates whether the source is NOT a
@@ -12,7 +12,7 @@
* the system will have to charge ramp.
*/
-#include "bq24392.h"
+#include "max14637.h"
#include "cannonlake.h"
#include "charge_manager.h"
#include "chipset.h"
@@ -36,10 +36,10 @@
* @return 1 if charger detect is activated (high when active high or
* low with active low), otherwise 0.
*/
-static int is_chg_det_activated(const struct bq24392_config_t * const cfg)
+static int is_chg_det_activated(const struct max14637_config_t * const cfg)
{
return !!gpio_get_level(cfg->chg_det_pin) ^
- !!(cfg->flags & BQ24392_FLAGS_CHG_DET_ACTIVE_LOW);
+ !!(cfg->flags & MAX14637_FLAGS_CHG_DET_ACTIVE_LOW);
}
/**
@@ -50,11 +50,11 @@ static int is_chg_det_activated(const struct bq24392_config_t * const cfg)
* low).
*/
static void activate_chip_enable(
- const struct bq24392_config_t * const cfg, const int enable)
+ const struct max14637_config_t * const cfg, const int enable)
{
gpio_set_level(
cfg->chip_enable_pin,
- !!enable ^ !!(cfg->flags & BQ24392_FLAGS_ENABLE_ACTIVE_LOW));
+ !!enable ^ !!(cfg->flags & MAX14637_FLAGS_ENABLE_ACTIVE_LOW));
}
/**
@@ -64,7 +64,7 @@ static void activate_chip_enable(
*/
static void bc12_detect(const int port)
{
- const struct bq24392_config_t * const cfg = &bq24392_config[port];
+ const struct max14637_config_t * const cfg = &max14637_config[port];
struct charge_port_info new_chg;
/*
@@ -100,13 +100,13 @@ static void bc12_detect(const int port)
}
/**
- * Turn off the BQ24392 detector.
+ * Turn off the MAX14637 detector.
*
* @param port: Which USB Type-C port's BC1.2 detector to turn off.
*/
static void power_down_ic(const int port)
{
- const struct bq24392_config_t * const cfg = &bq24392_config[port];
+ const struct max14637_config_t * const cfg = &max14637_config[port];
/* Turn off the IC. */
activate_chip_enable(cfg, 0);
@@ -168,14 +168,16 @@ void usb_charger_task(void *u)
void usb_charger_set_switches(int port, enum usb_switch setting)
{
- /* The BQ24392 automatically sets up the USB 2.0 high-speed switches. */
+ /*
+ * The MAX14637 automatically sets up the USB 2.0 high-speed switches.
+ */
}
#if defined(CONFIG_CHARGE_RAMP_SW) || defined(CONFIG_CHARGE_RAMP_HW)
int usb_charger_ramp_allowed(int supplier)
{
/*
- * Due to the limitations in the application of the BQ24392, we
+ * Due to the limitations in the application of the MAX14637, we
* don't quite know exactly what we're plugged into. Therefore,
* the supplier type will be CHARGE_SUPPLIER_OTHER.
*/
@@ -184,7 +186,7 @@ int usb_charger_ramp_allowed(int supplier)
int usb_charger_ramp_max(int supplier, int sup_curr)
{
- /* Use the current limit that was decided by the BQ24392. */
+ /* Use the current limit that was decided by the MAX14637. */
if (supplier == CHARGE_SUPPLIER_OTHER)
return sup_curr;
else
diff --git a/driver/bc12/bq24392.h b/driver/bc12/max14637.h
index 1d49814968..7013e46fb1 100644
--- a/driver/bc12/bq24392.h
+++ b/driver/bc12/max14637.h
@@ -3,29 +3,29 @@
* found in the LICENSE file.
*/
-/* BQ24392 USB BC 1.2 Charger Detector driver definitions */
+/* MAX14637 USB BC 1.2 Charger Detector driver definitions */
#include "gpio.h"
-#define BQ24392_FLAGS_ENABLE_ACTIVE_LOW (1 << 0)
-#define BQ24392_FLAGS_CHG_DET_ACTIVE_LOW (1 << 1)
+#define MAX14637_FLAGS_ENABLE_ACTIVE_LOW (1 << 0)
+#define MAX14637_FLAGS_CHG_DET_ACTIVE_LOW (1 << 1)
-struct bq24392_config_t {
+struct max14637_config_t {
/*
* Enable signal to BC 1.2. Can be active high or low depending on
- * BQ24392_FLAGS_ENABLE_ACTIVE_LOW flag bit.
+ * MAX14637_FLAGS_ENABLE_ACTIVE_LOW flag bit.
*/
enum gpio_signal chip_enable_pin;
/*
* Charger detect signal from BC 1.2 chip. Can be active high or low
- * depending on BQ24392_FLAGS_CHG_DET_ACTIVE_LOW flag bit.
+ * depending on MAX14637_FLAGS_CHG_DET_ACTIVE_LOW flag bit.
*/
enum gpio_signal chg_det_pin;
- /* Configuration flags with prefix BQ24392_FLAGS. */
+ /* Configuration flags with prefix MAX14637_FLAGS. */
int flags;
};
/*
* Array that contains boards-specific configuration for BC 1.2 charging chips.
*/
-extern const struct bq24392_config_t bq24392_config[CONFIG_USB_PD_PORT_COUNT];
+extern const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT];
diff --git a/driver/build.mk b/driver/build.mk
index 2529aa2478..ae5b46c06d 100644
--- a/driver/build.mk
+++ b/driver/build.mk
@@ -18,7 +18,7 @@ driver-$(CONFIG_ACCEL_LIS2D_COMMON)+=accel_lis2dh.o stm_mems_common.o
driver-$(CONFIG_SYNC)+=sync.o
# BC1.2 Charger Detection Devices
-driver-$(CONFIG_BC12_DETECT_BQ24392)+=bc12/bq24392.o
+driver-$(CONFIG_BC12_DETECT_MAX14637)+=bc12/max14637.o
driver-$(CONFIG_BC12_DETECT_PI3USB9281)+=bc12/pi3usb9281.o
# Gyrometers
diff --git a/include/config.h b/include/config.h
index 44af10b3a3..bcc27bbdbe 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3363,7 +3363,7 @@
#undef CONFIG_USB_CHARGER
/* External BC1.2 charger detection devices. */
-#undef CONFIG_BC12_DETECT_BQ24392
+#undef CONFIG_BC12_DETECT_MAX14637
#undef CONFIG_BC12_DETECT_PI3USB9281
/* Number of Pericom PI3USB9281 chips present in system */
#undef CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT