diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-05-27 17:03:10 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-29 05:42:59 +0000 |
commit | 14ab37132cd0571bcad4432347356c80f6854d48 (patch) | |
tree | 4cd26f87367fa63551fddd0bf1bd52c3a9f6f32e /driver | |
parent | 8975cbb645f1f07c3682334d02510a8a1d3f730b (diff) | |
download | chrome-ec-14ab37132cd0571bcad4432347356c80f6854d48.tar.gz |
pi3usb9201: Add always powered flag
In some designs, the PI3USB9201 is always powered whereas in other
designs it was assumed to be tied to a 5V rail that could be
controlled.
This commit simply adds a flag, PI3USB9201_ALWAYS_POWERED that a board
can use.
BUG=b:151688130, b:150814620
BRANCH=None
TEST=Enable on waddledoo, build and flash, verify that Type-A ports
are not powered when a charger is plugged in in S5/G3.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I385ed6ff5d8ab3ab73f093e1c2288349436aca95
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2219270
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/bc12/pi3usb9201.c | 23 | ||||
-rw-r--r-- | driver/bc12/pi3usb9201.h | 4 |
2 files changed, 21 insertions, 6 deletions
diff --git a/driver/bc12/pi3usb9201.c b/driver/bc12/pi3usb9201.c index 5178d81dae..01f1374c75 100644 --- a/driver/bc12/pi3usb9201.c +++ b/driver/bc12/pi3usb9201.c @@ -210,6 +210,11 @@ static void bc12_power_down(int port) * supplier type that was most recently detected. */ bc12_update_supplier(CHARGE_SUPPLIER_NONE, port, NULL); + + /* There's nothing else to do if the part is always powered. */ + if (pi3usb9201_bc12_chips[port].flags & PI3USB9201_ALWAYS_POWERED) + return; + #if defined(CONFIG_POWER_PP5000_CONTROL) && defined(HAS_TASK_CHIPSET) /* Indicate PP5000_A rail is not required by USB_CHG task. */ power_5v_enable(task_get_current(), 0); @@ -218,12 +223,18 @@ static void bc12_power_down(int port) static void bc12_power_up(int port) { -#if defined(CONFIG_POWER_PP5000_CONTROL) && defined(HAS_TASK_CHIPSET) - /* Turn on the 5V rail to allow the chip to be powered. */ - power_5v_enable(task_get_current(), 1); - /* Give the pi3usb9201 time so it's ready to receive i2c messages */ - msleep(1); -#endif + if (IS_ENABLED(CONFIG_POWER_PP5000_CONTROL) && + IS_ENABLED(HAS_TASK_CHIPSET) && + !(pi3usb9201_bc12_chips[port].flags & PI3USB9201_ALWAYS_POWERED)) { + /* Turn on the 5V rail to allow the chip to be powered. */ + power_5v_enable(task_get_current(), 1); + /* + * Give the pi3usb9201 time so it's ready to receive i2c + * messages + */ + msleep(1); + } + pi3usb9201_interrupt_mask(port, 1); } diff --git a/driver/bc12/pi3usb9201.h b/driver/bc12/pi3usb9201.h index e3029999ca..6326ee1d49 100644 --- a/driver/bc12/pi3usb9201.h +++ b/driver/bc12/pi3usb9201.h @@ -16,6 +16,9 @@ #define PI3USB9201_REG_CLIENT_STS 0x2 #define PI3USB9201_REG_HOST_STS 0x3 +/* Flags */ +#define PI3USB9201_ALWAYS_POWERED BIT(0) + /* Control_1 regiter bit definitions */ #define PI3USB9201_REG_CTRL_1_INT_MASK BIT(0) #define PI3USB9201_REG_CTRL_1_MODE_SHIFT 1 @@ -34,6 +37,7 @@ struct pi3usb9201_config_t { const int i2c_port; const int i2c_addr_flags; + const int flags; }; enum pi3usb9201_mode { |