diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8510.c | 25 | ||||
-rw-r--r-- | sound/soc/codecs/wm8728.c | 25 | ||||
-rw-r--r-- | sound/soc/codecs/wm8731.c | 25 | ||||
-rw-r--r-- | sound/soc/codecs/wm8750.c | 25 | ||||
-rw-r--r-- | sound/soc/codecs/wm8988.c | 25 | ||||
-rw-r--r-- | sound/soc/soc-cache.c | 39 |
6 files changed, 36 insertions, 128 deletions
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 4ca724ff4c6e..bcd6a40171dc 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
@@ -737,30 +737,6 @@ static struct spi_driver wm8510_spi_driver = { | |||
737 | .probe = wm8510_spi_probe, | 737 | .probe = wm8510_spi_probe, |
738 | .remove = __devexit_p(wm8510_spi_remove), | 738 | .remove = __devexit_p(wm8510_spi_remove), |
739 | }; | 739 | }; |
740 | |||
741 | static int wm8510_spi_write(struct spi_device *spi, const char *data, int len) | ||
742 | { | ||
743 | struct spi_transfer t; | ||
744 | struct spi_message m; | ||
745 | u8 msg[2]; | ||
746 | |||
747 | if (len <= 0) | ||
748 | return 0; | ||
749 | |||
750 | msg[0] = data[0]; | ||
751 | msg[1] = data[1]; | ||
752 | |||
753 | spi_message_init(&m); | ||
754 | memset(&t, 0, (sizeof t)); | ||
755 | |||
756 | t.tx_buf = &msg[0]; | ||
757 | t.len = len; | ||
758 | |||
759 | spi_message_add_tail(&t, &m); | ||
760 | spi_sync(spi, &m); | ||
761 | |||
762 | return len; | ||
763 | } | ||
764 | #endif /* CONFIG_SPI_MASTER */ | 740 | #endif /* CONFIG_SPI_MASTER */ |
765 | 741 | ||
766 | static int wm8510_probe(struct platform_device *pdev) | 742 | static int wm8510_probe(struct platform_device *pdev) |
@@ -790,7 +766,6 @@ static int wm8510_probe(struct platform_device *pdev) | |||
790 | #endif | 766 | #endif |
791 | #if defined(CONFIG_SPI_MASTER) | 767 | #if defined(CONFIG_SPI_MASTER) |
792 | if (setup->spi) { | 768 | if (setup->spi) { |
793 | codec->hw_write = (hw_write_t)wm8510_spi_write; | ||
794 | ret = spi_register_driver(&wm8510_spi_driver); | 769 | ret = spi_register_driver(&wm8510_spi_driver); |
795 | if (ret != 0) | 770 | if (ret != 0) |
796 | printk(KERN_ERR "can't add spi driver"); | 771 | printk(KERN_ERR "can't add spi driver"); |
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index a28630de9c91..16e969a762c3 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c | |||
@@ -425,30 +425,6 @@ static struct spi_driver wm8728_spi_driver = { | |||
425 | .probe = wm8728_spi_probe, | 425 | .probe = wm8728_spi_probe, |
426 | .remove = __devexit_p(wm8728_spi_remove), | 426 | .remove = __devexit_p(wm8728_spi_remove), |
427 | }; | 427 | }; |
428 | |||
429 | static int wm8728_spi_write(struct spi_device *spi, const char *data, int len) | ||
430 | { | ||
431 | struct spi_transfer t; | ||
432 | struct spi_message m; | ||
433 | u8 msg[2]; | ||
434 | |||
435 | if (len <= 0) | ||
436 | return 0; | ||
437 | |||
438 | msg[0] = data[0]; | ||
439 | msg[1] = data[1]; | ||
440 | |||
441 | spi_message_init(&m); | ||
442 | memset(&t, 0, (sizeof t)); | ||
443 | |||
444 | t.tx_buf = &msg[0]; | ||
445 | t.len = len; | ||
446 | |||
447 | spi_message_add_tail(&t, &m); | ||
448 | spi_sync(spi, &m); | ||
449 | |||
450 | return len; | ||
451 | } | ||
452 | #endif /* CONFIG_SPI_MASTER */ | 428 | #endif /* CONFIG_SPI_MASTER */ |
453 | 429 | ||
454 | static int wm8728_probe(struct platform_device *pdev) | 430 | static int wm8728_probe(struct platform_device *pdev) |
@@ -478,7 +454,6 @@ static int wm8728_probe(struct platform_device *pdev) | |||
478 | #endif | 454 | #endif |
479 | #if defined(CONFIG_SPI_MASTER) | 455 | #if defined(CONFIG_SPI_MASTER) |
480 | if (setup->spi) { | 456 | if (setup->spi) { |
481 | codec->hw_write = (hw_write_t)wm8728_spi_write; | ||
482 | ret = spi_register_driver(&wm8728_spi_driver); | 457 | ret = spi_register_driver(&wm8728_spi_driver); |
483 | if (ret != 0) | 458 | if (ret != 0) |
484 | printk(KERN_ERR "can't add spi driver"); | 459 | printk(KERN_ERR "can't add spi driver"); |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 27fc942a5ced..6232afd907ef 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -591,30 +591,6 @@ static void wm8731_unregister(struct wm8731_priv *wm8731) | |||
591 | } | 591 | } |
592 | 592 | ||
593 | #if defined(CONFIG_SPI_MASTER) | 593 | #if defined(CONFIG_SPI_MASTER) |
594 | static int wm8731_spi_write(struct spi_device *spi, const char *data, int len) | ||
595 | { | ||
596 | struct spi_transfer t; | ||
597 | struct spi_message m; | ||
598 | u8 msg[2]; | ||
599 | |||
600 | if (len <= 0) | ||
601 | return 0; | ||
602 | |||
603 | msg[0] = data[0]; | ||
604 | msg[1] = data[1]; | ||
605 | |||
606 | spi_message_init(&m); | ||
607 | memset(&t, 0, (sizeof t)); | ||
608 | |||
609 | t.tx_buf = &msg[0]; | ||
610 | t.len = len; | ||
611 | |||
612 | spi_message_add_tail(&t, &m); | ||
613 | spi_sync(spi, &m); | ||
614 | |||
615 | return len; | ||
616 | } | ||
617 | |||
618 | static int __devinit wm8731_spi_probe(struct spi_device *spi) | 594 | static int __devinit wm8731_spi_probe(struct spi_device *spi) |
619 | { | 595 | { |
620 | struct snd_soc_codec *codec; | 596 | struct snd_soc_codec *codec; |
@@ -626,7 +602,6 @@ static int __devinit wm8731_spi_probe(struct spi_device *spi) | |||
626 | 602 | ||
627 | codec = &wm8731->codec; | 603 | codec = &wm8731->codec; |
628 | codec->control_data = spi; | 604 | codec->control_data = spi; |
629 | codec->hw_write = (hw_write_t)wm8731_spi_write; | ||
630 | codec->dev = &spi->dev; | 605 | codec->dev = &spi->dev; |
631 | 606 | ||
632 | dev_set_drvdata(&spi->dev, wm8731); | 607 | dev_set_drvdata(&spi->dev, wm8731); |
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index e6422b161678..4ba1e7e93fb4 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -911,30 +911,6 @@ static struct spi_driver wm8750_spi_driver = { | |||
911 | .probe = wm8750_spi_probe, | 911 | .probe = wm8750_spi_probe, |
912 | .remove = __devexit_p(wm8750_spi_remove), | 912 | .remove = __devexit_p(wm8750_spi_remove), |
913 | }; | 913 | }; |
914 | |||
915 | static int wm8750_spi_write(struct spi_device *spi, const char *data, int len) | ||
916 | { | ||
917 | struct spi_transfer t; | ||
918 | struct spi_message m; | ||
919 | u8 msg[2]; | ||
920 | |||
921 | if (len <= 0) | ||
922 | return 0; | ||
923 | |||
924 | msg[0] = data[0]; | ||
925 | msg[1] = data[1]; | ||
926 | |||
927 | spi_message_init(&m); | ||
928 | memset(&t, 0, (sizeof t)); | ||
929 | |||
930 | t.tx_buf = &msg[0]; | ||
931 | t.len = len; | ||
932 | |||
933 | spi_message_add_tail(&t, &m); | ||
934 | spi_sync(spi, &m); | ||
935 | |||
936 | return len; | ||
937 | } | ||
938 | #endif | 914 | #endif |
939 | 915 | ||
940 | static int wm8750_probe(struct platform_device *pdev) | 916 | static int wm8750_probe(struct platform_device *pdev) |
@@ -973,7 +949,6 @@ static int wm8750_probe(struct platform_device *pdev) | |||
973 | #endif | 949 | #endif |
974 | #if defined(CONFIG_SPI_MASTER) | 950 | #if defined(CONFIG_SPI_MASTER) |
975 | if (setup->spi) { | 951 | if (setup->spi) { |
976 | codec->hw_write = (hw_write_t)wm8750_spi_write; | ||
977 | ret = spi_register_driver(&wm8750_spi_driver); | 952 | ret = spi_register_driver(&wm8750_spi_driver); |
978 | if (ret != 0) | 953 | if (ret != 0) |
979 | printk(KERN_ERR "can't add spi driver"); | 954 | printk(KERN_ERR "can't add spi driver"); |
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 7486d3ec787e..1c8653523c8c 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -979,30 +979,6 @@ static struct i2c_driver wm8988_i2c_driver = { | |||
979 | #endif | 979 | #endif |
980 | 980 | ||
981 | #if defined(CONFIG_SPI_MASTER) | 981 | #if defined(CONFIG_SPI_MASTER) |
982 | static int wm8988_spi_write(struct spi_device *spi, const char *data, int len) | ||
983 | { | ||
984 | struct spi_transfer t; | ||
985 | struct spi_message m; | ||
986 | u8 msg[2]; | ||
987 | |||
988 | if (len <= 0) | ||
989 | return 0; | ||
990 | |||
991 | msg[0] = data[0]; | ||
992 | msg[1] = data[1]; | ||
993 | |||
994 | spi_message_init(&m); | ||
995 | memset(&t, 0, (sizeof t)); | ||
996 | |||
997 | t.tx_buf = &msg[0]; | ||
998 | t.len = len; | ||
999 | |||
1000 | spi_message_add_tail(&t, &m); | ||
1001 | spi_sync(spi, &m); | ||
1002 | |||
1003 | return len; | ||
1004 | } | ||
1005 | |||
1006 | static int __devinit wm8988_spi_probe(struct spi_device *spi) | 982 | static int __devinit wm8988_spi_probe(struct spi_device *spi) |
1007 | { | 983 | { |
1008 | struct wm8988_priv *wm8988; | 984 | struct wm8988_priv *wm8988; |
@@ -1013,7 +989,6 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi) | |||
1013 | return -ENOMEM; | 989 | return -ENOMEM; |
1014 | 990 | ||
1015 | codec = &wm8988->codec; | 991 | codec = &wm8988->codec; |
1016 | codec->hw_write = (hw_write_t)wm8988_spi_write; | ||
1017 | codec->control_data = spi; | 992 | codec->control_data = spi; |
1018 | codec->dev = &spi->dev; | 993 | codec->dev = &spi->dev; |
1019 | 994 | ||
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index ab058b811633..56ec3f22bf1c 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/i2c.h> | 14 | #include <linux/i2c.h> |
15 | #include <linux/spi/spi.h> | ||
15 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
16 | 17 | ||
17 | static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, | 18 | static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, |
@@ -46,6 +47,36 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, | |||
46 | return -EIO; | 47 | return -EIO; |
47 | } | 48 | } |
48 | 49 | ||
50 | #if defined(CONFIG_SPI_MASTER) | ||
51 | static int snd_soc_7_9_spi_write(void *control_data, const char *data, | ||
52 | int len) | ||
53 | { | ||
54 | struct spi_device *spi = control_data; | ||
55 | struct spi_transfer t; | ||
56 | struct spi_message m; | ||
57 | u8 msg[2]; | ||
58 | |||
59 | if (len <= 0) | ||
60 | return 0; | ||
61 | |||
62 | msg[0] = data[0]; | ||
63 | msg[1] = data[1]; | ||
64 | |||
65 | spi_message_init(&m); | ||
66 | memset(&t, 0, (sizeof t)); | ||
67 | |||
68 | t.tx_buf = &msg[0]; | ||
69 | t.len = len; | ||
70 | |||
71 | spi_message_add_tail(&t, &m); | ||
72 | spi_sync(spi, &m); | ||
73 | |||
74 | return len; | ||
75 | } | ||
76 | #else | ||
77 | #define snd_soc_7_9_spi_write NULL | ||
78 | #endif | ||
79 | |||
49 | static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | 80 | static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, |
50 | unsigned int value) | 81 | unsigned int value) |
51 | { | 82 | { |
@@ -115,12 +146,12 @@ static struct { | |||
115 | int addr_bits; | 146 | int addr_bits; |
116 | int data_bits; | 147 | int data_bits; |
117 | int (*write)(struct snd_soc_codec *codec, unsigned int, unsigned int); | 148 | int (*write)(struct snd_soc_codec *codec, unsigned int, unsigned int); |
149 | int (*spi_write)(void *, const char *, int); | ||
118 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); | 150 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); |
119 | unsigned int (*i2c_read)(struct snd_soc_codec *, unsigned int); | 151 | unsigned int (*i2c_read)(struct snd_soc_codec *, unsigned int); |
120 | } io_types[] = { | 152 | } io_types[] = { |
121 | { 7, 9, snd_soc_7_9_write, snd_soc_7_9_read }, | 153 | { 7, 9, snd_soc_7_9_write, snd_soc_7_9_spi_write, snd_soc_7_9_read }, |
122 | { 8, 16, | 154 | { 8, 16, snd_soc_8_16_write, NULL, snd_soc_8_16_read, |
123 | snd_soc_8_16_write, snd_soc_8_16_read, | ||
124 | snd_soc_8_16_read_i2c }, | 155 | snd_soc_8_16_read_i2c }, |
125 | }; | 156 | }; |
126 | 157 | ||
@@ -177,6 +208,8 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
177 | break; | 208 | break; |
178 | 209 | ||
179 | case SND_SOC_SPI: | 210 | case SND_SOC_SPI: |
211 | if (io_types[i].spi_write) | ||
212 | codec->hw_write = io_types[i].spi_write; | ||
180 | break; | 213 | break; |
181 | } | 214 | } |
182 | 215 | ||