Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01abbd85 authored by Umang Agrawal's avatar Umang Agrawal
Browse files

power: smb1390-psy: Optimize power_supply_changed call flow



Currently, power_supply_changed is call on every run through cp
disable votable callback function. Optimize this, to call power_
supply_changed only in case of a change in its disable status.

Change-Id: Ic95e5c6e59d59988a0c2b592f15987e2f24716a9
Signed-off-by: default avatarUmang Agrawal <uagrawal@codeaurora.org>
parent 1e6db67e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ struct smb1390 {
	bool			switcher_enabled;
	int			die_temp;
	bool			suspended;
	bool			disabled;
	u32			debug_mask;
	u32			min_ilim_ua;
	u32			max_temp_alarm_degc;
@@ -482,8 +483,10 @@ static int smb1390_disable_vote_cb(struct votable *votable, void *data,
	}

	/* charging may have been disabled by ILIM; send uevent */
	if (chip->cp_master_psy)
	if (chip->cp_master_psy && (disable != chip->disabled))
		power_supply_changed(chip->cp_master_psy);

	chip->disabled = disable;
	return rc;
}

@@ -1116,6 +1119,7 @@ static int smb1390_probe(struct platform_device *pdev)
	mutex_init(&chip->die_chan_lock);
	chip->die_temp = -ENODATA;
	chip->pmic_rev_id = pmic_rev_id;
	chip->disabled = true;
	platform_set_drvdata(pdev, chip);

	chip->regmap = dev_get_regmap(chip->dev->parent, NULL);