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

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

Merge "ipa3: fix suspend sequence for MHI ADPL pipe"

parents 338206de 96f6ec68
Loading
Loading
Loading
Loading
+32 −19
Original line number Original line Diff line number Diff line
@@ -1743,13 +1743,14 @@ static int ipa_mhi_wait_for_cons_release(void)
	return 0;
	return 0;
}
}


static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *channels)
static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *channels,
	int max_channels)
{
{
	int i;
	int i;
	int res;
	int res;


	IPA_MHI_FUNC_ENTRY();
	IPA_MHI_FUNC_ENTRY();
	for (i = 0; i < IPA_MHI_MAX_UL_CHANNELS; i++) {
	for (i = 0; i < max_channels; i++) {
		if (!channels[i].valid)
		if (!channels[i].valid)
			continue;
			continue;
		if (channels[i].state !=
		if (channels[i].state !=
@@ -1779,7 +1780,7 @@ static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *channels)
}
}


static int ipa_mhi_stop_event_update_channels(
static int ipa_mhi_stop_event_update_channels(
		struct ipa_mhi_channel_ctx *channels)
		struct ipa_mhi_channel_ctx *channels, int max_channels)
{
{
	int i;
	int i;
	int res;
	int res;
@@ -1788,7 +1789,7 @@ static int ipa_mhi_stop_event_update_channels(
		return 0;
		return 0;


	IPA_MHI_FUNC_ENTRY();
	IPA_MHI_FUNC_ENTRY();
	for (i = 0; i < IPA_MHI_MAX_UL_CHANNELS; i++) {
	for (i = 0; i < max_channels; i++) {
		if (!channels[i].valid)
		if (!channels[i].valid)
			continue;
			continue;
		if (channels[i].state !=
		if (channels[i].state !=
@@ -1847,14 +1848,14 @@ static bool ipa_mhi_check_pending_packets_from_host(void)
}
}


static int ipa_mhi_resume_channels(bool LPTransitionRejected,
static int ipa_mhi_resume_channels(bool LPTransitionRejected,
		struct ipa_mhi_channel_ctx *channels)
		struct ipa_mhi_channel_ctx *channels, int max_channels)
{
{
	int i;
	int i;
	int res;
	int res;
	struct ipa_mhi_channel_ctx *channel;
	struct ipa_mhi_channel_ctx *channel;


	IPA_MHI_FUNC_ENTRY();
	IPA_MHI_FUNC_ENTRY();
	for (i = 0; i < IPA_MHI_MAX_UL_CHANNELS; i++) {
	for (i = 0; i < max_channels; i++) {
		if (!channels[i].valid)
		if (!channels[i].valid)
			continue;
			continue;
		if (channels[i].state !=
		if (channels[i].state !=
@@ -1903,7 +1904,8 @@ static int ipa_mhi_suspend_ul(bool force, bool *empty, bool *force_clear)


	*force_clear = false;
	*force_clear = false;


	res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels);
	res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels,
		IPA_MHI_MAX_UL_CHANNELS);
	if (res) {
	if (res) {
		IPA_MHI_ERR("ipa_mhi_suspend_ul_channels failed %d\n", res);
		IPA_MHI_ERR("ipa_mhi_suspend_ul_channels failed %d\n", res);
		goto fail_suspend_ul_channel;
		goto fail_suspend_ul_channel;
@@ -1964,7 +1966,7 @@ static int ipa_mhi_suspend_ul(bool force, bool *empty, bool *force_clear)
	}
	}


	res = ipa_mhi_stop_event_update_channels(
	res = ipa_mhi_stop_event_update_channels(
		ipa_mhi_client_ctx->ul_channels);
		ipa_mhi_client_ctx->ul_channels, IPA_MHI_MAX_UL_CHANNELS);
	if (res) {
	if (res) {
		IPA_MHI_ERR(
		IPA_MHI_ERR(
			"ipa_mhi_stop_event_update_ul_channels failed %d\n",
			"ipa_mhi_stop_event_update_ul_channels failed %d\n",
@@ -2080,7 +2082,8 @@ static int ipa_mhi_suspend_dl(bool force)
{
{
	int res;
	int res;


	res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels);
	res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels,
		IPA_MHI_MAX_DL_CHANNELS);
	if (res) {
	if (res) {
		IPA_MHI_ERR(
		IPA_MHI_ERR(
			"ipa_mhi_suspend_channels for dl failed %d\n", res);
			"ipa_mhi_suspend_channels for dl failed %d\n", res);
@@ -2088,7 +2091,8 @@ static int ipa_mhi_suspend_dl(bool force)
	}
	}


	res = ipa_mhi_stop_event_update_channels
	res = ipa_mhi_stop_event_update_channels
			(ipa_mhi_client_ctx->dl_channels);
			(ipa_mhi_client_ctx->dl_channels,
			IPA_MHI_MAX_DL_CHANNELS);
	if (res) {
	if (res) {
		IPA_MHI_ERR("failed to stop event update on DL %d\n", res);
		IPA_MHI_ERR("failed to stop event update on DL %d\n", res);
		goto fail_stop_event_update_dl_channel;
		goto fail_stop_event_update_dl_channel;
@@ -2113,7 +2117,8 @@ static int ipa_mhi_suspend_dl(bool force)


fail_stop_event_update_dl_channel:
fail_stop_event_update_dl_channel:
		ipa_mhi_resume_channels(true,
		ipa_mhi_resume_channels(true,
				ipa_mhi_client_ctx->dl_channels);
				ipa_mhi_client_ctx->dl_channels,
				IPA_MHI_MAX_DL_CHANNELS);
fail_suspend_dl_channel:
fail_suspend_dl_channel:
		return res;
		return res;
}
}
@@ -2226,7 +2231,8 @@ int ipa_mhi_suspend(bool force)
#endif
#endif
	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
fail_suspend_ul_channel:
fail_suspend_ul_channel:
	ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->ul_channels);
	ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->ul_channels,
		IPA_MHI_MAX_UL_CHANNELS);
	if (force_clear) {
	if (force_clear) {
		if (
		if (
		ipa_mhi_disable_force_clear(ipa_mhi_client_ctx->qmi_req_id)) {
		ipa_mhi_disable_force_clear(ipa_mhi_client_ctx->qmi_req_id)) {
@@ -2237,7 +2243,8 @@ int ipa_mhi_suspend(bool force)
		ipa_mhi_client_ctx->qmi_req_id++;
		ipa_mhi_client_ctx->qmi_req_id++;
	}
	}
fail_suspend_dl_channel:
fail_suspend_dl_channel:
	ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->dl_channels);
	ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->dl_channels,
		IPA_MHI_MAX_DL_CHANNELS);
	ipa_mhi_set_state(IPA_MHI_STATE_STARTED);
	ipa_mhi_set_state(IPA_MHI_STATE_STARTED);
	return res;
	return res;
}
}
@@ -2272,7 +2279,8 @@ int ipa_mhi_resume(void)
	if (ipa_mhi_client_ctx->rm_cons_state == IPA_MHI_RM_STATE_REQUESTED) {
	if (ipa_mhi_client_ctx->rm_cons_state == IPA_MHI_RM_STATE_REQUESTED) {
		/* resume all DL channels */
		/* resume all DL channels */
		res = ipa_mhi_resume_channels(false,
		res = ipa_mhi_resume_channels(false,
				ipa_mhi_client_ctx->dl_channels);
				ipa_mhi_client_ctx->dl_channels,
				IPA_MHI_MAX_DL_CHANNELS);
		if (res) {
		if (res) {
			IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
			IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
				res);
				res);
@@ -2310,7 +2318,8 @@ int ipa_mhi_resume(void)


	/* resume all UL channels */
	/* resume all UL channels */
	res = ipa_mhi_resume_channels(false,
	res = ipa_mhi_resume_channels(false,
					ipa_mhi_client_ctx->ul_channels);
					ipa_mhi_client_ctx->ul_channels,
					IPA_MHI_MAX_UL_CHANNELS);
	if (res) {
	if (res) {
		IPA_MHI_ERR("ipa_mhi_resume_ul_channels failed %d\n", res);
		IPA_MHI_ERR("ipa_mhi_resume_ul_channels failed %d\n", res);
		goto fail_resume_ul_channels;
		goto fail_resume_ul_channels;
@@ -2318,7 +2327,8 @@ int ipa_mhi_resume(void)


	if (!dl_channel_resumed) {
	if (!dl_channel_resumed) {
		res = ipa_mhi_resume_channels(false,
		res = ipa_mhi_resume_channels(false,
					ipa_mhi_client_ctx->dl_channels);
					ipa_mhi_client_ctx->dl_channels,
					IPA_MHI_MAX_DL_CHANNELS);
		if (res) {
		if (res) {
			IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
			IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
				res);
				res);
@@ -2339,9 +2349,11 @@ int ipa_mhi_resume(void)
	return 0;
	return 0;


fail_set_state:
fail_set_state:
	ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels);
	ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels,
		IPA_MHI_MAX_DL_CHANNELS);
fail_resume_dl_channels2:
fail_resume_dl_channels2:
	ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels);
	ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels,
		IPA_MHI_MAX_UL_CHANNELS);
fail_resume_ul_channels:
fail_resume_ul_channels:
	if (!ipa_pm_is_used())
	if (!ipa_pm_is_used())
		ipa_mhi_release_prod();
		ipa_mhi_release_prod();
@@ -2354,7 +2366,8 @@ int ipa_mhi_resume(void)
		ipa_pm_deactivate_sync(ipa_mhi_client_ctx->pm_hdl);
		ipa_pm_deactivate_sync(ipa_mhi_client_ctx->pm_hdl);
fail_pm_activate:
fail_pm_activate:
#endif
#endif
	ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels);
	ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels,
		IPA_MHI_MAX_DL_CHANNELS);
fail_resume_dl_channels:
fail_resume_dl_channels:
	ipa_mhi_set_state(IPA_MHI_STATE_SUSPENDED);
	ipa_mhi_set_state(IPA_MHI_STATE_SUSPENDED);
	return res;
	return res;