Commit a2086325 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: wm5102: replace platform to component

Now platform can be replaced to component, let's do it.
This patch merges wm5102_compr_platform into soc_codec_dev_wm5102
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0a2b051b
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include "wm5102.h" #include "wm5102.h"
#include "wm_adsp.h" #include "wm_adsp.h"
#define DRV_NAME "wm5102-codec"
struct wm5102_priv { struct wm5102_priv {
struct arizona_priv core; struct arizona_priv core;
struct arizona_fll fll[2]; struct arizona_fll fll[2];
...@@ -1910,7 +1912,8 @@ static struct snd_soc_dai_driver wm5102_dai[] = { ...@@ -1910,7 +1912,8 @@ static struct snd_soc_dai_driver wm5102_dai[] = {
static int wm5102_open(struct snd_compr_stream *stream) static int wm5102_open(struct snd_compr_stream *stream)
{ {
struct snd_soc_pcm_runtime *rtd = stream->private_data; struct snd_soc_pcm_runtime *rtd = stream->private_data;
struct wm5102_priv *priv = snd_soc_platform_get_drvdata(rtd->platform); struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct wm5102_priv *priv = snd_soc_component_get_drvdata(component);
return wm_adsp_compr_open(&priv->core.adsp[0], stream); return wm_adsp_compr_open(&priv->core.adsp[0], stream);
} }
...@@ -1992,6 +1995,16 @@ static unsigned int wm5102_digital_vu[] = { ...@@ -1992,6 +1995,16 @@ static unsigned int wm5102_digital_vu[] = {
ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_DAC_DIGITAL_VOLUME_5R,
}; };
static struct snd_compr_ops wm5102_compr_ops = {
.open = wm5102_open,
.free = wm_adsp_compr_free,
.set_params = wm_adsp_compr_set_params,
.get_caps = wm_adsp_compr_get_caps,
.trigger = wm_adsp_compr_trigger,
.pointer = wm_adsp_compr_pointer,
.copy = wm_adsp_compr_copy,
};
static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
.probe = wm5102_codec_probe, .probe = wm5102_codec_probe,
.remove = wm5102_codec_remove, .remove = wm5102_codec_remove,
...@@ -2002,6 +2015,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { ...@@ -2002,6 +2015,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
.set_pll = wm5102_set_fll, .set_pll = wm5102_set_fll,
.component_driver = { .component_driver = {
.name = DRV_NAME,
.compr_ops = &wm5102_compr_ops,
.controls = wm5102_snd_controls, .controls = wm5102_snd_controls,
.num_controls = ARRAY_SIZE(wm5102_snd_controls), .num_controls = ARRAY_SIZE(wm5102_snd_controls),
.dapm_widgets = wm5102_dapm_widgets, .dapm_widgets = wm5102_dapm_widgets,
...@@ -2011,20 +2026,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { ...@@ -2011,20 +2026,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
}, },
}; };
static const struct snd_compr_ops wm5102_compr_ops = {
.open = wm5102_open,
.free = wm_adsp_compr_free,
.set_params = wm_adsp_compr_set_params,
.get_caps = wm_adsp_compr_get_caps,
.trigger = wm_adsp_compr_trigger,
.pointer = wm_adsp_compr_pointer,
.copy = wm_adsp_compr_copy,
};
static const struct snd_soc_platform_driver wm5102_compr_platform = {
.compr_ops = &wm5102_compr_ops,
};
static int wm5102_probe(struct platform_device *pdev) static int wm5102_probe(struct platform_device *pdev)
{ {
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
...@@ -2109,23 +2110,15 @@ static int wm5102_probe(struct platform_device *pdev) ...@@ -2109,23 +2110,15 @@ static int wm5102_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto err_dsp_irq; goto err_dsp_irq;
ret = snd_soc_register_platform(&pdev->dev, &wm5102_compr_platform);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
goto err_spk_irqs;
}
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102, ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102,
wm5102_dai, ARRAY_SIZE(wm5102_dai)); wm5102_dai, ARRAY_SIZE(wm5102_dai));
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
goto err_platform; goto err_spk_irqs;
} }
return ret; return ret;
err_platform:
snd_soc_unregister_platform(&pdev->dev);
err_spk_irqs: err_spk_irqs:
arizona_free_spk_irqs(arizona); arizona_free_spk_irqs(arizona);
err_dsp_irq: err_dsp_irq:
...@@ -2139,7 +2132,6 @@ static int wm5102_remove(struct platform_device *pdev) ...@@ -2139,7 +2132,6 @@ static int wm5102_remove(struct platform_device *pdev)
struct wm5102_priv *wm5102 = platform_get_drvdata(pdev); struct wm5102_priv *wm5102 = platform_get_drvdata(pdev);
struct arizona *arizona = wm5102->core.arizona; struct arizona *arizona = wm5102->core.arizona;
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_codec(&pdev->dev); snd_soc_unregister_codec(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
......
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