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

Commit 9e4d7255 authored by Karthikeyan Mani's avatar Karthikeyan Mani
Browse files

asoc: msm: Add support for updated tdm slot map cfg version



Slot map of tdm now has multiple versions and they need
to be supported to configure the afe parameters as
per the version used.

Change-Id: I63490e08afcf17444fd884e08f771a7dcf108c66
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent 2139a7d1
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -8547,13 +8547,18 @@ static unsigned int tdm_param_set_slot_mask(u16 *slot_offset, int slot_width,
	unsigned int slot_index = 0;
	unsigned long slot_mask = 0;
	unsigned int slot_width_bytes = slot_width / 8;
	unsigned int channel_count = AFE_PORT_MAX_AUDIO_CHAN_CNT;

	if (q6core_get_avcs_api_version_per_service(
		APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V3)
		channel_count = AFE_PORT_MAX_AUDIO_CHAN_CNT_V2;

	if (slot_width_bytes == 0) {
		pr_err("%s: slot width is zero\n", __func__);
		return slot_mask;
	}

	for (i = 0; i < AFE_PORT_MAX_AUDIO_CHAN_CNT; i++) {
	for (i = 0; i < channel_count; i++) {
		if (slot_offset[i] != AFE_SLOT_MAPPING_OFFSET_INVALID) {
			slot_index = slot_offset[i] / slot_width_bytes;
			if (slot_index < slots_per_frame)
@@ -8675,6 +8680,13 @@ static int msm_dai_q6_tdm_hw_params(struct snd_pcm_substream *substream,
	 */
	tdm->nslots_per_frame = tdm_group->nslots_per_frame;
	tdm->slot_width = tdm_group->slot_width;
	if (q6core_get_avcs_api_version_per_service(
		APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V3)
		tdm->slot_mask = tdm_param_set_slot_mask(
					slot_mapping_v2->offset,
					tdm_group->slot_width,
					tdm_group->nslots_per_frame);
	else
		tdm->slot_mask = tdm_param_set_slot_mask(slot_mapping->offset,
					tdm_group->slot_width,
					tdm_group->nslots_per_frame);