All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019
@ 2022-05-23 13:23 V sujith kumar Reddy
  2022-05-23 13:23   ` V sujith kumar Reddy
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: V sujith kumar Reddy @ 2022-05-23 13:23 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: V sujith kumar Reddy, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	ajitkumar.pandey, Vijendar.Mukunda

This patch set depends on:
        --gpio patch
        --https://patchwork.kernel.org/project/alsa-devel/patch/20220516160619.17832-1-Vsujithkumar.Reddy@amd.com/
        --https://patchwork.kernel.org/project/alsa-devel/patch/20220516160619.17832-2-Vsujithkumar.Reddy@amd.com/

Resolved  compilation error:

/build/stage/linux/sound/soc/amd/acp/acp-mach-common.c: In function ‘acp_card_nau8825_init’:
/build/stage/linux/sound/soc/amd/acp/acp-mach-common.c:479:15: error: too many arguments to function ‘snd_soc_card_jack_new’
  479 |         ret = snd_soc_card_jack_new(card, "Headset Jack",
      |               ^~~~~~~~~~~~~~~~~~~~~
In file included from /build/stage/linux/include/sound/soc.h:1362,
                 from /build/stage/linux/sound/soc/amd/acp/acp-mach-common.c:20:
/build/stage/linux/include/sound/soc-card.h:18:5: note: declared here
   18 | int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type

V sujith kumar Reddy (2):
  ASoC: amd: acp: Add support for nau8825 and max98360 card
  ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs
    instance

 sound/soc/amd/acp-config.c          |  30 ++++
 sound/soc/amd/acp/Kconfig           |   1 +
 sound/soc/amd/acp/acp-mach-common.c | 235 ++++++++++++++++++++++++++--
 sound/soc/amd/acp/acp-mach.h        |   3 +
 sound/soc/amd/acp/acp-sof-mach.c    |  30 ++++
 sound/soc/amd/mach-config.h         |   1 +
 6 files changed, 283 insertions(+), 17 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
  2022-05-23 13:23 [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 V sujith kumar Reddy
@ 2022-05-23 13:23   ` V sujith kumar Reddy
  2022-05-23 13:23   ` V sujith kumar Reddy
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: V sujith kumar Reddy @ 2022-05-23 13:23 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	ajitkumar.pandey, V sujith kumar Reddy, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Ajit Kumar Pandey,
	Pierre-Louis Bossart, Kai Vehmanen, Geert Uytterhoeven,
	Arnd Bergmann, Jia-Ju Bai, Akihiko Odaki, Daniel Baluta,
	Bard Liao, open list

We have new platform with nau8825 as a primary codec and max98360 as an
amp codec. Add machine struct to register sof audio based sound card
on such Chrome machine.

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
---
 sound/soc/amd/acp-config.c          |  21 ++++
 sound/soc/amd/acp/Kconfig           |   1 +
 sound/soc/amd/acp/acp-mach-common.c | 166 +++++++++++++++++++++++++++-
 sound/soc/amd/acp/acp-mach.h        |   3 +
 sound/soc/amd/acp/acp-sof-mach.c    |  15 +++
 sound/soc/amd/mach-config.h         |   1 +
 6 files changed, 201 insertions(+), 6 deletions(-)

diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
index 5cbc82eca4c9..f73c187fee03 100644
--- a/sound/soc/amd/acp-config.c
+++ b/sound/soc/amd/acp-config.c
@@ -130,4 +130,25 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
 };
 EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
 
+struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
+	{
+		.id = "AMDI1019",
+		.drv_name = "rmb-dsp",
+		.pdata = (void *)&acp_quirk_data,
+		.fw_filename = "sof-rmb.ri",
+		.sof_tplg_filename = "sof-acp-rmb.tplg",
+	},
+	{
+		.id = "10508825",
+		.drv_name = "nau8825-max",
+		.pdata = (void *)&acp_quirk_data,
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &amp_max,
+		.fw_filename = "sof-rmb.ri",
+		.sof_tplg_filename = "sof-acp-rmb.tplg",
+	},
+	{},
+};
+EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
+
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
index 9dae2719084c..7e56d2644105 100644
--- a/sound/soc/amd/acp/Kconfig
+++ b/sound/soc/amd/acp/Kconfig
@@ -49,6 +49,7 @@ config SND_SOC_AMD_MACH_COMMON
 	select SND_SOC_RT1019
 	select SND_SOC_MAX98357A
 	select SND_SOC_RT5682S
+	select SND_SOC_NAU8825
 	help
 	  This option enables common Machine driver module for ACP.
 
diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index 6ae454bf60af..4f5cfa26c58d 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -24,6 +24,7 @@
 #include "../../codecs/rt5682.h"
 #include "../../codecs/rt1019.h"
 #include "../../codecs/rt5682s.h"
+#include "../../codecs/nau8825.h"
 #include "acp-mach.h"
 
 #define PCO_PLAT_CLK 48000000
@@ -175,7 +176,8 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream)
 	struct snd_soc_card *card = rtd->card;
 	struct acp_card_drvdata *drvdata = card->drvdata;
 
-	clk_disable_unprepare(drvdata->wclk);
+	if (!drvdata->soc_mclk)
+		clk_disable_unprepare(drvdata->wclk);
 }
 
 static const struct snd_soc_ops acp_card_rt5682_ops = {
@@ -363,7 +365,7 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_card *card = rtd->card;
 	struct acp_card_drvdata *drvdata = card->drvdata;
-	int ret;
+	int ret = 0;
 
 	runtime->hw.channels_max = DUAL_CHANNEL;
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
@@ -371,10 +373,13 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 				      &constraints_rates);
 
-	ret = acp_clk_enable(drvdata);
-	if (ret < 0)
-		dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
-
+	if (!drvdata->soc_mclk) {
+		ret = acp_clk_enable(drvdata);
+		if (ret < 0) {
+			dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
+			return ret;
+		}
+	}
 	return ret;
 }
 
@@ -409,6 +414,104 @@ static const struct snd_soc_ops acp_card_maxim_ops = {
 	.shutdown = acp_card_shutdown,
 };
 
+/* Declare nau8825 codec components */
+SND_SOC_DAILINK_DEF(nau8825,
+		    DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
+
+static const struct snd_soc_dapm_route nau8825_map[] = {
+	{ "Headphone Jack", NULL, "HPOL" },
+	{ "Headphone Jack", NULL, "HPOR" },
+};
+
+static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
+{
+	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);
+	struct snd_soc_component *component = codec_dai->component;
+	unsigned int fmt;
+	int ret;
+
+	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
+
+	if (drvdata->hs_codec_id != NAU8825)
+		return -EINVAL;
+
+	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);
+	if (ret < 0) {
+		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
+		return ret;
+	}
+	ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
+					 SND_JACK_HEADSET | SND_JACK_LINEOUT |
+					 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+					 SND_JACK_BTN_2 | SND_JACK_BTN_3,
+					 &pco_jack, NULL, 0);
+	if (ret) {
+		dev_err(card->dev, "HP jack creation failed %d\n", ret);
+		return ret;
+	}
+
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
+
+	ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
+	if (ret) {
+		dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
+		return ret;
+	}
+
+	return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map));
+}
+
+static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
+				 struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+	int ret;
+
+	ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS,
+				     (48000 * 256), SND_SOC_CLOCK_IN);
+	if (ret < 0)
+		dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
+
+	ret = snd_soc_dai_set_pll(codec_dai, 0, 0, params_rate(params),
+				  params_rate(params) * 256);
+	if (ret < 0) {
+		dev_err(rtd->dev, "can't set FLL: %d\n", ret);
+		return ret;
+	}
+
+	return ret;
+}
+
+static int acp_nau8825_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	runtime->hw.channels_max = 2;
+	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+				   &constraints_channels);
+
+	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+	snd_pcm_hw_constraint_list(runtime, 0,
+				   SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
+	return 0;
+}
+
+static const struct snd_soc_ops acp_card_nau8825_ops = {
+	.startup =  acp_nau8825_startup,
+	.hw_params = acp_nau8825_hw_params,
+};
+
 /* Declare DMIC codec components */
 SND_SOC_DAILINK_DEF(dmic_codec,
 		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
@@ -437,6 +540,8 @@ SND_SOC_DAILINK_DEF(i2s_sp,
 	DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
 SND_SOC_DAILINK_DEF(sof_sp,
 	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
+SND_SOC_DAILINK_DEF(sof_hs,
+		    DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
 SND_SOC_DAILINK_DEF(sof_dmic,
 	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
 SND_SOC_DAILINK_DEF(pdm_dmic,
@@ -491,6 +596,31 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		i++;
 	}
 
+	if (drv_data->hs_cpu_id == I2S_HS) {
+		links[i].name = "acp-headset-codec";
+		links[i].id = HEADSET_BE_ID;
+		links[i].cpus = sof_hs;
+		links[i].num_cpus = ARRAY_SIZE(sof_hs);
+		links[i].platforms = sof_component;
+		links[i].num_platforms = ARRAY_SIZE(sof_component);
+		links[i].dpcm_playback = 1;
+		links[i].dpcm_capture = 1;
+		links[i].nonatomic = true;
+		links[i].no_pcm = 1;
+		if (!drv_data->hs_codec_id) {
+			/* Use dummy codec if codec id not specified */
+			links[i].codecs = dummy_codec;
+			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+		}
+		if (drv_data->hs_codec_id == NAU8825) {
+			links[i].codecs = nau8825;
+			links[i].num_codecs = ARRAY_SIZE(nau8825);
+			links[i].init = acp_card_nau8825_init;
+			links[i].ops = &acp_card_nau8825_ops;
+		}
+		i++;
+	}
+
 	if (drv_data->amp_cpu_id == I2S_SP) {
 		links[i].name = "acp-amp-codec";
 		links[i].id = AMP_BE_ID;
@@ -523,6 +653,30 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		i++;
 	}
 
+	if (drv_data->amp_cpu_id == I2S_HS) {
+		links[i].name = "acp-amp-codec";
+		links[i].id = AMP_BE_ID;
+		links[i].cpus = sof_hs;
+		links[i].num_cpus = ARRAY_SIZE(sof_hs);
+		links[i].platforms = sof_component;
+		links[i].num_platforms = ARRAY_SIZE(sof_component);
+		links[i].dpcm_playback = 1;
+		links[i].nonatomic = true;
+		links[i].no_pcm = 1;
+		if (!drv_data->amp_codec_id) {
+			/* Use dummy codec if codec id not specified */
+			links[i].codecs = dummy_codec;
+			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+		}
+		if (drv_data->amp_codec_id == MAX98360A) {
+			links[i].codecs = max98360a;
+			links[i].num_codecs = ARRAY_SIZE(max98360a);
+			links[i].ops = &acp_card_maxim_ops;
+			links[i].init = acp_card_maxim_init;
+		}
+		i++;
+	}
+
 	if (drv_data->dmic_cpu_id == DMIC) {
 		links[i].name = "acp-dmic-codec";
 		links[i].id = DMIC_BE_ID;
diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
index 5dc47cfbff10..c95ee1c52eb1 100644
--- a/sound/soc/amd/acp/acp-mach.h
+++ b/sound/soc/amd/acp/acp-mach.h
@@ -26,6 +26,7 @@ enum be_id {
 
 enum cpu_endpoints {
 	NONE = 0,
+	I2S_HS,
 	I2S_SP,
 	I2S_BT,
 	DMIC,
@@ -37,6 +38,7 @@ enum codec_endpoints {
 	RT1019,
 	MAX98360A,
 	RT5682S,
+	NAU8825,
 };
 
 struct acp_card_drvdata {
@@ -49,6 +51,7 @@ struct acp_card_drvdata {
 	unsigned int dai_fmt;
 	struct clk *wclk;
 	struct clk *bclk;
+	bool soc_mclk;
 };
 
 int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
index d1531cdab110..adbae809f2aa 100644
--- a/sound/soc/amd/acp/acp-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sof-mach.c
@@ -56,6 +56,16 @@ static struct acp_card_drvdata sof_rt5682s_max_data = {
 	.dmic_codec_id = DMIC,
 };
 
+static struct acp_card_drvdata sof_nau8825_data = {
+	.hs_cpu_id = I2S_HS,
+	.amp_cpu_id = I2S_HS,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = NAU8825,
+	.amp_codec_id = MAX98360A,
+	.dmic_codec_id = DMIC,
+	.soc_mclk = true,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -124,6 +134,10 @@ static const struct platform_device_id board_ids[] = {
 		.name = "rt5682s-rt1019",
 		.driver_data = (kernel_ulong_t)&sof_rt5682s_rt1019_data
 	},
+	{
+		.name = "nau8825-max",
+		.driver_data = (kernel_ulong_t)&sof_nau8825_data
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -143,4 +157,5 @@ MODULE_ALIAS("platform:rt5682-rt1019");
 MODULE_ALIAS("platform:rt5682-max");
 MODULE_ALIAS("platform:rt5682s-max");
 MODULE_ALIAS("platform:rt5682s-rt1019");
+MODULE_ALIAS("platform:nau8825-max");
 MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
index 0a54567a2841..7b4c625da40d 100644
--- a/sound/soc/amd/mach-config.h
+++ b/sound/soc/amd/mach-config.h
@@ -19,6 +19,7 @@
 #define ACP_PCI_DEV_ID			0x15E2
 
 extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
+extern struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[];
 
 struct config_entry {
 	u32 flags;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
@ 2022-05-23 13:23   ` V sujith kumar Reddy
  0 siblings, 0 replies; 13+ messages in thread
