chg: let each project could use its own heartbeat work period

Heartbeat work in charger driver will work every 100s when no charging.
It will cost some power. 
But when discharging, we do not need to pay attention to charging
function, we just need soc changing.
And for our test in genevn, fg driver will send a notification when soc
changed. So we could increase the period of heartbeat wor

Change-Id: I9f9dcda52f42bbb53bcff61820e1df9ab07e4f15
Reviewed-on: https://gerrit.mot.com/2417652
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
weiweij 2022-11-01 13:36:08 +08:00 • committed by Wei Wei
commit ee26b35a3a

View file

@ -254,6 +254,8 @@ struct mmi_charger_chip {
uint32_t factory_kill_debounce_ms;
bool empty_vbat_shutdown_triggered;
int heartbeat_dischg_ms;
};
static int mmi_vote(struct mmi_vote *vote, const char *voter,
@ -2220,7 +2222,7 @@ static void mmi_charger_heartbeat_work(struct work_struct *work)
else if (chip->max_charger_rate != MMI_POWER_SUPPLY_CHARGE_RATE_NONE)
hb_resch_time = chip->heartbeat_interval;
else
hb_resch_time = HEARTBEAT_DISCHARGE_MS;
hb_resch_time = chip->heartbeat_dischg_ms;
schedule_delayed_work(&chip->heartbeat_work,
msecs_to_jiffies(hb_resch_time));
if (suspend_wakeups ||
@ -2760,6 +2762,13 @@ static int mmi_parse_dt(struct mmi_charger_chip *chip)
if (rc)
chip->wls_pmax = CHARGER_POWER_10W;
rc = of_property_read_u32(node, "mmi,heartbeat-discharger-ms",
&chip->heartbeat_dischg_ms);
if (rc)
chip->heartbeat_dischg_ms = HEARTBEAT_DISCHARGE_MS;
mmi_warn(chip, "mmi,heartbeat dischg ms %d\n", chip->heartbeat_dischg_ms);
node = of_find_node_by_path("/chosen");
if (!node)