charger/rt946x: notify AC_CHANGE when ext power plugged/unplugged

Support hooking on AC_CHANGE when external power plugged and unplugged.

BUG=b:137903027
TEST=on kukui, shutdown -h now, and plug power adapter on kukui, and see
     battery LED turning on immediately, and also see console prints
     "AC on"
BRANCH=master

Change-Id: I6e2704cfe2d3ed09cc6e1c76b8d03a5030a400ed
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1712400
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Commit-Queue: Yilun Lin <yllin@chromium.org>
Tested-by: Yilun Lin <yllin@chromium.org>
This commit is contained in:
Yilun Lin 2019-07-22 10:45:41 +08:00 committed by Commit Bot
parent 473bd883b6
commit be58022c66
1 changed files with 3 additions and 0 deletions

View File

@ -989,6 +989,7 @@ void usb_charger_task(void *u)
}
rt946x_enable_bc12_detection(0);
hook_notify(HOOK_AC_CHANGE);
}
/* VBUS detach event */
@ -1001,6 +1002,8 @@ void usb_charger_task(void *u)
if (!IS_ENABLED(CONFIG_CHARGER_MT6370_BC12_GPIO))
rt946x_enable_bc12_detection(1);
hook_notify(HOOK_AC_CHANGE);
}
task_wait_event(-1);