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

ASoC: wm2000: 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
...@@ -607,8 +607,8 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000) ...@@ -607,8 +607,8 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)
static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
ucontrol->value.integer.value[0] = wm2000->anc_active; ucontrol->value.integer.value[0] = wm2000->anc_active;
...@@ -618,8 +618,8 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, ...@@ -618,8 +618,8 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
unsigned int anc_active = ucontrol->value.integer.value[0]; unsigned int anc_active = ucontrol->value.integer.value[0];
int ret; int ret;
...@@ -640,8 +640,8 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, ...@@ -640,8 +640,8 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
ucontrol->value.integer.value[0] = wm2000->spk_ena; ucontrol->value.integer.value[0] = wm2000->spk_ena;
...@@ -651,8 +651,8 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, ...@@ -651,8 +651,8 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, static int wm2000_speaker_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
unsigned int val = ucontrol->value.integer.value[0]; unsigned int val = ucontrol->value.integer.value[0];
int ret; int ret;
...@@ -683,8 +683,8 @@ static const struct snd_kcontrol_new wm2000_controls[] = { ...@@ -683,8 +683,8 @@ static const struct snd_kcontrol_new wm2000_controls[] = {
static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
int ret; int ret;
mutex_lock(&wm2000->lock); mutex_lock(&wm2000->lock);
...@@ -724,16 +724,16 @@ static const struct snd_soc_dapm_route wm2000_audio_map[] = { ...@@ -724,16 +724,16 @@ static const struct snd_soc_dapm_route wm2000_audio_map[] = {
}; };
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int wm2000_suspend(struct snd_soc_codec *codec) static int wm2000_suspend(struct snd_soc_component *component)
{ {
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
return wm2000_anc_transition(wm2000, ANC_OFF); return wm2000_anc_transition(wm2000, ANC_OFF);
} }
static int wm2000_resume(struct snd_soc_codec *codec) static int wm2000_resume(struct snd_soc_component *component)
{ {
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
return wm2000_anc_set_mode(wm2000); return wm2000_anc_set_mode(wm2000);
} }
...@@ -782,9 +782,9 @@ static const struct regmap_config wm2000_regmap = { ...@@ -782,9 +782,9 @@ static const struct regmap_config wm2000_regmap = {
.readable_reg = wm2000_readable_reg, .readable_reg = wm2000_readable_reg,
}; };
static int wm2000_probe(struct snd_soc_codec *codec) static int wm2000_probe(struct snd_soc_component *component)
{ {
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
/* This will trigger a transition to standby mode by default */ /* This will trigger a transition to standby mode by default */
wm2000_anc_set_mode(wm2000); wm2000_anc_set_mode(wm2000);
...@@ -792,27 +792,28 @@ static int wm2000_probe(struct snd_soc_codec *codec) ...@@ -792,27 +792,28 @@ static int wm2000_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int wm2000_remove(struct snd_soc_codec *codec) static void wm2000_remove(struct snd_soc_component *component)
{ {
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
return wm2000_anc_transition(wm2000, ANC_OFF); wm2000_anc_transition(wm2000, ANC_OFF);
} }
static const struct snd_soc_codec_driver soc_codec_dev_wm2000 = { static const struct snd_soc_component_driver soc_component_dev_wm2000 = {
.probe = wm2000_probe, .probe = wm2000_probe,
.remove = wm2000_remove, .remove = wm2000_remove,
.suspend = wm2000_suspend, .suspend = wm2000_suspend,
.resume = wm2000_resume, .resume = wm2000_resume,
.controls = wm2000_controls,
.component_driver = { .num_controls = ARRAY_SIZE(wm2000_controls),
.controls = wm2000_controls, .dapm_widgets = wm2000_dapm_widgets,
.num_controls = ARRAY_SIZE(wm2000_controls), .num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets),
.dapm_widgets = wm2000_dapm_widgets, .dapm_routes = wm2000_audio_map,
.num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets), .num_dapm_routes = ARRAY_SIZE(wm2000_audio_map),
.dapm_routes = wm2000_audio_map, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(wm2000_audio_map), .use_pmdown_time = 1,
}, .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int wm2000_i2c_probe(struct i2c_client *i2c, static int wm2000_i2c_probe(struct i2c_client *i2c,
...@@ -916,7 +917,8 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, ...@@ -916,7 +917,8 @@ static int wm2000_i2c_probe(struct i2c_client *i2c,
wm2000_reset(wm2000); wm2000_reset(wm2000);
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0); ret = devm_snd_soc_register_component(&i2c->dev,
&soc_component_dev_wm2000, NULL, 0);
err_supplies: err_supplies:
regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies); regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies);
...@@ -926,13 +928,6 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, ...@@ -926,13 +928,6 @@ static int wm2000_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
static int wm2000_i2c_remove(struct i2c_client *i2c)
{
snd_soc_unregister_codec(&i2c->dev);
return 0;
}
static const struct i2c_device_id wm2000_i2c_id[] = { static const struct i2c_device_id wm2000_i2c_id[] = {
{ "wm2000", 0 }, { "wm2000", 0 },
{ } { }
...@@ -944,7 +939,6 @@ static struct i2c_driver wm2000_i2c_driver = { ...@@ -944,7 +939,6 @@ static struct i2c_driver wm2000_i2c_driver = {
.name = "wm2000", .name = "wm2000",
}, },
.probe = wm2000_i2c_probe, .probe = wm2000_i2c_probe,
.remove = wm2000_i2c_remove,
.id_table = wm2000_i2c_id, .id_table = wm2000_i2c_id,
}; };
......
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