Skip to contentSkip to conversation

ASoC: Mediatek: Add support for MT8173 SoC

PATCH Superseded Koro Chen 3 participants 14 messages Jun 10, 2015 – Jun 15, 2015

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Koro Chen

author
#0 lore raw

cover ASoC: Mediatek: Add support for MT8173 SoC

This adds basic support for the Mediatek AFE (Audio Front End) unit for MT8173. This patch is based on Linux 4.1-rc1 and Sascha's SCPSYS power patch [1].

The AFE unit comprises several memory interfaces that communicate with CPU, a multi input multi output digital audio interconnect,
and several external interfaces (e.g. I2S).

[1] https://lkml.org/lkml/2015/6/9/172

changes since RFC:
- Use DPCM to model AFE
AFE memory interfaces such as DL1, VUL are modeled as frontend DAIs, and AFE IOs such as I2S, HDMI are backend DAIs.
Which memif and IO to be used can be set in the machine driver. There is no need to indicate this in dts anymore so include/dt-bindings/sound/mtk-afe.h is removed.
AFE connections are represented by DAPM widgets and routes, and set connection APIs/tables are no longer required. (mtk-afe-connection.c and mtk-afe-connection.h are removed) Instead, mixer controls are used to do connection/disconnection.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#1 lore raw

PATCH 1/3 ASoC: mediatek: Add AFE platform driver

This is the DPCM based platform driver of AFE (Audio Front End) unit.

---
 .../devicetree/bindings/sound/mtk-afe-pcm.txt      |   45 +
 sound/soc/Kconfig                                  |    1 +
 sound/soc/Makefile                                 |    1 +
 sound/soc/mediatek/Kconfig                         |    9 +
 sound/soc/mediatek/Makefile                        |    2 +
 sound/soc/mediatek/mtk-afe-common.h                |  109 ++
 sound/soc/mediatek/mtk-afe-pcm.c                   | 1233 ++++++++++++++++++++
 7 files changed, 1400 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt
 create mode 100644 sound/soc/mediatek/Kconfig
 create mode 100644 sound/soc/mediatek/Makefile
 create mode 100644 sound/soc/mediatek/mtk-afe-common.h
 create mode 100644 sound/soc/mediatek/mtk-afe-pcm.c
Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt new file +45 -0
new file mode 100644
index 0000000..e302c7f
@@ -0,0 +1,45 @@
+Mediatek AFE PCM controller
+
+Required properties:
+- compatible = "mediatek,mt8173-afe-pcm";
+- reg: register location and size
+- interrupts: Should contain AFE interrupt
+- clock-names: should have these clock names:
+		"infra_sys_audio_clk",
+		"top_pdn_audio",
+		"top_pdn_aud_intbus",
+		"bck0",
+		"bck1",
+		"i2s0_m",
+		"i2s1_m",
+		"i2s2_m",
+		"i2s3_m",
+		"i2s3_b";
+
+Example:
+
+	afe: mt8173-afe-pcm@11220000  {
+		compatible = "mediatek,mt8173-afe-pcm";
+		reg = <0 0x11220000 0 0x1000>;
+		interrupts = <GIC_SPI 134 IRQ_TYPE_EDGE_FALLING>;
+		clocks = <&infracfg INFRA_AUDIO>,
+			<&topckgen TOP_AUDIO_SEL>,
+			<&topckgen TOP_AUD_INTBUS_SEL>,
+			<&topckgen TOP_APLL1_DIV0>,
+			<&topckgen TOP_APLL2_DIV0>,
+			<&topckgen TOP_I2S0_M_CK_SEL>,
+			<&topckgen TOP_I2S1_M_CK_SEL>,
+			<&topckgen TOP_I2S2_M_CK_SEL>,
+			<&topckgen TOP_I2S3_M_CK_SEL>,
+			<&topckgen TOP_I2S3_B_CK_SEL>;
+		clock-names = "infra_sys_audio_clk",
+				"top_pdn_audio",
+				"top_pdn_aud_intbus",
+				"bck0",
+				"bck1",
+				"i2s0_m",
+				"i2s1_m",
+				"i2s2_m",
+				"i2s3_m",
+				"i2s3_b";
+	};
sound/soc/Kconfig +1 -0
index 3ba52da..cc1b718 100644
@@ -45,6 +45,7 @@ source "sound/soc/nuc900/Kconfig"
 source "sound/soc/omap/Kconfig"
 source "sound/soc/kirkwood/Kconfig"
 source "sound/soc/intel/Kconfig"