From: V sujith kumar Reddy @ 2022-05-23 13:23 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Pierre-Louis Bossart, Sunil-kumar.Dommati, Geert Uytterhoeven,
	Ajit Kumar Pandey, Kai Vehmanen, open list, Basavaraj.Hiregoudar,
	Takashi Iwai, Liam Girdwood, Jia-Ju Bai, Arnd Bergmann,
	Akihiko Odaki, Vijendar.Mukunda, V sujith kumar Reddy,
	Daniel Baluta, Bard Liao

We have new platform with nau8825 as a primary codec and max98360 as an
amp codec. Add machine struct to register sof audio based sound card
on such Chrome machine.

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
---
 sound/soc/amd/acp-config.c          |  21 ++++
 sound/soc/amd/acp/Kconfig           |   1 +
 sound/soc/amd/acp/acp-mach-common.c | 166 +++++++++++++++++++++++++++-
 sound/soc/amd/acp/acp-mach.h        |   3 +
 sound/soc/amd/acp/acp-sof-mach.c    |  15 +++
 sound/soc/amd/mach-config.h         |   1 +
 6 files changed, 201 insertions(+), 6 deletions(-)

diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
index 5cbc82eca4c9..f73c187fee03 100644
--- a/sound/soc/amd/acp-config.c
+++ b/sound/soc/amd/acp-config.c
@@ -130,4 +130,25 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
 };
 EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
 
+struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
+	{
+		.id = "AMDI1019",
+		.drv_name = "rmb-dsp",
+		.pdata = (void *)&acp_quirk_data,
+		.fw_filename = "sof-rmb.ri",
+		.sof_tplg_filename = "sof-acp-rmb.tplg",
+	},
+	{
+		.id = "10508825",
+		.drv_name = "nau8825-max",
+		.pdata = (void *)&acp_quirk_data,
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &amp_max,
+		.fw_filename = "sof-rmb.ri",
+		.sof_tplg_filename = "sof-acp-rmb.tplg",
+	},
+	{},
+};
+EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
+
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
index 9dae2719084c..7e56d2644105 100644
--- a/sound/soc/amd/acp/Kconfig
+++ b/sound/soc/amd/acp/Kconfig
@@ -49,6 +49,7 @@ config SND_SOC_AMD_MACH_COMMON
 	select SND_SOC_RT1019
 	select SND_SOC_MAX98357A
 	select SND_SOC_RT5682S
+	select SND_SOC_NAU8825
 	help
 	  This option enables common Machine driver module for ACP.
 
diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index 6ae454bf60af..4f5cfa26c58d 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -24,6 +24,7 @@
 #include "../../codecs/rt5682.h"
 #include "../../codecs/rt1019.h"
 #include "../../codecs/rt5682s.h"
+#include "../../codecs/nau8825.h"
 #include "acp-mach.h"
 
 #define PCO_PLAT_CLK 48000000
@@ -175,7 +176,8 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream)
 	struct snd_soc_card *card = rtd->card;
 	struct acp_card_drvdata *drvdata = card->drvdata;
 
-	clk_disable_unprepare(drvdata->wclk);
+	if (!drvdata->soc_mclk)
+		clk_disable_unprepare(drvdata->wclk);
 }
 
 static const struct snd_soc_ops acp_card_rt5682_ops = {
@@ -363,7 +365,7 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_card *card = rtd->card;
 	struct acp_card_drvdata *drvdata = card->drvdata;
-	int ret;
+	int ret = 0;
 
 	runtime->hw.channels_max = DUAL_CHANNEL;
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
@@ -371,10 +373,13 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 				      &constraints_rates);
 
-	ret = acp_clk_enable(drvdata);
-	if (ret < 0)
-		dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
-
+	if (!drvdata->soc_mclk) {
+		ret = acp_clk_enable(drvdata);
+		if (ret < 0) {
+			dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
+			return ret;
+		}
+	}
 	return ret;
 }
 
@@ -409,6 +414,104 @@ static const struct snd_soc_ops acp_card_maxim_ops = {
 	.shutdown = acp_card_shutdown,
 };
 
