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

Commit 8e0d54cc authored by Pradnya Chaphekar's avatar Pradnya Chaphekar Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: Fix incorrect topology being used for adm close



Fix incorrect topology being used when closing adm. The util
function currently being used refers to the cal block to find
topology id, which may have incorrect topology id when
concurrencies are enabled. This results in undefined behavior
from dsp. Update the util function to fetch topology based on
port id and copp index instead.

CRs-Fixed: 744121
Change-Id: I1737bfc63f7fe23d9cdfee7e98ae78381cc941a7
Signed-off-by: default avatarPradnya Chaphekar <pradnyac@codeaurora.org>
parent 9dfd8ae8
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -984,16 +984,21 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
		if (msm_bedais[reg].active && fdai->strm_id !=
			INVALID_SESSION) {
			int idx;
			int port_id;
			unsigned long copp =
				session_copp_map[val][session_type][reg];
			for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++)
				if (test_bit(idx, &copp))
					break;
			topology = msm_routing_get_adm_topology(path_type, val);

			port_id = msm_bedais[reg].port_id;
			topology = adm_get_topology_for_port_copp_idx(port_id,
								      idx);
			adm_close(msm_bedais[reg].port_id, fdai->perf_mode,
				  idx);
			pr_debug("%s: copp: %ld, reset idx bit fe:%d, type: %d, be:%d\n",
				 __func__, copp, val, session_type, reg);
			pr_debug("%s: copp: %ld, reset idx bit fe:%d, type: %d, be:%d topology=0x%x\n",
				 __func__, copp, val, session_type, reg,
				 topology);
			clear_bit(idx,
				  &session_copp_map[val][session_type][reg]);
			if ((DOLBY_ADM_COPP_TOPOLOGY_ID == topology ||
@@ -5339,16 +5344,20 @@ static int msm_pcm_routing_close(struct snd_pcm_substream *substream)
		fdai = &fe_dai_map[i][session_type];
		if (fdai->strm_id != INVALID_SESSION) {
			int idx;
			int port_id;
			unsigned long copp =
				session_copp_map[i][session_type][be_id];
			for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++)
				if (test_bit(idx, &copp))
					break;
			fdai->be_srate = bedai->sample_rate;
			topology = msm_routing_get_adm_topology(path_type, i);
			port_id = bedai->port_id;
			topology = adm_get_topology_for_port_copp_idx(port_id,
								     idx);
			adm_close(bedai->port_id, fdai->perf_mode, idx);
			pr_debug("%s: copp:%ld,idx bit fe:%d, type:%d,be:%d\n",
				 __func__, copp, i, session_type, be_id);
			pr_debug("%s: copp:%ld,idx bit fe:%d, type:%d,be:%d topology=0x%x\n",
				 __func__, copp, i, session_type, be_id,
				 topology);
			clear_bit(idx,
				  &session_copp_map[i][session_type][be_id]);
			if ((fdai->perf_mode == LEGACY_PCM_MODE) &&