+source "sound/soc/mediatek/Kconfig"
 source "sound/soc/mxs/Kconfig"
 source "sound/soc/pxa/Kconfig"
 source "sound/soc/qcom/Kconfig"
sound/soc/Makefile +1 -0
index 974ba70..e552633 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_SND_SOC)	+= dwc/
 obj-$(CONFIG_SND_SOC)	+= fsl/
 obj-$(CONFIG_SND_SOC)	+= jz4740/
 obj-$(CONFIG_SND_SOC)	+= intel/
+obj-$(CONFIG_SND_SOC)	+= mediatek/
 obj-$(CONFIG_SND_SOC)	+= mxs/
 obj-$(CONFIG_SND_SOC)	+= nuc900/
 obj-$(CONFIG_SND_SOC)	+= omap/
sound/soc/mediatek/Kconfig new file +9 -0
new file mode 100644
index 0000000..38630d4
@@ -0,0 +1,9 @@
+config SND_SOC_MEDIATEK
+	bool "ASoC support for Mediatek chip"
+	depends on ARCH_MEDIATEK
+	help
+	  This adds ASoC platform driver support for Mediatek chip
+	  that can be used with other codecs.
+	  Select Y if you have such device.
+	  Ex: MT8173
+
sound/soc/mediatek/Makefile new file +2 -0
new file mode 100644
index 0000000..5f27cc7
@@ -0,0 +1,2 @@
+# MTK Platform Support
+obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
sound/soc/mediatek/mtk-afe-common.h new file +109 -0

109 lines not on this page · raw message

sound/soc/mediatek/mtk-afe-pcm.c new file +1233 -0

1,233 lines not on this page · raw message

Signature · 6 lines
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

Quoted 19 lines · Koro Chen
sound/soc/mediatek/Kconfig new file +8 -0
 
+config SND_SOC_MEDIATEK
+	bool "ASoC support for Mediatek chip"
+	depends on ARCH_MEDIATEK
+	help
+	  This adds ASoC platform driver support for Mediatek chip
+	  that can be used with other codecs.
+	  Select Y if you have such device.
+	  Ex: MT8173
sound/soc/mediatek/Makefile new file +1 -0
 
+obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o

sound/soc/mediatek/mtk-afe-pcm.c line 243

Quoted 9 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +7 -0
 
+#include <linux/module.h>
 
+static void mtk_afe_set_i2s_enable(struct mtk_afe *afe, bool enable)
+{
+	unsigned int val;
+
+	regmap_read(afe->regmap, AFE_I2S_CON2, &val);
+	if (!!(val & AFE_I2S_CON2_EN) == !!enable)

(What does negating a bool twice do?)

sound/soc/mediatek/mtk-afe-pcm.c line 250

Quoted 7 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +7 -0
+		return; /* must skip soft reset */
+
+	/* I2S soft reset begin */
+	regmap_update_bits(afe->regmap, AUDIO_TOP_CON1, 0x4, 0x4);
+
+	/* input */
+	regmap_update_bits(afe->regmap, AFE_I2S_CON2, 0x1, !!enable);

Ditto.

sound/soc/mediatek/mtk-afe-pcm.c line 253

Quoted 3 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +3 -0
+
+	/* output */
+	regmap_update_bits(afe->regmap, AFE_I2S_CON1, 0x1, !!enable);

Ditto.

Quoted 16 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +14 -0
+
+	/* I2S soft reset end */
+	udelay(1);
+	regmap_update_bits(afe->regmap, AUDIO_TOP_CON1, 0x4, 0);
+}
 
+static const struct of_device_id mtk_afe_pcm_dt_match[] = {
+	{ .compatible = "mediatek,mt8173-afe-pcm", },
+	{ }
+}; 
 
+static struct platform_driver mtk_afe_pcm_driver = {
+	.driver = {
+		   .name = "mtk-afe-pcm",
+		   .owner = THIS_MODULE,
+		   .of_match_table = mtk_afe_pcm_dt_match,

sound/soc/mediatek/mtk-afe-pcm.c line 1233

Quoted 10 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +9 -0
+		   .pm = &mtk_afe_pm_ops,
+	},
+	.probe = mtk_afe_pcm_dev_probe,
+	.remove = mtk_afe_pcm_dev_remove,
+};
 
