summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrasanna Prapancham <prapancham@google.com>2022-11-18 20:08:36 +0000
committerPrasanna Prapancham <prapancham@google.com>2022-11-22 22:50:41 +0000
commitbdc4e3a6497462c754fba8fff1356c452737fff5 (patch)
treebb98a032fe9cd80b62128f80daa949eab94b33eb
parent0c47a265a9cd51383bdc2c3c88791689f3037e1b (diff)
downloadbms-bdc4e3a6497462c754fba8fff1356c452737fff5.tar.gz
google_cpm: disable dc_chg_avail votable only on thermal crit level
cp_fcc == 0 can happen even if PPS adapter offline. So rely on actual mdis level to disable dc chg avail votable Bug: 259618406 Change-Id: I1d53e475b6fc0cc727cfb16fc4df679a5ccc2fb9 Signed-off-by: Prasanna Prapancham <prapancham@google.com>
-rw-r--r--google_cpm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/google_cpm.c b/google_cpm.c
index e9e6fa2..7dda5c2 100644
--- a/google_cpm.c
+++ b/google_cpm.c
@@ -2546,10 +2546,6 @@ static int gcpm_mdis_update_limits(struct gcpm_drv *gcpm, int msc_fcc,
cp_fcc, ret);
}
- ret = gvotable_cast_int_vote(gcpm->dc_chg_avail_votable, REASON_MDIS, cp_fcc != 0, 1);
- if (ret < 0)
- dev_err(gcpm->device, "Unable to cast vote for DC Chg avail (%d)\n", ret);
-
/* turning off wireless charging equires disabling the wireless IC */
if (dc_icl == 0 && dc_icl_votable) {
ret = mdis_cast_vote(dc_icl_votable, 0, true);
@@ -2571,6 +2567,7 @@ static int gcpm_set_mdis_charge_cntl_limit(struct thermal_cooling_device *tcd,
struct gcpm_drv *gcpm = tdev->gcpm;
int online = 0, budget = -1, in_idx = -1;
int msc_fcc, dc_icl, cp_fcc, ret;
+ bool mdis_crit_lvl;
if (tdev->thermal_levels <= 0 || lvl < 0 || lvl > tdev->thermal_levels)
return -EINVAL;
@@ -2580,7 +2577,8 @@ static int gcpm_set_mdis_charge_cntl_limit(struct thermal_cooling_device *tcd,
dev_dbg(gcpm->device, "MSC_THERM_MDIS lvl=%d->%d\n", tdev->current_level, (int)lvl);
tdev->current_level = lvl;
- if (lvl == tdev->thermal_levels || tdev->thermal_mitigation[lvl] == 0) {
+ mdis_crit_lvl = lvl == tdev->thermal_levels || tdev->thermal_mitigation[lvl] == 0;
+ if (mdis_crit_lvl) {
budget = msc_fcc = dc_icl = cp_fcc = 0;
gcpm->cp_fcc_hold_limit = gcpm_chg_select_check_cp_limit(gcpm);
gcpm->cp_fcc_hold = true;
@@ -2673,6 +2671,10 @@ static int gcpm_set_mdis_charge_cntl_limit(struct thermal_cooling_device *tcd,
lvl, in_idx, online, cp_fcc, gcpm->cp_fcc_hold,
gcpm->cp_fcc_hold_limit);
+ ret = gvotable_cast_int_vote(gcpm->dc_chg_avail_votable, REASON_MDIS,
+ !mdis_crit_lvl, 1);
+ if (ret < 0)
+ dev_err(gcpm->device, "Unable to cast vote for DC Chg avail (%d)\n", ret);
/*
* this might be in the callback for mdis_votable
* . cp_fcc == 0 will apply msc_fcc, dc_icl and must cause the