Commit 32a6c5ab authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/vc4_hdmi', 'asoc/topic/wl1273',...

Merge remote-tracking branches 'asoc/topic/vc4_hdmi', 'asoc/topic/wl1273', 'asoc/topic/wm0010', 'asoc/topic/wm1250-ev1' and 'asoc/topic/wm2000' into asoc-next
...@@ -995,15 +995,17 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = { ...@@ -995,15 +995,17 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = {
{ "TX", NULL, "Playback" }, { "TX", NULL, "Playback" },
}; };
static const struct snd_soc_codec_driver vc4_hdmi_audio_codec_drv = { static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = {
.component_driver = {
.controls = vc4_hdmi_audio_controls, .controls = vc4_hdmi_audio_controls,
.num_controls = ARRAY_SIZE(vc4_hdmi_audio_controls), .num_controls = ARRAY_SIZE(vc4_hdmi_audio_controls),
.dapm_widgets = vc4_hdmi_audio_widgets, .dapm_widgets = vc4_hdmi_audio_widgets,
.num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets), .num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets),
.dapm_routes = vc4_hdmi_audio_routes, .dapm_routes = vc4_hdmi_audio_routes,
.num_dapm_routes = ARRAY_SIZE(vc4_hdmi_audio_routes), .num_dapm_routes = ARRAY_SIZE(vc4_hdmi_audio_routes),
}, .idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct snd_soc_dai_ops vc4_hdmi_audio_dai_ops = { static const struct snd_soc_dai_ops vc4_hdmi_audio_dai_ops = {
...@@ -1101,11 +1103,11 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi) ...@@ -1101,11 +1103,11 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
return ret; return ret;
} }
/* register codec and codec dai */ /* register component and codec dai */
ret = snd_soc_register_codec(dev, &vc4_hdmi_audio_codec_drv, ret = devm_snd_soc_register_component(dev, &vc4_hdmi_audio_component_drv,
&vc4_hdmi_audio_codec_dai_drv, 1); &vc4_hdmi_audio_codec_dai_drv, 1);
if (ret) { if (ret) {
dev_err(dev, "Could not register codec: %d\n", ret); dev_err(dev, "Could not register component: %d\n", ret);
return ret; return ret;
} }
...@@ -1130,29 +1132,11 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi) ...@@ -1130,29 +1132,11 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
*/ */
snd_soc_card_set_drvdata(card, hdmi); snd_soc_card_set_drvdata(card, hdmi);
ret = devm_snd_soc_register_card(dev, card); ret = devm_snd_soc_register_card(dev, card);
if (ret) { if (ret)
dev_err(dev, "Could not register sound card: %d\n", ret); dev_err(dev, "Could not register sound card: %d\n", ret);
goto unregister_codec;
}
return 0;
unregister_codec:
snd_soc_unregister_codec(dev);
return ret; return ret;
}
static void vc4_hdmi_audio_cleanup(struct vc4_hdmi *hdmi)
{
struct device *dev = &hdmi->pdev->dev;
/*
* If drvdata is not set this means the audio card was not
* registered, just skip codec unregistration in this case.
*/
if (dev_get_drvdata(dev))
snd_soc_unregister_codec(dev);
} }
#ifdef CONFIG_DRM_VC4_HDMI_CEC #ifdef CONFIG_DRM_VC4_HDMI_CEC
...@@ -1480,7 +1464,6 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, ...@@ -1480,7 +1464,6 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
struct vc4_dev *vc4 = drm->dev_private; struct vc4_dev *vc4 = drm->dev_private;
struct vc4_hdmi *hdmi = vc4->hdmi; struct vc4_hdmi *hdmi = vc4->hdmi;
vc4_hdmi_audio_cleanup(hdmi);
cec_unregister_adapter(hdmi->cec_adap); cec_unregister_adapter(hdmi->cec_adap);
vc4_hdmi_connector_destroy(hdmi->connector); vc4_hdmi_connector_destroy(hdmi->connector);
vc4_hdmi_encoder_destroy(hdmi->encoder); vc4_hdmi_encoder_destroy(hdmi->encoder);
......
...@@ -172,8 +172,8 @@ static int snd_wl1273_fm_set_channel_number(struct wl1273_core *core, ...@@ -172,8 +172,8 @@ static int snd_wl1273_fm_set_channel_number(struct wl1273_core *core,
static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol, static int snd_wl1273_get_audio_route(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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] = wl1273->mode; ucontrol->value.enumerated.item[0] = wl1273->mode;
...@@ -190,14 +190,14 @@ static const char * const wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" }; ...@@ -190,14 +190,14 @@ static const char * const wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" };
static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol, static int snd_wl1273_set_audio_route(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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
if (wl1273->mode == ucontrol->value.enumerated.item[0]) if (wl1273->mode == ucontrol->value.enumerated.item[0])
return 0; return 0;
/* Do not allow changes while stream is running */ /* Do not allow changes while stream is running */
if (snd_soc_codec_is_active(codec)) if (snd_soc_component_is_active(component))
return -EPERM; return -EPERM;
if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route)) if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route))
...@@ -213,10 +213,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, wl1273_audio_route); ...@@ -213,10 +213,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, wl1273_audio_route);
static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, static int snd_wl1273_fm_audio_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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
dev_dbg(codec->dev, "%s: enter.\n", __func__); dev_dbg(component->dev, "%s: enter.\n", __func__);
ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode; ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode;
...@@ -226,11 +226,11 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, ...@@ -226,11 +226,11 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,
static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol, static int snd_wl1273_fm_audio_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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
int val, r = 0; int val, r = 0;
dev_dbg(codec->dev, "%s: enter.\n", __func__); dev_dbg(component->dev, "%s: enter.\n", __func__);
val = ucontrol->value.enumerated.item[0]; val = ucontrol->value.enumerated.item[0];
if (wl1273->core->audio_mode == val) if (wl1273->core->audio_mode == val)
...@@ -250,10 +250,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings); ...@@ -250,10 +250,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings);
static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, static int snd_wl1273_fm_volume_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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
dev_dbg(codec->dev, "%s: enter.\n", __func__); dev_dbg(component->dev, "%s: enter.\n", __func__);
ucontrol->value.integer.value[0] = wl1273->core->volume; ucontrol->value.integer.value[0] = wl1273->core->volume;
...@@ -263,11 +263,11 @@ static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, ...@@ -263,11 +263,11 @@ static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol,
static int snd_wl1273_fm_volume_put(struct snd_kcontrol *kcontrol, static int snd_wl1273_fm_volume_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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
int r; int r;
dev_dbg(codec->dev, "%s: enter.\n", __func__); dev_dbg(component->dev, "%s: enter.\n", __func__);
r = wl1273->core->set_volume(wl1273->core, r = wl1273->core->set_volume(wl1273->core,
ucontrol->value.integer.value[0]); ucontrol->value.integer.value[0]);
...@@ -301,8 +301,8 @@ static const struct snd_soc_dapm_route wl1273_dapm_routes[] = { ...@@ -301,8 +301,8 @@ static const struct snd_soc_dapm_route wl1273_dapm_routes[] = {
static int wl1273_startup(struct snd_pcm_substream *substream, static int wl1273_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 wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
switch (wl1273->mode) { switch (wl1273->mode) {
case WL1273_MODE_BT: case WL1273_MODE_BT:
...@@ -335,7 +335,7 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream, ...@@ -335,7 +335,7 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(dai->codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(dai->component);
struct wl1273_core *core = wl1273->core; struct wl1273_core *core = wl1273->core;
unsigned int rate, width, r; unsigned int rate, width, r;
...@@ -415,14 +415,14 @@ static struct snd_soc_dai_driver wl1273_dai = { ...@@ -415,14 +415,14 @@ static struct snd_soc_dai_driver wl1273_dai = {
}; };
/* Audio interface format for the soc_card driver */ /* Audio interface format for the soc_card driver */
int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt) int wl1273_get_format(struct snd_soc_component *component, unsigned int *fmt)
{ {
struct wl1273_priv *wl1273; struct wl1273_priv *wl1273;
if (codec == NULL || fmt == NULL) if (component == NULL || fmt == NULL)
return -EINVAL; return -EINVAL;
wl1273 = snd_soc_codec_get_drvdata(codec); wl1273 = snd_soc_component_get_drvdata(component);
switch (wl1273->mode) { switch (wl1273->mode) {
case WL1273_MODE_FM_RX: case WL1273_MODE_FM_RX:
...@@ -446,15 +446,15 @@ int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt) ...@@ -446,15 +446,15 @@ int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt)
} }
EXPORT_SYMBOL_GPL(wl1273_get_format); EXPORT_SYMBOL_GPL(wl1273_get_format);
static int wl1273_probe(struct snd_soc_codec *codec) static int wl1273_probe(struct snd_soc_component *component)
{ {
struct wl1273_core **core = codec->dev->platform_data; struct wl1273_core **core = component->dev->platform_data;
struct wl1273_priv *wl1273; struct wl1273_priv *wl1273;
dev_dbg(codec->dev, "%s.\n", __func__); dev_dbg(component->dev, "%s.\n", __func__);
if (!core) { if (!core) {
dev_err(codec->dev, "Platform data is missing.\n"); dev_err(component->dev, "Platform data is missing.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -465,44 +465,43 @@ static int wl1273_probe(struct snd_soc_codec *codec) ...@@ -465,44 +465,43 @@ static int wl1273_probe(struct snd_soc_codec *codec)
wl1273->mode = WL1273_MODE_BT; wl1273->mode = WL1273_MODE_BT;
wl1273->core = *core; wl1273->core = *core;
snd_soc_codec_set_drvdata(codec, wl1273); snd_soc_component_set_drvdata(component, wl1273);
return 0; return 0;
} }
static int wl1273_remove(struct snd_soc_codec *codec) static void wl1273_remove(struct snd_soc_component *component)
{ {
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
dev_dbg(codec->dev, "%s\n", __func__); dev_dbg(component->dev, "%s\n", __func__);
kfree(wl1273); kfree(wl1273);
return 0;
} }
static const struct snd_soc_codec_driver soc_codec_dev_wl1273 = { static const struct snd_soc_component_driver soc_component_dev_wl1273 = {
.probe = wl1273_probe, .probe = wl1273_probe,
.remove = wl1273_remove, .remove = wl1273_remove,
.component_driver = {
.controls = wl1273_controls, .controls = wl1273_controls,
.num_controls = ARRAY_SIZE(wl1273_controls), .num_controls = ARRAY_SIZE(wl1273_controls),
.dapm_widgets = wl1273_dapm_widgets, .dapm_widgets = wl1273_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wl1273_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(wl1273_dapm_widgets),
.dapm_routes = wl1273_dapm_routes, .dapm_routes = wl1273_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wl1273_dapm_routes), .num_dapm_routes = ARRAY_SIZE(wl1273_dapm_routes),
}, .idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int wl1273_platform_probe(struct platform_device *pdev) static int wl1273_platform_probe(struct platform_device *pdev)
{ {
return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wl1273, return devm_snd_soc_register_component(&pdev->dev,
&soc_component_dev_wl1273,
&wl1273_dai, 1); &wl1273_dai, 1);
} }
static int wl1273_platform_remove(struct platform_device *pdev) static int wl1273_platform_remove(struct platform_device *pdev)
{ {
snd_soc_unregister_codec(&pdev->dev);
return 0; return 0;
} }
......
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
#ifndef __WL1273_CODEC_H__ #ifndef __WL1273_CODEC_H__
#define __WL1273_CODEC_H__ #define __WL1273_CODEC_H__
int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt); int wl1273_get_format(struct snd_soc_component *component, unsigned int *fmt);
#endif /* End of __WL1273_CODEC_H__ */ #endif /* End of __WL1273_CODEC_H__ */
This diff is collapsed.
...@@ -32,10 +32,10 @@ struct wm1250_priv { ...@@ -32,10 +32,10 @@ struct wm1250_priv {
struct gpio gpios[WM1250_EV1_NUM_GPIOS]; struct gpio gpios[WM1250_EV1_NUM_GPIOS];
}; };
static int wm1250_ev1_set_bias_level(struct snd_soc_codec *codec, static int wm1250_ev1_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct wm1250_priv *wm1250 = dev_get_drvdata(codec->dev); struct wm1250_priv *wm1250 = dev_get_drvdata(component->dev);
int ena; int ena;
if (wm1250) if (wm1250)
...@@ -81,7 +81,7 @@ static int wm1250_ev1_hw_params(struct snd_pcm_substream *substream, ...@@ -81,7 +81,7 @@ static int wm1250_ev1_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct wm1250_priv *wm1250 = snd_soc_codec_get_drvdata(dai->codec); struct wm1250_priv *wm1250 = snd_soc_component_get_drvdata(dai->component);
switch (params_rate(params)) { switch (params_rate(params)) {
case 8000: case 8000:
...@@ -141,15 +141,15 @@ static struct snd_soc_dai_driver wm1250_ev1_dai = { ...@@ -141,15 +141,15 @@ static struct snd_soc_dai_driver wm1250_ev1_dai = {
.ops = &wm1250_ev1_ops, .ops = &wm1250_ev1_ops,
}; };
static const struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = { static const struct snd_soc_component_driver soc_component_dev_wm1250_ev1 = {
.component_driver = {
.dapm_widgets = wm1250_ev1_dapm_widgets, .dapm_widgets = wm1250_ev1_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm1250_ev1_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(wm1250_ev1_dapm_widgets),
.dapm_routes = wm1250_ev1_dapm_routes, .dapm_routes = wm1250_ev1_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm1250_ev1_dapm_routes), .num_dapm_routes = ARRAY_SIZE(wm1250_ev1_dapm_routes),
},
.set_bias_level = wm1250_ev1_set_bias_level, .set_bias_level = wm1250_ev1_set_bias_level,
.idle_bias_off = true, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int wm1250_ev1_pdata(struct i2c_client *i2c) static int wm1250_ev1_pdata(struct i2c_client *i2c)
...@@ -224,7 +224,7 @@ static int wm1250_ev1_probe(struct i2c_client *i2c, ...@@ -224,7 +224,7 @@ static int wm1250_ev1_probe(struct i2c_client *i2c,
if (ret != 0) if (ret != 0)
return ret; return ret;
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm1250_ev1, ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_wm1250_ev1,
&wm1250_ev1_dai, 1); &wm1250_ev1_dai, 1);
if (ret != 0) { if (ret != 0) {
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
...@@ -237,7 +237,6 @@ static int wm1250_ev1_probe(struct i2c_client *i2c, ...@@ -237,7 +237,6 @@ static int wm1250_ev1_probe(struct i2c_client *i2c,
static int wm1250_ev1_remove(struct i2c_client *i2c) static int wm1250_ev1_remove(struct i2c_client *i2c)
{ {
snd_soc_unregister_codec(&i2c->dev);
wm1250_ev1_free(i2c); wm1250_ev1_free(i2c);
return 0; return 0;
......
...@@ -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,
.component_driver = {
.controls = wm2000_controls, .controls = wm2000_controls,
.num_controls = ARRAY_SIZE(wm2000_controls), .num_controls = ARRAY_SIZE(wm2000_controls),
.dapm_widgets = wm2000_dapm_widgets, .dapm_widgets = wm2000_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets),
.dapm_routes = wm2000_audio_map, .dapm_routes = wm2000_audio_map,
.num_dapm_routes = ARRAY_SIZE(wm2000_audio_map), .num_dapm_routes = ARRAY_SIZE(wm2000_audio_map),
}, .idle_bias_on = 1,
.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