+/* Declare nau8825 codec components */
+SND_SOC_DAILINK_DEF(nau8825,
+		    DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
+
+static const struct snd_soc_dapm_route nau8825_map[] = {
+	{ "Headphone Jack", NULL, "HPOL" },
+	{ "Headphone Jack", NULL, "HPOR" },
+};
+
+static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
+{
+	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);
+	struct snd_soc_component *component = codec_dai->component;
+	unsigned int fmt;
+	int ret;
+
+	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
+
+	if (drvdata->hs_codec_id != NAU8825)
+		return -EINVAL;
+
+	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);
+	if (ret < 0) {
+		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
+		return ret;
+	}
+	ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
+					 SND_JACK_HEADSET | SND_JACK_LINEOUT |
+					 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+					 SND_JACK_BTN_2 | SND_JACK_BTN_3,
+					 &pco_jack, NULL, 0);
+	if (ret) {
+		dev_err(card->dev, "HP jack creation failed %d\n", ret);
+		return ret;
+	}
+
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
+	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
+
+	ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
+	if (ret) {
+		dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
+		return ret;
+	}
+
+	return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map));
+}
+
+static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
+				 struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+	int ret;
+
+	ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS,
+				     (48000 * 256), SND_SOC_CLOCK_IN);
+	if (ret < 0)
+		dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
+
+	ret = snd_soc_dai_set_pll(codec_dai, 0, 0, params_rate(params),
+				  params_rate(params) * 256);
+	if (ret < 0) {
+		dev_err(rtd->dev, "can't set FLL: %d\n", ret);
+		return ret;
+	}
+
+	return ret;
+}
+
+static int acp_nau8825_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	runtime->hw.channels_max = 2;
+	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+				   &constraints_channels);
+
+	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+	snd_pcm_hw_constraint_list(runtime, 0,
+				   SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
+	return 0;
+}
+
+static const struct snd_soc_ops acp_card_nau8825_ops = {
+	.startup =  acp_nau8825_startup,
+	.hw_params = acp_nau8825_hw_params,
+};
+
 /* Declare DMIC codec components */
 SND_SOC_DAILINK_DEF(dmic_codec,
 		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
@@ -437,6 +540,8 @@ SND_SOC_DAILINK_DEF(i2s_sp,
 	DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
 SND_SOC_DAILINK_DEF(sof_sp,
 	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
+SND_SOC_DAILINK_DEF(sof_hs,
+		    DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
 SND_SOC_DAILINK_DEF(sof_dmic,
 	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
 SND_SOC_DAILINK_DEF(pdm_dmic,
@@ -491,6 +596,31 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		i++;
 	}
 
+	if (drv_data->hs_cpu_id == I2S_HS) {
+		links[i].name = "acp-headset-codec";
+		links[i].id = HEADSET_BE_ID;
+		links[i].cpus = sof_hs;
+		links[i].num_cpus = ARRAY_SIZE(sof_hs);
+		links[i].platforms = sof_component;
+		links[i].num_platforms = ARRAY_SIZE(sof_component);
+		links[i].dpcm_playback = 1;
+		links[i].dpcm_capture = 1;
+		links[i].nonatomic = true;
+		links[i].no_pcm = 1;
+		if (!drv_data->hs_codec_id) {
+			/* Use dummy codec if codec id not specified */
+			links[i].codecs = dummy_codec;
+			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+		}
+		if (drv_data->hs_codec_id == NAU8825) {
+			links[i].codecs = nau8825;
+			links[i].num_codecs = ARRAY_SIZE(nau8825);
+			links[i].init = acp_card_nau8825_init;
+			links[i].ops = &acp_card_nau8825_ops;
+		}
+		i++;
+	}
+
 	if (drv_data->amp_cpu_id == I2S_SP) {
 		links[i].name = "acp-amp-codec";
 		links[i].id = AMP_BE_ID;
@@ -523,6 +653,30 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		i++;
 	}
 
+	if (drv_data->amp_cpu_id == I2S_HS) {
+		links[i].name = "acp-amp-codec";
+		links[i].id = AMP_BE_ID;
+		links[i].cpus = sof_hs;
+		links[i].num_cpus = ARRAY_SIZE(sof_hs);
+		links[i].platforms = sof_component;
+		links[i].num_platforms = ARRAY_SIZE(sof_component);
+		links[i].dpcm_playback = 1;
+		links[i].nonatomic = true;
+		links[i].no_pcm = 1;
+		if (!drv_data->amp_codec_id) {
+			/* Use dummy codec if codec id not specified */
+			links[i].codecs = dummy_codec;
+			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+		}
+		if (drv_data->amp_codec_id == MAX98360A) {
+			links[i].codecs = max98360a;
+			links[i].num_codecs = ARRAY_SIZE(max98360a);
+			links[i].ops = &acp_card_maxim_ops;
+			links[i].init = acp_card_maxim_init;
+		}
+		i++;
+	}
+
 	if (drv_data->dmic_cpu_id == DMIC) {
 		links[i].name = "acp-dmic-codec";
 		links[i].id = DMIC_BE_ID;
diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
index 5dc47cfbff10..c95ee1c52eb1 100644
--- a/sound/soc/amd/acp/acp-mach.h
+++ b/sound/soc/amd/acp/acp-mach.h
@@ -26,6 +26,7 @@ enum be_id {
 
 enum cpu_endpoints {
 	NONE = 0,
+	I2S_HS,
 	I2S_SP,
 	I2S_BT,
 	DMIC,
@@ -37,6 +38,7 @@ enum codec_endpoints {
 	RT1019,
 	MAX98360A,
 	RT5682S,
+	NAU8825,
 };
 
 struct acp_card_drvdata {
@@ -49,6 +51,7 @@ struct acp_card_drvdata {
 	unsigned int dai_fmt;
 	struct clk *wclk;
 	struct clk *bclk;
+	bool soc_mclk;
 };
 
 int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
index d1531cdab110..adbae809f2aa 100644
--- a/sound/soc/amd/acp/acp-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sof-mach.c
@@ -56,6 +56,16 @@ static struct acp_card_drvdata sof_rt5682s_max_data = {
 	.dmic_codec_id = DMIC,
 };
 
+static struct acp_card_drvdata sof_nau8825_data = {
+	.hs_cpu_id = I2S_HS,
+	.amp_cpu_id = I2S_HS,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = NAU8825,
+	.amp_codec_id = MAX98360A,
+	.dmic_codec_id = DMIC,
+	.soc_mclk = true,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -124,6 +134,10 @@ static const struct platform_device_id board_ids[] = {
 		.name = "rt5682s-rt1019",
 		.driver_data = (kernel_ulong_t)&sof_rt5682s_rt1019_data
 	},
+	{
+		.name = "nau8825-max",
+		.driver_data = (kernel_ulong_t)&sof_nau8825_data
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -143,4 +157,5 @@ MODULE_ALIAS("platform:rt5682-rt1019");
 MODULE_ALIAS("platform:rt5682-max");
 MODULE_ALIAS("platform:rt5682s-max");
 MODULE_ALIAS("platform:rt5682s-rt1019");
+MODULE_ALIAS("platform:nau8825-max");
 MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
index 0a54567a2841..7b4c625da40d 100644
--- a/sound/soc/amd/mach-config.h
+++ b/sound/soc/amd/mach-config.h
@@ -19,6 +19,7 @@
 #define ACP_PCI_DEV_ID			0x15E2
 
 extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
+extern struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[];
 
 struct config_entry {
 	u32 flags;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/2] ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs instance
  2022-05-23 13:23 [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 V sujith kumar Reddy
@ 2022-05-23 13:23   ` V sujith kumar Reddy
  2022-05-23 13:23   ` V sujith kumar Reddy
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: V sujith kumar Reddy @ 2022-05-23 13:23 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	ajitkumar.pandey, V sujith kumar Reddy, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Ajit Kumar Pandey,
	Pierre-Louis Bossart, Kai Vehmanen, Jia-Ju Bai, Akihiko Odaki,
	open list

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@amd.com>
---
 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 f73c187fee03..5c7b51b2ecfb 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 = (void *)&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",
+	},
 	{},
 };
 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 4f5cfa26c58d..1ce0e0080515 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;
+	int ret = 0;
 
-	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);
 	if (ret < 0) {
 		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
 		return ret;
@@ -162,10 +167,13 @@ static int acp_card_hs_startup(struct snd_pcm_substream *substream)
 				      &constraints_channels);
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 				      &constraints_rates);
-
-	ret = acp_clk_enable(drvdata);
-	if (ret < 0)
-		dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
+	if (!drvdata->soc_mclk) {
+		ret = acp_clk_enable(drvdata);
+		if (ret < 0) {
+			dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
+			return ret;
+		}
+	}
 
 	return ret;
 }
@@ -201,6 +209,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
 	struct acp_card_drvdata *drvdata = card->drvdata;
 	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
 	struct snd_soc_component *component = codec_dai->component;
+	unsigned int fmt;
 	int ret;
 
 	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
@@ -208,8 +217,12 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
 	if (drvdata->hs_codec_id != RT5682S)
 		return -EINVAL;
 
-	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);
 	if (ret < 0) {
 		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
 		return ret;
@@ -236,8 +249,10 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
-	drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
-	drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
+	if (!drvdata->soc_mclk) {
+		drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
+		drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
+	}
 
 	ret = snd_soc_card_jack_new(card, "Headset Jack",
 				    SND_JACK_HEADSET | SND_JACK_LINEOUT |
@@ -298,6 +313,9 @@ static const struct snd_soc_ops acp_card_dmic_ops = {
 SND_SOC_DAILINK_DEF(rt1019,
 	DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:00", "rt1019-aif"),
 			  COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
+SND_SOC_DAILINK_DEF(rt1019_1,
+		    DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:02", "rt1019-aif"),
+		    COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
 
 static const struct snd_soc_dapm_route rt1019_map_lr[] = {
 	{ "Left Spk", NULL, "Left SPO" },
@@ -315,6 +333,17 @@ static struct snd_soc_codec_conf rt1019_conf[] = {
 	},
 };
 
+static struct snd_soc_codec_conf rt1019_1_conf[] = {
+	{
+		.dlc = COMP_CODEC_CONF("i2c-10EC1019:02"),
+		.name_prefix = "Left",
+	},
+	{
+		.dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),
+		.name_prefix = "Right",
+	},
+};
+
 static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_card *card = rtd->card;
@@ -618,6 +647,12 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 			links[i].init = acp_card_nau8825_init;
 			links[i].ops = &acp_card_nau8825_ops;
 		}
+		if (drv_data->hs_codec_id == RT5682S) {
+			links[i].codecs = rt5682s;
+			links[i].num_codecs = ARRAY_SIZE(rt5682s);
+			links[i].init = acp_card_rt5682s_init;
+			links[i].ops = &acp_card_rt5682s_ops;
+		}
 		i++;
 	}
 
@@ -674,6 +709,18 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 			links[i].ops = &acp_card_maxim_ops;
 			links[i].init = acp_card_maxim_init;
 		}
+		if (drv_data->amp_codec_id == RT1019) {
+			links[i].codecs = rt1019;
+			links[i].num_codecs = ARRAY_SIZE(rt1019);
+			links[i].ops = &acp_card_rt1019_ops;
+			links[i].init = acp_card_rt1019_init;
+			card->codec_conf = rt1019_conf;
+			card->num_configs = ARRAY_SIZE(rt1019_conf);
+			links[i].codecs = rt1019_1;
+			links[i].num_codecs = ARRAY_SIZE(rt1019_1);
+			card->codec_conf = rt1019_1_conf;
+			card->num_configs = ARRAY_SIZE(rt1019_1_conf);
+		}
 		i++;
 	}
 
diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
index adbae809f2aa..f19f064a7527 100644
--- a/sound/soc/amd/acp/acp-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sof-mach.c
@@ -66,6 +66,16 @@ static struct acp_card_drvdata sof_nau8825_data = {
 	.soc_mclk = true,
 };
 
+static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = {
+	.hs_cpu_id = I2S_HS,
+	.amp_cpu_id = I2S_HS,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = RT5682S,
+	.amp_codec_id = RT1019,
+	.dmic_codec_id = DMIC,
+	.soc_mclk = true,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -138,6 +148,10 @@ static const struct platform_device_id board_ids[] = {
 		.name = "nau8825-max",
 		.driver_data = (kernel_ulong_t)&sof_nau8825_data
 	},
+	{
+		.name = "rt5682s-hs-rt1019",
+		.driver_data = (kernel_ulong_t)&sof_rt5682s_hs_rt1019_data
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -158,4 +172,5 @@ MODULE_ALIAS("platform:rt5682-max");
 MODULE_ALIAS("platform:rt5682s-max");
 MODULE_ALIAS("platform:rt5682s-rt1019");
 MODULE_ALIAS("platform:nau8825-max");
+MODULE_ALIAS("platform:rt5682s-hs-rt1019");
 MODULE_LICENSE("GPL v2");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/2] ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs instance
@ 2022-05-23 13:23   ` V sujith kumar Reddy
  0 siblings, 0 replies; 13+ messages in thread
From: V sujith kumar Reddy @ 2022-05-23 13:23 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Pierre-Louis Bossart, Sunil-kumar.Dommati, Ajit Kumar Pandey,
	Kai Vehmanen, open list, Basavaraj.Hiregoudar, Takashi Iwai,
	Liam Girdwood, Jia-Ju Bai, Akihiko Odaki, Vijendar.Mukunda,
	V sujith kumar Reddy

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@amd.com>
---
 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 f73c187fee03..5c7b51b2ecfb 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 = (void *)&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",
+	},
 	{},
 };
 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 4f5cfa26c58d..1ce0e0080515 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;
+	int ret = 0;
 
-	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);
 	if (ret < 0) {
 		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
 		return ret;
@@ -162,10 +167,13 @@ static int acp_card_hs_startup(struct snd_pcm_substream *substream)
 				      &constraints_channels);
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 				      &constraints_rates);
-
-	ret = acp_clk_enable(drvdata);
-	if (ret < 0)
-		dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
+	if (!drvdata->soc_mclk) {
+		ret = acp_clk_enable(drvdata);
+		if (ret < 0) {
+			dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
+			return ret;
+		}
+	}
 
 	return ret;
 }
@@ -201,6 +209,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
 	struct acp_card_drvdata *drvdata = card->drvdata;
 	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
 	struct snd_soc_component *component = codec_dai->component;
+	unsigned int fmt;
 	int ret;
 
 	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
@@ -208,8 +217,12 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
 	if (drvdata->hs_codec_id != RT5682S)
 		return -EINVAL;
 
-	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);
 	if (ret < 0) {
 		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
 		return ret;
@@ -236,8 +249,10 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
-	drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
-	drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
+	if (!drvdata->soc_mclk) {
+		drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
+		drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
+	}
 
 	ret = snd_soc_card_jack_new(card, "Headset Jack",
 				    SND_JACK_HEADSET | SND_JACK_LINEOUT |
@@ -298,6 +313,9 @@ static const struct snd_soc_ops acp_card_dmic_ops = {
 SND_SOC_DAILINK_DEF(rt1019,
 	DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:00", "rt1019-aif"),
 			  COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
+SND_SOC_DAILINK_DEF(rt1019_1,
+		    DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:02", "rt1019-aif"),
+		    COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
 
 static const struct snd_soc_dapm_route rt1019_map_lr[] = {
 	{ "Left Spk", NULL, "Left SPO" },
@@ -315,6 +333,17 @@ static struct snd_soc_codec_conf rt1019_conf[] = {
 	},
 };
 
+static struct snd_soc_codec_conf rt1019_1_conf[] = {
+	{
+		.dlc = COMP_CODEC_CONF("i2c-10EC1019:02"),
+		.name_prefix = "Left",
+	},
+	{
+		.dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),
+		.name_prefix = "Right",
+	},
+};
+
 static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_card *card = rtd->card;
@@ -618,6 +647,12 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 			links[i].init = acp_card_nau8825_init;
 			links[i].ops = &acp_card_nau8825_ops;
 		}
+		if (drv_data->hs_codec_id == RT5682S) {
+			links[i].codecs = rt5682s;
+			links[i].num_codecs = ARRAY_SIZE(rt5682s);
+			links[i].init = acp_card_rt5682s_init;
+			links[i].ops = &acp_card_rt5682s_ops;
+		}
 		i++;
 	}
 
@@ -674,6 +709,18 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 			links[i].ops = &acp_card_maxim_ops;
 			links[i].init = acp_card_maxim_init;
 		}
+		if (drv_data->amp_codec_id == RT1019) {
+			links[i].codecs = rt1019;
+			links[i].num_codecs = ARRAY_SIZE(rt1019);
+			links[i].ops = &acp_card_rt1019_ops;
+			links[i].init = acp_card_rt1019_init;
+			card->codec_conf = rt1019_conf;
+			card->num_configs = ARRAY_SIZE(rt1019_conf);
+			links[i].codecs = rt1019_1;
+			links[i].num_codecs = ARRAY_SIZE(rt1019_1);
+			card->codec_conf = rt1019_1_conf;
+			card->num_configs = ARRAY_SIZE(rt1019_1_conf);
+		}
 		i++;
 	}
 
diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
index adbae809f2aa..f19f064a7527 100644
--- a/sound/soc/amd/acp/acp-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sof-mach.c
@@ -66,6 +66,16 @@ static struct acp_card_drvdata sof_nau8825_data = {
 	.soc_mclk = true,
 };
 
+static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = {
+	.hs_cpu_id = I2S_HS,
+	.amp_cpu_id = I2S_HS,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = RT5682S,
+	.amp_codec_id = RT1019,
+	.dmic_codec_id = DMIC,
+	.soc_mclk = true,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -138,6 +148,10 @@ static const struct platform_device_id board_ids[] = {
 		.name = "nau8825-max",
 		.driver_data = (kernel_ulong_t)&sof_nau8825_data
 	},
+	{
+		.name = "rt5682s-hs-rt1019",
+		.driver_data = (kernel_ulong_t)&sof_rt5682s_hs_rt1019_data
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -158,4 +172,5 @@ MODULE_ALIAS("platform:rt5682-max");
 MODULE_ALIAS("platform:rt5682s-max");
 MODULE_ALIAS("platform:rt5682s-rt1019");
 MODULE_ALIAS("platform:nau8825-max");
+MODULE_ALIAS("platform:rt5682s-hs-rt1019");
 MODULE_LICENSE("GPL v2");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s,rt1019
  2022-05-23 13:23 [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 V sujith kumar Reddy
  2022-05-23 13:23   ` V sujith kumar Reddy
  2022-05-23 13:23   ` V sujith kumar Reddy
@ 2022-05-23 13:28 ` Reddy, V sujith kumar
  2022-06-07 10:54 ` [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 Mark Brown
  3 siblings, 0 replies; 13+ messages in thread
From: Reddy, V sujith kumar @ 2022-05-23 13:28 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Hiregoudar, Basavaraj, Dommati, Sunil-kumar, Pandey, Ajit Kumar,
	Mukunda, Vijendar

[AMD Official Use Only - General]



________________________________
From: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
Sent: Monday, May 23, 2022 6:53 PM
To: broonie@kernel.org <broonie@kernel.org>; alsa-devel@alsa-project.org <alsa-devel@alsa-project.org>
Cc: Mukunda, Vijendar <Vijendar.Mukunda@amd.com>; Hiregoudar, Basavaraj <Basavaraj.Hiregoudar@amd.com>; Dommati, Sunil-kumar <Sunil-kumar.Dommati@amd.com>; Pandey, Ajit Kumar <AjitKumar.Pandey@amd.com>; Reddy, V sujith kumar <Vsujithkumar.Reddy@amd.com>
Subject: [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s,rt1019

This patch set depends on:
        --gpio patch
        --https://patchwork.kernel.org/project/alsa-devel/patch/20220516160619.17832-1-Vsujithkumar.Reddy@amd.com/
        --https://patchwork.kernel.org/project/alsa-devel/patch/20220516160619.17832-2-Vsujithkumar.Reddy@amd.com/

Resolved  compilation error:

/build/stage/linux/sound/soc/amd/acp/acp-mach-common.c: In function ‘acp_card_nau8825_init’:
/build/stage/linux/sound/soc/amd/acp/acp-mach-common.c:479:15: error: too many arguments to function ‘snd_soc_card_jack_new’
  479 |         ret = snd_soc_card_jack_new(card, "Headset Jack",
      |               ^~~~~~~~~~~~~~~~~~~~~
In file included from /build/stage/linux/include/sound/soc.h:1362,
                 from /build/stage/linux/sound/soc/amd/acp/acp-mach-common.c:20:
/build/stage/linux/include/sound/soc-card.h:18:5: note: declared here
   18 | int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type


>>>Resolved compilation error and pushed v3 patchset
V sujith kumar Reddy (2):
  ASoC: amd: acp: Add support for nau8825 and max98360 card
  ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs
    instance

 sound/soc/amd/acp-config.c          |  30 ++++
 sound/soc/amd/acp/Kconfig           |   1 +
 sound/soc/amd/acp/acp-mach-common.c | 235 ++++++++++++++++++++++++++--
 sound/soc/amd/acp/acp-mach.h        |   3 +
 sound/soc/amd/acp/acp-sof-mach.c    |  30 ++++
 sound/soc/amd/mach-config.h         |   1 +
 6 files changed, 283 insertions(+), 17 deletions(-)

--
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
  2022-05-23 13:23   ` V sujith kumar Reddy
@ 2022-05-23 13:52     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-05-23 13:52 UTC (permalink / raw)
  To: V sujith kumar Reddy
  Cc: Pierre-Louis Bossart, ALSA Development Mailing List,
	Sunil-kumar.Dommati, Geert Uytterhoeven, ajitkumar.pandey,
	Kai Vehmanen, open list, Basavaraj.Hiregoudar, Takashi Iwai,
	Liam Girdwood, Mark Brown, Arnd Bergmann, Akihiko Odaki,
	Vijendar.Mukunda, Jia-Ju Bai, Daniel Baluta, Bard Liao

Hi Sujith,

On Mon, May 23, 2022 at 3:24 PM V sujith kumar Reddy
<Vsujithkumar.Reddy@amd.com> wrote:
> We have new platform with nau8825 as a primary codec and max98360 as an
> amp codec. Add machine struct to register sof audio based sound card
> on such Chrome machine.
>
> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>

Thanks for your patch!

> --- a/sound/soc/amd/acp-config.c
> +++ b/sound/soc/amd/acp-config.c
> @@ -130,4 +130,25 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
>  };
>  EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
>
> +struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
> +       {
> +               .id = "AMDI1019",
> +               .drv_name = "rmb-dsp",
> +               .pdata = (void *)&acp_quirk_data,

You can assign an arbitrary pointer type to "void *" without casting.
In fact the cast makes the code less safe, as it prevents the compiler
from informing you in case a future patch changes types.

The same applies to below, and to the existing casts.

> +               .fw_filename = "sof-rmb.ri",
> +               .sof_tplg_filename = "sof-acp-rmb.tplg",
> +       },
> +       {
> +               .id = "10508825",
> +               .drv_name = "nau8825-max",
> +               .pdata = (void *)&acp_quirk_data,
> +               .machine_quirk = snd_soc_acpi_codec_list,
> +               .quirk_data = &amp_max,
> +               .fw_filename = "sof-rmb.ri",
> +               .sof_tplg_filename = "sof-acp-rmb.tplg",
> +       },
> +       {},
> +};

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
@ 2022-05-23 13:52     ` Geert Uytterhoeven
  0 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-05-23 13:52 UTC (permalink / raw)
  To: V sujith kumar Reddy
  Cc: Mark Brown, ALSA Development Mailing List, Vijendar.Mukunda,
	Basavaraj.Hiregoudar, Sunil-kumar.Dommati, ajitkumar.pandey,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, Kai Vehmanen, Geert Uytterhoeven,
	Arnd Bergmann, Jia-Ju Bai, Akihiko Odaki, Daniel Baluta,
	Bard Liao, open list

Hi Sujith,

On Mon, May 23, 2022 at 3:24 PM V sujith kumar Reddy
<Vsujithkumar.Reddy@amd.com> wrote:
> We have new platform with nau8825 as a primary codec and max98360 as an
> amp codec. Add machine struct to register sof audio based sound card
> on such Chrome machine.
>
> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>

Thanks for your patch!

> --- a/sound/soc/amd/acp-config.c
> +++ b/sound/soc/amd/acp-config.c
> @@ -130,4 +130,25 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
>  };
>  EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
>
> +struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
> +       {
> +               .id = "AMDI1019",
> +               .drv_name = "rmb-dsp",
> +               .pdata = (void *)&acp_quirk_data,

You can assign an arbitrary pointer type to "void *" without casting.
In fact the cast makes the code less safe, as it prevents the compiler
from informing you in case a future patch changes types.

The same applies to below, and to the existing casts.

> +               .fw_filename = "sof-rmb.ri",
> +               .sof_tplg_filename = "sof-acp-rmb.tplg",
> +       },
> +       {
> +               .id = "10508825",
> +               .drv_name = "nau8825-max",
> +               .pdata = (void *)&acp_quirk_data,
> +               .machine_quirk = snd_soc_acpi_codec_list,
> +               .quirk_data = &amp_max,
> +               .fw_filename = "sof-rmb.ri",
> +               .sof_tplg_filename = "sof-acp-rmb.tplg",
> +       },
> +       {},
> +};

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
  2022-05-23 13:23   ` V sujith kumar Reddy
@ 2022-05-24  5:54     ` Akihiko Odaki
  -1 siblings, 0 replies; 13+ messages in thread
From: Akihiko Odaki @ 2022-05-24  5:54 UTC (permalink / raw)
  To: V sujith kumar Reddy, broonie, alsa-devel
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	ajitkumar.pandey, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, Kai Vehmanen, Geert Uytterhoeven,
	Arnd Bergmann, Jia-Ju Bai, Daniel Baluta, Bard Liao, open list

On 2022/05/23 22:23, V sujith kumar Reddy wrote:
> We have new platform with nau8825 as a primary codec and max98360 as an
> amp codec. Add machine struct to register sof audio based sound card
> on such Chrome machine.
> 
> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
> ---
>   sound/soc/amd/acp-config.c          |  21 ++++
>   sound/soc/amd/acp/Kconfig           |   1 +
>   sound/soc/amd/acp/acp-mach-common.c | 166 +++++++++++++++++++++++++++-
>   sound/soc/amd/acp/acp-mach.h        |   3 +
>   sound/soc/amd/acp/acp-sof-mach.c    |  15 +++
>   sound/soc/amd/mach-config.h         |   1 +
>   6 files changed, 201 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
> index 5cbc82eca4c9..f73c187fee03 100644
> --- a/sound/soc/amd/acp-config.c
> +++ b/sound/soc/amd/acp-config.c
> @@ -130,4 +130,25 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
>   };
>   EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
>   
> +struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
> +	{
> +		.id = "AMDI1019",
> +		.drv_name = "rmb-dsp",
> +		.pdata = (void *)&acp_quirk_data,
> +		.fw_filename = "sof-rmb.ri",
> +		.sof_tplg_filename = "sof-acp-rmb.tplg",
> +	},
> +	{
> +		.id = "10508825",
> +		.drv_name = "nau8825-max",
> +		.pdata = (void *)&acp_quirk_data,
> +		.machine_quirk = snd_soc_acpi_codec_list,
> +		.quirk_data = &amp_max,
> +		.fw_filename = "sof-rmb.ri",
> +		.sof_tplg_filename = "sof-acp-rmb.tplg",
> +	},
> +	{},
> +};
> +EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
> +
>   MODULE_LICENSE("Dual BSD/GPL");
> diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
> index 9dae2719084c..7e56d2644105 100644
> --- a/sound/soc/amd/acp/Kconfig
> +++ b/sound/soc/amd/acp/Kconfig
> @@ -49,6 +49,7 @@ config SND_SOC_AMD_MACH_COMMON
>   	select SND_SOC_RT1019
>   	select SND_SOC_MAX98357A
>   	select SND_SOC_RT5682S
> +	select SND_SOC_NAU8825
>   	help
>   	  This option enables common Machine driver module for ACP.
>   
> diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
> index 6ae454bf60af..4f5cfa26c58d 100644
> --- a/sound/soc/amd/acp/acp-mach-common.c
> +++ b/sound/soc/amd/acp/acp-mach-common.c
> @@ -24,6 +24,7 @@
>   #include "../../codecs/rt5682.h"
>   #include "../../codecs/rt1019.h"
>   #include "../../codecs/rt5682s.h"
> +#include "../../codecs/nau8825.h"
>   #include "acp-mach.h"
>   
>   #define PCO_PLAT_CLK 48000000
> @@ -175,7 +176,8 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream)
>   	struct snd_soc_card *card = rtd->card;
>   	struct acp_card_drvdata *drvdata = card->drvdata;
>   
> -	clk_disable_unprepare(drvdata->wclk);
> +	if (!drvdata->soc_mclk)
> +		clk_disable_unprepare(drvdata->wclk);
>   }
>   
>   static const struct snd_soc_ops acp_card_rt5682_ops = {
> @@ -363,7 +365,7 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
>   	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
>   	struct snd_soc_card *card = rtd->card;
>   	struct acp_card_drvdata *drvdata = card->drvdata;
> -	int ret;
> +	int ret = 0;
>   
>   	runtime->hw.channels_max = DUAL_CHANNEL;
>   	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
> @@ -371,10 +373,13 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
>   	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
>   				      &constraints_rates);
>   
> -	ret = acp_clk_enable(drvdata);
> -	if (ret < 0)
> -		dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
> -
> +	if (!drvdata->soc_mclk) {
> +		ret = acp_clk_enable(drvdata);
> +		if (ret < 0) {
> +			dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
> +			return ret;
> +		}
> +	}
>   	return ret;
>   }
>   
> @@ -409,6 +414,104 @@ static const struct snd_soc_ops acp_card_maxim_ops = {
>   	.shutdown = acp_card_shutdown,
>   };
>   
> +/* Declare nau8825 codec components */
> +SND_SOC_DAILINK_DEF(nau8825,
> +		    DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
> +
> +static const struct snd_soc_dapm_route nau8825_map[] = {
> +	{ "Headphone Jack", NULL, "HPOL" },
> +	{ "Headphone Jack", NULL, "HPOR" },
> +};
> +
> +static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
> +{
> +	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);
> +	struct snd_soc_component *component = codec_dai->component;
> +	unsigned int fmt;
> +	int ret;
> +
> +	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
> +
> +	if (drvdata->hs_codec_id != NAU8825)
> +		return -EINVAL;
> +
> +	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);
> +	if (ret < 0) {
> +		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
> +		return ret;
> +	}
> +	ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
> +					 SND_JACK_HEADSET | SND_JACK_LINEOUT |
> +					 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
> +					 SND_JACK_BTN_2 | SND_JACK_BTN_3,
> +					 &pco_jack, NULL, 0);

Here, snd_soc_card_jack_new() should be used instead. Please refer 
comments in sound/soc/soc-card.c for differences between those two 
functions.

Regards,
Akihiko Odaki

> +	if (ret) {
> +		dev_err(card->dev, "HP jack creation failed %d\n", ret);
> +		return ret;
> +	}
> +
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
> +
> +	ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
> +	if (ret) {
> +		dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map));
> +}
> +
> +static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
> +				 struct snd_pcm_hw_params *params)
> +{
> +	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
> +	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
> +	int ret;
> +
> +	ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS,
> +				     (48000 * 256), SND_SOC_CLOCK_IN);
> +	if (ret < 0)
> +		dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
> +
> +	ret = snd_soc_dai_set_pll(codec_dai, 0, 0, params_rate(params),
> +				  params_rate(params) * 256);
> +	if (ret < 0) {
> +		dev_err(rtd->dev, "can't set FLL: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return ret;
> +}
> +
> +static int acp_nau8825_startup(struct snd_pcm_substream *substream)
> +{
> +	struct snd_pcm_runtime *runtime = substream->runtime;
> +
> +	runtime->hw.channels_max = 2;
> +	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
> +				   &constraints_channels);
> +
> +	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
> +	snd_pcm_hw_constraint_list(runtime, 0,
> +				   SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
> +	return 0;
> +}
> +
> +static const struct snd_soc_ops acp_card_nau8825_ops = {
> +	.startup =  acp_nau8825_startup,
> +	.hw_params = acp_nau8825_hw_params,
> +};
> +
>   /* Declare DMIC codec components */
>   SND_SOC_DAILINK_DEF(dmic_codec,
>   		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
> @@ -437,6 +540,8 @@ SND_SOC_DAILINK_DEF(i2s_sp,
>   	DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
>   SND_SOC_DAILINK_DEF(sof_sp,
>   	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
> +SND_SOC_DAILINK_DEF(sof_hs,
> +		    DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
>   SND_SOC_DAILINK_DEF(sof_dmic,
>   	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
>   SND_SOC_DAILINK_DEF(pdm_dmic,
> @@ -491,6 +596,31 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
>   		i++;
>   	}
>   
> +	if (drv_data->hs_cpu_id == I2S_HS) {
> +		links[i].name = "acp-headset-codec";
> +		links[i].id = HEADSET_BE_ID;
> +		links[i].cpus = sof_hs;
> +		links[i].num_cpus = ARRAY_SIZE(sof_hs);
> +		links[i].platforms = sof_component;
> +		links[i].num_platforms = ARRAY_SIZE(sof_component);
> +		links[i].dpcm_playback = 1;
> +		links[i].dpcm_capture = 1;
> +		links[i].nonatomic = true;
> +		links[i].no_pcm = 1;
> +		if (!drv_data->hs_codec_id) {
> +			/* Use dummy codec if codec id not specified */
> +			links[i].codecs = dummy_codec;
> +			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
> +		}
> +		if (drv_data->hs_codec_id == NAU8825) {
> +			links[i].codecs = nau8825;
> +			links[i].num_codecs = ARRAY_SIZE(nau8825);
> +			links[i].init = acp_card_nau8825_init;
> +			links[i].ops = &acp_card_nau8825_ops;
> +		}
> +		i++;
> +	}
> +
>   	if (drv_data->amp_cpu_id == I2S_SP) {
>   		links[i].name = "acp-amp-codec";
>   		links[i].id = AMP_BE_ID;
> @@ -523,6 +653,30 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
>   		i++;
>   	}
>   
> +	if (drv_data->amp_cpu_id == I2S_HS) {
> +		links[i].name = "acp-amp-codec";
> +		links[i].id = AMP_BE_ID;
> +		links[i].cpus = sof_hs;
> +		links[i].num_cpus = ARRAY_SIZE(sof_hs);
> +		links[i].platforms = sof_component;
> +		links[i].num_platforms = ARRAY_SIZE(sof_component);
> +		links[i].dpcm_playback = 1;
> +		links[i].nonatomic = true;
> +		links[i].no_pcm = 1;
> +		if (!drv_data->amp_codec_id) {
> +			/* Use dummy codec if codec id not specified */
> +			links[i].codecs = dummy_codec;
> +			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
> +		}
> +		if (drv_data->amp_codec_id == MAX98360A) {
> +			links[i].codecs = max98360a;
> +			links[i].num_codecs = ARRAY_SIZE(max98360a);
> +			links[i].ops = &acp_card_maxim_ops;
> +			links[i].init = acp_card_maxim_init;
> +		}
> +		i++;
> +	}
> +
>   	if (drv_data->dmic_cpu_id == DMIC) {
>   		links[i].name = "acp-dmic-codec";
>   		links[i].id = DMIC_BE_ID;
> diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
> index 5dc47cfbff10..c95ee1c52eb1 100644
> --- a/sound/soc/amd/acp/acp-mach.h
> +++ b/sound/soc/amd/acp/acp-mach.h
> @@ -26,6 +26,7 @@ enum be_id {
>   
>   enum cpu_endpoints {
>   	NONE = 0,
> +	I2S_HS,
>   	I2S_SP,
>   	I2S_BT,
>   	DMIC,
> @@ -37,6 +38,7 @@ enum codec_endpoints {
>   	RT1019,
>   	MAX98360A,
>   	RT5682S,
> +	NAU8825,
>   };
>   
>   struct acp_card_drvdata {
> @@ -49,6 +51,7 @@ struct acp_card_drvdata {
>   	unsigned int dai_fmt;
>   	struct clk *wclk;
>   	struct clk *bclk;
> +	bool soc_mclk;
>   };
>   
>   int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
> diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
> index d1531cdab110..adbae809f2aa 100644
> --- a/sound/soc/amd/acp/acp-sof-mach.c
> +++ b/sound/soc/amd/acp/acp-sof-mach.c
> @@ -56,6 +56,16 @@ static struct acp_card_drvdata sof_rt5682s_max_data = {
>   	.dmic_codec_id = DMIC,
>   };
>   
> +static struct acp_card_drvdata sof_nau8825_data = {
> +	.hs_cpu_id = I2S_HS,
> +	.amp_cpu_id = I2S_HS,
> +	.dmic_cpu_id = DMIC,
> +	.hs_codec_id = NAU8825,
> +	.amp_codec_id = MAX98360A,
> +	.dmic_codec_id = DMIC,
> +	.soc_mclk = true,
> +};
> +
>   static const struct snd_kcontrol_new acp_controls[] = {
>   	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
>   	SOC_DAPM_PIN_SWITCH("Headset Mic"),
> @@ -124,6 +134,10 @@ static const struct platform_device_id board_ids[] = {
>   		.name = "rt5682s-rt1019",
>   		.driver_data = (kernel_ulong_t)&sof_rt5682s_rt1019_data
>   	},
> +	{
> +		.name = "nau8825-max",
> +		.driver_data = (kernel_ulong_t)&sof_nau8825_data
> +	},
>   	{ }
>   };
>   static struct platform_driver acp_asoc_audio = {
> @@ -143,4 +157,5 @@ MODULE_ALIAS("platform:rt5682-rt1019");
>   MODULE_ALIAS("platform:rt5682-max");
>   MODULE_ALIAS("platform:rt5682s-max");
>   MODULE_ALIAS("platform:rt5682s-rt1019");
> +MODULE_ALIAS("platform:nau8825-max");
>   MODULE_LICENSE("GPL v2");
> diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
> index 0a54567a2841..7b4c625da40d 100644
> --- a/sound/soc/amd/mach-config.h
> +++ b/sound/soc/amd/mach-config.h
> @@ -19,6 +19,7 @@
>   #define ACP_PCI_DEV_ID			0x15E2
>   
>   extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
> +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[];
>   
>   struct config_entry {
>   	u32 flags;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
@ 2022-05-24  5:54     ` Akihiko Odaki
  0 siblings, 0 replies; 13+ messages in thread
From: Akihiko Odaki @ 2022-05-24  5:54 UTC (permalink / raw)
  To: V sujith kumar Reddy, broonie, alsa-devel
  Cc: Pierre-Louis Bossart, Sunil-kumar.Dommati, Geert Uytterhoeven,
	ajitkumar.pandey, Kai Vehmanen, open list, Basavaraj.Hiregoudar,
	Takashi Iwai, Liam Girdwood, Jia-Ju Bai, Arnd Bergmann,
	Vijendar.Mukunda, Daniel Baluta, Bard Liao

On 2022/05/23 22:23, V sujith kumar Reddy wrote:
> We have new platform with nau8825 as a primary codec and max98360 as an
> amp codec. Add machine struct to register sof audio based sound card
> on such Chrome machine.
> 
> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
> ---
>   sound/soc/amd/acp-config.c          |  21 ++++
>   sound/soc/amd/acp/Kconfig           |   1 +
>   sound/soc/amd/acp/acp-mach-common.c | 166 +++++++++++++++++++++++++++-
>   sound/soc/amd/acp/acp-mach.h        |   3 +
>   sound/soc/amd/acp/acp-sof-mach.c    |  15 +++
>   sound/soc/amd/mach-config.h         |   1 +
>   6 files changed, 201 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
> index 5cbc82eca4c9..f73c187fee03 100644
> --- a/sound/soc/amd/acp-config.c
> +++ b/sound/soc/amd/acp-config.c
> @@ -130,4 +130,25 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
>   };
>   EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
>   
> +struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
> +	{
> +		.id = "AMDI1019",
> +		.drv_name = "rmb-dsp",
> +		.pdata = (void *)&acp_quirk_data,
> +		.fw_filename = "sof-rmb.ri",
> +		.sof_tplg_filename = "sof-acp-rmb.tplg",
> +	},
> +	{
> +		.id = "10508825",
> +		.drv_name = "nau8825-max",
> +		.pdata = (void *)&acp_quirk_data,
> +		.machine_quirk = snd_soc_acpi_codec_list,
> +		.quirk_data = &amp_max,
> +		.fw_filename = "sof-rmb.ri",
> +		.sof_tplg_filename = "sof-acp-rmb.tplg",
> +	},
> +	{},
> +};
> +EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
> +
>   MODULE_LICENSE("Dual BSD/GPL");
> diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
> index 9dae2719084c..7e56d2644105 100644
> --- a/sound/soc/amd/acp/Kconfig
> +++ b/sound/soc/amd/acp/Kconfig
> @@ -49,6 +49,7 @@ config SND_SOC_AMD_MACH_COMMON
>   	select SND_SOC_RT1019
>   	select SND_SOC_MAX98357A
>   	select SND_SOC_RT5682S
> +	select SND_SOC_NAU8825
>   	help
>   	  This option enables common Machine driver module for ACP.
>   
> diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
> index 6ae454bf60af..4f5cfa26c58d 100644
> --- a/sound/soc/amd/acp/acp-mach-common.c
> +++ b/sound/soc/amd/acp/acp-mach-common.c
> @@ -24,6 +24,7 @@
>   #include "../../codecs/rt5682.h"
>   #include "../../codecs/rt1019.h"
>   #include "../../codecs/rt5682s.h"
> +#include "../../codecs/nau8825.h"
>   #include "acp-mach.h"
>   
>   #define PCO_PLAT_CLK 48000000
> @@ -175,7 +176,8 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream)
>   	struct snd_soc_card *card = rtd->card;
>   	struct acp_card_drvdata *drvdata = card->drvdata;
>   
> -	clk_disable_unprepare(drvdata->wclk);
> +	if (!drvdata->soc_mclk)
> +		clk_disable_unprepare(drvdata->wclk);
>   }
>   
>   static const struct snd_soc_ops acp_card_rt5682_ops = {
> @@ -363,7 +365,7 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
>   	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
>   	struct snd_soc_card *card = rtd->card;
>   	struct acp_card_drvdata *drvdata = card->drvdata;
> -	int ret;
> +	int ret = 0;
>   
>   	runtime->hw.channels_max = DUAL_CHANNEL;
>   	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
> @@ -371,10 +373,13 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream)
>   	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
>   				      &constraints_rates);
>   
> -	ret = acp_clk_enable(drvdata);
> -	if (ret < 0)
> -		dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
> -
> +	if (!drvdata->soc_mclk) {
> +		ret = acp_clk_enable(drvdata);
> +		if (ret < 0) {
> +			dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret);
> +			return ret;
> +		}
> +	}
>   	return ret;
>   }
>   
> @@ -409,6 +414,104 @@ static const struct snd_soc_ops acp_card_maxim_ops = {
>   	.shutdown = acp_card_shutdown,
>   };
>   
> +/* Declare nau8825 codec components */
> +SND_SOC_DAILINK_DEF(nau8825,
> +		    DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
> +
> +static const struct snd_soc_dapm_route nau8825_map[] = {
> +	{ "Headphone Jack", NULL, "HPOL" },
> +	{ "Headphone Jack", NULL, "HPOR" },
> +};
> +
> +static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
> +{
> +	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);
> +	struct snd_soc_component *component = codec_dai->component;
> +	unsigned int fmt;
> +	int ret;
> +
> +	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
> +
> +	if (drvdata->hs_codec_id != NAU8825)
> +		return -EINVAL;
> +
> +	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);
> +	if (ret < 0) {
> +		dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
> +		return ret;
> +	}
> +	ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
> +					 SND_JACK_HEADSET | SND_JACK_LINEOUT |
> +					 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
> +					 SND_JACK_BTN_2 | SND_JACK_BTN_3,
> +					 &pco_jack, NULL, 0);

