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

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

Merge "ASoC: msm: q6dspv2: fix APR deregistration logic in ASM during ADSP SSR"

parents 25790feb 2defb8c2
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -514,19 +514,19 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
			mutex_unlock(&svc->m_lock);
			return NULL;
		}
		if (!svc->port_cnt && !svc->svc_cnt)
		if (!svc->svc_cnt)
			clnt->svc_cnt++;
		svc->port_cnt++;
		svc->port_fn[temp_port] = svc_fn;
		svc->port_priv[temp_port] = priv;
		svc->svc_cnt++;
	} else {
		if (!svc->fn) {
			if (!svc->port_cnt && !svc->svc_cnt)
			if (!svc->svc_cnt)
				clnt->svc_cnt++;
			svc->fn = svc_fn;
			if (svc->port_cnt)
				svc->svc_cnt++;
			svc->priv = priv;
			svc->svc_cnt++;
		}
	}

@@ -745,29 +745,28 @@ int apr_deregister(void *handle)
	if (!handle)
		return -EINVAL;

	if (!svc->svc_cnt) {
		pr_err("%s: svc already deregistered. svc = %pK\n",
			__func__, svc);
		return -EINVAL;
	}

	mutex_lock(&svc->m_lock);
	dest_id = svc->dest_id;
	client_id = svc->client_id;
	clnt = &client[dest_id][client_id];

	if (svc->port_cnt > 0 || svc->svc_cnt > 0) {
	if (svc->svc_cnt > 0) {
		if (svc->port_cnt)
			svc->port_cnt--;
		else if (svc->svc_cnt)
		svc->svc_cnt--;
		if (!svc->port_cnt && !svc->svc_cnt) {
		if (!svc->svc_cnt) {
			client[dest_id][client_id].svc_cnt--;
			svc->need_reset = 0x0;
		}
	} else if (client[dest_id][client_id].svc_cnt > 0) {
		client[dest_id][client_id].svc_cnt--;
		if (!client[dest_id][client_id].svc_cnt) {
			svc->need_reset = 0x0;
			pr_debug("%s: service is reset %pK\n", __func__, svc);
		}
	}

	if (!svc->port_cnt && !svc->svc_cnt) {
	if (!svc->svc_cnt) {
		svc->priv = NULL;
		svc->id = 0;
		svc->fn = NULL;
+11 −8
Original line number Diff line number Diff line
@@ -1031,12 +1031,14 @@ void q6asm_audio_client_free(struct audio_client *ac)
	}

	rtac_set_asm_handle(ac->session, NULL);
	if (!atomic_read(&ac->reset)) {
		apr_deregister(ac->apr2);
		apr_deregister(ac->apr);
		q6asm_mmap_apr_dereg();
		ac->apr2 = NULL;
		ac->apr = NULL;
		ac->mmap_apr = NULL;
	}
	q6asm_session_free(ac);

	pr_debug("%s: APR De-Register\n", __func__);
@@ -1507,7 +1509,6 @@ static int32_t q6asm_srvc_callback(struct apr_client_data *data, void *priv)
			}
			pr_debug("%s: Clearing custom topology\n", __func__);
		}
		this_mmap.apr = NULL;

		cal_utils_clear_cal_block_q6maps(ASM_MAX_CAL_TYPES, cal_data);
		common_client.mmap_apr = NULL;
@@ -1708,8 +1709,10 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
	if (data->opcode == RESET_EVENTS) {
		mutex_lock(&ac->cmd_lock);
		atomic_set(&ac->reset, 1);
		if (ac->apr == NULL)
		if (ac->apr == NULL) {
			ac->apr = ac->apr2;
			ac->apr2 = NULL;
		}
		pr_debug("%s: Reset event is received: %d %d apr[%pK]\n",
			__func__,
			data->reset_event, data->reset_proc, ac->apr);
+16 −14
Original line number Diff line number Diff line
@@ -398,6 +398,7 @@ bool q6core_is_adsp_ready(void)

	mutex_lock(&(q6core_lcl.cmd_lock));
	ocm_core_open();
	if (q6core_lcl.core_handle_q) {
		q6core_lcl.bus_bw_resp_received = 0;
		rc = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)&hdr);
		if (rc < 0) {
@@ -414,6 +415,7 @@ bool q6core_is_adsp_ready(void)
			rmb();
			ret = !!q6core_lcl.param;
		}
	}
bail:
	pr_debug("%s: leave, rc %d, adsp ready %d\n", __func__, rc, ret);
	mutex_unlock(&(q6core_lcl.cmd_lock));