Commit 3b60cf10 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: wm8524: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
	xxx_codec_xxx()		->	xxx_component_xxx()
	.idle_bias_off = 0	->	.idle_bias_on = 1
	.ignore_pmdown_time = 0	->	.use_pmdown_time = 1
	-			->	.endianness = 1
	-			->	.non_legacy_dai_naming = 1
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7928b2cb
...@@ -62,14 +62,14 @@ static const struct { ...@@ -62,14 +62,14 @@ static const struct {
static int wm8524_startup(struct snd_pcm_substream *substream, static int wm8524_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec); struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
/* The set of sample rates that can be supported depends on the /* The set of sample rates that can be supported depends on the
* MCLK supplied to the CODEC - enforce this. * MCLK supplied to the CODEC - enforce this.
*/ */
if (!wm8524->sysclk) { if (!wm8524->sysclk) {
dev_err(codec->dev, dev_err(component->dev,
"No MCLK configured, call set_sysclk() on init\n"); "No MCLK configured, call set_sysclk() on init\n");
return -EINVAL; return -EINVAL;
} }
...@@ -86,8 +86,8 @@ static int wm8524_startup(struct snd_pcm_substream *substream, ...@@ -86,8 +86,8 @@ static int wm8524_startup(struct snd_pcm_substream *substream,
static void wm8524_shutdown(struct snd_pcm_substream *substream, static void wm8524_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec); struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
gpiod_set_value_cansleep(wm8524->mute, 0); gpiod_set_value_cansleep(wm8524->mute, 0);
} }
...@@ -95,8 +95,8 @@ static void wm8524_shutdown(struct snd_pcm_substream *substream, ...@@ -95,8 +95,8 @@ static void wm8524_shutdown(struct snd_pcm_substream *substream,
static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec); struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
unsigned int val; unsigned int val;
int i, j = 0; int i, j = 0;
...@@ -118,13 +118,13 @@ static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -118,13 +118,13 @@ static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,
case 96000: case 96000:
case 176400: case 176400:
case 192000: case 192000:
dev_dbg(codec->dev, "Supported sample rate: %dHz\n", dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val); val);
wm8524->rate_constraint_list[j++] = val; wm8524->rate_constraint_list[j++] = val;
wm8524->rate_constraint.count++; wm8524->rate_constraint.count++;
break; break;
default: default:
dev_dbg(codec->dev, "Skipping sample rate: %dHz\n", dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val); val);
} }
} }
...@@ -152,7 +152,7 @@ static int wm8524_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -152,7 +152,7 @@ static int wm8524_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
static int wm8524_mute_stream(struct snd_soc_dai *dai, int mute, int stream) static int wm8524_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{ {
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(dai->codec); struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(dai->component);
if (wm8524->mute) if (wm8524->mute)
gpiod_set_value_cansleep(wm8524->mute, mute); gpiod_set_value_cansleep(wm8524->mute, mute);
...@@ -184,9 +184,9 @@ static struct snd_soc_dai_driver wm8524_dai = { ...@@ -184,9 +184,9 @@ static struct snd_soc_dai_driver wm8524_dai = {
.ops = &wm8524_dai_ops, .ops = &wm8524_dai_ops,
}; };
static int wm8524_probe(struct snd_soc_codec *codec) static int wm8524_probe(struct snd_soc_component *component)
{ {
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec); struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
wm8524->rate_constraint.list = &wm8524->rate_constraint_list[0]; wm8524->rate_constraint.list = &wm8524->rate_constraint_list[0];
wm8524->rate_constraint.count = wm8524->rate_constraint.count =
...@@ -195,15 +195,16 @@ static int wm8524_probe(struct snd_soc_codec *codec) ...@@ -195,15 +195,16 @@ static int wm8524_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static const struct snd_soc_codec_driver soc_codec_dev_wm8524 = { static const struct snd_soc_component_driver soc_component_dev_wm8524 = {
.probe = wm8524_probe, .probe = wm8524_probe,
.dapm_widgets = wm8524_dapm_widgets,
.component_driver = { .num_dapm_widgets = ARRAY_SIZE(wm8524_dapm_widgets),
.dapm_widgets = wm8524_dapm_widgets, .dapm_routes = wm8524_dapm_routes,
.num_dapm_widgets = ARRAY_SIZE(wm8524_dapm_widgets), .num_dapm_routes = ARRAY_SIZE(wm8524_dapm_routes),
.dapm_routes = wm8524_dapm_routes, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(wm8524_dapm_routes), .use_pmdown_time = 1,
}, .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct of_device_id wm8524_of_match[] = { static const struct of_device_id wm8524_of_match[] = {
...@@ -231,23 +232,16 @@ static int wm8524_codec_probe(struct platform_device *pdev) ...@@ -231,23 +232,16 @@ static int wm8524_codec_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = snd_soc_register_codec(&pdev->dev, ret = devm_snd_soc_register_component(&pdev->dev,
&soc_codec_dev_wm8524, &wm8524_dai, 1); &soc_component_dev_wm8524, &wm8524_dai, 1);
if (ret < 0) if (ret < 0)
dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
return ret; return ret;
} }
static int wm8524_codec_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
static struct platform_driver wm8524_codec_driver = { static struct platform_driver wm8524_codec_driver = {
.probe = wm8524_codec_probe, .probe = wm8524_codec_probe,
.remove = wm8524_codec_remove,
.driver = { .driver = {
.name = "wm8524-codec", .name = "wm8524-codec",
.of_match_table = wm8524_of_match, .of_match_table = wm8524_of_match,
......
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