Re: [PATCH v4 2/2] ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs instance

From: Reddy, V sujith kumar
Date: Tue May 31 2022 - 05:24:27 EST



On 5/26/2022 2:58 AM, Pierre-Louis Bossart wrote:
[CAUTION: External Email]

On 5/25/22 15:34, V sujith kumar Reddy wrote:
We have new platform with rt5682s as a primary codec and rt1019 as an
amp codec. Add machine struct to register sof audio based sound card
on such Chrome machine.

Here we are configuring as a soc mclk master and codec slave.

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@xxxxxxx>
---
sound/soc/amd/acp-config.c | 9 ++++
sound/soc/amd/acp/acp-mach-common.c | 69 ++++++++++++++++++++++++-----
sound/soc/amd/acp/acp-sof-mach.c | 15 +++++++
3 files changed, 82 insertions(+), 11 deletions(-)

diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
index ba9e0adacc4a..39ca48be7be9 100644
--- a/sound/soc/amd/acp-config.c
+++ b/sound/soc/amd/acp-config.c
@@ -147,6 +147,15 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
.fw_filename = "sof-rmb.ri",
.sof_tplg_filename = "sof-acp-rmb.tplg",
},
+ {
+ .id = "RTL5682",
+ .drv_name = "rt5682s-hs-rt1019",
+ .pdata = &acp_quirk_data,
+ .machine_quirk = snd_soc_acpi_codec_list,
+ .quirk_data = &amp_rt1019,
+ .fw_filename = "sof-rmb.ri",
+ .sof_tplg_filename = "sof-acp-rmb.tplg",
+ },
that means a 3rd entry with the same pair of firmware/topology files?
will change and push new patchset

{},
};
EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index a03b396d96bb..4aad3fee51cf 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -148,10 +148,15 @@ static int acp_card_hs_startup(struct snd_pcm_substream *substream)
struct snd_soc_card *card = rtd->card;
struct acp_card_drvdata *drvdata = card->drvdata;
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
- int ret;
+ unsigned int fmt = 0;
fmt initialization is overridden below.
will change and push new patchset

+ int ret = 0;
useless init...
will change and push new patchset

- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
- | SND_SOC_DAIFMT_CBP_CFP);
+ if (drvdata->soc_mclk)
+ fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC;
+ else
+ fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP;
+
+ ret = snd_soc_dai_set_fmt(codec_dai, fmt);
... overridden here
will change and push new patchset

if (ret < 0) {
dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
return ret;