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

Commit f49e59f7 authored by David Keitel's avatar David Keitel
Browse files

power: qpnp-charger: allow charging in host mode



If host mode is enabled, allow the BATFET to be closed
thus that a DC charger is still able to charge the battery.

Change-Id: I3f863db42b028fa51637d3eb02f0931a02311e27
CRs-Fixed: 495760
Signed-off-by: default avatarDavid Keitel <dkeitel@codeaurora.org>
parent 597cda31
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1215,6 +1215,8 @@ qpnp_chg_dc_dcin_valid_irq_handler(int irq, void *_chip)

	if (chip->dc_present ^ dc_present) {
		chip->dc_present = dc_present;
		if (qpnp_chg_is_otg_en_set(chip))
			qpnp_chg_force_run_on_batt(chip, !dc_present ? 1 : 0);
		if (!dc_present && !qpnp_chg_is_usb_chg_plugged_in(chip)) {
			chip->delta_vddmax_mv = 0;
			qpnp_chg_set_appropriate_vddmax(chip);
@@ -1417,11 +1419,13 @@ switch_usb_to_host_mode(struct qpnp_chg_chip *chip)
	if (qpnp_chg_is_otg_en_set(chip))
		return 0;

	if (!qpnp_chg_is_dc_chg_plugged_in(chip)) {
		rc = qpnp_chg_force_run_on_batt(chip, 1);
		if (rc) {
			pr_err("Failed to disable charging rc = %d\n", rc);
			return rc;
		}
	}

	/* force usb ovp fet off */
	rc = qpnp_chg_masked_write(chip,