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

Commit 78169a07 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: gadget: u_bam_data: Fix ordering of tethered disconnect notification



Current ordering is as below:
1. Call IPA tethered function related disconnect notify API
2. Perform USB and IPA BAM related pipe disconnect

Above step 1 deletes USB related depedency graph with IPA RM which
results into IPA is not pulling pending data from USB BAM producer pipe.
Due to this, data stall is observed and USB BAM driver is encountering
condition where it explicitly crashes device using panic().

Fix above order as below:
1. Perform USB and IPA BAM related pipe disconnect
2. Call IPA tethered function related disconnect notify API

With above ordering, USB related depedency graph is deleted after USB
BAM producer pipe is empty and disconnected successfully here.

Change-Id: Ib7e498a789008a44cc3f196064a9c2dda828bb1a
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent e47fdd15
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -787,11 +787,18 @@ static void bam2bam_data_disconnect_work(struct work_struct *w)
	*/
	spin_unlock_irqrestore(&port->port_lock, flags);

	bam_data_ipa_disconnect(d);
	ret = usb_bam_disconnect_ipa(d->usb_bam_type, &d->ipa_params);
	if (ret)
		pr_err("usb_bam_disconnect_ipa failed: err:%d\n", ret);

	/*
	 * NOTE: it is required to disconnect USB and IPA BAM related pipes
	 * before calling IPA tethered function related disconnect API. IPA
	 * tethered function related disconnect API delete depedency graph
	 * with IPA RM which would results into IPA not pulling data although
	 * there is pending data on USB BAM producer pipe.
	 */
	bam_data_ipa_disconnect(d);
	spin_lock_irqsave(&port->port_lock, flags);
	port->is_ipa_connected = false;