+MODULE_DESCRIPTION("Mediatek ALSA SoC AFE platform driver");
+MODULE_AUTHOR("Koro Chen <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, mtk_afe_pcm_dt_match);

(The common pattern is to have MODULE_DEVICE_TABLE() directly follow that table.)

SND_SOC_MEDIATEK is a bool symbol and mtk-afe-pcm.o is built-in only. But the code uses a few module specific constructs. I spotted THIS_MODULE, MODULE_DESCRIPTION, MODULE_AUTHOR, MODULE_LICENSE, and MODULE_DEVICE_TABLE.

Is SND_SOC_MEDIATEK perhaps meant to be bool?

Likewise for SND_SOC_MT8173_MAX98090 (in 2/3) and
SND_SOC_MT8173_RT5650_RT5676 (in 3/3).

Thanks,

Paul Bolle

#3 lore raw

Re: [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

Quoted 1 line · Paul Bolle

Is SND_SOC_MEDIATEK perhaps meant to be bool?

s/bool/tristate/, of course.

Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#4 lore raw

Re: [alsa-devel] [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

In reply to Paul Bolle
Quoted 23 lines · Paul Bolle
Quoted 21 lines · Koro Chen
sound/soc/mediatek/Kconfig new file +8 -0
 
+config SND_SOC_MEDIATEK
+	bool "ASoC support for Mediatek chip"
+	depends on ARCH_MEDIATEK
+	help
+	  This adds ASoC platform driver support for Mediatek chip
+	  that can be used with other codecs.
+	  Select Y if you have such device.
+	  Ex: MT8173
sound/soc/mediatek/Makefile new file +1 -0
 
+obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
sound/soc/mediatek/mtk-afe-pcm.c new file +1 -0
 
+#include <linux/module.h>
Quoted 9 lines

sound/soc/mediatek/mtk-afe-pcm.c line 243

Quoted 6 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +6 -0
+static void mtk_afe_set_i2s_enable(struct mtk_afe *afe, bool enable)
+{
+	unsigned int val;
+
+	regmap_read(afe->regmap, AFE_I2S_CON2, &val);
+	if (!!(val & AFE_I2S_CON2_EN) == !!enable)

(What does negating a bool twice do?)

Because bool actually can be unsigned char, although actually in this driver, the caller always passes "true" or "false" to this function. Do you think if this is the case, should I still need to do !!?

Quoted 38 lines

sound/soc/mediatek/mtk-afe-pcm.c line 250

Quoted 7 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +7 -0
+		return; /* must skip soft reset */
+
+	/* I2S soft reset begin */
+	regmap_update_bits(afe->regmap, AUDIO_TOP_CON1, 0x4, 0x4);
+
+	/* input */
+	regmap_update_bits(afe->regmap, AFE_I2S_CON2, 0x1, !!enable);

Ditto.

sound/soc/mediatek/mtk-afe-pcm.c line 253

Quoted 3 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +3 -0
+
+	/* output */
+	regmap_update_bits(afe->regmap, AFE_I2S_CON1, 0x1, !!enable);

Ditto.

Quoted 21 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +19 -0
+
+	/* I2S soft reset end */
+	udelay(1);
+	regmap_update_bits(afe->regmap, AUDIO_TOP_CON1, 0x4, 0);
+}
 
+static const struct of_device_id mtk_afe_pcm_dt_match[] = {
+	{ .compatible = "mediatek,mt8173-afe-pcm", },
+	{ }
+}; 
 
+static struct platform_driver mtk_afe_pcm_driver = {
+	.driver = {
+		   .name = "mtk-afe-pcm",
+		   .owner = THIS_MODULE,
+		   .of_match_table = mtk_afe_pcm_dt_match,
+		   .pm = &mtk_afe_pm_ops,
+	},
+	.probe = mtk_afe_pcm_dev_probe,
+	.remove = mtk_afe_pcm_dev_remove,
+};
Quoted 8 lines

sound/soc/mediatek/mtk-afe-pcm.c line 1233

Quoted 4 lines
sound/soc/mediatek/mtk-afe-pcm.c new file +4 -0
+MODULE_DESCRIPTION("Mediatek ALSA SoC AFE platform driver");
+MODULE_AUTHOR("Koro Chen <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, mtk_afe_pcm_dt_match);

(The common pattern is to have MODULE_DEVICE_TABLE() directly follow that table.)

Thank you for mentioning this, I will fix it.

Quoted 10 lines

SND_SOC_MEDIATEK is a bool symbol and mtk-afe-pcm.o is built-in only. But the code uses a few module specific constructs. I spotted THIS_MODULE, MODULE_DESCRIPTION, MODULE_AUTHOR, MODULE_LICENSE, and MODULE_DEVICE_TABLE.

Is SND_SOC_MEDIATEK perhaps meant to be bool?

Likewise for SND_SOC_MT8173_MAX98090 (in 2/3) and
SND_SOC_MT8173_RT5650_RT5676 (in 3/3).

OK, yes, I think I should replace it by tristate, thank you!

Quoted 9 lines

Thanks,

Paul Bolle

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

Re: [alsa-devel] [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

Quoted 5 lines · Koro Chen
Quoted 2 lines · Paul Bolle

(What does negating a bool twice do?)

Because bool actually can be unsigned char, although actually in this driver, the caller always passes "true" or "false" to this function.

bool is _Bool in the kernel (see include/linux/types.h). So whenever you see a bool in the kernel you can assume it's either 0 or 1. Are there any cases where this conveniently simple rule doesn't hold?

But here the discussion is moot, because as you say, the function will only be passed false or true so we know "enable" is either 0 or 1 and double negating will do nothing.

Quoted 1 line

Do you think if this is the case, should I still need to do !!?

So you should not, as it's confusing at best.

Thanks,

Paul Bolle

author
#6 lore raw

Re: [alsa-devel] [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

Quoted 11 lines · Paul Bolle
Quoted 5 lines · Koro Chen
Quoted 2 lines · Paul Bolle

(What does negating a bool twice do?)

Because bool actually can be unsigned char, although actually in this driver, the caller always passes "true" or "false" to this function.

bool is _Bool in the kernel (see include/linux/types.h). So whenever you see a bool in the kernel you can assume it's either 0 or 1. Are there any cases where this conveniently simple rule doesn't hold?

Quoted 8 lines

But here the discussion is moot, because as you say, the function will only be passed false or true so we know "enable" is either 0 or 1 and double negating will do nothing.

Quoted 1 line

Do you think if this is the case, should I still need to do !!?

So you should not, as it's confusing at best.

OK, thank you. I will drop it in the next version of patch.

Quoted 5 lines

Thanks,

Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#7 lore raw

Re: [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

In reply to Koro Chen
Quoted 4 lines · Koro Chen

This is the DPCM based platform driver of AFE (Audio Front End) unit.

Your signoff should be last if you're the one sending the patch. Otherwise this seems basically fine, but you said you were going to send a new version so not applying.

author
#8 lore raw

Re: [PATCH 1/3] ASoC: mediatek: Add AFE platform driver

Quoted 9 lines · Mark Brown
Quoted 4 lines · Koro Chen

This is the DPCM based platform driver of AFE (Audio Front End) unit.

Your signoff should be last if you're the one sending the patch. Otherwise this seems basically fine, but you said you were going to send a new version so not applying.

Thank you, I will fix this in the next version of patch along with fixups of Paul's comments.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#9 lore raw

PATCH 2/3 ASoC: mediatek: Add machine driver for MAX98090 codec

In reply to Koro Chen

This is the DPCM based machine driver with MAX98090

---
 .../devicetree/bindings/sound/mt8173-max98090.txt  |  17 ++
 sound/soc/mediatek/Kconfig                         |  11 +
 sound/soc/mediatek/Makefile                        |   2 +
 sound/soc/mediatek/mt8173-max98090.c               | 260 +++++++++++++++++++++
 4 files changed, 290 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/mt8173-max98090.txt
 create mode 100644 sound/soc/mediatek/mt8173-max98090.c
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +17 -0
new file mode 100644
index 0000000..8d6b84c
@@ -0,0 +1,17 @@
+MT8173 with MAX98090 CODEC
+
+Required properties:
+- compatible : "mediatek,mt8173-max98090"
+- mediatek,audio-codec: the phandle of the MAX98090 audio codec
+- dvdd-supply : the phandle of regulator to supply 1.2V
+- avdd-supply : the phandle of regulator to supply 1.8V
+
+Example:
+
+	sound {
+		compatible = "mediatek,mt8173-max98090";
+		mediatek,audio-codec = <&max98090>;
+		dvdd-supply = <&mt6397_vgp1_reg>;
+		avdd-supply = <&mt6397_vgp4_reg>;
+	};
+
sound/soc/mediatek/Kconfig +11 -0
index 38630d4..6fb337e 100644
@@ -7,3 +7,14 @@ config SND_SOC_MEDIATEK
 	  Select Y if you have such device.
 	  Ex: MT8173
 
+config SND_SOC_MT8173_MAX98090
+	bool "ASoC Audio driver for MT8173 with MAX98090 codec"
+	depends on ARCH_MEDIATEK
+	select SND_SOC_MEDIATEK
+	select SND_SOC_MAX98090
+	help
+	  This adds ASoC driver for Mediatek MT8173 boards
+	  with the MAX98090 audio codec.
+	  Select Y if you have such device.
+	  If unsure select "N".
+
sound/soc/mediatek/Makefile +2 -0
index 5f27cc7..08fa765 100644
@@ -1,2 +1,4 @@
 # MTK Platform Support
 obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
+# Machine support
+obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
sound/soc/mediatek/mt8173-max98090.c new file +260 -0

260 lines not on this page · raw message

Signature · 1 line
1.8.1.1.dirty
maintainer
#10 lore raw

Re: [PATCH 2/3] ASoC: mediatek: Add machine driver for MAX98090 codec

Documentation/devicetree/bindings/sound/mt8173-max98090.txt line 7

Quoted 10 lines · Koro Chen
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +7 -0
@@ -0,0 +1,17 @@
+MT8173 with MAX98090 CODEC
+
+Required properties:
+- compatible : "mediatek,mt8173-max98090"
+- mediatek,audio-codec: the phandle of the MAX98090 audio codec
+- dvdd-supply : the phandle of regulator to supply 1.2V
+- avdd-supply : the phandle of regulator to supply 1.8V

Why are these supplies part of the machine driver?

Documentation/devicetree/bindings/sound/mt8173-max98090.txt line 9

Quoted 2 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +2 -0
+config SND_SOC_MT8173_MAX98090
+	bool "ASoC Audio driver for MT8173 with MAX98090 codec"

Why bool?

Documentation/devicetree/bindings/sound/mt8173-max98090.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +6 -0
+	codec_node = of_parse_phandle(pdev->dev.of_node,
+				      "mediatek,audio-codec", 0);
+	if (!codec_node) {
+		dev_err(&pdev->dev,
+			"Property 'audio-codec' missing or invalid\n");
+	} else {

Isn't this a fatal error?

Documentation/devicetree/bindings/sound/mt8173-max98090.txt

Quoted 11 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +11 -0
+	/* set codec DVDD voltage */
+	reg_dvdd = devm_regulator_get(&pdev->dev, "dvdd");
+	if (IS_ERR(reg_dvdd)) {
+		dev_err(&pdev->dev, "failed to get dvdd\n");
+		return PTR_ERR(reg_dvdd);
+	}
+	ret = regulator_set_voltage(reg_dvdd, 1220000, 1220000);
+	if (ret != 0) {
+		dev_err(&pdev->dev, "Failed to set dvdd: %d\n", ret);
+		return ret;
+	}

No, this is not appropriate for a machine driver - this is something the regulator constraints set for the board should do.

Documentation/devicetree/bindings/sound/mt8173-max98090.txt

Quoted 2 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +2 -0
+	dev_info(&pdev->dev, "dvdd = %d uv\n",
+		 regulator_get_voltage(reg_dvdd));

Don't include debugging stuff like this please.

Documentation/devicetree/bindings/sound/mt8173-max98090.txt

Quoted 5 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +5 -0
+	ret = regulator_enable(reg_dvdd);
+	if (ret != 0) {
+		dev_err(&pdev->dev, "Failed to enable dvdd: %d\n", ret);
+		return ret;
+	}

IF this is for the CODEC then you should add regulator support to the CODEC driver.

author
#11 lore raw

Re: [PATCH 2/3] ASoC: mediatek: Add machine driver for MAX98090 codec

Quoted 15 lines · Mark Brown

Documentation/devicetree/bindings/sound/mt8173-max98090.txt line 7

Quoted 10 lines · Koro Chen
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +7 -0
@@ -0,0 +1,17 @@
+MT8173 with MAX98090 CODEC
+
+Required properties:
+- compatible : "mediatek,mt8173-max98090"
+- mediatek,audio-codec: the phandle of the MAX98090 audio codec
+- dvdd-supply : the phandle of regulator to supply 1.2V
+- avdd-supply : the phandle of regulator to supply 1.8V

Why are these supplies part of the machine driver?

These are for the codec as you said. I think I should remove all these supplies as well as codes in machine drivers, since now the regulators are configured during the board's bootloader stage.

Quoted 5 lines

Documentation/devicetree/bindings/sound/mt8173-max98090.txt line 9

Quoted 2 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +2 -0
+config SND_SOC_MT8173_MAX98090
+	bool "ASoC Audio driver for MT8173 with MAX98090 codec"

Why bool?

This should be tristate as Paul mentioned before. I will fix it.

Quoted 9 lines

Documentation/devicetree/bindings/sound/mt8173-max98090.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/sound/mt8173-max98090.txt new file +6 -0
+	codec_node = of_parse_phandle(pdev->dev.of_node,
+				      "mediatek,audio-codec", 0);
+	if (!codec_node) {
+		dev_err(&pdev->dev,
+			"Property 'audio-codec' missing or invalid\n");
+	} else {

Isn't this a fatal error?

Thank you and yes it should be fatal, I will fix it.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#12 lore raw

PATCH 3/3 ASoC: mediatek: Add machine driver for rt5650 rt5676 codec

In reply to Koro Chen

This is the DPCM based machine driver with rt5650 and rt5676

---
 .../bindings/sound/mt8173-rt5650-rt5676.txt        |  15 ++
 sound/soc/mediatek/Kconfig                         |  12 +
 sound/soc/mediatek/Makefile                        |   1 +
 sound/soc/mediatek/mt8173-rt5650-rt5676.c          | 300 +++++++++++++++++++++
 4 files changed, 328 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt
 create mode 100644 sound/soc/mediatek/mt8173-rt5650-rt5676.c
Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt new file +15 -0
new file mode 100644
index 0000000..5fbdf39
@@ -0,0 +1,15 @@
+MT8173 with RT5650 RT5676 CODECS
+
+Required properties:
+- compatible : "mediatek,mt8173-rt5650-rt5676"
+- mediatek,audio-codec: the phandles of rt5650 and rt5676 codecs
+- avdd-supply : the phandle of regulator to supply 1.8V
+
+Example:
+
+	sound {
+		compatible = "mediatek,mt8173-rt5650-rt5676";
+		mediatek,audio-codec = <&rt5650 &rt5676>;
+		avdd-supply = <&mt6397_vgp1_reg>;
+	};
+
sound/soc/mediatek/Kconfig +12 -0
index 6fb337e..6f03e26 100644
@@ -18,3 +18,15 @@ config SND_SOC_MT8173_MAX98090
 	  Select Y if you have such device.
 	  If unsure select "N".
 
+config SND_SOC_MT8173_RT5650_RT5676
+	bool "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs"
+	depends on ARCH_MEDIATEK
+	select SND_SOC_MEDIATEK
+	select SND_SOC_RT5645
+	select SND_SOC_RT5677
+	help
+	  This adds ASoC driver for Mediatek MT8173 boards
+	  with the RT5650 and RT5676 codecs.
+	  Select Y if you have such device.
+	  If unsure select "N".
+
sound/soc/mediatek/Makefile +1 -0
index 08fa765..75effbe 100644
@@ -2,3 +2,4 @@
 obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
 # Machine support
 obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
+obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
sound/soc/mediatek/mt8173-rt5650-rt5676.c new file +300 -0

300 lines not on this page · raw message

Signature · 6 lines
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#13 lore raw

Re: [PATCH 3/3] ASoC: mediatek: Add machine driver for rt5650 rt5676 codec

Quoted 1 line · Koro Chen

This is the DPCM based machine driver with rt5650 and rt5676

Similar issues to the Maxim driver ehre.