mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
samus_pd: add interrupt to detect VBUS transitions quickly
Add interrupt to VBUS signal to detect VBUS transitions quickly to make sure we transition out of SNK_READY when VBUS goes away. BUG=chrome-os-partner:28611 BRANCH=none TEST=Test on samus 1.9 board. Ran for hours with charger plugged in, made sure when charger cuts out after missing ping responses, that it successfully goes to disconnected state and renogiates power. Change-Id: I93b2e49891e6a38c98095b7311a9435606cc61ab Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/201155 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
113ea43a69
commit
3dff34e653
@@ -18,7 +18,8 @@
|
||||
|
||||
void vbus_evt(enum gpio_signal signal)
|
||||
{
|
||||
ccprintf("VBUS %d!\n", signal);
|
||||
ccprintf("VBUS %d, %d!\n", signal, gpio_get_level(signal));
|
||||
task_wake(TASK_ID_PD);
|
||||
}
|
||||
|
||||
void bc12_evt(enum gpio_signal signal)
|
||||
@@ -176,6 +177,9 @@ static void board_init(void)
|
||||
* to specify device mode.
|
||||
*/
|
||||
gpio_set_level(GPIO_USB_C_CC_EN, 1);
|
||||
|
||||
/* Enable interrupts on VBUS transitions. */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE);
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
|
||||
@@ -784,6 +784,7 @@ void pd_task(void)
|
||||
pd_task_state = PD_STATE_SNK_DISCONNECTED;
|
||||
/* set timeout small to reconnect fast */
|
||||
timeout = 5*MSEC;
|
||||
break;
|
||||
}
|
||||
|
||||
/* check vital parameters from time to time */
|
||||
|
||||
Reference in New Issue
Block a user