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

Commit c62032e9 authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

power: qpnp-linear-charger: Update initial USB status



When kernel boots without USB connected, the USB driver
expects BSV(peripheral session valid) clear event from
the charger driver for the proper initialization of it's
state machine.

Update the USB psy with the initial USB status.

CRs-Fixed: 637966
Change-Id: If8172289585a8a3c073c037d81834a13a40ec3bb
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent ca060f4a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1922,10 +1922,17 @@ static int qpnp_lbc_get_irqs(struct qpnp_lbc_chip *chip, u8 subtype,
	return 0;
}

/* Get initial state of charger */
/* Get/Set initial state of charger */
static void determine_initial_status(struct qpnp_lbc_chip *chip)
{
	qpnp_lbc_usbin_valid_irq_handler(chip->irqs[USBIN_VALID].irq, chip);
	chip->usb_present = qpnp_lbc_is_usb_chg_plugged_in(chip);
	power_supply_set_present(chip->usb_psy, chip->usb_present);
	/*
	 * Set USB psy online to avoid userspace from shutting down if battery
	 * capacity is at zero and no chargers online.
	 */
	if (chip->usb_present)
		power_supply_set_online(chip->usb_psy, 1);
}

static int qpnp_lbc_probe(struct spmi_device *spmi)
@@ -2128,7 +2135,7 @@ static int qpnp_lbc_probe(struct spmi_device *spmi)
		goto unregister_batt;
	}

	/* Get charger's initial status */
	/* Get/Set charger's initial status */
	determine_initial_status(chip);

	rc = qpnp_lbc_request_irqs(chip);