diff options
Diffstat (limited to 'sound/soc/codecs/wm8523.c')
-rw-r--r-- | sound/soc/codecs/wm8523.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 9a433a5396cb..4fd4d8dca0fc 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 */ |
42 | struct wm8523_priv { | 41 | struct 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]; |
@@ -60,7 +58,7 @@ static const u16 wm8523_reg[WM8523_REGISTER_COUNT] = { | |||
60 | 0x0000, /* R8 - ZERO_DETECT */ | 58 | 0x0000, /* R8 - ZERO_DETECT */ |
61 | }; | 59 | }; |
62 | 60 | ||
63 | static int wm8523_volatile_register(unsigned int reg) | 61 | static int wm8523_volatile_register(struct snd_soc_codec *codec, unsigned int reg) |
64 | { | 62 | { |
65 | switch (reg) { | 63 | switch (reg) { |
66 | case WM8523_DEVICE_ID: | 64 | case WM8523_DEVICE_ID: |
@@ -110,10 +108,11 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
110 | 108 | ||
111 | static int wm8523_add_widgets(struct snd_soc_codec *codec) | 109 | static 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 | } |
@@ -314,6 +313,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
314 | enum snd_soc_bias_level level) | 313 | enum snd_soc_bias_level level) |
315 | { | 314 | { |
316 | 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; | ||
317 | int ret, i; | 317 | int ret, i; |
318 | 318 | ||
319 | switch (level) { | 319 | switch (level) { |
@@ -327,7 +327,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
327 | break; | 327 | break; |
328 | 328 | ||
329 | case SND_SOC_BIAS_STANDBY: | 329 | case SND_SOC_BIAS_STANDBY: |
330 | if (codec->bias_level == SND_SOC_BIAS_OFF) { | 330 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { |
331 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), | 331 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), |
332 | wm8523->supplies); | 332 | wm8523->supplies); |
333 | if (ret != 0) { | 333 | if (ret != 0) { |
@@ -344,7 +344,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
344 | /* Sync back default/cached values */ | 344 | /* Sync back default/cached values */ |
345 | for (i = WM8523_AIF_CTRL1; | 345 | for (i = WM8523_AIF_CTRL1; |
346 | i < WM8523_MAX_REGISTER; i++) | 346 | i < WM8523_MAX_REGISTER; i++) |
347 | snd_soc_write(codec, i, wm8523->reg_cache[i]); | 347 | snd_soc_write(codec, i, reg_cache[i]); |
348 | 348 | ||
349 | 349 | ||
350 | msleep(100); | 350 | msleep(100); |
@@ -366,7 +366,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
366 | wm8523->supplies); | 366 | wm8523->supplies); |
367 | break; | 367 | break; |
368 | } | 368 | } |
369 | codec->bias_level = level; | 369 | codec->dapm.bias_level = level; |
370 | return 0; | 370 | return 0; |
371 | } | 371 | } |
372 | 372 | ||
@@ -470,8 +470,9 @@ static int wm8523_probe(struct snd_soc_codec *codec) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | /* Change some default settings - latch VU and enable ZC */ | 472 | /* Change some default settings - latch VU and enable ZC */ |
473 | wm8523->reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; | 473 | snd_soc_update_bits(codec, WM8523_DAC_GAINR, |
474 | wm8523->reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; | 474 | WM8523_DACR_VU, WM8523_DACR_VU); |
475 | snd_soc_update_bits(codec, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC); | ||
475 | 476 | ||
476 | wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 477 | wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
477 | 478 | ||