aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8523.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8523.c')
-rw-r--r--sound/soc/codecs/wm8523.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 712ef7c76f90..5eb2f501ce32 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -24,7 +24,6 @@
24#include <sound/pcm.h> 24#include <sound/pcm.h>
25#include <sound/pcm_params.h> 25#include <sound/pcm_params.h>
26#include <sound/soc.h> 26#include <sound/soc.h>
27#include <sound/soc-dapm.h>
28#include <sound/initval.h> 27#include <sound/initval.h>
29#include <sound/tlv.h> 28#include <sound/tlv.h>
30 29
@@ -41,7 +40,6 @@ static const char *wm8523_supply_names[WM8523_NUM_SUPPLIES] = {
41/* codec private data */ 40/* codec private data */
42struct wm8523_priv { 41struct wm8523_priv {
43 enum snd_soc_control_type control_type; 42 enum snd_soc_control_type control_type;
44 u16 reg_cache[WM8523_REGISTER_COUNT];
45 struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES]; 43 struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES];
46 unsigned int sysclk; 44 unsigned int sysclk;
47 unsigned int rate_constraint_list[WM8523_NUM_RATES]; 45 unsigned int rate_constraint_list[WM8523_NUM_RATES];
@@ -110,10 +108,11 @@ static const struct snd_soc_dapm_route intercon[] = {
110 108
111static int wm8523_add_widgets(struct snd_soc_codec *codec) 109static int wm8523_add_widgets(struct snd_soc_codec *codec)
112{ 110{
113 snd_soc_dapm_new_controls(codec, wm8523_dapm_widgets, 111 struct snd_soc_dapm_context *dapm = &codec->dapm;
114 ARRAY_SIZE(wm8523_dapm_widgets));
115 112
116 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 113 snd_soc_dapm_new_controls(dapm, wm8523_dapm_widgets,
114 ARRAY_SIZE(wm8523_dapm_widgets));
115 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
117 116
118 return 0; 117 return 0;
119} 118}
@@ -146,7 +145,6 @@ static int wm8523_startup(struct snd_pcm_substream *substream,
146 return -EINVAL; 145 return -EINVAL;
147 } 146 }
148 147
149 return 0;
150 snd_pcm_hw_constraint_list(substream->runtime, 0, 148 snd_pcm_hw_constraint_list(substream->runtime, 0,
151 SNDRV_PCM_HW_PARAM_RATE, 149 SNDRV_PCM_HW_PARAM_RATE,
152 &wm8523->rate_constraint); 150 &wm8523->rate_constraint);
@@ -315,6 +313,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
315 enum snd_soc_bias_level level) 313 enum snd_soc_bias_level level)
316{ 314{
317 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); 315 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
316 u16 *reg_cache = codec->reg_cache;
318 int ret, i; 317 int ret, i;
319 318
320 switch (level) { 319 switch (level) {
@@ -328,7 +327,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
328 break; 327 break;
329 328
330 case SND_SOC_BIAS_STANDBY: 329 case SND_SOC_BIAS_STANDBY:
331 if (codec->bias_level == SND_SOC_BIAS_OFF) { 330 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
332 ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), 331 ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies),
333 wm8523->supplies); 332 wm8523->supplies);
334 if (ret != 0) { 333 if (ret != 0) {
@@ -345,7 +344,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
345 /* Sync back default/cached values */ 344 /* Sync back default/cached values */
346 for (i = WM8523_AIF_CTRL1; 345 for (i = WM8523_AIF_CTRL1;
347 i < WM8523_MAX_REGISTER; i++) 346 i < WM8523_MAX_REGISTER; i++)
348 snd_soc_write(codec, i, wm8523->reg_cache[i]); 347 snd_soc_write(codec, i, reg_cache[i]);
349 348
350 349
351 msleep(100); 350 msleep(100);
@@ -367,7 +366,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
367 wm8523->supplies); 366 wm8523->supplies);
368 break; 367 break;
369 } 368 }
370 codec->bias_level = level; 369 codec->dapm.bias_level = level;
371 return 0; 370 return 0;
372} 371}
373 372
@@ -415,6 +414,7 @@ static int wm8523_resume(struct snd_soc_codec *codec)
415static int wm8523_probe(struct snd_soc_codec *codec) 414static int wm8523_probe(struct snd_soc_codec *codec)
416{ 415{
417 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); 416 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
417 u16 *reg_cache = codec->reg_cache;
418 int ret, i; 418 int ret, i;
419 419
420 codec->hw_write = (hw_write_t)i2c_master_send; 420 codec->hw_write = (hw_write_t)i2c_master_send;
@@ -471,8 +471,8 @@ static int wm8523_probe(struct snd_soc_codec *codec)
471 } 471 }
472 472
473 /* Change some default settings - latch VU and enable ZC */ 473 /* Change some default settings - latch VU and enable ZC */
474 wm8523->reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; 474 reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU;
475 wm8523->reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; 475 reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC;
476 476
477 wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 477 wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
478 478