summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-01-14 14:30:41 +0800
committerCommit Bot <commit-bot@chromium.org>2022-01-19 06:38:20 +0000
commitbf45efbbe3497a01364bfad793489cfddbd7d34c (patch)
treeab6d59f834d3fe1ccd9c3cc51eb8675dc6552381
parentfd8210fd57184db0f496a89ea83e4525dabbc644 (diff)
downloadchrome-ec-bf45efbbe3497a01364bfad793489cfddbd7d34c.tar.gz
zephyr: kingler: move GPIO_EN_USB_C1_SINK control to rt1718s hook
PPC NX20P3483 needs EN_SNK asserted to sink. This isn't a issue on most cases except for the dead battery case. When dead battery happens, the nx20p3483_init tries to enable sink from VCHG, but however, the EN_SNK was controlled by the RT1718S's universal GPIO, and the control was tight to charge_manager:board_set_active_charger_port(). The charge_manager wasn't ready at the very beginning moment of boot up, and also the NX20P3483 won't response to I2C command when it was in dead battery mode, so it has difficulty to interact to charger_manager from PPC driver. So when NX20P3483 exits dead battery mode, due to the EN_SNK was not asserted, the board is browned-out. This CL moves the control from charge_manager to TCPC driver so it's easier for NX20P3483 to ask RT1718S to enable EN_SNK pin. BUG=b:214146359 TEST=Boot Kingler without battery with sinking from C1. BRANCH=none Change-Id: I032c020a958bd9d1cec1a6b10766c90ebd102f3b Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3386982 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r--zephyr/projects/corsola/src/kingler/usb_pd_policy.c2
-rw-r--r--zephyr/projects/corsola/src/kingler/usbc_config.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/zephyr/projects/corsola/src/kingler/usb_pd_policy.c b/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
index b2c8b2ca37..ac33b4e3b7 100644
--- a/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
+++ b/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
@@ -44,7 +44,7 @@ int pd_set_power_supply_ready(int port)
int rv;
/* Disable charging. */
- rv = board_vbus_sink_enable(port, 0);
+ rv = ppc_vbus_sink_enable(port, 0);
if (rv)
return rv;
diff --git a/zephyr/projects/corsola/src/kingler/usbc_config.c b/zephyr/projects/corsola/src/kingler/usbc_config.c
index 8a1a37ef84..289b5d1e2c 100644
--- a/zephyr/projects/corsola/src/kingler/usbc_config.c
+++ b/zephyr/projects/corsola/src/kingler/usbc_config.c
@@ -214,12 +214,12 @@ int board_is_sourcing_vbus(int port)
return board_vbus_source_enabled(port);
}
-int board_vbus_sink_enable(int port, int enable)
+__override int board_rt1718s_set_snk_enable(int port, int enable)
{
if (port == USBC_PORT_C1)
rt1718s_gpio_set_level(port, GPIO_EN_USB_C1_SINK, enable);
- return ppc_vbus_sink_enable(port, enable);
+ return EC_SUCCESS;
}
int board_set_active_charge_port(int port)
@@ -240,7 +240,7 @@ int board_set_active_charge_port(int port)
* Do not return early if one fails otherwise we can
* get into a boot loop assertion failure.
*/
- if (board_vbus_sink_enable(i, 0))
+ if (ppc_vbus_sink_enable(i, 0))
CPRINTS("Disabling C%d as sink failed.", i);
}
@@ -263,12 +263,12 @@ int board_set_active_charge_port(int port)
if (i == port)
continue;
- if (board_vbus_sink_enable(i, 0))
+ if (ppc_vbus_sink_enable(i, 0))
CPRINTS("C%d: sink path disable failed.", i);
}
/* Enable requested charge port. */
- if (board_vbus_sink_enable(port, 1)) {
+ if (ppc_vbus_sink_enable(port, 1)) {
CPRINTS("C%d: sink path enable failed.", port);
return EC_ERROR_UNKNOWN;
}