diff options
author | Diana Z <dzigterman@chromium.org> | 2021-06-10 14:09:13 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-16 19:52:32 +0000 |
commit | 7a9b88e75a9e6e99643b0c45206d78f3c7f36ee9 (patch) | |
tree | 5e8d71f0b014f1b9a7e88df9b48027d1007dab8d /driver/tcpm/nct38xx.c | |
parent | ffa3298c8360adb169e4427b004d6c883bd57ad4 (diff) | |
download | chrome-ec-7a9b88e75a9e6e99643b0c45206d78f3c7f36ee9.tar.gz |
NCT38xx: Export boot type information
Outside code may need an understanding of our board's boot type, so
allow it to be exported from the driver.
BRANCH=None
BUG=b:183660105
TEST=make -j buildall
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Iec61872be283f9ef65ccf71e99d89cee7184f2f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953874
Reviewed-by: Rob Barnes <robbarnes@google.com>
Commit-Queue: Rob Barnes <robbarnes@google.com>
Diffstat (limited to 'driver/tcpm/nct38xx.c')
-rw-r--r-- | driver/tcpm/nct38xx.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c index f5527af3a5..1b620b5c40 100644 --- a/driver/tcpm/nct38xx.c +++ b/driver/tcpm/nct38xx.c @@ -22,14 +22,13 @@ #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) -enum nct38xx_boot_type { - BOOT_UNKNOWN, - BOOT_DEAD_BATTERY, - BOOT_NORMAL, -}; - static enum nct38xx_boot_type boot_type[CONFIG_USB_PD_PORT_MAX_COUNT]; +enum nct38xx_boot_type nct38xx_get_boot_type(int port) +{ + return boot_type[port]; +} + static int nct38xx_init(int port) { int rv; @@ -39,13 +38,13 @@ static int nct38xx_init(int port) * Detect dead battery boot by the default role control value of 0x0A * once per EC run */ - if (boot_type[port] == BOOT_UNKNOWN) { + if (boot_type[port] == NCT38XX_BOOT_UNKNOWN) { RETURN_ERROR(tcpc_read(port, TCPC_REG_ROLE_CTRL, ®)); - if (reg == 0x0A) - boot_type[port] = BOOT_DEAD_BATTERY; + if (reg == NCT38XX_ROLE_CTRL_DEAD_BATTERY) + boot_type[port] = NCT38XX_BOOT_DEAD_BATTERY; else - boot_type[port] = BOOT_NORMAL; + boot_type[port] = NCT38XX_BOOT_NORMAL; } RETURN_ERROR(tcpc_read(port, TCPC_REG_POWER_STATUS, ®)); @@ -57,7 +56,7 @@ static int nct38xx_init(int port) * be delayed if we have booted from a dead battery with a debug * accessory and change this bit (see b/186799392). */ - if ((boot_type[port] == BOOT_DEAD_BATTERY) && + if ((boot_type[port] == NCT38XX_BOOT_DEAD_BATTERY) && (reg & TCPC_REG_POWER_STATUS_DEBUG_ACC_CON)) CPRINTS("C%d: Booted in dead battery mode, not changing debug" " control", port); |