diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2015-03-30 14:45:21 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-02 16:49:16 +0000 |
commit | 305ab1e07f4ed41511c09c2cadd012bfd88d1380 (patch) | |
tree | 00bab227e034ecad27d0235d458887c1de1dc04f | |
parent | 6c499c93cd60ea231f11d8013c2de5a480c9b95d (diff) | |
download | chrome-ec-305ab1e07f4ed41511c09c2cadd012bfd88d1380.tar.gz |
ryu: add Proto 6 support
- use the TI BQ25892 instead of the BQ24773 as the battery charger,
update the board configuration accordingly.
=> this change is NOT backward compatible with previous boards
- upate GPIOs configuration
- Use the BQ25892 5V boost to source VBUS.
- on the type-C port, Rp has been set to 1.5A, update the USB PD source
limit accordingly and set the boost limit to 1.65A.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:38603 chrome-os-partner:39202
TEST=make buildall
run on a P4 modified board with BQ25890 and see the battery charging and
the system running on AC and battery. Plug on C-to-A receptacle adapter
and see 5V.
Change-Id: Id28c9dbd155fe5aedc328bf5ab4da4420495e1f5
Reviewed-on: https://chromium-review.googlesource.com/266021
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/ryu/board.c | 4 | ||||
-rw-r--r-- | board/ryu/board.h | 6 | ||||
-rw-r--r-- | board/ryu/gpio.inc | 19 | ||||
-rw-r--r-- | board/ryu/usb_pd_config.h | 13 | ||||
-rw-r--r-- | board/ryu/usb_pd_policy.c | 10 |
5 files changed, 29 insertions, 23 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c index 92c7558c55..bee0c931b5 100644 --- a/board/ryu/board.c +++ b/board/ryu/board.c @@ -64,7 +64,7 @@ void vbus_evt(enum gpio_signal signal) * If VBUS is low, or VBUS is high and we are not outputting VBUS * ourselves, then update the VBUS supplier. */ - if (!vbus_level || !gpio_get_level(GPIO_USBC_5V_EN)) { + if (!vbus_level || !gpio_get_level(GPIO_CHGR_OTG)) { charge.voltage = USB_BC12_CHARGE_VOLTAGE; charge.current = vbus_level ? DEFAULT_CURR_LIMIT : 0; charge_manager_update_charge(CHARGE_SUPPLIER_VBUS, 0, &charge); @@ -457,7 +457,7 @@ int board_set_active_charge_port(int charge_port) { int ret = EC_SUCCESS; /* check if we are source vbus on that port */ - int source = gpio_get_level(GPIO_USBC_5V_EN); + int source = gpio_get_level(GPIO_CHGR_OTG); if (charge_port >= 0 && charge_port < PD_PORT_COUNT && source) { CPRINTS("Port %d is not a sink, skipping enable", charge_port); diff --git a/board/ryu/board.h b/board/ryu/board.h index 0b9cf98a88..da9aff7624 100644 --- a/board/ryu/board.h +++ b/board/ryu/board.h @@ -55,11 +55,11 @@ #define CONFIG_BATTERY_REVIVE_DISCONNECT #define CONFIG_CHARGER #define CONFIG_CHARGER_V2 -#define CONFIG_CHARGER_BQ24773 +#define CONFIG_CHARGER_BQ25892 +#define CONFIG_CHARGER_BQ2589X_BOOST (BQ2589X_BOOSTV_MV(4998) | \ + BQ2589X_BOOST_LIM_1650MA) #define CONFIG_CHARGER_ILIM_PIN_DISABLED #define CONFIG_CHARGER_PROFILE_OVERRIDE -#define CONFIG_CHARGER_SENSE_RESISTOR 5 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 #define CONFIG_CHARGER_INPUT_CURRENT 512 #define CONFIG_CHARGER_DISCHARGE_ON_AC #define CONFIG_CHIPSET_TEGRA diff --git a/board/ryu/gpio.inc b/board/ryu/gpio.inc index 5d5a3011f3..03963164b9 100644 --- a/board/ryu/gpio.inc +++ b/board/ryu/gpio.inc @@ -21,9 +21,13 @@ GPIO_INT(HPD_IN, C, 1, GPIO_INT_BOTH, pp1800_on /* Interrupt lines not used yet */ GPIO(BC_TEMP_ALERT_L, C, 5, GPIO_INT_FALLING) -GPIO(LB_INT_L, E, 7, GPIO_INT_FALLING | GPIO_PULL_UP) +GPIO(LB_INT_L, C, 14, GPIO_INT_FALLING | GPIO_PULL_UP) GPIO(LIGHTBAR_EN_L, E, 8, GPIO_INT_FALLING | GPIO_PULL_UP) GPIO(BASE_PRES_L, E, 10, GPIO_INT_BOTH | GPIO_PULL_UP) +GPIO(CHGR_INT_L, B, 2, GPIO_INT_FALLING) +GPIO(CAM_SYNC_INT_L, C, 7, GPIO_INT_FALLING) +GPIO(ACC_IRQ, D, 12, GPIO_INPUT) +GPIO(COMPASS_DRDY, A, 8, GPIO_INPUT) /* Buttons */ GPIO(BTN_VOLD_L, C, 0, GPIO_INPUT | GPIO_PULL_UP) @@ -45,7 +49,6 @@ GPIO(USBC_TX_CLKIN, B, 3, GPIO_OUT_LOW) /* System power */ GPIO(PMIC_PWRON_L, D, 14, GPIO_ODR_HIGH) GPIO(PMIC_WARM_RESET_L, E, 4, GPIO_ODR_HIGH) -GPIO(EN_PP5000, A, 14, GPIO_OUT_LOW) /* Proto 5+ */ /* * We are missing an external pull-up for EN_PP3300. * This GPIO is used to pull it up through an external 100kOhm. @@ -56,8 +59,8 @@ GPIO(EN_PP3300_RSVD, E, 13, GPIO_OUT_LOW) GPIO(PMIC_THERM_L, B, 8, GPIO_ODR_HIGH) GPIO(VBUS_SENSE, A, 0, GPIO_ANALOG) -GPIO(CHGR_IADP, B, 0, GPIO_ANALOG) -GPIO(CHGR_IBAT, C, 3, GPIO_ANALOG) +GPIO(CHGR_PSEL, B, 0, GPIO_OUT_LOW) +GPIO(CHGR_OTG, C, 3, GPIO_OUT_LOW) /* Inductive charging */ GPIO(CHARGE_EN, D, 13, GPIO_OUT_LOW) @@ -65,12 +68,13 @@ GPIO(BASE_CHG_VDD_EN, E, 5, GPIO_OUT_LOW) /* USB-C Power and muxes control */ GPIO(USBC_CHARGE_EN_L, A, 7, GPIO_OUT_LOW) -GPIO(USBC_5V_EN, D, 8, GPIO_OUT_LOW) GPIO(USBC_VCONN1_EN_L, F, 10, GPIO_OUT_HIGH) GPIO(USBC_VCONN2_EN_L, D, 10, GPIO_OUT_HIGH) GPIO(USBC_CC1_DEVICE_ODL, A, 5, GPIO_ODR_LOW) GPIO(USBC_CC2_DEVICE_ODL, E, 14, GPIO_ODR_LOW) +GPIO(USBC_CC_PUEN1, D, 0, GPIO_INPUT) +GPIO(USBC_CC_PUEN2, C, 8, GPIO_INPUT) /* Pericom PI3USB30592 mux controls on Proto 5+ */ GPIO(USBC_MUX_CONF0, D, 3, GPIO_OUT_LOW) @@ -113,9 +117,10 @@ GPIO(VDDSPI_EN, C, 12, GPIO_OUT_LOW) GPIO(SH_RESET, C, 4, GPIO_ODR_HIGH) GPIO(SH_BOOT, C, 9, GPIO_ODR_HIGH) GPIO(EC_INT_L, F, 2, GPIO_ODR_HIGH) -GPIO(ENTERING_RW, E, 15, GPIO_OUT_LOW) +GPIO(ENTERING_RW, E, 9, GPIO_OUT_LOW) GPIO(WP_L, F, 6, GPIO_INPUT) -GPIO(FW_DEBUG_MODE_L, C, 7, GPIO_ODR_HIGH) /* Proto 5+ */ +GPIO(FW_DEBUG_MODE_L, D, 1, GPIO_ODR_HIGH) +GPIO(EC_BOOT_SPI_EN, F, 4, GPIO_ODR_HIGH) #if 0 /* Alternate functions */ diff --git a/board/ryu/usb_pd_config.h b/board/ryu/usb_pd_config.h index 8ab1017e3f..95828a5c46 100644 --- a/board/ryu/usb_pd_config.h +++ b/board/ryu/usb_pd_config.h @@ -132,8 +132,6 @@ static inline void pd_tx_init(void) static inline void pd_set_host_mode(int port, int enable) { if (enable) { - /* Turn the 5V regulator providing VBUS */ - gpio_set_level(GPIO_EN_PP5000, 1); /* We never charging in power source mode */ gpio_set_level(GPIO_USBC_CHARGE_EN_L, 1); charge_set_input_current_limit(0); @@ -142,9 +140,8 @@ static inline void pd_set_host_mode(int port, int enable) gpio_set_level(GPIO_USBC_CC2_DEVICE_ODL, 1); } else { /* Kill VBUS power supply */ - gpio_set_level(GPIO_USBC_5V_EN, 0); - /* Turn off the 5V regulator */ - gpio_set_level(GPIO_EN_PP5000, 0); + charger_enable_otg_power(0); + gpio_set_level(GPIO_CHGR_OTG, 0); /* Pull low for device mode. */ gpio_set_level(GPIO_USBC_CC1_DEVICE_ODL, 0); gpio_set_level(GPIO_USBC_CC2_DEVICE_ODL, 0); @@ -211,15 +208,15 @@ static inline int pd_snk_is_vbus_provided(int port) /* start as a sink in case we have no other power supply/battery */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED -/* delay for the voltage transition on the power supply, chip max is 16us */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 20000 /* us */ +/* delay for the voltage transition on the power supply, BQ25x spec is 30ms */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 40000 /* us */ #define PD_POWER_SUPPLY_TURN_OFF_DELAY 20000 /* us */ /* Define typical operating power and max power */ #define PD_OPERATING_POWER_MW 10000 #define PD_MAX_POWER_MW 24000 #define PD_MAX_CURRENT_MA 3000 -#define PD_MAX_VOLTAGE_MV 20000 +#define PD_MAX_VOLTAGE_MV 12000 /* The lower the input voltage, the higher the power efficiency. */ #define PD_PREFER_LOW_VOLTAGE diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c index b7550b1480..9459ab8772 100644 --- a/board/ryu/usb_pd_policy.c +++ b/board/ryu/usb_pd_policy.c @@ -3,7 +3,9 @@ * found in the LICENSE file. */ +#include "config.h" #include "charge_manager.h" +#include "charger.h" #include "common.h" #include "console.h" #include "gpio.h" @@ -21,7 +23,7 @@ #define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP) const uint32_t pd_src_pdo[] = { - PDO_FIXED(5000, 900, PDO_FIXED_FLAGS), + PDO_FIXED(5000, 1500, PDO_FIXED_FLAGS), }; const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo); @@ -90,7 +92,8 @@ void pd_transition_voltage(int idx) int pd_set_power_supply_ready(int port) { /* provide VBUS */ - gpio_set_level(GPIO_USBC_5V_EN, 1); + gpio_set_level(GPIO_CHGR_OTG, 1); + charger_enable_otg_power(1); return EC_SUCCESS; /* we are ready */ } @@ -98,7 +101,8 @@ int pd_set_power_supply_ready(int port) void pd_power_supply_reset(int port) { /* Kill VBUS */ - gpio_set_level(GPIO_USBC_5V_EN, 0); + charger_enable_otg_power(0); + gpio_set_level(GPIO_CHGR_OTG, 0); } int pd_board_checks(void) |