axp-pmu: adc refactor

Remove the battery power ADC since it's not used right now,
and seems to fluctuate too rapidly to be of much use.

Change-Id: If115e4e3ce14d4c18ce899f5a889f7f99ab66489
This commit is contained in:
Aidan MacDonald 2022-01-09 18:55:28 +00:00
parent b490f08b7c
commit c62c323ebc
5 changed files with 60 additions and 129 deletions

View file

@ -63,10 +63,15 @@ void power_init(void)
/* Set lowest sample rate */
axp_adc_set_rate(AXP_ADC_RATE_25HZ);
/* Ensure battery voltage ADC is enabled */
int bits = axp_adc_get_enabled();
bits |= (1 << ADC_BATTERY_VOLTAGE);
axp_adc_set_enabled(bits);
/* Enable required ADCs */
axp_adc_set_enabled(
(1 << ADC_BATTERY_VOLTAGE) |
(1 << ADC_CHARGE_CURRENT) |
(1 << ADC_DISCHARGE_CURRENT) |
(1 << ADC_VBUS_VOLTAGE) |
(1 << ADC_VBUS_CURRENT) |
(1 << ADC_INTERNAL_TEMP) |
(1 << ADC_APS_VOLTAGE));
/* Turn on all power outputs */
i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR,

View file

@ -61,10 +61,15 @@ void power_init(void)
/* Set lowest sample rate */
axp_adc_set_rate(AXP_ADC_RATE_25HZ);
/* Ensure battery voltage ADC is enabled */
int bits = axp_adc_get_enabled();
bits |= (1 << ADC_BATTERY_VOLTAGE);
axp_adc_set_enabled(bits);
/* Enable required ADCs */
axp_adc_set_enabled(
(1 << ADC_BATTERY_VOLTAGE) |
(1 << ADC_CHARGE_CURRENT) |
(1 << ADC_DISCHARGE_CURRENT) |
(1 << ADC_VBUS_VOLTAGE) |
(1 << ADC_VBUS_CURRENT) |
(1 << ADC_INTERNAL_TEMP) |
(1 << ADC_APS_VOLTAGE));
/* Turn on all power outputs */
i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR,

View file

@ -78,6 +78,19 @@ void power_init(void)
cw2015_init();
#endif
/* Set lowest sample rate */
axp_adc_set_rate(AXP_ADC_RATE_25HZ);
/* Enable required ADCs */
axp_adc_set_enabled(
(1 << ADC_BATTERY_VOLTAGE) |
(1 << ADC_CHARGE_CURRENT) |
(1 << ADC_DISCHARGE_CURRENT) |
(1 << ADC_VBUS_VOLTAGE) |
(1 << ADC_VBUS_CURRENT) |
(1 << ADC_INTERNAL_TEMP) |
(1 << ADC_APS_VOLTAGE));
/* Change supply voltage from the default of 1250 mV to 1200 mV,
* this matches the original firmware's settings. Didn't observe
* any obviously bad behavior at 1250 mV, but better to be safe. */