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

Commit 26c202ce authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

power: smb135x-charger: Don't change current limits when batt absent



When battery is absent, the device is running from a charger source.
The default hardware behaviour/bootloader would have set the appropriate
amount of current to draw from the charger.
In such a case, ignore the values set by USB driver and continue to draw
current as set by hardware defaults/bootloader from the charger source.

Change-Id: I85c509ae9914fc31795cc02fb8a2ff2b59768e8d
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 7397ff81
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -869,6 +869,17 @@ static int smb135x_set_appropriate_current(struct smb135x_chg *chip,
	int (*func)(struct smb135x_chg *chip, int current_ma);
	int rc = 0;

	/*
	 * If battery is absent do not modify the current at all, these
	 * would be some appropriate values set by the bootloader or default
	 * configuration and since it is the only source of power we should
	 * not change it
	 */
	if (!chip->batt_present) {
		pr_debug("ignoring current request since battery is absent\n");
		return 0;
	}

	if (path == USB) {
		path_current = chip->usb_psy_ma;
		func = smb135x_set_usb_chg_current;