diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-05-02 12:09:59 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-10 21:00:55 +0000 |
commit | 2e6849807f2a9c7a1a8f963a90df5fb732ac4f20 (patch) | |
tree | ac0751d458ab2728b6f986570323d2eddfe8033c /driver | |
parent | 1d5f1604963d7f4a51b2b4836db5662777a9fe13 (diff) | |
download | chrome-ec-2e6849807f2a9c7a1a8f963a90df5fb732ac4f20.tar.gz |
Flapjack: Trigger BC12 detection when AC charger is plugged
Currently, when a BC12 charger is plugged while wireless charging is
taking place, rt946x does not trigger detection because VBUS is already
supplied. This makes charge_manger see a BC12 charger as a WPC supplier.
This patch makes EC manually trigger BC12 detection when an AC charger
is plugged.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b/127228934
BRANCH=none
TEST=Start charging on WPC. Connect a BC12 charger. Verify the supplier
switches to DCP (1.5A @5V).
Change-Id: I8e3439682515bf2241f6756a5386a7ad3ab2e14c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1593742
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/charger/rt946x.c | 11 | ||||
-rw-r--r-- | driver/charger/rt946x.h | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c index d3d9309129..4573943197 100644 --- a/driver/charger/rt946x.c +++ b/driver/charger/rt946x.c @@ -927,6 +927,17 @@ void rt946x_interrupt(enum gpio_signal signal) task_wake(TASK_ID_USB_CHG); } +int rt946x_toggle_bc12_detection(void) +{ + int rv; + rv = rt946x_enable_bc12_detection(0); + if (rv) + return rv; + /* mt6370 requires 40us delay to toggle RT946X_MASK_USBCHGEN */ + udelay(40); + return rt946x_enable_bc12_detection(1); +} + void usb_charger_task(void *u) { struct charge_port_info chg; diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h index 2b8c50ce19..ee35fae901 100644 --- a/driver/charger/rt946x.h +++ b/driver/charger/rt946x.h @@ -615,6 +615,13 @@ int rt946x_cutoff_battery(void); /* Enable/Disable charge temination */ int rt946x_enable_charge_termination(int en); +/** + * Toggle BC12 detection + * + * @return EC_SUCCESS or EC_ERROR_* + */ +int rt946x_toggle_bc12_detection(void); + struct rt946x_init_setting { uint16_t eoc_current; uint16_t mivr; |