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

Commit 9e15fd0a authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: Fix to release the IPA clock"

parents 8c14f76e 9989d567
Loading
Loading
Loading
Loading
+32 −19
Original line number Diff line number Diff line
@@ -1733,13 +1733,14 @@ static int ipa_mhi_wait_for_cons_release(void)
	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 res;

	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)
			continue;
		if (channels[i].state !=
@@ -1769,7 +1770,7 @@ static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *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 res;
@@ -1778,7 +1779,7 @@ static int ipa_mhi_stop_event_update_channels(
		return 0;

	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)
			continue;
		if (channels[i].state !=
@@ -1837,14 +1838,14 @@ static bool ipa_mhi_check_pending_packets_from_host(void)
}

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 res;
	struct ipa_mhi_channel_ctx *channel;

	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)
			continue;
		if (channels[i].state !=
@@ -1893,7 +1894,8 @@ static int ipa_mhi_suspend_ul(bool force, bool *empty, bool *force_clear)

	*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) {
		IPA_MHI_ERR("ipa_mhi_suspend_ul_channels failed %d\n", res);
		goto fail_suspend_ul_channel;
@@ -1954,7 +1956,7 @@ static int ipa_mhi_suspend_ul(bool force, bool *empty, bool *force_clear)
	}

	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) {
		IPA_MHI_ERR(
			"ipa_mhi_stop_event_update_ul_channels failed %d\n",
@@ -2075,7 +2077,8 @@ static int ipa_mhi_suspend_dl(bool force)
{
	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) {
		IPA_MHI_ERR(
			"ipa_mhi_suspend_channels for dl failed %d\n", res);
@@ -2083,7 +2086,8 @@ static int ipa_mhi_suspend_dl(bool force)
	}

	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) {
		IPA_MHI_ERR("failed to stop event update on DL %d\n", res);
		goto fail_stop_event_update_dl_channel;
@@ -2105,7 +2109,8 @@ static int ipa_mhi_suspend_dl(bool force)

fail_stop_event_update_dl_channel:
		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:
		return res;
}
@@ -2215,7 +2220,8 @@ int ipa_mhi_suspend(bool force)
fail_deactivate_pm:
	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
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 (
		ipa_mhi_disable_force_clear(ipa_mhi_client_ctx->qmi_req_id)) {
@@ -2226,7 +2232,8 @@ int ipa_mhi_suspend(bool force)
		ipa_mhi_client_ctx->qmi_req_id++;
	}
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);
	return res;
}
@@ -2261,7 +2268,8 @@ int ipa_mhi_resume(void)
	if (ipa_mhi_client_ctx->rm_cons_state == IPA_MHI_RM_STATE_REQUESTED) {
		/* resume all DL channels */
		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) {
			IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
				res);
@@ -2295,7 +2303,8 @@ int ipa_mhi_resume(void)

	/* resume all UL channels */
	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) {
		IPA_MHI_ERR("ipa_mhi_resume_ul_channels failed %d\n", res);
		goto fail_resume_ul_channels;
@@ -2303,7 +2312,8 @@ int ipa_mhi_resume(void)

	if (!dl_channel_resumed) {
		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) {
			IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
				res);
@@ -2324,9 +2334,11 @@ int ipa_mhi_resume(void)
	return 0;

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:
	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:
	if (!ipa_pm_is_used())
		ipa_mhi_release_prod();
@@ -2337,7 +2349,8 @@ int ipa_mhi_resume(void)
	if (ipa_pm_is_used())
		ipa_pm_deactivate_sync(ipa_mhi_client_ctx->pm_hdl);
fail_pm_activate:
	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:
	ipa_mhi_set_state(IPA_MHI_STATE_SUSPENDED);
	return res;
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -479,6 +479,7 @@ static void ipa3_uc_response_hdlr(enum ipa_irq_type interrupt,

		if (ipa3_ctx->uc_ctx.uc_loaded) {
			IPADBG("uC resp op INIT_COMPLETED is unexpected\n");
			IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
			return;
		}