google_charger: Only set charger PSY FV if FV changed
This prevents -1 from being sent to the charger PSY if the device
connects to power with its charging path suspended (therefore not
drawing power).
Bug: 328534364
Signed-off-by: Andrei Ciubotariu <[email protected]>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:4b8a32c534a8fbe108c4a73e77305c8ff182ec57)
Merged-In: I38771b1d55c70af4dd9016d1b04f052f83434650
Change-Id: I38771b1d55c70af4dd9016d1b04f052f83434650
diff --git a/google_charger.c b/google_charger.c
index 79cfa69..6632c48 100644
--- a/google_charger.c
+++ b/google_charger.c
@@ -742,14 +742,16 @@
}
}
- pval.intval = fv_uv;
- rc = power_supply_set_property(chg_psy, POWER_SUPPLY_PROP_VOLTAGE_MAX,
- &pval);
- if (rc == -EAGAIN)
- return rc;
- if (rc != 0) {
- pr_err("MSC_CHG cannot set float voltage rc=%d\n", rc);
- return -EIO;
+ if (fv_uv != chg_drv->fv_uv) {
+ pval.intval = fv_uv;
+ rc = power_supply_set_property(chg_psy, POWER_SUPPLY_PROP_VOLTAGE_MAX,
+ &pval);
+ if (rc == -EAGAIN)
+ return rc;
+ if (rc != 0) {
+ pr_err("MSC_CHG cannot set float voltage rc=%d\n", rc);
+ return -EIO;
+ }
}
if (cc_max > chg_drv->cc_max) {