hwmon: pm8xxx-adc: Set the trim bit in the RSV register
Default value read from the RSV register is 0 when the driver
is initialized. Set the TRIM bit for every read during the
configuration. Setting this bit improves the PON OCV readings
done by the BMS controller as part of the XOADC calibration
routine.
Change-Id: I164897c053e3dad08612739f5df9ee28cf5e06d3
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
diff --git a/drivers/hwmon/pm8xxx-adc.c b/drivers/hwmon/pm8xxx-adc.c
index c33598f..57d34b9 100644
--- a/drivers/hwmon/pm8xxx-adc.c
+++ b/drivers/hwmon/pm8xxx-adc.c
@@ -345,12 +345,16 @@
if (rc < 0)
return rc;
+ rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_RSV, &data_arb_rsv);
+ if (rc < 0)
+ return rc;
+
data_arb_rsv &= (PM8XXX_ADC_ARB_USRP_RSV_RST |
PM8XXX_ADC_ARB_USRP_RSV_DTEST0 |
PM8XXX_ADC_ARB_USRP_RSV_DTEST1 |
- PM8XXX_ADC_ARB_USRP_RSV_OP |
- PM8XXX_ADC_ARB_USRP_RSV_TRM);
- data_arb_rsv |= chan_prop->amux_ip_rsv << PM8XXX_ADC_RSV_IP_SEL;
+ PM8XXX_ADC_ARB_USRP_RSV_OP);
+ data_arb_rsv |= (chan_prop->amux_ip_rsv << PM8XXX_ADC_RSV_IP_SEL |
+ PM8XXX_ADC_ARB_USRP_RSV_TRM);
rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_USRP_RSV, data_arb_rsv);
if (rc < 0)