From f0486d8cde3001dc62038de7bc06a473f3d84b7c Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Mon, 29 Mar 2021 20:23:32 -0700 Subject: Reland "dedede/raa489000: Disable ASGATE from READY state" This is a reland of f7fbc629f0655229cc7ffdadfb18c9e13118e3d2 Original change's description: > dedede/raa489000: Disable ASGATE from READY state > > On the boards which use the RAA489000, we keep the ADC enabled while > giving VBUS control to the charger side. This can cause a situation > where VBUS is not quite zero volts when a charger is removed. This > commit uses the charger side registers to control the ASGATE when > selecting our active charge port. This is done in addition to the > existing implementation which uses the TCPCI registers to control > ASGATE. When we place the parts into low power mode, we move the VBUS > control from the TCPC side of the IC to the charger side. It should > be safe to issue both commands as if the TCPC side has control, the IC > ignores the setting from the charger side registers. > > BUG=b:183220414 > BRANCH=dedede > TEST=Build and flash madoo, plug in charger to port, unplug, verify > that VBUS falls to < 200mV and decays from there. > > Signed-off-by: Aseda Aboagye > Change-Id: I8e8c8cc32575d18c9d3d1210ed3c5cf69ad5ca4b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793058 > Tested-by: Aseda Aboagye > Reviewed-by: Diana Z > Commit-Queue: Aseda Aboagye Bug: b:183220414 Change-Id: I36db53f3e13ba848308cd7e0c94a1b5a3551c600 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2797549 Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye Tested-by: Aseda Aboagye --- board/waddledoo/board.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'board/waddledoo') diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c index bea0774a3d..a7e76e6525 100644 --- a/board/waddledoo/board.c +++ b/board/waddledoo/board.c @@ -344,9 +344,11 @@ int board_set_active_charge_port(int port) /* Disable all ports. */ if (port == CHARGE_PORT_NONE) { - for (i = 0; i < board_get_usb_pd_port_count(); i++) + for (i = 0; i < board_get_usb_pd_port_count(); i++) { tcpc_write(i, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW); + raa489000_enable_asgate(i, false); + } return EC_SUCCESS; } @@ -368,6 +370,7 @@ int board_set_active_charge_port(int port) if (tcpc_write(i, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW)) CPRINTS("p%d: sink path disable failed.", i); + raa489000_enable_asgate(i, false); } /* @@ -378,7 +381,8 @@ int board_set_active_charge_port(int port) charger_discharge_on_ac(1); /* Enable requested charge port. */ - if (tcpc_write(port, TCPC_REG_COMMAND, + if (raa489000_enable_asgate(port, true) || + tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_HIGH)) { CPRINTS("p%d: sink path enable failed.", port); charger_discharge_on_ac(0); -- cgit v1.2.1