mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-04 14:01:54 +00:00
glados: kunimitsu: remove dual-port charge enable workaround
Remove workaround for initial versions of boards in which we could not detect VBUS presence unless CHARGE_EN was active. With this change we can now properly charge from the port providing more power. Also cleanup unnecessary TODO in usb_pd_policy which isn't needed anymore. BUG=none BRANCH=none TEST=tested on glados. plug in a low power charger to one port, then plug in zinger to the other port and make sure the second port becomes the active charge port. Change-Id: I1a39db6570f3469ae79dc36e1205a1b872c67152 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298067 Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
@@ -273,15 +273,9 @@ int board_set_active_charge_port(int charge_port)
|
||||
CPRINTS("New chg p%d", charge_port);
|
||||
|
||||
if (charge_port == CHARGE_PORT_NONE) {
|
||||
/*
|
||||
* TODO: currently we only get VBUS knowledge when charge
|
||||
* is enabled. so, when not charging, we need to enable
|
||||
* both ports. but, this is dangerous if you have two
|
||||
* chargers plugged in and you set charge override to -1
|
||||
* then it will enable both sides!
|
||||
*/
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
|
||||
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 0);
|
||||
/* Disable both ports */
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1);
|
||||
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 1);
|
||||
} else {
|
||||
/* Make sure non-charging port is disabled */
|
||||
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_EN_L :
|
||||
|
||||
@@ -89,15 +89,9 @@ void pd_power_supply_reset(int port)
|
||||
/* Disable VBUS */
|
||||
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
|
||||
GPIO_USB_C0_5V_EN, 0);
|
||||
/*
|
||||
* TODO: Currently we can only detect VBUS when charge_en is
|
||||
* asserted, so, if there is no active charge port, then enable
|
||||
* charge_en. If the other port is the active charger, then leave
|
||||
* this port disabled.
|
||||
*/
|
||||
if (charge_manager_get_active_charge_port() != !port)
|
||||
gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L :
|
||||
GPIO_USB_C0_CHARGE_EN_L, 0);
|
||||
|
||||
/* notify host of power info change */
|
||||
pd_send_host_event(PD_EVENT_POWER_CHANGE);
|
||||
}
|
||||
|
||||
void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
@@ -154,7 +148,7 @@ int pd_check_data_swap(int port, int data_role)
|
||||
|
||||
void pd_execute_data_swap(int port, int data_role)
|
||||
{
|
||||
/* TODO: need to open/close D+/D- switch based on role */
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
void pd_check_pr_role(int port, int pr_role, int flags)
|
||||
|
||||
@@ -382,15 +382,9 @@ int board_set_active_charge_port(int charge_port)
|
||||
CPRINTS("New chg p%d", charge_port);
|
||||
|
||||
if (charge_port == CHARGE_PORT_NONE) {
|
||||
/*
|
||||
* TODO: currently we only get VBUS knowledge when charge
|
||||
* is enabled. so, when not charging, we need to enable
|
||||
* both ports. but, this is dangerous if you have two
|
||||
* chargers plugged in and you set charge override to -1
|
||||
* then it will enable both sides!
|
||||
*/
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
|
||||
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 0);
|
||||
/* Disable both ports */
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1);
|
||||
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 1);
|
||||
} else {
|
||||
/* Make sure non-charging port is disabled */
|
||||
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_EN_L :
|
||||
|
||||
@@ -89,15 +89,9 @@ void pd_power_supply_reset(int port)
|
||||
/* Disable VBUS */
|
||||
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
|
||||
GPIO_USB_C0_5V_EN, 0);
|
||||
/*
|
||||
* TODO: Currently we can only detect VBUS when charge_en is
|
||||
* asserted, so, if there is no active charge port, then enable
|
||||
* charge_en. If the other port is the active charger, then leave
|
||||
* this port disabled.
|
||||
*/
|
||||
if (charge_manager_get_active_charge_port() != !port)
|
||||
gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L :
|
||||
GPIO_USB_C0_CHARGE_EN_L, 0);
|
||||
|
||||
/* notify host of power info change */
|
||||
pd_send_host_event(PD_EVENT_POWER_CHANGE);
|
||||
}
|
||||
|
||||
void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
@@ -154,7 +148,7 @@ int pd_check_data_swap(int port, int data_role)
|
||||
|
||||
void pd_execute_data_swap(int port, int data_role)
|
||||
{
|
||||
/* TODO: need to open/close D+/D- switch based on role */
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
void pd_check_pr_role(int port, int pr_role, int flags)
|
||||
|
||||
Reference in New Issue
Block a user