X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sound%2Fsoc%2Fcodecs%2Fwm8350.c;h=8c4c9591ec055103eb1cf3381ae3e3d969abac85;hb=e6c94e9f6dd77c928419dc05af2b3d17ed9463b9;hp=3f1ed5f5ccf4208a147606f60bb9b66e0ac42c41;hpb=1db7c89c62b3c0a0ebf8c07975ae907fa404116a;p=deliverable%2Flinux.git diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 3f1ed5f5ccf4..8c4c9591ec05 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -696,7 +696,7 @@ static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = { SND_SOC_DAPM_INPUT("IN3L"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8350_dapm_routes[] = { /* left playback mixer */ {"Left Playback Mixer", "Playback Switch", "Left DAC"}, @@ -777,29 +777,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Beep", NULL, "IN3R PGA"}, }; -static int wm8350_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; - - ret = snd_soc_dapm_new_controls(dapm, - wm8350_dapm_widgets, - ARRAY_SIZE(wm8350_dapm_widgets)); - if (ret != 0) { - dev_err(codec->dev, "dapm control register failed\n"); - return ret; - } - - /* set up audio paths */ - ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - if (ret != 0) { - dev_err(codec->dev, "DAPM route register failed\n"); - return ret; - } - - return 0; -} - static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { @@ -1315,7 +1292,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm8350_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8350_suspend(struct snd_soc_codec *codec) { wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; @@ -1553,7 +1530,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) return -EINVAL; } - priv = kzalloc(sizeof(struct wm8350_data), GFP_KERNEL); + priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data), + GFP_KERNEL); if (priv == NULL) return -ENOMEM; snd_soc_codec_set_drvdata(codec, priv); @@ -1564,7 +1542,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) ret = regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies), priv->supplies); if (ret != 0) - goto err_priv; + return ret; wm8350->codec.codec = codec; codec->control_data = wm8350; @@ -1633,17 +1611,9 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) wm8350_mic_handler, 0, "Microphone detect", priv); - snd_soc_add_controls(codec, wm8350_snd_controls, - ARRAY_SIZE(wm8350_snd_controls)); - wm8350_add_widgets(codec); - wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; - -err_priv: - kfree(priv); - return ret; } static int wm8350_codec_remove(struct snd_soc_codec *codec) @@ -1676,7 +1646,7 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec) wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies); - kfree(priv); + return 0; } @@ -1688,6 +1658,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8350 = { .read = wm8350_codec_read, .write = wm8350_codec_write, .set_bias_level = wm8350_set_bias_level, + + .controls = wm8350_snd_controls, + .num_controls = ARRAY_SIZE(wm8350_snd_controls), + .dapm_widgets = wm8350_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), + .dapm_routes = wm8350_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), }; static int __devinit wm8350_probe(struct platform_device *pdev)