Commit 94319ba1 authored by Koro Chen's avatar Koro Chen Committed by Mark Brown

ASoC: mediatek: Use platform_of_node for machine drivers

This replaces the platform_name in snd_soc_dai_link by device tree node.
Signed-off-by: default avatarKoro Chen <koro.chen@mediatek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4623a614
...@@ -3,11 +3,13 @@ MT8173 with MAX98090 CODEC ...@@ -3,11 +3,13 @@ MT8173 with MAX98090 CODEC
Required properties: Required properties:
- compatible : "mediatek,mt8173-max98090" - compatible : "mediatek,mt8173-max98090"
- mediatek,audio-codec: the phandle of the MAX98090 audio codec - mediatek,audio-codec: the phandle of the MAX98090 audio codec
- mediatek,platform: the phandle of MT8173 ASoC platform
Example: Example:
sound { sound {
compatible = "mediatek,mt8173-max98090"; compatible = "mediatek,mt8173-max98090";
mediatek,audio-codec = <&max98090>; mediatek,audio-codec = <&max98090>;
mediatek,platform = <&afe>;
}; };
...@@ -3,11 +3,13 @@ MT8173 with RT5650 RT5676 CODECS ...@@ -3,11 +3,13 @@ MT8173 with RT5650 RT5676 CODECS
Required properties: Required properties:
- compatible : "mediatek,mt8173-rt5650-rt5676" - compatible : "mediatek,mt8173-rt5650-rt5676"
- mediatek,audio-codec: the phandles of rt5650 and rt5676 codecs - mediatek,audio-codec: the phandles of rt5650 and rt5676 codecs
- mediatek,platform: the phandle of MT8173 ASoC platform
Example: Example:
sound { sound {
compatible = "mediatek,mt8173-rt5650-rt5676"; compatible = "mediatek,mt8173-rt5650-rt5676";
mediatek,audio-codec = <&rt5650 &rt5676>; mediatek,audio-codec = <&rt5650 &rt5676>;
mediatek,platform = <&afe>;
}; };
...@@ -103,7 +103,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = { ...@@ -103,7 +103,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
.name = "MAX98090 Playback", .name = "MAX98090 Playback",
.stream_name = "MAX98090 Playback", .stream_name = "MAX98090 Playback",
.cpu_dai_name = "DL1", .cpu_dai_name = "DL1",
.platform_name = "11220000.mt8173-afe-pcm",
.codec_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai", .codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
...@@ -114,7 +113,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = { ...@@ -114,7 +113,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
.name = "MAX98090 Capture", .name = "MAX98090 Capture",
.stream_name = "MAX98090 Capture", .stream_name = "MAX98090 Capture",
.cpu_dai_name = "VUL", .cpu_dai_name = "VUL",
.platform_name = "11220000.mt8173-afe-pcm",
.codec_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai", .codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
...@@ -125,7 +123,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = { ...@@ -125,7 +123,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
{ {
.name = "Codec", .name = "Codec",
.cpu_dai_name = "I2S", .cpu_dai_name = "I2S",
.platform_name = "11220000.mt8173-afe-pcm",
.no_pcm = 1, .no_pcm = 1,
.codec_dai_name = "HiFi", .codec_dai_name = "HiFi",
.init = mt8173_max98090_init, .init = mt8173_max98090_init,
...@@ -152,9 +149,21 @@ static struct snd_soc_card mt8173_max98090_card = { ...@@ -152,9 +149,21 @@ static struct snd_soc_card mt8173_max98090_card = {
static int mt8173_max98090_dev_probe(struct platform_device *pdev) static int mt8173_max98090_dev_probe(struct platform_device *pdev)
{ {
struct snd_soc_card *card = &mt8173_max98090_card; struct snd_soc_card *card = &mt8173_max98090_card;
struct device_node *codec_node; struct device_node *codec_node, *platform_node;
int ret, i; int ret, i;
platform_node = of_parse_phandle(pdev->dev.of_node,
"mediatek,platform", 0);
if (!platform_node) {
dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
return -EINVAL;
}
for (i = 0; i < card->num_links; i++) {
if (mt8173_max98090_dais[i].platform_name)
continue;
mt8173_max98090_dais[i].platform_of_node = platform_node;
}
codec_node = of_parse_phandle(pdev->dev.of_node, codec_node = of_parse_phandle(pdev->dev.of_node,
"mediatek,audio-codec", 0); "mediatek,audio-codec", 0);
if (!codec_node) { if (!codec_node) {
......
...@@ -138,7 +138,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = { ...@@ -138,7 +138,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
.name = "rt5650_rt5676 Playback", .name = "rt5650_rt5676 Playback",
.stream_name = "rt5650_rt5676 Playback", .stream_name = "rt5650_rt5676 Playback",
.cpu_dai_name = "DL1", .cpu_dai_name = "DL1",
.platform_name = "11220000.mt8173-afe-pcm",
.codec_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai", .codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
...@@ -149,7 +148,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = { ...@@ -149,7 +148,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
.name = "rt5650_rt5676 Capture", .name = "rt5650_rt5676 Capture",
.stream_name = "rt5650_rt5676 Capture", .stream_name = "rt5650_rt5676 Capture",
.cpu_dai_name = "VUL", .cpu_dai_name = "VUL",
.platform_name = "11220000.mt8173-afe-pcm",
.codec_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai", .codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
...@@ -161,7 +159,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = { ...@@ -161,7 +159,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
{ {
.name = "Codec", .name = "Codec",
.cpu_dai_name = "I2S", .cpu_dai_name = "I2S",
.platform_name = "11220000.mt8173-afe-pcm",
.no_pcm = 1, .no_pcm = 1,
.codecs = mt8173_rt5650_rt5676_codecs, .codecs = mt8173_rt5650_rt5676_codecs,
.num_codecs = 2, .num_codecs = 2,
...@@ -209,7 +206,21 @@ static struct snd_soc_card mt8173_rt5650_rt5676_card = { ...@@ -209,7 +206,21 @@ static struct snd_soc_card mt8173_rt5650_rt5676_card = {
static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
{ {
struct snd_soc_card *card = &mt8173_rt5650_rt5676_card; struct snd_soc_card *card = &mt8173_rt5650_rt5676_card;
int ret; struct device_node *platform_node;
int i, ret;
platform_node = of_parse_phandle(pdev->dev.of_node,
"mediatek,platform", 0);
if (!platform_node) {
dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
return -EINVAL;
}
for (i = 0; i < card->num_links; i++) {
if (mt8173_rt5650_rt5676_dais[i].platform_name)
continue;
mt8173_rt5650_rt5676_dais[i].platform_of_node = platform_node;
}
mt8173_rt5650_rt5676_codecs[0].of_node = mt8173_rt5650_rt5676_codecs[0].of_node =
of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0); of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment