X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sound%2Fsoc%2Fcodecs%2Fwm8753.c;h=b114c19f530ab89c30ea9daa24cc2a0eef143f85;hb=84b315ee893676e9a9ce8ac42ab5ef44e2af3ee1;hp=a9504710bb692e806655e785e5f35121ecf4afc1;hpb=f906fb1d70e016726fccfb0d978c5d425503db9d;p=deliverable%2Flinux.git diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index a9504710bb69..b114c19f530a 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -190,6 +189,9 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); u16 ioctl; + if (wm8753->dai_func == ucontrol->value.integer.value[0]) + return 0; + if (codec->active) return -EBUSY; @@ -483,7 +485,7 @@ SND_SOC_DAPM_INPUT("MIC2"), SND_SOC_DAPM_VMID("VREF"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8753_dapm_routes[] = { /* left mixer */ {"Left Mixer", "Left Playback Switch", "Left DAC"}, {"Left Mixer", "Voice Playback Switch", "Voice DAC"}, @@ -637,17 +639,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"ACOP", NULL, "ALC Mixer"}, }; -static int wm8753_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets, - ARRAY_SIZE(wm8753_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - /* PLL divisors */ struct _pll_div { u32 div2:1; @@ -1323,7 +1314,7 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec, * 3. Voice disabled - HIFI over HIFI * 4. Voice disabled - HIFI over HIFI, uses voice DAI LRC for capture */ -static struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { +static const struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { .hw_params = wm8753_i2s_hw_params, .digital_mute = wm8753_mute, .set_fmt = wm8753_hifi_set_dai_fmt, @@ -1332,7 +1323,7 @@ static struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { .set_sysclk = wm8753_set_dai_sysclk, }; -static struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = { +static const struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = { .hw_params = wm8753_pcm_hw_params, .digital_mute = wm8753_mute, .set_fmt = wm8753_voice_set_dai_fmt, @@ -1389,7 +1380,7 @@ static void wm8753_work(struct work_struct *work) wm8753_set_bias_level(codec, dapm->bias_level); } -static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8753_suspend(struct snd_soc_codec *codec) { wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; @@ -1464,10 +1455,6 @@ static int wm8753_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100); snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100); - snd_soc_add_controls(codec, wm8753_snd_controls, - ARRAY_SIZE(wm8753_snd_controls)); - wm8753_add_widgets(codec); - return 0; } @@ -1489,6 +1476,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8753 = { .reg_cache_size = ARRAY_SIZE(wm8753_reg), .reg_word_size = sizeof(u16), .reg_cache_default = wm8753_reg, + + .controls = wm8753_snd_controls, + .num_controls = ARRAY_SIZE(wm8753_snd_controls), + .dapm_widgets = wm8753_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8753_dapm_widgets), + .dapm_routes = wm8753_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8753_dapm_routes), }; static const struct of_device_id wm8753_of_match[] = {