diff options
Diffstat (limited to 'sound/soc/codecs/wm8731.c')
-rw-r--r-- | sound/soc/codecs/wm8731.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 76b4361e9b80..7e5ec03f6f8d 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/regulator/consumer.h> | 23 | #include <linux/regulator/consumer.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/of_device.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include <sound/pcm.h> | 27 | #include <sound/pcm.h> |
27 | #include <sound/pcm_params.h> | 28 | #include <sound/pcm_params.h> |
@@ -426,9 +427,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
426 | enum snd_soc_bias_level level) | 427 | enum snd_soc_bias_level level) |
427 | { | 428 | { |
428 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); | 429 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); |
429 | int i, ret; | 430 | int ret; |
430 | u8 data[2]; | ||
431 | u16 *cache = codec->reg_cache; | ||
432 | u16 reg; | 431 | u16 reg; |
433 | 432 | ||
434 | switch (level) { | 433 | switch (level) { |
@@ -443,16 +442,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
443 | if (ret != 0) | 442 | if (ret != 0) |
444 | return ret; | 443 | return ret; |
445 | 444 | ||
446 | /* Sync reg_cache with the hardware */ | 445 | snd_soc_cache_sync(codec); |
447 | for (i = 0; i < ARRAY_SIZE(wm8731_reg); i++) { | ||
448 | if (cache[i] == wm8731_reg[i]) | ||
449 | continue; | ||
450 | |||
451 | data[0] = (i << 1) | ((cache[i] >> 8) | ||
452 | & 0x0001); | ||
453 | data[1] = cache[i] & 0x00ff; | ||
454 | codec->hw_write(codec->control_data, data, 2); | ||
455 | } | ||
456 | } | 446 | } |
457 | 447 | ||
458 | /* Clear PWROFF, gate CLKOUT, everything else as-is */ | 448 | /* Clear PWROFF, gate CLKOUT, everything else as-is */ |
@@ -607,6 +597,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8731 = { | |||
607 | .num_dapm_routes = ARRAY_SIZE(wm8731_intercon), | 597 | .num_dapm_routes = ARRAY_SIZE(wm8731_intercon), |
608 | }; | 598 | }; |
609 | 599 | ||
600 | static const struct of_device_id wm8731_of_match[] = { | ||
601 | { .compatible = "wlf,wm8731", }, | ||
602 | { } | ||
603 | }; | ||
604 | |||
605 | MODULE_DEVICE_TABLE(of, wm8731_of_match); | ||
606 | |||
610 | #if defined(CONFIG_SPI_MASTER) | 607 | #if defined(CONFIG_SPI_MASTER) |
611 | static int __devinit wm8731_spi_probe(struct spi_device *spi) | 608 | static int __devinit wm8731_spi_probe(struct spi_device *spi) |
612 | { | 609 | { |
@@ -638,6 +635,7 @@ static struct spi_driver wm8731_spi_driver = { | |||
638 | .driver = { | 635 | .driver = { |
639 | .name = "wm8731", | 636 | .name = "wm8731", |
640 | .owner = THIS_MODULE, | 637 | .owner = THIS_MODULE, |
638 | .of_match_table = wm8731_of_match, | ||
641 | }, | 639 | }, |
642 | .probe = wm8731_spi_probe, | 640 | .probe = wm8731_spi_probe, |
643 | .remove = __devexit_p(wm8731_spi_remove), | 641 | .remove = __devexit_p(wm8731_spi_remove), |
@@ -682,6 +680,7 @@ static struct i2c_driver wm8731_i2c_driver = { | |||
682 | .driver = { | 680 | .driver = { |
683 | .name = "wm8731", | 681 | .name = "wm8731", |
684 | .owner = THIS_MODULE, | 682 | .owner = THIS_MODULE, |
683 | .of_match_table = wm8731_of_match, | ||
685 | }, | 684 | }, |
686 | .probe = wm8731_i2c_probe, | 685 | .probe = wm8731_i2c_probe, |
687 | .remove = __devexit_p(wm8731_i2c_remove), | 686 | .remove = __devexit_p(wm8731_i2c_remove), |