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

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

Merge "usb: phy-msm-snps: Implement msm_hsphy_set_suspend API"

parents 8e880787 a45bd342
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -422,6 +422,28 @@ static int msm_hsphy_init(struct usb_phy *uphy)

static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
{
	struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);

	if (phy->suspended && suspend) {
		dev_dbg(uphy->dev, "%s: USB PHY is already suspended\n",
			__func__);
		return 0;
	}

	if (suspend) { /* Bus suspend */
		if (phy->cable_connected ||
			(phy->phy.flags & PHY_HOST_MODE)) {
			msm_hsphy_enable_clocks(phy, false);
		} else {/* Cable disconnect */
			msm_hsphy_enable_clocks(phy, false);
			msm_hsphy_enable_power(phy, false);
		}
		phy->suspended = true;
	} else { /* Bus resume and cable connect */
			msm_hsphy_enable_clocks(phy, true);
			phy->suspended = false;
		}

	return 0;
}