mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
pd: Clear type-c charge_manager supplier when VBUS disappears
When VBUS is initially present, we set a type-c charge_manager supplier. Therefore, when we clear our VBUS present flag, we also need to zero our supplier. BUG=None TEST=Manual on Samus. Quickly plug + unplug SDP charger, verify that pd correctly detects that no charger is present on the board. BRANCH=Samus Change-Id: Ie72503f8a9b0f749b7529cfd6ff0675bd5640257 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/242092 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
9e07dfb6cb
commit
3075113c85
@@ -10,6 +10,5 @@ CHIP:=stm32
|
||||
CHIP_FAMILY:=stm32f0
|
||||
CHIP_VARIANT:=stm32f07x
|
||||
|
||||
board-y=board.o
|
||||
board-y=board.o usb_pd_policy.o
|
||||
board-$(HAS_TASK_SNIFFER)+=sniffer.o injector.o
|
||||
board-$(HAS_TASK_PD)+=usb_pd_policy.o
|
||||
|
||||
@@ -386,7 +386,15 @@ static inline void set_state(int port, enum pd_states next_state)
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE
|
||||
if (next_state == PD_STATE_SRC_DISCONNECTED ||
|
||||
next_state == PD_STATE_SNK_DISCONNECTED) {
|
||||
#else
|
||||
if (pd[port].flags & PD_FLAGS_VBUS_PRESENT) {
|
||||
/* Clear the input current limit */
|
||||
pd_set_input_current_limit(port, 0, 0);
|
||||
#ifdef CONFIG_CHARGE_MANAGER
|
||||
typec_set_input_current_limit(port, 0, 0);
|
||||
charge_manager_set_ceil(port, CHARGE_CEIL_NONE);
|
||||
#endif
|
||||
}
|
||||
#else /* CONFIG_USB_PD_DUAL_ROLE */
|
||||
if (next_state == PD_STATE_SRC_DISCONNECTED) {
|
||||
#endif
|
||||
pd[port].dev_id = 0;
|
||||
@@ -2348,7 +2356,8 @@ void pd_task(void)
|
||||
port, typec_curr, TYPE_C_VOLTAGE);
|
||||
#endif
|
||||
pd[port].flags |= PD_FLAGS_CHECK_PR_ROLE |
|
||||
PD_FLAGS_CHECK_DR_ROLE;
|
||||
PD_FLAGS_CHECK_DR_ROLE |
|
||||
PD_FLAGS_VBUS_PRESENT;
|
||||
set_state(port, PD_STATE_SNK_DISCOVERY);
|
||||
timeout = 10*MSEC;
|
||||
hook_call_deferred(
|
||||
@@ -2753,12 +2762,6 @@ void pd_task(void)
|
||||
pd[port].task_state != PD_STATE_HARD_RESET_EXECUTE) {
|
||||
/* Sink: detect disconnect by monitoring VBUS */
|
||||
set_state(port, PD_STATE_SNK_DISCONNECTED);
|
||||
/* Clear the input current limit */
|
||||
pd_set_input_current_limit(port, 0, 0);
|
||||
#ifdef CONFIG_CHARGE_MANAGER
|
||||
typec_set_input_current_limit(port, 0, 0);
|
||||
charge_manager_set_ceil(port, CHARGE_CEIL_NONE);
|
||||
#endif
|
||||
/* set timeout small to reconnect fast */
|
||||
timeout = 5*MSEC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user