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

Commit b2a2d2d7 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3-msm: Fix some cleanup during remove



Fix some additional cleanup/uninitializations in the
dwc3_msm_remove() callback. These were found to be
left on when attempting to dynamically unbind the
driver from the device, and prevented the system from
entering system sleep/XO shutdown/VDD minimization:

- runtime PM state was not in suspended state, so the
  parent device's active child count is left nonzero and
  is unable to enter runtime suspend
- hs_phy_irq wakeup was still enabled and blocks system sleep
- UTMI clock was left enabled which prevented XO shutdown
- HS PHY's host mode flag was still set; when dwc3 child
  is removed it calls set_suspend(0) but HS PHY driver does
  not disable regulators in host mode. This prevents VDD
  minimization.

CRs-Fixed: 657154
Change-Id: Id4b3619a232c650f9b47e4c536be0b1256bd070f
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent c82bee2d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2873,6 +2873,7 @@ static int dwc3_msm_remove(struct platform_device *pdev)
	struct dwc3_msm	*mdwc = platform_get_drvdata(pdev);

	pm_runtime_disable(mdwc->dev);
	pm_runtime_set_suspended(mdwc->dev);
	device_wakeup_disable(mdwc->dev);

	if (mdwc->ext_chg_device) {
@@ -2890,6 +2891,8 @@ static int dwc3_msm_remove(struct platform_device *pdev)
		dwc3_start_chg_det(&mdwc->charger, false);
	if (mdwc->usb_psy.dev)
		power_supply_unregister(&mdwc->usb_psy);
	if (mdwc->hs_phy)
		mdwc->hs_phy->flags &= ~PHY_HOST_MODE;

	platform_device_put(mdwc->dwc3);
	device_for_each_child(&pdev->dev, NULL, dwc3_msm_remove_children);
@@ -2897,6 +2900,9 @@ static int dwc3_msm_remove(struct platform_device *pdev)
	if (!IS_ERR_OR_NULL(mdwc->vbus_otg))
		regulator_disable(mdwc->vbus_otg);

	disable_irq_wake(mdwc->hs_phy_irq);

	clk_disable_unprepare(mdwc->utmi_clk);
	clk_disable_unprepare(mdwc->core_clk);
	clk_disable_unprepare(mdwc->iface_clk);
	clk_disable_unprepare(mdwc->sleep_clk);