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

Commit 277ac926 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: Set power supply online status to false after cable disconnect"

parents 80e4bd1f 5868edf7
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -1425,6 +1425,16 @@ psy_error:
	return -ENXIO;
}

static void msm_otg_set_online_status(struct msm_otg *motg)
{
	if (!psy)
		dev_dbg(motg->phy.dev, "no usb power supply registered\n");

	/* Set power supply online status to false */
	if (power_supply_set_online(psy, false))
		dev_dbg(motg->phy.dev, "error setting power supply property\n");
}

static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA)
{
	struct usb_gadget *g = motg->phy.otg->gadget;
@@ -1444,6 +1454,13 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA)
			"Failed notifying %d charger type to PMIC\n",
							motg->chg_type);

	/*
	 * This condition will be true when usb cable is disconnected
	 * during bootup before charger detection mechanism starts.
	 */
	if (motg->online && motg->cur_power == 0 && mA == 0)
		msm_otg_set_online_status(motg);

	if (motg->cur_power == mA)
		return;