mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
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: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
parent
2139a7d178
commit
9e4d72554a
1 changed files with 17 additions and 5 deletions
|
|
@ -8541,19 +8541,24 @@ static int msm_dai_q6_tdm_set_channel_map(struct snd_soc_dai *dai,
|
|||
}
|
||||
|
||||
static unsigned int tdm_param_set_slot_mask(u16 *slot_offset, int slot_width,
|
||||
int slots_per_frame)
|
||||
int slots_per_frame)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
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,9 +8680,16 @@ 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;
|
||||
tdm->slot_mask = tdm_param_set_slot_mask(slot_mapping->offset,
|
||||
tdm_group->slot_width,
|
||||
tdm_group->nslots_per_frame);
|
||||
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);
|
||||
|
||||
pr_debug("%s: TDM:\n"
|
||||
"num_channels=%d sample_rate=%d bit_width=%d\n"
|
||||
|
|
|
|||
Loading…
Reference in a new issue