Commit 0f10adb0 authored by Maso Huang's avatar Maso Huang Committed by Mark Brown

ASoC: mediatek: mt7986: remove the mt7986_wm8960_priv structure

Remove the mt7986_wm8960_priv structure.
Signed-off-by: default avatarMaso Huang <maso.huang@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20231024035019.11732-3-maso.huang@mediatek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3e92ea2a
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
#include "mt7986-afe-common.h" #include "mt7986-afe-common.h"
struct mt7986_wm8960_priv {
struct device_node *platform_node;
struct device_node *codec_node;
};
static const struct snd_soc_dapm_widget mt7986_wm8960_widgets[] = { static const struct snd_soc_dapm_widget mt7986_wm8960_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("AMIC", NULL), SND_SOC_DAPM_MIC("AMIC", NULL),
...@@ -92,20 +87,18 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) ...@@ -92,20 +87,18 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
struct snd_soc_card *card = &mt7986_wm8960_card; struct snd_soc_card *card = &mt7986_wm8960_card;
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
struct device_node *platform, *codec; struct device_node *platform, *codec;
struct mt7986_wm8960_priv *priv; struct device_node *platform_dai_node, *codec_dai_node;
int ret, i; int ret, i;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); card->dev = &pdev->dev;
if (!priv)
return -ENOMEM;
platform = of_get_child_by_name(pdev->dev.of_node, "platform"); platform = of_get_child_by_name(pdev->dev.of_node, "platform");
if (platform) { if (platform) {
priv->platform_node = of_parse_phandle(platform, "sound-dai", 0); platform_dai_node = of_parse_phandle(platform, "sound-dai", 0);
of_node_put(platform); of_node_put(platform);
if (!priv->platform_node) { if (!platform_dai_node) {
dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n"); dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n");
return -EINVAL; return -EINVAL;
} }
...@@ -117,24 +110,22 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) ...@@ -117,24 +110,22 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
for_each_card_prelinks(card, i, dai_link) { for_each_card_prelinks(card, i, dai_link) {
if (dai_link->platforms->name) if (dai_link->platforms->name)
continue; continue;
dai_link->platforms->of_node = priv->platform_node; dai_link->platforms->of_node = platform_dai_node;
} }
card->dev = &pdev->dev;
codec = of_get_child_by_name(pdev->dev.of_node, "codec"); codec = of_get_child_by_name(pdev->dev.of_node, "codec");
if (codec) { if (codec) {
priv->codec_node = of_parse_phandle(codec, "sound-dai", 0); codec_dai_node = of_parse_phandle(codec, "sound-dai", 0);
of_node_put(codec); of_node_put(codec);
if (!priv->codec_node) { if (!codec_dai_node) {
of_node_put(priv->platform_node); of_node_put(platform_dai_node);
dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n"); dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n");
return -EINVAL; return -EINVAL;
} }
} else { } else {
of_node_put(priv->platform_node); of_node_put(platform_dai_node);
dev_err(&pdev->dev, "Property 'codec' missing or invalid\n"); dev_err(&pdev->dev, "Property 'codec' missing or invalid\n");
return -EINVAL; return -EINVAL;
} }
...@@ -142,7 +133,7 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) ...@@ -142,7 +133,7 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
for_each_card_prelinks(card, i, dai_link) { for_each_card_prelinks(card, i, dai_link) {
if (dai_link->codecs->name) if (dai_link->codecs->name)
continue; continue;
dai_link->codecs->of_node = priv->codec_node; dai_link->codecs->of_node = codec_dai_node;
} }
ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
...@@ -158,8 +149,8 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) ...@@ -158,8 +149,8 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
} }
err_of_node_put: err_of_node_put:
of_node_put(priv->codec_node); of_node_put(platform_dai_node);
of_node_put(priv->platform_node); of_node_put(codec_dai_node);
return ret; return ret;
} }
......
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