pca9468_charger: log vin, vout, vbat on error

Bug: 277127919
Change-Id: If02d4f00f90696143a9a75cdddf6f1da2c4c7269
Signed-off-by: Prasanna Prapancham <[email protected]>
(cherry picked from commit 2f47caee6e9cf115443fdd75756f48f30fc88900)
diff --git a/pca9468_charger.c b/pca9468_charger.c
index 028c466..b225398 100644
--- a/pca9468_charger.c
+++ b/pca9468_charger.c
@@ -194,7 +194,7 @@
 /* ------------------------------------------------------------------------ */
 
 /* ADC Read function, return uV or uA */
-int pca9468_read_adc(struct pca9468_charger *pca9468, u8 adc_ch)
+int pca9468_read_adc(const struct pca9468_charger *pca9468, u8 adc_ch)
 {
 	u8 reg_data[2];
 	u16 raw_adc = 0;
@@ -622,7 +622,7 @@
 				    int loglevel)
 {
 	u8 test_val[16];
-	int ret;
+	int ret, vin, vout, vbat;
 
 	/* Read test register for debugging */
 	ret = regmap_bulk_read(pca9468->regmap, 0x40, test_val, 16);
@@ -640,6 +640,12 @@
 				__func__, test_val[8], test_val[9], test_val[10], test_val[11],
 				test_val[12], test_val[13], test_val[14], test_val[15]);
 	}
+
+	vin = pca9468_read_adc(pca9468, ADCCH_VIN);
+	vout = pca9468_read_adc(pca9468, ADCCH_VOUT);
+	vbat = pca9468_read_adc(pca9468, ADCCH_VBAT);
+	logbuffer_prlog(pca9468, loglevel, "%s: vin: %d, vout: %d, vbat: %d\n",
+			__func__, vin, vout, vbat);
 }
 
 static void pca9468_dump_config(const struct pca9468_charger *pca9468,
diff --git a/pca9468_charger.h b/pca9468_charger.h
index 91d2db6..21dbcd3 100644
--- a/pca9468_charger.h
+++ b/pca9468_charger.h
@@ -320,7 +320,7 @@
 
 /* - Core driver  ---------------------------- */
 
-int pca9468_read_adc(struct pca9468_charger *pca9468, u8 adc_ch);
+int pca9468_read_adc(const struct pca9468_charger *pca9468, u8 adc_ch);
 int pca9468_input_current_limit(struct pca9468_charger *pca9468);
 
 /* - PPS Integration (move to a separate file) ---------------------------- */