From e446b985ba7e9e41efdd3f30ae4dcfba1aa84c2c Mon Sep 17 00:00:00 2001 From: Manu Gautam Date: Mon, 21 Apr 2014 17:44:00 +0530 Subject: [PATCH] USB: phy-msm-usb: Disable VBUS OTG during REBOOT Some PMICs preserve OTG state across reboots. This can result in VBUS detection failure if target was rebooted in host mode. To fix this make sure that VBUS OTG is turned off during shutdown. With this PMIC boots up with OTG (or host) mode disabled and can correctly detect VBUS state after reboot. CRs-fixed: 650765 Change-Id: If68bb5351577ba1020d1e88077bb9ae85654733a Signed-off-by: Manu Gautam --- drivers/usb/phy/phy-msm-usb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 1637b099f7a..2f8443f591d 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -5091,6 +5091,14 @@ static int msm_otg_remove(struct platform_device *pdev) return 0; } +static void msm_otg_shutdown(struct platform_device *pdev) +{ + struct msm_otg *motg = platform_get_drvdata(pdev); + + dev_dbg(&pdev->dev, "OTG shutdown\n"); + msm_hsusb_vbus_power(motg, 0); +} + #ifdef CONFIG_PM_RUNTIME static int msm_otg_runtime_idle(struct device *dev) { @@ -5203,6 +5211,7 @@ static struct of_device_id msm_otg_dt_match[] = { static struct platform_driver msm_otg_driver = { .probe = msm_otg_probe, .remove = msm_otg_remove, + .shutdown = msm_otg_shutdown, .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE,