diff options
Diffstat (limited to 'sound/soc/codecs/wm8711.c')
-rw-r--r-- | sound/soc/codecs/wm8711.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index a537e4af6ae7..8d0347cf0e9a 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright 2006 Wolfson Microelectronics | 4 | * Copyright 2006 Wolfson Microelectronics |
5 | * | 5 | * |
6 | * Author: Mike Arthur <linux@wolfsonmicro.com> | 6 | * Author: Mike Arthur <Mike.Arthur@wolfsonmicro.com> |
7 | * | 7 | * |
8 | * Based on wm8731.c by Richard Purdie | 8 | * Based on wm8731.c by Richard Purdie |
9 | * | 9 | * |
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/of_device.h> | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/pcm.h> | 26 | #include <sound/pcm.h> |
26 | #include <sound/pcm_params.h> | 27 | #include <sound/pcm_params.h> |
@@ -286,7 +287,6 @@ static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
286 | return 0; | 287 | return 0; |
287 | } | 288 | } |
288 | 289 | ||
289 | |||
290 | static int wm8711_set_bias_level(struct snd_soc_codec *codec, | 290 | static int wm8711_set_bias_level(struct snd_soc_codec *codec, |
291 | enum snd_soc_bias_level level) | 291 | enum snd_soc_bias_level level) |
292 | { | 292 | { |
@@ -299,6 +299,9 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec, | |||
299 | case SND_SOC_BIAS_PREPARE: | 299 | case SND_SOC_BIAS_PREPARE: |
300 | break; | 300 | break; |
301 | case SND_SOC_BIAS_STANDBY: | 301 | case SND_SOC_BIAS_STANDBY: |
302 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | ||
303 | snd_soc_cache_sync(codec); | ||
304 | |||
302 | snd_soc_write(codec, WM8711_PWR, reg | 0x0040); | 305 | snd_soc_write(codec, WM8711_PWR, reg | 0x0040); |
303 | break; | 306 | break; |
304 | case SND_SOC_BIAS_OFF: | 307 | case SND_SOC_BIAS_OFF: |
@@ -345,25 +348,14 @@ static int wm8711_suspend(struct snd_soc_codec *codec, pm_message_t state) | |||
345 | 348 | ||
346 | static int wm8711_resume(struct snd_soc_codec *codec) | 349 | static int wm8711_resume(struct snd_soc_codec *codec) |
347 | { | 350 | { |
348 | int i; | ||
349 | u8 data[2]; | ||
350 | u16 *cache = codec->reg_cache; | ||
351 | |||
352 | /* Sync reg_cache with the hardware */ | ||
353 | for (i = 0; i < ARRAY_SIZE(wm8711_reg); i++) { | ||
354 | data[0] = (i << 1) | ((cache[i] >> 8) & 0x0001); | ||
355 | data[1] = cache[i] & 0x00ff; | ||
356 | codec->hw_write(codec->control_data, data, 2); | ||
357 | } | ||
358 | wm8711_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 351 | wm8711_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
359 | |||
360 | return 0; | 352 | return 0; |
361 | } | 353 | } |
362 | 354 | ||
363 | static int wm8711_probe(struct snd_soc_codec *codec) | 355 | static int wm8711_probe(struct snd_soc_codec *codec) |
364 | { | 356 | { |
365 | struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec); | 357 | struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec); |
366 | int ret, reg; | 358 | int ret; |
367 | 359 | ||
368 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8711->bus_type); | 360 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8711->bus_type); |
369 | if (ret < 0) { | 361 | if (ret < 0) { |
@@ -380,10 +372,8 @@ static int wm8711_probe(struct snd_soc_codec *codec) | |||
380 | wm8711_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 372 | wm8711_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
381 | 373 | ||
382 | /* Latch the update bits */ | 374 | /* Latch the update bits */ |
383 | reg = snd_soc_read(codec, WM8711_LOUT1V); | 375 | snd_soc_update_bits(codec, WM8711_LOUT1V, 0x0100, 0x0100); |
384 | snd_soc_write(codec, WM8711_LOUT1V, reg | 0x0100); | 376 | snd_soc_update_bits(codec, WM8711_ROUT1V, 0x0100, 0x0100); |
385 | reg = snd_soc_read(codec, WM8711_ROUT1V); | ||
386 | snd_soc_write(codec, WM8711_ROUT1V, reg | 0x0100); | ||
387 | 377 | ||
388 | snd_soc_add_controls(codec, wm8711_snd_controls, | 378 | snd_soc_add_controls(codec, wm8711_snd_controls, |
389 | ARRAY_SIZE(wm8711_snd_controls)); | 379 | ARRAY_SIZE(wm8711_snd_controls)); |
@@ -414,6 +404,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = { | |||
414 | .num_dapm_routes = ARRAY_SIZE(wm8711_intercon), | 404 | .num_dapm_routes = ARRAY_SIZE(wm8711_intercon), |
415 | }; | 405 | }; |
416 | 406 | ||
407 | static const struct of_device_id wm8711_of_match[] = { | ||
408 | { .compatible = "wlf,wm8711", }, | ||
409 | { } | ||
410 | }; | ||
411 | MODULE_DEVICE_TABLE(of, wm8711_of_match); | ||
412 | |||
417 | #if defined(CONFIG_SPI_MASTER) | 413 | #if defined(CONFIG_SPI_MASTER) |
418 | static int __devinit wm8711_spi_probe(struct spi_device *spi) | 414 | static int __devinit wm8711_spi_probe(struct spi_device *spi) |
419 | { | 415 | { |
@@ -443,8 +439,9 @@ static int __devexit wm8711_spi_remove(struct spi_device *spi) | |||
443 | 439 | ||
444 | static struct spi_driver wm8711_spi_driver = { | 440 | static struct spi_driver wm8711_spi_driver = { |
445 | .driver = { | 441 | .driver = { |
446 | .name = "wm8711-codec", | 442 | .name = "wm8711", |
447 | .owner = THIS_MODULE, | 443 | .owner = THIS_MODULE, |
444 | .of_match_table = wm8711_of_match, | ||
448 | }, | 445 | }, |
449 | .probe = wm8711_spi_probe, | 446 | .probe = wm8711_spi_probe, |
450 | .remove = __devexit_p(wm8711_spi_remove), | 447 | .remove = __devexit_p(wm8711_spi_remove), |
@@ -487,8 +484,9 @@ MODULE_DEVICE_TABLE(i2c, wm8711_i2c_id); | |||
487 | 484 | ||
488 | static struct i2c_driver wm8711_i2c_driver = { | 485 | static struct i2c_driver wm8711_i2c_driver = { |
489 | .driver = { | 486 | .driver = { |
490 | .name = "wm8711-codec", | 487 | .name = "wm8711", |
491 | .owner = THIS_MODULE, | 488 | .owner = THIS_MODULE, |
489 | .of_match_table = wm8711_of_match, | ||
492 | }, | 490 | }, |
493 | .probe = wm8711_i2c_probe, | 491 | .probe = wm8711_i2c_probe, |
494 | .remove = __devexit_p(wm8711_i2c_remove), | 492 | .remove = __devexit_p(wm8711_i2c_remove), |