Skip to contentSkip to conversation

ASoC: mediatek: Add support for MT8195 sound card with max98390 and rt5682

PATCH Superseded Trevor Wu 2 participants 8 messages Mar 16, 2022 – Mar 17, 2022

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Trevor Wu

author
#0 lore raw

v2 cover ASoC: mediatek: Add support for MT8195 sound card with max98390 and rt5682

This series of patches adds support for mt8195 board with mt6359, max98390 and rt5682.

To prevent from copy-paste components, mt8195 machine drivers and dt-bindings are merged in the patch.

Patches are based on broonie tree "for-next" branch.

Changes since v1:
- remove merged patches about reset controller
- propose a common machine driver instead of machine driver common code
- propose a common dt-bindings for mt8195 sound card

Trevor Wu (5):
ASoC: mediatek: mt8195: merge machine driver
ASoC: dt-bindings: mediatek: mt8195: merge mt8195 machine yaml
ASoC: mediatek: mt8195: rename card controls
ASoC: mediatek: mt8195: add machine support for max98390 and rt5682
ASoC: dt-bindings: mediatek: mt8195: support

    mt8195-mt6359-max98390-rt5682
 .../sound/mt8195-mt6359-rt1011-rt5682.yaml    |   51 -
 ...-rt1019-rt5682.yaml => mt8195-mt6359.yaml} |    9 +-
 sound/soc/mediatek/Kconfig                    |   26 +-
 sound/soc/mediatek/mt8195/Makefile            |    3 +-
 .../mt8195/mt8195-mt6359-rt1011-rt5682.c      | 1198 -----------------
 ...mt6359-rt1019-rt5682.c => mt8195-mt6359.c} |  984 +++++++++-----
 6 files changed, 634 insertions(+), 1637 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1011-rt5682.yaml
 rename Documentation/devicetree/bindings/sound/{mt8195-mt6359-rt1019-rt5682.yaml => mt8195-mt6359.yaml} (84%)
 delete mode 100644 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c
 rename sound/soc/mediatek/mt8195/{mt8195-mt6359-rt1019-rt5682.c => mt8195-mt6359.c} (76%)
Signature · 1 line
2.18.0
author
#1 lore raw

PATCH v2 1/5 ASoC: mediatek: mt8195: merge machine driver

Because most functions can be reused in different codec combinations, mt8195 machine drivers are combined to one common file.

The model and compatible string are used to decide which codecs are being used.

As a result, We can prevent from copy-paste functions when new codec combination is introduced.

---
 sound/soc/mediatek/Kconfig                    |   25 +-
 sound/soc/mediatek/mt8195/Makefile            |    3 +-
 .../mt8195/mt8195-mt6359-rt1011-rt5682.c      | 1198 -----------------
 ...mt6359-rt1019-rt5682.c => mt8195-mt6359.c} |  918 ++++++++-----
 4 files changed, 558 insertions(+), 1586 deletions(-)
 delete mode 100644 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c
 rename sound/soc/mediatek/mt8195/{mt8195-mt6359-rt1019-rt5682.c => mt8195-mt6359.c} (80%)
sound/soc/mediatek/Kconfig +5 -20
index 0d154350f180..16204a135c4d 100644
@@ -198,34 +198,19 @@ config SND_SOC_MT8195
 	  Select Y if you have such device.
 	  If unsure select "N".
 
-config SND_SOC_MT8195_MT6359_RT1019_RT5682
-	tristate "ASoC Audio driver for MT8195 with MT6359 RT1019 RT5682 codec"
-	depends on I2C && GPIOLIB
-	depends on SND_SOC_MT8195 && MTK_PMIC_WRAP
-	select SND_SOC_MT6359
-	select SND_SOC_RT1015P
-	select SND_SOC_RT5682_I2C
-	select SND_SOC_RT5682S
-	select SND_SOC_DMIC
-	select SND_SOC_HDMI_CODEC
-	help
-	  This adds ASoC driver for Mediatek MT8195 boards
-	  with the MT6359 RT1019 RT5682 audio codec.
-	  Select Y if you have such device.
-	  If unsure select "N".
-
-config SND_SOC_MT8195_MT6359_RT1011_RT5682
-	tristate "ASoC Audio driver for MT8195 with MT6359 RT1011 RT5682 codec"
+config SND_SOC_MT8195_MT6359
+	tristate "ASoC Audio driver for MT8195 with MT6359 and I2S codec"
 	depends on I2C && GPIOLIB
 	depends on SND_SOC_MT8195 && MTK_PMIC_WRAP
 	select SND_SOC_MT6359
 	select SND_SOC_RT1011
