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

Commit b2120c9d authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Saket Saurabh
Browse files

USB: Fix bug in ext_chg_active flag handling



The ext_chg_active flag is set to true when the external charger
processing is pending. It is set to true when DCP is detected and
set to false when the user space notifies that it is done with
the charger detection. The user space may unblock the low power mode
any time to access the hardware to request a new voltage setting.
The current code does not set ext_chg_active flag in this case due to
which USB enters low power mode while external charger processing
is pending. This results in unclocked register access.
Fix the issue by setting ext_chg_active to true every time the
userspace calls the block LPM.

CRs-Fixed: 663301
Change-Id: If18f762d7fc0b4eaba297e27bbd7382b161fbcde
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarSaket Saurabh <ssaurabh@codeaurora.org>
parent 7e02cedd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2662,12 +2662,15 @@ static void msm_otg_wait_for_ext_chg_done(struct msm_otg *motg)

	if (motg->ext_chg_active) {

do_wait:
		pr_debug("before msm_otg ext chg wait\n");

		t = wait_for_completion_timeout(&motg->ext_chg_wait,
				msecs_to_jiffies(3000));
		if (!t)
			pr_err("msm_otg ext chg wait timeout\n");
		else if (motg->ext_chg_active)
			goto do_wait;
		else
			pr_debug("msm_otg ext chg wait done\n");
	}
@@ -4212,6 +4215,7 @@ msm_otg_ext_chg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
		pr_debug("%s: LPM block request %d\n", __func__, val);
		if (val) { /* block LPM */
			if (motg->chg_type == USB_DCP_CHARGER) {
				motg->ext_chg_active = true;
				/*
				 * If device is already suspended, resume it.
				 * The PM usage counter is incremented in