summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2023-02-24 11:28:42 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-24 07:41:18 +0000
commit9239f343bc9bf69aac3cf6438a4d34ba3e578a7e (patch)
tree669805daef6eae4db408df857546871de3c98f71
parent689394b3906cb4b1c3a18af04383fd2ed57b130e (diff)
downloadchrome-ec-9239f343bc9bf69aac3cf6438a4d34ba3e578a7e.tar.gz
geralt: disable RT9490 ADC on AC off
The RT9490 ADC is used as IBUS ADC, so this is not needed when there's no AC coming from the port. Disable it when AC is off. BUG=b:269708282 TEST=unplug power, in G3. $ dut-power -t 60 | grep @@ BRANCH=none LOW_COVERAGE_REASON=geralt early bringup Change-Id: I5dacd383420f942aa863b45a4e70d858fa7ac1f3 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4290092 Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Alvis Hsu <alvishsu@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--zephyr/program/geralt/src/hooks.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/zephyr/program/geralt/src/hooks.c b/zephyr/program/geralt/src/hooks.c
index bc21babe66..fd106732ae 100644
--- a/zephyr/program/geralt/src/hooks.c
+++ b/zephyr/program/geralt/src/hooks.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include "charger.h"
+#include "driver/charger/rt9490.h"
+#include "extpower.h"
#include "gpio/gpio_int.h"
#include "gpio_signal.h"
#include "hooks.h"
@@ -85,3 +88,10 @@ static int install_suspend_handler(const struct device *unused)
}
SYS_INIT(install_suspend_handler, APPLICATION, 1);
+
+static void board_hook_ac_change(void)
+{
+ rt9490_enable_adc(CHARGER_SOLO, extpower_is_present());
+}
+DECLARE_HOOK(HOOK_AC_CHANGE, board_hook_ac_change, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, board_hook_ac_change, HOOK_PRIO_LAST);