From 5ec3b2791a405b18ff919bfd9a4283b1e03debda Mon Sep 17 00:00:00 2001 From: Yilun Lin Date: Thu, 14 Nov 2019 11:24:36 +0800 Subject: charger/rt946x: expose rt946x_get_adc expose rt946x_get_adc for ADC readings TEST=make buildall -j BUG=b:141903096 BRANCH=kukui Change-Id: Ibd8f900347b1a940dab1cce7e20031da02b0a334 Signed-off-by: Yilun Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1915480 Reviewed-by: Ting Shen --- driver/charger/rt946x.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'driver/charger/rt946x.h') diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h index 6b0228bb3b..c672622080 100644 --- a/driver/charger/rt946x.h +++ b/driver/charger/rt946x.h @@ -718,6 +718,24 @@ int rt946x_enable_charge_termination(int en); /* Enable/Disable charge EOC */ int rt946x_enable_charge_eoc(int en); +enum rt946x_adc_in_sel { + RT946X_ADC_VBUS_DIV5 = 1, + RT946X_ADC_VBUS_DIV2, + MT6370_ADC_TS_BAT = 6, + MT6370_ADC_IBUS = 8, + MT6370_ADC_TEMP_JC = 12, + MT6370_ADC_MAX, +}; + +/** + * Read ADC channels + * + * @param adc_sel The ADC channel + * @param adc_val The read value + * @return EC_SUCCESS or EC_ERROR_* + */ +int rt946x_get_adc(enum rt946x_adc_in_sel adc_sel, int *adc_val); + /** * Toggle BC12 detection * -- cgit v1.2.1