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

Commit d80a3f91 authored by Lena Salman's avatar Lena Salman
Browse files

usb_bam: Fix producer request on resume



In certain scenario, where no consumer request the variable
'pipes_resumed' remain != 0, therefore on next suspend and resume
iteration, the producer request will be skipped.

CRs-Fixed: 548971
Change-Id: Ia2ec567f152153321c538e93899012c59ad28197
Signed-off-by: default avatarLena Salman <esalman@codeaurora.org>
Signed-off-by: default avatarIdo Shayevitz <idos@codeaurora.org>
parent 1502243d
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -898,7 +898,7 @@ static void usb_bam_finish_suspend(void)
			spin_unlock(&usb_bam_ipa_handshake_info_lock);
			pr_debug("%s: Suspending pipe\n", __func__);
			/* ACK on the last pipe */
			if (info[cur_bam].pipes_suspended * 2 + 1 ==
			if ((info[cur_bam].pipes_suspended + 1) * 2 ==
			    ctx.pipes_enabled_per_bam[cur_bam] &&
			    info[cur_bam].cur_cons_state ==
			    IPA_RM_RESOURCE_RELEASED) {
@@ -921,6 +921,7 @@ static void usb_bam_finish_suspend(void)
		}
	}
	info[cur_bam].pipes_to_suspend = 0;
	info[cur_bam].pipes_resumed = 0;
	spin_unlock(&usb_bam_ipa_handshake_info_lock);
	pr_debug("%s: Starting LPM on Bus Suspend\n", __func__);
	usb_bam_start_lpm(0);
@@ -1421,12 +1422,13 @@ static void usb_bam_finish_resume(struct work_struct *w)
	resume_suspended_pipes(cur_bam);

	if (info[cur_bam].pipes_resumed * 2 ==
	      ctx.pipes_enabled_per_bam[cur_bam] &&
	      info[cur_bam].cur_cons_state == IPA_RM_RESOURCE_GRANTED) {
	      ctx.pipes_enabled_per_bam[cur_bam]) {
		info[cur_bam].pipes_resumed = 0;
		if (info[cur_bam].cur_cons_state == IPA_RM_RESOURCE_GRANTED) {
			pr_debug("%s: Notify CONS_GRANTED\n", __func__);
			ipa_rm_notify_completion(IPA_RM_RESOURCE_GRANTED,
					 ipa_rm_resource_cons[cur_bam]);
		info[cur_bam].pipes_resumed = 0;
		}
	}
	spin_unlock(&usb_bam_ipa_handshake_info_lock);
	mutex_unlock(&info[cur_bam].suspend_resume_mutex);