+	select SND_SOC_RT1015P
 	select SND_SOC_RT5682_I2C
 	select SND_SOC_RT5682S
 	select SND_SOC_DMIC
 	select SND_SOC_HDMI_CODEC
 	help
-	  This adds ASoC driver for Mediatek MT8195 boards
-	  with the MT6359 RT1011 RT5682 audio codec.
+	  This adds support for ASoC machine driver for Mediatek MT8195
+	  boards with MT6359 and other I2S audio codecs.
 	  Select Y if you have such device.
 	  If unsure select "N".
sound/soc/mediatek/mt8195/Makefile +1 -2
index e5f0df5010b6..aae673ec751b 100644
@@ -12,5 +12,4 @@ snd-soc-mt8195-afe-objs := \
 obj-$(CONFIG_SND_SOC_MT8195) += snd-soc-mt8195-afe.o
 
 # machine driver
-obj-$(CONFIG_SND_SOC_MT8195_MT6359_RT1019_RT5682) += mt8195-mt6359-rt1019-rt5682.o
-obj-$(CONFIG_SND_SOC_MT8195_MT6359_RT1011_RT5682) += mt8195-mt6359-rt1011-rt5682.o
+obj-$(CONFIG_SND_SOC_MT8195_MT6359) += mt8195-mt6359.o
sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c deleted +0 -1198

1,198 lines not on this page · raw message

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +552 -366

1,137 lines not on this page · raw message

Signature · 1 line
2.18.0
#2 lore raw

Re: [PATCH v2 1/5] ASoC: mediatek: mt8195: merge machine driver

Hi,
I didn't review too many details because I found the patch is not easy to review. Please consider to not reorder symbols if it can. If it is still hard to generate reasonable chunks or the reorders are necessary, it could put some refactor patches prior to the "merge".

Quoted 1 line · Trevor Wu
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +0 -0

[...]

sound/soc/mediatek/mt8195/mt8195-mt6359.c line 17

Quoted 8 lines

#include <linux/input.h>
#include <linux/module.h>

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -1
+#include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 #include <sound/jack.h>
 #include <sound/pcm_params.h>
 #include <sound/rt5682.h>
-#include <sound/sof.h>

Why does it remove the header?

Quoted 18 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +18 -0
+struct mt8195_mt6359_priv {
+	struct snd_soc_jack headset_jack;
+	struct snd_soc_jack dp_jack;
+	struct snd_soc_jack hdmi_jack;
+	struct clk *i2so1_mclk;
+};
+
+struct mt8195_card_data {
+	const char *name;
+	unsigned long quirk;
+};
+
+struct sof_conn_stream {
+	const char *normal_link;
+	const char *sof_link;
+	const char *sof_dma;
+	int stream_dir;
+};

[...]

sound/soc/mediatek/mt8195/mt8195-mt6359.c line 51

Quoted 13 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +0 -13
-struct sof_conn_stream {
-	const char *normal_link;
-	const char *sof_link;
-	const char *sof_dma;
-	int stream_dir;
-};
-
-struct mt8195_mt6359_rt1019_rt5682_priv {
-	struct snd_soc_jack headset_jack;
-	struct snd_soc_jack dp_jack;
-	struct snd_soc_jack hdmi_jack;
-	struct clk *i2so1_mclk;
-};

The effective operation here: rename from mt8195_mt6359_rt1019_rt5682_priv to mt8195_mt6359_priv. However, it somehow reorders the code. As a result, the change looks like more complicated than just a "merge" operation.

