Skip to contentSkip to conversation

ASoC: mt8188: add new board support

PATCH Superseded Trevor Wu 2 participants 23 messages May 23, 2023 – May 25, 2023

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
author
#1 lore raw

PATCH v2 1/7 ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai

In reply to Trevor Wu

MT8188 will support SOF. In SOF, be_hw_params_fixup callback are used to configure BE hardware parameters. However, playback and capture stream share the same callback function in which it can't know the stream type.

It's possible to require different paremters for playback and capture stream, so separate them into two dais for SOF usage.

---
 sound/soc/mediatek/mt8188/mt8188-afe-common.h |  3 +-
 sound/soc/mediatek/mt8188/mt8188-dai-adda.c   | 73 ++++++++++---------
 sound/soc/mediatek/mt8188/mt8188-mt6359.c     | 34 +++++++--
 3 files changed, 65 insertions(+), 45 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-common.h +2 -1
index eb7e57c239bd..1304d685a306 100644
@@ -39,7 +39,7 @@ enum {
 	MT8188_AFE_MEMIF_END,
 	MT8188_AFE_MEMIF_NUM = (MT8188_AFE_MEMIF_END - MT8188_AFE_MEMIF_START),
 	MT8188_AFE_IO_START = MT8188_AFE_MEMIF_END,
-	MT8188_AFE_IO_ADDA = MT8188_AFE_IO_START,
+	MT8188_AFE_IO_DL_SRC = MT8188_AFE_IO_START,
 	MT8188_AFE_IO_DMIC_IN,
 	MT8188_AFE_IO_DPTX,
 	MT8188_AFE_IO_ETDM_START,
@@ -52,6 +52,7 @@ enum {
 	MT8188_AFE_IO_ETDM_NUM =
 		(MT8188_AFE_IO_ETDM_END - MT8188_AFE_IO_ETDM_START),
 	MT8188_AFE_IO_PCM = MT8188_AFE_IO_ETDM_END,
+	MT8188_AFE_IO_UL_SRC,
 	MT8188_AFE_IO_END,
 	MT8188_AFE_IO_NUM = (MT8188_AFE_IO_END - MT8188_AFE_IO_START),
 	MT8188_DAI_END = MT8188_AFE_IO_END,
sound/soc/mediatek/mt8188/mt8188-dai-adda.c +37 -36

141 lines not on this page · raw message

sound/soc/mediatek/mt8188/mt8188-mt6359.c +26 -8
index 919d74ea1934..833bc362dad2 100644
@@ -99,8 +99,8 @@ SND_SOC_DAILINK_DEFS(capture10,
 		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
 /* BE */
-SND_SOC_DAILINK_DEFS(adda,
-		     DAILINK_COMP_ARRAY(COMP_CPU("ADDA")),
+SND_SOC_DAILINK_DEFS(dl_src,
+		     DAILINK_COMP_ARRAY(COMP_CPU("DL_SRC")),
 		     DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
 						   "mt6359-snd-codec-aif1")),
 		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
@@ -140,6 +140,12 @@ SND_SOC_DAILINK_DEFS(pcm1,
 		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
 		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
+SND_SOC_DAILINK_DEFS(ul_src,
+		     DAILINK_COMP_ARRAY(COMP_CPU("UL_SRC")),
+		     DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
+						   "mt6359-snd-codec-aif1")),
+		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
+
 struct mt8188_mt6359_priv {
 	struct snd_soc_jack dp_jack;
 	struct snd_soc_jack hdmi_jack;
@@ -345,7 +351,7 @@ enum {
 	DAI_LINK_UL8_FE,
 	DAI_LINK_UL9_FE,
 	DAI_LINK_UL10_FE,
-	DAI_LINK_ADDA_BE,
+	DAI_LINK_DL_SRC_BE,
 	DAI_LINK_DPTX_BE,
 	DAI_LINK_ETDM1_IN_BE,
 	DAI_LINK_ETDM2_IN_BE,
@@ -353,6 +359,7 @@ enum {
 	DAI_LINK_ETDM2_OUT_BE,
 	DAI_LINK_ETDM3_OUT_BE,
 	DAI_LINK_PCM1_BE,
+	DAI_LINK_UL_SRC_BE,
 };
 
 static int mt8188_dptx_hw_params(struct snd_pcm_substream *substream,
@@ -604,13 +611,11 @@ static struct snd_soc_dai_link mt8188_mt6359_dai_links[] = {
 		SND_SOC_DAILINK_REG(capture10),
 	},
 	/* BE */
-	[DAI_LINK_ADDA_BE] = {
-		.name = "ADDA_BE",
+	[DAI_LINK_DL_SRC_BE] = {
+		.name = "DL_SRC_BE",
 		.no_pcm = 1,
 		.dpcm_playback = 1,
-		.dpcm_capture = 1,
-		.init = mt8188_mt6359_init,
-		SND_SOC_DAILINK_REG(adda),
+		SND_SOC_DAILINK_REG(dl_src),
 	},
 	[DAI_LINK_DPTX_BE] = {
 		.name = "DPTX_BE",
@@ -676,6 +681,12 @@ static struct snd_soc_dai_link mt8188_mt6359_dai_links[] = {
 		.dpcm_capture = 1,
 		SND_SOC_DAILINK_REG(pcm1),
 	},
+	[DAI_LINK_UL_SRC_BE] = {
+		.name = "UL_SRC_BE",
+		.no_pcm = 1,
+		.dpcm_capture = 1,
+		SND_SOC_DAILINK_REG(ul_src),
+	},
 };
 
 static struct snd_soc_card mt8188_mt6359_soc_card = {
@@ -695,6 +706,7 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
 	struct mt8188_mt6359_priv *priv;
 	struct mt8188_card_data *card_data;
 	struct snd_soc_dai_link *dai_link;
+	bool init_mt6359 = false;
 	int ret, i;
 
 	card_data = (struct mt8188_card_data *)of_device_get_match_data(&pdev->dev);
@@ -739,6 +751,12 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
 		} else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
 			if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
 				dai_link->init = mt8188_hdmi_codec_init;
+		} else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 ||
+			   strcmp(dai_link->name, "UL_SRC_BE") == 0) {
+			if (!init_mt6359) {
+				dai_link->init = mt8188_mt6359_init;
+				init_mt6359 = true;
+			}
 		}
 	}
 
Signature · 1 line
2.18.0
author
#4 lore raw

PATCH v2 2/7 ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

In reply to Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188-mt6359, codec for ADDA_BE must be mt6359 which are configured on the machine driver. Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE. As a result, remove ADDA_BE from items of link-name.

---
 .../devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml        | 1 -
 1 file changed, 1 deletion(-)
Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml +0 -1
index 6640272b3f4f..3d2c01b693be 100644
@@ -42,7 +42,6 @@ patternProperties:
           we are going to update parameters in this node.
         items:
           enum:
-            - ADDA_BE
             - DPTX_BE
             - ETDM1_IN_BE
             - ETDM2_IN_BE
Signature · 1 line
2.18.0
author
#11 lore raw

PATCH v2 3/7 ASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins

In reply to Trevor Wu

Some userspace applications need jack control events, so register hdmi and dp jack pins to activate jack control events.

---
 sound/soc/mediatek/mt8188/mt8188-mt6359.c | 27 +++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8188/mt8188-mt6359.c +23 -4
index 833bc362dad2..6c3f36e2fffd 100644
@@ -151,6 +151,20 @@ struct mt8188_mt6359_priv {
 	struct snd_soc_jack hdmi_jack;
 };
 
+static struct snd_soc_jack_pin mt8188_hdmi_jack_pins[] = {
+	{
+		.pin = "HDMI",
+		.mask = SND_JACK_LINEOUT,
+	},
+};
+
+static struct snd_soc_jack_pin mt8188_dp_jack_pins[] = {
+	{
+		.pin = "DP",
+		.mask = SND_JACK_LINEOUT,
+	},
+};
+
 struct mt8188_card_data {
 	const char *name;
 	unsigned long quirk;
@@ -159,6 +173,8 @@ struct mt8188_card_data {
 static const struct snd_soc_dapm_widget mt8188_mt6359_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_SINK("HDMI"),
+	SND_SOC_DAPM_SINK("DP"),
 };
 
 static const struct snd_kcontrol_new mt8188_mt6359_controls[] = {
@@ -396,8 +412,10 @@ static int mt8188_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
 	int ret = 0;
 
-	ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT,
-				    &priv->hdmi_jack);
+	ret = snd_soc_card_jack_new_pins(rtd->card, "HDMI Jack",
+					 SND_JACK_LINEOUT, &priv->hdmi_jack,
+					 mt8188_hdmi_jack_pins,
+					 ARRAY_SIZE(mt8188_hdmi_jack_pins));
 	if (ret) {
 		dev_info(rtd->dev, "%s, new jack failed: %d\n", __func__, ret);
 		return ret;
@@ -417,8 +435,9 @@ static int mt8188_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
 	int ret = 0;
 
-	ret = snd_soc_card_jack_new(rtd->card, "DP Jack", SND_JACK_LINEOUT,
-				    &priv->dp_jack);
+	ret = snd_soc_card_jack_new_pins(rtd->card, "DP Jack", SND_JACK_LINEOUT,
+					 &priv->dp_jack, mt8188_dp_jack_pins,
+					 ARRAY_SIZE(mt8188_dp_jack_pins));
 	if (ret) {
 		dev_info(rtd->dev, "%s, new jack failed: %d\n", __func__, ret);
 		return ret;
Signature · 1 line
2.18.0
author
#13 lore raw

PATCH v2 4/7 ASoC: mediatek: common: soundcard driver add dai_fmt support

In reply to Trevor Wu

There are two changes included in the patch.

First, add set_dailink_daifmt() function, so dai_fmt can be updated by the configuration in dai-link sub node.

Second, remove codec phandle from required property in dai-link sub node. For example, user possibly needs to update dai-format for all etdm co-clock dai-links, but codec doesn't need to be specified in capture dai-link for a speaker amp.

---
 .../mediatek/common/mtk-soundcard-driver.c    | 49 ++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)
sound/soc/mediatek/common/mtk-soundcard-driver.c +48 -1
index 738093451ccb..5e291092046b 100644
@@ -22,7 +22,7 @@ static int set_card_codec_info(struct snd_soc_card *card,
 
 	codec_node = of_get_child_by_name(sub_node, "codec");
 	if (!codec_node)
-		return -EINVAL;
+		return 0;
 
 	/* set card codec info */
 	ret = snd_soc_of_get_dai_link_codecs(dev, codec_node, dai_link);
@@ -36,6 +36,47 @@ static int set_card_codec_info(struct snd_soc_card *card,
 	return 0;
 }
 
+static int set_dailink_daifmt(struct snd_soc_card *card,
+			      struct device_node *sub_node,
+			      struct snd_soc_dai_link *dai_link)
+{
+	unsigned int daifmt;
+	const char *str;
+	int ret;
+	struct {
+		char *name;
+		unsigned int val;
+	} of_clk_table[] = {
+		{ "cpu",	SND_SOC_DAIFMT_CBC_CFC },
+		{ "codec",	SND_SOC_DAIFMT_CBP_CFP },
+	};
+
+	daifmt = snd_soc_daifmt_parse_format(sub_node, NULL);
+	if (daifmt) {
+		dai_link->dai_fmt &= SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
+		dai_link->dai_fmt |= daifmt;
+	}
+
+	/*
+	 * check "mediatek,clk-provider = xxx"
+	 * SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK area
+	 */
+	ret = of_property_read_string(sub_node, "mediatek,clk-provider", &str);
+	if (ret == 0) {
+		int i;
+
+		for (i = 0; i < ARRAY_SIZE(of_clk_table); i++) {
+			if (strcmp(str, of_clk_table[i].name) == 0) {
+				dai_link->dai_fmt &= ~SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
+				dai_link->dai_fmt |= of_clk_table[i].val;
+				break;
+			}
+		}
+	}
+
+	return 0;
+}
+
 int parse_dai_link_info(struct snd_soc_card *card)
 {
 	struct device *dev = card->dev;
@@ -67,6 +108,12 @@ int parse_dai_link_info(struct snd_soc_card *card)
 			of_node_put(sub_node);
 			return ret;
 		}
+
+		ret = set_dailink_daifmt(card, sub_node, dai_link);
+		if (ret < 0) {
+			of_node_put(sub_node);
+			return ret;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.18.0
author
#16 lore raw

PATCH v2 5/7 ASoC: soc-dapm.c: clean up debugfs for freed widget

In reply to Trevor Wu

When a widget is added to dapm via snd_soc_dapm_new_widgets, dapm_debugfs_add_widget is also called to create a corresponding debugfs file. However, when a widget is freed by snd_soc_dapm_free_widget, the corresponding debugfs is not cleared. As a result, the freed widget is still seen in the dapm directory.

This patch adds dapm_debugfs_free_widget to free the debugfs of a specified widget, and it's called at snd_soc_dapm_free_widget to clean up the debugfs for freed widget.

---
 sound/soc/soc-dapm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
sound/soc/soc-dapm.c +16 -0
index f2f04ce693a1..c65cc374bb3f 100644
@@ -2216,6 +2216,16 @@ static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
 			    &dapm_widget_power_fops);
 }
 
+static void dapm_debugfs_free_widget(struct snd_soc_dapm_widget *w)
+{
+	struct snd_soc_dapm_context *dapm = w->dapm;
+
+	if (!dapm->debugfs_dapm || !w->name)
+		return;
+
+	debugfs_lookup_and_remove(w->name, dapm->debugfs_dapm);
+}
+
 static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
 {
 	debugfs_remove_recursive(dapm->debugfs_dapm);
@@ -2232,6 +2242,10 @@ static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
 {
 }
 
+static inline void dapm_debugfs_free_widget(struct snd_soc_dapm_widget *w)
+{
+}
+
 static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
 {
 }
@@ -2495,6 +2509,8 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
 			dapm_free_path(p);
 	}
 
+	dapm_debugfs_free_widget(w);
+
 	kfree(w->kcontrols);
 	kfree_const(w->name);
 	kfree_const(w->sname);
Signature · 1 line
2.18.0
author
#22 lore raw

PATCH v2 7/7 ASoC: dt-bindings: mediatek,mt8188-mt6359: add NAU8825 support

In reply to Trevor Wu

Add compatible string "mediatek,mt8188-nau8825" to support new board with nau8825 codec.

Introduce two properties "dai-format" and "mediatek,clk-provider" under dai-link subnode to configure dai-link parameters via dts.

"codec" property is removed from required property of dai-link subnode. For co-clock case, it's possible two dai-links should be configured to the same dai format, but only one cpu dai is bound with codec.

---
 .../sound/mediatek,mt8188-mt6359.yaml         | 26 ++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml +23 -3
index 3d2c01b693be..05e532b5d50a 100644
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: mediatek,mt8188-mt6359-evb
+    enum:
+      - mediatek,mt8188-mt6359-evb
+      - mediatek,mt8188-nau8825
 
   model:
     $ref: /schemas/types.yaml#/definitions/string
@@ -61,11 +63,28 @@ patternProperties:
         required:
           - sound-dai
 
+      dai-format:
+        description: audio format.
+        items:
+          enum:
+            - i2s
+            - right_j
+            - left_j
+            - dsp_a
+            - dsp_b
+
+      mediatek,clk-provider:
+        $ref: /schemas/types.yaml#/definitions/string
+        description: Indicates dai-link clock master.
+        items:
+          enum:
+            - cpu
+            - codec
+
     additionalProperties: false
 
     required:
       - link-name
-      - codec
 
 additionalProperties: false
 
@@ -86,7 +105,8 @@ examples:
             "AIN1", "Headset Mic";
         dai-link-0 {
             link-name = "ETDM3_OUT_BE";
-
+            dai-format = "i2s";
+            mediatek,clk-provider = "cpu";
             codec {
                 sound-dai = <&hdmi0>;
             };
Signature · 1 line
2.18.0

Trevor Wu

author
#0 lore raw

v2 cover ASoC: mt8188: add new board support

In the series, we extend the capability of mt8188-mt6359 driver.

The following changes are included.
1. Divide ADDA BE dai into two dais for SOF.
2. Register hdmi/dp jack pins.
3. dai_fmt can be configured from device tree.
4. Add some I2S codecs support.

In addition, new compatible string "mediatek,mt8188-nau8825" is included for a new board support.

Changes since v1:
- add "Headphone Jack" for Nau8825
- separate binding patch 2 from patch 6, and rename the subject
- clean up debugfs for freed widget

Trevor Wu (7):
ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai
ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from
link-name
ASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins
ASoC: mediatek: common: soundcard driver add dai_fmt support
ASoC: soc-dapm.c: clean up debugfs for freed widget
ASoC: mediatek: mt8188-mt6359: support new board with nau88255
ASoC: dt-bindings: mediatek,mt8188-mt6359: add NAU8825 support

 .../sound/mediatek,mt8188-mt6359.yaml         |  27 +-
 sound/soc/mediatek/Kconfig                    |   4 +
 .../mediatek/common/mtk-soundcard-driver.c    |  49 ++-
 sound/soc/mediatek/mt8188/mt8188-afe-common.h |   3 +-
 sound/soc/mediatek/mt8188/mt8188-dai-adda.c   |  73 ++--
 sound/soc/mediatek/mt8188/mt8188-mt6359.c     | 389 +++++++++++++++++-
 sound/soc/soc-dapm.c                          |  16 +
 7 files changed, 507 insertions(+), 54 deletions(-)
Signature · 1 line
2.18.0
author
#18 lore raw

PATCH v2 6/7 ASoC: mediatek: mt8188-mt6359: support new board with nau88255

This patch adds multiple i2s codecs support including NAU88L25, MAX98390, and the dumb amp like NAU8318 usage. In addition, dmic-codec is also added to skip the beginning pop noise.

---
 sound/soc/mediatek/Kconfig                |   4 +
 sound/soc/mediatek/mt8188/mt8188-mt6359.c | 330 +++++++++++++++++++++-
 2 files changed, 333 insertions(+), 1 deletion(-)
sound/soc/mediatek/Kconfig +4 -0
index 4baac72677d9..4ea012342b52 100644
@@ -225,6 +225,10 @@ config SND_SOC_MT8188_MT6359
 	depends on SND_SOC_MT8188 && MTK_PMIC_WRAP
 	select SND_SOC_MT6359
 	select SND_SOC_HDMI_CODEC
+	select SND_SOC_DMIC
+	select SND_SOC_MAX98390
+	select SND_SOC_NAU8315
+	select SND_SOC_NAU8825
 	help
 	  This adds support for ASoC machine driver for MediaTek MT8188
 	  boards with the MT6359 and other I2S audio codecs.
sound/soc/mediatek/mt8188/mt8188-mt6359.c +329 -1

418 lines not on this page · raw message

Signature · 1 line
2.18.0
Reviewed-by on v2 1/7
#2 lore raw

Re: [PATCH v2 1/7] ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai

In reply to Trevor Wu
Quoted 1 line · Trevor Wu

MT8188 will support SOF. In SOF, be_hw_params_fixup callback are used to

Can you write what is SOF please ? (Sound Open Firmware I guess ?)

Quoted 4 lines

configure BE hardware parameters. However, playback and capture stream share the same callback function in which it can't know the stream type.

It's possible to require different paremters for playback and capture

paremters => parameters

Code looks good, after the commit messages fixes:

Signature · 2 lines
Regards,
Alexandre
#5 lore raw

Re: [PATCH v2 2/7] ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

In reply to Trevor Wu
Quoted 6 lines · Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188-mt6359, codec for ADDA_BE must be mt6359 which are configured on the machine driver. Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE. As a result, remove ADDA_BE from items of link-name.

I don't understand how "DL_SRC_BE" and "UL_SRC_BE" links are done. Why these dais don't replace "ADDA_BE" in this binding ?

Regards,
Alexandre

#3 lore raw

Re: [PATCH v2 1/7] ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai

In reply to Alexandre Mergnat
Quoted 20 lines · Alexandre Mergnat

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 2 lines · Trevor Wu

MT8188 will support SOF. In SOF, be_hw_params_fixup callback are used to

Can you write what is SOF please ? (Sound Open Firmware I guess ?)

Quoted 7 lines

configure BE hardware parameters. However, playback and capture stream
share the same callback function in which it can't know the stream type.

It's possible to require different paremters for playback and capture

paremters => parameters

Quoted 8 lines

Code looks good, after the commit messages fixes:

--
Regards,
Alexandre

Hi Alexandre,

Thank you for pointing out my mistake.
I will correct it in v3.

Thanks,
Trevor

#6 lore raw

Re: [PATCH v2 2/7] ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

In reply to Alexandre Mergnat
Quoted 8 lines · Alexandre Mergnat
Quoted 7 lines · Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188-mt6359, codec
for ADDA_BE must be mt6359 which are configured on the machine driver.
Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE. As a result, remove ADDA_BE from items of link-name.

Quoted 8 lines
Quoted 1 line

I don't understand how "DL_SRC_BE" and "UL_SRC_BE" links are done. Why these dais don't replace "ADDA_BE" in this binding ?

Regards,
Alexandre

Hi Alexandre,

Because the sound card is mt8188-mt6359, the codec for these two links must be mt6359. Thus, I specifiy the codec in machine driver directly. If the codec is changed, there will be a new sound card and binding file. In conclusion, the codec won't be updated via dts, and that's why I don't just replace ADDA_BE in this binding.

Do you suggest me add some information in the commit message?

Thanks,
Trevor

#7 lore raw

Re: [PATCH v2 2/7] ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

Quoted 20 lines · Trevor Wu (吳文良)
Quoted 8 lines · Alexandre Mergnat
Quoted 7 lines · Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188-mt6359, codec
for ADDA_BE must be mt6359 which are configured on the machine driver.
Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE. As a result, remove ADDA_BE from items of link-name.

Quoted 8 lines
Quoted 1 line

I don't understand how "DL_SRC_BE" and "UL_SRC_BE" links are done. Why these dais don't replace "ADDA_BE" in this binding ?

Regards,
Alexandre

Hi Alexandre,

Quoted 7 lines

Because the sound card is mt8188-mt6359, the codec for these two links must be mt6359. Thus, I specifiy the codec in machine driver directly. If the codec is changed, there will be a new sound card and binding file. In conclusion, the codec won't be updated via dts, and that's why I don't just replace ADDA_BE in this binding.

Do you suggest me add some information in the commit message?

No it's fine, I'm just trying to understand.

When you say "I specifiy the codec in machine driver directly", you are talking about this change ?

+ } else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 ||
+ strcmp(dai_link->name, "UL_SRC_BE") == 0) {
+ if (!init_mt6359) {
+ dai_link->init = mt8188_mt6359_init;

I'm asking because the equivalent was done here:

- [DAI_LINK_ADDA_BE] = {
- .name = "ADDA_BE",
+ [DAI_LINK_DL_SRC_BE] = {
+ .name = "DL_SRC_BE",
.no_pcm = 1,
.dpcm_playback = 1,
- .dpcm_capture = 1,
- .init = mt8188_mt6359_init,
- SND_SOC_DAILINK_REG(adda),
+ SND_SOC_DAILINK_REG(dl_src),

So I'm wondering why "ADDA_BE" & "DPTX_BE" & "ETDM3_OUT_BE" are in the enum list of the binding since the codec is already specified in machine driver too. I probably miss something but I don't know what.

Signature · 2 lines
Regards,
Alexandre
#8 lore raw

Re: [PATCH v2 2/7] ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

In reply to Alexandre Mergnat
Quoted 64 lines · Alexandre Mergnat

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 32 lines · Trevor Wu (吳文良)
Quoted 10 lines · Alexandre Mergnat
Quoted 9 lines · Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188- mt6359,
codec
for ADDA_BE must be mt6359 which are configured on the machine driver.
Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE.
As a result, remove ADDA_BE from items of link-name.

Quoted 9 lines
Quoted 1 line

I don't understand how "DL_SRC_BE" and "UL_SRC_BE" links are done.
Why these dais don't replace "ADDA_BE" in this binding ?

Regards,
Alexandre

Hi Alexandre,

Because the sound card is mt8188-mt6359, the codec for these two links
must be mt6359. Thus, I specifiy the codec in machine driver directly.
If the codec is changed, there will be a new sound card and binding file. In conclusion, the codec won't be updated via dts, and that's why
I don't just replace ADDA_BE in this binding.

Quoted 1 line

Do you suggest me add some information in the commit message?

No it's fine, I'm just trying to understand.

When you say "I specifiy the codec in machine driver directly", you are talking about this change ?

+ } else if (strcmp(dai_link->name, "DL_SRC_BE") == 0

||
+                          strcmp(dai_link->name, "UL_SRC_BE") == 0)

{

(quoted diff) +2 -0
+                       if (!init_mt6359) {
+                               dai_link->init = mt8188_mt6359_init;

I'm asking because the equivalent was done here:

(quoted diff) +3 -5
-       [DAI_LINK_ADDA_BE] = {
-               .name = "ADDA_BE",
+       [DAI_LINK_DL_SRC_BE] = {
+               .name = "DL_SRC_BE",
                .no_pcm = 1,
                .dpcm_playback = 1,
-               .dpcm_capture = 1,
-               .init = mt8188_mt6359_init,
-               SND_SOC_DAILINK_REG(adda),
+               SND_SOC_DAILINK_REG(dl_src),
Quoted 6 lines

So I'm wondering why "ADDA_BE" & "DPTX_BE" & "ETDM3_OUT_BE" are in the
enum list of the binding since the codec is already specified in machine driver too. I probably miss something but I don't know what.

The following code snippet is cut from [PATCH v2 1/7].

/* BE */
-SND_SOC_DAILINK_DEFS(adda,
- DAILINK_COMP_ARRAY(COMP_CPU("ADDA")),
+SND_SOC_DAILINK_DEFS(dl_src,
+ DAILINK_COMP_ARRAY(COMP_CPU("DL_SRC")),

                     DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
                                                   "mt6359-snd-codec-
aif1")),
                     DAILINK_COMP_ARRAY(COMP_EMPTY()));
@@ -140,6 +140,12 @@ SND_SOC_DAILINK_DEFS(pcm1,
                     DAILINK_COMP_ARRAY(COMP_DUMMY()),
                     DAILINK_COMP_ARRAY(COMP_EMPTY()));

+SND_SOC_DAILINK_DEFS(ul_src,
+ DAILINK_COMP_ARRAY(COMP_CPU("UL_SRC")),
+ DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
+ "mt6359-snd-codec-
aif1")),
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));

This is why I talk about specifying the codec it connects in the machine driver.
If you check other dai-links, you would see COMP_DUMMY() in the COMP_CODEC() field.

Thanks,
Trevor

Quoted 1 line
Reviewed-by on v2 4/7
#14 lore raw

Re: [PATCH v2 4/7] ASoC: mediatek: common: soundcard driver add dai_fmt support

In reply to Trevor Wu
Quoted 20 lines · Trevor Wu

There are two changes included in the patch.

First, add set_dailink_daifmt() function, so dai_fmt can be updated by the configuration in dai-link sub node.

Second, remove codec phandle from required property in dai-link sub node. For example, user possibly needs to update dai-format for all etdm co-clock dai-links, but codec doesn't need to be specified in capture dai-link for a speaker amp.

---
  .../mediatek/common/mtk-soundcard-driver.c    | 49 ++++++++++++++++++-
  1 file changed, 48 insertions(+), 1 deletion(-)
sound/soc/mediatek/common/mtk-soundcard-driver.c +0 -0
index 738093451ccb..5e291092046b 100644

sound/soc/mediatek/common/mtk-soundcard-driver.c static int set_card_codec_info(struct snd_soc_card *card, · line 25

Quoted 4 lines
sound/soc/mediatek/common/mtk-soundcard-driver.c +0 -1
@@ -22,7 +22,7 @@ static int set_card_codec_info(struct snd_soc_card *card,
 
  	codec_node = of_get_child_by_name(sub_node, "codec");
  	if (!codec_node)
-		return -EINVAL;

IMO, the debug or info print should be welcome here because the behavior
change: dai link info parse will not stop if the codec node is NULL. That could help to understand what is happening during init.

Signature · 2 lines
Regards,
Alexandre
Reviewed-by
#9 lore raw

Re: [PATCH v2 2/7] ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

In reply to Trevor Wu (吳文良)
Quoted 96 lines · Trevor Wu (吳文良)
Quoted 64 lines · Alexandre Mergnat

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 32 lines · Trevor Wu (吳文良)
Quoted 10 lines · Alexandre Mergnat
Quoted 9 lines · Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188- mt6359,
codec
for ADDA_BE must be mt6359 which are configured on the machine driver.
Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE.
As a result, remove ADDA_BE from items of link-name.

Quoted 9 lines
Quoted 1 line

I don't understand how "DL_SRC_BE" and "UL_SRC_BE" links are done.
Why these dais don't replace "ADDA_BE" in this binding ?

Regards,
Alexandre

Hi Alexandre,

Because the sound card is mt8188-mt6359, the codec for these two links
must be mt6359. Thus, I specifiy the codec in machine driver directly.
If the codec is changed, there will be a new sound card and binding file. In conclusion, the codec won't be updated via dts, and that's why
I don't just replace ADDA_BE in this binding.

Quoted 1 line

Do you suggest me add some information in the commit message?

No it's fine, I'm just trying to understand.

When you say "I specifiy the codec in machine driver directly", you are talking about this change ?

+ } else if (strcmp(dai_link->name, "DL_SRC_BE") == 0

||
+                          strcmp(dai_link->name, "UL_SRC_BE") == 0)

{

(quoted diff) +2 -0
+                       if (!init_mt6359) {
+                               dai_link->init = mt8188_mt6359_init;

I'm asking because the equivalent was done here:

(quoted diff) +3 -5
-       [DAI_LINK_ADDA_BE] = {
-               .name = "ADDA_BE",
+       [DAI_LINK_DL_SRC_BE] = {
+               .name = "DL_SRC_BE",
                 .no_pcm = 1,
                 .dpcm_playback = 1,
-               .dpcm_capture = 1,
-               .init = mt8188_mt6359_init,
-               SND_SOC_DAILINK_REG(adda),
+               SND_SOC_DAILINK_REG(dl_src),
Quoted 6 lines

So I'm wondering why "ADDA_BE" & "DPTX_BE" & "ETDM3_OUT_BE" are in the
enum list of the binding since the codec is already specified in machine driver too. I probably miss something but I don't know what.

The following code snippet is cut from [PATCH v2 1/7].

/* BE */

(quoted diff) +2 -2
-SND_SOC_DAILINK_DEFS(adda,
-                    DAILINK_COMP_ARRAY(COMP_CPU("ADDA")),
+SND_SOC_DAILINK_DEFS(dl_src,
+                    DAILINK_COMP_ARRAY(COMP_CPU("DL_SRC")),
                      DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
                                                    "mt6359-snd-codec-

aif1")),

                      DAILINK_COMP_ARRAY(COMP_EMPTY()));
(quoted diff) +5 -0
@@ -140,6 +140,12 @@ SND_SOC_DAILINK_DEFS(pcm1,
                      DAILINK_COMP_ARRAY(COMP_DUMMY()),
                      DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
+SND_SOC_DAILINK_DEFS(ul_src,
+                    DAILINK_COMP_ARRAY(COMP_CPU("UL_SRC")),
+                    DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
+                                                  "mt6359-snd-codec-
 aif1")),
+                    DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
 
Quoted 4 lines

This is why I talk about specifying the codec it connects in the machine driver.
If you check other dai-links, you would see COMP_DUMMY() in the COMP_CODEC() field.

Ok thanks for the explanation. If I understand well, ADDA_BE could have been removed from the enum list before your serie because the codec was already specified for ADDA_BE.

Signature · 2 lines
Regards,
Alexandre
Reviewed-by on v2 5/7
#17 lore raw

Re: [PATCH v2 5/7] ASoC: soc-dapm.c: clean up debugfs for freed widget

In reply to Trevor Wu
Quoted 11 lines · Trevor Wu

When a widget is added to dapm via snd_soc_dapm_new_widgets, dapm_debugfs_add_widget is also called to create a corresponding debugfs file. However, when a widget is freed by snd_soc_dapm_free_widget, the corresponding debugfs is not cleared. As a result, the freed widget is still seen in the dapm directory.

This patch adds dapm_debugfs_free_widget to free the debugfs of a specified widget, and it's called at snd_soc_dapm_free_widget to clean up the debugfs for freed widget.

Signature · 2 lines
Regards,
Alexandre
#19 lore raw

Re: [PATCH v2 6/7] ASoC: mediatek: mt8188-mt6359: support new board with nau88255

In reply to Trevor Wu

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1076

Quoted 13 lines · Trevor Wu
  	card_data = (struct mt8188_card_data *)of_device_get_match_data(&pdev->dev);
sound/soc/mediatek/mt8188/mt8188-mt6359.c +8 -0
@@ -776,9 +1066,38 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
  				dai_link->init = mt8188_mt6359_init;
  				init_mt6359 = true;
  			}
+		} else if (strcmp(dai_link->name, "ETDM1_OUT_BE") == 0 ||
+			   strcmp(dai_link->name, "ETDM2_OUT_BE") == 0 ||
+			   strcmp(dai_link->name, "ETDM1_IN_BE") == 0 ||
+			   strcmp(dai_link->name, "ETDM2_IN_BE") == 0) {
+			if (!strcmp(dai_link->codecs->dai_name, MAX98390_CODEC_DAI)) {
+				dai_link->ops = &mt8188_max98390_ops;
+				if (init_max98390)
+					continue;

I prefer that you do like your patch [PATCH v2 1/7] to be consistent and easy to read.

+ if (!init_mt6359) {
+ dai_link->init = mt8188_mt6359_init;
+ init_mt6359 = true;
+ }

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1083

Quoted 7 lines
sound/soc/mediatek/mt8188/mt8188-mt6359.c +7 -0
+
+				dai_link->init = mt8188_max98390_codec_init;
+				init_max98390 = true;
+			} else if (!strcmp(dai_link->codecs->dai_name, NAU8825_CODEC_DAI)) {
+				dai_link->ops = &mt8188_nau8825_ops;
+				if (init_nau8825)
+					continue;

ditto

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1089

Quoted 6 lines
sound/soc/mediatek/mt8188/mt8188-mt6359.c +6 -0
+
+				dai_link->init = mt8188_nau8825_codec_init;
+				dai_link->exit = mt8188_nau8825_codec_exit;
+				init_nau8825 = true;
+			} else {
+				if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {

Shouldn't be with a NOT operator ("!") ?
+ if (!strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1091

Quoted 2 lines
sound/soc/mediatek/mt8188/mt8188-mt6359.c +2 -0
+					if (init_dumb)
+						continue;

ditto

Quoted 33 lines
sound/soc/mediatek/mt8188/mt8188-mt6359.c +15 -0
+
+					dai_link->init = mt8188_dumb_amp_init;
+					init_dumb = true;
+				}
+			}
  		}
  	}
 
+	priv->private_data = card_data;
  	snd_soc_card_set_drvdata(card, priv);
 
  	ret = devm_snd_soc_register_card(&pdev->dev, card);
@@ -795,11 +1114,20 @@ static struct mt8188_card_data mt8188_evb_card = {
  	.name = "mt8188_mt6359",
  };
 
+static struct mt8188_card_data mt8188_nau8825_card = {
+	.name = "mt8188_nau8825",
+	.quirk = NAU8825_HS_PRESENT,
+};
+
  static const struct of_device_id mt8188_mt6359_dt_match[] = {
  	{
  		.compatible = "mediatek,mt8188-mt6359-evb",
  		.data = &mt8188_evb_card,
  	},
+	{
+		.compatible = "mediatek,mt8188-nau8825",
+		.data = &mt8188_nau8825_card,
+	},
  	{},
  };
  MODULE_DEVICE_TABLE(of, mt8188_mt6359_dt_match);
Signature · 2 lines
Regards,
Alexandre
#15 lore raw

Re: [PATCH v2 4/7] ASoC: mediatek: common: soundcard driver add dai_fmt support

In reply to Alexandre Mergnat
Quoted 39 lines · Alexandre Mergnat
Quoted 25 lines · Trevor Wu

There are two changes included in the patch.

First, add set_dailink_daifmt() function, so dai_fmt can be updated by
the configuration in dai-link sub node.

Second, remove codec phandle from required property in dai-link sub node.
For example, user possibly needs to update dai-format for all etdm co-clock dai-links, but codec doesn't need to be specified in capture
dai-link for a speaker amp.

---
  .../mediatek/common/mtk-soundcard-driver.c    | 49
++++++++++++++++++-
  1 file changed, 48 insertions(+), 1 deletion(-)
sound/soc/mediatek/common/mtk-soundcard-driver.c +0 -0
index 738093451ccb..5e291092046b 100644

sound/soc/mediatek/common/mtk-soundcard-driver.c static int set_card_codec_info(struct · line 26

Quoted 5 lines
sound/soc/mediatek/common/mtk-soundcard-driver.c +0 -1
@@ -22,7 +22,7 @@ static int set_card_codec_info(struct
 snd_soc_card *card,
 
      codec_node = of_get_child_by_name(sub_node, "codec");
      if (!codec_node)
-             return -EINVAL;

IMO, the debug or info print should be welcome here because the behavior
change: dai link info parse will not stop if the codec node is NULL. That could help to understand what is happening during init.

Quoted 2 lines

Thanks for your suggestion. I will add a debug message here.

Thanks,
Trevor

#10 lore raw

Re: [PATCH v2 2/7] ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

In reply to Alexandre Mergnat
Quoted 122 lines · Alexandre Mergnat
Quoted 110 lines · Trevor Wu (吳文良)
Quoted 74 lines · Alexandre Mergnat

External email : Please do not click links or open attachments until
you have verified the sender or the content.

Quoted 36 lines · Trevor Wu (吳文良)
Quoted 11 lines · Alexandre Mergnat
Quoted 10 lines · Trevor Wu

ADDA_BE is used to connect to mt6359. For machine mt8188- mt6359,
codec
for ADDA_BE must be mt6359 which are configured on the machine
driver.
Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE.
As a result, remove ADDA_BE from items of link-name.

Quoted 9 lines
Quoted 1 line

I don't understand how "DL_SRC_BE" and "UL_SRC_BE" links are done.
Why these dais don't replace "ADDA_BE" in this binding ?

Regards,
Alexandre

Hi Alexandre,

Because the sound card is mt8188-mt6359, the codec for these two
links
must be mt6359. Thus, I specifiy the codec in machine driver directly.
If the codec is changed, there will be a new sound card and binding
file. In conclusion, the codec won't be updated via dts, and that's
why
I don't just replace ADDA_BE in this binding.

Quoted 1 line

Do you suggest me add some information in the commit message?

No it's fine, I'm just trying to understand.

When you say "I specifiy the codec in machine driver directly", you
are talking about this change ?

+ } else if (strcmp(dai_link->name, "DL_SRC_BE") ==
0

Quoted 1 line
Quoted 1 line

+ strcmp(dai_link->name, "UL_SRC_BE") ==
0)
{

(quoted diff) +2 -0
+                       if (!init_mt6359) {
+                               dai_link->init =

mt8188_mt6359_init;

I'm asking because the equivalent was done here:

(quoted diff) +3 -5
-       [DAI_LINK_ADDA_BE] = {
-               .name = "ADDA_BE",
+       [DAI_LINK_DL_SRC_BE] = {
+               .name = "DL_SRC_BE",
                 .no_pcm = 1,
                 .dpcm_playback = 1,
-               .dpcm_capture = 1,
-               .init = mt8188_mt6359_init,
-               SND_SOC_DAILINK_REG(adda),
+               SND_SOC_DAILINK_REG(dl_src),
Quoted 8 lines

So I'm wondering why "ADDA_BE" & "DPTX_BE" & "ETDM3_OUT_BE" are in
the
enum list of the binding since the codec is already specified in machine driver too. I probably miss something but I don't know what.

The following code snippet is cut from [PATCH v2 1/7].

/* BE */

(quoted diff) +2 -2
-SND_SOC_DAILINK_DEFS(adda,
-                    DAILINK_COMP_ARRAY(COMP_CPU("ADDA")),
+SND_SOC_DAILINK_DEFS(dl_src,
+                    DAILINK_COMP_ARRAY(COMP_CPU("DL_SRC")),
                      DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
                                                    "mt6359-snd-

codec-
aif1")),

                      DAILINK_COMP_ARRAY(COMP_EMPTY()));
(quoted diff) +4 -0
@@ -140,6 +140,12 @@ SND_SOC_DAILINK_DEFS(pcm1,
                      DAILINK_COMP_ARRAY(COMP_DUMMY()),
                      DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
+SND_SOC_DAILINK_DEFS(ul_src,
+                    DAILINK_COMP_ARRAY(COMP_CPU("UL_SRC")),
+                    DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
+                                                  "mt6359-snd-

codec-
aif1")),
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));

Quoted 4 lines

This is why I talk about specifying the codec it connects in the machine driver.
If you check other dai-links, you would see COMP_DUMMY() in the COMP_CODEC() field.

Ok thanks for the explanation. If I understand well, ADDA_BE could have
been removed from the enum list before your serie because the codec was
already specified for ADDA_BE.

Quoted 2 lines

Actually, it's allowed to be overwritten by DTS configuration. That's why I listed ADDA_BE in the enum list before. However, I found the binding and machine driver was implemented for mt6359, so I think it's more reasonable to remove it from the list.

Thanks,
Trevor

#20 lore raw

Re: [PATCH v2 6/7] ASoC: mediatek: mt8188-mt6359: support new board with nau88255

In reply to Alexandre Mergnat
Quoted 20 lines · Alexandre Mergnat

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 15 lines · Trevor Wu

card_data = (struct mt8188_card_data
*)of_device_get_match_data(&pdev->dev);

sound/soc/mediatek/mt8188/mt8188-mt6359.c +1 -0
@@ -776,9 +1066,38 @@ static int mt8188_mt6359_dev_probe(struct
 platform_device *pdev)
                              dai_link->init = mt8188_mt6359_init;
                              init_mt6359 = true;
                      }
+             } else if (strcmp(dai_link->name, "ETDM1_OUT_BE") ==

0 ||
+ strcmp(dai_link->name, "ETDM2_OUT_BE") ==
0 ||
+ strcmp(dai_link->name, "ETDM1_IN_BE") == 0

||
+                        strcmp(dai_link->name, "ETDM2_IN_BE") ==

0) {

Quoted 8 lines

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1076

Quoted 5 lines

+ if (!strcmp(dai_link->codecs->dai_name,
MAX98390_CODEC_DAI)) {

sound/soc/mediatek/mt8188/mt8188-mt6359.c +3 -0
+                             dai_link->ops = &mt8188_max98390_ops;
+                             if (init_max98390)
+                                     continue;

I prefer that you do like your patch [PATCH v2 1/7] to be consistent and easy to read.

OK, I will unify the style in v3.

Quoted 26 lines
(quoted diff) +4 -0
+                       if (!init_mt6359) {
+                               dai_link->init = mt8188_mt6359_init;
+                               init_mt6359 = true;
+                       }

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1083

Quoted 10 lines
(quoted diff) +2 -0
+
+                             dai_link->init =

mt8188_max98390_codec_init;

(quoted diff) +2 -0
+                             init_max98390 = true;
+                     } else if (!strcmp(dai_link->codecs-
Quoted 1 line

dai_name, NAU8825_CODEC_DAI)) {

sound/soc/mediatek/mt8188/mt8188-mt6359.c +3 -0
+                             dai_link->ops = &mt8188_nau8825_ops;
+                             if (init_nau8825)
+                                     continue;

ditto

Quoted 8 lines
(quoted diff) +2 -0
+
+                             dai_link->init =

mt8188_nau8825_codec_init;
+ dai_link->exit =
mt8188_nau8825_codec_exit;

sound/soc/mediatek/mt8188/mt8188-mt6359.c +3 -0
+                             init_nau8825 = true;
+                     } else {
+                             if (strcmp(dai_link->codecs-
Quoted 5 lines
Quoted 1 line
Quoted 1 line

dai_name, "snd-soc-dummy-dai")) {

Shouldn't be with a NOT operator ("!") ?
+ if (!strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {

strcmp returns 0 when the contents of both strings are equal. The default codec name is "snd-soc-dummy-dai". When the codec is specified from dts, the return value of strcmp will be non-zero and this is the case I want to assign init function. Therefore, it doesn't require a NOT operator here.

Thanks,
Trevor

Quoted 1 line
#21 lore raw

Re: [PATCH v2 6/7] ASoC: mediatek: mt8188-mt6359: support new board with nau88255

Quoted 64 lines · Trevor Wu (吳文良)
Quoted 20 lines · Alexandre Mergnat

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 15 lines · Trevor Wu

card_data = (struct mt8188_card_data
*)of_device_get_match_data(&pdev->dev);

sound/soc/mediatek/mt8188/mt8188-mt6359.c +1 -0
@@ -776,9 +1066,38 @@ static int mt8188_mt6359_dev_probe(struct
 platform_device *pdev)
                               dai_link->init = mt8188_mt6359_init;
                               init_mt6359 = true;
                       }
+             } else if (strcmp(dai_link->name, "ETDM1_OUT_BE") ==

0 ||
+ strcmp(dai_link->name, "ETDM2_OUT_BE") ==
0 ||
+ strcmp(dai_link->name, "ETDM1_IN_BE") == 0

||
+                        strcmp(dai_link->name, "ETDM2_IN_BE") ==

0) {

Quoted 8 lines

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1076

Quoted 5 lines

+ if (!strcmp(dai_link->codecs->dai_name,
MAX98390_CODEC_DAI)) {

sound/soc/mediatek/mt8188/mt8188-mt6359.c +3 -0
+                             dai_link->ops = &mt8188_max98390_ops;
+                             if (init_max98390)
+                                     continue;

I prefer that you do like your patch [PATCH v2 1/7] to be consistent and easy to read.

OK, I will unify the style in v3.

Quoted 26 lines
(quoted diff) +4 -0
+                       if (!init_mt6359) {
+                               dai_link->init = mt8188_mt6359_init;
+                               init_mt6359 = true;
+                       }

sound/soc/mediatek/mt8188/mt8188-mt6359.c static int mt8188_mt6359_dev_probe(struct platform_device *pdev) · line 1083

Quoted 10 lines
(quoted diff) +2 -0
+
+                             dai_link->init =

mt8188_max98390_codec_init;

(quoted diff) +2 -0
+                             init_max98390 = true;
+                     } else if (!strcmp(dai_link->codecs-
Quoted 1 line

dai_name, NAU8825_CODEC_DAI)) {

sound/soc/mediatek/mt8188/mt8188-mt6359.c +3 -0
+                             dai_link->ops = &mt8188_nau8825_ops;
+                             if (init_nau8825)
+                                     continue;

ditto

Quoted 8 lines
(quoted diff) +2 -0
+
+                             dai_link->init =

mt8188_nau8825_codec_init;
+ dai_link->exit =
mt8188_nau8825_codec_exit;

sound/soc/mediatek/mt8188/mt8188-mt6359.c +3 -0
+                             init_nau8825 = true;
+                     } else {
+                             if (strcmp(dai_link->codecs-
Quoted 5 lines
Quoted 1 line
Quoted 1 line

dai_name, "snd-soc-dummy-dai")) {

Shouldn't be with a NOT operator ("!") ?
+ if (!strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {

Quoted 5 lines

strcmp returns 0 when the contents of both strings are equal. The default codec name is "snd-soc-dummy-dai". When the codec is specified from dts, the return value of strcmp will be non-zero and this is the case I want to assign init function. Therefore, it doesn't require a NOT operator here.

Ok, I thought "mt8188_dumb_amp_init" was for "snd-soc-dummy-dai". It's fine for me.

Signature · 2 lines
Regards,
Alexandre