From ebb8a240e5d8aab0ad63c3df1dcdf61f306e8e2f Mon Sep 17 00:00:00 2001 From: yaozm1 Date: Thu, 4 Nov 2021 16:14:09 +0800 Subject: [PATCH] asoc:init rhode audio Change-Id: Ia605774ce9438516dea037f2e2538e3b8037560c Signed-off-by: yaozm1 Reviewed-on: https://gerrit.mot.com/2107467 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- asoc/Kbuild | 4 +++ asoc/bengal.c | 58 +++++++++++++++++++++++++++++++++++++++++- asoc/codecs/Kbuild | 3 +++ config/rhodeautoconf.h | 4 +++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 config/rhodeautoconf.h diff --git a/asoc/Kbuild b/asoc/Kbuild index e718931c1e8f..28f5d7d2266f 100644 --- a/asoc/Kbuild +++ b/asoc/Kbuild @@ -96,6 +96,10 @@ ifeq ($(KERNEL_BUILD), 0) export INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h endif + ifneq (,$(filter rhode%, $(TARGET_PRODUCT))) + INCS += -include $(AUDIO_ROOT)/config/rhodeautoconf.h + endif + endif # As per target team, build is done as follows: diff --git a/asoc/bengal.c b/asoc/bengal.c index 99733bed120e..e45f17c3dbe2 100644 --- a/asoc/bengal.c +++ b/asoc/bengal.c @@ -5432,6 +5432,51 @@ static struct snd_soc_dai_link msm_awinic_be_dai_links[] = { .ignore_suspend = 1, }, }; + +static struct snd_soc_dai_link_component awinic_codecs[] = { + { + .of_node = NULL, + .dai_name = "aw882xx-aif-0-34", + .name = "aw882xxacf_smartpa.0-0034", + }, + { + .of_node = NULL, + .dai_name = "aw882xx-aif-0-37", + .name = "aw882xxacf_smartpa.0-0037", + }, +}; + +static struct snd_soc_dai_link msm_stereo_awinic_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", + .num_codecs = ARRAY_SIZE(awinic_codecs), + .codecs = awinic_codecs, + .no_pcm = 1, + .dpcm_playback = 1, + .id = MSM_BACKEND_DAI_PRI_MI2S_RX, + .be_hw_params_fixup = msm_be_hw_params_fixup, + .ops = &msm_mi2s_be_ops, + .ignore_suspend = 1, + .ignore_pmdown_time = 1, + }, + { + .name = LPASS_BE_PRI_MI2S_TX, + .stream_name = "Primary MI2S Capture", + .cpu_dai_name = "msm-dai-q6-mi2s.0", + .platform_name = "msm-pcm-routing", + .num_codecs = ARRAY_SIZE(awinic_codecs), + .codecs = awinic_codecs, + .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, + }, +}; #endif #if !defined(CONFIG_SND_SMARTPA_AW882XX) @@ -6266,7 +6311,7 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) __func__); } else { dev_dbg(dev,"%s,aw,has-882xx=%d\n",__func__,has_awinic_pa); - if (has_awinic_pa) { + if (has_awinic_pa == 1) { memcpy(msm_bengal_dai_links + total_links, msm_awinic_fe_dai_links, sizeof(msm_awinic_fe_dai_links)); @@ -6277,6 +6322,17 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) sizeof(msm_awinic_be_dai_links)); total_links += ARRAY_SIZE(msm_awinic_be_dai_links); + } else if (has_awinic_pa == 2) { + memcpy(msm_bengal_dai_links + total_links, + msm_awinic_fe_dai_links, + sizeof(msm_awinic_fe_dai_links)); + total_links += + ARRAY_SIZE(msm_awinic_fe_dai_links); + memcpy(msm_bengal_dai_links + total_links, + msm_stereo_awinic_be_dai_links, + sizeof(msm_stereo_awinic_be_dai_links)); + total_links += + ARRAY_SIZE(msm_stereo_awinic_be_dai_links); } } #endif diff --git a/asoc/codecs/Kbuild b/asoc/codecs/Kbuild index 6ef33da1c951..fffbc368f46b 100644 --- a/asoc/codecs/Kbuild +++ b/asoc/codecs/Kbuild @@ -90,6 +90,9 @@ ifeq ($(KERNEL_BUILD), 0) export INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h endif + ifneq (,$(filter rhode%, $(TARGET_PRODUCT))) + INCS += -include $(AUDIO_ROOT)/config/rhodeautoconf.h + endif endif # As per target team, build is done as follows: diff --git a/config/rhodeautoconf.h b/config/rhodeautoconf.h new file mode 100644 index 000000000000..84c56f585f7e --- /dev/null +++ b/config/rhodeautoconf.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. + */ +#define CONFIG_AW882XX_STEREO_SMARTPA 1