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

Commit 1c2af547 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: phy: Reset PHY while disabling dpdm regulator"

parents 44ff1374 1c02cc8e
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -1056,6 +1056,20 @@ static int qusb_phy_dpdm_regulator_disable(struct regulator_dev *rdev)
		if (!qphy->cable_connected)
			qusb_phy_clear_tcsr_clamp(qphy, false);

		/*
		 * Phy reset is needed in case multiple instances
		 * of HSPHY exists with shared power supplies. This
		 * reset is to bring out the PHY from high-Z state
		 * and avoid extra current consumption.
		 */
		ret = reset_control_assert(qphy->phy_reset);
		if (ret)
			dev_err(qphy->phy.dev, "phyassert failed\n");
		usleep_range(100, 150);
		ret = reset_control_deassert(qphy->phy_reset);
		if (ret)
			dev_err(qphy->phy.dev, "deassert failed\n");

		ret = qusb_phy_enable_power(qphy, false);
		if (ret < 0) {
			dev_dbg(qphy->phy.dev,
+8 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -647,6 +647,13 @@ static int msm_hsphy_dpdm_regulator_disable(struct regulator_dev *rdev)
	mutex_lock(&phy->phy_lock);
	if (phy->dpdm_enable) {
		if (!phy->cable_connected) {
			/*
			 * Phy reset is needed in case multiple instances
			 * of HSPHY exists with shared power supplies. This
			 * reset is to bring out the PHY from high-Z state
			 * and avoid extra current consumption.
			 */
			msm_hsphy_reset(phy);
			ret = msm_hsphy_enable_power(phy, false);
			if (ret < 0) {
				mutex_unlock(&phy->phy_lock);