From 290f16a3a0361e7e42938b4f17b63f57924d9c21 Mon Sep 17 00:00:00 2001 From: Diana Z Date: Thu, 11 Apr 2019 10:46:45 -0600 Subject: TCPC: Set charger vbus during init For some chargers and TCPCs (specifically in this case, BC1.2 charger and ANX7447 combination), the TCPC will not supply a power status changed interrupt after waking from low power mode with the charger plugged in. In this case, we can use the Vbus presence during init in order to alert the charger task. BUG=b:130249342 BRANCH=octopus TEST=checked PD and BC1.2 chargers worked on both ports of phaser, verified they also worked over resets and sysjumps, both locked and unlocked Change-Id: Ie9c581a7b5a21c093a10d3e8d57cf27ac48fa138 Signed-off-by: Diana Z Reviewed-on: https://chromium-review.googlesource.com/1565170 Reviewed-by: Jett Rink (cherry picked from commit 7b01a7716c33c4c01907acc88adba7cc1c15199e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1568885 Tested-by: Xiong Huang --- driver/tcpm/tcpci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index a99e50e695..ea4183c247 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -707,6 +707,13 @@ int tcpci_tcpm_init(int port) /* Update VBUS status */ tcpc_vbus[port] = power_status & TCPC_REG_POWER_STATUS_VBUS_PRES ? 1 : 0; +#if defined(CONFIG_USB_PD_VBUS_DETECT_TCPC) && defined(CONFIG_USB_CHARGER) + /* + * Set Vbus change now in case the TCPC doesn't send a power status + * changed interrupt for it later. + */ + usb_charger_vbus_change(port, tcpc_vbus[port]); +#endif error = init_alert_mask(port); if (error) return error; -- cgit v1.2.1