diff --git a/asoc/sa6155.c b/asoc/sa6155.c index 8b1df6610a..2e243e8577 100644 --- a/asoc/sa6155.c +++ b/asoc/sa6155.c @@ -208,7 +208,7 @@ static struct dev_config tdm_rx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = { {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */ }, { /* QUAT TDM */ - {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */ + {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 8}, /* RX_0 */ {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */ {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */ {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */ @@ -262,7 +262,7 @@ static struct dev_config tdm_tx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = { {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */ }, { /* QUAT TDM */ - {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */ + {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 16}, /* TX_0 */ {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */ {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */ {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */ @@ -353,7 +353,7 @@ static struct tdm_slot_cfg tdm_slot[TDM_INTERFACE_MAX] = { /* TERT TDM */ {32, 8}, /* QUAT TDM */ - {32, 8}, + {32, 16}, /* QUIN TDM */ {32, 8} }; @@ -398,7 +398,7 @@ static unsigned int tdm_rx_slot_offset {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ - {0xFFFF}, /* not used */ + {28, 0xFFFF}, }, {/* TERT TDM */ {0, 4, 8, 12, 16, 20, 0xFFFF}, @@ -418,13 +418,13 @@ static unsigned int tdm_rx_slot_offset {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ - {0xFFFF}, /* not used */ + {28,0xFFFF}, }, {/* QUIN TDM */ - {0, 4, 0xFFFF}, /* not used */ - {8, 12, 0xFFFF}, /* not used */ - {16, 20, 0xFFFF}, /* not used */ - {24, 28, 0xFFFF}, /* not used */ + {0, 4, 0xFFFF},/*STEREO SPKR1*/ + {8, 12, 0xFFFF},/*STEREO SPKR2*/ + {16, 20, 0xFFFF},/*STEREO SPKR3*/ + {24, 28, 0xFFFF},/*STEREO SPKR4*/ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ @@ -462,21 +462,21 @@ static unsigned int tdm_tx_slot_offset {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ - {0xFFFF}, /* not used */ + {28, 0xFFFF}, }, {/* QUAT TDM */ {0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 44, 48, 52, 56, 60, 0xFFFF},/*MIC ARR*/ - {0xFFFF}, /* not used */ + 32, 36, 40, 44, 48, 52, 56, 60, 0xFFFF},/*MIC ARR*/ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ + {60,0xFFFF}, }, {/* QUIN TDM */ - {0, 4, 8, 12, 16, 20, 0xFFFF}, /* not used */ + {0, 4, 8, 12, 16, 20, 0xFFFF},/*EC/ANC REF*/ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ @@ -488,6 +488,7 @@ static unsigned int tdm_tx_slot_offset }; /***************************************************************************** +* TO BE UPDATED: Codec/Platform specific tdm slot offset table * NOTE: * Each entry represents the slot offset array of one backend tdm device * valid offset represents the starting offset in byte for the channel @@ -513,7 +514,7 @@ static unsigned int tdm_rx_slot_offset_custom {10, 0xFFFF}, {12, 14, 16, 18, 20, 22, 24, 26, 0xFFFF}, {28, 30, 0xFFFF}, - {0xFFFF}, /* not used */ + {30, 0xFFFF}, }, {/* TERT TDM */ {0, 2, 0xFFFF}, @@ -533,7 +534,7 @@ static unsigned int tdm_rx_slot_offset_custom {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ - {0xFFFF}, /* not used */ + {0, 0xFFFF}, }, {/* QUIN TDM */ {0xFFFF}, /* not used */ @@ -577,7 +578,7 @@ static unsigned int tdm_tx_slot_offset_custom {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ - {0xFFFF}, /* not used */ + {30, 0xFFFF}, }, {/* QUAT TDM */ {0xFFFF}, /* not used */ @@ -587,7 +588,7 @@ static unsigned int tdm_tx_slot_offset_custom {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ {0xFFFF}, /* not used */ - {0xFFFF}, /* not used */ + {0, 0xFFFF}, }, {/* QUIN TDM */ {0xFFFF}, /* not used */ @@ -1405,7 +1406,7 @@ static int aux_pcm_get_sample_rate_val(int sample_rate) static int tdm_get_mode(struct snd_kcontrol *kcontrol) { - int mode = TDM_PRI; + int mode = -EINVAL; if (strnstr(kcontrol->id.name, "PRI", sizeof(kcontrol->id.name))) { @@ -1433,7 +1434,7 @@ static int tdm_get_mode(struct snd_kcontrol *kcontrol) static int tdm_get_channel(struct snd_kcontrol *kcontrol) { - int channel = TDM_0; + int channel = -EINVAL; if (strnstr(kcontrol->id.name, "RX_0", sizeof(kcontrol->id.name)) || @@ -1495,9 +1496,8 @@ static int tdm_get_port_idx(struct snd_kcontrol *kcontrol, port->channel = tdm_get_channel(kcontrol); if (port->channel < 0) return port->channel; - } else { + } else return -EINVAL; - } return 0; } @@ -4018,6 +4018,14 @@ static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, rate->min = rate->max = tdm_rx_cfg[TDM_SEC][TDM_3].sample_rate; break; + case AFE_PORT_ID_SECONDARY_TDM_RX_7: + channels->min = channels->max = + tdm_rx_cfg[TDM_SEC][TDM_7].channels; + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + tdm_rx_cfg[TDM_SEC][TDM_7].bit_format); + rate->min = rate->max = + tdm_rx_cfg[TDM_SEC][TDM_7].sample_rate; + break; case AFE_PORT_ID_SECONDARY_TDM_TX: channels->min = channels->max = tdm_tx_cfg[TDM_SEC][TDM_0].channels; @@ -4122,6 +4130,14 @@ static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, rate->min = rate->max = tdm_tx_cfg[TDM_TERT][TDM_3].sample_rate; break; + case AFE_PORT_ID_TERTIARY_TDM_TX_7: + channels->min = channels->max = + tdm_tx_cfg[TDM_TERT][TDM_7].channels; + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + tdm_tx_cfg[TDM_TERT][TDM_7].bit_format); + rate->min = rate->max = + tdm_tx_cfg[TDM_TERT][TDM_7].sample_rate; + break; case AFE_PORT_ID_QUATERNARY_TDM_RX: channels->min = channels->max = tdm_rx_cfg[TDM_QUAT][TDM_0].channels; @@ -4154,6 +4170,14 @@ static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, rate->min = rate->max = tdm_rx_cfg[TDM_QUAT][TDM_3].sample_rate; break; + case AFE_PORT_ID_QUATERNARY_TDM_RX_7: + channels->min = channels->max = + tdm_rx_cfg[TDM_QUAT][TDM_7].channels; + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + tdm_rx_cfg[TDM_QUAT][TDM_7].bit_format); + rate->min = rate->max = + tdm_rx_cfg[TDM_QUAT][TDM_7].sample_rate; + break; case AFE_PORT_ID_QUATERNARY_TDM_TX: channels->min = channels->max = tdm_tx_cfg[TDM_QUAT][TDM_0].channels; @@ -4186,6 +4210,14 @@ static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, rate->min = rate->max = tdm_tx_cfg[TDM_QUAT][TDM_3].sample_rate; break; + case AFE_PORT_ID_QUATERNARY_TDM_TX_7: + channels->min = channels->max = + tdm_tx_cfg[TDM_QUAT][TDM_7].channels; + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + tdm_tx_cfg[TDM_QUAT][TDM_7].bit_format); + rate->min = rate->max = + tdm_tx_cfg[TDM_QUAT][TDM_7].sample_rate; + break; case AFE_PORT_ID_QUINARY_TDM_RX: channels->min = channels->max = tdm_rx_cfg[TDM_QUIN][TDM_0].channels; @@ -4375,6 +4407,11 @@ static int sa6155_tdm_snd_hw_params(struct snd_pcm_substream *substream, slot_width = tdm_slot[TDM_SEC].width; slot_offset = tdm_rx_slot_offset[TDM_SEC][TDM_3]; break; + case AFE_PORT_ID_SECONDARY_TDM_RX_7: + slots = tdm_slot[TDM_SEC].num; + slot_width = tdm_slot[TDM_SEC].width; + slot_offset = tdm_rx_slot_offset[TDM_SEC][TDM_7]; + break; case AFE_PORT_ID_SECONDARY_TDM_TX: slots = tdm_slot[TDM_SEC].num; slot_width = tdm_slot[TDM_SEC].width; @@ -4440,6 +4477,11 @@ static int sa6155_tdm_snd_hw_params(struct snd_pcm_substream *substream, slot_width = tdm_slot[TDM_TERT].width; slot_offset = tdm_tx_slot_offset[TDM_TERT][TDM_3]; break; + case AFE_PORT_ID_TERTIARY_TDM_TX_7: + slots = tdm_slot[TDM_TERT].num; + slot_width = tdm_slot[TDM_TERT].width; + slot_offset = tdm_tx_slot_offset[TDM_TERT][TDM_7]; + break; case AFE_PORT_ID_QUATERNARY_TDM_RX: slots = tdm_slot[TDM_QUAT].num; slot_width = tdm_slot[TDM_QUAT].width; @@ -4460,6 +4502,11 @@ static int sa6155_tdm_snd_hw_params(struct snd_pcm_substream *substream, slot_width = tdm_slot[TDM_QUAT].width; slot_offset = tdm_rx_slot_offset[TDM_QUAT][TDM_3]; break; + case AFE_PORT_ID_QUATERNARY_TDM_RX_7: + slots = tdm_slot[TDM_QUAT].num; + slot_width = tdm_slot[TDM_QUAT].width; + slot_offset = tdm_rx_slot_offset[TDM_QUAT][TDM_7]; + break; case AFE_PORT_ID_QUATERNARY_TDM_TX: slots = tdm_slot[TDM_QUAT].num; slot_width = tdm_slot[TDM_QUAT].width; @@ -4480,6 +4527,11 @@ static int sa6155_tdm_snd_hw_params(struct snd_pcm_substream *substream, slot_width = tdm_slot[TDM_QUAT].width; slot_offset = tdm_tx_slot_offset[TDM_QUAT][TDM_3]; break; + case AFE_PORT_ID_QUATERNARY_TDM_TX_7: + slots = tdm_slot[TDM_QUAT].num; + slot_width = tdm_slot[TDM_QUAT].width; + slot_offset = tdm_tx_slot_offset[TDM_QUAT][TDM_7]; + break; case AFE_PORT_ID_QUINARY_TDM_RX: slots = tdm_slot[TDM_QUIN].num; slot_width = tdm_slot[TDM_QUIN].width; @@ -5564,7 +5616,67 @@ static struct snd_soc_dai_link msm_auto_fe_dai_links[] = { .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_DTMF_RX, - } + }, + { + .name = "Secondary TDM RX 7 Hostless", + .stream_name = "Secondary TDM RX 7 Hostless", + .cpu_dai_name = "SEC_TDM_RX_7_HOSTLESS", + .platform_name = "msm-pcm-hostless", + .dynamic = 1, + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + .codec_dai_name = "snd-soc-dummy-dai", + .codec_name = "snd-soc-dummy", + }, + { + .name = "Tertiary TDM TX 7 Hostless", + .stream_name = "Tertiary TDM TX 7 Hostless", + .cpu_dai_name = "TERT_TDM_TX_7_HOSTLESS", + .platform_name = "msm-pcm-hostless", + .dynamic = 1, + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + .codec_dai_name = "snd-soc-dummy-dai", + .codec_name = "snd-soc-dummy", + }, + { + .name = "Quaternary TDM RX 7 Hostless", + .stream_name = "Quaternary TDM RX 7 Hostless", + .cpu_dai_name = "QUAT_TDM_RX_7_HOSTLESS", + .platform_name = "msm-pcm-hostless", + .dynamic = 1, + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + .codec_dai_name = "snd-soc-dummy-dai", + .codec_name = "snd-soc-dummy", + }, + { + .name = "Quaternary TDM TX 7 Hostless", + .stream_name = "Quaternary TDM TX 7 Hostless", + .cpu_dai_name = "QUAT_TDM_TX_7_HOSTLESS", + .platform_name = "msm-pcm-hostless", + .dynamic = 1, + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + .codec_dai_name = "snd-soc-dummy-dai", + .codec_name = "snd-soc-dummy", + }, }; static struct snd_soc_dai_link msm_custom_fe_dai_links[] = { @@ -6146,6 +6258,20 @@ static struct snd_soc_dai_link msm_auto_be_dai_links[] = { .ops = &sa6155_tdm_be_ops, .ignore_suspend = 1, }, + { + .name = LPASS_BE_SEC_TDM_RX_7, + .stream_name = "Secondary TDM7 Playback", + .cpu_dai_name = "msm-dai-q6-tdm.36894", + .platform_name = "msm-pcm-routing", + .codec_name = "msm-stub-codec.1", + .codec_dai_name = "msm-stub-rx", + .no_pcm = 1, + .dpcm_playback = 1, + .id = MSM_BACKEND_DAI_SEC_TDM_RX_7, + .be_hw_params_fixup = msm_tdm_be_hw_params_fixup, + .ops = &sa6155_tdm_be_ops, + .ignore_suspend = 1, + }, { .name = LPASS_BE_SEC_TDM_TX_1, .stream_name = "Secondary TDM1 Capture", @@ -6286,6 +6412,20 @@ static struct snd_soc_dai_link msm_auto_be_dai_links[] = { .ops = &sa6155_tdm_be_ops, .ignore_suspend = 1, }, + { + .name = LPASS_BE_TERT_TDM_TX_7, + .stream_name = "Tertiary TDM7 Capture", + .cpu_dai_name = "msm-dai-q6-tdm.36911", + .platform_name = "msm-pcm-routing", + .codec_name = "msm-stub-codec.1", + .codec_dai_name = "msm-stub-rx", + .no_pcm = 1, + .dpcm_capture = 1, + .id = MSM_BACKEND_DAI_TERT_TDM_TX_7, + .be_hw_params_fixup = msm_tdm_be_hw_params_fixup, + .ops = &sa6155_tdm_be_ops, + .ignore_suspend = 1, + }, { .name = LPASS_BE_QUAT_TDM_RX_1, .stream_name = "Quaternary TDM1 Playback", @@ -6328,6 +6468,20 @@ static struct snd_soc_dai_link msm_auto_be_dai_links[] = { .ops = &sa6155_tdm_be_ops, .ignore_suspend = 1, }, + { + .name = LPASS_BE_QUAT_TDM_RX_7, + .stream_name = "Quaternary TDM7 Playback", + .cpu_dai_name = "msm-dai-q6-tdm.36926", + .platform_name = "msm-pcm-routing", + .codec_name = "msm-stub-codec.1", + .codec_dai_name = "msm-stub-rx", + .no_pcm = 1, + .dpcm_playback = 1, + .id = MSM_BACKEND_DAI_QUAT_TDM_RX_7, + .be_hw_params_fixup = msm_tdm_be_hw_params_fixup, + .ops = &sa6155_tdm_be_ops, + .ignore_suspend = 1, + }, { .name = LPASS_BE_QUAT_TDM_TX_1, .stream_name = "Quaternary TDM1 Capture", @@ -6370,6 +6524,20 @@ static struct snd_soc_dai_link msm_auto_be_dai_links[] = { .ops = &sa6155_tdm_be_ops, .ignore_suspend = 1, }, + { + .name = LPASS_BE_QUAT_TDM_TX_7, + .stream_name = "Quaternary TDM7 Capture", + .cpu_dai_name = "msm-dai-q6-tdm.36927", + .platform_name = "msm-pcm-routing", + .codec_name = "msm-stub-codec.1", + .codec_dai_name = "msm-stub-rx", + .no_pcm = 1, + .dpcm_capture = 1, + .id = MSM_BACKEND_DAI_QUAT_TDM_TX_7, + .be_hw_params_fixup = msm_tdm_be_hw_params_fixup, + .ops = &sa6155_tdm_be_ops, + .ignore_suspend = 1, + }, }; static struct snd_soc_dai_link ext_disp_be_dai_link[] = {