summaryrefslogtreecommitdiff
path: root/driver/tcpm
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-04-23 15:49:55 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-29 01:13:23 +0000
commit8bc05328420e50ecf17c41e237eb4210a43eef46 (patch)
tree1941a4ae2eca60bacad32540a6a1ecb03493a6d7 /driver/tcpm
parent255a07f57d811080533664f87ebb3138794f0987 (diff)
downloadchrome-ec-8bc05328420e50ecf17c41e237eb4210a43eef46.tar.gz
raa489000: Check VBUS ADC over POWER_STATUS
In order to boot without a battery, we need to send the SinkVBUS command to the TCPC as soon as possible once we are aware. Previously, we were checking the TCPC registers, however since this is being done in the TCPC init, the TCPC registers weren't initialised yet so we couldn't really use this field. However, this part is a combined TCPC and charger IC, therefore we can use the charger IC-side APIs to check if VBUS is present. This commit simply checks the VBUS ADC register over consulting the POWER_STATUS TCPC register. BUG=b:178728138,b:178981107 BRANCH=dedede TEST=Build and flash madoo, unplug battery, verify DUT can boot up from either Type-C port with a 45W PD charger. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I4801fcd2655a65e74dc8feddc06e369635a2ce34 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2848245 Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'driver/tcpm')
-rw-r--r--driver/tcpm/raa489000.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/driver/tcpm/raa489000.c b/driver/tcpm/raa489000.c
index 572b992a4b..94c363ad81 100644
--- a/driver/tcpm/raa489000.c
+++ b/driver/tcpm/raa489000.c
@@ -6,6 +6,7 @@
*/
#include "charge_manager.h"
+#include "charger.h"
#include "common.h"
#include "console.h"
#include "driver/charger/isl923x.h"
@@ -60,6 +61,7 @@ int raa489000_init(int port)
int device_id;
int i2c_port;
struct charge_port_info chg = { 0 };
+ int vbus_mv = 0;
/* Perform unlock sequence */
rv = tcpc_write16(port, 0xAA, 0xDAA0);
@@ -105,10 +107,11 @@ int raa489000_init(int port)
* If VBUS is present, start sinking from it if we haven't already
* chosen a charge port and no battery is connected. This is
* *kinda hacky* doing it here, but we must start sinking VBUS now,
- * otherwise the board may die (See b/150702984, b/178728138)
+ * otherwise the board may die (See b/150702984, b/178728138). This
+ * works as this part is a combined charger IC and TCPC.
*/
- tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
- if ((regval & TCPC_REG_POWER_STATUS_UNINIT) &&
+ charger_get_vbus_voltage(port, &vbus_mv);
+ if (vbus_mv &&
charge_manager_get_active_charge_port() == CHARGE_PORT_NONE &&
!pd_is_battery_capable()) {
chg.current = 500;