|
@@ -8144,6 +8144,9 @@ static int msm_dai_q6_tdm_set_tdm_slot(struct snd_soc_dai *dai,
|
|
|
case 16:
|
|
|
cap_mask = 0xFFFF;
|
|
|
break;
|
|
|
+ case 32:
|
|
|
+ cap_mask = 0xFFFFFFFF;
|
|
|
+ break;
|
|
|
default:
|
|
|
dev_err(dai->dev, "%s: invalid slots %d\n",
|
|
|
__func__, slots);
|
|
@@ -8293,6 +8296,8 @@ static int msm_dai_q6_tdm_set_channel_map(struct snd_soc_dai *dai,
|
|
|
dev_get_drvdata(dai->dev);
|
|
|
struct afe_param_id_slot_mapping_cfg *slot_mapping =
|
|
|
&dai_data->port_cfg.slot_mapping;
|
|
|
+ struct afe_param_id_slot_mapping_cfg_v2 *slot_mapping_v2 =
|
|
|
+ &dai_data->port_cfg.slot_mapping_v2;
|
|
|
int i = 0;
|
|
|
|
|
|
dev_dbg(dai->dev, "%s: dai id = 0x%x\n", __func__, dai->id);
|
|
@@ -8346,23 +8351,49 @@ static int msm_dai_q6_tdm_set_channel_map(struct snd_soc_dai *dai,
|
|
|
case AFE_PORT_ID_SENARY_TDM_RX_5:
|
|
|
case AFE_PORT_ID_SENARY_TDM_RX_6:
|
|
|
case AFE_PORT_ID_SENARY_TDM_RX_7:
|
|
|
- if (!rx_slot) {
|
|
|
- dev_err(dai->dev, "%s: rx slot not found\n", __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (rx_num > AFE_PORT_MAX_AUDIO_CHAN_CNT) {
|
|
|
- dev_err(dai->dev, "%s: invalid rx num %d\n", __func__,
|
|
|
- rx_num);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ if (q6core_get_avcs_api_version_per_service(
|
|
|
+ APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V3) {
|
|
|
+ if (!rx_slot) {
|
|
|
+ dev_err(dai->dev, "%s: rx slot not found\n",
|
|
|
+ __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+ if (rx_num > AFE_PORT_MAX_AUDIO_CHAN_CNT_V2) {
|
|
|
+ dev_err(dai->dev, "%s: invalid rx num %d\n",
|
|
|
+ __func__,
|
|
|
+ rx_num);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
|
|
|
- for (i = 0; i < rx_num; i++)
|
|
|
- slot_mapping->offset[i] = rx_slot[i];
|
|
|
- for (i = rx_num; i < AFE_PORT_MAX_AUDIO_CHAN_CNT; i++)
|
|
|
- slot_mapping->offset[i] =
|
|
|
- AFE_SLOT_MAPPING_OFFSET_INVALID;
|
|
|
+ for (i = 0; i < rx_num; i++)
|
|
|
+ slot_mapping_v2->offset[i] = rx_slot[i];
|
|
|
+ for (i = rx_num; i < AFE_PORT_MAX_AUDIO_CHAN_CNT_V2;
|
|
|
+ i++)
|
|
|
+ slot_mapping_v2->offset[i] =
|
|
|
+ AFE_SLOT_MAPPING_OFFSET_INVALID;
|
|
|
|
|
|
- slot_mapping->num_channel = rx_num;
|
|
|
+ slot_mapping_v2->num_channel = rx_num;
|
|
|
+ } else {
|
|
|
+ if (!rx_slot) {
|
|
|
+ dev_err(dai->dev, "%s: rx slot not found\n",
|
|
|
+ __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+ if (rx_num > AFE_PORT_MAX_AUDIO_CHAN_CNT) {
|
|
|
+ dev_err(dai->dev, "%s: invalid rx num %d\n",
|
|
|
+ __func__,
|
|
|
+ rx_num);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = 0; i < rx_num; i++)
|
|
|
+ slot_mapping->offset[i] = rx_slot[i];
|
|
|
+ for (i = rx_num; i < AFE_PORT_MAX_AUDIO_CHAN_CNT; i++)
|
|
|
+ slot_mapping->offset[i] =
|
|
|
+ AFE_SLOT_MAPPING_OFFSET_INVALID;
|
|
|
+
|
|
|
+ slot_mapping->num_channel = rx_num;
|
|
|
+ }
|
|
|
break;
|
|
|
case AFE_PORT_ID_PRIMARY_TDM_TX:
|
|
|
case AFE_PORT_ID_PRIMARY_TDM_TX_1:
|
|
@@ -8412,23 +8443,49 @@ static int msm_dai_q6_tdm_set_channel_map(struct snd_soc_dai *dai,
|
|
|
case AFE_PORT_ID_SENARY_TDM_TX_5:
|
|
|
case AFE_PORT_ID_SENARY_TDM_TX_6:
|
|
|
case AFE_PORT_ID_SENARY_TDM_TX_7:
|
|
|
- if (!tx_slot) {
|
|
|
- dev_err(dai->dev, "%s: tx slot not found\n", __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (tx_num > AFE_PORT_MAX_AUDIO_CHAN_CNT) {
|
|
|
- dev_err(dai->dev, "%s: invalid tx num %d\n", __func__,
|
|
|
- tx_num);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ if (q6core_get_avcs_api_version_per_service(
|
|
|
+ APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V3) {
|
|
|
+ if (!tx_slot) {
|
|
|
+ dev_err(dai->dev, "%s: tx slot not found\n",
|
|
|
+ __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+ if (tx_num > AFE_PORT_MAX_AUDIO_CHAN_CNT_V2) {
|
|
|
+ dev_err(dai->dev, "%s: invalid tx num %d\n",
|
|
|
+ __func__,
|
|
|
+ tx_num);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = 0; i < tx_num; i++)
|
|
|
+ slot_mapping_v2->offset[i] = tx_slot[i];
|
|
|
+ for (i = tx_num; i < AFE_PORT_MAX_AUDIO_CHAN_CNT_V2;
|
|
|
+ i++)
|
|
|
+ slot_mapping_v2->offset[i] =
|
|
|
+ AFE_SLOT_MAPPING_OFFSET_INVALID;
|
|
|
+
|
|
|
+ slot_mapping_v2->num_channel = tx_num;
|
|
|
+ } else {
|
|
|
+ if (!tx_slot) {
|
|
|
+ dev_err(dai->dev, "%s: tx slot not found\n",
|
|
|
+ __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+ if (tx_num > AFE_PORT_MAX_AUDIO_CHAN_CNT) {
|
|
|
+ dev_err(dai->dev, "%s: invalid tx num %d\n",
|
|
|
+ __func__,
|
|
|
+ tx_num);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
|
|
|
- for (i = 0; i < tx_num; i++)
|
|
|
- slot_mapping->offset[i] = tx_slot[i];
|
|
|
- for (i = tx_num; i < AFE_PORT_MAX_AUDIO_CHAN_CNT; i++)
|
|
|
- slot_mapping->offset[i] =
|
|
|
- AFE_SLOT_MAPPING_OFFSET_INVALID;
|
|
|
+ for (i = 0; i < tx_num; i++)
|
|
|
+ slot_mapping->offset[i] = tx_slot[i];
|
|
|
+ for (i = tx_num; i < AFE_PORT_MAX_AUDIO_CHAN_CNT; i++)
|
|
|
+ slot_mapping->offset[i] =
|
|
|
+ AFE_SLOT_MAPPING_OFFSET_INVALID;
|
|
|
|
|
|
- slot_mapping->num_channel = tx_num;
|
|
|
+ slot_mapping->num_channel = tx_num;
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
dev_err(dai->dev, "%s: invalid dai id 0x%x\n",
|
|
@@ -8452,6 +8509,8 @@ static int msm_dai_q6_tdm_hw_params(struct snd_pcm_substream *substream,
|
|
|
&dai_data->port_cfg.tdm;
|
|
|
struct afe_param_id_slot_mapping_cfg *slot_mapping =
|
|
|
&dai_data->port_cfg.slot_mapping;
|
|
|
+ struct afe_param_id_slot_mapping_cfg_v2 *slot_mapping_v2 =
|
|
|
+ &dai_data->port_cfg.slot_mapping_v2;
|
|
|
struct afe_param_id_custom_tdm_header_cfg *custom_tdm_header =
|
|
|
&dai_data->port_cfg.custom_tdm_header;
|
|
|
|
|
@@ -8459,7 +8518,7 @@ static int msm_dai_q6_tdm_hw_params(struct snd_pcm_substream *substream,
|
|
|
__func__, dev_name(dai->dev));
|
|
|
|
|
|
if ((params_channels(params) == 0) ||
|
|
|
- (params_channels(params) > 8)) {
|
|
|
+ (params_channels(params) > 32)) {
|
|
|
dev_err(dai->dev, "%s: invalid param channels %d\n",
|
|
|
__func__, params_channels(params));
|
|
|
return -EINVAL;
|
|
@@ -8561,32 +8620,88 @@ static int msm_dai_q6_tdm_hw_params(struct snd_pcm_substream *substream,
|
|
|
tdm->ctrl_data_out_enable,
|
|
|
tdm->ctrl_invert_sync_pulse,
|
|
|
tdm->ctrl_sync_data_delay);
|
|
|
+ if (q6core_get_avcs_api_version_per_service(
|
|
|
+ APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V3) {
|
|
|
+ /*
|
|
|
+ * update slot mapping v2 config param
|
|
|
+ * NOTE: channels/rate/bitwidth are per stream property
|
|
|
+ */
|
|
|
+ slot_mapping_v2->bitwidth = dai_data->bitwidth;
|
|
|
|
|
|
- /*
|
|
|
- * update slot mapping config param
|
|
|
- * NOTE: channels/rate/bitwidth are per stream property
|
|
|
- */
|
|
|
- slot_mapping->bitwidth = dai_data->bitwidth;
|
|
|
-
|
|
|
- pr_debug("%s: SLOT MAPPING:\n"
|
|
|
+ pr_debug("%s: SLOT MAPPING_V2:\n"
|
|
|
"num_channel=%d bitwidth=%d data_align=0x%x\n",
|
|
|
__func__,
|
|
|
- slot_mapping->num_channel,
|
|
|
- slot_mapping->bitwidth,
|
|
|
- slot_mapping->data_align_type);
|
|
|
- pr_debug("%s: SLOT MAPPING:\n"
|
|
|
+ slot_mapping_v2->num_channel,
|
|
|
+ slot_mapping_v2->bitwidth,
|
|
|
+ slot_mapping_v2->data_align_type);
|
|
|
+ pr_debug("%s: SLOT MAPPING V2:\n"
|
|
|
"offset[0]=0x%x offset[1]=0x%x offset[2]=0x%x offset[3]=0x%x\n"
|
|
|
- "offset[4]=0x%x offset[5]=0x%x offset[6]=0x%x offset[7]=0x%x\n",
|
|
|
+ "offset[4]=0x%x offset[5]=0x%x offset[6]=0x%x offset[7]=0x%x\n"
|
|
|
+ "offset[8]=0x%x offset[9]=0x%x offset[10]=0x%x offset[11]=0x%x\n"
|
|
|
+ "offset[12]=0x%x offset[13]=0x%x offset[14]=0x%x offset[15]=0x%x\n"
|
|
|
+ "offset[16]=0x%x offset[17]=0x%x offset[18]=0x%x offset[19]=0x%x\n"
|
|
|
+ "offset[20]=0x%x offset[21]=0x%x offset[22]=0x%x offset[23]=0x%x\n"
|
|
|
+ "offset[24]=0x%x offset[25]=0x%x offset[26]=0x%x offset[27]=0x%x\n"
|
|
|
+ "offset[28]=0x%x offset[29]=0x%x offset[30]=0x%x offset[31]=0x%x\n",
|
|
|
__func__,
|
|
|
- slot_mapping->offset[0],
|
|
|
- slot_mapping->offset[1],
|
|
|
- slot_mapping->offset[2],
|
|
|
- slot_mapping->offset[3],
|
|
|
- slot_mapping->offset[4],
|
|
|
- slot_mapping->offset[5],
|
|
|
- slot_mapping->offset[6],
|
|
|
- slot_mapping->offset[7]);
|
|
|
+ slot_mapping_v2->offset[0],
|
|
|
+ slot_mapping_v2->offset[1],
|
|
|
+ slot_mapping_v2->offset[2],
|
|
|
+ slot_mapping_v2->offset[3],
|
|
|
+ slot_mapping_v2->offset[4],
|
|
|
+ slot_mapping_v2->offset[5],
|
|
|
+ slot_mapping_v2->offset[6],
|
|
|
+ slot_mapping_v2->offset[7],
|
|
|
+ slot_mapping_v2->offset[8],
|
|
|
+ slot_mapping_v2->offset[9],
|
|
|
+ slot_mapping_v2->offset[10],
|
|
|
+ slot_mapping_v2->offset[11],
|
|
|
+ slot_mapping_v2->offset[12],
|
|
|
+ slot_mapping_v2->offset[13],
|
|
|
+ slot_mapping_v2->offset[14],
|
|
|
+ slot_mapping_v2->offset[15],
|
|
|
+ slot_mapping_v2->offset[16],
|
|
|
+ slot_mapping_v2->offset[17],
|
|
|
+ slot_mapping_v2->offset[18],
|
|
|
+ slot_mapping_v2->offset[19],
|
|
|
+ slot_mapping_v2->offset[20],
|
|
|
+ slot_mapping_v2->offset[21],
|
|
|
+ slot_mapping_v2->offset[22],
|
|
|
+ slot_mapping_v2->offset[23],
|
|
|
+ slot_mapping_v2->offset[24],
|
|
|
+ slot_mapping_v2->offset[25],
|
|
|
+ slot_mapping_v2->offset[26],
|
|
|
+ slot_mapping_v2->offset[27],
|
|
|
+ slot_mapping_v2->offset[28],
|
|
|
+ slot_mapping_v2->offset[29],
|
|
|
+ slot_mapping_v2->offset[30],
|
|
|
+ slot_mapping_v2->offset[31]);
|
|
|
+ } else {
|
|
|
+ /*
|
|
|
+ * update slot mapping config param
|
|
|
+ * NOTE: channels/rate/bitwidth are per stream property
|
|
|
+ */
|
|
|
+ slot_mapping->bitwidth = dai_data->bitwidth;
|
|
|
|
|
|
+ pr_debug("%s: SLOT MAPPING:\n"
|
|
|
+ "num_channel=%d bitwidth=%d data_align=0x%x\n",
|
|
|
+ __func__,
|
|
|
+ slot_mapping->num_channel,
|
|
|
+ slot_mapping->bitwidth,
|
|
|
+ slot_mapping->data_align_type);
|
|
|
+ pr_debug("%s: SLOT MAPPING:\n"
|
|
|
+ "offset[0]=0x%x offset[1]=0x%x offset[2]=0x%x offset[3]=0x%x\n"
|
|
|
+ "offset[4]=0x%x offset[5]=0x%x offset[6]=0x%x offset[7]=0x%x\n",
|
|
|
+ __func__,
|
|
|
+ slot_mapping->offset[0],
|
|
|
+ slot_mapping->offset[1],
|
|
|
+ slot_mapping->offset[2],
|
|
|
+ slot_mapping->offset[3],
|
|
|
+ slot_mapping->offset[4],
|
|
|
+ slot_mapping->offset[5],
|
|
|
+ slot_mapping->offset[6],
|
|
|
+ slot_mapping->offset[7]);
|
|
|
+ }
|
|
|
/*
|
|
|
* update custom header config param
|
|
|
* NOTE: channels/rate/bitwidth are per playback stream property.
|
|
@@ -10922,6 +11037,8 @@ static int msm_dai_q6_tdm_dev_probe(struct platform_device *pdev)
|
|
|
/* TDM SLOT MAPPING CFG -- set default */
|
|
|
dai_data->port_cfg.slot_mapping.minor_version =
|
|
|
AFE_API_VERSION_SLOT_MAPPING_CONFIG;
|
|
|
+ dai_data->port_cfg.slot_mapping_v2.minor_version =
|
|
|
+ AFE_API_VERSION_SLOT_MAPPING_CONFIG_V2;
|
|
|
|
|
|
/* CUSTOM TDM HEADER CFG */
|
|
|
custom_tdm_header = &dai_data->port_cfg.custom_tdm_header;
|