From 3aa09a8758704f310c22e2f48d0f9590c2c788a6 Mon Sep 17 00:00:00 2001 From: Lakshman Chaluvaraju Date: Fri, 5 Nov 2021 19:15:16 +0530 Subject: [PATCH 01/19] ASoC: bitra: Add support for VI sense backend Add changes for VI sense WSA_CDC_DMA_TX_0 as backend dailink to support recording of VI sense data. Change-Id: I6f0911c9a2b5b20ce3b4f099f93ad3fed3cff886 Signed-off-by: Lakshman Chaluvaraju --- asoc/kona.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/asoc/kona.c b/asoc/kona.c index 67deb67b15c7..2286f288ed4f 100644 --- a/asoc/kona.c +++ b/asoc/kona.c @@ -6841,6 +6841,17 @@ static struct snd_soc_dai_link msm_wsa_cdc_dma_be_dai_links[] = { .ops = &msm_cdc_dma_be_ops, SND_SOC_DAILINK_REG(wsa_dma_tx1), }, + { + .name = LPASS_BE_WSA_CDC_DMA_TX_0_VI, + .stream_name = "WSA CDC DMA0 Capture", + .no_pcm = 1, + .dpcm_capture = 1, + .id = MSM_BACKEND_DAI_WSA_CDC_DMA_TX_0, + .be_hw_params_fixup = msm_be_hw_params_fixup, + .ignore_suspend = 1, + .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(wsa_dma_tx0_vi), + }, }; static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = { From 5e85dafc9cfcc95bcc8e33c696fffaaf3a026850 Mon Sep 17 00:00:00 2001 From: Hongtao Peng Date: Tue, 15 Feb 2022 21:14:13 +0800 Subject: [PATCH 02/19] ASoC: msm: extend app type cfg mixer command with copp mode ADM can be opened with different perf mode with ASM Change-Id: I22c50ae57c1e1f9ee9a0b080a20bde5b4f50d06c Signed-off-by: Hongtao Peng --- asoc/msm-pcm-loopback-v2.c | 27 ++++++++++------ asoc/msm-pcm-q6-v2.c | 27 ++++++++++------ asoc/msm-pcm-routing-v2.c | 64 +++++++++++++++++++++++++++++--------- asoc/msm-pcm-routing-v2.h | 4 +++ 4 files changed, 88 insertions(+), 34 deletions(-) mode change 100755 => 100644 asoc/msm-pcm-routing-v2.c diff --git a/asoc/msm-pcm-loopback-v2.c b/asoc/msm-pcm-loopback-v2.c index 2492f75e45a9..8bb38cb7a6a5 100644 --- a/asoc/msm-pcm-loopback-v2.c +++ b/asoc/msm-pcm-loopback-v2.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -683,7 +684,7 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; - struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0}; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; @@ -694,10 +695,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, cfg_data.copp_token = ucontrol->value.integer.value[4]; if (ucontrol->value.integer.value[5] != 0) cfg_data.bit_width = ucontrol->value.integer.value[5]; + if (ucontrol->value.integer.value[6] != 0) + cfg_data.copp_perf_mode = ucontrol->value.integer.value[6]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, - cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width); + cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) @@ -730,11 +733,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[3] = be_id; ucontrol->value.integer.value[4] = cfg_data.copp_token; ucontrol->value.integer.value[5] = cfg_data.bit_width; + ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, - cfg_data.copp_token, cfg_data.bit_width); + cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); done: return ret; @@ -746,7 +750,7 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; - struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0}; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; @@ -757,10 +761,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, cfg_data.copp_token = ucontrol->value.integer.value[4]; if (ucontrol->value.integer.value[5] != 0) cfg_data.bit_width = ucontrol->value.integer.value[5]; + if (ucontrol->value.integer.value[6] != 0) + cfg_data.copp_perf_mode = ucontrol->value.integer.value[6]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, - cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width); + cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) @@ -793,11 +799,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[3] = be_id; ucontrol->value.integer.value[4] = cfg_data.copp_token; ucontrol->value.integer.value[5] = cfg_data.bit_width; + ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, - cfg_data.copp_token, cfg_data.bit_width); + cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); done: return ret; } diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c index 31dcfc5027fa..b084c0081f1e 100644 --- a/asoc/msm-pcm-q6-v2.c +++ b/asoc/msm-pcm-q6-v2.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ @@ -2091,7 +2092,7 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; - struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0}; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; @@ -2102,10 +2103,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, cfg_data.copp_token = ucontrol->value.integer.value[4]; if (ucontrol->value.integer.value[5] != 0) cfg_data.bit_width = ucontrol->value.integer.value[5]; + if (ucontrol->value.integer.value[6] != 0) + cfg_data.copp_perf_mode = ucontrol->value.integer.value[6]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, - cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width); + cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) @@ -2138,10 +2141,11 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[3] = be_id; ucontrol->value.integer.value[4] = cfg_data.copp_token; ucontrol->value.integer.value[5] = cfg_data.bit_width; + ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, - cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width); + cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); done: return ret; } @@ -2152,7 +2156,7 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; - struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0}; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; @@ -2163,10 +2167,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, cfg_data.copp_token = ucontrol->value.integer.value[4]; if (ucontrol->value.integer.value[5] != 0) cfg_data.bit_width = ucontrol->value.integer.value[5]; + if (ucontrol->value.integer.value[6] != 0) + cfg_data.copp_perf_mode = ucontrol->value.integer.value[6]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, - cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width); + cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) @@ -2199,10 +2205,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[3] = be_id; ucontrol->value.integer.value[4] = cfg_data.copp_token; ucontrol->value.integer.value[5] = cfg_data.bit_width; + ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d" - "sample_rate- %d copp_token- %d bit_width- %d\n", + "sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, - cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width); + cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode); done: return ret; } diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c old mode 100755 new mode 100644 index f2a9ba603fe8..5b7fc20a08e4 --- a/asoc/msm-pcm-routing-v2.c +++ b/asoc/msm-pcm-routing-v2.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -1283,6 +1284,30 @@ static bool is_mm_lsm_fe_id(int fe_id) return rc; } +static int get_copp_perf_mode(int fe_id, int sess_type, int port) +{ + int fdai_mode, copp_perf_mode, flag, value; + int rc = 0; + + if ((fe_id < 0) || (fe_id >= MSM_FRONTEND_DAI_MAX) || + (port < 0) || (port >= MSM_BACKEND_DAI_MAX) || + (sess_type != SESSION_TYPE_RX && sess_type != SESSION_TYPE_TX)) { + pr_err("%s: Input out of bounds\n", __func__); + return rc; + } + fdai_mode = fe_dai_map[fe_id][sess_type].perf_mode; + copp_perf_mode = fe_dai_app_type_cfg[fe_id][sess_type][port].copp_perf_mode; + flag = (copp_perf_mode & PP_PERF_MODE_FLAG_MASK); + value = (copp_perf_mode & PP_PERF_MODE_VALUE_MASK); + rc = fdai_mode; + if ((flag != 0) && (value >= LEGACY_PCM_MODE) && + (value <= ULL_POST_PROCESSING_PCM_MODE)) { + rc = value; + } + pr_debug("%s: Get copp_perf_mode = %d", __func__, rc); + return rc; +} + /* * msm_pcm_routing_send_chmix_cfg: * send the channel mixer command to mix the input channels @@ -1476,11 +1501,11 @@ int msm_pcm_routing_reg_stream_app_type_cfg( } pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d," - "sample_rate %d, copp_token %d, bit_width %d\n", + "sample_rate %d, copp_token %d, bit_width %d, copp_perf_mode %d\n", __func__, fedai_id, session_type, be_id, cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->sample_rate, cfg_data->copp_token, - cfg_data->bit_width); + cfg_data->bit_width, cfg_data->copp_perf_mode); if (!is_mm_lsm_fe_id(fedai_id)) { pr_err("%s: Invalid machine driver ID %d\n", @@ -1564,11 +1589,11 @@ int msm_pcm_routing_get_stream_app_type_cfg( *bedai_id = be_id; *cfg_data = fe_dai_app_type_cfg[fedai_id][session_type][be_id]; pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d," - "sample_rate %d, copp_token %d, bit_width %d\n", + "sample_rate %d, copp_token %d, bit_width %d, copp_perf_mode %d\n", __func__, fedai_id, session_type, *bedai_id, cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->sample_rate, cfg_data->copp_token, - cfg_data->bit_width); + cfg_data->bit_width, cfg_data->copp_perf_mode); done: return ret; } @@ -1906,6 +1931,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, u16 bit_width = 16, be_bit_width; bool is_lsm; uint32_t copp_token = 0; + int copp_perf_mode = 0; pr_debug("%s:fe_id[%d] perf_mode[%d] id[%d] stream_type[%d] passt[%d]", __func__, fe_id, perf_mode, dspst_id, @@ -1999,6 +2025,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, } acdb_dev_id = fe_dai_app_type_cfg[fe_id][session_type][i].acdb_dev_id; + copp_perf_mode = get_copp_perf_mode(fe_id, session_type, i); topology = msm_routing_get_adm_topology(fe_id, session_type, i); @@ -2020,7 +2047,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, SNDRV_PCM_FORMAT_S32_LE); copp_idx = adm_open(port_id, path_type, sample_rate, - channels, topology, perf_mode, + channels, topology, copp_perf_mode, bit_width, app_type, acdb_dev_id, session_type, passthr_mode, copp_token); if ((copp_idx < 0) || @@ -2308,6 +2335,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, uint32_t passthr_mode = LEGACY_PCM; int ret = 0; uint32_t copp_token = 0; + int copp_perf_mode = 0; if (fedai_id >= MSM_FRONTEND_DAI_MM_MAX_ID) { /* bad ID assigned in machine driver */ @@ -2380,7 +2408,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, i); be_bit_width = msm_routing_get_bit_width( msm_bedais[i].format); - + copp_perf_mode = get_copp_perf_mode(fedai_id, session_type, i); if (hifi_filter_enabled && (msm_bedais[i].sample_rate == 384000 ||msm_bedais[i].sample_rate == 352800) && be_bit_width == 32) @@ -2403,7 +2431,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, copp_idx = adm_open_v2(port_id, path_type, sample_rate, channels, topology, - perf_mode, bits_per_sample, + copp_perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode, copp_token, @@ -2414,7 +2442,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, } else copp_idx = adm_open(port_id, path_type, sample_rate, channels, topology, - perf_mode, bits_per_sample, + copp_perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode, copp_token); if ((copp_idx < 0) || @@ -2495,6 +2523,7 @@ void msm_pcm_routing_dereg_phy_stream(int fedai_id, int stream_type) { int i, port_type, session_type, path_type, topology, port_id; struct msm_pcm_routing_fdai_data *fdai; + int copp_perf_mode; if (!is_mm_lsm_fe_id(fedai_id)) { /* bad ID assigned in machine driver */ @@ -2536,7 +2565,8 @@ void msm_pcm_routing_dereg_phy_stream(int fedai_id, int stream_type) topology = adm_get_topology_for_port_copp_idx( port_id, idx); msm_routing_unload_topology(topology); - adm_close(port_id, fdai->perf_mode, idx); + copp_perf_mode = get_copp_perf_mode(fedai_id, session_type, i); + adm_close(port_id, copp_perf_mode, idx); pr_debug("%s:copp:%ld,idx bit fe:%d,type:%d,be:%d\n", __func__, copp, fedai_id, session_type, i); clear_bit(idx, @@ -2580,6 +2610,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) uint32_t passthr_mode; bool is_lsm; uint32_t copp_token = 0; + int copp_perf_mode = 0; pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set); @@ -2694,6 +2725,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) be_bit_width = msm_routing_get_bit_width( msm_bedais[reg].format); + copp_perf_mode = get_copp_perf_mode(val, session_type, reg); if (hifi_filter_enabled && (msm_bedais[reg].sample_rate == 384000 ||msm_bedais[reg].sample_rate == 352800) && be_bit_width == 32) @@ -2701,7 +2733,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) SNDRV_PCM_FORMAT_S32_LE); copp_idx = adm_open(port_id, path_type, sample_rate, channels, topology, - fdai->perf_mode, bits_per_sample, + copp_perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode, copp_token); if ((copp_idx < 0) || @@ -2762,7 +2794,8 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) topology = adm_get_topology_for_port_copp_idx(port_id, idx); msm_routing_unload_topology(topology); - adm_close(port_id, fdai->perf_mode, idx); + copp_perf_mode = get_copp_perf_mode(val, session_type, reg); + adm_close(port_id, copp_perf_mode, idx); pr_debug("%s: copp: %ld, reset idx bit fe:%d, type: %d, be:%d topology=0x%x\n", __func__, copp, val, session_type, reg, topology); @@ -41329,6 +41362,7 @@ static int msm_pcm_routing_close(struct snd_pcm_substream *substream) int i, session_type, path_type, topology; struct msm_pcm_routing_bdai_data *bedai; struct msm_pcm_routing_fdai_data *fdai; + int copp_perf_mode; pr_debug("%s: substream->pcm->id:%s\n", __func__, substream->pcm->id); @@ -41370,7 +41404,8 @@ static int msm_pcm_routing_close(struct snd_pcm_substream *substream) topology = adm_get_topology_for_port_copp_idx(port_id, idx); msm_routing_unload_topology(topology); - adm_close(port_id, fdai->perf_mode, idx); + copp_perf_mode = get_copp_perf_mode(i, session_type, be_id); + adm_close(port_id, copp_perf_mode, idx); pr_debug("%s: copp:%ld,idx bit fe:%d, type:%d,be:%d topology=0x%x\n", __func__, copp, i, session_type, be_id, topology); @@ -41405,6 +41440,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) struct media_format_info voc_be_media_format; bool is_lsm; uint32_t copp_token = 0; + int copp_perf_mode = 0; pr_debug("%s: substream->pcm->id:%s\n", __func__, substream->pcm->id); @@ -41515,7 +41551,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) be_bit_width = msm_routing_get_bit_width( bedai->format); - + copp_perf_mode = get_copp_perf_mode(i, session_type, be_id); if (hifi_filter_enabled && (bedai->sample_rate == 384000 || bedai->sample_rate == 352800) && be_bit_width == 32) @@ -41523,7 +41559,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) SNDRV_PCM_FORMAT_S32_LE); copp_idx = adm_open(port_id, path_type, sample_rate, channels, topology, - fdai->perf_mode, bits_per_sample, + copp_perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, fdai->passthr_mode, copp_token); if ((copp_idx < 0) || diff --git a/asoc/msm-pcm-routing-v2.h b/asoc/msm-pcm-routing-v2.h index 63ff45f58df6..4a8e4b6eda58 100644 --- a/asoc/msm-pcm-routing-v2.h +++ b/asoc/msm-pcm-routing-v2.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef _MSM_PCM_ROUTING_H #define _MSM_PCM_ROUTING_H @@ -688,6 +689,8 @@ enum { #define STREAM_TYPE_ASM 0 #define STREAM_TYPE_LSM 1 +#define PP_PERF_MODE_FLAG_MASK 0x10000 +#define PP_PERF_MODE_VALUE_MASK 0xF enum { ADM_TOPOLOGY_CAL_TYPE_IDX = 0, ADM_LSM_TOPOLOGY_CAL_TYPE_IDX, @@ -743,6 +746,7 @@ struct msm_pcm_stream_app_type_cfg { int sample_rate; uint32_t copp_token; int bit_width; + int copp_perf_mode; }; /* dai_id: front-end ID, From 2b934435f68606040d627c553a15dd6d84c5e1aa Mon Sep 17 00:00:00 2001 From: Hugh Guan Date: Thu, 6 Jan 2022 12:52:02 -0800 Subject: [PATCH 03/19] asoc: refine dummy machine driver for gen3 Enable all LPAIF for gen3 dummy machine driver. Change-Id: I4e1f128e8f4283fa2ffbce981115201d8d50e38b Signed-off-by: Hugh Guan --- asoc/gvm_auto_spf_dummy.c | 164 ++++++++++++++++++++++++++++---------- asoc/msm_dailink.h | 112 +++++++++++++------------- 2 files changed, 178 insertions(+), 98 deletions(-) diff --git a/asoc/gvm_auto_spf_dummy.c b/asoc/gvm_auto_spf_dummy.c index e081007b221c..93bd664ae14c 100755 --- a/asoc/gvm_auto_spf_dummy.c +++ b/asoc/gvm_auto_spf_dummy.c @@ -218,26 +218,6 @@ static const struct snd_soc_dapm_widget msm_dapm_widgets[] = { /* Digital audio interface glue - connects codec <---> CPU */ static struct snd_soc_dai_link msm_common_dai_links[] = { /* BackEnd DAI Links */ - { - .name = "TERT_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF-RX-TERTIARY", - .dpcm_playback = 1, - .trigger = {SND_SOC_DPCM_TRIGGER_POST, - SND_SOC_DPCM_TRIGGER_POST}, - .ignore_suspend = 1, - .ignore_pmdown_time = 1, - SND_SOC_DAILINK_REG(tert_tdm_rx_0_dummy), - }, - { - .name = "TERT_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF-TX-TERTIARY", - .dpcm_capture = 1, - .trigger = {SND_SOC_DPCM_TRIGGER_POST, - SND_SOC_DPCM_TRIGGER_POST}, - .ignore_suspend = 1, - .ignore_pmdown_time = 1, - SND_SOC_DAILINK_REG(tert_tdm_tx_0_dummy), - }, { .name = "LPASS_BE_AUXPCM_RX_DUMMY", .stream_name = "AUXPCM-LPAIF-RX-PRIMARY", @@ -258,6 +238,46 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_pmdown_time = 1, SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy), }, + { + .name = "SEC_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF-RX-SECONDARY", + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(secondary_tdm_rx_0_dummy), + }, + { + .name = "SEC_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF-TX-SECONDARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(secondary_tdm_tx_0_dummy), + }, + { + .name = "TERT_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF-RX-TERTIARY", + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(tert_tdm_rx_0_dummy), + }, + { + .name = "TERT_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF-TX-TERTIARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(tert_tdm_tx_0_dummy), + }, { .name = "QUAT_TDM_RX_0_DUMMY", .stream_name = "TDM-LPAIF-RX-QUATERNARY", @@ -278,6 +298,26 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_pmdown_time = 1, SND_SOC_DAILINK_REG(quat_tdm_tx_0_dummy), }, + { + .name = "QUIN_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF-RX-QUINARY", + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quin_tdm_rx_0_dummy), + }, + { + .name = "QUIN_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF-TX-QUINARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quin_tdm_tx_0_dummy), + }, }; static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { @@ -426,26 +466,6 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { static struct snd_soc_dai_link msm_talos_dai_links[] = { /* BackEnd DAI Links */ - { - .name = "PRIMARY_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF_WSA-RX-PRIMARY", - .dpcm_playback = 1, - .trigger = {SND_SOC_DPCM_TRIGGER_POST, - SND_SOC_DPCM_TRIGGER_POST}, - .ignore_suspend = 1, - .ignore_pmdown_time = 1, - SND_SOC_DAILINK_REG(primary_tdm_rx_0_dummy), - }, - { - .name = "PRIMARY_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF_WSA-TX-PRIMARY", - .dpcm_capture = 1, - .trigger = {SND_SOC_DPCM_TRIGGER_POST, - SND_SOC_DPCM_TRIGGER_POST}, - .ignore_suspend = 1, - .ignore_pmdown_time = 1, - SND_SOC_DAILINK_REG(primary_tdm_tx_0_dummy), - }, { .name = "LPASS_BE_AUXPCM_RX_DUMMY", .stream_name = "AUXPCM-LPAIF-RX-PRIMARY", @@ -466,9 +486,49 @@ static struct snd_soc_dai_link msm_talos_dai_links[] = { .ignore_pmdown_time = 1, SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy), }, + { + .name = "SEC_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF-RX-SECONDARY", + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(secondary_tdm_rx_0_dummy), + }, + { + .name = "SEC_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF-TX-SECONDARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(secondary_tdm_tx_0_dummy), + }, + { + .name = "TERT_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF_WSA-RX-PRIMARY", + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(tert_tdm_rx_0_dummy), + }, + { + .name = "TERT_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF_WSA-TX-PRIMARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(tert_tdm_tx_0_dummy), + }, { .name = "QUAT_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF-RX-QUATERNARY", + .stream_name = "TDM-LPAIF_RXTX-RX-PRIMARY", .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -478,7 +538,7 @@ static struct snd_soc_dai_link msm_talos_dai_links[] = { }, { .name = "QUAT_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF-TX-QUATERNARY", + .stream_name = "TDM-LPAIF_RXTX-TX-PRIMARY", .dpcm_capture = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -486,6 +546,26 @@ static struct snd_soc_dai_link msm_talos_dai_links[] = { .ignore_pmdown_time = 1, SND_SOC_DAILINK_REG(quat_tdm_tx_0_dummy), }, + { + .name = "QUIN_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF-RX-TERTIARY", + .dpcm_playback = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quin_tdm_rx_0_dummy), + }, + { + .name = "QUIN_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF-TX-TERTIARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quin_tdm_tx_0_dummy), + }, }; struct snd_soc_card snd_soc_card_auto_hana_dummy_msm = { diff --git a/asoc/msm_dailink.h b/asoc/msm_dailink.h index 1cafb70abb91..171db997f9df 100755 --- a/asoc/msm_dailink.h +++ b/asoc/msm_dailink.h @@ -1305,82 +1305,82 @@ SND_SOC_DAILINK_DEFS(ext_display_port, "msm_dp_audio_codec_rx_dai")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); -SND_SOC_DAILINK_DEFS(tert_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); - -SND_SOC_DAILINK_DEFS(tert_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); - -SND_SOC_DAILINK_DEFS(quat_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); - -SND_SOC_DAILINK_DEFS(quat_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); - SND_SOC_DAILINK_DEFS(lpass_be_auxpcm_rx_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(lpass_be_auxpcm_tx_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(primary_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(primary_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(secondary_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(secondary_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(tert_tdm_rx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(tert_tdm_tx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(quat_tdm_rx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(quat_tdm_tx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(quin_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(quin_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(sen_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(sen_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(sep_tdm_rx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); SND_SOC_DAILINK_DEFS(sep_tdm_tx_0_dummy, - DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), - DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); From d1644ff55dc65e241c8ca4fff0bca00e3dc38dcf Mon Sep 17 00:00:00 2001 From: Dechen Chai Date: Tue, 22 Feb 2022 07:47:57 +0530 Subject: [PATCH 04/19] ASOC: Disable Temperature sensor of WSA881x for bengal -Temperature sensor of WSA881x is not used in bengal Hence disable compilation. -Initialize temp_val before use for wsa881x-analog. Change-Id: Ibfb2fdfabdba7acfad3f65911b89d007a0711f08 Signed-off-by: Dechen Chai --- config/bengalauto.conf | 1 + config/bengalautoconf.h | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/config/bengalauto.conf b/config/bengalauto.conf index f51e7be98f4f..8f2dc3bd953f 100644 --- a/config/bengalauto.conf +++ b/config/bengalauto.conf @@ -3,6 +3,7 @@ CONFIG_AUDIO_EXT_CLK=m CONFIG_SND_SOC_WCD9XXX_V2=m CONFIG_SND_SOC_WCD_MBHC=m CONFIG_SND_SOC_WSA881X_ANALOG=m +CONFIG_WSA881X_TEMP_SENSOR_DISABLE=m CONFIG_WCD9XXX_CODEC_CORE_V2=m CONFIG_MSM_CDC_PINCTRL=m CONFIG_MSM_QDSP6V2_CODECS=m diff --git a/config/bengalautoconf.h b/config/bengalautoconf.h index 42d962160927..b74279a8689a 100644 --- a/config/bengalautoconf.h +++ b/config/bengalautoconf.h @@ -1,5 +1,39 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. + * + * Changes from Qualcomm Innovation Center are provided under the following license: + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * * Neither the name of Qualcomm Innovation Center, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define CONFIG_PINCTRL_LPI 1 @@ -7,6 +41,7 @@ #define CONFIG_SND_SOC_WCD9XXX_V2 1 #define CONFIG_SND_SOC_WCD_MBHC 1 #define CONFIG_SND_SOC_WSA881X_ANALOG 1 +#define CONFIG_WSA881X_TEMP_SENSOR_DISABLE 1 #define CONFIG_WCD9XXX_CODEC_CORE_V2 1 #define CONFIG_MSM_CDC_PINCTRL 1 #define CONFIG_MSM_QDSP6V2_CODECS 1 From c11441a914a82eca26bbc6470ee833cef43218ce Mon Sep 17 00:00:00 2001 From: Jing Wang Date: Thu, 9 Dec 2021 15:28:47 +0530 Subject: [PATCH 05/19] asoc: afe: Add afe dyn mclk kcontrol Add afe dyn mclk kcontrol to support change external clk. Change-Id: I90f0a4a6a350ec261f216aa53bfa2f7306987bc1 Signed-off-by: Jing Wang --- asoc/msm-dai-q6-v2.c | 223 ++++++++++++++++++++++++++++++++++++- dsp/q6afe.c | 79 ++++++++++++- include/dsp/apr_audio-v2.h | 12 ++ include/dsp/q6afe-v2.h | 3 + 4 files changed, 315 insertions(+), 2 deletions(-) diff --git a/asoc/msm-dai-q6-v2.c b/asoc/msm-dai-q6-v2.c index ceba2e0ac11c..d39ef1e49b3f 100755 --- a/asoc/msm-dai-q6-v2.c +++ b/asoc/msm-dai-q6-v2.c @@ -481,6 +481,8 @@ static bool afe_port_logging_item[IDX_TDM_MAX]; static int afe_port_loggging_control_added; +static int afe_dyn_mclk_control_added; + static DEFINE_MUTEX(tdm_mutex); static atomic_t tdm_group_ref[IDX_GROUP_TDM_MAX]; @@ -522,6 +524,51 @@ static struct afe_clk_set tdm_clk_set = { 0, }; +static int clk_id_index; +static int clk_root_index; +static int clk_attri_index; +static int global_dyn_mclk_cfg_portid; +struct afe_param_id_clock_set_v2_t global_dyn_mclk_cfg = { + .clk_set_minor_version = Q6AFE_LPASS_CLK_CONFIG_API_VERSION, + .clk_id = Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT, + .clk_freq_in_hz = 12288000, + .clk_attri = Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO, + .clk_root = Q6AFE_LPASS_MCLK_IN0, + .divider_2x = AFE_CLOCK_DEFAULT_INTEGER_DIVIDER, + .m = AFE_CLOCK_DEFAULT_M_VALUE, + .n = AFE_CLOCK_DEFAULT_N_VALUE, + .d = AFE_CLOCK_DEFAULT_D_VALUE, + .enable = 0, +}; + +static int afe_dyn_clk_root_enum[] = { + Q6AFE_LPASS_MCLK_IN0, + Q6AFE_LPASS_MCLK_IN1, +}; + +static int afe_dyn_clk_attri_enum[] = { + Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO, + Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND, + Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR, +}; + +static int afe_dyn_clk_id_enum[] = { + Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT, Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT, + Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT, Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT, + Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT, Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT, + Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT, Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT, + Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_IBIT, Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_EBIT, + Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_OSR, + Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT, Q6AFE_LPASS_CLK_ID_PRI_PCM_EBIT, + Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT, Q6AFE_LPASS_CLK_ID_SEC_PCM_EBIT, + Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT, Q6AFE_LPASS_CLK_ID_TER_PCM_EBIT, + Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT, Q6AFE_LPASS_CLK_ID_QUAD_PCM_EBIT, + Q6AFE_LPASS_CLK_ID_MCLK_1, Q6AFE_LPASS_CLK_ID_MCLK_2, + Q6AFE_LPASS_CLK_ID_MCLK_3, Q6AFE_LPASS_CLK_ID_MCLK_4, + Q6AFE_LPASS_CLK_ID_MCLK_5, Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT, + Q6AFE_LPASS_CLK_ID_SPDIF_CORE +}; + static int msm_dai_q6_get_tdm_clk_ref(u16 id) { switch (id) { @@ -10371,14 +10418,168 @@ static int msm_pcm_add_afe_port_logging_control(struct snd_soc_dai *dai) return rc; } +static int get_global_clk_root(int value) +{ + if ((value < 0) || (value > ARRAY_SIZE(afe_dyn_clk_root_enum) - 1)) { + pr_err("%s, %d set clk_root range failed\n", __func__, __LINE__); + return global_dyn_mclk_cfg.clk_root; + } + clk_root_index = value; + return afe_dyn_clk_root_enum[clk_root_index]; +} + +static int get_global_clk_attri(int value) +{ + if ((value < 0) || (value > ARRAY_SIZE(afe_dyn_clk_attri_enum) - 1)) { + pr_err("%s, %d set clk_attri range failed\n", __func__, __LINE__); + return global_dyn_mclk_cfg.clk_attri; + } + clk_attri_index = value; + return afe_dyn_clk_attri_enum[clk_attri_index]; +} + +static int get_global_clk_id(int value) +{ + if ((value < 0) || (value > ARRAY_SIZE(afe_dyn_clk_id_enum) - 1)) { + pr_err("%s, %d set clk_id range failed\n", __func__, __LINE__); + return global_dyn_mclk_cfg.clk_id; + } + clk_id_index = value; + return afe_dyn_clk_id_enum[clk_id_index]; +} + +static int msm_pcm_afe_dyn_mclk_ctl_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *ucontrol) +{ + ucontrol->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + /* 11 int values:clk_set_minor_version, clk_id, clk_freq_in_hz, clk_attri, + * clk_root, enable, divider_2x, m, n, d + */ + ucontrol->count = 11; + ucontrol->value.integer.min = 0; + ucontrol->value.integer.max = INT_MAX; + /* Valid range is all positive values to support above controls */ + pr_debug("%s,%d\n", __func__, __LINE__); + + return 0; +} + +static int msm_pcm_afe_dyn_mclk_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.integer.value[0] = global_dyn_mclk_cfg_portid; + ucontrol->value.integer.value[1] = clk_id_index; + ucontrol->value.integer.value[2] = global_dyn_mclk_cfg.clk_freq_in_hz; + ucontrol->value.integer.value[3] = clk_attri_index; + ucontrol->value.integer.value[4] = clk_root_index; + ucontrol->value.integer.value[5] = global_dyn_mclk_cfg.enable; + ucontrol->value.integer.value[6] = global_dyn_mclk_cfg.divider_2x; + ucontrol->value.integer.value[7] = global_dyn_mclk_cfg.m; + ucontrol->value.integer.value[8] = global_dyn_mclk_cfg.n; + ucontrol->value.integer.value[9] = global_dyn_mclk_cfg.d; + ucontrol->value.integer.value[10] = global_dyn_mclk_cfg.clk_set_minor_version; + + pr_debug("%s:%d.... portid:%d, clk_id:%d, clk_freq_in_hz:%d, clk_attri:%d, clk_root:%d, enable:%d, divider_2x:%d, m:%d, n:%d, d:%d, version:%d\n", + __func__, __LINE__, global_dyn_mclk_cfg_portid, global_dyn_mclk_cfg.clk_id, + global_dyn_mclk_cfg.clk_freq_in_hz, global_dyn_mclk_cfg.clk_attri, + global_dyn_mclk_cfg.clk_root, global_dyn_mclk_cfg.enable, + global_dyn_mclk_cfg.divider_2x, global_dyn_mclk_cfg.m, global_dyn_mclk_cfg.n, + global_dyn_mclk_cfg.d, global_dyn_mclk_cfg.clk_set_minor_version); + + return 0; +} + +static int msm_pcm_afe_dyn_mclk_ctl_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + int ret = -EINVAL; + + pr_debug("%s: enter\n", __func__); + + global_dyn_mclk_cfg_portid = ucontrol->value.integer.value[0]; + + global_dyn_mclk_cfg.clk_id = get_global_clk_id(ucontrol->value.integer.value[1]); + + if (ucontrol->value.integer.value[2] >= 0) + global_dyn_mclk_cfg.clk_freq_in_hz = ucontrol->value.integer.value[2]; + + global_dyn_mclk_cfg.clk_attri = get_global_clk_attri(ucontrol->value.integer.value[3]); + + global_dyn_mclk_cfg.clk_root = get_global_clk_root(ucontrol->value.integer.value[4]); + + if ((ucontrol->value.integer.value[5] <= 1) && (ucontrol->value.integer.value[5] >= 0)) + global_dyn_mclk_cfg.enable = ucontrol->value.integer.value[5]; + + global_dyn_mclk_cfg.divider_2x = ucontrol->value.integer.value[6]; + global_dyn_mclk_cfg.m = ucontrol->value.integer.value[7]; + global_dyn_mclk_cfg.n = ucontrol->value.integer.value[8]; + global_dyn_mclk_cfg.d = ucontrol->value.integer.value[9]; + + pr_debug("%s:%d.... portid:%d, clk_id_index:%d, clk_freq_in_hz:%d, clk_attri_index:%d, clk_root_index:%d, enable:%d, divider_2x:%d, m:%d, n:%d, d:%d, version:%d\n", + __func__, __LINE__, ucontrol->value.integer.value[0], + ucontrol->value.integer.value[1], + ucontrol->value.integer.value[2], ucontrol->value.integer.value[3], + ucontrol->value.integer.value[4], ucontrol->value.integer.value[5], + ucontrol->value.integer.value[6], ucontrol->value.integer.value[7], + ucontrol->value.integer.value[8], ucontrol->value.integer.value[9]); + + ret = afe_set_lpass_clk_cfg_ext_mclk_v2(global_dyn_mclk_cfg_portid, + &global_dyn_mclk_cfg, 0); + if (ret) + pr_err("%s: AFE port logging setting for port 0x%x failed %d\n", + __func__, global_dyn_mclk_cfg_portid, ret); + + return ret; +} + +static int msm_pcm_add_afe_dyn_mclk_control(struct snd_soc_dai *dai) +{ + int rc = 0; + struct snd_kcontrol_new *knew = NULL; + struct snd_kcontrol *kctl = NULL; + const char *afe_dyn_mclk_ctl_name = "AFE_dyn_switch_mclk_source"; + + /* Add AFE port logging controls */ + knew = kzalloc(sizeof(struct snd_kcontrol_new), GFP_KERNEL); + if (!knew) + return -ENOMEM; + + knew->iface = SNDRV_CTL_ELEM_IFACE_MIXER; + knew->info = msm_pcm_afe_dyn_mclk_ctl_info; + knew->get = msm_pcm_afe_dyn_mclk_ctl_get; + knew->put = msm_pcm_afe_dyn_mclk_ctl_put; + knew->name = afe_dyn_mclk_ctl_name; + knew->private_value = dai->id; + kctl = snd_ctl_new1(knew, knew); + if (!kctl) { + kfree(knew); + return -ENOMEM; + } + + rc = snd_ctl_add(dai->component->card->snd_card, kctl); + if (rc < 0) + pr_err("%s: err add AFE dyn mclk control, DAI = %s\n", + __func__, dai->name); + + return rc; +} + +int jitter_cleaner_afe_enable_mclk_and_get_info_cb_func(void *private_data, + uint32_t enable, uint32_t mclk_freq, + struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg) +{ + pr_debug("%s,%d\n", __func__, __LINE__); + return 0; +} + static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai) { int rc = 0; + int port_idx = 0; struct msm_dai_q6_tdm_dai_data *tdm_dai_data = NULL; struct snd_kcontrol *data_format_kcontrol = NULL; struct snd_kcontrol *header_type_kcontrol = NULL; struct snd_kcontrol *header_kcontrol = NULL; - int port_idx = 0; const struct snd_kcontrol_new *data_format_ctrl = NULL; const struct snd_kcontrol_new *header_type_ctrl = NULL; const struct snd_kcontrol_new *header_ctrl = NULL; @@ -10459,6 +10660,26 @@ static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai) afe_port_loggging_control_added = 1; } + /* add AFE dyn mclk controls */ + if (!afe_dyn_mclk_control_added) { + rc = msm_pcm_add_afe_dyn_mclk_control(dai); + if (rc < 0) { + dev_err(dai->dev, "%s: add AFE dyn mclk control failed DAI: %s\n", + __func__, dai->name); + goto rtn; + } + + afe_dyn_mclk_control_added = 1; + + rc = afe_register_ext_mclk_cb(jitter_cleaner_afe_enable_mclk_and_get_info_cb_func, + (void *)&global_dyn_mclk_cfg); + if (rc < 0) { + dev_err(dai->dev, "%s: add AFE afe_register_ext_mclk_cb failed : %s\n", + __func__, dai->name); + goto rtn; + } + } + if (tdm_dai_data->is_island_dai) rc = msm_dai_q6_add_island_mx_ctls( dai->component->card->snd_card, diff --git a/dsp/q6afe.c b/dsp/q6afe.c index 9a7d7def16c8..9334d4c2972f 100755 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. */ #include #include @@ -9792,7 +9793,6 @@ static int afe_set_lpass_clk_cfg_ext_mclk(int index, struct afe_clk_set *cfg, dyn_mclk_cfg.clk_id = cfg->clk_id; dyn_mclk_cfg.clk_attri = cfg->clk_attri; dyn_mclk_cfg.enable = cfg->enable; - pr_debug("%s: Minor version =0x%x clk id = %d\n", __func__, dyn_mclk_cfg.clk_set_minor_version, dyn_mclk_cfg.clk_id); pr_debug("%s: clk freq (Hz) = %d, clk attri = 0x%x\n", __func__, @@ -9831,6 +9831,83 @@ stop_mclk: return ret; } +int afe_set_lpass_clk_cfg_ext_mclk_v2(int index, struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg, + uint32_t mclk_freq) +{ + struct param_hdr_v3 param_hdr; + int ret = 0; + + if (!dyn_mclk_cfg) { + pr_err("%s: clock cfg is NULL\n", __func__); + ret = -EINVAL; + return ret; + } + + if (index < 0 || index >= AFE_MAX_PORTS) { + pr_err("%s: index[%d] invalid!\n", __func__, index); + return -EINVAL; + } + + memset(¶m_hdr, 0, sizeof(param_hdr)); + param_hdr.module_id = AFE_MODULE_CLOCK_SET; + param_hdr.instance_id = INSTANCE_ID_0; + param_hdr.param_id = AFE_PARAM_ID_CLOCK_SET_V2; + param_hdr.param_size = sizeof(struct afe_param_id_clock_set_v2_t); + + if (afe_ext_mclk.ext_mclk_cb) { + ret = afe_ext_mclk.ext_mclk_cb(afe_ext_mclk.private_data, + dyn_mclk_cfg->enable, mclk_freq, dyn_mclk_cfg); + if (ret) { + pr_err_ratelimited("%s: get mclk cfg failed %d\n", + __func__, ret); + return ret; + } + } else { + pr_err_ratelimited("%s: mclk callback not registered\n", __func__); + return -EINVAL; + } + + dyn_mclk_cfg->clk_set_minor_version = 1; + + pr_debug("%s: Minor version =0x%x clk id = %d\n", __func__, + dyn_mclk_cfg->clk_set_minor_version, dyn_mclk_cfg->clk_id); + pr_debug("%s: clk freq (Hz) = %d, clk attri = 0x%x\n", __func__, + dyn_mclk_cfg->clk_freq_in_hz, dyn_mclk_cfg->clk_attri); + pr_debug("%s: clk root = 0x%x clk enable = 0x%x\n", __func__, + dyn_mclk_cfg->clk_root, dyn_mclk_cfg->enable); + pr_debug("%s: divider_2x =%d m = %d n = %d, d =%d\n", __func__, + dyn_mclk_cfg->divider_2x, dyn_mclk_cfg->m, dyn_mclk_cfg->n, + dyn_mclk_cfg->d); + + ret = afe_q6_interface_prepare(); + if (ret != 0) { + pr_err_ratelimited("%s: Q6 interface prepare failed %d\n", + __func__, ret); + goto stop_mclk; + } + + mutex_lock(&this_afe.afe_cmd_lock); + ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr, + (u8 *) dyn_mclk_cfg); + if (ret < 0) + pr_err_ratelimited("%s: ext MCLK clk cfg failed with ret %d\n", + __func__, ret); + + mutex_unlock(&this_afe.afe_cmd_lock); + + if (ret >= 0) + return ret; + +stop_mclk: + if (afe_ext_mclk.ext_mclk_cb && dyn_mclk_cfg->enable) { + afe_ext_mclk.ext_mclk_cb(afe_ext_mclk.private_data, + dyn_mclk_cfg->enable, mclk_freq, dyn_mclk_cfg); + } + + return ret; +} +EXPORT_SYMBOL(afe_set_lpass_clk_cfg_ext_mclk_v2); + /** * afe_set_lpass_clk_cfg - Set AFE clk config * diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h index 4fb7b49c41fa..b70670c04d2b 100644 --- a/include/dsp/apr_audio-v2.h +++ b/include/dsp/apr_audio-v2.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. */ @@ -12209,6 +12210,9 @@ struct afe_param_id_clip_bank_sel { /* Supported LPASS CLK root*/ #define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0 +#define Q6AFE_LPASS_MCLK_IN0 1 +#define Q6AFE_LPASS_MCLK_IN1 2 + enum afe_lpass_clk_mode { Q6AFE_LPASS_MODE_BOTH_INVALID, Q6AFE_LPASS_MODE_CLK1_VALID, @@ -12362,6 +12366,8 @@ enum afe_lpass_clk_mode { /* Clock ID for AHB HDMI input */ #define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400 +#define Q6AFE_LPASS_CLK_ID_SPDIF_CORE 0x000 + /* Clock ID for the primary SPDIF output core. */ #define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_CORE 0x500 /* Clock ID for the secondary SPDIF output core. */ @@ -12448,6 +12454,12 @@ struct afe_clk_set { #define AFE_PARAM_ID_CLOCK_SET_V2 0x000102E6 +#define AFE_CLOCK_SET_CLOCK_ROOT_DEFAULT 0x2 +#define AFE_CLOCK_DEFAULT_INTEGER_DIVIDER 0x0 +#define AFE_CLOCK_DEFAULT_M_VALUE 0x1 +#define AFE_CLOCK_DEFAULT_N_VALUE 0x2 +#define AFE_CLOCK_DEFAULT_D_VALUE 0x1 + #define AFE_API_VERSION_CLOCK_SET_V2 0x1 struct afe_param_id_clock_set_v2_t { diff --git a/include/dsp/q6afe-v2.h b/include/dsp/q6afe-v2.h index 48209087a8a2..016996e3bb67 100644 --- a/include/dsp/q6afe-v2.h +++ b/include/dsp/q6afe-v2.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __Q6AFE_V2_H__ #define __Q6AFE_V2_H__ @@ -592,6 +593,8 @@ int afe_port_send_logging_cfg(u16 port_id, struct afe_param_id_port_data_log_disable_t *log_disable); int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats, u16 port); +int afe_set_lpass_clk_cfg_ext_mclk_v2(int index, + struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg, uint32_t mclk_freq); int afe_get_sp_rx_tmax_xmax_logging_data( struct afe_sp_rx_tmax_xmax_logging_param *xt_logging, u16 port_id); From 2899520da559be50488c1aae093537af05e4d9f4 Mon Sep 17 00:00:00 2001 From: Huicheng Liu Date: Wed, 2 Feb 2022 17:19:28 -0500 Subject: [PATCH 06/19] asoc: Enable all LPAIF interface Enable all LPAIF interface Change-Id: I3f70cda077e6600785a8e706246d3ad3820e51ac Signed-off-by: Huicheng Liu --- asoc/gvm_auto_spf_dummy.c | 76 ++++++++++++++++++++++++++++++++++----- asoc/msm_dailink.h | 30 ++++++++++++++++ 2 files changed, 98 insertions(+), 8 deletions(-) diff --git a/asoc/gvm_auto_spf_dummy.c b/asoc/gvm_auto_spf_dummy.c index 93bd664ae14c..d017ee36573b 100755 --- a/asoc/gvm_auto_spf_dummy.c +++ b/asoc/gvm_auto_spf_dummy.c @@ -384,7 +384,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "QUAT_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF-RX-QUATERNARY", + .stream_name = "TDM-LPAIF_RXTX-RX-PRIMARY", .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -394,7 +394,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "QUAT_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF-TX-QUATERNARY", + .stream_name = "TDM-LPAIF_RXTX-TX-PRIMARY", .dpcm_capture = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -404,7 +404,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "QUIN_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF-RX-QUINARY", + .stream_name = "TDM-LPAIF_VA-RX-PRIMARY", .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -414,7 +414,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "QUIN_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF-TX-QUINARY", + .stream_name = "TDM-LPAIF_VA-TX-PRIMARY", .dpcm_capture = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -424,7 +424,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "SEN_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF-RX-SENARY", + .stream_name = "TDM-LPAIF_WSA-RX-PRIMARY", .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -434,7 +434,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "SEN_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF-TX-SENARY", + .stream_name = "TDM-LPAIF_WSA-TX-PRIMARY", .dpcm_capture = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -444,7 +444,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "SEP_TDM_RX_0_DUMMY", - .stream_name = "TDM-LPAIF-RX-SEPTENARY", + .stream_name = "TDM-LPAIF_AUD-RX-PRIMARY", .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -454,7 +454,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { }, { .name = "SEP_TDM_TX_0_DUMMY", - .stream_name = "TDM-LPAIF-TX-SEPTENARY", + .stream_name = "TDM-LPAIF_AUD-TX-PRIMARY", .dpcm_capture = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, @@ -462,6 +462,66 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = { .ignore_pmdown_time = 1, SND_SOC_DAILINK_REG(sep_tdm_tx_0_dummy), }, + { + .name = "HS_IF0_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF_SDR-RX-PRIMARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(hs_if0_tdm_rx_0_dummy), + }, + { + .name = "HS_IF0_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF_SDR-TX-PRIMARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(hs_if0_tdm_tx_0_dummy), + }, + { + .name = "HS_IF1_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF_SDR-RX-SECONDARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(hs_if1_tdm_rx_0_dummy), + }, + { + .name = "HS_IF1_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF_SDR-TX-SECONDARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(hs_if1_tdm_tx_0_dummy), + }, + { + .name = "HS_IF2_TDM_RX_0_DUMMY", + .stream_name = "TDM-LPAIF_SDR-RX-TERTIARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(hs_if2_tdm_rx_0_dummy), + }, + { + .name = "HS_IF2_TDM_TX_0_DUMMY", + .stream_name = "TDM-LPAIF_SDR-TX-TERTIARY", + .dpcm_capture = 1, + .trigger = {SND_SOC_DPCM_TRIGGER_POST, + SND_SOC_DPCM_TRIGGER_POST}, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(hs_if2_tdm_tx_0_dummy), + }, }; static struct snd_soc_dai_link msm_talos_dai_links[] = { diff --git a/asoc/msm_dailink.h b/asoc/msm_dailink.h index 171db997f9df..4d9d1f5e1f64 100755 --- a/asoc/msm_dailink.h +++ b/asoc/msm_dailink.h @@ -1384,3 +1384,33 @@ SND_SOC_DAILINK_DEFS(sep_tdm_tx_0_dummy, DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(hs_if0_tdm_rx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(hs_if0_tdm_tx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(hs_if1_tdm_rx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(hs_if1_tdm_tx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(hs_if2_tdm_rx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); + +SND_SOC_DAILINK_DEFS(hs_if2_tdm_tx_0_dummy, + DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")), + DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")), + DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy"))); From 91c556699af69ca3521ba7dee49858eea90e9e7e Mon Sep 17 00:00:00 2001 From: Krishna Kishor Jha Date: Mon, 21 Feb 2022 18:43:37 +0530 Subject: [PATCH 07/19] msm-audio: adding mixer control for soft step volume params adding new mixer control for set/get soft step volume module params values. This command is attached to FE DAI. Change-Id: I2572d6abe48dcb4d1fb685b5e9c0695fe83cc88a Signed-off-by: Krishna Kishor Jha --- asoc/msm-pcm-q6-v2.c | 187 ++++++++++++++++++++++++++++++++++++++ asoc/msm-pcm-routing-v2.c | 75 +++++++++++++++ asoc/msm-pcm-routing-v2.h | 20 ++++ include/dsp/q6asm-v2.h | 2 + 4 files changed, 284 insertions(+) mode change 100644 => 100755 asoc/msm-pcm-q6-v2.c mode change 100644 => 100755 asoc/msm-pcm-routing-v2.h mode change 100644 => 100755 include/dsp/q6asm-v2.h diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c old mode 100644 new mode 100755 index b084c0081f1e..70fc54190027 --- a/asoc/msm-pcm-q6-v2.c +++ b/asoc/msm-pcm-q6-v2.c @@ -129,6 +129,8 @@ static struct snd_pcm_hw_constraint_list constraints_sample_rates = { .mask = 0, }; +static struct asm_softvolume_params soft_params = {0,0,0}; + struct msm_pcm_channel_map *chmap_pspd[MSM_FRONTEND_DAI_MM_SIZE][2]; static void msm_pcm_route_event_handler(enum msm_pcm_routing_event event, @@ -151,6 +153,181 @@ static void msm_pcm_route_event_handler(enum msm_pcm_routing_event event, } } +static int msm_pcm_set_soft_volume_params(struct msm_audio *prtd,struct asm_softvolume_params *soft_vol_params) +{ + int rc = 0; + + switch (prtd->audio_client->topology) { + default: + rc = q6asm_set_softvolume_v2(prtd->audio_client, soft_vol_params, + SOFT_VOLUME_INSTANCE_1); + if (rc < 0) + pr_err("%s: Send SoftVolume Param failed ret=%d\n", + __func__, rc); + + } + return rc; +} + +static int msm_pcm_soft_volume_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + + struct snd_pcm_soft_volume *soft_vol = (struct snd_pcm_soft_volume *) snd_kcontrol_chip(kcontrol); + struct msm_plat_data *pdata = NULL; + struct snd_pcm_substream *substream = NULL; + struct snd_soc_pcm_runtime *soc_prtd = NULL; + struct snd_soc_component *component = NULL; + + pr_debug("%s\n", __func__); + + if (!soft_vol || !soft_vol->pcm) { + pr_err("%s: soft vol is NULL\n", __func__); + return -ENODEV; + } + + substream = soft_vol->pcm->streams[soft_vol->stream].substream; + if (!substream) { + pr_err("%s substream not found\n", __func__); + return -ENODEV; + } + soc_prtd = substream->private_data; + if (!soc_prtd) { + pr_err("%s substream runtime or private_data not found\n", + __func__); + return -ENODEV; + } + + component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); + if (!component || !component->dev) { + pr_err("%s: component is NULL\n", __func__); + return -ENODEV; + } + + pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); + if (!pdata) { + pr_err("%s: pdata not found\n", __func__); + return -ENODEV; + } + + mutex_lock(&pdata->lock); + + ucontrol->value.integer.value[0] = soft_params.period; + ucontrol->value.integer.value[1] = soft_params.step; + ucontrol->value.integer.value[2] = soft_params.rampingcurve; + pr_debug("%s: period = %d, step = %d , ramping curve: %d",__func__, + ucontrol->value.integer.value[0], + ucontrol->value.integer.value[1], + ucontrol->value.integer.value[2]); + + mutex_unlock(&pdata->lock); + return 0; +} + +static int msm_pcm_soft_volume_ctl_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + int rc = 0; + struct snd_pcm_soft_volume *soft_vol = (struct snd_pcm_soft_volume *) snd_kcontrol_chip(kcontrol); + struct msm_plat_data *pdata = NULL; + struct snd_soc_pcm_runtime *soc_prtd = NULL; + struct snd_soc_component *component = NULL; + struct snd_pcm_substream *substream = NULL; + + struct msm_audio *prtd; + + if (!soft_vol || !soft_vol->pcm) { + pr_err("%s: soft vol is NULL\n", __func__); + return -ENODEV; + } + + substream = soft_vol->pcm->streams[soft_vol->stream].substream; + if (!substream) { + pr_err("%s: substream not found\n", __func__); + return -ENODEV; + } + + soc_prtd = substream->private_data; + if (!substream->runtime || !soc_prtd) { + pr_err("%s: substream runtime or private_data not found\n", + __func__); + return -ENODEV; + } + + component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); + if (!component || !component->dev) { + pr_err("%s: component is NULL\n", __func__); + return -ENODEV; + } + + pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); + if (!pdata) { + pr_err("%s: pdata not found\n", __func__); + return -ENODEV; + } + + mutex_lock(&pdata->lock); + + if (substream->ref_count > 0) { + prtd = substream->runtime->private_data; + + if ( prtd) { + if ((ucontrol->value.integer.value[0] < 0) || (ucontrol->value.integer.value[0] > 15000)) { + pr_err("%s : Ramp period range (0 to 15000), input value is out of range: %d",__func__,soft_params.period); + goto exit; + } else { + soft_params.period = ucontrol->value.integer.value[0]; + } + if ((ucontrol->value.integer.value[1] < 0) || (ucontrol->value.integer.value[1] > 15000000)) { + pr_err("%s : Ramp step range (0 to 15000000), input value is out of range: %d",__func__,soft_params.step); + goto exit; + } else { + soft_params.step = ucontrol->value.integer.value[1]; + } + if ((ucontrol->value.integer.value[2] < 0) || (ucontrol->value.integer.value[2] >= SOFT_VOLUME_CURVE_ENUM_MAX)) { + pr_err("%s : Ramping curve range (0 to 2), input value is out of range: %d",__func__,soft_params.rampingcurve); + goto exit; + } else { + soft_params.rampingcurve = ucontrol->value.integer.value[2]; + } + + pr_debug("%s : soft vol params, period: %d, step: %d, ramp curve: %d",__func__,soft_params.period, + soft_params.step,soft_params.rampingcurve); + rc = msm_pcm_set_soft_volume_params(prtd, &soft_params); + } else { + pr_err("%s: prtd not found\n", __func__); + return -ENODEV; + } + } else { + pr_err("%s: substream ref count is invalid\n", __func__); + return -ENODEV; + } +exit: + mutex_unlock(&pdata->lock); + return rc; +} + +static int msm_pcm_add_soft_volume_params_control(struct snd_soc_pcm_runtime *rtd, int stream) +{ + int ret = 0; + struct snd_pcm *pcm = rtd->pcm; + struct snd_pcm_soft_volume *soft_vol = NULL; + struct snd_kcontrol *kctl = NULL; + + dev_dbg(rtd->dev, "%s, volume control add\n", __func__); + ret = snd_pcm_add_soft_volume_ctls(pcm, stream, + NULL,/* 1,*/ rtd->dai_link->id, + &soft_vol); + if (ret < 0) { + pr_err("%s volume control failed ret %d\n", __func__, ret); + return ret; + } + kctl = soft_vol->kctl; + kctl->put = msm_pcm_soft_volume_ctl_put; + kctl->get = msm_pcm_soft_volume_ctl_get; + return 0; +} + static void event_handler(uint32_t opcode, uint32_t token, uint32_t *payload, void *priv) { @@ -3497,6 +3674,16 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd) pr_err("%s: Could not add pcm Volume Control %d\n", __func__, ret); ret = msm_pcm_add_volume_control(rtd, SNDRV_PCM_STREAM_CAPTURE); + if (ret) + pr_err("%s: Could not add pcm Volume Control %d\n", + __func__, ret); + /* adding soft vol module params mixer control command*/ + ret = msm_pcm_add_soft_volume_params_control(rtd, SNDRV_PCM_STREAM_PLAYBACK); + if (ret) + pr_err("%s: Could not add pcm Volume Control %d\n", + __func__, ret); + + ret = msm_pcm_add_soft_volume_params_control(rtd, SNDRV_PCM_STREAM_CAPTURE); if (ret) pr_err("%s: Could not add pcm Volume Control %d\n", __func__, ret); diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c index 5b7fc20a08e4..8d8a5931bbe7 100644 --- a/asoc/msm-pcm-routing-v2.c +++ b/asoc/msm-pcm-routing-v2.c @@ -182,6 +182,81 @@ static int msm_routing_send_device_pp_params(int port_id, int copp_idx, static void msm_routing_load_topology(size_t data_size, void *data); static void msm_routing_unload_topology(uint32_t topology_id); +static int pcm_soft_volume_ctl_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = SOFT_VOLUME_CURVE_ENUM_MAX; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = INT_MAX; + return 0; +} + +static void pcm_soft_volume_ctl_private_free(struct snd_kcontrol *kcontrol) +{ + struct snd_pcm_volume *info = snd_kcontrol_chip(kcontrol); + + kfree(info); +} + +int snd_pcm_add_soft_volume_ctls(struct snd_pcm *pcm, int stream, + const struct snd_pcm_soft_vol_usr_elem *soft_vol_params, + unsigned long private_value, + struct snd_pcm_soft_volume **info_ret) +{ + int err = 0; + int size = 0; + struct snd_pcm_soft_volume *info; + struct snd_kcontrol_new knew = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | + SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = pcm_soft_volume_ctl_info, + }; + + info = kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + info->pcm = pcm; + info->stream = stream; + info->usr_val = soft_vol_params; + size = sizeof("Playback ") + sizeof("Soft Vol Params") + + STRING_LENGTH_OF_INT*sizeof(char) + 1; + knew.name = kzalloc(size, GFP_KERNEL); + if (!knew.name) { + kfree(info); + return -ENOMEM; + } + if (stream == SNDRV_PCM_STREAM_PLAYBACK) + snprintf((char *)knew.name, size, "%s %d %s", + "Playback ", pcm->device, "Soft Vol Params"); + else + snprintf((char *)knew.name, size, "%s %d %s", + "Capture", pcm->device, "Soft Vol Params"); + knew.device = pcm->device; + knew.count = pcm->streams[stream].substream_count; + knew.private_value = private_value; + info->kctl = snd_ctl_new1(&knew, info); + if (!info->kctl) { + kfree(info); + kfree(knew.name); + return -ENOMEM; + } + info->kctl->private_free = pcm_soft_volume_ctl_private_free; + err = snd_ctl_add(pcm->card, info->kctl); + if (err < 0) { + kfree(info); + kfree(knew.name); + return -ENOMEM; + } + if (info_ret) + *info_ret = info; + kfree(knew.name); + + return 0; +} +EXPORT_SYMBOL(snd_pcm_add_soft_volume_ctls); + #ifndef SND_PCM_ADD_VOLUME_CTL static int pcm_volume_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) diff --git a/asoc/msm-pcm-routing-v2.h b/asoc/msm-pcm-routing-v2.h old mode 100644 new mode 100755 index 4a8e4b6eda58..6414d959eb95 --- a/asoc/msm-pcm-routing-v2.h +++ b/asoc/msm-pcm-routing-v2.h @@ -800,6 +800,26 @@ int msm_pcm_routing_set_channel_mixer_runtime( int msm_pcm_routing_set_stream_ec_ref_chmix_cfg( int fedai_id, struct msm_pcm_channel_mixer *cfg_data); + +/* array element of usr elem */ +struct snd_pcm_soft_vol_usr_elem { + int val[3]; +}; + +/* mixer control information; retrieved via snd_kcontrol_chip() */ +struct snd_pcm_soft_volume { + struct snd_pcm *pcm; /* assigned PCM instance */ + int stream; /* PLAYBACK or CAPTURE */ + struct snd_kcontrol *kctl; /* contorl handle*/ + const struct snd_pcm_soft_vol_usr_elem *usr_val; + int max_length; + void *private_data; +}; + +int snd_pcm_add_soft_volume_ctls(struct snd_pcm *pcm, int stream, + const struct snd_pcm_soft_vol_usr_elem *soft_vol_params, + unsigned long private_value, + struct snd_pcm_soft_volume **info_ret); #ifndef SND_PCM_ADD_VOLUME_CTL /* PCM Volume control API */ diff --git a/include/dsp/q6asm-v2.h b/include/dsp/q6asm-v2.h old mode 100644 new mode 100755 index eab3656e5161..37525c57a928 --- a/include/dsp/q6asm-v2.h +++ b/include/dsp/q6asm-v2.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2012-2019, 2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __Q6_ASM_V2_H__ #define __Q6_ASM_V2_H__ @@ -150,6 +151,7 @@ enum { SOFT_VOLUME_CURVE_LINEAR = 0, SOFT_VOLUME_CURVE_EXP, SOFT_VOLUME_CURVE_LOG, + SOFT_VOLUME_CURVE_ENUM_MAX, }; #define SOFT_VOLUME_INSTANCE_1 1 From 4a7f98b01c979c853a41bdd90c1a89eeb2a6b6a1 Mon Sep 17 00:00:00 2001 From: ftong Date: Thu, 24 Feb 2022 16:25:53 +0800 Subject: [PATCH 08/19] asoc:msm-lsm-client: potential deadlock fix After acquiring spinlock, if memory allocation fails, the spinlock is not released, thus inducing a potential deadlock. Change-Id: I8d390437a00b8a9ca2cb216f47434a0448506e1f Signed-off-by: ftong --- asoc/msm-lsm-client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/asoc/msm-lsm-client.c b/asoc/msm-lsm-client.c index 69768bc38e51..b688d64a06ee 100644 --- a/asoc/msm-lsm-client.c +++ b/asoc/msm-lsm-client.c @@ -412,6 +412,7 @@ static void lsm_event_handler(uint32_t opcode, uint32_t token, if (!temp) { dev_err(rtd->dev, "%s: no memory for event status\n", __func__); + spin_unlock_irqrestore(&prtd->event_lock, flags); __pm_relax(prtd->ws); return; } From 1e417536ee872b2f806eba168e6d2272860d03cf Mon Sep 17 00:00:00 2001 From: Aditya Bavanari Date: Fri, 25 Feb 2022 10:17:53 +0530 Subject: [PATCH 09/19] asoc: Set clock index correctly in mi2s slave mode When msm acts as slave mode in mi2s, clock ID for a clock index is not properly updated for first time. Fix the sequence issue to update clock ID accordingly for slave mode. Change-Id: Ie601547e8a5677ee778ff707f55e2d861a35f459 Signed-off-by: Aditya Bavanari --- asoc/bengal.c | 9 +++++---- asoc/holi.c | 9 +++++---- asoc/kona.c | 9 +++++---- asoc/lahaina.c | 9 +++++---- asoc/qcs405.c | 9 +++++---- asoc/sa6155.c | 9 +++++---- asoc/sa8155.c | 9 +++++---- asoc/sm6150.c | 9 +++++---- asoc/sm8150.c | 9 +++++---- 9 files changed, 45 insertions(+), 36 deletions(-) diff --git a/asoc/bengal.c b/asoc/bengal.c index 2fff3ff5d19b..08517e07ae30 100644 --- a/asoc/bengal.c +++ b/asoc/bengal.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -3956,6 +3957,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) */ mutex_lock(&mi2s_intf_conf[index].lock); if (++mi2s_intf_conf[index].ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -3978,11 +3982,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) atomic_inc(&(pdata->mi2s_gpio_ref_count[index])); } } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/holi.c b/asoc/holi.c index c364512af581..5cf2b1ad56f5 100644 --- a/asoc/holi.c +++ b/asoc/holi.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -4459,6 +4460,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) } if (++mi2s_intf_conf[index].ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -4481,11 +4485,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) atomic_inc(&(pdata->mi2s_gpio_ref_count[index])); } } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/kona.c b/asoc/kona.c index 2286f288ed4f..06b4fd167299 100644 --- a/asoc/kona.c +++ b/asoc/kona.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -5100,6 +5101,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) } if (++mi2s_intf_conf[index].ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -5122,11 +5126,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) atomic_inc(&(pdata->mi2s_gpio_ref_count[index])); } } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/lahaina.c b/asoc/lahaina.c index 32880abbbc3c..f5ad209553b9 100644 --- a/asoc/lahaina.c +++ b/asoc/lahaina.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -5440,6 +5441,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__, mi2s_clk[index].clk_freq_in_hz); + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -5462,11 +5466,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) atomic_inc(&(pdata->mi2s_gpio_ref_count[index])); } } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/qcs405.c b/asoc/qcs405.c index ce8540bd15b7..8b012c6c7ccd 100644 --- a/asoc/qcs405.c +++ b/asoc/qcs405.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include #include @@ -7065,6 +7066,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) if (++mi2s_intf_conf[index].ref_cnt == 1) { if (data_format == AFE_DSD_DATA) fmt = SND_SOC_DAIFMT_CBM_CFS; + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -7101,11 +7105,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) } } } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/sa6155.c b/asoc/sa6155.c index 5d79f69fcf68..1e3fd7a2b896 100755 --- a/asoc/sa6155.c +++ b/asoc/sa6155.c @@ -1,4 +1,5 @@ /* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ /* * Copyright 2011, The Android Open Source Project @@ -5037,6 +5038,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) intf_conf = &pdata->mi2s_intf_conf[index]; mutex_lock(&intf_conf->lock); if (++intf_conf->ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!intf_conf->msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -5054,11 +5058,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) __func__, ret_pinctrl); } } - /* Check if msm needs to provide the clock to the interface */ - if (!intf_conf->msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!intf_conf->msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/sa8155.c b/asoc/sa8155.c index 7bc1b17a4ef5..8f4f243344da 100644 --- a/asoc/sa8155.c +++ b/asoc/sa8155.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ /* * Copyright 2011, The Android Open Source Project @@ -7427,6 +7428,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) intf_conf = &pdata->mi2s_intf_conf[index]; mutex_lock(&intf_conf->lock); if (++intf_conf->ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!intf_conf->msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -7444,11 +7448,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) __func__, ret_pinctrl); } } - /* Check if msm needs to provide the clock to the interface */ - if (!intf_conf->msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!intf_conf->msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/sm6150.c b/asoc/sm6150.c index e4763d81f099..92a9580327e4 100644 --- a/asoc/sm6150.c +++ b/asoc/sm6150.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -5908,6 +5909,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) */ mutex_lock(&mi2s_intf_conf[index].lock); if (++mi2s_intf_conf[index].ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -5932,11 +5936,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) msm_cdc_pinctrl_select_active_state( pdata->mi2s_gpio_p[index]); } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", diff --git a/asoc/sm8150.c b/asoc/sm8150.c index ccfe38cdf042..e200dfc27336 100644 --- a/asoc/sm8150.c +++ b/asoc/sm8150.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2016-2019, 2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -4852,6 +4853,9 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) */ mutex_lock(&mi2s_intf_conf[index].lock); if (++mi2s_intf_conf[index].ref_cnt == 1) { + /* Check if msm needs to provide the clock to the interface */ + if (!mi2s_intf_conf[index].msm_is_mi2s_master) + mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; ret = msm_mi2s_set_sclk(substream, true); if (ret < 0) { dev_err(rtd->card->dev, @@ -4868,11 +4872,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) __func__, ret_pinctrl); } } - /* Check if msm needs to provide the clock to the interface */ - if (!mi2s_intf_conf[index].msm_is_mi2s_master) { - mi2s_clk[index].clk_id = mi2s_ebit_clk[index]; + if (!mi2s_intf_conf[index].msm_is_mi2s_master) fmt = SND_SOC_DAIFMT_CBM_CFM; - } ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", From 7696eb78b6112e3d44ae1d50e34dbdd030ed4381 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 12:27:06 +0530 Subject: [PATCH 10/19] ASOC: ext-clk: Fix hw init issue caused by CLK upgrade CLK driver upgrade causes hw->init to be NULL. Unable to get hw->init from CLK core. Modify to obtain hw->init from local static data. Change-Id: I2ffc3e7dfd356cfcb2735336dd67ff70a35328c4 Signed-off-by: Shuai Zhang --- asoc/codecs/audio-ext-clk-up.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/asoc/codecs/audio-ext-clk-up.c b/asoc/codecs/audio-ext-clk-up.c index acd00da91404..f3e9b694c5b5 100644 --- a/asoc/codecs/audio-ext-clk-up.c +++ b/asoc/codecs/audio-ext-clk-up.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -58,6 +59,8 @@ struct audio_ext_clk_priv { uint32_t lpass_audio_hwvote_client_handle; }; +static struct audio_ext_clk audio_clk_array[]; + static inline struct audio_ext_clk_priv *to_audio_clk(struct clk_hw *hw) { return container_of(hw, struct audio_ext_clk_priv, audio_clk.fact.hw); @@ -137,8 +140,8 @@ static u8 audio_ext_clk_get_parent(struct clk_hw *hw) { struct audio_ext_clk_priv *clk_priv = to_audio_clk(hw); int num_parents = clk_hw_get_num_parents(hw); - const char * const *parent_names = hw->init->parent_names; - u8 i = 0, ret = hw->init->num_parents + 1; + const char * const *parent_names = audio_clk_array[clk_priv->clk_src].fact.hw.init->parent_names; + u8 i = 0, ret = num_parents + 1; if ((clk_priv->clk_src == AUDIO_EXT_CLK_PMI) && clk_priv->clk_name) { for (i = 0; i < num_parents; i++) { From 31b7445e1790525554b3c3a55c45c09886bc8c76 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 08:48:07 +0530 Subject: [PATCH 11/19] soc: swr-mstr-ctrl: Fix SWR cmd FIFO overflow error Fix SWR cmd FIFO overflow error. In 5.4 kernel there are few additional register writes added in soundwire driver, one of the register(SWRS_DP_SAMPLE_CONTROL_2_BANK) write is causing overflow error. Change-Id: I31f4855af52b24ceac53f55010ce1935c3bc1ea6 Signed-off-by: Shuai Zhang --- soc/swr-mstr-ctrl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c index f0a9e94f8ffb..2ef6ffe70422 100644 --- a/soc/swr-mstr-ctrl.c +++ b/soc/swr-mstr-ctrl.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -1464,12 +1465,14 @@ static void swrm_copy_data_port_config(struct swr_master *master, u8 bank) SWRS_DP_SAMPLE_CONTROL_1_BANK(slv_id, bank)); - reg[len] = SWRM_CMD_FIFO_WR_CMD; - val[len++] = SWR_REG_VAL_PACK( + if ((port_req->sinterval >> 8)& 0xFF) { + reg[len] = SWRM_CMD_FIFO_WR_CMD; + val[len++] = SWR_REG_VAL_PACK( (port_req->sinterval >> 8)& 0xFF, port_req->dev_num, 0x00, SWRS_DP_SAMPLE_CONTROL_2_BANK(slv_id, bank)); + } reg[len] = SWRM_CMD_FIFO_WR_CMD; val[len++] = SWR_REG_VAL_PACK(port_req->offset1, From 10e5816d4ad02ae761769a892b9e9307040465a2 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 12:07:01 +0530 Subject: [PATCH 12/19] ASoC: codecs: wsa881x: add codec dai for each wsa881x Add new codec dai for each wsa881x, since each WSA is initialized as a codec and not as aux device. Change-Id: Ifee063cea54a65600d9040390666d58de49a0689 Signed-off-by: Shuai Zhang --- asoc/codecs/wsa881x.c | 128 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 6 deletions(-) diff --git a/asoc/codecs/wsa881x.c b/asoc/codecs/wsa881x.c index 1c28ab051f24..fc4ae71882a9 100644 --- a/asoc/codecs/wsa881x.c +++ b/asoc/codecs/wsa881x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -30,9 +31,21 @@ #include "wsa881x-temp-sensor.h" #include "asoc/bolero-slave-internal.h" -#define DRV_NAME "wsa-codec" #define WSA881X_NUM_RETRY 5 +#define MAX_NAME_LEN 30 +#define WSA881X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ + SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\ + SNDRV_PCM_RATE_384000) +/* Fractional Rates */ +#define WSA881X_FRAC_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\ + SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_352800) + +#define WSA881X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ + SNDRV_PCM_FMTBIT_S24_LE |\ + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) + enum { G_18DB = 0, G_16P5DB, @@ -115,6 +128,9 @@ struct wsa881x_priv { struct dentry *debugfs_poke; struct dentry *debugfs_reg_dump; unsigned int read_data; + char *wsa881x_name_prefix; + struct snd_soc_dai_driver *dai_driver; + struct snd_soc_component_driver *driver; }; struct wsa_ctrl_platform_data { @@ -1356,7 +1372,7 @@ static void wsa881x_remove(struct snd_soc_component *component) } static const struct snd_soc_component_driver soc_codec_dev_wsa881x = { - .name = DRV_NAME, + .name = "wsa-codec", .probe = wsa881x_probe, .remove = wsa881x_remove, .controls = wsa881x_snd_controls, @@ -1367,6 +1383,21 @@ static const struct snd_soc_component_driver soc_codec_dev_wsa881x = { .num_dapm_routes = ARRAY_SIZE(wsa881x_audio_map), }; +static struct snd_soc_dai_driver wsa_dai[] = { + { + .name = "wsa_rx", + .playback = { + .stream_name = "WSA881X_AIF Playback", + .rates = WSA881X_RATES | WSA881X_FRAC_RATES, + .formats = WSA881X_FORMATS, + .rate_max = 192000, + .rate_min = 8000, + .channels_min = 1, + .channels_max = 2, + }, + }, +}; + static int wsa881x_gpio_ctrl(struct wsa881x_priv *wsa881x, bool enable) { int ret = 0; @@ -1461,9 +1492,13 @@ static int wsa881x_event_notify(struct notifier_block *nb, static int wsa881x_swr_probe(struct swr_device *pdev) { int ret = 0; - struct wsa881x_priv *wsa881x; + struct wsa881x_priv *wsa881x = NULL; + struct snd_soc_component *component; u8 devnum = 0; + int dev_index = 0; bool pin_state_current = false; + char buffer[MAX_NAME_LEN]; + const char *wsa881x_name_prefix_of = NULL; struct wsa_ctrl_platform_data *plat_data = NULL; wsa881x = devm_kzalloc(&pdev->dev, sizeof(struct wsa881x_priv), @@ -1553,14 +1588,74 @@ static int wsa881x_swr_probe(struct swr_device *pdev) goto dev_err; } - ret = snd_soc_register_component(&pdev->dev, &soc_codec_dev_wsa881x, - NULL, 0); + ret = of_property_read_string(pdev->dev.of_node, + "qcom,wsa-prefix", &wsa881x_name_prefix_of); + if (ret) { + dev_err(&pdev->dev, + "%s: Looking up %s property in node %s failed\n", + __func__, "qcom,wsa-prefix", + pdev->dev.of_node->full_name); + goto dev_err; + } + + wsa881x->driver = devm_kzalloc(&pdev->dev, + sizeof(struct snd_soc_component_driver), + GFP_KERNEL); + if (!wsa881x->driver) { + ret = -ENOMEM; + goto err_mem; + } + + memcpy(wsa881x->driver, &soc_codec_dev_wsa881x, + sizeof(struct snd_soc_component_driver)); + + wsa881x->dai_driver = devm_kzalloc(&pdev->dev, + sizeof(struct snd_soc_dai_driver), + GFP_KERNEL); + if (!wsa881x->dai_driver) { + ret = -ENOMEM; + goto err_mem; + } + + memcpy(wsa881x->dai_driver, wsa_dai, + sizeof(struct snd_soc_dai_driver)); + + dev_index = (int)((char)(pdev->addr & 0xF)); + + snprintf(buffer, sizeof(buffer), "wsa-codec.%d", dev_index); + wsa881x->driver->name = kstrndup(buffer, + strlen(buffer), GFP_KERNEL); + + snprintf(buffer, sizeof(buffer), "wsa_rx%d", dev_index); + wsa881x->dai_driver->name = + kstrndup(buffer, strlen(buffer), GFP_KERNEL); + + snprintf(buffer, sizeof(buffer), + "WSA881X_AIF%d Playback", dev_index); + wsa881x->dai_driver->playback.stream_name = + kstrndup(buffer, strlen(buffer), GFP_KERNEL); + + /* Number of DAI's used is 1 */ + ret = snd_soc_register_component(&pdev->dev, + wsa881x->driver, wsa881x->dai_driver, 1); if (ret) { dev_err(&pdev->dev, "%s: Codec registration failed\n", __func__); - goto dev_err; + goto err_mem; } + wsa881x->wsa881x_name_prefix = kstrndup(wsa881x_name_prefix_of, + strlen(wsa881x_name_prefix_of), GFP_KERNEL); + + component = snd_soc_lookup_component(&pdev->dev, wsa881x->driver->name); + if (!component) { + dev_err(&pdev->dev, "%s: component is NULL \n", __func__); + ret = -EINVAL; + goto err_mem; + } + + component->name_prefix = wsa881x->wsa881x_name_prefix; + wsa881x->bolero_np = of_parse_phandle(pdev->dev.of_node, "qcom,bolero-handle", 0); if (wsa881x->bolero_np) { @@ -1596,6 +1691,17 @@ static int wsa881x_swr_probe(struct swr_device *pdev) return 0; +err_mem: + kfree(wsa881x->wsa881x_name_prefix); + if (wsa881x->dai_driver) { + devm_kfree(&pdev->dev, wsa881x->dai_driver->name); + devm_kfree(&pdev->dev, wsa881x->dai_driver->playback.stream_name); + devm_kfree(&pdev->dev, wsa881x->dai_driver); + } + if (wsa881x->driver) { + devm_kfree(&pdev->dev, wsa881x->driver->name); + devm_kfree(&pdev->dev, wsa881x->driver); + } dev_err: if (pin_state_current == false) wsa881x_gpio_ctrl(wsa881x, false); @@ -1625,6 +1731,16 @@ static int wsa881x_swr_remove(struct swr_device *pdev) if (wsa881x->pd_gpio) gpio_free(wsa881x->pd_gpio); swr_set_dev_data(pdev, NULL); + kfree(wsa881x->wsa881x_name_prefix); + if (wsa881x->dai_driver) { + devm_kfree(&pdev->dev, wsa881x->dai_driver->name); + devm_kfree(&pdev->dev, wsa881x->dai_driver->playback.stream_name); + devm_kfree(&pdev->dev, wsa881x->dai_driver); + } + if (wsa881x->driver) { + devm_kfree(&pdev->dev, wsa881x->driver->name); + devm_kfree(&pdev->dev, wsa881x->driver); + } return 0; } From 4ec279c7cb257fe7d1a43ab5eda51bf41e6852dd Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 12:13:26 +0530 Subject: [PATCH 13/19] makefile: add config support for audio techpack for QCS610 Add required changes to makefile and enable the config keys for QCS610 target cpmpilation. Change-Id: I8ef55e9b237f10ae0d240d83c685f5580a939be3 Signed-off-by: Shuai Zhang --- Makefile | 8 +++- config/sm6150auto.conf | 96 +++++++++++++++++++++--------------------- 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index d60a0236f5ee..73ad150b67ec 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ endif ifeq ($(CONFIG_ARCH_SA6155), y) include $(srctree)/techpack/audio/config/sa6155auto.conf endif +ifeq ($(CONFIG_ARCH_SM6150), y) +include $(srctree)/techpack/audio/config/sm6150auto.conf +endif endif # Use USERINCLUDE when you must reference the UAPI directories only. USERINCLUDE += \ @@ -79,7 +82,10 @@ ifeq ($(CONFIG_ARCH_SA6155), y) LINUXINCLUDE += \ -include $(srctree)/techpack/audio/config/sa6155autoconf.h endif - +ifeq ($(CONFIG_ARCH_SM6150), y) +LINUXINCLUDE += \ + -include $(srctree)/techpack/audio/config/sm6150autoconf.h +endif obj-y += soc/ obj-y += dsp/ obj-y += ipc/ diff --git a/config/sm6150auto.conf b/config/sm6150auto.conf index f6074abbac0b..8ebc88a5e7de 100644 --- a/config/sm6150auto.conf +++ b/config/sm6150auto.conf @@ -1,48 +1,48 @@ -CONFIG_PINCTRL_WCD=m -CONFIG_PINCTRL_LPI=m -CONFIG_AUDIO_EXT_CLK=m -CONFIG_SND_SOC_WCD9XXX_V2=m -CONFIG_SND_SOC_WCD_MBHC=m -CONFIG_SND_SOC_WSA881X=m -CONFIG_SND_SOC_WCD_DSP_MGR=m -CONFIG_SND_SOC_WCD_SPI=m -CONFIG_SND_SOC_WCD934X=m -CONFIG_SND_SOC_WCD934X_MBHC=m -CONFIG_SND_SOC_WCD934X_DSD=m -CONFIG_WCD9XXX_CODEC_CORE=m -CONFIG_MSM_CDC_PINCTRL=m -CONFIG_MSM_QDSP6V2_CODECS=m -CONFIG_MSM_ULTRASOUND=m -CONFIG_MSM_QDSP6_APRV2_RPMSG=m -CONFIG_MSM_ADSP_LOADER=m -CONFIG_REGMAP_SWR=m -CONFIG_MSM_QDSP6_SSR=m -CONFIG_MSM_QDSP6_PDR=m -CONFIG_MSM_QDSP6_NOTIFIER=m -CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m -CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m -CONFIG_SND_SOC_SM6150=m -CONFIG_MSM_GLINK_SPI_XPRT=m -CONFIG_WCD_DSP_GLINK=m -CONFIG_SOUNDWIRE=m -CONFIG_SOUNDWIRE_MSTR_CTRL=m -CONFIG_SND_SOC_QDSP6V2=m -CONFIG_SND_SOC_WCD_MBHC_ADC=m -CONFIG_QTI_PP=m -CONFIG_SND_HWDEP_ROUTING=m -CONFIG_DTS_EAGLE=m -CONFIG_DOLBY_DS2=m -CONFIG_DOLBY_LICENSE=m -CONFIG_DTS_SRS_TM=m -CONFIG_SND_SOC_MSM_STUB=m -CONFIG_MSM_AVTIMER=m -CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m -CONFIG_SND_SOC_BOLERO=m -CONFIG_WSA_MACRO=m -CONFIG_VA_MACRO=m -CONFIG_RX_MACRO=m -CONFIG_TX_MACRO=m -CONFIG_SND_SOC_WCD_IRQ=m -CONFIG_SND_SOC_WCD937X=m -CONFIG_SND_SOC_WCD937X_SLAVE=m -CONFIG_SND_EVENT=m +export CONFIG_PINCTRL_WCD=m +export CONFIG_PINCTRL_LPI=m +export CONFIG_AUDIO_EXT_CLK=m +export CONFIG_SND_SOC_WCD9XXX_V2=m +export CONFIG_SND_SOC_WCD_MBHC=m +export CONFIG_SND_SOC_WSA881X=m +export CONFIG_SND_SOC_WCD_DSP_MGR=m +export CONFIG_SND_SOC_WCD_SPI=m +export CONFIG_SND_SOC_WCD934X=m +export CONFIG_SND_SOC_WCD934X_MBHC=m +export CONFIG_SND_SOC_WCD934X_DSD=m +export CONFIG_WCD9XXX_CODEC_CORE=m +export CONFIG_MSM_CDC_PINCTRL=m +export CONFIG_MSM_QDSP6V2_CODECS=m +export CONFIG_MSM_ULTRASOUND=m +export CONFIG_MSM_QDSP6_APRV2_RPMSG=m +export CONFIG_MSM_ADSP_LOADER=m +export CONFIG_REGMAP_SWR=m +export CONFIG_MSM_QDSP6_SSR=m +export CONFIG_MSM_QDSP6_PDR=m +export CONFIG_MSM_QDSP6_NOTIFIER=m +export CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m +export CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m +export CONFIG_SND_SOC_SM6150=m +export CONFIG_MSM_GLINK_SPI_XPRT=m +export CONFIG_WCD_DSP_GLINK=m +export CONFIG_SOUNDWIRE=m +export CONFIG_SOUNDWIRE_MSTR_CTRL=m +export CONFIG_SND_SOC_QDSP6V2=m +export CONFIG_SND_SOC_WCD_MBHC_ADC=m +export CONFIG_QTI_PP=m +export CONFIG_SND_HWDEP_ROUTING=m +export CONFIG_DTS_EAGLE=m +export CONFIG_DOLBY_DS2=m +export CONFIG_DOLBY_LICENSE=m +export CONFIG_DTS_SRS_TM=m +export CONFIG_SND_SOC_MSM_STUB=m +export CONFIG_MSM_AVTIMER=m +export CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m +export CONFIG_SND_SOC_BOLERO=m +export CONFIG_WSA_MACRO=m +export CONFIG_VA_MACRO=m +export CONFIG_RX_MACRO=m +export CONFIG_TX_MACRO=m +export CONFIG_SND_SOC_WCD_IRQ=m +export CONFIG_SND_SOC_WCD937X=m +export CONFIG_SND_SOC_WCD937X_SLAVE=m +export CONFIG_SND_EVENT=m From 21474dc6d78fe9766a67279661001d9a4e50db58 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 12:18:56 +0530 Subject: [PATCH 14/19] ASoC: wcd-spi: Fix dma alloc compilation errors Fix dma_alloc_coherent compilation errors, using the new API Change-Id: I2188c9ab34e5c02cebc0f86a53e3f810aefc6caf Signed-off-by: Shuai Zhang --- asoc/codecs/wcd-spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/asoc/codecs/wcd-spi.c b/asoc/codecs/wcd-spi.c index 4c7a85338ed4..8eca87d9a0da 100644 --- a/asoc/codecs/wcd-spi.c +++ b/asoc/codecs/wcd-spi.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -1478,7 +1479,7 @@ static int wcd_spi_component_bind(struct device *dev, spi_message_add_tail(&wcd_spi->xfer2[1], &wcd_spi->msg2); /* Pre-allocate the buffers */ - wcd_spi->tx_buf = dma_zalloc_coherent(&spi->dev, + wcd_spi->tx_buf = dma_alloc_coherent(&spi->dev, WCD_SPI_RW_MAX_BUF_SIZE, &wcd_spi->tx_dma, GFP_KERNEL); if (!wcd_spi->tx_buf) { @@ -1486,7 +1487,7 @@ static int wcd_spi_component_bind(struct device *dev, goto done; } - wcd_spi->rx_buf = dma_zalloc_coherent(&spi->dev, + wcd_spi->rx_buf = dma_alloc_coherent(&spi->dev, WCD_SPI_RW_MAX_BUF_SIZE, &wcd_spi->rx_dma, GFP_KERNEL); if (!wcd_spi->rx_buf) { From 0ac76a1d7aae397d59b9c0b4b8fc88529c737939 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 08:23:07 +0530 Subject: [PATCH 15/19] ASOC: update sm6150 machine driver Update machine driver for sm6150. Compile wsa881x digital driver for sm6150. Change-Id: I46e0ef5ffa773e2c8e4b9fe3cf8819ac32f303d5 Signed-off-by: Shuai Zhang --- asoc/Kbuild | 1 - asoc/sm6150.c | 1399 +++++++++++++------------------------------------ 2 files changed, 355 insertions(+), 1045 deletions(-) diff --git a/asoc/Kbuild b/asoc/Kbuild index f59beb058c3a..8276d7df6000 100644 --- a/asoc/Kbuild +++ b/asoc/Kbuild @@ -136,7 +136,6 @@ endif # for SM6150 sound card driver ifdef CONFIG_SND_SOC_SM6150 MACHINE_OBJS += sm6150.o - MACHINE_OBJS += machine_615x_init.o endif # For sa6155 sound card driver diff --git a/asoc/sm6150.c b/asoc/sm6150.c index 92a9580327e4..5eb1b5d94397 100644 --- a/asoc/sm6150.c +++ b/asoc/sm6150.c @@ -38,6 +38,8 @@ #include #include "codecs/bolero/wsa-macro.h" #include "codecs/wcd937x/wcd937x.h" +#include "msm_talos_dailink.h" +#include "talos-port-config.h" #define DRV_NAME "sm6150-asoc-snd" @@ -76,7 +78,6 @@ #define SM6150_SOC_VERSION_1_0 0x00010000 #define SM6150_SOC_MSM_ID 0x163 - enum { SLIM_RX_0 = 0, SLIM_RX_1, @@ -197,11 +198,6 @@ struct msm_wsa881x_dev_info { u32 index; }; -struct aux_codec_dev_info { - struct device_node *of_node; - u32 index; -}; - struct msm_asoc_mach_data { struct snd_info_entry *codec_root; int usbc_en2_gpio; /* used by gpio driver API */ @@ -216,6 +212,7 @@ struct msm_asoc_mach_data { struct device_node *hph_en0_gpio_p; /* used by pinctrl API */ bool is_afe_config_done; struct device_node *fsa_handle; + u32 wsa_max_devs; }; struct msm_asoc_wcd93xx_codec { @@ -624,8 +621,6 @@ static SOC_ENUM_SINGLE_EXT_DECL(tx_cdc_dma_tx_4_sample_rate, static int msm_hifi_control; static bool codec_reg_done; -static struct snd_soc_aux_dev *msm_aux_dev; -static struct snd_soc_codec_conf *msm_codec_conf; static struct msm_asoc_wcd93xx_codec msm_codec_fn; static int dmic_0_1_gpio_cnt; @@ -634,8 +629,7 @@ static int dmic_2_3_gpio_cnt; static void *def_wcd_mbhc_cal(void); static int msm_snd_enable_codec_ext_clk(struct snd_soc_component *component, int enable, bool dapm); -static int msm_wsa881x_init(struct snd_soc_component *component); -static int msm_aux_codec_init(struct snd_soc_component *component); +static int msm_wsa881x_init(struct snd_soc_pcm_runtime *rtd); /* * Need to report LINEIN @@ -4235,7 +4229,6 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, SNDRV_PCM_HW_PARAM_RATE); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); - struct snd_soc_dai *codec_dai = rtd->codec_dai; int rc = 0; int idx; @@ -4761,6 +4754,23 @@ static void msm_afe_clear_config(void) afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG); } +static struct snd_info_entry *msm_snd_info_create_subdir(struct module *mod, + const char *name, + struct snd_info_entry *parent) +{ + struct snd_info_entry *entry; + + entry = snd_info_create_module_entry(mod, name, parent); + if (!entry) + return NULL; + entry->mode = S_IFDIR | 0555; + if (snd_info_register(entry) < 0) { + snd_info_free_entry(entry); + return NULL; + } + return entry; +} + static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd) { int ret = 0; @@ -4769,7 +4779,6 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai; - struct snd_soc_component *aux_comp; struct snd_card *card = rtd->card->snd_card; struct snd_info_entry *entry; struct msm_asoc_mach_data *pdata = @@ -4877,23 +4886,14 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd) * Send speaker configuration only for WSA8810. * Default configuration is for WSA8815. */ - pr_debug("%s: Number of aux devices: %d\n", - __func__, rtd->card->num_aux_devs); - if (rtd->card->num_aux_devs && - !list_empty(&rtd->card->aux_comp_list)) { - aux_comp = list_first_entry(&rtd->card->aux_comp_list, - struct snd_soc_component, card_aux_list); - if (!strcmp(aux_comp->name, WSA8810_NAME_1) || - !strcmp(aux_comp->name, WSA8810_NAME_2)) { - tavil_set_spkr_mode(component, WCD934X_SPKR_MODE_1); - tavil_set_spkr_gain_offset(component, - WCD934X_RX_GAIN_OFFSET_M1P5_DB); - } - } + + tavil_set_spkr_mode(component, WCD934X_SPKR_MODE_1); + tavil_set_spkr_gain_offset(component, + WCD934X_RX_GAIN_OFFSET_M1P5_DB); card = rtd->card->snd_card; if (!pdata->codec_root) { - entry = snd_info_create_subdir(card->module, "codecs", + entry = msm_snd_info_create_subdir(card->module, "codecs", card->proc_root); if (!entry) { pr_debug("%s: Cannot create codecs module entry\n", @@ -4905,6 +4905,9 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd) } tavil_codec_info_create_codec_entry(pdata->codec_root, component); + tavil_set_port_map(component, + ARRAY_SIZE(sm_port_map_tavil_wsa), sm_port_map_tavil_wsa); + codec_reg_done = true; return 0; err: @@ -4919,7 +4922,6 @@ static int msm_audrx_tasha_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai; - struct snd_soc_component *aux_comp; struct snd_card *card; struct snd_info_entry *entry; struct msm_asoc_mach_data *pdata = @@ -5055,23 +5057,14 @@ static int msm_audrx_tasha_init(struct snd_soc_pcm_runtime *rtd) * Send speaker configuration only for WSA8810. * Default configuration is for WSA8815. */ - pr_debug("%s: Number of aux devices: %d\n", - __func__, rtd->card->num_aux_devs); - if (rtd->card->num_aux_devs && - !list_empty(&rtd->card->aux_comp_list)) { - aux_comp = list_first_entry(&rtd->card->aux_comp_list, - struct snd_soc_component, card_aux_list); - if (!strcmp(aux_comp->name, WSA8810_NAME_1) || - !strcmp(aux_comp->name, WSA8810_NAME_2)) { - tasha_set_spkr_mode(component, SPKR_MODE_1); - tasha_set_spkr_gain_offset(component, - RX_GAIN_OFFSET_M1P5_DB); - } - } + + tasha_set_spkr_mode(component, SPKR_MODE_1); + tasha_set_spkr_gain_offset(component, + RX_GAIN_OFFSET_M1P5_DB); card = rtd->card->snd_card; if (!pdata->codec_root) { - entry = snd_info_create_subdir(card->module, "codecs", + entry = msm_snd_info_create_subdir(card->module, "codecs", card->proc_root); if (!entry) { pr_debug("%s: Cannot create codecs module entry\n", @@ -5089,22 +5082,23 @@ err: return ret; } -static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) +static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) { int ret = 0; - struct snd_soc_component *component; - struct snd_soc_dapm_context *dapm; - struct snd_card *card; + struct snd_soc_component *component = NULL; + struct snd_soc_component *bolero_component = NULL; + struct snd_soc_dapm_context *dapm = NULL; + struct snd_card *card = NULL; struct snd_info_entry *entry; - struct snd_soc_component *aux_comp; struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_dai *codec_dai = rtd->codec_dai; component = snd_soc_rtdcom_lookup(rtd, "bolero_codec"); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; + } else { + bolero_component = component; } dapm = snd_soc_component_get_dapm(component); @@ -5147,25 +5141,15 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) * Send speaker configuration only for WSA8810. * Default configuration is for WSA8815. */ - dev_dbg(component->dev, "%s: Number of aux devices: %d\n", - __func__, rtd->card->num_aux_devs); - if (rtd->card->num_aux_devs && - !list_empty(&rtd->card->aux_comp_list)) { - list_for_each_entry(aux_comp, &rtd->card->aux_comp_list, - card_aux_list) { - if (!strcmp(aux_comp->name, WSA8810_NAME_1) || - !strcmp(aux_comp->name, WSA8810_NAME_2)) { - wsa_macro_set_spkr_mode(component, - WSA_MACRO_SPKR_MODE_1); - wsa_macro_set_spkr_gain_offset(component, - WSA_MACRO_GAIN_OFFSET_M1P5_DB); - break; - } - } - } + + wsa_macro_set_spkr_mode(component, + WSA_MACRO_SPKR_MODE_1); + wsa_macro_set_spkr_gain_offset(component, + WSA_MACRO_GAIN_OFFSET_M1P5_DB); + card = rtd->card->snd_card; if (!pdata->codec_root) { - entry = snd_info_create_subdir(card->module, "codecs", + entry = msm_snd_info_create_subdir(card->module, "codecs", card->proc_root); if (!entry) { pr_debug("%s: Cannot create codecs module entry\n", @@ -5175,7 +5159,7 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) } pdata->codec_root = entry; } - bolero_info_create_codec_entry(pdata->codec_root, codec); + bolero_info_create_codec_entry(pdata->codec_root, component); /* * SM6150 MSM 1.0 doesn't have hardware wake up interrupt line * from AOSS to APSS. So, it uses SW workaround and listens to @@ -5183,11 +5167,10 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) * Check for MSM version and MSM ID and register wake irq * accordingly to provide compatibility to all chipsets. */ - if (socinfo_get_id() == SM6150_SOC_MSM_ID && - socinfo_get_version() == SM6150_SOC_VERSION_1_0) - bolero_register_wake_irq(component, true); - else - bolero_register_wake_irq(component, false); + bolero_register_wake_irq(component, false); + + bolero_set_port_map(bolero_component, + ARRAY_SIZE(sm_port_map), sm_port_map); codec_reg_done = true; return 0; @@ -5850,21 +5833,7 @@ static struct snd_soc_ops sm6150_tdm_be_ops = { static int msm_fe_qos_prepare(struct snd_pcm_substream *substream) { - cpumask_t mask; - - if (pm_qos_request_active(&substream->latency_pm_qos_req)) - pm_qos_remove_request(&substream->latency_pm_qos_req); - - cpumask_clear(&mask); - cpumask_set_cpu(1, &mask); /* affine to core 1 */ - cpumask_set_cpu(2, &mask); /* affine to core 2 */ - cpumask_copy(&substream->latency_pm_qos_req.cpus_affine, &mask); - - substream->latency_pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES; - - pm_qos_add_request(&substream->latency_pm_qos_req, - PM_QOS_CPU_DMA_LATENCY, - MSM_LL_QOS_VALUE); + pr_debug("%s: TODO: add new QOS implementation\n", __func__); return 0; } @@ -6034,43 +6003,37 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { {/* hw:x,0 */ .name = MSM_DAILINK_NAME(Media1), .stream_name = "MultiMedia1", - .cpu_dai_name = "MultiMedia1", - .platform_name = "msm-pcm-dsp.0", .dynamic = 1, +#if IS_ENABLED(CONFIG_AUDIO_QGKI) .async_ops = ASYNC_DPCM_SND_SOC_PREPARE, +#endif /* CONFIG_AUDIO_QGKI */ .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 dainlink has playback support */ .ignore_pmdown_time = 1, - .id = MSM_FRONTEND_DAI_MULTIMEDIA1 + .id = MSM_FRONTEND_DAI_MULTIMEDIA1, + SND_SOC_DAILINK_REG(multimedia1), }, {/* hw:x,1 */ .name = MSM_DAILINK_NAME(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 dainlink has playback support */ .ignore_pmdown_time = 1, .id = MSM_FRONTEND_DAI_MULTIMEDIA2, + SND_SOC_DAILINK_REG(multimedia2), }, {/* hw:x,2 */ .name = "VoiceMMode1", .stream_name = "VoiceMMode1", - .cpu_dai_name = "VoiceMMode1", - .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6079,50 +6042,43 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .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", .id = MSM_FRONTEND_DAI_VOICEMMODE1, + SND_SOC_DAILINK_REG(voicemmode1), }, {/* 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 dainlink has playback support */ .ignore_pmdown_time = 1, .id = MSM_FRONTEND_DAI_VOIP, + SND_SOC_DAILINK_REG(msmvoip), }, {/* hw:x,4 */ .name = MSM_DAILINK_NAME(ULL), .stream_name = "MultiMedia3", - .cpu_dai_name = "MultiMedia3", - .platform_name = "msm-pcm-dsp.2", .dynamic = 1, +#if IS_ENABLED(CONFIG_AUDIO_QGKI) .async_ops = ASYNC_DPCM_SND_SOC_PREPARE, +#endif /* CONFIG_AUDIO_QGKI */ .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 dainlink has playback support */ .ignore_pmdown_time = 1, .id = MSM_FRONTEND_DAI_MULTIMEDIA3, + SND_SOC_DAILINK_REG(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_playback = 1, .dpcm_capture = 1, @@ -6132,54 +6088,44 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_suspend = 1, /* this dailink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(slimbus0_hostless), }, {/* hw:x,6 */ .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", .dpcm_playback = 1, .ignore_suspend = 1, /* this dainlink has playback support */ .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(afepcm_rx), }, {/* hw:x,7 */ .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", .dpcm_capture = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(afepcm_tx), }, {/* hw:x,8 */ .name = MSM_DAILINK_NAME(Compress1), .stream_name = "Compress1", - .cpu_dai_name = "MultiMedia4", - .platform_name = "msm-compress-dsp", .dynamic = 1, +#if IS_ENABLED(CONFIG_AUDIO_QGKI) .async_ops = ASYNC_DPCM_SND_SOC_HW_PARAMS, +#endif /* CONFIG_AUDIO_QGKI */ .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA4, + SND_SOC_DAILINK_REG(multimedia4), }, {/* hw:x,9 */ .name = "AUXPCM Hostless", .stream_name = "AUXPCM Hostless", - .cpu_dai_name = "AUXPCM_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6189,14 +6135,11 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_suspend = 1, /* this dainlink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(auxpcm_hostless), }, {/* hw:x,10 */ .name = "SLIMBUS_1 Hostless", .stream_name = "SLIMBUS_1 Hostless", - .cpu_dai_name = "SLIMBUS1_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6206,14 +6149,11 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_suspend = 1, /* this dailink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(slimbus1_hostless), }, {/* hw:x,11 */ .name = "SLIMBUS_3 Hostless", .stream_name = "SLIMBUS_3 Hostless", - .cpu_dai_name = "SLIMBUS3_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6223,14 +6163,11 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_suspend = 1, /* this dailink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(slimbus3_hostless), }, {/* hw:x,12 */ .name = "SLIMBUS_7 Hostless", .stream_name = "SLIMBUS_7 Hostless", - .cpu_dai_name = "SLIMBUS7_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6240,20 +6177,17 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_suspend = 1, /* this dailink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(slimbus7_hostless), }, {/* hw:x,13 */ .name = MSM_DAILINK_NAME(LowLatency), .stream_name = "MultiMedia5", - .cpu_dai_name = "MultiMedia5", - .platform_name = "msm-pcm-dsp.1", .dynamic = 1, +#if IS_ENABLED(CONFIG_AUDIO_QGKI) .async_ops = ASYNC_DPCM_SND_SOC_PREPARE, +#endif /* CONFIG_AUDIO_QGKI */ .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, @@ -6261,80 +6195,67 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_pmdown_time = 1, .id = MSM_FRONTEND_DAI_MULTIMEDIA5, .ops = &msm_fe_qos_ops, + SND_SOC_DAILINK_REG(multimedia5), }, {/* hw:x,14 */ .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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM1, + SND_SOC_DAILINK_REG(listen1), }, /* Multiple Tunnel instances */ {/* hw:x,15 */ .name = MSM_DAILINK_NAME(Compress2), .stream_name = "Compress2", - .cpu_dai_name = "MultiMedia7", - .platform_name = "msm-compress-dsp", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA7, + SND_SOC_DAILINK_REG(multimedia7), }, {/* hw:x,16 */ .name = MSM_DAILINK_NAME(MultiMedia10), .stream_name = "MultiMedia10", - .cpu_dai_name = "MultiMedia10", - .platform_name = "msm-pcm-dsp.1", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA10, + SND_SOC_DAILINK_REG(multimedia10), }, {/* hw:x,17 */ .name = MSM_DAILINK_NAME(ULL_NOIRQ), .stream_name = "MM_NOIRQ", - .cpu_dai_name = "MultiMedia8", - .platform_name = "msm-pcm-dsp-noirq", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA8, .ops = &msm_fe_qos_ops, + SND_SOC_DAILINK_REG(multimedia8), }, /* HDMI Hostless */ {/* hw:x,18 */ .name = "HDMI_RX_HOSTLESS", .stream_name = "HDMI_RX_HOSTLESS", - .cpu_dai_name = "HDMI_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, @@ -6342,14 +6263,11 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .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", + SND_SOC_DAILINK_REG(hdmi_rx_hostless), }, {/* hw:x,19 */ .name = "VoiceMMode2", .stream_name = "VoiceMMode2", - .cpu_dai_name = "VoiceMMode2", - .platform_name = "msm-pcm-voice", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6358,249 +6276,202 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .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", .id = MSM_FRONTEND_DAI_VOICEMMODE2, + SND_SOC_DAILINK_REG(voicemmode2), }, /* LSM FE */ {/* 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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM2, + SND_SOC_DAILINK_REG(listen2), }, {/* 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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM3, + SND_SOC_DAILINK_REG(listen3), }, {/* 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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM4, + SND_SOC_DAILINK_REG(listen4), }, {/* 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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM5, + SND_SOC_DAILINK_REG(listen5), }, {/* hw:x,24 */ .name = "Listen 6 Audio Service", .stream_name = "Listen 6 Audio Service", - .cpu_dai_name = "LSM6", - .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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM6, + SND_SOC_DAILINK_REG(listen6), }, {/* hw:x,25 */ .name = "Listen 7 Audio Service", .stream_name = "Listen 7 Audio Service", - .cpu_dai_name = "LSM7", - .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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM7, + SND_SOC_DAILINK_REG(listen7), }, {/* hw:x,26 */ .name = "Listen 8 Audio Service", .stream_name = "Listen 8 Audio Service", - .cpu_dai_name = "LSM8", - .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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", .id = MSM_FRONTEND_DAI_LSM8, + SND_SOC_DAILINK_REG(listen8), }, {/* hw:x,27 */ .name = MSM_DAILINK_NAME(Media9), .stream_name = "MultiMedia9", - .cpu_dai_name = "MultiMedia9", - .platform_name = "msm-pcm-dsp.0", .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 dainlink has playback support */ .ignore_pmdown_time = 1, .id = MSM_FRONTEND_DAI_MULTIMEDIA9, + SND_SOC_DAILINK_REG(multimedia9), }, {/* hw:x,28 */ .name = MSM_DAILINK_NAME(Compress4), .stream_name = "Compress4", - .cpu_dai_name = "MultiMedia11", - .platform_name = "msm-compress-dsp", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA11, + SND_SOC_DAILINK_REG(multimedia11), }, {/* hw:x,29 */ .name = MSM_DAILINK_NAME(Compress5), .stream_name = "Compress5", - .cpu_dai_name = "MultiMedia12", - .platform_name = "msm-compress-dsp", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA12, + SND_SOC_DAILINK_REG(multimedia12), }, {/* hw:x,30 */ .name = MSM_DAILINK_NAME(Compress6), .stream_name = "Compress6", - .cpu_dai_name = "MultiMedia13", - .platform_name = "msm-compress-dsp", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA13, + SND_SOC_DAILINK_REG(multimedia13), }, {/* hw:x,31 */ .name = MSM_DAILINK_NAME(Compress7), .stream_name = "Compress7", - .cpu_dai_name = "MultiMedia14", - .platform_name = "msm-compress-dsp", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA14, + SND_SOC_DAILINK_REG(multimedia14), }, {/* hw:x,32 */ .name = MSM_DAILINK_NAME(Compress8), .stream_name = "Compress8", - .cpu_dai_name = "MultiMedia15", - .platform_name = "msm-compress-dsp", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA15, + SND_SOC_DAILINK_REG(multimedia15), }, {/* hw:x,33 */ .name = MSM_DAILINK_NAME(ULL_NOIRQ_2), .stream_name = "MM_NOIRQ_2", - .cpu_dai_name = "MultiMedia16", - .platform_name = "msm-pcm-dsp-noirq", .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, .ignore_pmdown_time = 1, /* this dainlink has playback support */ .id = MSM_FRONTEND_DAI_MULTIMEDIA16, + .ops = &msm_fe_qos_ops, + SND_SOC_DAILINK_REG(multimedia16), }, {/* hw:x,34 */ .name = "SLIMBUS_8 Hostless", .stream_name = "SLIMBUS8_HOSTLESS Capture", - .cpu_dai_name = "SLIMBUS8_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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(slimbus8_hostless), }, {/* hw:x,35 */ .name = "CDC_DMA Hostless", .stream_name = "CDC_DMA Hostless", - .cpu_dai_name = "CDC_DMA_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6610,22 +6481,18 @@ static struct snd_soc_dai_link msm_common_dai_links[] = { .ignore_suspend = 1, /* this dailink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(cdcdma_hostless), }, {/* hw:x,36 */ .name = "TX3_CDC_DMA Hostless", .stream_name = "TX3_CDC_DMA Hostless", - .cpu_dai_name = "TX3_CDC_DMA_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, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(tx3_cdcdma_hostless), }, }; @@ -6633,40 +6500,31 @@ static struct snd_soc_dai_link msm_tavil_fe_dai_links[] = { {/* hw:x,37 */ .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 = "tavil_codec", - .codec_dai_name = "tavil_vifeedback", .id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(lpass_be_slimbus_4_tx), }, /* Ultrasound RX DAI Link */ {/* hw:x,38 */ .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 = "tavil_codec", - .codec_dai_name = "tavil_rx2", .ignore_suspend = 1, .ignore_pmdown_time = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ops = &msm_slimbus_2_be_ops, + SND_SOC_DAILINK_REG(slimbus_2_hostless_playback), }, /* Ultrasound TX DAI Link */ {/* hw:x,39 */ .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 = "tavil_codec", - .codec_dai_name = "tavil_tx2", .ignore_suspend = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ops = &msm_slimbus_2_be_ops, + SND_SOC_DAILINK_REG(slimbus_2_hostless_capture), }, }; @@ -6674,72 +6532,57 @@ static struct snd_soc_dai_link msm_int_compress_capture_dai[] = { { .name = "Compress9", .stream_name = "Compress9", - .cpu_dai_name = "MultiMedia17", - .platform_name = "msm-compress-dsp", .dynamic = 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, .id = MSM_FRONTEND_DAI_MULTIMEDIA17, + SND_SOC_DAILINK_REG(multimedia17), }, { .name = "Compress10", .stream_name = "Compress10", - .cpu_dai_name = "MultiMedia18", - .platform_name = "msm-compress-dsp", .dynamic = 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, .id = MSM_FRONTEND_DAI_MULTIMEDIA18, + SND_SOC_DAILINK_REG(multimedia18), }, { .name = "Compress11", .stream_name = "Compress11", - .cpu_dai_name = "MultiMedia19", - .platform_name = "msm-compress-dsp", .dynamic = 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, .id = MSM_FRONTEND_DAI_MULTIMEDIA19, + SND_SOC_DAILINK_REG(multimedia19), }, { .name = "Compress12", .stream_name = "Compress12", - .cpu_dai_name = "MultiMedia28", - .platform_name = "msm-compress-dsp", .dynamic = 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, .id = MSM_FRONTEND_DAI_MULTIMEDIA28, + SND_SOC_DAILINK_REG(multimedia28), }, { .name = "Compress13", .stream_name = "Compress13", - .cpu_dai_name = "MultiMedia29", - .platform_name = "msm-compress-dsp", .dynamic = 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, .id = MSM_FRONTEND_DAI_MULTIMEDIA29, + SND_SOC_DAILINK_REG(multimedia29), }, }; @@ -6747,15 +6590,12 @@ static struct snd_soc_dai_link msm_bolero_fe_dai_links[] = { {/* hw:x,37 */ .name = LPASS_BE_WSA_CDC_DMA_TX_0, .stream_name = "WSA CDC DMA0 Capture", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45057", - .platform_name = "msm-pcm-hostless", - .codec_name = "bolero_codec", - .codec_dai_name = "wsa_macro_vifeedback", .id = MSM_BACKEND_DAI_WSA_CDC_DMA_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(wsa_cdcdma0_capture), }, }; @@ -6764,64 +6604,50 @@ static struct snd_soc_dai_link msm_tasha_fe_dai_links[] = { { .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", .id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(lpass_be_slimbus_4_tx), }, /* 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, .ignore_pmdown_time = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ops = &msm_slimbus_2_be_ops, + SND_SOC_DAILINK_REG(slimbus_2_hostless_playback), }, /* 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 = &msm_slimbus_2_be_ops, + SND_SOC_DAILINK_REG(slimbus_2_hostless_capture), }, /* 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, - .codec_dai_name = "tasha_mad1", - .codec_name = "tasha_codec", .ops = &msm_ext_cpe_ops, + SND_SOC_DAILINK_REG(cpe_listen_service), }, { .name = "SLIMBUS_6 Hostless Playback", .stream_name = "SLIMBUS_6 Hostless", - .cpu_dai_name = "SLIMBUS6_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, @@ -6830,22 +6656,18 @@ static struct snd_soc_dai_link msm_tasha_fe_dai_links[] = { .ignore_suspend = 1, /* this dailink has playback support */ .ignore_pmdown_time = 1, - .codec_dai_name = "snd-soc-dummy-dai", - .codec_name = "snd-soc-dummy", + SND_SOC_DAILINK_REG(slimbus_6_hostless_playback), }, /* CPE LSM EC PP direct dai-link */ { .name = "CPE Listen service ECPP", .stream_name = "CPE Listen Audio Service ECPP", - .cpu_dai_name = "CPE_LSM_NOHOST", - .platform_name = "msm-cpe-lsm.3", .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 = "tasha_cpe", - .codec_name = "tasha_codec", + SND_SOC_DAILINK_REG(cpe_listen_service_ecpp), }, }; @@ -6853,25 +6675,20 @@ static struct snd_soc_dai_link msm_common_misc_fe_dai_links[] = { { .name = MSM_DAILINK_NAME(ASM Loopback), .stream_name = "MultiMedia6", - .cpu_dai_name = "MultiMedia6", - .platform_name = "msm-pcm-loopback", .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, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_pmdown_time = 1, .id = MSM_FRONTEND_DAI_MULTIMEDIA6, + SND_SOC_DAILINK_REG(multimedia6), }, { .name = "USB Audio Hostless", .stream_name = "USB Audio Hostless", - .cpu_dai_name = "USBAUDIO_HOSTLESS", - .platform_name = "msm-pcm-hostless", .dynamic = 1, .dpcm_playback = 1, .dpcm_capture = 1, @@ -6880,8 +6697,7 @@ static struct snd_soc_dai_link msm_common_misc_fe_dai_links[] = { .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", + SND_SOC_DAILINK_REG(usbaudio_hostless), }, }; @@ -6890,10 +6706,6 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { { .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, .id = MSM_BACKEND_DAI_AFE_PCM_RX, @@ -6901,112 +6713,91 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { /* this dainlink has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(afe_pcm_rx), }, { .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, .id = MSM_BACKEND_DAI_AFE_PCM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(afe_pcm_tx), }, /* 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, .id = MSM_BACKEND_DAI_INCALL_RECORD_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(incall_record_tx), }, /* 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, .id = MSM_BACKEND_DAI_INCALL_RECORD_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(incall_record_rx), }, /* 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_playback = 1, .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(voice_playback_tx), }, /* 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_playback = 1, .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(voice2_playback_tx), }, { .name = LPASS_BE_USB_AUDIO_RX, .stream_name = "USB Audio Playback", - .cpu_dai_name = "msm-dai-q6-dev.28672", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-rx", +#if IS_ENABLED(CONFIG_AUDIO_QGKI) + .dynamic_be = 1, +#endif /* CONFIG_AUDIO_QGKI */ .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_USB_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(usb_audio_rx), }, { .name = LPASS_BE_USB_AUDIO_TX, .stream_name = "USB Audio Capture", - .cpu_dai_name = "msm-dai-q6-dev.28673", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_USB_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(usb_audio_tx), }, { .name = LPASS_BE_PRI_TDM_RX_0, .stream_name = "Primary TDM0 Playback", - .cpu_dai_name = "msm-dai-q6-tdm.36864", - .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_PRI_TDM_RX_0, @@ -7014,28 +6805,22 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(pri_tdm_rx_0), }, { .name = LPASS_BE_PRI_TDM_TX_0, .stream_name = "Primary TDM0 Capture", - .cpu_dai_name = "msm-dai-q6-tdm.36865", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_PRI_TDM_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(pri_tdm_tx_0), }, { .name = LPASS_BE_SEC_TDM_RX_0, .stream_name = "Secondary TDM0 Playback", - .cpu_dai_name = "msm-dai-q6-tdm.36880", - .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_0, @@ -7043,28 +6828,22 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(sec_tdm_rx_0), }, { .name = LPASS_BE_SEC_TDM_TX_0, .stream_name = "Secondary TDM0 Capture", - .cpu_dai_name = "msm-dai-q6-tdm.36881", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SEC_TDM_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(sec_tdm_tx_0), }, { .name = LPASS_BE_TERT_TDM_RX_0, .stream_name = "Tertiary TDM0 Playback", - .cpu_dai_name = "msm-dai-q6-tdm.36896", - .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_TERT_TDM_RX_0, @@ -7072,28 +6851,22 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(tert_tdm_rx_0), }, { .name = LPASS_BE_TERT_TDM_TX_0, .stream_name = "Tertiary TDM0 Capture", - .cpu_dai_name = "msm-dai-q6-tdm.36897", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_TERT_TDM_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(tert_tdm_tx_0), }, { .name = LPASS_BE_QUAT_TDM_RX_0, .stream_name = "Quaternary TDM0 Playback", - .cpu_dai_name = "msm-dai-q6-tdm.36912", - .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_0, @@ -7101,28 +6874,22 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quat_tdm_rx_0), }, { .name = LPASS_BE_QUAT_TDM_TX_0, .stream_name = "Quaternary TDM0 Capture", - .cpu_dai_name = "msm-dai-q6-tdm.36913", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quat_tdm_tx_0), }, { .name = LPASS_BE_QUIN_TDM_RX_0, .stream_name = "Quinary TDM0 Playback", - .cpu_dai_name = "msm-dai-q6-tdm.36928", - .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_QUIN_TDM_RX_0, @@ -7130,20 +6897,18 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = { .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quin_tdm_rx_0), }, { .name = LPASS_BE_QUIN_TDM_TX_0, .stream_name = "Quinary TDM0 Capture", - .cpu_dai_name = "msm-dai-q6-tdm.36929", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_QUIN_TDM_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &sm6150_tdm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quin_tdm_tx_0), }, }; @@ -7151,10 +6916,6 @@ static struct snd_soc_dai_link msm_tavil_be_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 = "tavil_codec", - .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_0_RX, @@ -7164,28 +6925,23 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_be_ops, + SND_SOC_DAILINK_REG(slimbus_0_rx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_tx1", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_0_TX, + .init = &msm_wsa881x_init, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_be_ops, + SND_SOC_DAILINK_REG(slimbus_0_tx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_1_RX, @@ -7194,28 +6950,22 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_1_rx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_tx3", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_1_tx), }, { .name = LPASS_BE_SLIMBUS_2_RX, .stream_name = "Slimbus2 Playback", - .cpu_dai_name = "msm-dai-q6-dev.16388", - .platform_name = "msm-pcm-routing", - .codec_name = "tavil_codec", - .codec_dai_name = "tavil_rx2", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_2_RX, @@ -7223,14 +6973,11 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { .ops = &msm_be_ops, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_2_rx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_3_RX, @@ -7239,28 +6986,22 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_3_rx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_tx1", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_3_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_3_tx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_4_RX, @@ -7269,14 +7010,11 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_4_rx), }, { .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 = "tavil_codec", - .codec_dai_name = "tavil_rx3", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_5_RX, @@ -7285,29 +7023,23 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_5_rx), }, /* 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 = "tavil_codec", - .codec_dai_name = "tavil_mad1", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_5_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_5_tx), }, { .name = LPASS_BE_SLIMBUS_6_RX, .stream_name = "Slimbus6 Playback", - .cpu_dai_name = "msm-dai-q6-dev.16396", - .platform_name = "msm-pcm-routing", - .codec_name = "tavil_codec", - .codec_dai_name = "tavil_rx4", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_6_RX, @@ -7316,21 +7048,19 @@ static struct snd_soc_dai_link msm_tavil_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_6_rx), }, /* Slimbus VI Recording */ { .name = LPASS_BE_SLIMBUS_TX_VI, .stream_name = "Slimbus4 Capture", - .cpu_dai_name = "msm-dai-q6-dev.16393", - .platform_name = "msm-pcm-routing", - .codec_name = "tavil_codec", - .codec_dai_name = "tavil_vifeedback", .id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, .no_pcm = 1, .dpcm_capture = 1, + SND_SOC_DAILINK_REG(slimbus_tx_vi), }, }; @@ -7339,10 +7069,6 @@ static struct snd_soc_dai_link msm_tasha_be_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, .id = MSM_BACKEND_DAI_SLIMBUS_0_RX, @@ -7352,28 +7078,23 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_be_ops, + SND_SOC_DAILINK_REG(slimbus_0_rx), }, { .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, .id = MSM_BACKEND_DAI_SLIMBUS_0_TX, + .init = &msm_wsa881x_init, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_be_ops, + SND_SOC_DAILINK_REG(slimbus_0_tx), }, { .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, .id = MSM_BACKEND_DAI_SLIMBUS_1_RX, @@ -7382,28 +7103,22 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_1_rx), }, { .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, .id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_1_tx), }, { .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, .id = MSM_BACKEND_DAI_SLIMBUS_3_RX, @@ -7412,14 +7127,11 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_3_rx), }, { .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, @@ -7427,14 +7139,11 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_3_tx), }, { .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, .id = MSM_BACKEND_DAI_SLIMBUS_4_RX, @@ -7443,14 +7152,11 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_4_rx), }, { .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, .id = MSM_BACKEND_DAI_SLIMBUS_5_RX, @@ -7459,29 +7165,23 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_5_rx), }, /* 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, .id = MSM_BACKEND_DAI_SLIMBUS_5_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_5_tx), }, { .name = LPASS_BE_SLIMBUS_6_RX, .stream_name = "Slimbus6 Playback", - .cpu_dai_name = "msm-dai-q6-dev.16396", - .platform_name = "msm-pcm-routing", - .codec_name = "tasha_codec", - .codec_dai_name = "tasha_rx4", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_6_RX, @@ -7490,21 +7190,18 @@ static struct snd_soc_dai_link msm_tasha_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_6_rx), }, }; static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { { - .name = LPASS_BE_SLIMBUS_7_RX, + .name = LPASS_BE_SLIMBUS_TX_VI, .stream_name = "Slimbus7 Playback", - .cpu_dai_name = "msm-dai-q6-dev.16398", - .platform_name = "msm-pcm-routing", - .codec_name = "btfmslim_slave", /* BT codec driver determines capabilities based on * dai name, bt codecdai name should always contains * supported usecase information */ - .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_7_RX, @@ -7513,28 +7210,22 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { /* dai link has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_7_rx), }, { .name = LPASS_BE_SLIMBUS_7_TX, .stream_name = "Slimbus7 Capture", - .cpu_dai_name = "msm-dai-q6-dev.16399", - .platform_name = "msm-pcm-routing", - .codec_name = "btfmslim_slave", - .codec_dai_name = "btfm_bt_sco_slim_tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_7_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_wcn_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_7_tx), }, { .name = LPASS_BE_SLIMBUS_8_TX, .stream_name = "Slimbus8 Capture", - .cpu_dai_name = "msm-dai-q6-dev.16401", - .platform_name = "msm-pcm-routing", - .codec_name = "btfmslim_slave", - .codec_dai_name = "btfm_fm_slim_tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_8_TX, @@ -7542,35 +7233,31 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .init = &msm_wcn_init, .ops = &msm_wcn_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(slimbus_8_tx), }, }; +#if IS_ENABLED(CONFIG_AUDIO_QGKI) static struct snd_soc_dai_link ext_disp_be_dai_link[] = { /* DISP PORT BACK END DAI Link */ { .name = LPASS_BE_DISPLAY_PORT, .stream_name = "Display Port Playback", - .cpu_dai_name = "msm-dai-q6-dp.24608", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-ext-disp-audio-codec-rx", - .codec_dai_name = "msm_dp_audio_codec_rx_dai", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(ext_display_port), }, }; +#endif static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { { .name = LPASS_BE_PRI_MI2S_RX, .stream_name = "Primary MI2S Playback", - .cpu_dai_name = "msm-dai-q6-mi2s.0", - .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_PRI_MI2S_RX, @@ -7578,28 +7265,22 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(pri_mi2s_rx), }, { .name = LPASS_BE_PRI_MI2S_TX, .stream_name = "Primary MI2S Capture", - .cpu_dai_name = "msm-dai-q6-mi2s.0", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_PRI_MI2S_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(pri_mi2s_tx), }, { .name = LPASS_BE_SEC_MI2S_RX, .stream_name = "Secondary MI2S Playback", - .cpu_dai_name = "msm-dai-q6-mi2s.1", - .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_SECONDARY_MI2S_RX, @@ -7607,28 +7288,22 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(sec_mi2s_rx), }, { .name = LPASS_BE_SEC_MI2S_TX, .stream_name = "Secondary MI2S Capture", - .cpu_dai_name = "msm-dai-q6-mi2s.1", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(sec_mi2s_tx), }, { .name = LPASS_BE_TERT_MI2S_RX, .stream_name = "Tertiary MI2S Playback", - .cpu_dai_name = "msm-dai-q6-mi2s.2", - .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_TERTIARY_MI2S_RX, @@ -7636,28 +7311,22 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(tert_mi2s_rx), }, { .name = LPASS_BE_TERT_MI2S_TX, .stream_name = "Tertiary MI2S Capture", - .cpu_dai_name = "msm-dai-q6-mi2s.2", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(tert_mi2s_tx), }, { .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_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX, @@ -7665,28 +7334,22 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quat_mi2s_rx), }, { .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_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quat_mi2s_tx), }, { .name = LPASS_BE_QUIN_MI2S_RX, .stream_name = "Quinary MI2S Playback", - .cpu_dai_name = "msm-dai-q6-mi2s.4", - .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_QUINARY_MI2S_RX, @@ -7694,20 +7357,18 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, .ignore_pmdown_time = 1, + SND_SOC_DAILINK_REG(quin_mi2s_rx), }, { .name = LPASS_BE_QUIN_MI2S_TX, .stream_name = "Quinary MI2S Capture", - .cpu_dai_name = "msm-dai-q6-mi2s.4", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_QUINARY_MI2S_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quin_mi2s_tx), }, }; @@ -7717,140 +7378,110 @@ static struct snd_soc_dai_link msm_auxpcm_be_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, .id = MSM_BACKEND_DAI_AUXPCM_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(auxpcm_rx), }, { .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, .id = MSM_BACKEND_DAI_AUXPCM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(auxpcm_tx), }, /* Secondary AUX PCM Backend DAI Links */ { .name = LPASS_BE_SEC_AUXPCM_RX, .stream_name = "Sec AUX PCM Playback", - .cpu_dai_name = "msm-dai-q6-auxpcm.2", - .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_AUXPCM_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(sec_auxpcm_rx), }, { .name = LPASS_BE_SEC_AUXPCM_TX, .stream_name = "Sec AUX PCM Capture", - .cpu_dai_name = "msm-dai-q6-auxpcm.2", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(sec_auxpcm_tx), }, /* Tertiary AUX PCM Backend DAI Links */ { .name = LPASS_BE_TERT_AUXPCM_RX, .stream_name = "Tert AUX PCM Playback", - .cpu_dai_name = "msm-dai-q6-auxpcm.3", - .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_TERT_AUXPCM_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(tert_auxpcm_rx), }, { .name = LPASS_BE_TERT_AUXPCM_TX, .stream_name = "Tert AUX PCM Capture", - .cpu_dai_name = "msm-dai-q6-auxpcm.3", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(tert_auxpcm_tx), }, /* Quaternary AUX PCM Backend DAI Links */ { .name = LPASS_BE_QUAT_AUXPCM_RX, .stream_name = "Quat AUX PCM Playback", - .cpu_dai_name = "msm-dai-q6-auxpcm.4", - .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_AUXPCM_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quat_auxpcm_rx), }, { .name = LPASS_BE_QUAT_AUXPCM_TX, .stream_name = "Quat AUX PCM Capture", - .cpu_dai_name = "msm-dai-q6-auxpcm.4", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quat_auxpcm_tx), }, /* Quinary AUX PCM Backend DAI Links */ { .name = LPASS_BE_QUIN_AUXPCM_RX, .stream_name = "Quin AUX PCM Playback", - .cpu_dai_name = "msm-dai-q6-auxpcm.5", - .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_QUIN_AUXPCM_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quin_auxpcm_rx), }, { .name = LPASS_BE_QUIN_AUXPCM_TX, .stream_name = "Quin AUX PCM Capture", - .cpu_dai_name = "msm-dai-q6-auxpcm.5", - .platform_name = "msm-pcm-routing", - .codec_name = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_QUIN_AUXPCM_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, + SND_SOC_DAILINK_REG(quin_auxpcm_tx), }, }; @@ -7859,26 +7490,19 @@ static struct snd_soc_dai_link msm_wsa_cdc_dma_be_dai_links[] = { { .name = LPASS_BE_WSA_CDC_DMA_RX_0, .stream_name = "WSA CDC DMA0 Playback", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45056", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "wsa_macro_rx1", .no_pcm = 1, .dpcm_playback = 1, - .init = &msm_int_audrx_init, + .init = &msm_wsa881x_init, .id = MSM_BACKEND_DAI_WSA_CDC_DMA_RX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(wsa_dma_rx0), }, { .name = LPASS_BE_WSA_CDC_DMA_RX_1, .stream_name = "WSA CDC DMA1 Playback", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45058", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "wsa_macro_rx_mix", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_WSA_CDC_DMA_RX_1, @@ -7886,20 +7510,18 @@ static struct snd_soc_dai_link msm_wsa_cdc_dma_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(wsa_dma_rx1), }, { .name = LPASS_BE_WSA_CDC_DMA_TX_1, .stream_name = "WSA CDC DMA1 Capture", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45059", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "wsa_macro_echo", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_WSA_CDC_DMA_TX_1, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(wsa_dma_tx1), }, }; @@ -7908,10 +7530,6 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = { { .name = LPASS_BE_RX_CDC_DMA_RX_0, .stream_name = "RX CDC DMA0 Playback", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45104", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "rx_macro_rx1", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_RX_CDC_DMA_RX_0, @@ -7919,14 +7537,12 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_rx0), + .init = &msm_rx_tx_codec_init, }, { .name = LPASS_BE_RX_CDC_DMA_RX_1, .stream_name = "RX CDC DMA1 Playback", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45106", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "rx_macro_rx2", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_RX_CDC_DMA_RX_1, @@ -7934,14 +7550,11 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_rx1), }, { .name = LPASS_BE_RX_CDC_DMA_RX_2, .stream_name = "RX CDC DMA2 Playback", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45108", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "rx_macro_rx3", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_RX_CDC_DMA_RX_2, @@ -7949,14 +7562,11 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_rx2), }, { .name = LPASS_BE_RX_CDC_DMA_RX_3, .stream_name = "RX CDC DMA3 Playback", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45110", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "rx_macro_rx4", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_RX_CDC_DMA_RX_3, @@ -7964,49 +7574,41 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = { .ignore_pmdown_time = 1, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_rx3), }, /* TX CDC DMA Backend DAI Links */ { .name = LPASS_BE_TX_CDC_DMA_TX_0, .stream_name = "TX CDC DMA0 Capture", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45105", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "rx_macro_echo", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_TX_CDC_DMA_TX_0, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_tx0), }, { .name = LPASS_BE_TX_CDC_DMA_TX_3, .stream_name = "TX CDC DMA3 Capture", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45111", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "tx_macro_tx1", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_TX_CDC_DMA_TX_3, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_tx3), }, { .name = LPASS_BE_TX_CDC_DMA_TX_4, .stream_name = "TX CDC DMA4 Capture", - .cpu_dai_name = "msm-dai-cdc-dma-dev.45113", - .platform_name = "msm-pcm-routing", - .codec_name = "bolero_codec", - .codec_dai_name = "tx_macro_tx2", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_TX_CDC_DMA_TX_4, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_cdc_dma_be_ops, + SND_SOC_DAILINK_REG(rx_dma_tx4), }, }; @@ -8021,7 +7623,9 @@ static struct snd_soc_dai_link msm_sm6150_dai_links[ ARRAY_SIZE(msm_tavil_be_dai_links) + ARRAY_SIZE(msm_tasha_be_dai_links) + ARRAY_SIZE(msm_wcn_be_dai_links) + +#if IS_ENABLED(CONFIG_AUDIO_QGKI) ARRAY_SIZE(ext_disp_be_dai_link) + +#endif ARRAY_SIZE(msm_mi2s_be_dai_links) + ARRAY_SIZE(msm_auxpcm_be_dai_links) + ARRAY_SIZE(msm_wsa_cdc_dma_be_dai_links) + @@ -8119,82 +7723,139 @@ err_pcm_runtime: static int msm_populate_dai_link_component_of_node( struct snd_soc_card *card) { - int i, index, ret = 0; + int i, j, index, ret = 0; struct device *cdev = card->dev; struct snd_soc_dai_link *dai_link = card->dai_link; - struct device_node *np; + struct device_node *np = NULL; + int codecs_enabled = 0; + struct snd_soc_dai_link_component *codecs_comp = NULL; if (!cdev) { - pr_err("%s: Sound card device memory NULL\n", __func__); + dev_err(cdev, "%s: Sound card device memory NULL\n", __func__); return -ENODEV; } for (i = 0; i < card->num_links; i++) { - if (dai_link[i].platform_of_node && dai_link[i].cpu_of_node) + if (dai_link[i].platforms->of_node && dai_link[i].cpus->of_node) continue; /* populate platform_of_node for snd card dai links */ - if (dai_link[i].platform_name && - !dai_link[i].platform_of_node) { + if (dai_link[i].platforms->name && + !dai_link[i].platforms->of_node) { index = of_property_match_string(cdev->of_node, "asoc-platform-names", - dai_link[i].platform_name); + dai_link[i].platforms->name); if (index < 0) { - pr_err("%s: No match found for platform name: %s\n", - __func__, dai_link[i].platform_name); + dev_err(cdev, "%s: No match found for platform name: %s\n", + __func__, dai_link[i].platforms->name); ret = index; goto err; } np = of_parse_phandle(cdev->of_node, "asoc-platform", index); if (!np) { - pr_err("%s: retrieving phandle for platform %s, index %d failed\n", - __func__, dai_link[i].platform_name, + dev_err(cdev, "%s: retrieving phandle for platform %s, index %d failed\n", + __func__, dai_link[i].platforms->name, index); ret = -ENODEV; goto err; } - dai_link[i].platform_of_node = np; - dai_link[i].platform_name = NULL; + dai_link[i].platforms->of_node = np; + dai_link[i].platforms->name = NULL; } /* populate cpu_of_node for snd card dai links */ - if (dai_link[i].cpu_dai_name && !dai_link[i].cpu_of_node) { + if (dai_link[i].cpus->dai_name && !dai_link[i].cpus->of_node) { index = of_property_match_string(cdev->of_node, "asoc-cpu-names", - dai_link[i].cpu_dai_name); + dai_link[i].cpus->dai_name); if (index >= 0) { np = of_parse_phandle(cdev->of_node, "asoc-cpu", index); if (!np) { - pr_err("%s: retrieving phandle for cpu dai %s failed\n", + dev_err(cdev, "%s: retrieving phandle for cpu dai %s failed\n", __func__, - dai_link[i].cpu_dai_name); + dai_link[i].cpus->dai_name); ret = -ENODEV; goto err; } - dai_link[i].cpu_of_node = np; - dai_link[i].cpu_dai_name = NULL; + dai_link[i].cpus->of_node = np; + dai_link[i].cpus->dai_name = NULL; } } /* populate codec_of_node for snd card dai links */ - if (dai_link[i].codec_name && !dai_link[i].codec_of_node) { - index = of_property_match_string(cdev->of_node, - "asoc-codec-names", - dai_link[i].codec_name); - if (index < 0) - continue; - np = of_parse_phandle(cdev->of_node, "asoc-codec", - index); - if (!np) { - pr_err("%s: retrieving phandle for codec %s failed\n", - __func__, dai_link[i].codec_name); - ret = -ENODEV; - goto err; + if (dai_link[i].num_codecs > 0) { + for (j = 0; j < dai_link[i].num_codecs; j++) { + if (dai_link[i].codecs[j].of_node || + !dai_link[i].codecs[j].name) + continue; + + index = of_property_match_string(cdev->of_node, + "asoc-codec-names", + dai_link[i].codecs[j].name); + if (index < 0) + continue; + np = of_parse_phandle(cdev->of_node, + "asoc-codec", + index); + if (!np) { + dev_err(cdev, "%s: retrieving phandle for codec %s failed\n", + __func__, + dai_link[i].codecs[j].name); + ret = -ENODEV; + goto err; + } + dai_link[i].codecs[j].of_node = np; + dai_link[i].codecs[j].name = NULL; + } + } + } + + /* In multi-codec scenario, check if codecs are enabled for this platform */ + for (i = 0; i < card->num_links; i++) { + codecs_enabled = 0; + if (dai_link[i].num_codecs > 1) { + for (j = 0; j < dai_link[i].num_codecs; j++) { + if (!dai_link[i].codecs[j].of_node) + continue; + + np = dai_link[i].codecs[j].of_node; + if (!of_device_is_available(np)) { + dev_dbg(cdev, "%s: codec is disabled: %s\n", + __func__, + np->full_name); + dai_link[i].codecs[j].of_node = NULL; + continue; + } + + codecs_enabled++; + } + if (codecs_enabled > 0 && + codecs_enabled < dai_link[i].num_codecs) { + codecs_comp = devm_kzalloc(cdev, + sizeof(struct snd_soc_dai_link_component) + * codecs_enabled, GFP_KERNEL); + if (!codecs_comp) { + dev_err(cdev, "%s: %s dailink codec component alloc failed\n", + __func__, dai_link[i].name); + ret = -ENOMEM; + goto err; + } + index = 0; + for (j = 0; j < dai_link[i].num_codecs; j++) { + if(dai_link[i].codecs[j].of_node) { + codecs_comp[index].of_node = + dai_link[i].codecs[j].of_node; + codecs_comp[index].dai_name = + dai_link[i].codecs[j].dai_name; + codecs_comp[index].name = NULL; + index++; + } + } + dai_link[i].codecs = codecs_comp; + dai_link[i].num_codecs = codecs_enabled; } - dai_link[i].codec_of_node = np; - dai_link[i].codec_name = NULL; } } @@ -8262,20 +7923,19 @@ static struct snd_soc_dai_link msm_stub_fe_dai_links[] = { { .name = "MSMSTUB Media1", .stream_name = "MultiMedia1", - .cpu_dai_name = "MultiMedia1", - .platform_name = "msm-pcm-dsp.0", .dynamic = 1, +#if IS_ENABLED(CONFIG_AUDIO_QGKI) .async_ops = ASYNC_DPCM_SND_SOC_PREPARE, +#endif /* CONFIG_AUDIO_QGKI */ .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 dainlink has playback support */ .ignore_pmdown_time = 1, - .id = MSM_FRONTEND_DAI_MULTIMEDIA1 + .id = MSM_FRONTEND_DAI_MULTIMEDIA1, + SND_SOC_DAILINK_REG(multimedia1), }, }; @@ -8285,10 +7945,6 @@ static struct snd_soc_dai_link msm_stub_be_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 = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, .id = MSM_BACKEND_DAI_SLIMBUS_0_RX, @@ -8297,20 +7953,18 @@ static struct snd_soc_dai_link msm_stub_be_dai_links[] = { .ignore_pmdown_time = 1, /* dai link has playback support */ .ignore_suspend = 1, .ops = &msm_stub_be_ops, + SND_SOC_DAILINK_REG(slimbus_0_rx), }, { .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 = "msm-stub-codec.1", - .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, .id = MSM_BACKEND_DAI_SLIMBUS_0_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_stub_be_ops, + SND_SOC_DAILINK_REG(slimbus_0_tx), }, }; @@ -8335,8 +7989,8 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) struct snd_soc_card *card = NULL; struct snd_soc_dai_link *dailink; int total_links = 0, rc = 0; - u32 tavil_codec = 0, auxpcm_audio_intf = 0; - u32 mi2s_audio_intf = 0, ext_disp_audio_intf = 0; + u32 tavil_codec = 0, val = 0; + u32 mi2s_audio_intf = 0; u32 wcn_btfm_intf = 0; const struct of_device_id *match; u32 tasha_codec = 0; @@ -8434,14 +8088,15 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) ARRAY_SIZE(msm_rx_tx_cdc_dma_be_dai_links); } +#if IS_ENABLED(CONFIG_AUDIO_QGKI) rc = of_property_read_u32(dev->of_node, "qcom,ext-disp-audio-rx", - &ext_disp_audio_intf); + &val); if (rc) { dev_dbg(dev, "%s: No DT match Ext Disp interface\n", __func__); } else { - if (ext_disp_audio_intf) { + if (val) { memcpy(msm_sm6150_dai_links + total_links, ext_disp_be_dai_link, sizeof(ext_disp_be_dai_link)); @@ -8449,6 +8104,7 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) ARRAY_SIZE(ext_disp_be_dai_link); } } +#endif rc = of_property_read_u32(dev->of_node, "qcom,mi2s-audio-intf", &mi2s_audio_intf); @@ -8483,12 +8139,12 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) rc = of_property_read_u32(dev->of_node, "qcom,auxpcm-audio-intf", - &auxpcm_audio_intf); + &val); if (rc) { dev_dbg(dev, "%s: No DT match Aux PCM interface\n", __func__); } else { - if (auxpcm_audio_intf) { + if (val) { memcpy(msm_sm6150_dai_links + total_links, msm_auxpcm_be_dai_links, sizeof(msm_auxpcm_be_dai_links)); @@ -8522,7 +8178,7 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) return card; } -static int msm_wsa881x_init(struct snd_soc_component *component) +static int msm_wsa881x_init(struct snd_soc_pcm_runtime *rtd) { u8 spkleft_ports[WSA881X_MAX_SWR_PORTS] = {0, 1, 2, 3}; u8 spkright_ports[WSA881X_MAX_SWR_PORTS] = {0, 1, 2, 3}; @@ -8532,22 +8188,21 @@ static int msm_wsa881x_init(struct snd_soc_component *component) SPKR_R_BOOST, SPKR_R_VI}; unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200}; unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3}; - struct msm_asoc_mach_data *pdata; - struct snd_soc_dapm_context *dapm; - struct snd_card *card = component->card->snd_card; - struct snd_info_entry *entry; - int ret = 0; + struct snd_soc_component *component = NULL; + struct msm_asoc_mach_data *pdata = + snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_dapm_context *dapm = NULL; - if (!component) { - pr_err("%s codec is NULL\n", __func__); - return -EINVAL; - } - dapm = snd_soc_component_get_dapm(component); + if (pdata->wsa_max_devs > 0) { + component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.1"); + if (!component) { + pr_err("%s: wsa-codec.1 component is NULL\n", __func__); + return -EINVAL; + } + + dapm = snd_soc_component_get_dapm(component); - if (!strcmp(component->name_prefix, "SpkrLeft")) { - dev_dbg(component->dev, "%s: setting left ch map to codec %s\n", - __func__, component->name); wsa881x_set_channel_map(component, &spkleft_ports[0], WSA881X_MAX_SWR_PORTS, &ch_mask[0], &ch_rate[0], &spkleft_port_types[0]); @@ -8555,9 +8210,20 @@ static int msm_wsa881x_init(struct snd_soc_component *component) snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN"); snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR"); } - } else if (!strcmp(component->name_prefix, "SpkrRight")) { - dev_dbg(component->dev, "%s: setting right ch map to codec %s\n", - __func__, component->name); + wsa881x_codec_info_create_codec_entry(pdata->codec_root, + component); + } + + /* If current platform has more than one WSA */ + if (pdata->wsa_max_devs > 1) { + component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.2"); + if (!component) { + pr_err("%s: wsa-codec.2 component is NULL\n", __func__); + return -EINVAL; + } + + dapm = snd_soc_component_get_dapm(component); + wsa881x_set_channel_map(component, &spkright_ports[0], WSA881X_MAX_SWR_PORTS, &ch_mask[0], &ch_rate[0], &spkright_port_types[0]); @@ -8565,367 +8231,12 @@ static int msm_wsa881x_init(struct snd_soc_component *component) snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN"); snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR"); } - } else { - dev_err(component->dev, "%s: wrong codec name %s\n", __func__, - component->name); - ret = -EINVAL; - goto err; + wsa881x_codec_info_create_codec_entry(pdata->codec_root, + component); } - pdata = snd_soc_card_get_drvdata(component->card); - if (!pdata->codec_root) { - entry = snd_info_create_subdir(card->module, "codecs", - card->proc_root); - if (!entry) { - pr_err("%s: Cannot create codecs module entry\n", - __func__); - ret = 0; - goto err; - } - pdata->codec_root = entry; - } - wsa881x_codec_info_create_codec_entry(pdata->codec_root, - component); -err: - return ret; + + return 0; } - -static int msm_aux_codec_init(struct snd_soc_component *component) -{ - struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); - int ret = 0; - void *mbhc_calibration; - struct snd_info_entry *entry; - struct snd_card *card = component->card->snd_card; - struct msm_asoc_mach_data *pdata; - - snd_soc_dapm_ignore_suspend(dapm, "EAR"); - snd_soc_dapm_ignore_suspend(dapm, "AUX"); - snd_soc_dapm_ignore_suspend(dapm, "HPHL"); - snd_soc_dapm_ignore_suspend(dapm, "HPHR"); - snd_soc_dapm_ignore_suspend(dapm, "AMIC1"); - snd_soc_dapm_ignore_suspend(dapm, "AMIC2"); - snd_soc_dapm_ignore_suspend(dapm, "AMIC3"); - snd_soc_dapm_sync(dapm); - - pdata = snd_soc_card_get_drvdata(component->card); - if (!pdata->codec_root) { - entry = snd_info_create_subdir(card->module, "codecs", - card->proc_root); - if (!entry) { - pr_err("%s: Cannot create codecs module entry\n", - __func__); - ret = 0; - goto codec_root_err; - } - pdata->codec_root = entry; - } - wcd937x_info_create_codec_entry(pdata->codec_root, component); -codec_root_err: - mbhc_calibration = def_wcd_mbhc_cal(); - if (!mbhc_calibration) { - return -ENOMEM; - } - wcd_mbhc_cfg.calibration = mbhc_calibration; - ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); - - return ret; -} - -static int msm_init_aux_dev(struct platform_device *pdev, - struct snd_soc_card *card) -{ - struct device_node *wsa_of_node; - struct device_node *aux_codec_of_node; - u32 wsa_max_devs; - u32 wsa_dev_cnt; - u32 codec_max_aux_devs = 0; - u32 codec_aux_dev_cnt = 0; - int i; - struct msm_wsa881x_dev_info *wsa881x_dev_info = NULL; - struct aux_codec_dev_info *aux_cdc_dev_info = NULL; - const char *auxdev_name_prefix[1]; - char *dev_name_str = NULL; - int found = 0; - int codecs_found = 0; - int ret = 0; - - /* 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_err(&pdev->dev, - "%s: wsa-max-devs property missing in DT %s, ret = %d\n", - __func__, pdev->dev.of_node->full_name, ret); - wsa_max_devs = 0; - goto codec_aux_dev; - } - if (wsa_max_devs == 0) { - dev_dbg(&pdev->dev, - "%s: Max WSA devices is 0 for this target?\n", - __func__); - goto codec_aux_dev; - } - - /* 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__); - goto err; - } 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); - ret = -EINVAL; - goto err; - } - - /* - * 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); - ret = -EINVAL; - goto err; - } - - /* - * 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 msm_wsa881x_dev_info), - GFP_KERNEL); - if (!wsa881x_dev_info) { - ret = -ENOMEM; - goto err; - } - - /* - * 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__); - ret = -EINVAL; - goto err; - } - if (soc_find_component_locked(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); - -codec_aux_dev: - if (!strnstr(card->name, "tavil", strlen(card->name)) && - !strnstr(card->name, "tasha", strlen(card->name))) { - /* Get maximum aux codec device count for this platform */ - ret = of_property_read_u32(pdev->dev.of_node, - "qcom,codec-max-aux-devs", - &codec_max_aux_devs); - if (ret) { - dev_err(&pdev->dev, - "%s: codec-max-aux-devs property missing in DT %s, ret = %d\n", - __func__, pdev->dev.of_node->full_name, ret); - codec_max_aux_devs = 0; - goto aux_dev_register; - } - if (codec_max_aux_devs == 0) { - dev_dbg(&pdev->dev, - "%s: Max aux codec devices is 0 for this target?\n", - __func__); - goto aux_dev_register; - } - - /* Get count of aux codec device phandles for this platform */ - codec_aux_dev_cnt = of_count_phandle_with_args( - pdev->dev.of_node, - "qcom,codec-aux-devs", NULL); - if (codec_aux_dev_cnt == -ENOENT) { - dev_warn(&pdev->dev, "%s: No aux codec defined in DT.\n", - __func__); - goto err; - } else if (codec_aux_dev_cnt <= 0) { - dev_err(&pdev->dev, - "%s: Error reading aux codec device from DT, dev_cnt=%d\n", - __func__, codec_aux_dev_cnt); - ret = -EINVAL; - goto err; - } - - /* - * Expect total phandles count to be NOT less than maximum possible - * AUX device count. However, if it is less, then assign same value to - * max count as well. - */ - if (codec_aux_dev_cnt < codec_max_aux_devs) { - dev_dbg(&pdev->dev, - "%s: codec_max_aux_devs = %d cannot exceed codec_aux_dev_cnt = %d\n", - __func__, codec_max_aux_devs, - codec_aux_dev_cnt); - codec_max_aux_devs = codec_aux_dev_cnt; - } - - /* - * Alloc mem to store phandle and index info of aux codec - * if already registered with ALSA core - */ - aux_cdc_dev_info = devm_kcalloc(&pdev->dev, codec_max_aux_devs, - sizeof(struct aux_codec_dev_info), - GFP_KERNEL); - if (!aux_cdc_dev_info) { - ret = -ENOMEM; - goto err; - } - - /* - * search and check whether all aux codecs 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 < codec_aux_dev_cnt; i++) { - aux_codec_of_node = of_parse_phandle(pdev->dev.of_node, - "qcom,codec-aux-devs", i); - if (unlikely(!aux_codec_of_node)) { - /* we should not be here */ - dev_err(&pdev->dev, - "%s: aux codec dev node is not present\n", - __func__); - ret = -EINVAL; - goto err; - } - if (soc_find_component_locked(aux_codec_of_node, NULL)) { - /* AUX codec registered with ALSA core */ - aux_cdc_dev_info[codecs_found].of_node = - aux_codec_of_node; - aux_cdc_dev_info[codecs_found].index = i; - codecs_found++; - } - } - - if (codecs_found < codec_max_aux_devs) { - dev_dbg(&pdev->dev, - "%s: failed to find %d components. Found only %d\n", - __func__, codec_max_aux_devs, codecs_found); - return -EPROBE_DEFER; - } - dev_info(&pdev->dev, - "%s: found %d AUX codecs registered with ALSA core\n", - __func__, codecs_found); - - } - -aux_dev_register: - card->num_aux_devs = wsa_max_devs + codec_max_aux_devs; - card->num_configs = wsa_max_devs + codec_max_aux_devs; - - /* Alloc array of AUX devs struct */ - msm_aux_dev = devm_kcalloc(&pdev->dev, card->num_aux_devs, - sizeof(struct snd_soc_aux_dev), - GFP_KERNEL); - if (!msm_aux_dev) { - ret = -ENOMEM; - goto err; - } - - /* Alloc array of codec conf struct */ - msm_codec_conf = devm_kcalloc(&pdev->dev, card->num_configs, - sizeof(struct snd_soc_codec_conf), - GFP_KERNEL); - if (!msm_codec_conf) { - ret = -ENOMEM; - goto err; - } - - for (i = 0; i < wsa_max_devs; i++) { - dev_name_str = devm_kzalloc(&pdev->dev, DEV_NAME_STR_LEN, - GFP_KERNEL); - if (!dev_name_str) { - ret = -ENOMEM; - goto err; - } - - ret = of_property_read_string_index(pdev->dev.of_node, - "qcom,wsa-aux-dev-prefix", - wsa881x_dev_info[i].index, - auxdev_name_prefix); - if (ret) { - dev_err(&pdev->dev, - "%s: failed to read wsa aux dev prefix, ret = %d\n", - __func__, ret); - ret = -EINVAL; - goto err; - } - - snprintf(dev_name_str, strlen("wsa881x.%d"), "wsa881x.%d", i); - msm_aux_dev[i].name = dev_name_str; - msm_aux_dev[i].codec_name = NULL; - msm_aux_dev[i].codec_of_node = - wsa881x_dev_info[i].of_node; - msm_aux_dev[i].init = msm_wsa881x_init; - msm_codec_conf[i].dev_name = NULL; - msm_codec_conf[i].name_prefix = auxdev_name_prefix[0]; - msm_codec_conf[i].of_node = - wsa881x_dev_info[i].of_node; - } - - for (i = 0; i < codec_aux_dev_cnt; i++) { - msm_aux_dev[wsa_max_devs + i].name = "aux_codec"; - msm_aux_dev[wsa_max_devs + i].codec_name = NULL; - msm_aux_dev[wsa_max_devs + i].codec_of_node = - aux_cdc_dev_info[i].of_node; - msm_aux_dev[wsa_max_devs + i].init = msm_aux_codec_init; - msm_codec_conf[wsa_max_devs + i].dev_name = NULL; - msm_codec_conf[wsa_max_devs + i].name_prefix = - NULL; - msm_codec_conf[wsa_max_devs + i].of_node = - aux_cdc_dev_info[i].of_node; - } - - card->codec_conf = msm_codec_conf; - card->aux_dev = msm_aux_dev; -err: - return ret; -} - static void msm_i2s_auxpcm_init(struct platform_device *pdev) { int count; @@ -9020,7 +8331,9 @@ static int sm6150_ssr_enable(struct device *dev, void *data) pdata->is_afe_config_done = true; } } +#if IS_ENABLED(CONFIG_AUDIO_QGKI) snd_soc_card_change_online_state(card, 1); +#endif /* CONFIG_AUDIO_QGKI */ dev_dbg(dev, "%s: setting snd_card to ONLINE\n", __func__); err: @@ -9039,7 +8352,9 @@ static void sm6150_ssr_disable(struct device *dev, void *data) } dev_dbg(dev, "%s: setting snd_card to OFFLINE\n", __func__); +#if IS_ENABLED(CONFIG_AUDIO_QGKI) snd_soc_card_change_online_state(card, 0); +#endif /* CONFIG_AUDIO_QGKI */ if (strnstr(card->name, "tavil", strlen(card->name)) || strnstr(card->name, "tasha", strlen(card->name))) { @@ -9161,9 +8476,16 @@ static int msm_asoc_machine_probe(struct platform_device *pdev) goto err; } - ret = msm_init_aux_dev(pdev, card); - if (ret) - goto err; + /* Get maximum WSA device count for this platform */ + ret = of_property_read_u32(pdev->dev.of_node, + "qcom,wsa-max-devs", &pdata->wsa_max_devs); + if (ret) { + dev_info(&pdev->dev, + "%s: wsa-max-devs property missing in DT %s, ret = %d\n", + __func__, pdev->dev.of_node->full_name, ret); + pdata->wsa_max_devs = 0; + } + ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret == -EPROBE_DEFER) { @@ -9306,18 +8628,7 @@ static struct platform_driver sm6150_asoc_machine_driver = { .probe = msm_asoc_machine_probe, .remove = msm_asoc_machine_remove, }; - -int __init sm6150_init(void) -{ - pr_debug("%s\n", __func__); - return platform_driver_register(&sm6150_asoc_machine_driver); -} - -void sm6150_exit(void) -{ - pr_debug("%s\n", __func__); - platform_driver_unregister(&sm6150_asoc_machine_driver); -} +module_platform_driver(sm6150_asoc_machine_driver); MODULE_DESCRIPTION("ALSA SoC SM6150 Machine driver"); MODULE_LICENSE("GPL v2"); From 374b84c9b5f33f2f4ee71ee93ade357abdf3cc7f Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Mon, 7 Mar 2022 14:10:56 +0530 Subject: [PATCH 16/19] ASOC: update wcd934x codec driver Compile wcd934x driver for sm6150. Change-Id: Ia0f41d6f1de03ec41cddb0bc1cef5d62ac815cdf --- asoc/codecs/Kbuild | 1 + asoc/codecs/wcd934x/wcd934x.c | 30 ++++++++++++++++++++++++++++++ asoc/codecs/wcd934x/wcd934x.h | 8 ++++++++ 3 files changed, 39 insertions(+) diff --git a/asoc/codecs/Kbuild b/asoc/codecs/Kbuild index 52d20d667a20..0e842ee1bf6c 100755 --- a/asoc/codecs/Kbuild +++ b/asoc/codecs/Kbuild @@ -147,6 +147,7 @@ ifdef CONFIG_WCD9XXX_CODEC_CORE WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o WCD9XXX_OBJS += wcd-dsp-utils.o WCD9XXX_OBJS += wcd-dsp-mgr.o + WCD9XXX_OBJS += wcd-clsh.o else WCD9XXX_OBJS += wcd-clsh.o endif diff --git a/asoc/codecs/wcd934x/wcd934x.c b/asoc/codecs/wcd934x/wcd934x.c index 3a43485a7356..80923135bee3 100644 --- a/asoc/codecs/wcd934x/wcd934x.c +++ b/asoc/codecs/wcd934x/wcd934x.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include #include @@ -21,6 +22,7 @@ #include #include #include