mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 00:21:46 +00:00
plankton: Do not send soft reset unless already sourcing power
When 5v/12v/20v buttons are pressed, plankton first switchs to source role, set the requested source cap, and then perform a soft reset. However, if plankton was sink and just switched to source, the port partner might not have switched to sink and this leaves the CC line in a state where communication is not possible. The subsequent soft reset then fails. If we are not already sourcing power, we actually don't need a soft reset after changing source cap. BUG=chrome-os-partner:32163 TEST=Switch from sink to source. Doesn't see "soft reset" in console. TEST=Switch from 5V to 12V. See "soft reset". BRANCH=None Change-Id: Ia4b834c2e7dc1324b9143c46a72938845499e2fb Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219004 Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
a6c7b82fd9
commit
bf368218e5
@@ -36,25 +36,31 @@ enum usbc_action {
|
||||
USBC_ACT_CABLE_FLIP,
|
||||
USBC_ACT_CABLE_POLARITY0,
|
||||
USBC_ACT_CABLE_POLARITY1,
|
||||
|
||||
/* Number of USBC actions */
|
||||
USBC_ACT_COUNT
|
||||
};
|
||||
|
||||
enum board_src_cap src_cap_mapping[USBC_ACT_COUNT] =
|
||||
{
|
||||
[USBC_ACT_5V_TO_DUT] = SRC_CAP_5V,
|
||||
[USBC_ACT_12V_TO_DUT] = SRC_CAP_12V,
|
||||
[USBC_ACT_20V_TO_DUT] = SRC_CAP_20V,
|
||||
};
|
||||
|
||||
static void set_usbc_action(enum usbc_action act)
|
||||
{
|
||||
int need_soft_reset;
|
||||
|
||||
switch (act) {
|
||||
case USBC_ACT_5V_TO_DUT:
|
||||
board_set_source_cap(SRC_CAP_5V);
|
||||
pd_set_dual_role(PD_DRP_FORCE_SOURCE);
|
||||
pd_soft_reset();
|
||||
break;
|
||||
case USBC_ACT_12V_TO_DUT:
|
||||
board_set_source_cap(SRC_CAP_12V);
|
||||
pd_set_dual_role(PD_DRP_FORCE_SOURCE);
|
||||
pd_soft_reset();
|
||||
break;
|
||||
case USBC_ACT_20V_TO_DUT:
|
||||
board_set_source_cap(SRC_CAP_20V);
|
||||
need_soft_reset = gpio_get_level(GPIO_VBUS_CHARGER_EN);
|
||||
board_set_source_cap(src_cap_mapping[act]);
|
||||
pd_set_dual_role(PD_DRP_FORCE_SOURCE);
|
||||
pd_soft_reset();
|
||||
if (need_soft_reset)
|
||||
pd_soft_reset();
|
||||
break;
|
||||
case USBC_ACT_DEVICE:
|
||||
pd_set_dual_role(PD_DRP_FORCE_SINK);
|
||||
|
||||
Reference in New Issue
Block a user