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

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

Merge "USB: msm_otg: Fix race between PM resume and charger detection"

parents f2f2c38e 1bc40bca
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
/* Copyright (c) 2009-2013, Linux Foundation. All rights reserved.
/* Copyright (c) 2009-2014, Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -2659,6 +2659,8 @@ static void msm_otg_sm_work(struct work_struct *w)
	bool work = 0, srp_reqd, dcp;
	bool work = 0, srp_reqd, dcp;


	pm_runtime_resume(otg->phy->dev);
	pm_runtime_resume(otg->phy->dev);
	if (motg->pm_done)
		pm_runtime_get_sync(otg->phy->dev);
	pr_debug("%s work\n", usb_otg_state_string(otg->phy->state));
	pr_debug("%s work\n", usb_otg_state_string(otg->phy->state));
	switch (otg->phy->state) {
	switch (otg->phy->state) {
	case OTG_STATE_UNDEFINED:
	case OTG_STATE_UNDEFINED:
@@ -2804,6 +2806,7 @@ static void msm_otg_sm_work(struct work_struct *w)
			 */
			 */
			pm_runtime_mark_last_busy(otg->phy->dev);
			pm_runtime_mark_last_busy(otg->phy->dev);
			pm_runtime_autosuspend(otg->phy->dev);
			pm_runtime_autosuspend(otg->phy->dev);
			motg->pm_done = 1;
		}
		}
		break;
		break;
	case OTG_STATE_B_SRP_INIT:
	case OTG_STATE_B_SRP_INIT:
@@ -5031,6 +5034,7 @@ static int msm_otg_runtime_resume(struct device *dev)


	dev_dbg(dev, "OTG runtime resume\n");
	dev_dbg(dev, "OTG runtime resume\n");
	pm_runtime_get_noresume(dev);
	pm_runtime_get_noresume(dev);
	motg->pm_done = 0;
	return msm_otg_resume(motg);
	return msm_otg_resume(motg);
}
}
#endif
#endif
@@ -5058,6 +5062,7 @@ static int msm_otg_pm_resume(struct device *dev)


	dev_dbg(dev, "OTG PM resume\n");
	dev_dbg(dev, "OTG PM resume\n");


	motg->pm_done = 0;
	atomic_set(&motg->pm_suspended, 0);
	atomic_set(&motg->pm_suspended, 0);
	if (motg->async_int || motg->sm_work_pending ||
	if (motg->async_int || motg->sm_work_pending ||
			!pm_runtime_suspended(dev)) {
			!pm_runtime_suspended(dev)) {
+3 −1
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@
 *
 *
 * Copyright (C) 2008 Google, Inc.
 * Copyright (C) 2008 Google, Inc.
 * Author: Brian Swetland <swetland@google.com>
 * Author: Brian Swetland <swetland@google.com>
 * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
 *
 *
 * This software is licensed under the terms of the GNU General Public
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * License version 2, as published by the Free Software Foundation, and
@@ -359,6 +359,7 @@ struct msm_otg_platform_data {
 * @chg_check_timer: The timer used to implement the workaround to detect
 * @chg_check_timer: The timer used to implement the workaround to detect
 *               very slow plug in of wall charger.
 *               very slow plug in of wall charger.
 * @ui_enabled: USB Intterupt is enabled or disabled.
 * @ui_enabled: USB Intterupt is enabled or disabled.
 * @pm_done: Indicates whether USB is PM resumed
 */
 */
struct msm_otg {
struct msm_otg {
	struct usb_phy phy;
	struct usb_phy phy;
@@ -478,6 +479,7 @@ struct msm_otg {
	bool ext_chg_active;
	bool ext_chg_active;
	struct completion ext_chg_wait;
	struct completion ext_chg_wait;
	int ui_enabled;
	int ui_enabled;
	bool pm_done;
};
};


struct ci13xxx_platform_data {
struct ci13xxx_platform_data {