google_cpm: tickle the pps workloop only if DC is enabled
There is no need to schedue the pps workloop if PPS/DC is not requested
or running.
Bug: 178808007
Test: boot, enabe/disable DC charging, check logs
Signed-off-by: AleX Pelosi <[email protected]>
Change-Id: Ib95d1cacc126b718debd444f01f89419e52c8240
diff --git a/google_cpm.c b/google_cpm.c
index bf45e18..0c75dd2 100644
--- a/google_cpm.c
+++ b/google_cpm.c
@@ -941,15 +941,20 @@
/* route upstream when the charger active and found */
if (gcpm->chg_psy_avail[index])
power_supply_changed(gcpm->psy);
- mod_delayed_work(system_wq, &gcpm->pps_work, 0);
+
+ /* tickle the PPS loop if enabled */
+ if (gcpm->dc_index > 0)
+ mod_delayed_work(system_wq, &gcpm->pps_work, 0);
} else if (strcmp(psy->desc->name, gcpm->chg_psy_names[0]) == 0) {
- /* something is up with the default charger */
- mod_delayed_work(system_wq, &gcpm->pps_work, 0);
+ /* tickle the PPS loop if enabled */
+ if (gcpm->dc_index > 0)
+ mod_delayed_work(system_wq, &gcpm->pps_work, 0);
} else if (gcpm->tcpm_psy_name &&
!strcmp(psy->desc->name, gcpm->tcpm_psy_name))
{
- /* kick off PPS */
- mod_delayed_work(system_wq, &gcpm->pps_work, 0);
+ /* tickle the PPS loop if enabled */
+ if (gcpm->dc_index > 0)
+ mod_delayed_work(system_wq, &gcpm->pps_work, 0);
}
return NOTIFY_OK;