aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc.h9
-rw-r--r--sound/soc/codecs/wm8510.c10
-rw-r--r--sound/soc/codecs/wm8580.c8
-rw-r--r--sound/soc/codecs/wm8728.c10
-rw-r--r--sound/soc/codecs/wm8731.c10
-rw-r--r--sound/soc/codecs/wm8750.c10
-rw-r--r--sound/soc/codecs/wm8960.c8
-rw-r--r--sound/soc/codecs/wm8971.c8
-rw-r--r--sound/soc/codecs/wm8988.c10
-rw-r--r--sound/soc/soc-cache.c19
10 files changed, 63 insertions, 39 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 27409dd41ae9..d0b29a509bdd 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -187,13 +187,20 @@ typedef int (*hw_read_t)(void *,char* ,int);
187 187
188extern struct snd_ac97_bus_ops soc_ac97_ops; 188extern struct snd_ac97_bus_ops soc_ac97_ops;
189 189
190enum snd_soc_control_type {
191 SND_SOC_CUSTOM,
192 SND_SOC_I2C,
193 SND_SOC_SPI,
194};
195
190int snd_soc_register_platform(struct snd_soc_platform *platform); 196int snd_soc_register_platform(struct snd_soc_platform *platform);
191void snd_soc_unregister_platform(struct snd_soc_platform *platform); 197void snd_soc_unregister_platform(struct snd_soc_platform *platform);
192int snd_soc_register_codec(struct snd_soc_codec *codec); 198int snd_soc_register_codec(struct snd_soc_codec *codec);
193void snd_soc_unregister_codec(struct snd_soc_codec *codec); 199void snd_soc_unregister_codec(struct snd_soc_codec *codec);
194int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); 200int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
195int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 201int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
196 int addr_bits, int data_bits); 202 int addr_bits, int data_bits,
203 enum snd_soc_control_type control);
197 204
198#ifdef CONFIG_PM 205#ifdef CONFIG_PM
199int snd_soc_suspend_device(struct device *dev); 206int snd_soc_suspend_device(struct device *dev);
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 7a169bff86f9..4ca724ff4c6e 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -564,7 +564,8 @@ static int wm8510_resume(struct platform_device *pdev)
564 * initialise the WM8510 driver 564 * initialise the WM8510 driver
565 * register the mixer and dsp interfaces with the kernel 565 * register the mixer and dsp interfaces with the kernel
566 */ 566 */
567static int wm8510_init(struct snd_soc_device *socdev) 567static int wm8510_init(struct snd_soc_device *socdev,
568 enum snd_soc_control_type control)
568{ 569{
569 struct snd_soc_codec *codec = socdev->card->codec; 570 struct snd_soc_codec *codec = socdev->card->codec;
570 int ret = 0; 571 int ret = 0;
@@ -580,7 +581,7 @@ static int wm8510_init(struct snd_soc_device *socdev)
580 if (codec->reg_cache == NULL) 581 if (codec->reg_cache == NULL)
581 return -ENOMEM; 582 return -ENOMEM;
582 583
583 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 584 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
584 if (ret < 0) { 585 if (ret < 0) {
585 printk(KERN_ERR "wm8510: failed to set cache I/O: %d\n", 586 printk(KERN_ERR "wm8510: failed to set cache I/O: %d\n",
586 ret); 587 ret);
@@ -635,7 +636,7 @@ static int wm8510_i2c_probe(struct i2c_client *i2c,
635 i2c_set_clientdata(i2c, codec); 636 i2c_set_clientdata(i2c, codec);
636 codec->control_data = i2c; 637 codec->control_data = i2c;
637 638
638 ret = wm8510_init(socdev); 639 ret = wm8510_init(socdev, SND_SOC_I2C);
639 if (ret < 0) 640 if (ret < 0)
640 pr_err("failed to initialise WM8510\n"); 641 pr_err("failed to initialise WM8510\n");
641 642
@@ -715,7 +716,7 @@ static int __devinit wm8510_spi_probe(struct spi_device *spi)
715 716
716 codec->control_data = spi; 717 codec->control_data = spi;
717 718
718 ret = wm8510_init(socdev); 719 ret = wm8510_init(socdev, SND_SOC_SPI);
719 if (ret < 0) 720 if (ret < 0)
720 dev_err(&spi->dev, "failed to initialise WM8510\n"); 721 dev_err(&spi->dev, "failed to initialise WM8510\n");
721 722
@@ -784,7 +785,6 @@ static int wm8510_probe(struct platform_device *pdev)
784 wm8510_socdev = socdev; 785 wm8510_socdev = socdev;
785#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 786#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
786 if (setup->i2c_address) { 787 if (setup->i2c_address) {
787 codec->hw_write = (hw_write_t)i2c_master_send;
788 ret = wm8510_add_i2c_device(pdev, setup); 788 ret = wm8510_add_i2c_device(pdev, setup);
789 } 789 }
790#endif 790#endif
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 2250adea749f..d5473473a1e3 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -832,7 +832,8 @@ struct snd_soc_codec_device soc_codec_dev_wm8580 = {
832}; 832};
833EXPORT_SYMBOL_GPL(soc_codec_dev_wm8580); 833EXPORT_SYMBOL_GPL(soc_codec_dev_wm8580);
834 834
835static int wm8580_register(struct wm8580_priv *wm8580) 835static int wm8580_register(struct wm8580_priv *wm8580,
836 enum snd_soc_control_type control)
836{ 837{
837 int ret, i; 838 int ret, i;
838 struct snd_soc_codec *codec = &wm8580->codec; 839 struct snd_soc_codec *codec = &wm8580->codec;
@@ -859,7 +860,7 @@ static int wm8580_register(struct wm8580_priv *wm8580)
859 860
860 memcpy(codec->reg_cache, wm8580_reg, sizeof(wm8580_reg)); 861 memcpy(codec->reg_cache, wm8580_reg, sizeof(wm8580_reg));
861 862
862 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 863 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
863 if (ret < 0) { 864 if (ret < 0) {
864 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 865 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
865 goto err; 866 goto err;
@@ -944,14 +945,13 @@ static int wm8580_i2c_probe(struct i2c_client *i2c,
944 return -ENOMEM; 945 return -ENOMEM;
945 946
946 codec = &wm8580->codec; 947 codec = &wm8580->codec;
947 codec->hw_write = (hw_write_t)i2c_master_send;
948 948
949 i2c_set_clientdata(i2c, wm8580); 949 i2c_set_clientdata(i2c, wm8580);
950 codec->control_data = i2c; 950 codec->control_data = i2c;
951 951
952 codec->dev = &i2c->dev; 952 codec->dev = &i2c->dev;
953 953
954 return wm8580_register(wm8580); 954 return wm8580_register(wm8580, SND_SOC_I2C);
955} 955}
956 956
957static int wm8580_i2c_remove(struct i2c_client *client) 957static int wm8580_i2c_remove(struct i2c_client *client)
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index 66da44b08d35..a28630de9c91 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -248,7 +248,8 @@ static int wm8728_resume(struct platform_device *pdev)
248 * initialise the WM8728 driver 248 * initialise the WM8728 driver
249 * register the mixer and dsp interfaces with the kernel 249 * register the mixer and dsp interfaces with the kernel
250 */ 250 */
251static int wm8728_init(struct snd_soc_device *socdev) 251static int wm8728_init(struct snd_soc_device *socdev,
252 enum snd_soc_control_type control)
252{ 253{
253 struct snd_soc_codec *codec = socdev->card->codec; 254 struct snd_soc_codec *codec = socdev->card->codec;
254 int ret = 0; 255 int ret = 0;
@@ -266,7 +267,7 @@ static int wm8728_init(struct snd_soc_device *socdev)
266 if (codec->reg_cache == NULL) 267 if (codec->reg_cache == NULL)
267 return -ENOMEM; 268 return -ENOMEM;
268 269
269 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 270 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
270 if (ret < 0) { 271 if (ret < 0) {
271 printk(KERN_ERR "wm8728: failed to configure cache I/O: %d\n", 272 printk(KERN_ERR "wm8728: failed to configure cache I/O: %d\n",
272 ret); 273 ret);
@@ -323,7 +324,7 @@ static int wm8728_i2c_probe(struct i2c_client *i2c,
323 i2c_set_clientdata(i2c, codec); 324 i2c_set_clientdata(i2c, codec);
324 codec->control_data = i2c; 325 codec->control_data = i2c;
325 326
326 ret = wm8728_init(socdev); 327 ret = wm8728_init(socdev, SND_SOC_I2C);
327 if (ret < 0) 328 if (ret < 0)
328 pr_err("failed to initialise WM8728\n"); 329 pr_err("failed to initialise WM8728\n");
329 330
@@ -403,7 +404,7 @@ static int __devinit wm8728_spi_probe(struct spi_device *spi)
403 404
404 codec->control_data = spi; 405 codec->control_data = spi;
405 406
406 ret = wm8728_init(socdev); 407 ret = wm8728_init(socdev, SND_SOC_SPI);
407 if (ret < 0) 408 if (ret < 0)
408 dev_err(&spi->dev, "failed to initialise WM8728\n"); 409 dev_err(&spi->dev, "failed to initialise WM8728\n");
409 410
@@ -472,7 +473,6 @@ static int wm8728_probe(struct platform_device *pdev)
472 473
473#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 474#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
474 if (setup->i2c_address) { 475 if (setup->i2c_address) {
475 codec->hw_write = (hw_write_t)i2c_master_send;
476 ret = wm8728_add_i2c_device(pdev, setup); 476 ret = wm8728_add_i2c_device(pdev, setup);
477 } 477 }
478#endif 478#endif
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 4eb84ff691b3..27fc942a5ced 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -504,7 +504,8 @@ struct snd_soc_codec_device soc_codec_dev_wm8731 = {
504}; 504};
505EXPORT_SYMBOL_GPL(soc_codec_dev_wm8731); 505EXPORT_SYMBOL_GPL(soc_codec_dev_wm8731);
506 506
507static int wm8731_register(struct wm8731_priv *wm8731) 507static int wm8731_register(struct wm8731_priv *wm8731,
508 enum snd_soc_control_type control)
508{ 509{
509 int ret; 510 int ret;
510 struct snd_soc_codec *codec = &wm8731->codec; 511 struct snd_soc_codec *codec = &wm8731->codec;
@@ -531,7 +532,7 @@ static int wm8731_register(struct wm8731_priv *wm8731)
531 532
532 memcpy(codec->reg_cache, wm8731_reg, sizeof(wm8731_reg)); 533 memcpy(codec->reg_cache, wm8731_reg, sizeof(wm8731_reg));
533 534
534 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 535 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
535 if (ret < 0) { 536 if (ret < 0) {
536 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 537 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
537 goto err; 538 goto err;
@@ -630,7 +631,7 @@ static int __devinit wm8731_spi_probe(struct spi_device *spi)
630 631
631 dev_set_drvdata(&spi->dev, wm8731); 632 dev_set_drvdata(&spi->dev, wm8731);
632 633
633 return wm8731_register(wm8731); 634 return wm8731_register(wm8731, SND_SOC_SPI);
634} 635}
635 636
636static int __devexit wm8731_spi_remove(struct spi_device *spi) 637static int __devexit wm8731_spi_remove(struct spi_device *spi)
@@ -682,14 +683,13 @@ static __devinit int wm8731_i2c_probe(struct i2c_client *i2c,
682 return -ENOMEM; 683 return -ENOMEM;
683 684
684 codec = &wm8731->codec; 685 codec = &wm8731->codec;
685 codec->hw_write = (hw_write_t)i2c_master_send;
686 686
687 i2c_set_clientdata(i2c, wm8731); 687 i2c_set_clientdata(i2c, wm8731);
688 codec->control_data = i2c; 688 codec->control_data = i2c;
689 689
690 codec->dev = &i2c->dev; 690 codec->dev = &i2c->dev;
691 691
692 return wm8731_register(wm8731); 692 return wm8731_register(wm8731, SND_SOC_I2C);
693} 693}
694 694
695static __devexit int wm8731_i2c_remove(struct i2c_client *client) 695static __devexit int wm8731_i2c_remove(struct i2c_client *client)
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index ed09043181e1..e6422b161678 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -711,7 +711,8 @@ static int wm8750_resume(struct platform_device *pdev)
711 * initialise the WM8750 driver 711 * initialise the WM8750 driver
712 * register the mixer and dsp interfaces with the kernel 712 * register the mixer and dsp interfaces with the kernel
713 */ 713 */
714static int wm8750_init(struct snd_soc_device *socdev) 714static int wm8750_init(struct snd_soc_device *socdev,
715 enum snd_soc_control_type control)
715{ 716{
716 struct snd_soc_codec *codec = socdev->card->codec; 717 struct snd_soc_codec *codec = socdev->card->codec;
717 int reg, ret = 0; 718 int reg, ret = 0;
@@ -726,7 +727,7 @@ static int wm8750_init(struct snd_soc_device *socdev)
726 if (codec->reg_cache == NULL) 727 if (codec->reg_cache == NULL)
727 return -ENOMEM; 728 return -ENOMEM;
728 729
729 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 730 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
730 if (ret < 0) { 731 if (ret < 0) {
731 printk(KERN_ERR "wm8750: failed to set cache I/O: %d\n", ret); 732 printk(KERN_ERR "wm8750: failed to set cache I/O: %d\n", ret);
732 goto err; 733 goto err;
@@ -809,7 +810,7 @@ static int wm8750_i2c_probe(struct i2c_client *i2c,
809 i2c_set_clientdata(i2c, codec); 810 i2c_set_clientdata(i2c, codec);
810 codec->control_data = i2c; 811 codec->control_data = i2c;
811 812
812 ret = wm8750_init(socdev); 813 ret = wm8750_init(socdev, SND_SOC_I2C);
813 if (ret < 0) 814 if (ret < 0)
814 pr_err("failed to initialise WM8750\n"); 815 pr_err("failed to initialise WM8750\n");
815 816
@@ -889,7 +890,7 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
889 890
890 codec->control_data = spi; 891 codec->control_data = spi;
891 892
892 ret = wm8750_init(socdev); 893 ret = wm8750_init(socdev, SND_SOC_SPI);
893 if (ret < 0) 894 if (ret < 0)
894 dev_err(&spi->dev, "failed to initialise WM8750\n"); 895 dev_err(&spi->dev, "failed to initialise WM8750\n");
895 896
@@ -967,7 +968,6 @@ static int wm8750_probe(struct platform_device *pdev)
967 968
968#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 969#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
969 if (setup->i2c_address) { 970 if (setup->i2c_address) {
970 codec->hw_write = (hw_write_t)i2c_master_send;
971 ret = wm8750_add_i2c_device(pdev, setup); 971 ret = wm8750_add_i2c_device(pdev, setup);
972 } 972 }
973#endif 973#endif
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index c529ffcfe5d8..f59703be61c8 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -747,7 +747,8 @@ struct snd_soc_codec_device soc_codec_dev_wm8960 = {
747}; 747};
748EXPORT_SYMBOL_GPL(soc_codec_dev_wm8960); 748EXPORT_SYMBOL_GPL(soc_codec_dev_wm8960);
749 749
750static int wm8960_register(struct wm8960_priv *wm8960) 750static int wm8960_register(struct wm8960_priv *wm8960,
751 enum snd_soc_control_type control)
751{ 752{
752 struct wm8960_data *pdata = wm8960->codec.dev->platform_data; 753 struct wm8960_data *pdata = wm8960->codec.dev->platform_data;
753 struct snd_soc_codec *codec = &wm8960->codec; 754 struct snd_soc_codec *codec = &wm8960->codec;
@@ -785,7 +786,7 @@ static int wm8960_register(struct wm8960_priv *wm8960)
785 786
786 memcpy(codec->reg_cache, wm8960_reg, sizeof(wm8960_reg)); 787 memcpy(codec->reg_cache, wm8960_reg, sizeof(wm8960_reg));
787 788
788 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 789 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
789 if (ret < 0) { 790 if (ret < 0) {
790 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 791 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
791 goto err; 792 goto err;
@@ -866,14 +867,13 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
866 return -ENOMEM; 867 return -ENOMEM;
867 868
868 codec = &wm8960->codec; 869 codec = &wm8960->codec;
869 codec->hw_write = (hw_write_t)i2c_master_send;
870 870
871 i2c_set_clientdata(i2c, wm8960); 871 i2c_set_clientdata(i2c, wm8960);
872 codec->control_data = i2c; 872 codec->control_data = i2c;
873 873
874 codec->dev = &i2c->dev; 874 codec->dev = &i2c->dev;
875 875
876 return wm8960_register(wm8960); 876 return wm8960_register(wm8960, SND_SOC_I2C);
877} 877}
878 878
879static __devexit int wm8960_i2c_remove(struct i2c_client *client) 879static __devexit int wm8960_i2c_remove(struct i2c_client *client)
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 53f3bc90ea0c..d66efb0546ea 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -640,7 +640,8 @@ static int wm8971_resume(struct platform_device *pdev)
640 return 0; 640 return 0;
641} 641}
642 642
643static int wm8971_init(struct snd_soc_device *socdev) 643static int wm8971_init(struct snd_soc_device *socdev,
644 enum snd_soc_control_type control)
644{ 645{
645 struct snd_soc_codec *codec = socdev->card->codec; 646 struct snd_soc_codec *codec = socdev->card->codec;
646 int reg, ret = 0; 647 int reg, ret = 0;
@@ -656,7 +657,7 @@ static int wm8971_init(struct snd_soc_device *socdev)
656 if (codec->reg_cache == NULL) 657 if (codec->reg_cache == NULL)
657 return -ENOMEM; 658 return -ENOMEM;
658 659
659 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 660 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
660 if (ret < 0) { 661 if (ret < 0) {
661 printk(KERN_ERR "wm8971: failed to set cache I/O: %d\n", ret); 662 printk(KERN_ERR "wm8971: failed to set cache I/O: %d\n", ret);
662 goto err; 663 goto err;
@@ -734,7 +735,7 @@ static int wm8971_i2c_probe(struct i2c_client *i2c,
734 735
735 codec->control_data = i2c; 736 codec->control_data = i2c;
736 737
737 ret = wm8971_init(socdev); 738 ret = wm8971_init(socdev, SND_SOC_I2C);
738 if (ret < 0) 739 if (ret < 0)
739 pr_err("failed to initialise WM8971\n"); 740 pr_err("failed to initialise WM8971\n");
740 741
@@ -844,7 +845,6 @@ static int wm8971_probe(struct platform_device *pdev)
844 845
845#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) 846#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE)
846 if (setup->i2c_address) { 847 if (setup->i2c_address) {
847 codec->hw_write = (hw_write_t)i2c_master_send;
848 ret = wm8971_add_i2c_device(pdev, setup); 848 ret = wm8971_add_i2c_device(pdev, setup);
849 } 849 }
850#endif 850#endif
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 7d5b807bdb48..7486d3ec787e 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -825,7 +825,8 @@ struct snd_soc_codec_device soc_codec_dev_wm8988 = {
825}; 825};
826EXPORT_SYMBOL_GPL(soc_codec_dev_wm8988); 826EXPORT_SYMBOL_GPL(soc_codec_dev_wm8988);
827 827
828static int wm8988_register(struct wm8988_priv *wm8988) 828static int wm8988_register(struct wm8988_priv *wm8988,
829 enum snd_soc_control_type control)
829{ 830{
830 struct snd_soc_codec *codec = &wm8988->codec; 831 struct snd_soc_codec *codec = &wm8988->codec;
831 int ret; 832 int ret;
@@ -854,7 +855,7 @@ static int wm8988_register(struct wm8988_priv *wm8988)
854 memcpy(codec->reg_cache, wm8988_reg, 855 memcpy(codec->reg_cache, wm8988_reg,
855 sizeof(wm8988_reg)); 856 sizeof(wm8988_reg));
856 857
857 ret = snd_soc_codec_set_cache_io(codec, 7, 9); 858 ret = snd_soc_codec_set_cache_io(codec, 7, 9, control);
858 if (ret < 0) { 859 if (ret < 0) {
859 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 860 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
860 goto err; 861 goto err;
@@ -927,14 +928,13 @@ static int wm8988_i2c_probe(struct i2c_client *i2c,
927 return -ENOMEM; 928 return -ENOMEM;
928 929
929 codec = &wm8988->codec; 930 codec = &wm8988->codec;
930 codec->hw_write = (hw_write_t)i2c_master_send;
931 931
932 i2c_set_clientdata(i2c, wm8988); 932 i2c_set_clientdata(i2c, wm8988);
933 codec->control_data = i2c; 933 codec->control_data = i2c;
934 934
935 codec->dev = &i2c->dev; 935 codec->dev = &i2c->dev;
936 936
937 return wm8988_register(wm8988); 937 return wm8988_register(wm8988, SND_SOC_I2C);
938} 938}
939 939
940static int wm8988_i2c_remove(struct i2c_client *client) 940static int wm8988_i2c_remove(struct i2c_client *client)
@@ -1019,7 +1019,7 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
1019 1019
1020 spi->dev.driver_data = wm8988; 1020 spi->dev.driver_data = wm8988;
1021 1021
1022 return wm8988_register(wm8988); 1022 return wm8988_register(wm8988, SND_SOC_SPI);
1023} 1023}
1024 1024
1025static int __devexit wm8988_spi_remove(struct spi_device *spi) 1025static int __devexit wm8988_spi_remove(struct spi_device *spi)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 4eb4333a0efb..8b126682c843 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -11,6 +11,7 @@
11 * option) any later version. 11 * option) any later version.
12 */ 12 */
13 13
14#include <linux/i2c.h>
14#include <sound/soc.h> 15#include <sound/soc.h>
15 16
16static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, 17static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec,
@@ -62,6 +63,7 @@ static struct {
62 * @type: Type of cache. 63 * @type: Type of cache.
63 * @addr_bits: Number of bits of register address data. 64 * @addr_bits: Number of bits of register address data.
64 * @data_bits: Number of bits of data per register. 65 * @data_bits: Number of bits of data per register.
66 * @control: Control bus used.
65 * 67 *
66 * Register formats are frequently shared between many I2C and SPI 68 * Register formats are frequently shared between many I2C and SPI
67 * devices. In order to promote code reuse the ASoC core provides 69 * devices. In order to promote code reuse the ASoC core provides
@@ -75,7 +77,8 @@ static struct {
75 * volatile registers. 77 * volatile registers.
76 */ 78 */
77int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 79int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
78 int addr_bits, int data_bits) 80 int addr_bits, int data_bits,
81 enum snd_soc_control_type control)
79{ 82{
80 int i; 83 int i;
81 84
@@ -100,6 +103,20 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
100 codec->write = io_types[i].write; 103 codec->write = io_types[i].write;
101 codec->read = io_types[i].read; 104 codec->read = io_types[i].read;
102 105
106 switch (control) {
107 case SND_SOC_CUSTOM:
108 break;
109
110 case SND_SOC_I2C:
111#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
112 codec->hw_write = (hw_write_t)i2c_master_send;
113#endif
114 break;
115
116 case SND_SOC_SPI:
117 break;
118 }
119
103 return 0; 120 return 0;
104} 121}
105EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); 122EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);