power: pm8921-charger: adjust vdd max earlier
The charger hardware decides Constant Current VS Constant Voltage based
on the VPH_PWR voltage and not on battery voltage (vbatt) as it should.
The problem is, becuase of IR drop between VPH_PWR and VBATT, VPH_PWR
reaches the voltage programmed in vdd_max earlier while the VBATT stays
lower causing the charger hardware switch to constant voltage mode
prematurely.
To fix this issue, adjust the vdd_max early.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/drivers/power/pm8921-charger.c b/drivers/power/pm8921-charger.c
index 0db0b6f..0285d4f 100644
--- a/drivers/power/pm8921-charger.c
+++ b/drivers/power/pm8921-charger.c
@@ -3171,11 +3171,7 @@
pr_debug("Exiting ichg_meas_ua = %d > 0\n", ichg_meas_ua);
return;
}
- if (ichg_meas_ua <= ichg_threshold_ua) {
- pr_debug("Exiting ichg_meas_ua = %d < ichg_threshold_ua = %d\n",
- ichg_meas_ua, ichg_threshold_ua);
- return;
- }
+
ichg_meas_ma = ichg_meas_ua / 1000;
/* rconn_mohm is in milliOhms */