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

Commit 7570630b authored by Lena Salman's avatar Lena Salman
Browse files

usb_bam: Fix disconnect sequence for BAM2BAM_IPA mode



Due to confusing naming of functions in the disconnect
sequence, there was a decrement of the USB producer pipes
in the wrong place. Hence on USB disconnect case producer
pipe counter is decremented multiple times.
On next USB re-connect due to producer pipe counter not
being set to non-zero value, IPA resource manager API is not
called for requesting IPA producer resource which
causes a stall in USB tethered functionality. To fix this issue,
this change moves the decrement of USB producer pipe to API
where the USB producer pipe is actually released. Also add
proper comments to disconnect APIs to clear purpose of those
APIs.

Change-Id: I329788c61d4272579c0096c38cc1eeff94fa277c
Signed-off-by: default avatarLena Salman <esalman@codeaurora.org>
parent a0bba46a
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -927,6 +927,18 @@ static bool usb_bam_resume_core(enum usb_ctrl bam_type,
	}
}

/**
 * usb_bam_disconnect_ipa_prod() - disconnects the USB consumer i.e. IPA producer.
 * @ipa_params: USB IPA related parameters
 * @cur_bam: USB controller used for BAM functionality
 * @bam_mode: USB controller based BAM used in Device or Host Mode

 * It performs disconnect with IPA driver for IPA producer pipe and
 * with SPS driver for USB BAM consumer pipe. This API also takes care
 * of SYS2BAM and BAM2BAM IPA disconnect functionality.
 *
 * Return: 0 in case of success, errno otherwise.
 */
static int usb_bam_disconnect_ipa_prod(
		struct usb_bam_connect_ipa_params *ipa_params,
		enum usb_ctrl cur_bam, enum usb_bam_mode bam_mode)
@@ -994,11 +1006,21 @@ static int usb_bam_disconnect_ipa_prod(
			ctx.pipes_enabled_per_bam[pipe_connect->bam_type] -= 1;
		spin_unlock(&usb_bam_lock);
	}
	info[cur_bam].prod_pipes_enabled_per_bam -= 1;

	return 0;
}

/**
 * usb_bam_disconnect_ipa_cons() - disconnects the USB producer i.e. IPA consumer.
 * @ipa_params: USB IPA related parameters
 * @cur_bam: USB controller used for BAM functionality
 *
 * It performs disconnect with IPA driver for IPA consumer pipe and
 * with SPS driver for USB BAM producer pipe. This API also takes care
 * of SYS2BAM and BAM2BAM IPA disconnect functionality.
 *
 * Return: 0 in case of success, errno otherwise.
 */
static int usb_bam_disconnect_ipa_cons(
		struct usb_bam_connect_ipa_params *ipa_params,
		enum usb_ctrl cur_bam)
@@ -1074,6 +1096,7 @@ static int usb_bam_disconnect_ipa_cons(
	}

	pipe_connect->ipa_clnt_hdl = -1;
	info[cur_bam].prod_pipes_enabled_per_bam -= 1;

	return 0;
}