Here, snd_soc_card_jack_new() should be used instead. Please refer 
comments in sound/soc/soc-card.c for differences between those two 
functions.

Regards,
Akihiko Odaki

> +	if (ret) {
> +		dev_err(card->dev, "HP jack creation failed %d\n", ret);
> +		return ret;
> +	}
> +
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
> +	snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
> +
> +	ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
> +	if (ret) {
> +		dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map));
> +}
> +
> +static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
> +				 struct snd_pcm_hw_params *params)
> +{
> +	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
> +	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
> +	int ret;
> +
> +	ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS,
> +				     (48000 * 256), SND_SOC_CLOCK_IN);
> +	if (ret < 0)
> +		dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
> +
> +	ret = snd_soc_dai_set_pll(codec_dai, 0, 0, params_rate(params),
> +				  params_rate(params) * 256);
> +	if (ret < 0) {
> +		dev_err(rtd->dev, "can't set FLL: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return ret;
> +}
> +
> +static int acp_nau8825_startup(struct snd_pcm_substream *substream)
> +{
> +	struct snd_pcm_runtime *runtime = substream->runtime;
> +
> +	runtime->hw.channels_max = 2;
> +	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
> +				   &constraints_channels);
> +
> +	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
> +	snd_pcm_hw_constraint_list(runtime, 0,
> +				   SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
> +	return 0;
> +}
> +
> +static const struct snd_soc_ops acp_card_nau8825_ops = {
> +	.startup =  acp_nau8825_startup,
> +	.hw_params = acp_nau8825_hw_params,
> +};
> +
>   /* Declare DMIC codec components */
>   SND_SOC_DAILINK_DEF(dmic_codec,
>   		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
> @@ -437,6 +540,8 @@ SND_SOC_DAILINK_DEF(i2s_sp,
>   	DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
>   SND_SOC_DAILINK_DEF(sof_sp,
>   	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
> +SND_SOC_DAILINK_DEF(sof_hs,
> +		    DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
>   SND_SOC_DAILINK_DEF(sof_dmic,
>   	DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
>   SND_SOC_DAILINK_DEF(pdm_dmic,
> @@ -491,6 +596,31 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
>   		i++;
>   	}
>   
> +	if (drv_data->hs_cpu_id == I2S_HS) {
> +		links[i].name = "acp-headset-codec";
> +		links[i].id = HEADSET_BE_ID;
> +		links[i].cpus = sof_hs;
> +		links[i].num_cpus = ARRAY_SIZE(sof_hs);
> +		links[i].platforms = sof_component;
> +		links[i].num_platforms = ARRAY_SIZE(sof_component);
> +		links[i].dpcm_playback = 1;
> +		links[i].dpcm_capture = 1;
> +		links[i].nonatomic = true;
> +		links[i].no_pcm = 1;
> +		if (!drv_data->hs_codec_id) {
> +			/* Use dummy codec if codec id not specified */
> +			links[i].codecs = dummy_codec;
> +			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
> +		}
> +		if (drv_data->hs_codec_id == NAU8825) {
> +			links[i].codecs = nau8825;
> +			links[i].num_codecs = ARRAY_SIZE(nau8825);
> +			links[i].init = acp_card_nau8825_init;
> +			links[i].ops = &acp_card_nau8825_ops;
> +		}
> +		i++;
> +	}
> +
>   	if (drv_data->amp_cpu_id == I2S_SP) {
>   		links[i].name = "acp-amp-codec";
>   		links[i].id = AMP_BE_ID;
> @@ -523,6 +653,30 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
>   		i++;
>   	}
>   
> +	if (drv_data->amp_cpu_id == I2S_HS) {
> +		links[i].name = "acp-amp-codec";
> +		links[i].id = AMP_BE_ID;
> +		links[i].cpus = sof_hs;
> +		links[i].num_cpus = ARRAY_SIZE(sof_hs);
> +		links[i].platforms = sof_component;
> +		links[i].num_platforms = ARRAY_SIZE(sof_component);
> +		links[i].dpcm_playback = 1;
> +		links[i].nonatomic = true;
> +		links[i].no_pcm = 1;
> +		if (!drv_data->amp_codec_id) {
> +			/* Use dummy codec if codec id not specified */
> +			links[i].codecs = dummy_codec;
> +			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
> +		}
> +		if (drv_data->amp_codec_id == MAX98360A) {
> +			links[i].codecs = max98360a;
> +			links[i].num_codecs = ARRAY_SIZE(max98360a);
> +			links[i].ops = &acp_card_maxim_ops;
> +			links[i].init = acp_card_maxim_init;
> +		}
> +		i++;
> +	}
> +
>   	if (drv_data->dmic_cpu_id == DMIC) {
>   		links[i].name = "acp-dmic-codec";
>   		links[i].id = DMIC_BE_ID;
> diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
> index 5dc47cfbff10..c95ee1c52eb1 100644
> --- a/sound/soc/amd/acp/acp-mach.h
> +++ b/sound/soc/amd/acp/acp-mach.h
> @@ -26,6 +26,7 @@ enum be_id {
>   
>   enum cpu_endpoints {
>   	NONE = 0,
> +	I2S_HS,
>   	I2S_SP,
>   	I2S_BT,
>   	DMIC,
> @@ -37,6 +38,7 @@ enum codec_endpoints {
>   	RT1019,
>   	MAX98360A,
>   	RT5682S,
> +	NAU8825,
>   };
>   
>   struct acp_card_drvdata {
> @@ -49,6 +51,7 @@ struct acp_card_drvdata {
>   	unsigned int dai_fmt;
>   	struct clk *wclk;
>   	struct clk *bclk;
> +	bool soc_mclk;
>   };
>   
>   int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
> diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c
> index d1531cdab110..adbae809f2aa 100644
> --- a/sound/soc/amd/acp/acp-sof-mach.c
> +++ b/sound/soc/amd/acp/acp-sof-mach.c
> @@ -56,6 +56,16 @@ static struct acp_card_drvdata sof_rt5682s_max_data = {
>   	.dmic_codec_id = DMIC,
>   };
>   
> +static struct acp_card_drvdata sof_nau8825_data = {
> +	.hs_cpu_id = I2S_HS,
> +	.amp_cpu_id = I2S_HS,
> +	.dmic_cpu_id = DMIC,
> +	.hs_codec_id = NAU8825,
> +	.amp_codec_id = MAX98360A,
> +	.dmic_codec_id = DMIC,
> +	.soc_mclk = true,
> +};
> +
>   static const struct snd_kcontrol_new acp_controls[] = {
>   	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
>   	SOC_DAPM_PIN_SWITCH("Headset Mic"),
> @@ -124,6 +134,10 @@ static const struct platform_device_id board_ids[] = {
>   		.name = "rt5682s-rt1019",
>   		.driver_data = (kernel_ulong_t)&sof_rt5682s_rt1019_data
>   	},
> +	{
> +		.name = "nau8825-max",
> +		.driver_data = (kernel_ulong_t)&sof_nau8825_data
> +	},
>   	{ }
>   };
>   static struct platform_driver acp_asoc_audio = {
> @@ -143,4 +157,5 @@ MODULE_ALIAS("platform:rt5682-rt1019");
>   MODULE_ALIAS("platform:rt5682-max");
>   MODULE_ALIAS("platform:rt5682s-max");
>   MODULE_ALIAS("platform:rt5682s-rt1019");
> +MODULE_ALIAS("platform:nau8825-max");
>   MODULE_LICENSE("GPL v2");
> diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
> index 0a54567a2841..7b4c625da40d 100644
> --- a/sound/soc/amd/mach-config.h
> +++ b/sound/soc/amd/mach-config.h
> @@ -19,6 +19,7 @@
>   #define ACP_PCI_DEV_ID			0x15E2
>   
>   extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
> +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[];
>   
>   struct config_entry {
>   	u32 flags;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
  2022-05-24  5:54     ` Akihiko Odaki
@ 2022-05-24  6:24       ` Reddy, V sujith kumar
  -1 siblings, 0 replies; 13+ messages in thread
From: Reddy, V sujith kumar @ 2022-05-24  6:24 UTC (permalink / raw)
  To: Akihiko Odaki, broonie, alsa-devel
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	ajitkumar.pandey, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, Kai Vehmanen, Geert Uytterhoeven,
	Arnd Bergmann, Jia-Ju Bai, Daniel Baluta, Bard Liao, open list


On 5/24/2022 11:24 AM, Akihiko Odaki wrote:
> [CAUTION: External Email]
>
> On 2022/05/23 22:23, V sujith kumar Reddy wrote:
>> We have new platform with nau8825 as a primary codec and max98360 as an
>> amp codec. Add machine struct to register sof audio based sound card
>> on such Chrome machine.
>>
>> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
>> ---
>>   sound/soc/amd/acp-config.c          |  21 ++++
>>   sound/soc/amd/acp/Kconfig           |   1 +
>>   sound/soc/amd/acp/acp-mach-common.c | 166 +++++++++++++++++++++++++++-
>>   sound/soc/amd/acp/acp-mach.h        |   3 +
>>   sound/soc/amd/acp/acp-sof-mach.c    |  15 +++
>>   sound/soc/amd/mach-config.h         |   1 +
>>   6 files changed, 201 insertions(+), 6 deletions(-)
>>
>> diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
>> index 5cbc82eca4c9..f73c187fee03 100644
>> --- a/sound/soc/amd/acp-config.c
>> +++ b/sound/soc/amd/acp-config.c
>> @@ -130,4 +130,25 @@ struct snd_soc_acpi_mach 
>> snd_soc_acpi_amd_sof_machines[] = {
>>   };
>>   EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
>>
>> +struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
>> +     {
>> +             .id = "AMDI1019",
>> +             .drv_name = "rmb-dsp",
>> +             .pdata = (void *)&acp_quirk_data,
>> +             .fw_filename = "sof-rmb.ri",
>> +             .sof_tplg_filename = "sof-acp-rmb.tplg",
>> +     },
>> +     {
>> +             .id = "10508825",
>> +             .drv_name = "nau8825-max",
>> +             .pdata = (void *)&acp_quirk_data,
>> +             .machine_quirk = snd_soc_acpi_codec_list,
>> +             .quirk_data = &amp_max,
>> +             .fw_filename = "sof-rmb.ri",
>> +             .sof_tplg_filename = "sof-acp-rmb.tplg",
>> +     },
>> +     {},
>> +};
>> +EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
>> +
>>   MODULE_LICENSE("Dual BSD/GPL");
>> diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
>> index 9dae2719084c..7e56d2644105 100644
>> --- a/sound/soc/amd/acp/Kconfig
>> +++ b/sound/soc/amd/acp/Kconfig
>> @@ -49,6 +49,7 @@ config SND_SOC_AMD_MACH_COMMON
>>       select SND_SOC_RT1019
>>       select SND_SOC_MAX98357A
>>       select SND_SOC_RT5682S
>> +     select SND_SOC_NAU8825
>>       help
>>         This option enables common Machine driver module for ACP.
>>
>> diff --git a/sound/soc/amd/acp/acp-mach-common.c 
>> b/sound/soc/amd/acp/acp-mach-common.c
>> index 6ae454bf60af..4f5cfa26c58d 100644
>> --- a/sound/soc/amd/acp/acp-mach-common.c
>> +++ b/sound/soc/amd/acp/acp-mach-common.c
>> @@ -24,6 +24,7 @@
>>   #include "../../codecs/rt5682.h"
>>   #include "../../codecs/rt1019.h"
>>   #include "../../codecs/rt5682s.h"
>> +#include "../../codecs/nau8825.h"
>>   #include "acp-mach.h"
>>
>>   #define PCO_PLAT_CLK 48000000
>> @@ -175,7 +176,8 @@ static void acp_card_shutdown(struct 
>> snd_pcm_substream *substream)
>>       struct snd_soc_card *card = rtd->card;
>>       struct acp_card_drvdata *drvdata = card->drvdata;
>>
>> -     clk_disable_unprepare(drvdata->wclk);
>> +     if (!drvdata->soc_mclk)
>> +             clk_disable_unprepare(drvdata->wclk);
>>   }
>>
>>   static const struct snd_soc_ops acp_card_rt5682_ops = {
>> @@ -363,7 +365,7 @@ static int acp_card_amp_startup(struct 
>> snd_pcm_substream *substream)
>>       struct snd_soc_pcm_runtime *rtd = 
>> asoc_substream_to_rtd(substream);
>>       struct snd_soc_card *card = rtd->card;
>>       struct acp_card_drvdata *drvdata = card->drvdata;
>> -     int ret;
>> +     int ret = 0;
>>
>>       runtime->hw.channels_max = DUAL_CHANNEL;
>>       snd_pcm_hw_constraint_list(runtime, 0, 
>> SNDRV_PCM_HW_PARAM_CHANNELS,
>> @@ -371,10 +373,13 @@ static int acp_card_amp_startup(struct 
>> snd_pcm_substream *substream)
>>       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
>>                                     &constraints_rates);
>>
>> -     ret = acp_clk_enable(drvdata);
>> -     if (ret < 0)
>> -             dev_err(rtd->card->dev, "Failed to enable AMP clk: 
>> %d\n", ret);
>> -
>> +     if (!drvdata->soc_mclk) {
>> +             ret = acp_clk_enable(drvdata);
>> +             if (ret < 0) {
>> +                     dev_err(rtd->card->dev, "Failed to enable AMP 
>> clk: %d\n", ret);
>> +                     return ret;
>> +             }
>> +     }
>>       return ret;
>>   }
>>
>> @@ -409,6 +414,104 @@ static const struct snd_soc_ops 
>> acp_card_maxim_ops = {
>>       .shutdown = acp_card_shutdown,
>>   };
>>
>> +/* Declare nau8825 codec components */
>> +SND_SOC_DAILINK_DEF(nau8825,
>> + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
>> +
>> +static const struct snd_soc_dapm_route nau8825_map[] = {
>> +     { "Headphone Jack", NULL, "HPOL" },
>> +     { "Headphone Jack", NULL, "HPOR" },
>> +};
>> +
>> +static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
>> +{
>> +     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);
>> +     struct snd_soc_component *component = codec_dai->component;
>> +     unsigned int fmt;
>> +     int ret;
>> +
>> +     dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
>> +
>> +     if (drvdata->hs_codec_id != NAU8825)
>> +             return -EINVAL;
>> +
>> +     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);
>> +     if (ret < 0) {
>> +             dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", 
>> ret);
>> +             return ret;
>> +     }
>> +     ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
>> +                                      SND_JACK_HEADSET | 
>> SND_JACK_LINEOUT |
>> +                                      SND_JACK_BTN_0 | SND_JACK_BTN_1 |
>> +                                      SND_JACK_BTN_2 | SND_JACK_BTN_3,
>> +                                      &pco_jack, NULL, 0);
>
> Here, snd_soc_card_jack_new() should be used instead. Please refer
> comments in sound/soc/soc-card.c for differences between those two
> functions.
will fix it and send newer patchset
>
> Regards,
> Akihiko Odaki
>
>> +     if (ret) {
>> +             dev_err(card->dev, "HP jack creation failed %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
>> +
>> +     ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
>> +     if (ret) {
>> +             dev_err(rtd->dev, "Headset Jack call-back failed: 
>> %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, 
>> ARRAY_SIZE(nau8825_map));
>> +}
>> +
>> +static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
>> +                              struct snd_pcm_hw_params *params)
>> +{
>> +     struct snd_soc_pcm_runtime *rtd = 
>> asoc_substream_to_rtd(substream);
>> +     struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
>> +     int ret;
>> +
>> +     ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS,
>> +                                  (48000 * 256), SND_SOC_CLOCK_IN);
>> +     if (ret < 0)
>> +             dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", 
>> ret);
>> +
>> +     ret = snd_soc_dai_set_pll(codec_dai, 0, 0, params_rate(params),
>> +                               params_rate(params) * 256);
>> +     if (ret < 0) {
>> +             dev_err(rtd->dev, "can't set FLL: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return ret;
>> +}
>> +
>> +static int acp_nau8825_startup(struct snd_pcm_substream *substream)
>> +{
>> +     struct snd_pcm_runtime *runtime = substream->runtime;
>> +
>> +     runtime->hw.channels_max = 2;
>> +     snd_pcm_hw_constraint_list(runtime, 0, 
>> SNDRV_PCM_HW_PARAM_CHANNELS,
>> +                                &constraints_channels);
>> +
>> +     runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
>> +     snd_pcm_hw_constraint_list(runtime, 0,
>> +                                SNDRV_PCM_HW_PARAM_RATE, 
>> &constraints_rates);
>> +     return 0;
>> +}
>> +
>> +static const struct snd_soc_ops acp_card_nau8825_ops = {
>> +     .startup =  acp_nau8825_startup,
>> +     .hw_params = acp_nau8825_hw_params,
>> +};
>> +
>>   /* Declare DMIC codec components */
>>   SND_SOC_DAILINK_DEF(dmic_codec,
>>               DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", 
>> "dmic-hifi")));
>> @@ -437,6 +540,8 @@ SND_SOC_DAILINK_DEF(i2s_sp,
>>       DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
>>   SND_SOC_DAILINK_DEF(sof_sp,
>>       DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
>> +SND_SOC_DAILINK_DEF(sof_hs,
>> +                 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
>>   SND_SOC_DAILINK_DEF(sof_dmic,
>>       DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
>>   SND_SOC_DAILINK_DEF(pdm_dmic,
>> @@ -491,6 +596,31 @@ int acp_sofdsp_dai_links_create(struct 
>> snd_soc_card *card)
>>               i++;
>>       }
>>
>> +     if (drv_data->hs_cpu_id == I2S_HS) {
>> +             links[i].name = "acp-headset-codec";
>> +             links[i].id = HEADSET_BE_ID;
>> +             links[i].cpus = sof_hs;
>> +             links[i].num_cpus = ARRAY_SIZE(sof_hs);
>> +             links[i].platforms = sof_component;
>> +             links[i].num_platforms = ARRAY_SIZE(sof_component);
>> +             links[i].dpcm_playback = 1;
>> +             links[i].dpcm_capture = 1;
>> +             links[i].nonatomic = true;
>> +             links[i].no_pcm = 1;
>> +             if (!drv_data->hs_codec_id) {
>> +                     /* Use dummy codec if codec id not specified */
>> +                     links[i].codecs = dummy_codec;
>> +                     links[i].num_codecs = ARRAY_SIZE(dummy_codec);
>> +             }
>> +             if (drv_data->hs_codec_id == NAU8825) {
>> +                     links[i].codecs = nau8825;
>> +                     links[i].num_codecs = ARRAY_SIZE(nau8825);
>> +                     links[i].init = acp_card_nau8825_init;
>> +                     links[i].ops = &acp_card_nau8825_ops;
>> +             }
>> +             i++;
>> +     }
>> +
>>       if (drv_data->amp_cpu_id == I2S_SP) {
>>               links[i].name = "acp-amp-codec";
>>               links[i].id = AMP_BE_ID;
>> @@ -523,6 +653,30 @@ int acp_sofdsp_dai_links_create(struct 
>> snd_soc_card *card)
>>               i++;
>>       }
>>
>> +     if (drv_data->amp_cpu_id == I2S_HS) {
>> +             links[i].name = "acp-amp-codec";
>> +             links[i].id = AMP_BE_ID;
>> +             links[i].cpus = sof_hs;
>> +             links[i].num_cpus = ARRAY_SIZE(sof_hs);
>> +             links[i].platforms = sof_component;
>> +             links[i].num_platforms = ARRAY_SIZE(sof_component);
>> +             links[i].dpcm_playback = 1;
>> +             links[i].nonatomic = true;
>> +             links[i].no_pcm = 1;
>> +             if (!drv_data->amp_codec_id) {
>> +                     /* Use dummy codec if codec id not specified */
>> +                     links[i].codecs = dummy_codec;
>> +                     links[i].num_codecs = ARRAY_SIZE(dummy_codec);
>> +             }
>> +             if (drv_data->amp_codec_id == MAX98360A) {
>> +                     links[i].codecs = max98360a;
>> +                     links[i].num_codecs = ARRAY_SIZE(max98360a);
>> +                     links[i].ops = &acp_card_maxim_ops;
>> +                     links[i].init = acp_card_maxim_init;
>> +             }
>> +             i++;
>> +     }
>> +
>>       if (drv_data->dmic_cpu_id == DMIC) {
>>               links[i].name = "acp-dmic-codec";
>>               links[i].id = DMIC_BE_ID;
>> diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
>> index 5dc47cfbff10..c95ee1c52eb1 100644
>> --- a/sound/soc/amd/acp/acp-mach.h
>> +++ b/sound/soc/amd/acp/acp-mach.h
>> @@ -26,6 +26,7 @@ enum be_id {
>>
>>   enum cpu_endpoints {
>>       NONE = 0,
>> +     I2S_HS,
>>       I2S_SP,
>>       I2S_BT,
>>       DMIC,
>> @@ -37,6 +38,7 @@ enum codec_endpoints {
>>       RT1019,
>>       MAX98360A,
>>       RT5682S,
>> +     NAU8825,
>>   };
>>
>>   struct acp_card_drvdata {
>> @@ -49,6 +51,7 @@ struct acp_card_drvdata {
>>       unsigned int dai_fmt;
>>       struct clk *wclk;
>>       struct clk *bclk;
>> +     bool soc_mclk;
>>   };
>>
>>   int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
>> diff --git a/sound/soc/amd/acp/acp-sof-mach.c 
>> b/sound/soc/amd/acp/acp-sof-mach.c
>> index d1531cdab110..adbae809f2aa 100644
>> --- a/sound/soc/amd/acp/acp-sof-mach.c
>> +++ b/sound/soc/amd/acp/acp-sof-mach.c
>> @@ -56,6 +56,16 @@ static struct acp_card_drvdata 
>> sof_rt5682s_max_data = {
>>       .dmic_codec_id = DMIC,
>>   };
>>
>> +static struct acp_card_drvdata sof_nau8825_data = {
>> +     .hs_cpu_id = I2S_HS,
>> +     .amp_cpu_id = I2S_HS,
>> +     .dmic_cpu_id = DMIC,
>> +     .hs_codec_id = NAU8825,
>> +     .amp_codec_id = MAX98360A,
>> +     .dmic_codec_id = DMIC,
>> +     .soc_mclk = true,
>> +};
>> +
>>   static const struct snd_kcontrol_new acp_controls[] = {
>>       SOC_DAPM_PIN_SWITCH("Headphone Jack"),
>>       SOC_DAPM_PIN_SWITCH("Headset Mic"),
>> @@ -124,6 +134,10 @@ static const struct platform_device_id 
>> board_ids[] = {
>>               .name = "rt5682s-rt1019",
>>               .driver_data = (kernel_ulong_t)&sof_rt5682s_rt1019_data
>>       },
>> +     {
>> +             .name = "nau8825-max",
>> +             .driver_data = (kernel_ulong_t)&sof_nau8825_data
>> +     },
>>       { }
>>   };
>>   static struct platform_driver acp_asoc_audio = {
>> @@ -143,4 +157,5 @@ MODULE_ALIAS("platform:rt5682-rt1019");
>>   MODULE_ALIAS("platform:rt5682-max");
>>   MODULE_ALIAS("platform:rt5682s-max");
>>   MODULE_ALIAS("platform:rt5682s-rt1019");
>> +MODULE_ALIAS("platform:nau8825-max");
>>   MODULE_LICENSE("GPL v2");
>> diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
>> index 0a54567a2841..7b4c625da40d 100644
>> --- a/sound/soc/amd/mach-config.h
>> +++ b/sound/soc/amd/mach-config.h
>> @@ -19,6 +19,7 @@
>>   #define ACP_PCI_DEV_ID                      0x15E2
>>
>>   extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
>> +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[];
>>
>>   struct config_entry {
>>       u32 flags;
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
@ 2022-05-24  6:24       ` Reddy, V sujith kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Reddy, V sujith kumar @ 2022-05-24  6:24 UTC (permalink / raw)
  To: Akihiko Odaki, broonie, alsa-devel
  Cc: Pierre-Louis Bossart, Sunil-kumar.Dommati, Geert Uytterhoeven,
	ajitkumar.pandey, Kai Vehmanen, open list, Basavaraj.Hiregoudar,
	Takashi Iwai, Liam Girdwood, Jia-Ju Bai, Arnd Bergmann,
	Vijendar.Mukunda, Daniel Baluta, Bard Liao


On 5/24/2022 11:24 AM, Akihiko Odaki wrote:
> [CAUTION: External Email]
>
> On 2022/05/23 22:23, V sujith kumar Reddy wrote:
>> We have new platform with nau8825 as a primary codec and max98360 as an
>> amp codec. Add machine struct to register sof audio based sound card
>> on such Chrome machine.
>>
>> Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
>> ---
>>   sound/soc/amd/acp-config.c          |  21 ++++
>>   sound/soc/amd/acp/Kconfig           |   1 +
>>   sound/soc/amd/acp/acp-mach-common.c | 166 +++++++++++++++++++++++++++-
>>   sound/soc/amd/acp/acp-mach.h        |   3 +
>>   sound/soc/amd/acp/acp-sof-mach.c    |  15 +++
>>   sound/soc/amd/mach-config.h         |   1 +
>>   6 files changed, 201 insertions(+), 6 deletions(-)
>>
>> diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
>> index 5cbc82eca4c9..f73c187fee03 100644
>> --- a/sound/soc/amd/acp-config.c
>> +++ b/sound/soc/amd/acp-config.c
>> @@ -130,4 +130,25 @@ struct snd_soc_acpi_mach 
>> snd_soc_acpi_amd_sof_machines[] = {
>>   };
>>   EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
>>
>> +struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
>> +     {
>> +             .id = "AMDI1019",
>> +             .drv_name = "rmb-dsp",
>> +             .pdata = (void *)&acp_quirk_data,
>> +             .fw_filename = "sof-rmb.ri",
>> +             .sof_tplg_filename = "sof-acp-rmb.tplg",
>> +     },
>> +     {
>> +             .id = "10508825",
>> +             .drv_name = "nau8825-max",
>> +             .pdata = (void *)&acp_quirk_data,
>> +             .machine_quirk = snd_soc_acpi_codec_list,
>> +             .quirk_data = &amp_max,
>> +             .fw_filename = "sof-rmb.ri",
>> +             .sof_tplg_filename = "sof-acp-rmb.tplg",
>> +     },
>> +     {},
>> +};
>> +EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
>> +
>>   MODULE_LICENSE("Dual BSD/GPL");
>> diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
>> index 9dae2719084c..7e56d2644105 100644
>> --- a/sound/soc/amd/acp/Kconfig
>> +++ b/sound/soc/amd/acp/Kconfig
>> @@ -49,6 +49,7 @@ config SND_SOC_AMD_MACH_COMMON
>>       select SND_SOC_RT1019
>>       select SND_SOC_MAX98357A
>>       select SND_SOC_RT5682S
>> +     select SND_SOC_NAU8825
>>       help
>>         This option enables common Machine driver module for ACP.
>>
>> diff --git a/sound/soc/amd/acp/acp-mach-common.c 
>> b/sound/soc/amd/acp/acp-mach-common.c
>> index 6ae454bf60af..4f5cfa26c58d 100644
>> --- a/sound/soc/amd/acp/acp-mach-common.c
>> +++ b/sound/soc/amd/acp/acp-mach-common.c
>> @@ -24,6 +24,7 @@
>>   #include "../../codecs/rt5682.h"
>>   #include "../../codecs/rt1019.h"
>>   #include "../../codecs/rt5682s.h"
>> +#include "../../codecs/nau8825.h"
>>   #include "acp-mach.h"
>>
>>   #define PCO_PLAT_CLK 48000000
>> @@ -175,7 +176,8 @@ static void acp_card_shutdown(struct 
>> snd_pcm_substream *substream)
>>       struct snd_soc_card *card = rtd->card;
>>       struct acp_card_drvdata *drvdata = card->drvdata;
>>
>> -     clk_disable_unprepare(drvdata->wclk);
>> +     if (!drvdata->soc_mclk)
>> +             clk_disable_unprepare(drvdata->wclk);
>>   }
>>
>>   static const struct snd_soc_ops acp_card_rt5682_ops = {
>> @@ -363,7 +365,7 @@ static int acp_card_amp_startup(struct 
>> snd_pcm_substream *substream)
>>       struct snd_soc_pcm_runtime *rtd = 
>> asoc_substream_to_rtd(substream);
>>       struct snd_soc_card *card = rtd->card;
>>       struct acp_card_drvdata *drvdata = card->drvdata;
>> -     int ret;
>> +     int ret = 0;
>>
>>       runtime->hw.channels_max = DUAL_CHANNEL;
>>       snd_pcm_hw_constraint_list(runtime, 0, 
>> SNDRV_PCM_HW_PARAM_CHANNELS,
>> @@ -371,10 +373,13 @@ static int acp_card_amp_startup(struct 
>> snd_pcm_substream *substream)
>>       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
>>                                     &constraints_rates);
>>
>> -     ret = acp_clk_enable(drvdata);
>> -     if (ret < 0)
>> -             dev_err(rtd->card->dev, "Failed to enable AMP clk: 
>> %d\n", ret);
>> -
>> +     if (!drvdata->soc_mclk) {
>> +             ret = acp_clk_enable(drvdata);
>> +             if (ret < 0) {
>> +                     dev_err(rtd->card->dev, "Failed to enable AMP 
>> clk: %d\n", ret);
>> +                     return ret;
>> +             }
>> +     }
>>       return ret;
>>   }
>>
>> @@ -409,6 +414,104 @@ static const struct snd_soc_ops 
>> acp_card_maxim_ops = {
>>       .shutdown = acp_card_shutdown,
>>   };
>>
>> +/* Declare nau8825 codec components */
>> +SND_SOC_DAILINK_DEF(nau8825,
>> + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
>> +
>> +static const struct snd_soc_dapm_route nau8825_map[] = {
>> +     { "Headphone Jack", NULL, "HPOL" },
>> +     { "Headphone Jack", NULL, "HPOR" },
>> +};
>> +
>> +static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd)
>> +{
>> +     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);
>> +     struct snd_soc_component *component = codec_dai->component;
>> +     unsigned int fmt;
>> +     int ret;
>> +
>> +     dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
>> +
>> +     if (drvdata->hs_codec_id != NAU8825)
>> +             return -EINVAL;
>> +
>> +     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);
>> +     if (ret < 0) {
>> +             dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", 
>> ret);
>> +             return ret;
>> +     }
>> +     ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
>> +                                      SND_JACK_HEADSET | 
>> SND_JACK_LINEOUT |
>> +                                      SND_JACK_BTN_0 | SND_JACK_BTN_1 |
>> +                                      SND_JACK_BTN_2 | SND_JACK_BTN_3,
>> +                                      &pco_jack, NULL, 0);
>
> Here, snd_soc_card_jack_new() should be used instead. Please refer
> comments in sound/soc/soc-card.c for differences between those two
> functions.
will fix it and send newer patchset
>
> Regards,
> Akihiko Odaki
>
>> +     if (ret) {
>> +             dev_err(card->dev, "HP jack creation failed %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
>> +     snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
>> +
>> +     ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
>> +     if (ret) {
>> +             dev_err(rtd->dev, "Headset Jack call-back failed: 
>> %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, 
>> ARRAY_SIZE(nau8825_map));
>> +}
>> +
>> +static int acp_nau8825_hw_params(struct snd_pcm_substream *substream,
>> +                              struct snd_pcm_hw_params *params)
>> +{
>> +     struct snd_soc_pcm_runtime *rtd = 
>> asoc_substream_to_rtd(substream);
>> +     struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
>> +     int ret;
>> +
>> +     ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS,
>> +                                  (48000 * 256), SND_SOC_CLOCK_IN);
>> +     if (ret < 0)
>> +             dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", 
>> ret);
>> +
>> +     ret = snd_soc_dai_set_pll(codec_dai, 0, 0, params_rate(params),
>> +                               params_rate(params) * 256);
>> +     if (ret < 0) {
>> +             dev_err(rtd->dev, "can't set FLL: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return ret;
>> +}
>> +
>> +static int acp_nau8825_startup(struct snd_pcm_substream *substream)
>> +{
>> +     struct snd_pcm_runtime *runtime = substream->runtime;
>> +
>> +     runtime->hw.channels_max = 2;
>> +     snd_pcm_hw_constraint_list(runtime, 0, 
>> SNDRV_PCM_HW_PARAM_CHANNELS,
>> +                                &constraints_channels);
>> +
>> +     runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
>> +     snd_pcm_hw_constraint_list(runtime, 0,
>> +                                SNDRV_PCM_HW_PARAM_RATE, 
>> &constraints_rates);
>> +     return 0;
>> +}
>> +
>> +static const struct snd_soc_ops acp_card_nau8825_ops = {
>> +     .startup =  acp_nau8825_startup,
>> +     .hw_params = acp_nau8825_hw_params,
>> +};
>> +
>>   /* Declare DMIC codec components */
>>   SND_SOC_DAILINK_DEF(dmic_codec,
>>               DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", 
>> "dmic-hifi")));
>> @@ -437,6 +540,8 @@ SND_SOC_DAILINK_DEF(i2s_sp,
>>       DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
>>   SND_SOC_DAILINK_DEF(sof_sp,
>>       DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
>> +SND_SOC_DAILINK_DEF(sof_hs,
>> +                 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
>>   SND_SOC_DAILINK_DEF(sof_dmic,
>>       DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
>>   SND_SOC_DAILINK_DEF(pdm_dmic,
>> @@ -491,6 +596,31 @@ int acp_sofdsp_dai_links_create(struct 
>> snd_soc_card *card)
>>               i++;
>>       }
>>
>> +     if (drv_data->hs_cpu_id == I2S_HS) {
>> +             links[i].name = "acp-headset-codec";
>> +             links[i].id = HEADSET_BE_ID;
>> +             links[i].cpus = sof_hs;
>> +             links[i].num_cpus = ARRAY_SIZE(sof_hs);
>> +             links[i].platforms = sof_component;
>> +             links[i].num_platforms = ARRAY_SIZE(sof_component);
>> +             links[i].dpcm_playback = 1;
>> +             links[i].dpcm_capture = 1;
>> +             links[i].nonatomic = true;
>> +             links[i].no_pcm = 1;
>> +             if (!drv_data->hs_codec_id) {
>> +                     /* Use dummy codec if codec id not specified */
>> +                     links[i].codecs = dummy_codec;
>> +                     links[i].num_codecs = ARRAY_SIZE(dummy_codec);
>> +             }
>> +             if (drv_data->hs_codec_id == NAU8825) {
>> +                     links[i].codecs = nau8825;
>> +                     links[i].num_codecs = ARRAY_SIZE(nau8825);
>> +                     links[i].init = acp_card_nau8825_init;
>> +                     links[i].ops = &acp_card_nau8825_ops;
>> +             }
>> +             i++;
>> +     }
>> +
>>       if (drv_data->amp_cpu_id == I2S_SP) {
>>               links[i].name = "acp-amp-codec";
>>               links[i].id = AMP_BE_ID;
>> @@ -523,6 +653,30 @@ int acp_sofdsp_dai_links_create(struct 
>> snd_soc_card *card)
>>               i++;
>>       }
>>
>> +     if (drv_data->amp_cpu_id == I2S_HS) {
>> +             links[i].name = "acp-amp-codec";
>> +             links[i].id = AMP_BE_ID;
>> +             links[i].cpus = sof_hs;
>> +             links[i].num_cpus = ARRAY_SIZE(sof_hs);
>> +             links[i].platforms = sof_component;
>> +             links[i].num_platforms = ARRAY_SIZE(sof_component);
>> +             links[i].dpcm_playback = 1;
>> +             links[i].nonatomic = true;
>> +             links[i].no_pcm = 1;
>> +             if (!drv_data->amp_codec_id) {
>> +                     /* Use dummy codec if codec id not specified */
>> +                     links[i].codecs = dummy_codec;
>> +                     links[i].num_codecs = ARRAY_SIZE(dummy_codec);
>> +             }
>> +             if (drv_data->amp_codec_id == MAX98360A) {
>> +                     links[i].codecs = max98360a;
>> +                     links[i].num_codecs = ARRAY_SIZE(max98360a);
>> +                     links[i].ops = &acp_card_maxim_ops;
>> +                     links[i].init = acp_card_maxim_init;
>> +             }
>> +             i++;
>> +     }
>> +
>>       if (drv_data->dmic_cpu_id == DMIC) {
>>               links[i].name = "acp-dmic-codec";
>>               links[i].id = DMIC_BE_ID;
>> diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
>> index 5dc47cfbff10..c95ee1c52eb1 100644
>> --- a/sound/soc/amd/acp/acp-mach.h
>> +++ b/sound/soc/amd/acp/acp-mach.h
>> @@ -26,6 +26,7 @@ enum be_id {
>>
>>   enum cpu_endpoints {
>>       NONE = 0,
>> +     I2S_HS,
>>       I2S_SP,
>>       I2S_BT,
>>       DMIC,
>> @@ -37,6 +38,7 @@ enum codec_endpoints {
>>       RT1019,
>>       MAX98360A,
>>       RT5682S,
>> +     NAU8825,
>>   };
>>
>>   struct acp_card_drvdata {
>> @@ -49,6 +51,7 @@ struct acp_card_drvdata {
>>       unsigned int dai_fmt;
>>       struct clk *wclk;
>>       struct clk *bclk;
>> +     bool soc_mclk;
>>   };
>>
>>   int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
>> diff --git a/sound/soc/amd/acp/acp-sof-mach.c 
>> b/sound/soc/amd/acp/acp-sof-mach.c
>> index d1531cdab110..adbae809f2aa 100644
>> --- a/sound/soc/amd/acp/acp-sof-mach.c
>> +++ b/sound/soc/amd/acp/acp-sof-mach.c
>> @@ -56,6 +56,16 @@ static struct acp_card_drvdata 
>> sof_rt5682s_max_data = {
>>       .dmic_codec_id = DMIC,
>>   };
>>
>> +static struct acp_card_drvdata sof_nau8825_data = {
>> +     .hs_cpu_id = I2S_HS,
>> +     .amp_cpu_id = I2S_HS,
>> +     .dmic_cpu_id = DMIC,
>> +     .hs_codec_id = NAU8825,
>> +     .amp_codec_id = MAX98360A,
>> +     .dmic_codec_id = DMIC,
>> +     .soc_mclk = true,
>> +};
>> +
>>   static const struct snd_kcontrol_new acp_controls[] = {
>>       SOC_DAPM_PIN_SWITCH("Headphone Jack"),
>>       SOC_DAPM_PIN_SWITCH("Headset Mic"),
>> @@ -124,6 +134,10 @@ static const struct platform_device_id 
>> board_ids[] = {
>>               .name = "rt5682s-rt1019",
>>               .driver_data = (kernel_ulong_t)&sof_rt5682s_rt1019_data
>>       },
>> +     {
>> +             .name = "nau8825-max",
>> +             .driver_data = (kernel_ulong_t)&sof_nau8825_data
>> +     },
>>       { }
>>   };
>>   static struct platform_driver acp_asoc_audio = {
>> @@ -143,4 +157,5 @@ MODULE_ALIAS("platform:rt5682-rt1019");
>>   MODULE_ALIAS("platform:rt5682-max");
>>   MODULE_ALIAS("platform:rt5682s-max");
>>   MODULE_ALIAS("platform:rt5682s-rt1019");
>> +MODULE_ALIAS("platform:nau8825-max");
>>   MODULE_LICENSE("GPL v2");
>> diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
>> index 0a54567a2841..7b4c625da40d 100644
>> --- a/sound/soc/amd/mach-config.h
>> +++ b/sound/soc/amd/mach-config.h
>> @@ -19,6 +19,7 @@
>>   #define ACP_PCI_DEV_ID                      0x15E2
>>
>>   extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[];
>> +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[];
>>
>>   struct config_entry {
>>       u32 flags;
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019
  2022-05-23 13:23 [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 V sujith kumar Reddy
                   ` (2 preceding siblings ...)
  2022-05-23 13:28 ` [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s,rt1019 Reddy, V sujith kumar
@ 2022-06-07 10:54 ` Mark Brown
  3 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2022-06-07 10:54 UTC (permalink / raw)
  To: alsa-devel, Vsujithkumar.Reddy
  Cc: Basavaraj.Hiregoudar, Sunil-kumar.Dommati, ajitkumar.pandey,
	Vijendar.Mukunda

On Mon, 23 May 2022 18:53:51 +0530, V sujith kumar Reddy wrote:
> This patch set depends on:
>         --gpio patch
>         --https://patchwork.kernel.org/project/alsa-devel/patch/20220516160619.17832-1-Vsujithkumar.Reddy@amd.com/
>         --https://patchwork.kernel.org/project/alsa-devel/patch/20220516160619.17832-2-Vsujithkumar.Reddy@amd.com/
> 
> Resolved  compilation error:
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card
      commit: 0439eb4d94e0fc17c6dd3829fabd88c11773381d
[2/2] ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs instance
      commit: 4dc6737cfe882765d914fcb88b5eaa14551ffddd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-06-07 10:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 13:23 [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 V sujith kumar Reddy
2022-05-23 13:23 ` [PATCH v3 1/2] ASoC: amd: acp: Add support for nau8825 and max98360 card V sujith kumar Reddy
2022-05-23 13:23   ` V sujith kumar Reddy
2022-05-23 13:52   ` Geert Uytterhoeven
2022-05-23 13:52     ` Geert Uytterhoeven
2022-05-24  5:54   ` Akihiko Odaki
2022-05-24  5:54     ` Akihiko Odaki
2022-05-24  6:24     ` Reddy, V sujith kumar
2022-05-24  6:24       ` Reddy, V sujith kumar
2022-05-23 13:23 ` [PATCH v3 2/2] ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs instance V sujith kumar Reddy
2022-05-23 13:23   ` V sujith kumar Reddy
2022-05-23 13:28 ` [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s,rt1019 Reddy, V sujith kumar
2022-06-07 10:54 ` [PATCH v3 0/2] Add Machine driver support for nau8825, max98560 and rt5682s, rt1019 Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.