Quoted 28 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +9 -10
-static const struct snd_soc_dapm_route mt8195_mt6359_rt1019_rt5682_routes[] = {
-	/* speaker */
-	{ "Speakers", NULL, "Speaker" },
+static const struct snd_kcontrol_new mt8195_mt6359_controls[] = {
+	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
+	SOC_DAPM_PIN_SWITCH("Headset Mic"),
+};
+
+static const struct snd_soc_dapm_route mt8195_mt6359_routes[] = {
 	/* headset */
 	{ "Headphone Jack", NULL, "HPOL" },
 	{ "Headphone Jack", NULL, "HPOR" },
@@ -80,55 +94,31 @@ static const struct snd_soc_dapm_route mt8195_mt6359_rt1019_rt5682_routes[] = {
 	{"I021", NULL, SOF_DMA_DL3},
 };
 
-static const struct snd_kcontrol_new mt8195_mt6359_rt1019_rt5682_controls[] = {
-	SOC_DAPM_PIN_SWITCH("Speakers"),
-	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
-	SOC_DAPM_PIN_SWITCH("Headset Mic"),
+static const struct snd_soc_dapm_widget mt8195_dual_speaker_widgets[] = {
+	SND_SOC_DAPM_SPK("Left Speaker", NULL),
+	SND_SOC_DAPM_SPK("Right Speaker", NULL),
 };
 
-static int mt8195_rt5682_etdm_hw_params(struct snd_pcm_substream *substream,
-					struct snd_pcm_hw_params *params)
-{

[...]

sound/soc/mediatek/mt8195/mt8195-mt6359.c static const struct snd_soc_dapm_route mt8195_mt6359_rt1019_rt5682_routes[] = { · line 105

Quoted 4 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +4 -0
+static const struct snd_kcontrol_new mt8195_dual_speaker_controls[] = {
+	SOC_DAPM_PIN_SWITCH("Left Speaker"),
+	SOC_DAPM_PIN_SWITCH("Right Speaker"),
+};

Ditto. I would expect it only renames and adds something. However, if you look at the block and the following, it looks like changed a lot.

Quoted 13 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +2 -5
@@ -143,20 +133,20 @@ static int mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)
 	struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt_afe);
 	struct mt8195_afe_private *afe_priv = afe->platform_priv;
 	struct mtkaif_param *param = &afe_priv->mtkaif_params;
-	int phase;
-	unsigned int monitor;
-	int mtkaif_calibration_num_phase;
+	int chosen_phase_1, chosen_phase_2, chosen_phase_3;
+	int prev_cycle_1, prev_cycle_2, prev_cycle_3;
 	int test_done_1, test_done_2, test_done_3;
 	int cycle_1, cycle_2, cycle_3;
-	int prev_cycle_1, prev_cycle_2, prev_cycle_3;
-	int chosen_phase_1, chosen_phase_2, chosen_phase_3;

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd) · line 147

Quoted 10 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +5 -2
-	int counter;
-	bool mtkaif_calibration_ok;
 	int mtkaif_chosen_phase[MT8195_MTKAIF_MISO_NUM];
 	int mtkaif_phase_cycle[MT8195_MTKAIF_MISO_NUM];
+	int mtkaif_calibration_num_phase;
+	bool mtkaif_calibration_ok;
+	unsigned int monitor;
+	int counter;
+	int phase;
 	int i;

The reorder of variable declaration is irrelevant to the patch. Drop them. If it has good reason to do so, send another patch for the purpose.

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_playback_startup(struct snd_pcm_substream *substream) · line 450

Quoted 7 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -1
@@ -513,7 +446,7 @@ static int mt8195_playback_startup(struct snd_pcm_substream *substream)
 	return 0;
 }
 
-static const struct snd_soc_ops mt8195_playback_ops = {
+const struct snd_soc_ops mt8195_playback_ops = {
 	.startup = mt8195_playback_startup,

Why does it remove the static?

Quoted 2 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -0
+static int mt8195_mt6359_dev_probe(struct platform_device *pdev)
 {

[...]

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_dailink_parse_of(struct snd_soc_card *card, struct device_node · line 1457

Quoted 5 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +5 -0
+	match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
+	if (!match || !match->data)
+		return -EINVAL;
+
+	card_data = (struct mt8195_card_data *)match->data;

Use of_device_get_match_data().

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) · line 1603

Quoted 5 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -1
-static const struct dev_pm_ops mt8195_mt6359_rt1019_rt5682_pm_ops = {
+const struct dev_pm_ops mt8195_mt6359_pm_ops = {
 	.poweroff = snd_soc_poweroff,
 	.restore = snd_soc_resume,
 };

Why does it remove the static?

author
#3 lore raw

Re: [PATCH v2 1/5] ASoC: mediatek: mt8195: merge machine driver

Quoted 8 lines · Tzung-Bi Shih

Hi,
I didn't review too many details because I found the patch is not easy to
review. Please consider to not reorder symbols if it can. If it is still
hard to generate reasonable chunks or the reorders are necessary, it could
put some refactor patches prior to the "merge".

Hi Tzung-Bi,

Thanks for your suggestion.
Originally, I try to delete the old machine drivers and create a new one, so the layout is reordered and some functions are copied from mt8195-mt6359-rt1011-rt5682.c. But the git patch becomes a diff with mt8195-mt6359-rt1019-rt5682.c.

I can split the one into two patches in v3, one is "merge" and another one is "revise".
I hope it can make the review easier.

Quoted 6 lines · Trevor Wu
Quoted 2 lines
(quoted diff) +0 -0

rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c

[...]

Quoted 10 lines

sound/soc/mediatek/mt8195/mt8195-mt6359.c line 17

Quoted 8 lines

#include <linux/input.h>
#include <linux/module.h>

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -1
+#include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 #include <sound/jack.h>
 #include <sound/pcm_params.h>
 #include <sound/rt5682.h>
-#include <sound/sof.h>

Why does it remove the header?

It seems that the header is redundant, because the driver works on my platform.
But I will double confirm it.

Quoted 108 lines
Quoted 19 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +18 -0
+struct mt8195_mt6359_priv {
+	struct snd_soc_jack headset_jack;
+	struct snd_soc_jack dp_jack;
+	struct snd_soc_jack hdmi_jack;
+	struct clk *i2so1_mclk;
+};
+
+struct mt8195_card_data {
+	const char *name;
+	unsigned long quirk;
+};
+
+struct sof_conn_stream {
+	const char *normal_link;
+	const char *sof_link;
+	const char *sof_dma;
+	int stream_dir;
+};

[...]

sound/soc/mediatek/mt8195/mt8195-mt6359.c line 51

Quoted 13 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +0 -13
-struct sof_conn_stream {
-	const char *normal_link;
-	const char *sof_link;
-	const char *sof_dma;
-	int stream_dir;
-};
-
-struct mt8195_mt6359_rt1019_rt5682_priv {
-	struct snd_soc_jack headset_jack;
-	struct snd_soc_jack dp_jack;
-	struct snd_soc_jack hdmi_jack;
-	struct clk *i2so1_mclk;
-};

The effective operation here: rename from mt8195_mt6359_rt1019_rt5682_priv
to mt8195_mt6359_priv. However, it somehow reorders the code. As a result,
the change looks like more complicated than just a "merge" operation.

Quoted 34 lines

-static const struct snd_soc_dapm_route
mt8195_mt6359_rt1019_rt5682_routes[] = {

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +9 -9
-	/* speaker */
-	{ "Speakers", NULL, "Speaker" },
+static const struct snd_kcontrol_new mt8195_mt6359_controls[] = {
+	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
+	SOC_DAPM_PIN_SWITCH("Headset Mic"),
+};
+
+static const struct snd_soc_dapm_route mt8195_mt6359_routes[] = {
 	/* headset */
 	{ "Headphone Jack", NULL, "HPOL" },
 	{ "Headphone Jack", NULL, "HPOR" },
@@ -80,55 +94,31 @@ static const struct snd_soc_dapm_route
 mt8195_mt6359_rt1019_rt5682_routes[] = {
 	{"I021", NULL, SOF_DMA_DL3},
 };
 
-static const struct snd_kcontrol_new
 mt8195_mt6359_rt1019_rt5682_controls[] = {
-	SOC_DAPM_PIN_SWITCH("Speakers"),
-	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
-	SOC_DAPM_PIN_SWITCH("Headset Mic"),
+static const struct snd_soc_dapm_widget
 mt8195_dual_speaker_widgets[] = {
+	SND_SOC_DAPM_SPK("Left Speaker", NULL),
+	SND_SOC_DAPM_SPK("Right Speaker", NULL),
 };
 
-static int mt8195_rt5682_etdm_hw_params(struct snd_pcm_substream
 *substream,
-					struct snd_pcm_hw_params
 *params)
-{

[...]

sound/soc/mediatek/mt8195/mt8195-mt6359.c static const struct snd_soc_dapm_route mt8195_mt6359_rt1019_rt5682_routes[] = { · line 105

Quoted 5 lines

+static const struct snd_kcontrol_new
mt8195_dual_speaker_controls[] = {

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +3 -0
+	SOC_DAPM_PIN_SWITCH("Left Speaker"),
+	SOC_DAPM_PIN_SWITCH("Right Speaker"),
+};

Ditto. I would expect it only renames and adds something. However, if you
look at the block and the following, it looks like changed a lot.

Quoted 21 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +4 -7
@@ -143,20 +133,20 @@ static int
 mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)
 	struct mtk_base_afe *afe =
 snd_soc_component_get_drvdata(cmpnt_afe);
 	struct mt8195_afe_private *afe_priv = afe->platform_priv;
 	struct mtkaif_param *param = &afe_priv->mtkaif_params;
-	int phase;
-	unsigned int monitor;
-	int mtkaif_calibration_num_phase;
+	int chosen_phase_1, chosen_phase_2, chosen_phase_3;
+	int prev_cycle_1, prev_cycle_2, prev_cycle_3;
 	int test_done_1, test_done_2, test_done_3;
 	int cycle_1, cycle_2, cycle_3;
-	int prev_cycle_1, prev_cycle_2, prev_cycle_3;
-	int chosen_phase_1, chosen_phase_2, chosen_phase_3;
-	int counter;
-	bool mtkaif_calibration_ok;
 	int mtkaif_chosen_phase[MT8195_MTKAIF_MISO_NUM];
 	int mtkaif_phase_cycle[MT8195_MTKAIF_MISO_NUM];
+	int mtkaif_calibration_num_phase;
+	bool mtkaif_calibration_ok;
Quoted 8 lines

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd) · line 147

Quoted 4 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +3 -0
+	unsigned int monitor;
+	int counter;
+	int phase;
 	int i;

The reorder of variable declaration is irrelevant to the patch. Drop them.
If it has good reason to do so, send another patch for the purpose.

This function is copied from mt8195-mt6359-rt1011-rt5682.c, because this is the latest version of mt8195_mt6359_mtkaif_calibration(). The reordering is suggested by the reviewer.

Quoted 11 lines

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_playback_startup(struct · line 451

Quoted 9 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -1
@@ -513,7 +446,7 @@ static int mt8195_playback_startup(struct
 snd_pcm_substream *substream)
 	return 0;
 }
 
-static const struct snd_soc_ops mt8195_playback_ops = {
+const struct snd_soc_ops mt8195_playback_ops = {
 	.startup = mt8195_playback_startup,

Why does it remove the static?

Sorry, I will add it in v3.

Quoted 5 lines
Quoted 3 lines
sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -0
+static int mt8195_mt6359_dev_probe(struct platform_device *pdev)
 {

[...]

Quoted 8 lines

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_dailink_parse_of(struct snd_soc_card *card, struct device_node · line 1457

Quoted 6 lines
(quoted diff) +1 -0
+	match = of_match_device(pdev->dev.driver->of_match_table,

&pdev->dev);

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +4 -0
+	if (!match || !match->data)
+		return -EINVAL;
+
+	card_data = (struct mt8195_card_data *)match->data;

Use of_device_get_match_data().

OK.

Quoted 9 lines

sound/soc/mediatek/mt8195/mt8195-mt6359.c static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) · line 1603

Quoted 7 lines

-static const struct dev_pm_ops mt8195_mt6359_rt1019_rt5682_pm_ops = {

sound/soc/mediatek/mt8195/mt8195-mt6359.c renamed from sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +1 -0
+const struct dev_pm_ops mt8195_mt6359_pm_ops = {
 	.poweroff = snd_soc_poweroff,
 	.restore = snd_soc_resume,
 };

Why does it remove the static?

I will add it in v3.

Thanks,
Trevor

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

author
#4 lore raw

PATCH v2 2/5 ASoC: dt-bindings: mediatek: mt8195: merge mt8195 machine yaml

In reply to Trevor Wu

Because the same binding components can be shared by all codecs combinations, we only reserve one binding file for mt8195 machine driver and rename to a generic name.

We use compatible string to separate different codec combination instead of creating a new binding file for new codec combination.

---
 .../sound/mt8195-mt6359-rt1011-rt5682.yaml    | 51 -------------------
 ...-rt1019-rt5682.yaml => mt8195-mt6359.yaml} |  8 +--
 2 files changed, 5 insertions(+), 54 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1011-rt5682.yaml
 rename Documentation/devicetree/bindings/sound/{mt8195-mt6359-rt1019-rt5682.yaml => mt8195-mt6359.yaml} (87%)
Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1011-rt5682.yaml deleted +0 -51
deleted file mode 100644
index cf6ad7933e23..000000000000
@@ -1,51 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/sound/mt8195-mt6359-rt1011-rt5682.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Mediatek MT8195 with MT6359, RT1011 and RT5682 ASoC sound card driver
-
-maintainers:
-  - Trevor Wu <[email protected]>
-
-description:
-  This binding describes the MT8195 sound card with RT1011 and RT5682.
-
-properties:
-  compatible:
-    const: mediatek,mt8195_mt6359_rt1011_rt5682
-
-  model:
-    $ref: /schemas/types.yaml#/definitions/string
-    description: User specified audio sound card name
-
-  mediatek,platform:
-    $ref: "/schemas/types.yaml#/definitions/phandle"
-    description: The phandle of MT8195 ASoC platform.
-
-  mediatek,dptx-codec:
-    $ref: "/schemas/types.yaml#/definitions/phandle"
-    description: The phandle of MT8195 Display Port Tx codec node.
-
-  mediatek,hdmi-codec:
-    $ref: "/schemas/types.yaml#/definitions/phandle"
-    description: The phandle of MT8195 HDMI codec node.
-
-additionalProperties: false
-
-required:
-  - compatible
-  - mediatek,platform
-
-examples:
-  - |
-
-    sound: mt8195-sound {
-        compatible = "mediatek,mt8195_mt6359_rt1011_rt5682";
-        mediatek,platform = <&afe>;
-        pinctrl-names = "default";
-        pinctrl-0 = <&aud_pins_default>;
-    };
-
-...
Documentation/devicetree/bindings/sound/mt8195-mt6359.yaml renamed from Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml +5 -3
similarity index 87%
rename from Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml
rename to Documentation/devicetree/bindings/sound/mt8195-mt6359.yaml
index 8f177e02ad35..74227fba91c7 100644
@@ -1,10 +1,10 @@
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/sound/mt8195-mt6359-rt1019-rt5682.yaml#
+$id: http://devicetree.org/schemas/sound/mt8195-mt6359.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Mediatek MT8195 with MT6359, RT1019 and RT5682 ASoC sound card driver
+title: Mediatek MT8195 ASoC sound card driver
 
 maintainers:
   - Trevor Wu <[email protected]>
@@ -14,7 +14,9 @@ description:
 
 properties:
   compatible:
-    const: mediatek,mt8195_mt6359_rt1019_rt5682
+    enum:
+      - mediatek,mt8195_mt6359_rt1019_rt5682
+      - mediatek,mt8195_mt6359_rt1011_rt5682
 
   model:
     $ref: /schemas/types.yaml#/definitions/string
Signature · 1 line
2.18.0
author
#5 lore raw

PATCH v2 3/5 ASoC: mediatek: mt8195: rename card controls

In reply to Trevor Wu

In order to be able to reuse the same configurations in user space, rename the controls to generic names.

"Headphone Jack" -> "Headphone"
"Speakers" -> "Ext Spk"
"Left Speaker" -> "Left Spk"
"Right Speaker" -> "Right SPk"

---
 sound/soc/mediatek/mt8195/mt8195-mt6359.c | 26 +++++++++++------------
 1 file changed, 13 insertions(+), 13 deletions(-)
sound/soc/mediatek/mt8195/mt8195-mt6359.c +13 -13
index 544e99c83f3f..5ad6363e1bc9 100644
@@ -64,7 +64,7 @@ struct sof_conn_stream {
 #define SOF_DMA_UL5 "SOF_DMA_UL5"
 
 static const struct snd_soc_dapm_widget mt8195_mt6359_widgets[] = {
-	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
 	SND_SOC_DAPM_MIXER(SOF_DMA_DL2, SND_SOC_NOPM, 0, 0, NULL, 0),
 	SND_SOC_DAPM_MIXER(SOF_DMA_DL3, SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -73,14 +73,14 @@ static const struct snd_soc_dapm_widget mt8195_mt6359_widgets[] = {
 };
 
 static const struct snd_kcontrol_new mt8195_mt6359_controls[] = {
-	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
+	SOC_DAPM_PIN_SWITCH("Headphone"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
 };
 
 static const struct snd_soc_dapm_route mt8195_mt6359_routes[] = {
 	/* headset */
-	{ "Headphone Jack", NULL, "HPOL" },
-	{ "Headphone Jack", NULL, "HPOR" },
+	{ "Headphone", NULL, "HPOL" },
+	{ "Headphone", NULL, "HPOR" },
 	{ "IN1P", NULL, "Headset Mic" },
 	/* SOF Uplink */
 	{SOF_DMA_UL4, NULL, "O034"},
@@ -95,30 +95,30 @@ static const struct snd_soc_dapm_route mt8195_mt6359_routes[] = {
 };
 
 static const struct snd_soc_dapm_widget mt8195_dual_speaker_widgets[] = {
-	SND_SOC_DAPM_SPK("Left Speaker", NULL),
-	SND_SOC_DAPM_SPK("Right Speaker", NULL),
+	SND_SOC_DAPM_SPK("Left Spk", NULL),
+	SND_SOC_DAPM_SPK("Right Spk", NULL),
 };
 
 static const struct snd_kcontrol_new mt8195_dual_speaker_controls[] = {
-	SOC_DAPM_PIN_SWITCH("Left Speaker"),
-	SOC_DAPM_PIN_SWITCH("Right Speaker"),
+	SOC_DAPM_PIN_SWITCH("Left Spk"),
+	SOC_DAPM_PIN_SWITCH("Right Spk"),
 };
 
 static const struct snd_soc_dapm_widget mt8195_speaker_widgets[] = {
-	SND_SOC_DAPM_SPK("Speakers", NULL),
+	SND_SOC_DAPM_SPK("Ext Spk", NULL),
 };
 
 static const struct snd_kcontrol_new mt8195_speaker_controls[] = {
-	SOC_DAPM_PIN_SWITCH("Speakers"),
+	SOC_DAPM_PIN_SWITCH("Ext Spk"),
 };
 
 static const struct snd_soc_dapm_route mt8195_rt1011_routes[] = {
-	{ "Left Speaker", NULL, "Left SPO" },
-	{ "Right Speaker", NULL, "Right SPO" },
+	{ "Left Spk", NULL, "Left SPO" },
+	{ "Right Spk", NULL, "Right SPO" },
 };
 
 static const struct snd_soc_dapm_route mt8195_rt1019_routes[] = {
-	{ "Speakers", NULL, "Speaker" },
+	{ "Ext Spk", NULL, "Speaker" },
 };
 
 #define CKSYS_AUD_TOP_CFG 0x032c
Signature · 1 line
2.18.0
author
#6 lore raw

PATCH v2 4/5 ASoC: mediatek: mt8195: add machine support for max98390 and rt5682

In reply to Trevor Wu

This patch adds support for mt8195 board with mt6359, max98390 and rt5682.

---
 sound/soc/mediatek/Kconfig                |  1 +
 sound/soc/mediatek/mt8195/mt8195-mt6359.c | 72 +++++++++++++++++++++++
 2 files changed, 73 insertions(+)
sound/soc/mediatek/Kconfig +1 -0
index 16204a135c4d..2a38e01da4ba 100644
@@ -207,6 +207,7 @@ config SND_SOC_MT8195_MT6359
 	select SND_SOC_RT1015P
 	select SND_SOC_RT5682_I2C
 	select SND_SOC_RT5682S
+	select SND_SOC_MAX98390
 	select SND_SOC_DMIC
 	select SND_SOC_HDMI_CODEC
 	help
sound/soc/mediatek/mt8195/mt8195-mt6359.c +72 -0

120 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#7 lore raw

PATCH v2 5/5 ASoC: dt-bindings: mediatek: mt8195: support mt8195-mt6359-max98390-rt5682

In reply to Trevor Wu

This patch adds compatible string "mediatek,mt8195-mt6359-max98390-rt5682" to support mt8195 board with mt6359, max98390 and rt5682.

---
 Documentation/devicetree/bindings/sound/mt8195-mt6359.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/mt8195-mt6359.yaml +1 -0
index 74227fba91c7..6222ef2cf7e4 100644
@@ -17,6 +17,7 @@ properties:
     enum:
       - mediatek,mt8195_mt6359_rt1019_rt5682
       - mediatek,mt8195_mt6359_rt1011_rt5682
+      - mediatek,mt8195_mt6359_max98390_rt5682
 
   model:
     $ref: /schemas/types.yaml#/definitions/string
Signature · 1 line
2.18.0