/* Copyright (c) 2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include #include #include #include #include #include #include "msm8952-slimbus.h" #include "qdsp6v2/msm-pcm-routing-v2.h" #include "../codecs/wcd9335.h" #define DEV_NAME_STR_LEN 32 static struct snd_soc_card snd_soc_card_msm[MAX_CODECS]; static struct snd_soc_card snd_soc_card_msm_card; static struct snd_soc_ops msm8952_quat_mi2s_be_ops = { .startup = msm_quat_mi2s_snd_startup, .hw_params = msm_mi2s_snd_hw_params, .shutdown = msm_quat_mi2s_snd_shutdown, }; static struct snd_soc_ops msm8952_quin_mi2s_be_ops = { .startup = msm_quin_mi2s_snd_startup, .hw_params = msm_mi2s_snd_hw_params, .shutdown = msm_quin_mi2s_snd_shutdown, }; static struct snd_soc_ops msm_pri_auxpcm_be_ops = { .startup = msm_prim_auxpcm_startup, .shutdown = msm_prim_auxpcm_shutdown, }; static struct snd_soc_ops msm8952_slimbus_be_ops = { .hw_params = msm_snd_hw_params, }; static struct snd_soc_ops msm8952_cpe_ops = { .hw_params = msm_snd_cpe_hw_params, }; static struct snd_soc_ops msm8952_slimbus_2_be_ops = { .hw_params = msm8952_slimbus_2_hw_params, }; static struct snd_soc_dai_link msm8952_tasha_fe_dai[] = { /* tasha_vifeedback for speaker protection */ { .name = LPASS_BE_SLIMBUS_4_TX, .stream_name = "Slimbus4 Capture", .cpu_dai_name = "msm-dai-q6-dev.16393", .platform_name = "msm-pcm-hostless", .codec_name = "tasha_codec", .codec_dai_name = "tasha_vifeedback", .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_slim_4_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_suspend = 1, }, /* Ultrasound RX DAI Link */ { .name = "SLIMBUS_2 Hostless Playback", .stream_name = "SLIMBUS_2 Hostless Playback", .cpu_dai_name = "msm-dai-q6-dev.16388", .platform_name = "msm-pcm-hostless", .codec_name = "tasha_codec", .codec_dai_name = "tasha_rx2", .ignore_suspend = 1, .dpcm_playback = 1, .dpcm_capture = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ops = &msm8952_slimbus_2_be_ops, }, /* Ultrasound TX DAI Link */ { .name = "SLIMBUS_2 Hostless Capture", .stream_name = "SLIMBUS_2 Hostless Capture", .cpu_dai_name = "msm-dai-q6-dev.16389", .platform_name = "msm-pcm-hostless", .codec_name = "tasha_codec", .codec_dai_name = "tasha_tx2", .ignore_suspend = 1, .dpcm_capture = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ops = &msm8952_slimbus_2_be_ops, }, /* CPE LSM direct dai-link */ { .name = "CPE Listen service", .stream_name = "CPE Listen Audio Service", .cpu_dai_name = "msm-dai-slim", .platform_name = "msm-cpe-lsm", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_suspend = 1, .dpcm_capture = 1, .ignore_pmdown_time = 1, .codec_dai_name = "tasha_mad1", .codec_name = "tasha_codec", .ops = &msm8952_cpe_ops, }, }; static struct snd_soc_dai_link msm8952_tasha_be_dai[] = { /* Backend DAI Links */ { .name = LPASS_BE_SLIMBUS_0_RX, .stream_name = "Slimbus Playback", .cpu_dai_name = "msm-dai-q6-dev.16384", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX, .init = &msm_audrx_init, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, /* this dainlink has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm8952_slimbus_be_ops, }, { .name = LPASS_BE_SLIMBUS_0_TX, .stream_name = "Slimbus Capture", .cpu_dai_name = "msm-dai-q6-dev.16385", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_tx1", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm8952_slimbus_be_ops, }, { .name = LPASS_BE_SLIMBUS_1_RX, .stream_name = "Slimbus1 Playback", .cpu_dai_name = "msm-dai-q6-dev.16386", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_1_RX, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_1_TX, .stream_name = "Slimbus1 Capture", .cpu_dai_name = "msm-dai-q6-dev.16387", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_tx3", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_slim_1_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_3_RX, .stream_name = "Slimbus3 Playback", .cpu_dai_name = "msm-dai-q6-dev.16390", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_3_RX, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_3_TX, .stream_name = "Slimbus3 Capture", .cpu_dai_name = "msm-dai-q6-dev.16391", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_tx1", .no_pcm = 1, .dpcm_capture = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_3_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_4_RX, .stream_name = "Slimbus4 Playback", .cpu_dai_name = "msm-dai-q6-dev.16392", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_5_RX, .stream_name = "Slimbus5 Playback", .cpu_dai_name = "msm-dai-q6-dev.16394", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_rx3", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_5_RX, .be_hw_params_fixup = msm_slim_5_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, /* MAD BE */ { .name = LPASS_BE_SLIMBUS_5_TX, .stream_name = "Slimbus5 Capture", .cpu_dai_name = "msm-dai-q6-dev.16395", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_mad1", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX, .be_hw_params_fixup = msm_slim_5_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .ignore_suspend = 1, }, }; static struct snd_soc_dai_link msm8952_tomtom_fe_dai[] = { { /* hw:x,28 */ .name = LPASS_BE_SLIMBUS_4_TX, .stream_name = "Slimbus4 Capture", .cpu_dai_name = "msm-dai-q6-dev.16393", .platform_name = "msm-pcm-hostless", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_vifeedback", .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_slim_4_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_suspend = 1, }, /* CPE LSM FE */ { /* hw:x,29 */ .name = "CPE Listen service", .stream_name = "CPE Listen Audio Service", .cpu_dai_name = "msm-dai-slim", .platform_name = "msm-cpe-lsm", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST }, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .dpcm_capture = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .codec_dai_name = "tomtom_mad1", .codec_name = "tomtom_codec", .ops = &msm8952_cpe_ops, }, }; static struct snd_soc_dai_link msm8952_tomtom_be_dai[] = { /* Backend DAI Links */ { .name = LPASS_BE_SLIMBUS_0_RX, .stream_name = "Slimbus Playback", .cpu_dai_name = "msm-dai-q6-dev.16384", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX, .init = &msm_audrx_init, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ignore_pmdown_time = 1, /* dai link has playback support */ .ignore_suspend = 1, .ops = &msm8952_slimbus_be_ops, }, { .name = LPASS_BE_SLIMBUS_0_TX, .stream_name = "Slimbus Capture", .cpu_dai_name = "msm-dai-q6-dev.16385", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_tx1", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm8952_slimbus_be_ops, }, { .name = LPASS_BE_SLIMBUS_1_RX, .stream_name = "Slimbus1 Playback", .cpu_dai_name = "msm-dai-q6-dev.16386", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_1_RX, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_1_TX, .stream_name = "Slimbus1 Capture", .cpu_dai_name = "msm-dai-q6-dev.16387", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_tx1", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_3_RX, .stream_name = "Slimbus3 Playback", .cpu_dai_name = "msm-dai-q6-dev.16390", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_3_RX, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_3_TX, .stream_name = "Slimbus3 Capture", .cpu_dai_name = "msm-dai-q6-dev.16391", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_tx1", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_3_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, .ignore_suspend = 1, }, { .name = LPASS_BE_SLIMBUS_4_RX, .stream_name = "Slimbus4 Playback", .cpu_dai_name = "msm-dai-q6-dev.16392", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_rx1", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX, .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, .ops = &msm8952_slimbus_be_ops, /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, /* MAD BE */ { .name = LPASS_BE_SLIMBUS_5_TX, .stream_name = "Slimbus5 Capture", .cpu_dai_name = "msm-dai-q6-dev.16395", .platform_name = "msm-pcm-routing", .codec_name = "tomtom_codec", .codec_dai_name = "tomtom_mad1", .no_pcm = 1, .dpcm_capture = 1, .async_ops = ASYNC_DPCM_SND_SOC_PREPARE, .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX, .be_hw_params_fixup = msm_slim_5_tx_be_hw_params_fixup, .ignore_suspend = 1, }, }; static struct snd_soc_dai_link msm8952_common_fe_dai[] = { /* FrontEnd DAI Links */ {/* hw:x,0 */ .name = "MSM8X16 Media1", .stream_name = "MultiMedia1", .cpu_dai_name = "MultiMedia1", .platform_name = "msm-pcm-dsp.0", .dynamic = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .dpcm_playback = 1, .dpcm_capture = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA1 }, {/* hw:x,1 */ .name = "MSM8X16 Media2", .stream_name = "MultiMedia2", .cpu_dai_name = "MultiMedia2", .platform_name = "msm-pcm-dsp.0", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA2, }, {/* hw:x,2 */ .name = "Circuit-Switch Voice", .stream_name = "CS-Voice", .cpu_dai_name = "CS-VOICE", .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_CS_VOICE, }, {/* hw:x,3 */ .name = "MSM VoIP", .stream_name = "VoIP", .cpu_dai_name = "VoIP", .platform_name = "msm-voip-dsp", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_VOIP, }, {/* hw:x,4 */ .name = "MSM8X16 ULL", .stream_name = "ULL", .cpu_dai_name = "MultiMedia3", .platform_name = "msm-pcm-dsp.2", .dynamic = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA3, }, /* Hostless PCM purpose */ {/* hw:x,5 */ .name = "SLIMBUS_0 Hostless", .stream_name = "SLIMBUS_0 Hostless", .cpu_dai_name = "SLIMBUS0_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* This dai link has MI2S support */ .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,6 */ .name = "INT_FM Hostless", .stream_name = "INT_FM Hostless", .cpu_dai_name = "INT_FM_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* this dai link has playback support */ .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,7 */ .name = "MSM AFE-PCM RX", .stream_name = "AFE-PROXY RX", .cpu_dai_name = "msm-dai-q6-dev.241", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .platform_name = "msm-pcm-afe", .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, }, {/* hw:x,8 */ .name = "MSM AFE-PCM TX", .stream_name = "AFE-PROXY TX", .cpu_dai_name = "msm-dai-q6-dev.240", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .platform_name = "msm-pcm-afe", .ignore_suspend = 1, }, {/* hw:x,9 */ .name = "MSM8X16 Compress1", .stream_name = "Compress1", .cpu_dai_name = "MultiMedia4", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA4, }, {/* hw:x,10 */ .name = "AUXPCM Hostless", .stream_name = "AUXPCM Hostless", .cpu_dai_name = "AUXPCM_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* this dai link has playback support */ .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,11 */ .name = "SLIMBUS_1 Hostless", .stream_name = "SLIMBUS_1 Hostless", .cpu_dai_name = "SLIMBUS1_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* dai link has playback support */ .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,12 */ .name = "MSM8952 LowLatency", .stream_name = "MultiMedia5", .cpu_dai_name = "MultiMedia5", .platform_name = "msm-pcm-dsp.1", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA5, }, {/* hw:x,13 */ .name = "Voice2", .stream_name = "Voice2", .cpu_dai_name = "Voice2", .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_capture = 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, /* this dai link has playback support */ .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .be_id = MSM_FRONTEND_DAI_VOICE2, }, {/* hw:x,14 */ .name = "MSM8952 Media9", .stream_name = "MultiMedia9", .cpu_dai_name = "MultiMedia9", .platform_name = "msm-pcm-dsp.0", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .ignore_suspend = 1, /* This dailink has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA9, }, { /* hw:x,15 */ .name = "VoLTE", .stream_name = "VoLTE", .cpu_dai_name = "VoLTE", .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_capture = 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, /* this dai link has playback support */ .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .be_id = MSM_FRONTEND_DAI_VOLTE, }, { /* hw:x,16 */ .name = "VoWLAN", .stream_name = "VoWLAN", .cpu_dai_name = "VoWLAN", .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_capture = 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", .be_id = MSM_FRONTEND_DAI_VOWLAN, }, {/* hw:x,17 */ .name = "INT_HFP_BT Hostless", .stream_name = "INT_HFP_BT Hostless", .cpu_dai_name = "INT_HFP_BT_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* this dai link has playback support */ .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,18 */ .name = "MSM8916 HFP", .stream_name = "MultiMedia6", .cpu_dai_name = "MultiMedia6", .platform_name = "msm-pcm-loopback", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .ignore_suspend = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA6, }, /* LSM FE */ {/* hw:x,19 */ .name = "Listen 1 Audio Service", .stream_name = "Listen 1 Audio Service", .cpu_dai_name = "LSM1", .platform_name = "msm-lsm-client", .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", .be_id = MSM_FRONTEND_DAI_LSM1, }, {/* hw:x,20 */ .name = "Listen 2 Audio Service", .stream_name = "Listen 2 Audio Service", .cpu_dai_name = "LSM2", .platform_name = "msm-lsm-client", .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", .be_id = MSM_FRONTEND_DAI_LSM2, }, {/* hw:x,21 */ .name = "Listen 3 Audio Service", .stream_name = "Listen 3 Audio Service", .cpu_dai_name = "LSM3", .platform_name = "msm-lsm-client", .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", .be_id = MSM_FRONTEND_DAI_LSM3, }, {/* hw:x,22 */ .name = "Listen 4 Audio Service", .stream_name = "Listen 4 Audio Service", .cpu_dai_name = "LSM4", .platform_name = "msm-lsm-client", .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", .be_id = MSM_FRONTEND_DAI_LSM4, }, {/* hw:x,23 */ .name = "Listen 5 Audio Service", .stream_name = "Listen 5 Audio Service", .cpu_dai_name = "LSM5", .platform_name = "msm-lsm-client", .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", .be_id = MSM_FRONTEND_DAI_LSM5, }, {/* hw:x,24 */ .name = "MSM8X16 Compress2", .stream_name = "Compress2", .cpu_dai_name = "MultiMedia7", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, .be_id = MSM_FRONTEND_DAI_MULTIMEDIA7, }, {/* hw:x,25 */ .name = "SLIMBUS_3 Hostless", .stream_name = "SLIMBUS_3 Hostless", .cpu_dai_name = "SLIMBUS3_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* dai link has playback support */ .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,26 */ .name = "SLIMBUS_4 Hostless", .stream_name = "SLIMBUS_4 Hostless", .cpu_dai_name = "SLIMBUS4_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* dai link has playback support */ .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, { /* hw:x,27 */ .name = "QUAT_MI2S Hostless", .stream_name = "QUAT_MI2S Hostless", .cpu_dai_name = "QUAT_MI2S_RX_HOSTLESS", .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_capture = 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, /* this dai link has playback support */ .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", }, {/* hw:x,28 */ .name = "MSM8X16 Compress3", .stream_name = "Compress3", .cpu_dai_name = "MultiMedia10", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA10, }, {/* hw:x,29 */ .name = "MSM8X16 Compress4", .stream_name = "Compress4", .cpu_dai_name = "MultiMedia11", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA11, }, {/* hw:x,30 */ .name = "MSM8X16 Compress5", .stream_name = "Compress5", .cpu_dai_name = "MultiMedia12", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA12, }, {/* hw:x,31 */ .name = "MSM8X16 Compress6", .stream_name = "Compress6", .cpu_dai_name = "MultiMedia13", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA13, }, {/* hw:x,32 */ .name = "MSM8X16 Compress7", .stream_name = "Compress7", .cpu_dai_name = "MultiMedia14", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA14, }, {/* hw:x,33 */ .name = "MSM8X16 Compress8", .stream_name = "Compress8", .cpu_dai_name = "MultiMedia15", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA15, }, {/* hw:x,34 */ .name = "MSM8X16 Compress9", .stream_name = "Compress9", .cpu_dai_name = "MultiMedia16", .platform_name = "msm-compress-dsp", .dynamic = 1, .dpcm_capture = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ .be_id = MSM_FRONTEND_DAI_MULTIMEDIA16, }, {/* hw:x,35 */ .name = "VoiceMMode1", .stream_name = "VoiceMMode1", .cpu_dai_name = "VoiceMMode1", .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_capture = 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", .be_id = MSM_FRONTEND_DAI_VOICEMMODE1, }, {/* hw:x,36 */ .name = "VoiceMMode2", .stream_name = "VoiceMMode2", .cpu_dai_name = "VoiceMMode2", .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_capture = 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", .be_id = MSM_FRONTEND_DAI_VOICEMMODE2, }, }; static struct snd_soc_dai_link msm8952_common_be_dai[] = { /* Backend I2S DAI Links */ { .name = LPASS_BE_QUAT_MI2S_RX, .stream_name = "Quaternary MI2S Playback", .cpu_dai_name = "msm-dai-q6-mi2s.3", .platform_name = "msm-pcm-routing", .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm8952_quat_mi2s_be_ops, .ignore_pmdown_time = 1, /* dai link has playback support */ .ignore_suspend = 1, }, /* Primary AUX PCM Backend DAI Links */ { .name = LPASS_BE_AUXPCM_RX, .stream_name = "AUX PCM Playback", .cpu_dai_name = "msm-dai-q6-auxpcm.1", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_AUXPCM_RX, .be_hw_params_fixup = msm_auxpcm_be_params_fixup, .ops = &msm_pri_auxpcm_be_ops, .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_AUXPCM_TX, .stream_name = "AUX PCM Capture", .cpu_dai_name = "msm-dai-q6-auxpcm.1", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_AUXPCM_TX, .be_hw_params_fixup = msm_auxpcm_be_params_fixup, .ops = &msm_pri_auxpcm_be_ops, .ignore_suspend = 1, }, { .name = LPASS_BE_QUAT_MI2S_TX, .stream_name = "Quaternary MI2S Capture", .cpu_dai_name = "msm-dai-q6-mi2s.3", .platform_name = "msm-pcm-routing", .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm8952_quat_mi2s_be_ops, .ignore_suspend = 1, }, { .name = LPASS_BE_INT_BT_SCO_RX, .stream_name = "Internal BT-SCO Playback", .cpu_dai_name = "msm-dai-q6-dev.12288", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_INT_BT_SCO_RX, .be_hw_params_fixup = msm_btsco_be_hw_params_fixup, /* this dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_INT_BT_SCO_TX, .stream_name = "Internal BT-SCO Capture", .cpu_dai_name = "msm-dai-q6-dev.12289", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_INT_BT_SCO_TX, .be_hw_params_fixup = msm_btsco_be_hw_params_fixup, .ignore_suspend = 1, }, { .name = LPASS_BE_INT_FM_RX, .stream_name = "Internal FM Playback", .cpu_dai_name = "msm-dai-q6-dev.12292", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_INT_FM_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, /* this dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_INT_FM_TX, .stream_name = "Internal FM Capture", .cpu_dai_name = "msm-dai-q6-dev.12293", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_INT_FM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, { .name = LPASS_BE_AFE_PCM_RX, .stream_name = "AFE Playback", .cpu_dai_name = "msm-dai-q6-dev.224", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_AFE_PCM_RX, .be_hw_params_fixup = msm_proxy_rx_be_hw_params_fixup, /* this dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, }, { .name = LPASS_BE_AFE_PCM_TX, .stream_name = "AFE Capture", .cpu_dai_name = "msm-dai-q6-dev.225", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_AFE_PCM_TX, .be_hw_params_fixup = msm_proxy_tx_be_hw_params_fixup, .ignore_suspend = 1, }, /* Incall Record Uplink BACK END DAI Link */ { .name = LPASS_BE_INCALL_RECORD_TX, .stream_name = "Voice Uplink Capture", .cpu_dai_name = "msm-dai-q6-dev.32772", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, /* Incall Record Downlink BACK END DAI Link */ { .name = LPASS_BE_INCALL_RECORD_RX, .stream_name = "Voice Downlink Capture", .cpu_dai_name = "msm-dai-q6-dev.32771", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, /* Incall Music BACK END DAI Link */ { .name = LPASS_BE_VOICE_PLAYBACK_TX, .stream_name = "Voice Farend Playback", .cpu_dai_name = "msm-dai-q6-dev.32773", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, /* Incall Music 2 BACK END DAI Link */ { .name = LPASS_BE_VOICE2_PLAYBACK_TX, .stream_name = "Voice2 Farend Playback", .cpu_dai_name = "msm-dai-q6-dev.32770", .platform_name = "msm-pcm-routing", .codec_name = "msm-stub-codec.1", .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, }; static struct snd_soc_dai_link msm8952_hdmi_dba_dai_link[] = { { .name = LPASS_BE_QUIN_MI2S_RX, .stream_name = "Quinary MI2S Playback", .cpu_dai_name = "msm-dai-q6-mi2s.5", .platform_name = "msm-pcm-routing", .codec_dai_name = "msm_hdmi_dba_codec_rx_dai", .codec_name = "msm-hdmi-dba-codec-rx", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_QUINARY_MI2S_RX, .be_hw_params_fixup = msm_quin_be_hw_params_fixup, .ops = &msm8952_quin_mi2s_be_ops, .ignore_pmdown_time = 1, /* dai link has playback support */ .ignore_suspend = 1, }, }; static struct snd_soc_dai_link msm8952_quin_dai_link[] = { { .name = LPASS_BE_QUIN_MI2S_RX, .stream_name = "Quinary MI2S Playback", .cpu_dai_name = "msm-dai-q6-mi2s.5", .platform_name = "msm-pcm-routing", .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", .no_pcm = 1, .dpcm_playback = 1, .be_id = MSM_BACKEND_DAI_QUINARY_MI2S_RX, .be_hw_params_fixup = msm_quin_be_hw_params_fixup, .ops = &msm8952_quin_mi2s_be_ops, .ignore_pmdown_time = 1, /* dai link has playback support */ .ignore_suspend = 1, }, }; struct msm895x_wsa881x_dev_info { struct device_node *of_node; u32 index; }; static struct snd_soc_aux_dev *msm895x_aux_dev; static struct snd_soc_codec_conf *msm895x_codec_conf; static struct snd_soc_dai_link msm8952_tomtom_dai_links[ ARRAY_SIZE(msm8952_common_fe_dai) + ARRAY_SIZE(msm8952_tomtom_fe_dai) + ARRAY_SIZE(msm8952_common_be_dai) + ARRAY_SIZE(msm8952_tomtom_be_dai) + ARRAY_SIZE(msm8952_quin_dai_link)]; static struct snd_soc_dai_link msm8952_tasha_dai_links[ ARRAY_SIZE(msm8952_common_fe_dai) + ARRAY_SIZE(msm8952_tasha_fe_dai) + ARRAY_SIZE(msm8952_common_be_dai) + ARRAY_SIZE(msm8952_tasha_be_dai) + ARRAY_SIZE(msm8952_hdmi_dba_dai_link)]; int msm8952_init_wsa_dev(struct platform_device *pdev, struct snd_soc_card *card) { struct device_node *wsa_of_node; u32 wsa_max_devs; u32 wsa_dev_cnt; char *dev_name_str = NULL; struct msm895x_wsa881x_dev_info *wsa881x_dev_info; const char *wsa_auxdev_name_prefix[1]; int found = 0; int i; int ret; /* Get maximum WSA device count for this platform */ ret = of_property_read_u32(pdev->dev.of_node, "qcom,wsa-max-devs", &wsa_max_devs); if (ret) { dev_dbg(&pdev->dev, "%s: wsa-max-devs property missing in DT %s, ret = %d\n", __func__, pdev->dev.of_node->full_name, ret); return 0; } if (wsa_max_devs == 0) { dev_warn(&pdev->dev, "%s: Max WSA devices is 0 for this target?\n", __func__); return 0; } /* Get count of WSA device phandles for this platform */ wsa_dev_cnt = of_count_phandle_with_args(pdev->dev.of_node, "qcom,wsa-devs", NULL); if (wsa_dev_cnt == -ENOENT) { dev_warn(&pdev->dev, "%s: No wsa device defined in DT.\n", __func__); return 0; } else if (wsa_dev_cnt <= 0) { dev_err(&pdev->dev, "%s: Error reading wsa device from DT. wsa_dev_cnt = %d\n", __func__, wsa_dev_cnt); return -EINVAL; } /* * Expect total phandles count to be NOT less than maximum possible * WSA count. However, if it is less, then assign same value to * max count as well. */ if (wsa_dev_cnt < wsa_max_devs) { dev_dbg(&pdev->dev, "%s: wsa_max_devs = %d cannot exceed wsa_dev_cnt = %d\n", __func__, wsa_max_devs, wsa_dev_cnt); wsa_max_devs = wsa_dev_cnt; } /* Make sure prefix string passed for each WSA device */ ret = of_property_count_strings(pdev->dev.of_node, "qcom,wsa-aux-dev-prefix"); if (ret != wsa_dev_cnt) { dev_err(&pdev->dev, "%s: expecting %d wsa prefix. Defined only %d in DT\n", __func__, wsa_dev_cnt, ret); return -EINVAL; } /* * Alloc mem to store phandle and index info of WSA device, if already * registered with ALSA core */ wsa881x_dev_info = devm_kcalloc(&pdev->dev, wsa_max_devs, sizeof(struct msm895x_wsa881x_dev_info), GFP_KERNEL); if (!wsa881x_dev_info) return -ENOMEM; /* * search and check whether all WSA devices are already * registered with ALSA core or not. If found a node, store * the node and the index in a local array of struct for later * use. */ for (i = 0; i < wsa_dev_cnt; i++) { wsa_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,wsa-devs", i); if (unlikely(!wsa_of_node)) { /* we should not be here */ dev_err(&pdev->dev, "%s: wsa dev node is not present\n", __func__); return -EINVAL; } if (soc_find_component(wsa_of_node, NULL)) { /* WSA device registered with ALSA core */ wsa881x_dev_info[found].of_node = wsa_of_node; wsa881x_dev_info[found].index = i; found++; if (found == wsa_max_devs) break; } } if (found < wsa_max_devs) { dev_dbg(&pdev->dev, "%s: failed to find %d components. Found only %d\n", __func__, wsa_max_devs, found); return -EPROBE_DEFER; } dev_info(&pdev->dev, "%s: found %d wsa881x devices registered with ALSA core\n", __func__, found); card->num_aux_devs = wsa_max_devs; card->num_configs = wsa_max_devs; /* Alloc array of AUX devs struct */ msm895x_aux_dev = devm_kcalloc(&pdev->dev, card->num_aux_devs, sizeof(struct snd_soc_aux_dev), GFP_KERNEL); if (!msm895x_aux_dev) return -ENOMEM; /* Alloc array of codec conf struct */ msm895x_codec_conf = devm_kcalloc(&pdev->dev, card->num_aux_devs, sizeof(struct snd_soc_codec_conf), GFP_KERNEL); if (!msm895x_codec_conf) return -ENOMEM; for (i = 0; i < card->num_aux_devs; i++) { dev_name_str = devm_kzalloc(&pdev->dev, DEV_NAME_STR_LEN, GFP_KERNEL); if (!dev_name_str) return -ENOMEM; ret = of_property_read_string_index(pdev->dev.of_node, "qcom,wsa-aux-dev-prefix", wsa881x_dev_info[i].index, wsa_auxdev_name_prefix); if (ret) { dev_err(&pdev->dev, "%s: failed to read wsa aux dev prefix, ret = %d\n", __func__, ret); return -EINVAL; } snprintf(dev_name_str, strlen("wsa881x.%d"), "wsa881x.%d", i); msm895x_aux_dev[i].name = dev_name_str; msm895x_aux_dev[i].codec_name = NULL; msm895x_aux_dev[i].codec_of_node = wsa881x_dev_info[i].of_node; msm895x_aux_dev[i].init = msm895x_wsa881x_init; msm895x_codec_conf[i].dev_name = NULL; msm895x_codec_conf[i].name_prefix = wsa_auxdev_name_prefix[0]; msm895x_codec_conf[i].of_node = wsa881x_dev_info[i].of_node; } card->codec_conf = msm895x_codec_conf; card->aux_dev = msm895x_aux_dev; return 0; } struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) { struct snd_soc_card *card = &snd_soc_card_msm_card; struct snd_soc_dai_link *msm8952_dai_links = NULL; int num_links, ret, len1, len2, len3, len4; enum codec_variant codec_ver = 0; const char *tasha_lite = "msm8952-tashalite-snd-card"; card->dev = dev; ret = snd_soc_of_parse_card_name(card, "qcom,model"); if (ret) { dev_err(dev, "%s: parse card name failed, err:%d\n", __func__, ret); return NULL; } if (!strcmp(card->name, "msm8952-tomtom-snd-card")) { len1 = ARRAY_SIZE(msm8952_common_fe_dai); len2 = len1 + ARRAY_SIZE(msm8952_tomtom_fe_dai); len3 = len2 + ARRAY_SIZE(msm8952_common_be_dai); snd_soc_card_msm[TOMTOM_CODEC].name = card->name; card = &snd_soc_card_msm[TOMTOM_CODEC]; num_links = ARRAY_SIZE(msm8952_tomtom_dai_links); memcpy(msm8952_tomtom_dai_links, msm8952_common_fe_dai, sizeof(msm8952_common_fe_dai)); memcpy(msm8952_tomtom_dai_links + len1, msm8952_tomtom_fe_dai, sizeof(msm8952_tomtom_fe_dai)); memcpy(msm8952_tomtom_dai_links + len2, msm8952_common_be_dai, sizeof(msm8952_common_be_dai)); memcpy(msm8952_tomtom_dai_links + len3, msm8952_tomtom_be_dai, sizeof(msm8952_tomtom_be_dai)); msm8952_dai_links = msm8952_tomtom_dai_links; } else if (strnstr(card->name, "tasha", strlen(card->name))) { codec_ver = tasha_codec_ver(); if (codec_ver == WCD9326) card->name = tasha_lite; len1 = ARRAY_SIZE(msm8952_common_fe_dai); len2 = len1 + ARRAY_SIZE(msm8952_tasha_fe_dai); len3 = len2 + ARRAY_SIZE(msm8952_common_be_dai); snd_soc_card_msm[TASHA_CODEC].name = card->name; card = &snd_soc_card_msm[TASHA_CODEC]; num_links = ARRAY_SIZE(msm8952_tasha_dai_links); memcpy(msm8952_tasha_dai_links, msm8952_common_fe_dai, sizeof(msm8952_common_fe_dai)); memcpy(msm8952_tasha_dai_links + len1, msm8952_tasha_fe_dai, sizeof(msm8952_tasha_fe_dai)); memcpy(msm8952_tasha_dai_links + len2, msm8952_common_be_dai, sizeof(msm8952_common_be_dai)); memcpy(msm8952_tasha_dai_links + len3, msm8952_tasha_be_dai, sizeof(msm8952_tasha_be_dai)); msm8952_dai_links = msm8952_tasha_dai_links; len4 = len3 + ARRAY_SIZE(msm8952_tasha_be_dai); } if (of_property_read_bool(dev->of_node, "qcom,hdmi-dba-codec-rx")) { dev_dbg(dev, "%s(): hdmi dba audio support present\n", __func__); memcpy(msm8952_dai_links + len4, msm8952_hdmi_dba_dai_link, sizeof(msm8952_hdmi_dba_dai_link)); len4 += ARRAY_SIZE(msm8952_hdmi_dba_dai_link); } else { dev_dbg(dev, "%s(): No hdmi dba present, add quin dai\n", __func__); memcpy(msm8952_dai_links + len4, msm8952_quin_dai_link, sizeof(msm8952_quin_dai_link)); len4 += ARRAY_SIZE(msm8952_quin_dai_link); } card->dai_link = msm8952_dai_links; card->num_links = len4; card->dev = dev; return card; } void msm895x_free_auxdev_mem(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev); int i; if (card->num_aux_devs > 0) { for (i = 0; i < card->num_aux_devs; i++) { kfree(msm895x_aux_dev[i].codec_name); kfree(msm895x_codec_conf[i].dev_name); kfree(msm895x_codec_conf[i].name_prefix); } } }