From 6191f6b3a4689eaa560d8d41df651439fb98eb1e Mon Sep 17 00:00:00 2001 From: "choongryeol.lee" <choongryeol.lee@lge.com> Date: Wed, 10 Sep 2014 23:32:13 -0700 Subject: [PATCH] usb: phy-msm-usb: fix usb online prop setting failure When a usb removal is detected, the vbus power is set to 0mA and the online property is set to 0. If the requested power is same as a cur_power, the request is simply ignored. However, since the cur_power is initially 0, the request for 0mA could be ignored at booting. If the request for 0mA is ignored, the online property setting is also ignored. Fix this by setting cur_power to -EINVAL initially. Change-Id: I9dd1623be6fe463de200337e81bef5c496a40413 Signed-off-by: choongryeol.lee <choongryeol.lee@lge.com> --- drivers/usb/phy/phy-msm-usb.c | 3 ++- include/linux/usb/msm_hsusb.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 5783b002eb9a..73f496d5ba1a 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1415,7 +1415,7 @@ static int msm_otg_notify_power_supply(struct msm_otg *motg, unsigned mA) goto psy_error; if (power_supply_set_current_limit(psy, 1000*mA)) goto psy_error; - } else if (motg->cur_power > 0 && (mA == 0 || mA == 2)) { + } else if (mA == 0 || mA == 2) { /* Disable charging */ if (power_supply_set_online(psy, false)) goto psy_error; @@ -4841,6 +4841,7 @@ static int msm_otg_probe(struct platform_device *pdev) } motg->current_max = IDEV_CHG_MIN * 1000; + motg->cur_power = -EINVAL; motg->usb_psy.name = "usb"; motg->usb_psy.type = POWER_SUPPLY_TYPE_USB; diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 78a2ed4c05e9..f2eff72b8fe8 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -414,7 +414,7 @@ struct msm_otg { atomic_t in_lpm; atomic_t set_fpr_with_lpm_exit; int async_int; - unsigned cur_power; + int cur_power; struct delayed_work chg_work; struct delayed_work pmic_id_status_work; struct delayed_work suspend_work; -- GitLab