aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-03-25 17:22:01 -0400
committerMark Brown <broonie@linaro.org>2014-03-25 17:22:01 -0400
commitacae02c475146a69a6a48c7c8a162c39d5a6521b (patch)
treeebbdae22e0c2e51fc68af9168667a5d2929a2854
parentba052e1b3155da48d80ecf4a98f48a6681f57f27 (diff)
parent56fe48976db38ed3984e0e68b71e503e8179dd89 (diff)
Merge tag 'asoc-v3.15-2' into asoc-next
ASoC: Updates for v3.15 This is mostly a few additional fixes from Lars-Peter, a new driver and cleaning up a git failure with merging the Intel branch (combined with an xargs failure to pay attention to error codes). The history lists a bunch of additional commits for the branch but the content of those commits is actually present already but not recorded in history due to git failing. Unfortunately xargs is used in the merge script and it doesn't do a good job of noticing errors from the commands it invokes. # gpg: Signature made Thu 13 Mar 2014 14:25:44 GMT using RSA key ID 7EA229BD # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
-rw-r--r--Documentation/devicetree/bindings/sound/armada-370db-audio.txt24
-rw-r--r--Documentation/devicetree/bindings/sound/mvebu-audio.txt1
-rw-r--r--Documentation/devicetree/bindings/sound/tlv320aic31xx.txt61
-rw-r--r--MAINTAINERS7
-rw-r--r--include/dt-bindings/sound/tlv320aic31xx-micbias.h8
-rw-r--r--include/sound/soc.h13
-rw-r--r--sound/soc/cirrus/snappercl15.c18
-rw-r--r--sound/soc/codecs/88pm860x-codec.c3
-rw-r--r--sound/soc/codecs/Kconfig4
-rw-r--r--sound/soc/codecs/Makefile2
-rw-r--r--sound/soc/codecs/ad193x.c10
-rw-r--r--sound/soc/codecs/adau1373.c7
-rw-r--r--sound/soc/codecs/adav80x.c7
-rw-r--r--sound/soc/codecs/ak4535.c9
-rw-r--r--sound/soc/codecs/ak4641.c8
-rw-r--r--sound/soc/codecs/ak4642.c8
-rw-r--r--sound/soc/codecs/ak4671.c12
-rw-r--r--sound/soc/codecs/alc5623.c7
-rw-r--r--sound/soc/codecs/alc5632.c8
-rw-r--r--sound/soc/codecs/cq93vc.c3
-rw-r--r--sound/soc/codecs/cs4270.c9
-rw-r--r--sound/soc/codecs/cs42l51.c6
-rw-r--r--sound/soc/codecs/cs42l52.c9
-rw-r--r--sound/soc/codecs/cs42l73.c11
-rw-r--r--sound/soc/codecs/da7210.c8
-rw-r--r--sound/soc/codecs/da7213.c8
-rw-r--r--sound/soc/codecs/da732x.c29
-rw-r--r--sound/soc/codecs/da9055.c8
-rw-r--r--sound/soc/codecs/isabelle.c16
-rw-r--r--sound/soc/codecs/lm4857.c3
-rw-r--r--sound/soc/codecs/lm49453.c31
-rw-r--r--sound/soc/codecs/max9768.c5
-rw-r--r--sound/soc/codecs/max98088.c45
-rw-r--r--sound/soc/codecs/max98090.c8
-rw-r--r--sound/soc/codecs/max98095.c56
-rw-r--r--sound/soc/codecs/max9850.c8
-rw-r--r--sound/soc/codecs/mc13783.c4
-rw-r--r--sound/soc/codecs/ml26124.c10
-rw-r--r--sound/soc/codecs/rt5631.c9
-rw-r--r--sound/soc/codecs/rt5640.c8
-rw-r--r--sound/soc/codecs/sgtl5000.c8
-rw-r--r--sound/soc/codecs/si476x.c6
-rw-r--r--sound/soc/codecs/sn95031.c2
-rw-r--r--sound/soc/codecs/ssm2518.c10
-rw-r--r--sound/soc/codecs/ssm2602.c7
-rw-r--r--sound/soc/codecs/sta32x.c14
-rw-r--r--sound/soc/codecs/sta529.c10
-rw-r--r--sound/soc/codecs/tlv320aic23.c8
-rw-r--r--sound/soc/codecs/tlv320aic26.c2
-rw-r--r--sound/soc/codecs/tlv320aic31xx.c1295
-rw-r--r--sound/soc/codecs/tlv320aic31xx.h258
-rw-r--r--sound/soc/codecs/tlv320aic32x4.c2
-rw-r--r--sound/soc/codecs/tlv320aic3x.c6
-rw-r--r--sound/soc/codecs/tlv320dac33.c1
-rw-r--r--sound/soc/codecs/wm2000.c2
-rw-r--r--sound/soc/codecs/wm2200.c7
-rw-r--r--sound/soc/codecs/wm5100.c7
-rw-r--r--sound/soc/codecs/wm5102.c4
-rw-r--r--sound/soc/codecs/wm5110.c3
-rw-r--r--sound/soc/codecs/wm8350.c4
-rw-r--r--sound/soc/codecs/wm8400.c3
-rw-r--r--sound/soc/codecs/wm8510.c10
-rw-r--r--sound/soc/codecs/wm8523.c7
-rw-r--r--sound/soc/codecs/wm8580.c6
-rw-r--r--sound/soc/codecs/wm8711.c6
-rw-r--r--sound/soc/codecs/wm8728.c11
-rw-r--r--sound/soc/codecs/wm8731.c7
-rw-r--r--sound/soc/codecs/wm8737.c6
-rw-r--r--sound/soc/codecs/wm8741.c6
-rw-r--r--sound/soc/codecs/wm8750.c6
-rw-r--r--sound/soc/codecs/wm8753.c7
-rw-r--r--sound/soc/codecs/wm8770.c6
-rw-r--r--sound/soc/codecs/wm8776.c6
-rw-r--r--sound/soc/codecs/wm8804.c8
-rw-r--r--sound/soc/codecs/wm8900.c8
-rw-r--r--sound/soc/codecs/wm8903.c10
-rw-r--r--sound/soc/codecs/wm8904.c9
-rw-r--r--sound/soc/codecs/wm8940.c6
-rw-r--r--sound/soc/codecs/wm8955.c8
-rw-r--r--sound/soc/codecs/wm8960.c6
-rw-r--r--sound/soc/codecs/wm8961.c7
-rw-r--r--sound/soc/codecs/wm8962.c7
-rw-r--r--sound/soc/codecs/wm8971.c6
-rw-r--r--sound/soc/codecs/wm8974.c6
-rw-r--r--sound/soc/codecs/wm8978.c8
-rw-r--r--sound/soc/codecs/wm8983.c6
-rw-r--r--sound/soc/codecs/wm8985.c7
-rw-r--r--sound/soc/codecs/wm8988.c8
-rw-r--r--sound/soc/codecs/wm8990.c8
-rw-r--r--sound/soc/codecs/wm8991.c8
-rw-r--r--sound/soc/codecs/wm8993.c7
-rw-r--r--sound/soc/codecs/wm8994.c3
-rw-r--r--sound/soc/codecs/wm8995.c7
-rw-r--r--sound/soc/codecs/wm8996.c12
-rw-r--r--sound/soc/codecs/wm8997.c4
-rw-r--r--sound/soc/codecs/wm9081.c11
-rw-r--r--sound/soc/codecs/wm9090.c10
-rw-r--r--sound/soc/intel/Kconfig4
-rw-r--r--sound/soc/kirkwood/Kconfig10
-rw-r--r--sound/soc/kirkwood/Makefile2
-rw-r--r--sound/soc/kirkwood/armada-370-db.c120
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c1
-rw-r--r--sound/soc/omap/ams-delta.c2
-rw-r--r--sound/soc/pxa/magician.c34
-rw-r--r--sound/soc/pxa/tosa.c35
-rw-r--r--sound/soc/s6000/s6105-ipcam.c28
-rw-r--r--sound/soc/soc-core.c14
-rw-r--r--sound/soc/soc-io.c64
-rw-r--r--sound/soc/soc-jack.c5
109 files changed, 1958 insertions, 795 deletions
diff --git a/Documentation/devicetree/bindings/sound/armada-370db-audio.txt b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
new file mode 100644
index 000000000000..3893b4d15a20
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
@@ -0,0 +1,24 @@
1Device Tree bindings for the Armada 370 DB audio
2================================================
3
4These Device Tree bindings are used to describe the audio complex
5found on the Armada 370 DB platform.
6
7Mandatory properties:
8
9 * compatible: must be "marvell,a370db-audio"
10
11 * marvell,audio-controller: a phandle that points to the audio
12 controller of the Armada 370 SoC.
13
14 * marvell,audio-codec: a phandle that points to the analog audio
15 codec connected to the Armada 370 SoC.
16
17Example:
18
19 sound {
20 compatible = "marvell,a370db-audio";
21 marvell,audio-controller = <&audio_controller>;
22 marvell,audio-codec = <&audio_codec>;
23 status = "okay";
24 };
diff --git a/Documentation/devicetree/bindings/sound/mvebu-audio.txt b/Documentation/devicetree/bindings/sound/mvebu-audio.txt
index f0062c5871b4..cb8c07c81ce4 100644
--- a/Documentation/devicetree/bindings/sound/mvebu-audio.txt
+++ b/Documentation/devicetree/bindings/sound/mvebu-audio.txt
@@ -5,6 +5,7 @@ Required properties:
5- compatible: 5- compatible:
6 "marvell,kirkwood-audio" for Kirkwood platforms 6 "marvell,kirkwood-audio" for Kirkwood platforms
7 "marvell,dove-audio" for Dove platforms 7 "marvell,dove-audio" for Dove platforms
8 "marvell,armada370-audio" for Armada 370 platforms
8 9
9- reg: physical base address of the controller and length of memory mapped 10- reg: physical base address of the controller and length of memory mapped
10 region. 11 region.
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt b/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
new file mode 100644
index 000000000000..74c66dee3e14
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
@@ -0,0 +1,61 @@
1Texas Instruments - tlv320aic31xx Codec module
2
3The tlv320aic31xx serial control bus communicates through I2C protocols
4
5Required properties:
6
7- compatible - "string" - One of:
8 "ti,tlv320aic310x" - Generic TLV320AIC31xx with mono speaker amp
9 "ti,tlv320aic311x" - Generic TLV320AIC31xx with stereo speaker amp
10 "ti,tlv320aic3100" - TLV320AIC3100 (mono speaker amp, no MiniDSP)
11 "ti,tlv320aic3110" - TLV320AIC3110 (stereo speaker amp, no MiniDSP)
12 "ti,tlv320aic3120" - TLV320AIC3120 (mono speaker amp, MiniDSP)
13 "ti,tlv320aic3111" - TLV320AIC3111 (stereo speaker amp, MiniDSP)
14
15- reg - <int> - I2C slave address
16
17
18Optional properties:
19
20- gpio-reset - gpio pin number used for codec reset
21- ai31xx-micbias-vg - MicBias Voltage setting
22 1 or MICBIAS_2_0V - MICBIAS output is powered to 2.0V
23 2 or MICBIAS_2_5V - MICBIAS output is powered to 2.5V
24 3 or MICBIAS_AVDD - MICBIAS output is connected to AVDD
25 If this node is not mentioned or if the value is unknown, then
26 micbias is set to 2.0V.
27- HPVDD-supply, SPRVDD-supply, SPLVDD-supply, AVDD-supply, IOVDD-supply,
28 DVDD-supply : power supplies for the device as covered in
29 Documentation/devicetree/bindings/regulator/regulator.txt
30
31CODEC output pins:
32 * HPL
33 * HPR
34 * SPL, devices with stereo speaker amp
35 * SPR, devices with stereo speaker amp
36 * SPK, devices with mono speaker amp
37 * MICBIAS
38
39CODEC input pins:
40 * MIC1LP
41 * MIC1RP
42 * MIC1LM
43
44The pins can be used in referring sound node's audio-routing property.
45
46Example:
47#include <dt-bindings/sound/tlv320aic31xx-micbias.h>
48
49tlv320aic31xx: tlv320aic31xx@18 {
50 compatible = "ti,tlv320aic311x";
51 reg = <0x18>;
52
53 ai31xx-micbias-vg = <MICBIAS_OFF>;
54
55 HPVDD-supply = <&regulator>;
56 SPRVDD-supply = <&regulator>;
57 SPLVDD-supply = <&regulator>;
58 AVDD-supply = <&regulator>;
59 IOVDD-supply = <&regulator>;
60 DVDD-supply = <&regulator>;
61};
diff --git a/MAINTAINERS b/MAINTAINERS
index 82640e640f36..ec01455c7afe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2203,6 +2203,13 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
2203S: Odd Fixes 2203S: Odd Fixes
2204F: sound/soc/codecs/cs4270* 2204F: sound/soc/codecs/cs4270*
2205 2205
2206CIRRUS LOGIC AUDIO CODEC DRIVERS
2207M: Brian Austin <brian.austin@cirrus.com>
2208M: Paul Handrigan <Paul.Handrigan@cirrus.com>
2209L: alsa-devel@alsa-project.org (moderated for non-subscribers)
2210S: Maintained
2211F: sound/soc/codecs/cs*
2212
2206CLEANCACHE API 2213CLEANCACHE API
2207M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 2214M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2208L: linux-kernel@vger.kernel.org 2215L: linux-kernel@vger.kernel.org
diff --git a/include/dt-bindings/sound/tlv320aic31xx-micbias.h b/include/dt-bindings/sound/tlv320aic31xx-micbias.h
new file mode 100644
index 000000000000..f5cb772ab9c8
--- /dev/null
+++ b/include/dt-bindings/sound/tlv320aic31xx-micbias.h
@@ -0,0 +1,8 @@
1#ifndef __DT_TLV320AIC31XX_MICBIAS_H
2#define __DT_TLV320AIC31XX_MICBIAS_H
3
4#define MICBIAS_2_0V 1
5#define MICBIAS_2_5V 2
6#define MICBIAS_AVDDV 3
7
8#endif /* __DT_TLV320AIC31XX_MICBIAS_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 959f38949967..f7de629728bf 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -354,12 +354,6 @@ typedef int (*hw_write_t)(void *,const char* ,int);
354 354
355extern struct snd_ac97_bus_ops *soc_ac97_ops; 355extern struct snd_ac97_bus_ops *soc_ac97_ops;
356 356
357enum snd_soc_control_type {
358 SND_SOC_I2C = 1,
359 SND_SOC_SPI,
360 SND_SOC_REGMAP,
361};
362
363enum snd_soc_pcm_subclass { 357enum snd_soc_pcm_subclass {
364 SND_SOC_PCM_CLASS_PCM = 0, 358 SND_SOC_PCM_CLASS_PCM = 0,
365 SND_SOC_PCM_CLASS_BE = 1, 359 SND_SOC_PCM_CLASS_BE = 1,
@@ -406,8 +400,7 @@ int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
406int snd_soc_codec_writable_register(struct snd_soc_codec *codec, 400int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
407 unsigned int reg); 401 unsigned int reg);
408int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 402int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
409 int addr_bits, int data_bits, 403 struct regmap *regmap);
410 enum snd_soc_control_type control);
411int snd_soc_cache_sync(struct snd_soc_codec *codec); 404int snd_soc_cache_sync(struct snd_soc_codec *codec);
412int snd_soc_cache_init(struct snd_soc_codec *codec); 405int snd_soc_cache_init(struct snd_soc_codec *codec);
413int snd_soc_cache_exit(struct snd_soc_codec *codec); 406int snd_soc_cache_exit(struct snd_soc_codec *codec);
@@ -614,7 +607,8 @@ struct snd_soc_jack_gpio {
614 struct snd_soc_jack *jack; 607 struct snd_soc_jack *jack;
615 struct delayed_work work; 608 struct delayed_work work;
616 609
617 int (*jack_status_check)(void); 610 void *data;
611 int (*jack_status_check)(void *data);
618}; 612};
619 613
620struct snd_soc_jack { 614struct snd_soc_jack {
@@ -717,7 +711,6 @@ struct snd_soc_codec {
717 /* codec IO */ 711 /* codec IO */
718 void *control_data; /* codec control (i2c/3wire) data */ 712 void *control_data; /* codec control (i2c/3wire) data */
719 hw_write_t hw_write; 713 hw_write_t hw_write;
720 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
721 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 714 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
722 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 715 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
723 void *reg_cache; 716 void *reg_cache;
diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c
index 29238a7476dd..5b68b106cfc2 100644
--- a/sound/soc/cirrus/snappercl15.c
+++ b/sound/soc/cirrus/snappercl15.c
@@ -65,18 +65,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
65 {"MICIN", NULL, "Mic Jack"}, 65 {"MICIN", NULL, "Mic Jack"},
66}; 66};
67 67
68static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
69{
70 struct snd_soc_codec *codec = rtd->codec;
71 struct snd_soc_dapm_context *dapm = &codec->dapm;
72
73 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
74 ARRAY_SIZE(tlv320aic23_dapm_widgets));
75
76 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
77 return 0;
78}
79
80static struct snd_soc_dai_link snappercl15_dai = { 68static struct snd_soc_dai_link snappercl15_dai = {
81 .name = "tlv320aic23", 69 .name = "tlv320aic23",
82 .stream_name = "AIC23", 70 .stream_name = "AIC23",
@@ -84,7 +72,6 @@ static struct snd_soc_dai_link snappercl15_dai = {
84 .codec_dai_name = "tlv320aic23-hifi", 72 .codec_dai_name = "tlv320aic23-hifi",
85 .codec_name = "tlv320aic23-codec.0-001a", 73 .codec_name = "tlv320aic23-codec.0-001a",
86 .platform_name = "ep93xx-i2s", 74 .platform_name = "ep93xx-i2s",
87 .init = snappercl15_tlv320aic23_init,
88 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | 75 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
89 SND_SOC_DAIFMT_CBS_CFS, 76 SND_SOC_DAIFMT_CBS_CFS,
90 .ops = &snappercl15_ops, 77 .ops = &snappercl15_ops,
@@ -95,6 +82,11 @@ static struct snd_soc_card snd_soc_snappercl15 = {
95 .owner = THIS_MODULE, 82 .owner = THIS_MODULE,
96 .dai_link = &snappercl15_dai, 83 .dai_link = &snappercl15_dai,
97 .num_links = 1, 84 .num_links = 1,
85
86 .dapm_widgets = tlv320aic23_dapm_widgets,
87 .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets),
88 .dapm_routes = audio_map,
89 .num_dapm_routes = ARRAY_SIZE(audio_map),
98}; 90};
99 91
100static int snappercl15_probe(struct platform_device *pdev) 92static int snappercl15_probe(struct platform_device *pdev)
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 8703244ee9fb..b07e17160f94 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -1327,8 +1327,7 @@ static int pm860x_probe(struct snd_soc_codec *codec)
1327 1327
1328 pm860x->codec = codec; 1328 pm860x->codec = codec;
1329 1329
1330 codec->control_data = pm860x->regmap; 1330 ret = snd_soc_codec_set_cache_io(codec, pm860x->regmap);
1331 ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
1332 if (ret) 1331 if (ret)
1333 return ret; 1332 return ret;
1334 1333
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 32d7a6f04b7d..1a8ff1e541ef 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -85,6 +85,7 @@ config SND_SOC_ALL_CODECS
85 select SND_SOC_TLV320AIC23_I2C if I2C 85 select SND_SOC_TLV320AIC23_I2C if I2C
86 select SND_SOC_TLV320AIC23_SPI if SPI_MASTER 86 select SND_SOC_TLV320AIC23_SPI if SPI_MASTER
87 select SND_SOC_TLV320AIC26 if SPI_MASTER 87 select SND_SOC_TLV320AIC26 if SPI_MASTER
88 select SND_SOC_TLV320AIC31XX if I2C
88 select SND_SOC_TLV320AIC32X4 if I2C 89 select SND_SOC_TLV320AIC32X4 if I2C
89 select SND_SOC_TLV320AIC3X if I2C 90 select SND_SOC_TLV320AIC3X if I2C
90 select SND_SOC_TPA6130A2 if I2C 91 select SND_SOC_TPA6130A2 if I2C
@@ -449,6 +450,9 @@ config SND_SOC_TLV320AIC26
449 tristate 450 tristate
450 depends on SPI 451 depends on SPI
451 452
453config SND_SOC_TLV320AIC31XX
454 tristate
455
452config SND_SOC_TLV320AIC32X4 456config SND_SOC_TLV320AIC32X4
453 tristate 457 tristate
454 458
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index cb46c4c78dc2..73df822885de 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -79,6 +79,7 @@ snd-soc-tlv320aic23-objs := tlv320aic23.o
79snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o 79snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
80snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o 80snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
81snd-soc-tlv320aic26-objs := tlv320aic26.o 81snd-soc-tlv320aic26-objs := tlv320aic26.o
82snd-soc-tlv320aic31xx-objs := tlv320aic31xx.o
82snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o 83snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o
83snd-soc-tlv320aic3x-objs := tlv320aic3x.o 84snd-soc-tlv320aic3x-objs := tlv320aic3x.o
84snd-soc-tlv320dac33-objs := tlv320dac33.o 85snd-soc-tlv320dac33-objs := tlv320dac33.o
@@ -223,6 +224,7 @@ obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o
223obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o 224obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o
224obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o 225obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
225obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o 226obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o
227obj-$(CONFIG_SND_SOC_TLV320AIC31XX) += snd-soc-tlv320aic31xx.o
226obj-$(CONFIG_SND_SOC_TLV320AIC32X4) += snd-soc-tlv320aic32x4.o 228obj-$(CONFIG_SND_SOC_TLV320AIC32X4) += snd-soc-tlv320aic32x4.o
227obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o 229obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o
228obj-$(CONFIG_SND_SOC_TLV320DAC33) += snd-soc-tlv320dac33.o 230obj-$(CONFIG_SND_SOC_TLV320DAC33) += snd-soc-tlv320dac33.o
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index 9381a767e75f..6844d0b2af68 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -322,14 +322,6 @@ static struct snd_soc_dai_driver ad193x_dai = {
322static int ad193x_codec_probe(struct snd_soc_codec *codec) 322static int ad193x_codec_probe(struct snd_soc_codec *codec)
323{ 323{
324 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec); 324 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
325 int ret;
326
327 codec->control_data = ad193x->regmap;
328 ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
329 if (ret < 0) {
330 dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
331 return ret;
332 }
333 325
334 /* default setting for ad193x */ 326 /* default setting for ad193x */
335 327
@@ -347,7 +339,7 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
347 regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */ 339 regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */
348 regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL1, 0x04); 340 regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL1, 0x04);
349 341
350 return ret; 342 return 0;
351} 343}
352 344
353static struct snd_soc_codec_driver soc_codec_dev_ad193x = { 345static struct snd_soc_codec_driver soc_codec_dev_ad193x = {
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index 5223800775ad..877f5737bb6b 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -1376,15 +1376,8 @@ static int adau1373_probe(struct snd_soc_codec *codec)
1376 struct adau1373_platform_data *pdata = codec->dev->platform_data; 1376 struct adau1373_platform_data *pdata = codec->dev->platform_data;
1377 bool lineout_differential = false; 1377 bool lineout_differential = false;
1378 unsigned int val; 1378 unsigned int val;
1379 int ret;
1380 int i; 1379 int i;
1381 1380
1382 ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
1383 if (ret) {
1384 dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
1385 return ret;
1386 }
1387
1388 if (pdata) { 1381 if (pdata) {
1389 if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting)) 1382 if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting))
1390 return -EINVAL; 1383 return -EINVAL;
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index 7470831ba756..5062e34ee8dc 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -801,15 +801,8 @@ static struct snd_soc_dai_driver adav80x_dais[] = {
801 801
802static int adav80x_probe(struct snd_soc_codec *codec) 802static int adav80x_probe(struct snd_soc_codec *codec)
803{ 803{
804 int ret;
805 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); 804 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
806 805
807 ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
808 if (ret) {
809 dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
810 return ret;
811 }
812
813 /* Force PLLs on for SYSCLK output */ 806 /* Force PLLs on for SYSCLK output */
814 snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1"); 807 snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1");
815 snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2"); 808 snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2");
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index 684fe910669f..30e297890fec 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -388,15 +388,6 @@ static int ak4535_resume(struct snd_soc_codec *codec)
388 388
389static int ak4535_probe(struct snd_soc_codec *codec) 389static int ak4535_probe(struct snd_soc_codec *codec)
390{ 390{
391 struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec);
392 int ret;
393
394 codec->control_data = ak4535->regmap;
395 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
396 if (ret < 0) {
397 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
398 return ret;
399 }
400 /* power on device */ 391 /* power on device */
401 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 392 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
402 393
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 684b56f2856a..868c0e2da1ec 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -519,14 +519,6 @@ static int ak4641_resume(struct snd_soc_codec *codec)
519 519
520static int ak4641_probe(struct snd_soc_codec *codec) 520static int ak4641_probe(struct snd_soc_codec *codec)
521{ 521{
522 int ret;
523
524 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
525 if (ret != 0) {
526 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
527 return ret;
528 }
529
530 /* power on device */ 522 /* power on device */
531 ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 523 ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
532 524
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 1f646c6e90c6..92655cc189ae 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -465,14 +465,6 @@ static int ak4642_resume(struct snd_soc_codec *codec)
465 465
466static int ak4642_probe(struct snd_soc_codec *codec) 466static int ak4642_probe(struct snd_soc_codec *codec)
467{ 467{
468 int ret;
469
470 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
471 if (ret < 0) {
472 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
473 return ret;
474 }
475
476 ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 468 ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
477 469
478 return 0; 470 return 0;
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index deb2b44669de..998fa0c5a0b9 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -613,17 +613,7 @@ static struct snd_soc_dai_driver ak4671_dai = {
613 613
614static int ak4671_probe(struct snd_soc_codec *codec) 614static int ak4671_probe(struct snd_soc_codec *codec)
615{ 615{
616 int ret; 616 return ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
617
618 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
619 if (ret < 0) {
620 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
621 return ret;
622 }
623
624 ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
625
626 return ret;
627} 617}
628 618
629static int ak4671_remove(struct snd_soc_codec *codec) 619static int ak4671_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index ed506253a914..09f7e773bafb 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -904,13 +904,6 @@ static int alc5623_probe(struct snd_soc_codec *codec)
904 struct snd_soc_dapm_context *dapm = &codec->dapm; 904 struct snd_soc_dapm_context *dapm = &codec->dapm;
905 int ret; 905 int ret;
906 906
907 codec->control_data = alc5623->regmap;
908 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
909 if (ret < 0) {
910 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
911 return ret;
912 }
913
914 alc5623_reset(codec); 907 alc5623_reset(codec);
915 908
916 /* power on device */ 909 /* power on device */
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c
index d885056ad8f2..ec071a6306ef 100644
--- a/sound/soc/codecs/alc5632.c
+++ b/sound/soc/codecs/alc5632.c
@@ -1063,14 +1063,6 @@ static int alc5632_probe(struct snd_soc_codec *codec)
1063 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); 1063 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
1064 int ret; 1064 int ret;
1065 1065
1066 codec->control_data = alc5632->regmap;
1067
1068 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1069 if (ret != 0) {
1070 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1071 return ret;
1072 }
1073
1074 /* power on device */ 1066 /* power on device */
1075 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1067 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1076 1068
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
index 43737a27d79c..1e25c7af853b 100644
--- a/sound/soc/codecs/cq93vc.c
+++ b/sound/soc/codecs/cq93vc.c
@@ -138,9 +138,8 @@ static int cq93vc_probe(struct snd_soc_codec *codec)
138 struct davinci_vc *davinci_vc = codec->dev->platform_data; 138 struct davinci_vc *davinci_vc = codec->dev->platform_data;
139 139
140 davinci_vc->cq93vc.codec = codec; 140 davinci_vc->cq93vc.codec = codec;
141 codec->control_data = davinci_vc->regmap;
142 141
143 snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP); 142 snd_soc_codec_set_cache_io(codec, davinci_vc->regmap);
144 143
145 /* Off, with power on */ 144 /* Off, with power on */
146 cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 145 cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 83c835d9fd88..3920e6264948 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -506,15 +506,6 @@ static int cs4270_probe(struct snd_soc_codec *codec)
506 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); 506 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
507 int ret; 507 int ret;
508 508
509 /* Tell ASoC what kind of I/O to use to read the registers. ASoC will
510 * then do the I2C transactions itself.
511 */
512 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
513 if (ret < 0) {
514 dev_err(codec->dev, "failed to set cache I/O (ret=%i)\n", ret);
515 return ret;
516 }
517
518 /* Disable auto-mute. This feature appears to be buggy. In some 509 /* Disable auto-mute. This feature appears to be buggy. In some
519 * situations, auto-mute will not deactivate when it should, so we want 510 * situations, auto-mute will not deactivate when it should, so we want
520 * this feature disabled by default. An application (e.g. alsactl) can 511 * this feature disabled by default. An application (e.g. alsactl) can
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 828157779057..6c0da2baa154 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -487,12 +487,6 @@ static int cs42l51_probe(struct snd_soc_codec *codec)
487{ 487{
488 int ret, reg; 488 int ret, reg;
489 489
490 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
491 if (ret < 0) {
492 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
493 return ret;
494 }
495
496 /* 490 /*
497 * DAC configuration 491 * DAC configuration
498 * - Use signal processor 492 * - Use signal processor
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index ea7938d9e13a..f0ca6bee6771 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -1109,14 +1109,7 @@ static void cs42l52_free_beep(struct snd_soc_codec *codec)
1109static int cs42l52_probe(struct snd_soc_codec *codec) 1109static int cs42l52_probe(struct snd_soc_codec *codec)
1110{ 1110{
1111 struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec); 1111 struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
1112 int ret;
1113 1112
1114 codec->control_data = cs42l52->regmap;
1115 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1116 if (ret < 0) {
1117 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1118 return ret;
1119 }
1120 regcache_cache_only(cs42l52->regmap, true); 1113 regcache_cache_only(cs42l52->regmap, true);
1121 1114
1122 cs42l52_add_mic_controls(codec); 1115 cs42l52_add_mic_controls(codec);
@@ -1128,7 +1121,7 @@ static int cs42l52_probe(struct snd_soc_codec *codec)
1128 cs42l52->sysclk = CS42L52_DEFAULT_CLK; 1121 cs42l52->sysclk = CS42L52_DEFAULT_CLK;
1129 cs42l52->config.format = CS42L52_DEFAULT_FORMAT; 1122 cs42l52->config.format = CS42L52_DEFAULT_FORMAT;
1130 1123
1131 return ret; 1124 return 0;
1132} 1125}
1133 1126
1134static int cs42l52_remove(struct snd_soc_codec *codec) 1127static int cs42l52_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index e5778c015c8d..0ee60a19a263 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -1345,17 +1345,8 @@ static int cs42l73_resume(struct snd_soc_codec *codec)
1345 1345
1346static int cs42l73_probe(struct snd_soc_codec *codec) 1346static int cs42l73_probe(struct snd_soc_codec *codec)
1347{ 1347{
1348 int ret;
1349 struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); 1348 struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec);
1350 1349
1351 codec->control_data = cs42l73->regmap;
1352
1353 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1354 if (ret < 0) {
1355 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1356 return ret;
1357 }
1358
1359 cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1350 cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1360 1351
1361 /* Set Charge Pump Frequency */ 1352 /* Set Charge Pump Frequency */
@@ -1368,7 +1359,7 @@ static int cs42l73_probe(struct snd_soc_codec *codec)
1368 cs42l73->mclksel = CS42L73_CLKID_MCLK1; 1359 cs42l73->mclksel = CS42L73_CLKID_MCLK1;
1369 cs42l73->mclk = 0; 1360 cs42l73->mclk = 0;
1370 1361
1371 return ret; 1362 return 0;
1372} 1363}
1373 1364
1374static int cs42l73_remove(struct snd_soc_codec *codec) 1365static int cs42l73_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 01e55fc72307..137e8ebc092c 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -1071,17 +1071,9 @@ static struct snd_soc_dai_driver da7210_dai = {
1071static int da7210_probe(struct snd_soc_codec *codec) 1071static int da7210_probe(struct snd_soc_codec *codec)
1072{ 1072{
1073 struct da7210_priv *da7210 = snd_soc_codec_get_drvdata(codec); 1073 struct da7210_priv *da7210 = snd_soc_codec_get_drvdata(codec);
1074 int ret;
1075 1074
1076 dev_info(codec->dev, "DA7210 Audio Codec %s\n", DA7210_VERSION); 1075 dev_info(codec->dev, "DA7210 Audio Codec %s\n", DA7210_VERSION);
1077 1076
1078 codec->control_data = da7210->regmap;
1079 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1080 if (ret < 0) {
1081 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1082 return ret;
1083 }
1084
1085 da7210->mclk_rate = 0; /* This will be set from set_sysclk() */ 1077 da7210->mclk_rate = 0; /* This will be set from set_sysclk() */
1086 da7210->master = 0; /* This will be set from set_fmt() */ 1078 da7210->master = 0; /* This will be set from set_fmt() */
1087 1079
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 439d10387f10..738fa18a50d2 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -1393,17 +1393,9 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec,
1393 1393
1394static int da7213_probe(struct snd_soc_codec *codec) 1394static int da7213_probe(struct snd_soc_codec *codec)
1395{ 1395{
1396 int ret;
1397 struct da7213_priv *da7213 = snd_soc_codec_get_drvdata(codec); 1396 struct da7213_priv *da7213 = snd_soc_codec_get_drvdata(codec);
1398 struct da7213_platform_data *pdata = da7213->pdata; 1397 struct da7213_platform_data *pdata = da7213->pdata;
1399 1398
1400 codec->control_data = da7213->regmap;
1401 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1402 if (ret < 0) {
1403 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1404 return ret;
1405 }
1406
1407 /* Default to using ALC auto offset calibration mode. */ 1399 /* Default to using ALC auto offset calibration mode. */
1408 snd_soc_update_bits(codec, DA7213_ALC_CTRL1, 1400 snd_soc_update_bits(codec, DA7213_ALC_CTRL1,
1409 DA7213_ALC_CALIB_MODE_MAN, 0); 1401 DA7213_ALC_CALIB_MODE_MAN, 0);
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c
index 4d1c302f5a76..7d168ec71cd7 100644
--- a/sound/soc/codecs/da732x.c
+++ b/sound/soc/codecs/da732x.c
@@ -1297,9 +1297,9 @@ static void da732x_dac_offset_adjust(struct snd_soc_codec *codec)
1297 msleep(DA732X_WAIT_FOR_STABILIZATION); 1297 msleep(DA732X_WAIT_FOR_STABILIZATION);
1298 1298
1299 /* Check DAC offset sign */ 1299 /* Check DAC offset sign */
1300 sign[DA732X_HPL_DAC] = (codec->hw_read(codec, DA732X_REG_HPL_DAC_OFF_CNTL) & 1300 sign[DA732X_HPL_DAC] = (snd_soc_read(codec, DA732X_REG_HPL_DAC_OFF_CNTL) &
1301 DA732X_HP_DAC_OFF_CNTL_COMPO); 1301 DA732X_HP_DAC_OFF_CNTL_COMPO);
1302 sign[DA732X_HPR_DAC] = (codec->hw_read(codec, DA732X_REG_HPR_DAC_OFF_CNTL) & 1302 sign[DA732X_HPR_DAC] = (snd_soc_read(codec, DA732X_REG_HPR_DAC_OFF_CNTL) &
1303 DA732X_HP_DAC_OFF_CNTL_COMPO); 1303 DA732X_HP_DAC_OFF_CNTL_COMPO);
1304 1304
1305 /* Binary search DAC offset values (both channels at once) */ 1305 /* Binary search DAC offset values (both channels at once) */
@@ -1316,10 +1316,10 @@ static void da732x_dac_offset_adjust(struct snd_soc_codec *codec)
1316 1316
1317 msleep(DA732X_WAIT_FOR_STABILIZATION); 1317 msleep(DA732X_WAIT_FOR_STABILIZATION);
1318 1318
1319 if ((codec->hw_read(codec, DA732X_REG_HPL_DAC_OFF_CNTL) & 1319 if ((snd_soc_read(codec, DA732X_REG_HPL_DAC_OFF_CNTL) &
1320 DA732X_HP_DAC_OFF_CNTL_COMPO) ^ sign[DA732X_HPL_DAC]) 1320 DA732X_HP_DAC_OFF_CNTL_COMPO) ^ sign[DA732X_HPL_DAC])
1321 offset[DA732X_HPL_DAC] &= ~step; 1321 offset[DA732X_HPL_DAC] &= ~step;
1322 if ((codec->hw_read(codec, DA732X_REG_HPR_DAC_OFF_CNTL) & 1322 if ((snd_soc_read(codec, DA732X_REG_HPR_DAC_OFF_CNTL) &
1323 DA732X_HP_DAC_OFF_CNTL_COMPO) ^ sign[DA732X_HPR_DAC]) 1323 DA732X_HP_DAC_OFF_CNTL_COMPO) ^ sign[DA732X_HPR_DAC])
1324 offset[DA732X_HPR_DAC] &= ~step; 1324 offset[DA732X_HPR_DAC] &= ~step;
1325 1325
@@ -1360,9 +1360,9 @@ static void da732x_output_offset_adjust(struct snd_soc_codec *codec)
1360 msleep(DA732X_WAIT_FOR_STABILIZATION); 1360 msleep(DA732X_WAIT_FOR_STABILIZATION);
1361 1361
1362 /* Check output offset sign */ 1362 /* Check output offset sign */
1363 sign[DA732X_HPL_AMP] = codec->hw_read(codec, DA732X_REG_HPL) & 1363 sign[DA732X_HPL_AMP] = snd_soc_read(codec, DA732X_REG_HPL) &
1364 DA732X_HP_OUT_COMPO; 1364 DA732X_HP_OUT_COMPO;
1365 sign[DA732X_HPR_AMP] = codec->hw_read(codec, DA732X_REG_HPR) & 1365 sign[DA732X_HPR_AMP] = snd_soc_read(codec, DA732X_REG_HPR) &
1366 DA732X_HP_OUT_COMPO; 1366 DA732X_HP_OUT_COMPO;
1367 1367
1368 snd_soc_write(codec, DA732X_REG_HPL, DA732X_HP_OUT_COMP | 1368 snd_soc_write(codec, DA732X_REG_HPL, DA732X_HP_OUT_COMP |
@@ -1383,10 +1383,10 @@ static void da732x_output_offset_adjust(struct snd_soc_codec *codec)
1383 1383
1384 msleep(DA732X_WAIT_FOR_STABILIZATION); 1384 msleep(DA732X_WAIT_FOR_STABILIZATION);
1385 1385
1386 if ((codec->hw_read(codec, DA732X_REG_HPL) & 1386 if ((snd_soc_read(codec, DA732X_REG_HPL) &
1387 DA732X_HP_OUT_COMPO) ^ sign[DA732X_HPL_AMP]) 1387 DA732X_HP_OUT_COMPO) ^ sign[DA732X_HPL_AMP])
1388 offset[DA732X_HPL_AMP] &= ~step; 1388 offset[DA732X_HPL_AMP] &= ~step;
1389 if ((codec->hw_read(codec, DA732X_REG_HPR) & 1389 if ((snd_soc_read(codec, DA732X_REG_HPR) &
1390 DA732X_HP_OUT_COMPO) ^ sign[DA732X_HPR_AMP]) 1390 DA732X_HP_OUT_COMPO) ^ sign[DA732X_HPR_AMP])
1391 offset[DA732X_HPR_AMP] &= ~step; 1391 offset[DA732X_HPR_AMP] &= ~step;
1392 1392
@@ -1512,23 +1512,14 @@ static int da732x_probe(struct snd_soc_codec *codec)
1512{ 1512{
1513 struct da732x_priv *da732x = snd_soc_codec_get_drvdata(codec); 1513 struct da732x_priv *da732x = snd_soc_codec_get_drvdata(codec);
1514 struct snd_soc_dapm_context *dapm = &codec->dapm; 1514 struct snd_soc_dapm_context *dapm = &codec->dapm;
1515 int ret = 0;
1516 1515
1517 da732x->codec = codec; 1516 da732x->codec = codec;
1518 1517
1519 dapm->idle_bias_off = false; 1518 dapm->idle_bias_off = false;
1520 1519
1521 codec->control_data = da732x->regmap;
1522
1523 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1524 if (ret != 0) {
1525 dev_err(codec->dev, "Failed to register codec.\n");
1526 goto err;
1527 }
1528
1529 da732x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1520 da732x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1530err: 1521
1531 return ret; 1522 return 0;
1532} 1523}
1533 1524
1534static int da732x_remove(struct snd_soc_codec *codec) 1525static int da732x_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index f118daa91234..4ff06b50fbba 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -1383,16 +1383,8 @@ static int da9055_set_bias_level(struct snd_soc_codec *codec,
1383 1383
1384static int da9055_probe(struct snd_soc_codec *codec) 1384static int da9055_probe(struct snd_soc_codec *codec)
1385{ 1385{
1386 int ret;
1387 struct da9055_priv *da9055 = snd_soc_codec_get_drvdata(codec); 1386 struct da9055_priv *da9055 = snd_soc_codec_get_drvdata(codec);
1388 1387
1389 codec->control_data = da9055->regmap;
1390 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1391 if (ret < 0) {
1392 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1393 return ret;
1394 }
1395
1396 /* Enable all Gain Ramps */ 1388 /* Enable all Gain Ramps */
1397 snd_soc_update_bits(codec, DA9055_AUX_L_CTRL, 1389 snd_soc_update_bits(codec, DA9055_AUX_L_CTRL,
1398 DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN); 1390 DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN);
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c
index cb736ddc446d..3e264a78017a 100644
--- a/sound/soc/codecs/isabelle.c
+++ b/sound/soc/codecs/isabelle.c
@@ -1090,23 +1090,7 @@ static struct snd_soc_dai_driver isabelle_dai[] = {
1090 }, 1090 },
1091}; 1091};
1092 1092
1093static int isabelle_probe(struct snd_soc_codec *codec)
1094{
1095 int ret = 0;
1096
1097 codec->control_data = dev_get_regmap(codec->dev, NULL);
1098
1099 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1100 if (ret < 0) {
1101 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1102 return ret;
1103 }
1104
1105 return 0;
1106}
1107
1108static struct snd_soc_codec_driver soc_codec_dev_isabelle = { 1093static struct snd_soc_codec_driver soc_codec_dev_isabelle = {
1109 .probe = isabelle_probe,
1110 .set_bias_level = isabelle_set_bias_level, 1094 .set_bias_level = isabelle_set_bias_level,
1111 .controls = isabelle_snd_controls, 1095 .controls = isabelle_snd_controls,
1112 .num_controls = ARRAY_SIZE(isabelle_snd_controls), 1096 .num_controls = ARRAY_SIZE(isabelle_snd_controls),
diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c
index 0e5743ea79df..4f048db9f55f 100644
--- a/sound/soc/codecs/lm4857.c
+++ b/sound/soc/codecs/lm4857.c
@@ -101,8 +101,7 @@ static const char *lm4857_mode[] = {
101 "Headphone", 101 "Headphone",
102}; 102};
103 103
104static const struct soc_enum lm4857_mode_enum = 104static SOC_ENUM_SINGLE_EXT_DECL(lm4857_mode_enum, lm4857_mode);
105 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(lm4857_mode), lm4857_mode);
106 105
107static const struct snd_soc_dapm_widget lm4857_dapm_widgets[] = { 106static const struct snd_soc_dapm_widget lm4857_dapm_widgets[] = {
108 SND_SOC_DAPM_INPUT("IN"), 107 SND_SOC_DAPM_INPUT("IN"),
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index 6b7fe5e54881..275b3f72f3f4 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -213,15 +213,13 @@ static const char *lm49453_adcl_mux_text[] = { "MIC1", "Aux_L" };
213 213
214static const char *lm49453_adcr_mux_text[] = { "MIC2", "Aux_R" }; 214static const char *lm49453_adcr_mux_text[] = { "MIC2", "Aux_R" };
215 215
216static const struct soc_enum lm49453_adcl_enum = 216static SOC_ENUM_SINGLE_DECL(lm49453_adcl_enum,
217 SOC_ENUM_SINGLE(LM49453_P0_ANALOG_MIXER_ADC_REG, 0, 217 LM49453_P0_ANALOG_MIXER_ADC_REG, 0,
218 ARRAY_SIZE(lm49453_adcl_mux_text), 218 lm49453_adcl_mux_text);
219 lm49453_adcl_mux_text);
220 219
221static const struct soc_enum lm49453_adcr_enum = 220static SOC_ENUM_SINGLE_DECL(lm49453_adcr_enum,
222 SOC_ENUM_SINGLE(LM49453_P0_ANALOG_MIXER_ADC_REG, 1, 221 LM49453_P0_ANALOG_MIXER_ADC_REG, 1,
223 ARRAY_SIZE(lm49453_adcr_mux_text), 222 lm49453_adcr_mux_text);
224 lm49453_adcr_mux_text);
225 223
226static const struct snd_kcontrol_new lm49453_adcl_mux_control = 224static const struct snd_kcontrol_new lm49453_adcl_mux_control =
227 SOC_DAPM_ENUM("ADC Left Mux", lm49453_adcl_enum); 225 SOC_DAPM_ENUM("ADC Left Mux", lm49453_adcl_enum);
@@ -1409,22 +1407,6 @@ static int lm49453_resume(struct snd_soc_codec *codec)
1409 return 0; 1407 return 0;
1410} 1408}
1411 1409
1412static int lm49453_probe(struct snd_soc_codec *codec)
1413{
1414 struct lm49453_priv *lm49453 = snd_soc_codec_get_drvdata(codec);
1415 int ret = 0;
1416
1417 codec->control_data = lm49453->regmap;
1418
1419 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1420 if (ret < 0) {
1421 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1422 return ret;
1423 }
1424
1425 return 0;
1426}
1427
1428/* power down chip */ 1410/* power down chip */
1429static int lm49453_remove(struct snd_soc_codec *codec) 1411static int lm49453_remove(struct snd_soc_codec *codec)
1430{ 1412{
@@ -1433,7 +1415,6 @@ static int lm49453_remove(struct snd_soc_codec *codec)
1433} 1415}
1434 1416
1435static struct snd_soc_codec_driver soc_codec_dev_lm49453 = { 1417static struct snd_soc_codec_driver soc_codec_dev_lm49453 = {
1436 .probe = lm49453_probe,
1437 .remove = lm49453_remove, 1418 .remove = lm49453_remove,
1438 .suspend = lm49453_suspend, 1419 .suspend = lm49453_suspend,
1439 .resume = lm49453_resume, 1420 .resume = lm49453_resume,
diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c
index 31f91560e9f6..ec481fc428c7 100644
--- a/sound/soc/codecs/max9768.c
+++ b/sound/soc/codecs/max9768.c
@@ -135,11 +135,6 @@ static int max9768_probe(struct snd_soc_codec *codec)
135 struct max9768 *max9768 = snd_soc_codec_get_drvdata(codec); 135 struct max9768 *max9768 = snd_soc_codec_get_drvdata(codec);
136 int ret; 136 int ret;
137 137
138 codec->control_data = max9768->regmap;
139 ret = snd_soc_codec_set_cache_io(codec, 2, 6, SND_SOC_REGMAP);
140 if (ret)
141 return ret;
142
143 if (max9768->flags & MAX9768_FLAG_CLASSIC_PWM) { 138 if (max9768->flags & MAX9768_FLAG_CLASSIC_PWM) {
144 ret = snd_soc_write(codec, MAX9768_CTRL, MAX9768_CTRL_PWM); 139 ret = snd_soc_write(codec, MAX9768_CTRL, MAX9768_CTRL_PWM);
145 if (ret) 140 if (ret)
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index bb1ecfc4459b..ef7cf89f5623 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -597,28 +597,27 @@ static const unsigned int max98088_exmode_values[] = {
597 0x00, 0x43, 0x10, 0x20, 0x30, 0x40, 0x11, 0x22, 0x32 597 0x00, 0x43, 0x10, 0x20, 0x30, 0x40, 0x11, 0x22, 0x32
598}; 598};
599 599
600static const struct soc_enum max98088_exmode_enum = 600static SOC_VALUE_ENUM_SINGLE_DECL(max98088_exmode_enum,
601 SOC_VALUE_ENUM_SINGLE(M98088_REG_41_SPKDHP, 0, 127, 601 M98088_REG_41_SPKDHP, 0, 127,
602 ARRAY_SIZE(max98088_exmode_texts), 602 max98088_exmode_texts,
603 max98088_exmode_texts, 603 max98088_exmode_values);
604 max98088_exmode_values);
605 604
606static const char *max98088_ex_thresh[] = { /* volts PP */ 605static const char *max98088_ex_thresh[] = { /* volts PP */
607 "0.6", "1.2", "1.8", "2.4", "3.0", "3.6", "4.2", "4.8"}; 606 "0.6", "1.2", "1.8", "2.4", "3.0", "3.6", "4.2", "4.8"};
608static const struct soc_enum max98088_ex_thresh_enum[] = { 607static SOC_ENUM_SINGLE_DECL(max98088_ex_thresh_enum,
609 SOC_ENUM_SINGLE(M98088_REG_42_SPKDHP_THRESH, 0, 8, 608 M98088_REG_42_SPKDHP_THRESH, 0,
610 max98088_ex_thresh), 609 max98088_ex_thresh);
611};
612 610
613static const char *max98088_fltr_mode[] = {"Voice", "Music" }; 611static const char *max98088_fltr_mode[] = {"Voice", "Music" };
614static const struct soc_enum max98088_filter_mode_enum[] = { 612static SOC_ENUM_SINGLE_DECL(max98088_filter_mode_enum,
615 SOC_ENUM_SINGLE(M98088_REG_18_DAI1_FILTERS, 7, 2, max98088_fltr_mode), 613 M98088_REG_18_DAI1_FILTERS, 7,
616}; 614 max98088_fltr_mode);
617 615
618static const char *max98088_extmic_text[] = { "None", "MIC1", "MIC2" }; 616static const char *max98088_extmic_text[] = { "None", "MIC1", "MIC2" };
619 617
620static const struct soc_enum max98088_extmic_enum = 618static SOC_ENUM_SINGLE_DECL(max98088_extmic_enum,
621 SOC_ENUM_SINGLE(M98088_REG_48_CFG_MIC, 0, 3, max98088_extmic_text); 619 M98088_REG_48_CFG_MIC, 0,
620 max98088_extmic_text);
622 621
623static const struct snd_kcontrol_new max98088_extmic_mux = 622static const struct snd_kcontrol_new max98088_extmic_mux =
624 SOC_DAPM_ENUM("External MIC Mux", max98088_extmic_enum); 623 SOC_DAPM_ENUM("External MIC Mux", max98088_extmic_enum);
@@ -626,12 +625,12 @@ static const struct snd_kcontrol_new max98088_extmic_mux =
626static const char *max98088_dai1_fltr[] = { 625static const char *max98088_dai1_fltr[] = {
627 "Off", "fc=258/fs=16k", "fc=500/fs=16k", 626 "Off", "fc=258/fs=16k", "fc=500/fs=16k",
628 "fc=258/fs=8k", "fc=500/fs=8k", "fc=200"}; 627 "fc=258/fs=8k", "fc=500/fs=8k", "fc=200"};
629static const struct soc_enum max98088_dai1_dac_filter_enum[] = { 628static SOC_ENUM_SINGLE_DECL(max98088_dai1_dac_filter_enum,
630 SOC_ENUM_SINGLE(M98088_REG_18_DAI1_FILTERS, 0, 6, max98088_dai1_fltr), 629 M98088_REG_18_DAI1_FILTERS, 0,
631}; 630 max98088_dai1_fltr);
632static const struct soc_enum max98088_dai1_adc_filter_enum[] = { 631static SOC_ENUM_SINGLE_DECL(max98088_dai1_adc_filter_enum,
633 SOC_ENUM_SINGLE(M98088_REG_18_DAI1_FILTERS, 4, 6, max98088_dai1_fltr), 632 M98088_REG_18_DAI1_FILTERS, 4,
634}; 633 max98088_dai1_fltr);
635 634
636static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol, 635static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol,
637 struct snd_ctl_elem_value *ucontrol) 636 struct snd_ctl_elem_value *ucontrol)
@@ -1915,12 +1914,6 @@ static int max98088_probe(struct snd_soc_codec *codec)
1915 1914
1916 regcache_mark_dirty(max98088->regmap); 1915 regcache_mark_dirty(max98088->regmap);
1917 1916
1918 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1919 if (ret != 0) {
1920 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1921 return ret;
1922 }
1923
1924 /* initialize private data */ 1917 /* initialize private data */
1925 1918
1926 max98088->sysclk = (unsigned)-1; 1919 max98088->sysclk = (unsigned)-1;
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index f363de19be07..96a47459b3d7 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2218,14 +2218,6 @@ static int max98090_probe(struct snd_soc_codec *codec)
2218 2218
2219 max98090->codec = codec; 2219 max98090->codec = codec;
2220 2220
2221 codec->control_data = max98090->regmap;
2222
2223 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
2224 if (ret != 0) {
2225 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2226 return ret;
2227 }
2228
2229 /* Reset the codec, the DSP core, and disable all interrupts */ 2221 /* Reset the codec, the DSP core, and disable all interrupts */
2230 max98090_reset(max98090); 2222 max98090_reset(max98090);
2231 2223
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index 5bce9cde4a6d..03f0536e6f61 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -560,25 +560,27 @@ static void m98095_biquad_band(struct snd_soc_codec *codec, unsigned int dai,
560} 560}
561 561
562static const char * const max98095_fltr_mode[] = { "Voice", "Music" }; 562static const char * const max98095_fltr_mode[] = { "Voice", "Music" };
563static const struct soc_enum max98095_dai1_filter_mode_enum[] = { 563static SOC_ENUM_SINGLE_DECL(max98095_dai1_filter_mode_enum,
564 SOC_ENUM_SINGLE(M98095_02E_DAI1_FILTERS, 7, 2, max98095_fltr_mode), 564 M98095_02E_DAI1_FILTERS, 7,
565}; 565 max98095_fltr_mode);
566static const struct soc_enum max98095_dai2_filter_mode_enum[] = { 566static SOC_ENUM_SINGLE_DECL(max98095_dai2_filter_mode_enum,
567 SOC_ENUM_SINGLE(M98095_038_DAI2_FILTERS, 7, 2, max98095_fltr_mode), 567 M98095_038_DAI2_FILTERS, 7,
568}; 568 max98095_fltr_mode);
569 569
570static const char * const max98095_extmic_text[] = { "None", "MIC1", "MIC2" }; 570static const char * const max98095_extmic_text[] = { "None", "MIC1", "MIC2" };
571 571
572static const struct soc_enum max98095_extmic_enum = 572static SOC_ENUM_SINGLE_DECL(max98095_extmic_enum,
573 SOC_ENUM_SINGLE(M98095_087_CFG_MIC, 0, 3, max98095_extmic_text); 573 M98095_087_CFG_MIC, 0,
574 max98095_extmic_text);
574 575
575static const struct snd_kcontrol_new max98095_extmic_mux = 576static const struct snd_kcontrol_new max98095_extmic_mux =
576 SOC_DAPM_ENUM("External MIC Mux", max98095_extmic_enum); 577 SOC_DAPM_ENUM("External MIC Mux", max98095_extmic_enum);
577 578
578static const char * const max98095_linein_text[] = { "INA", "INB" }; 579static const char * const max98095_linein_text[] = { "INA", "INB" };
579 580
580static const struct soc_enum max98095_linein_enum = 581static SOC_ENUM_SINGLE_DECL(max98095_linein_enum,
581 SOC_ENUM_SINGLE(M98095_086_CFG_LINE, 6, 2, max98095_linein_text); 582 M98095_086_CFG_LINE, 6,
583 max98095_linein_text);
582 584
583static const struct snd_kcontrol_new max98095_linein_mux = 585static const struct snd_kcontrol_new max98095_linein_mux =
584 SOC_DAPM_ENUM("Linein Input Mux", max98095_linein_enum); 586 SOC_DAPM_ENUM("Linein Input Mux", max98095_linein_enum);
@@ -586,24 +588,26 @@ static const struct snd_kcontrol_new max98095_linein_mux =
586static const char * const max98095_line_mode_text[] = { 588static const char * const max98095_line_mode_text[] = {
587 "Stereo", "Differential"}; 589 "Stereo", "Differential"};
588 590
589static const struct soc_enum max98095_linein_mode_enum = 591static SOC_ENUM_SINGLE_DECL(max98095_linein_mode_enum,
590 SOC_ENUM_SINGLE(M98095_086_CFG_LINE, 7, 2, max98095_line_mode_text); 592 M98095_086_CFG_LINE, 7,
593 max98095_line_mode_text);
591 594
592static const struct soc_enum max98095_lineout_mode_enum = 595static SOC_ENUM_SINGLE_DECL(max98095_lineout_mode_enum,
593 SOC_ENUM_SINGLE(M98095_086_CFG_LINE, 4, 2, max98095_line_mode_text); 596 M98095_086_CFG_LINE, 4,
597 max98095_line_mode_text);
594 598
595static const char * const max98095_dai_fltr[] = { 599static const char * const max98095_dai_fltr[] = {
596 "Off", "Elliptical-HPF-16k", "Butterworth-HPF-16k", 600 "Off", "Elliptical-HPF-16k", "Butterworth-HPF-16k",
597 "Elliptical-HPF-8k", "Butterworth-HPF-8k", "Butterworth-HPF-Fs/240"}; 601 "Elliptical-HPF-8k", "Butterworth-HPF-8k", "Butterworth-HPF-Fs/240"};
598static const struct soc_enum max98095_dai1_dac_filter_enum[] = { 602static SOC_ENUM_SINGLE_DECL(max98095_dai1_dac_filter_enum,
599 SOC_ENUM_SINGLE(M98095_02E_DAI1_FILTERS, 0, 6, max98095_dai_fltr), 603 M98095_02E_DAI1_FILTERS, 0,
600}; 604 max98095_dai_fltr);
601static const struct soc_enum max98095_dai2_dac_filter_enum[] = { 605static SOC_ENUM_SINGLE_DECL(max98095_dai2_dac_filter_enum,
602 SOC_ENUM_SINGLE(M98095_038_DAI2_FILTERS, 0, 6, max98095_dai_fltr), 606 M98095_038_DAI2_FILTERS, 0,
603}; 607 max98095_dai_fltr);
604static const struct soc_enum max98095_dai3_dac_filter_enum[] = { 608static SOC_ENUM_SINGLE_DECL(max98095_dai3_dac_filter_enum,
605 SOC_ENUM_SINGLE(M98095_042_DAI3_FILTERS, 0, 6, max98095_dai_fltr), 609 M98095_042_DAI3_FILTERS, 0,
606}; 610 max98095_dai_fltr);
607 611
608static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol, 612static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol,
609 struct snd_ctl_elem_value *ucontrol) 613 struct snd_ctl_elem_value *ucontrol)
@@ -2234,12 +2238,6 @@ static int max98095_probe(struct snd_soc_codec *codec)
2234 struct i2c_client *client; 2238 struct i2c_client *client;
2235 int ret = 0; 2239 int ret = 0;
2236 2240
2237 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
2238 if (ret != 0) {
2239 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2240 return ret;
2241 }
2242
2243 /* reset the codec, the DSP core, and disable all interrupts */ 2241 /* reset the codec, the DSP core, and disable all interrupts */
2244 max98095_reset(codec); 2242 max98095_reset(codec);
2245 2243
diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c
index 82757ebf0301..4fdf5aaa236f 100644
--- a/sound/soc/codecs/max9850.c
+++ b/sound/soc/codecs/max9850.c
@@ -312,14 +312,6 @@ static int max9850_resume(struct snd_soc_codec *codec)
312 312
313static int max9850_probe(struct snd_soc_codec *codec) 313static int max9850_probe(struct snd_soc_codec *codec)
314{ 314{
315 int ret;
316
317 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
318 if (ret < 0) {
319 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
320 return ret;
321 }
322
323 /* enable zero-detect */ 315 /* enable zero-detect */
324 snd_soc_update_bits(codec, MAX9850_GENERAL_PURPOSE, 1, 1); 316 snd_soc_update_bits(codec, MAX9850_GENERAL_PURPOSE, 1, 1);
325 /* enable slew-rate control */ 317 /* enable slew-rate control */
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index ec89b8f90a64..37d737e567a1 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -612,8 +612,8 @@ static int mc13783_probe(struct snd_soc_codec *codec)
612 struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); 612 struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec);
613 int ret; 613 int ret;
614 614
615 codec->control_data = dev_get_regmap(codec->dev->parent, NULL); 615 ret = snd_soc_codec_set_cache_io(codec,
616 ret = snd_soc_codec_set_cache_io(codec, 8, 24, SND_SOC_REGMAP); 616 dev_get_regmap(codec->dev->parent, NULL));
617 if (ret != 0) { 617 if (ret != 0) {
618 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 618 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
619 return ret; 619 return ret;
diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c
index 577fb8776ce7..e661e8420e3d 100644
--- a/sound/soc/codecs/ml26124.c
+++ b/sound/soc/codecs/ml26124.c
@@ -586,16 +586,6 @@ static int ml26124_resume(struct snd_soc_codec *codec)
586 586
587static int ml26124_probe(struct snd_soc_codec *codec) 587static int ml26124_probe(struct snd_soc_codec *codec)
588{ 588{
589 int ret;
590 struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec);
591 codec->control_data = priv->regmap;
592
593 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
594 if (ret < 0) {
595 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
596 return ret;
597 }
598
599 /* Software Reset */ 589 /* Software Reset */
600 snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 1); 590 snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 1);
601 snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0); 591 snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0);
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c
index ce199d375209..d4c229f0233f 100644
--- a/sound/soc/codecs/rt5631.c
+++ b/sound/soc/codecs/rt5631.c
@@ -1570,15 +1570,6 @@ static int rt5631_probe(struct snd_soc_codec *codec)
1570{ 1570{
1571 struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); 1571 struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
1572 unsigned int val; 1572 unsigned int val;
1573 int ret;
1574
1575 codec->control_data = rt5631->regmap;
1576
1577 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1578 if (ret != 0) {
1579 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1580 return ret;
1581 }
1582 1573
1583 val = rt5631_read_index(codec, RT5631_ADDA_MIXER_INTL_REG3); 1574 val = rt5631_read_index(codec, RT5631_ADDA_MIXER_INTL_REG3);
1584 if (val & 0x0002) 1575 if (val & 0x0002)
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 1a1e1150237d..13ccee43cfc5 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1936,16 +1936,8 @@ static int rt5640_set_bias_level(struct snd_soc_codec *codec,
1936static int rt5640_probe(struct snd_soc_codec *codec) 1936static int rt5640_probe(struct snd_soc_codec *codec)
1937{ 1937{
1938 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); 1938 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1939 int ret;
1940 1939
1941 rt5640->codec = codec; 1940 rt5640->codec = codec;
1942 codec->control_data = rt5640->regmap;
1943
1944 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1945 if (ret != 0) {
1946 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1947 return ret;
1948 }
1949 1941
1950 codec->dapm.idle_bias_off = 1; 1942 codec->dapm.idle_bias_off = 1;
1951 rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF); 1943 rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index ab4754a7a88c..d3ed1be5a186 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1352,14 +1352,6 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1352 int ret; 1352 int ret;
1353 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); 1353 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
1354 1354
1355 /* setup i2c data ops */
1356 codec->control_data = sgtl5000->regmap;
1357 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
1358 if (ret < 0) {
1359 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1360 return ret;
1361 }
1362
1363 ret = sgtl5000_enable_regulators(codec); 1355 ret = sgtl5000_enable_regulators(codec);
1364 if (ret) 1356 if (ret)
1365 return ret; 1357 return ret;
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index fa2b8e07f420..244c097cd905 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -21,6 +21,7 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <sound/pcm.h> 22#include <sound/pcm.h>
23#include <sound/pcm_params.h> 23#include <sound/pcm_params.h>
24#include <linux/regmap.h>
24#include <sound/soc.h> 25#include <sound/soc.h>
25#include <sound/initval.h> 26#include <sound/initval.h>
26 27
@@ -209,8 +210,9 @@ out:
209 210
210static int si476x_codec_probe(struct snd_soc_codec *codec) 211static int si476x_codec_probe(struct snd_soc_codec *codec)
211{ 212{
212 codec->control_data = dev_get_regmap(codec->dev->parent, NULL); 213 struct regmap *regmap = dev_get_regmap(codec->dev->parent, NULL);
213 return snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); 214
215 return snd_soc_codec_set_cache_io(codec, regmap);
214} 216}
215 217
216static struct snd_soc_dai_ops si476x_dai_ops = { 218static struct snd_soc_dai_ops si476x_dai_ops = {
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index bca7d02b362a..42dff26b3a2a 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -825,8 +825,6 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec)
825{ 825{
826 pr_debug("codec_probe called\n"); 826 pr_debug("codec_probe called\n");
827 827
828 snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
829
830 /* PCM interface config 828 /* PCM interface config
831 * This sets the pcm rx slot conguration to max 6 slots 829 * This sets the pcm rx slot conguration to max 6 slots
832 * for max 4 dais (2 stereo and 2 mono) 830 * for max 4 dais (2 stereo and 2 mono)
diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c
index 806f3d826ffb..56adb3e2def9 100644
--- a/sound/soc/codecs/ssm2518.c
+++ b/sound/soc/codecs/ssm2518.c
@@ -648,16 +648,6 @@ static struct snd_soc_dai_driver ssm2518_dai = {
648 648
649static int ssm2518_probe(struct snd_soc_codec *codec) 649static int ssm2518_probe(struct snd_soc_codec *codec)
650{ 650{
651 struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec);
652 int ret;
653
654 codec->control_data = ssm2518->regmap;
655 ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
656 if (ret < 0) {
657 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
658 return ret;
659 }
660
661 return ssm2518_set_bias_level(codec, SND_SOC_BIAS_OFF); 651 return ssm2518_set_bias_level(codec, SND_SOC_BIAS_OFF);
662} 652}
663 653
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 12947096897c..97b0454eb346 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -562,13 +562,6 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)
562 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); 562 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
563 int ret; 563 int ret;
564 564
565 codec->control_data = ssm2602->regmap;
566 ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
567 if (ret < 0) {
568 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
569 return ret;
570 }
571
572 ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0); 565 ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
573 if (ret < 0) { 566 if (ret < 0) {
574 dev_err(codec->dev, "Failed to issue reset: %d\n", ret); 567 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index 2735361a4c3c..12577749b17b 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -872,16 +872,6 @@ static int sta32x_probe(struct snd_soc_codec *codec)
872 return ret; 872 return ret;
873 } 873 }
874 874
875 /* Tell ASoC what kind of I/O to use to read the registers. ASoC will
876 * then do the I2C transactions itself.
877 */
878 codec->control_data = sta32x->regmap;
879 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
880 if (ret < 0) {
881 dev_err(codec->dev, "failed to set cache I/O (ret=%i)\n", ret);
882 goto err;
883 }
884
885 /* Chip documentation explicitly requires that the reset values 875 /* Chip documentation explicitly requires that the reset values
886 * of reserved register bits are left untouched. 876 * of reserved register bits are left untouched.
887 * Write the register default value to cache for reserved registers, 877 * Write the register default value to cache for reserved registers,
@@ -946,10 +936,6 @@ static int sta32x_probe(struct snd_soc_codec *codec)
946 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); 936 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
947 937
948 return 0; 938 return 0;
949
950err:
951 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
952 return ret;
953} 939}
954 940
955static int sta32x_remove(struct snd_soc_codec *codec) 941static int sta32x_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index f15b0e37274c..a3c61d308bb0 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -322,16 +322,6 @@ static struct snd_soc_dai_driver sta529_dai = {
322 322
323static int sta529_probe(struct snd_soc_codec *codec) 323static int sta529_probe(struct snd_soc_codec *codec)
324{ 324{
325 struct sta529 *sta529 = snd_soc_codec_get_drvdata(codec);
326 int ret;
327
328 codec->control_data = sta529->regmap;
329 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
330
331 if (ret < 0) {
332 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
333 return ret;
334 }
335 sta529_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 325 sta529_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
336 326
337 return 0; 327 return 0;
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index dc9a52fcb39a..20864ee8793b 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -559,14 +559,6 @@ static int tlv320aic23_resume(struct snd_soc_codec *codec)
559 559
560static int tlv320aic23_codec_probe(struct snd_soc_codec *codec) 560static int tlv320aic23_codec_probe(struct snd_soc_codec *codec)
561{ 561{
562 int ret;
563
564 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
565 if (ret < 0) {
566 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
567 return ret;
568 }
569
570 /* Reset codec */ 562 /* Reset codec */
571 snd_soc_write(codec, TLV320AIC23_RESET, 0); 563 snd_soc_write(codec, TLV320AIC23_RESET, 0);
572 564
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index ff5f23d482b7..43069de3d56a 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -296,8 +296,6 @@ static int aic26_probe(struct snd_soc_codec *codec)
296 struct aic26 *aic26 = dev_get_drvdata(codec->dev); 296 struct aic26 *aic26 = dev_get_drvdata(codec->dev);
297 int ret, reg; 297 int ret, reg;
298 298
299 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
300
301 aic26->codec = codec; 299 aic26->codec = codec;
302 300
303 /* Reset the codec to power on defaults */ 301 /* Reset the codec to power on defaults */
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
new file mode 100644
index 000000000000..e60e37b43a1b
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -0,0 +1,1295 @@
1/*
2 * ALSA SoC TLV320AIC31XX codec driver
3 *
4 * Copyright (C) 2014 Texas Instruments, Inc.
5 *
6 * Author: Jyri Sarha <jsarha@ti.com>
7 *
8 * Based on ground work by: Ajit Kulkarni <x0175765@ti.com>
9 *
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * THIS PACKAGE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 *
18 * The TLV320AIC31xx series of audio codec is a low-power, highly integrated
19 * high performance codec which provides a stereo DAC, a mono ADC,
20 * and mono/stereo Class-D speaker driver.
21 */
22
23#include <linux/module.h>
24#include <linux/moduleparam.h>
25#include <linux/init.h>
26#include <linux/delay.h>
27#include <linux/pm.h>
28#include <linux/i2c.h>
29#include <linux/gpio.h>
30#include <linux/regulator/consumer.h>
31#include <linux/of_gpio.h>
32#include <linux/slab.h>
33#include <sound/core.h>
34#include <sound/pcm.h>
35#include <sound/pcm_params.h>
36#include <sound/soc.h>
37#include <sound/initval.h>
38#include <sound/tlv.h>
39#include <dt-bindings/sound/tlv320aic31xx-micbias.h>
40
41#include "tlv320aic31xx.h"
42
43static const struct reg_default aic31xx_reg_defaults[] = {
44 { AIC31XX_CLKMUX, 0x00 },
45 { AIC31XX_PLLPR, 0x11 },
46 { AIC31XX_PLLJ, 0x04 },
47 { AIC31XX_PLLDMSB, 0x00 },
48 { AIC31XX_PLLDLSB, 0x00 },
49 { AIC31XX_NDAC, 0x01 },
50 { AIC31XX_MDAC, 0x01 },
51 { AIC31XX_DOSRMSB, 0x00 },
52 { AIC31XX_DOSRLSB, 0x80 },
53 { AIC31XX_NADC, 0x01 },
54 { AIC31XX_MADC, 0x01 },
55 { AIC31XX_AOSR, 0x80 },
56 { AIC31XX_IFACE1, 0x00 },
57 { AIC31XX_DATA_OFFSET, 0x00 },
58 { AIC31XX_IFACE2, 0x00 },
59 { AIC31XX_BCLKN, 0x01 },
60 { AIC31XX_DACSETUP, 0x14 },
61 { AIC31XX_DACMUTE, 0x0c },
62 { AIC31XX_LDACVOL, 0x00 },
63 { AIC31XX_RDACVOL, 0x00 },
64 { AIC31XX_ADCSETUP, 0x00 },
65 { AIC31XX_ADCFGA, 0x80 },
66 { AIC31XX_ADCVOL, 0x00 },
67 { AIC31XX_HPDRIVER, 0x04 },
68 { AIC31XX_SPKAMP, 0x06 },
69 { AIC31XX_DACMIXERROUTE, 0x00 },
70 { AIC31XX_LANALOGHPL, 0x7f },
71 { AIC31XX_RANALOGHPR, 0x7f },
72 { AIC31XX_LANALOGSPL, 0x7f },
73 { AIC31XX_RANALOGSPR, 0x7f },
74 { AIC31XX_HPLGAIN, 0x02 },
75 { AIC31XX_HPRGAIN, 0x02 },
76 { AIC31XX_SPLGAIN, 0x00 },
77 { AIC31XX_SPRGAIN, 0x00 },
78 { AIC31XX_MICBIAS, 0x00 },
79 { AIC31XX_MICPGA, 0x80 },
80 { AIC31XX_MICPGAPI, 0x00 },
81 { AIC31XX_MICPGAMI, 0x00 },
82};
83
84static bool aic31xx_volatile(struct device *dev, unsigned int reg)
85{
86 switch (reg) {
87 case AIC31XX_PAGECTL: /* regmap implementation requires this */
88 case AIC31XX_RESET: /* always clears after write */
89 case AIC31XX_OT_FLAG:
90 case AIC31XX_ADCFLAG:
91 case AIC31XX_DACFLAG1:
92 case AIC31XX_DACFLAG2:
93 case AIC31XX_OFFLAG: /* Sticky interrupt flags */
94 case AIC31XX_INTRDACFLAG: /* Sticky interrupt flags */
95 case AIC31XX_INTRADCFLAG: /* Sticky interrupt flags */
96 case AIC31XX_INTRDACFLAG2:
97 case AIC31XX_INTRADCFLAG2:
98 return true;
99 }
100 return false;
101}
102
103static bool aic31xx_writeable(struct device *dev, unsigned int reg)
104{
105 switch (reg) {
106 case AIC31XX_OT_FLAG:
107 case AIC31XX_ADCFLAG:
108 case AIC31XX_DACFLAG1:
109 case AIC31XX_DACFLAG2:
110 case AIC31XX_OFFLAG: /* Sticky interrupt flags */
111 case AIC31XX_INTRDACFLAG: /* Sticky interrupt flags */
112 case AIC31XX_INTRADCFLAG: /* Sticky interrupt flags */
113 case AIC31XX_INTRDACFLAG2:
114 case AIC31XX_INTRADCFLAG2:
115 return false;
116 }
117 return true;
118}
119
120static const struct regmap_range_cfg aic31xx_ranges[] = {
121 {
122 .range_min = 0,
123 .range_max = 12 * 128,
124 .selector_reg = AIC31XX_PAGECTL,
125 .selector_mask = 0xff,
126 .selector_shift = 0,
127 .window_start = 0,
128 .window_len = 128,
129 },
130};
131
132struct regmap_config aic31xx_i2c_regmap = {
133 .reg_bits = 8,
134 .val_bits = 8,
135 .writeable_reg = aic31xx_writeable,
136 .volatile_reg = aic31xx_volatile,
137 .reg_defaults = aic31xx_reg_defaults,
138 .num_reg_defaults = ARRAY_SIZE(aic31xx_reg_defaults),
139 .cache_type = REGCACHE_RBTREE,
140 .ranges = aic31xx_ranges,
141 .num_ranges = ARRAY_SIZE(aic31xx_ranges),
142 .max_register = 12 * 128,
143};
144
145#define AIC31XX_NUM_SUPPLIES 6
146static const char * const aic31xx_supply_names[AIC31XX_NUM_SUPPLIES] = {
147 "HPVDD",
148 "SPRVDD",
149 "SPLVDD",
150 "AVDD",
151 "IOVDD",
152 "DVDD",
153};
154
155struct aic31xx_disable_nb {
156 struct notifier_block nb;
157 struct aic31xx_priv *aic31xx;
158};
159
160struct aic31xx_priv {
161 struct snd_soc_codec *codec;
162 u8 i2c_regs_status;
163 struct device *dev;
164 struct regmap *regmap;
165 struct aic31xx_pdata pdata;
166 struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
167 struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
168 unsigned int sysclk;
169 int rate_div_line;
170};
171
172struct aic31xx_rate_divs {
173 u32 mclk;
174 u32 rate;
175 u8 p_val;
176 u8 pll_j;
177 u16 pll_d;
178 u16 dosr;
179 u8 ndac;
180 u8 mdac;
181 u8 aosr;
182 u8 nadc;
183 u8 madc;
184};
185
186/* ADC dividers can be disabled by cofiguring them to 0 */
187static const struct aic31xx_rate_divs aic31xx_divs[] = {
188 /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */
189 /* 8k rate */
190 {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2},
191 {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2},
192 {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2},
193 /* 11.025k rate */
194 {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2},
195 {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2},
196 {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2},
197 /* 16k rate */
198 {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2},
199 {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2},
200 {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2},
201 /* 22.05k rate */
202 {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2},
203 {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2},
204 {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2},
205 /* 32k rate */
206 {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2},
207 {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2},
208 {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2},
209 /* 44.1k rate */
210 {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2},
211 {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2},
212 {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2},
213 /* 48k rate */
214 {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2},
215 {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2},
216 {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2},
217 /* 88.2k rate */
218 {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2},
219 {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2},
220 {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2},
221 /* 96k rate */
222 {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2},
223 {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2},
224 {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2},
225 /* 176.4k rate */
226 {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2},
227 {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2},
228 {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2},
229 /* 192k rate */
230 {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2},
231 {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2},
232 {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2},
233};
234
235static const char * const ldac_in_text[] = {
236 "Off", "Left Data", "Right Data", "Mono"
237};
238
239static const char * const rdac_in_text[] = {
240 "Off", "Right Data", "Left Data", "Mono"
241};
242
243static SOC_ENUM_SINGLE_DECL(ldac_in_enum, AIC31XX_DACSETUP, 4, ldac_in_text);
244
245static SOC_ENUM_SINGLE_DECL(rdac_in_enum, AIC31XX_DACSETUP, 2, rdac_in_text);
246
247static const char * const mic_select_text[] = {
248 "Off", "FFR 10 Ohm", "FFR 20 Ohm", "FFR 40 Ohm"
249};
250
251static const
252SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, mic_select_text);
253static const
254SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, mic_select_text);
255static const
256SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, mic_select_text);
257
258static const
259SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text);
260static const
261SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, mic_select_text);
262
263static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0);
264static const DECLARE_TLV_DB_SCALE(adc_fgain_tlv, 0, 10, 0);
265static const DECLARE_TLV_DB_SCALE(adc_cgain_tlv, -2000, 50, 0);
266static const DECLARE_TLV_DB_SCALE(mic_pga_tlv, 0, 50, 0);
267static const DECLARE_TLV_DB_SCALE(hp_drv_tlv, 0, 100, 0);
268static const DECLARE_TLV_DB_SCALE(class_D_drv_tlv, 600, 600, 0);
269static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -6350, 50, 0);
270static const DECLARE_TLV_DB_SCALE(sp_vol_tlv, -6350, 50, 0);
271
272/*
273 * controls to be exported to the user space
274 */
275static const struct snd_kcontrol_new aic31xx_snd_controls[] = {
276 SOC_DOUBLE_R_S_TLV("DAC Playback Volume", AIC31XX_LDACVOL,
277 AIC31XX_RDACVOL, 0, -127, 48, 7, 0, dac_vol_tlv),
278
279 SOC_SINGLE_TLV("ADC Fine Capture Volume", AIC31XX_ADCFGA, 4, 4, 1,
280 adc_fgain_tlv),
281
282 SOC_SINGLE("ADC Capture Switch", AIC31XX_ADCFGA, 7, 1, 1),
283 SOC_DOUBLE_R_S_TLV("ADC Capture Volume", AIC31XX_ADCVOL, AIC31XX_ADCVOL,
284 0, -24, 40, 6, 0, adc_cgain_tlv),
285
286 SOC_SINGLE_TLV("Mic PGA Capture Volume", AIC31XX_MICPGA, 0,
287 119, 0, mic_pga_tlv),
288
289 SOC_DOUBLE_R("HP Driver Playback Switch", AIC31XX_HPLGAIN,
290 AIC31XX_HPRGAIN, 2, 1, 0),
291 SOC_DOUBLE_R_TLV("HP Driver Playback Volume", AIC31XX_HPLGAIN,
292 AIC31XX_HPRGAIN, 3, 0x09, 0, hp_drv_tlv),
293
294 SOC_DOUBLE_R_TLV("HP Analog Playback Volume", AIC31XX_LANALOGHPL,
295 AIC31XX_RANALOGHPR, 0, 0x7F, 1, hp_vol_tlv),
296};
297
298static const struct snd_kcontrol_new aic311x_snd_controls[] = {
299 SOC_DOUBLE_R("Speaker Driver Playback Switch", AIC31XX_SPLGAIN,
300 AIC31XX_SPRGAIN, 2, 1, 0),
301 SOC_DOUBLE_R_TLV("Speaker Driver Playback Volume", AIC31XX_SPLGAIN,
302 AIC31XX_SPRGAIN, 3, 3, 0, class_D_drv_tlv),
303
304 SOC_DOUBLE_R_TLV("Speaker Analog Playback Volume", AIC31XX_LANALOGSPL,
305 AIC31XX_RANALOGSPR, 0, 0x7F, 1, sp_vol_tlv),
306};
307
308static const struct snd_kcontrol_new aic310x_snd_controls[] = {
309 SOC_SINGLE("Speaker Driver Playback Switch", AIC31XX_SPLGAIN,
310 2, 1, 0),
311 SOC_SINGLE_TLV("Speaker Driver Playback Volume", AIC31XX_SPLGAIN,
312 3, 3, 0, class_D_drv_tlv),
313
314 SOC_SINGLE_TLV("Speaker Analog Playback Volume", AIC31XX_LANALOGSPL,
315 0, 0x7F, 1, sp_vol_tlv),
316};
317
318static const struct snd_kcontrol_new ldac_in_control =
319 SOC_DAPM_ENUM("DAC Left Input", ldac_in_enum);
320
321static const struct snd_kcontrol_new rdac_in_control =
322 SOC_DAPM_ENUM("DAC Right Input", rdac_in_enum);
323
324int aic31xx_wait_bits(struct aic31xx_priv *aic31xx, unsigned int reg,
325 unsigned int mask, unsigned int wbits, int sleep,
326 int count)
327{
328 unsigned int bits;
329 int counter = count;
330 int ret = regmap_read(aic31xx->regmap, reg, &bits);
331 while ((bits & mask) != wbits && counter && !ret) {
332 usleep_range(sleep, sleep * 2);
333 ret = regmap_read(aic31xx->regmap, reg, &bits);
334 counter--;
335 }
336 if ((bits & mask) != wbits) {
337 dev_err(aic31xx->dev,
338 "%s: Failed! 0x%x was 0x%x expected 0x%x (%d, 0x%x, %d us)\n",
339 __func__, reg, bits, wbits, ret, mask,
340 (count - counter) * sleep);
341 ret = -1;
342 }
343 return ret;
344}
345
346#define WIDGET_BIT(reg, shift) (((shift) << 8) | (reg))
347
348static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w,
349 struct snd_kcontrol *kcontrol, int event)
350{
351 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(w->codec);
352 unsigned int reg = AIC31XX_DACFLAG1;
353 unsigned int mask;
354
355 switch (WIDGET_BIT(w->reg, w->shift)) {
356 case WIDGET_BIT(AIC31XX_DACSETUP, 7):
357 mask = AIC31XX_LDACPWRSTATUS_MASK;
358 break;
359 case WIDGET_BIT(AIC31XX_DACSETUP, 6):
360 mask = AIC31XX_RDACPWRSTATUS_MASK;
361 break;
362 case WIDGET_BIT(AIC31XX_HPDRIVER, 7):
363 mask = AIC31XX_HPLDRVPWRSTATUS_MASK;
364 break;
365 case WIDGET_BIT(AIC31XX_HPDRIVER, 6):
366 mask = AIC31XX_HPRDRVPWRSTATUS_MASK;
367 break;
368 case WIDGET_BIT(AIC31XX_SPKAMP, 7):
369 mask = AIC31XX_SPLDRVPWRSTATUS_MASK;
370 break;
371 case WIDGET_BIT(AIC31XX_SPKAMP, 6):
372 mask = AIC31XX_SPRDRVPWRSTATUS_MASK;
373 break;
374 case WIDGET_BIT(AIC31XX_ADCSETUP, 7):
375 mask = AIC31XX_ADCPWRSTATUS_MASK;
376 reg = AIC31XX_ADCFLAG;
377 break;
378 default:
379 dev_err(w->codec->dev, "Unknown widget '%s' calling %s/n",
380 w->name, __func__);
381 return -EINVAL;
382 }
383
384 switch (event) {
385 case SND_SOC_DAPM_POST_PMU:
386 return aic31xx_wait_bits(aic31xx, reg, mask, mask, 5000, 100);
387 case SND_SOC_DAPM_POST_PMD:
388 return aic31xx_wait_bits(aic31xx, reg, mask, 0, 5000, 100);
389 default:
390 dev_dbg(w->codec->dev,
391 "Unhandled dapm widget event %d from %s\n",
392 event, w->name);
393 }
394 return 0;
395}
396
397static const struct snd_kcontrol_new left_output_switches[] = {
398 SOC_DAPM_SINGLE("From Left DAC", AIC31XX_DACMIXERROUTE, 6, 1, 0),
399 SOC_DAPM_SINGLE("From MIC1LP", AIC31XX_DACMIXERROUTE, 5, 1, 0),
400 SOC_DAPM_SINGLE("From MIC1RP", AIC31XX_DACMIXERROUTE, 4, 1, 0),
401};
402
403static const struct snd_kcontrol_new right_output_switches[] = {
404 SOC_DAPM_SINGLE("From Right DAC", AIC31XX_DACMIXERROUTE, 2, 1, 0),
405 SOC_DAPM_SINGLE("From MIC1RP", AIC31XX_DACMIXERROUTE, 1, 1, 0),
406};
407
408static const struct snd_kcontrol_new p_term_mic1lp =
409 SOC_DAPM_ENUM("MIC1LP P-Terminal", mic1lp_p_enum);
410
411static const struct snd_kcontrol_new p_term_mic1rp =
412 SOC_DAPM_ENUM("MIC1RP P-Terminal", mic1rp_p_enum);
413
414static const struct snd_kcontrol_new p_term_mic1lm =
415 SOC_DAPM_ENUM("MIC1LM P-Terminal", mic1lm_p_enum);
416
417static const struct snd_kcontrol_new m_term_mic1lm =
418 SOC_DAPM_ENUM("MIC1LM M-Terminal", mic1lm_m_enum);
419
420static const struct snd_kcontrol_new aic31xx_dapm_hpl_switch =
421 SOC_DAPM_SINGLE("Switch", AIC31XX_LANALOGHPL, 7, 1, 0);
422
423static const struct snd_kcontrol_new aic31xx_dapm_hpr_switch =
424 SOC_DAPM_SINGLE("Switch", AIC31XX_RANALOGHPR, 7, 1, 0);
425
426static const struct snd_kcontrol_new aic31xx_dapm_spl_switch =
427 SOC_DAPM_SINGLE("Switch", AIC31XX_LANALOGSPL, 7, 1, 0);
428
429static const struct snd_kcontrol_new aic31xx_dapm_spr_switch =
430 SOC_DAPM_SINGLE("Switch", AIC31XX_RANALOGSPR, 7, 1, 0);
431
432static int mic_bias_event(struct snd_soc_dapm_widget *w,
433 struct snd_kcontrol *kcontrol, int event)
434{
435 struct snd_soc_codec *codec = w->codec;
436 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
437 switch (event) {
438 case SND_SOC_DAPM_POST_PMU:
439 /* change mic bias voltage to user defined */
440 snd_soc_update_bits(codec, AIC31XX_MICBIAS,
441 AIC31XX_MICBIAS_MASK,
442 aic31xx->pdata.micbias_vg <<
443 AIC31XX_MICBIAS_SHIFT);
444 dev_dbg(codec->dev, "%s: turned on\n", __func__);
445 break;
446 case SND_SOC_DAPM_PRE_PMD:
447 /* turn mic bias off */
448 snd_soc_update_bits(codec, AIC31XX_MICBIAS,
449 AIC31XX_MICBIAS_MASK, 0);
450 dev_dbg(codec->dev, "%s: turned off\n", __func__);
451 break;
452 }
453 return 0;
454}
455
456static const struct snd_soc_dapm_widget aic31xx_dapm_widgets[] = {
457 SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
458
459 SND_SOC_DAPM_MUX("DAC Left Input",
460 SND_SOC_NOPM, 0, 0, &ldac_in_control),
461 SND_SOC_DAPM_MUX("DAC Right Input",
462 SND_SOC_NOPM, 0, 0, &rdac_in_control),
463 /* DACs */
464 SND_SOC_DAPM_DAC_E("DAC Left", "Left Playback",
465 AIC31XX_DACSETUP, 7, 0, aic31xx_dapm_power_event,
466 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
467
468 SND_SOC_DAPM_DAC_E("DAC Right", "Right Playback",
469 AIC31XX_DACSETUP, 6, 0, aic31xx_dapm_power_event,
470 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
471
472 /* Output Mixers */
473 SND_SOC_DAPM_MIXER("Output Left", SND_SOC_NOPM, 0, 0,
474 left_output_switches,
475 ARRAY_SIZE(left_output_switches)),
476 SND_SOC_DAPM_MIXER("Output Right", SND_SOC_NOPM, 0, 0,
477 right_output_switches,
478 ARRAY_SIZE(right_output_switches)),
479
480 SND_SOC_DAPM_SWITCH("HP Left", SND_SOC_NOPM, 0, 0,
481 &aic31xx_dapm_hpl_switch),
482 SND_SOC_DAPM_SWITCH("HP Right", SND_SOC_NOPM, 0, 0,
483 &aic31xx_dapm_hpr_switch),
484
485 /* Output drivers */
486 SND_SOC_DAPM_OUT_DRV_E("HPL Driver", AIC31XX_HPDRIVER, 7, 0,
487 NULL, 0, aic31xx_dapm_power_event,
488 SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_PMU),
489 SND_SOC_DAPM_OUT_DRV_E("HPR Driver", AIC31XX_HPDRIVER, 6, 0,
490 NULL, 0, aic31xx_dapm_power_event,
491 SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_PMU),
492
493 /* ADC */
494 SND_SOC_DAPM_ADC_E("ADC", "Capture", AIC31XX_ADCSETUP, 7, 0,
495 aic31xx_dapm_power_event, SND_SOC_DAPM_POST_PMU |
496 SND_SOC_DAPM_POST_PMD),
497
498 /* Input Selection to MIC_PGA */
499 SND_SOC_DAPM_MUX("MIC1LP P-Terminal", SND_SOC_NOPM, 0, 0,
500 &p_term_mic1lp),
501 SND_SOC_DAPM_MUX("MIC1RP P-Terminal", SND_SOC_NOPM, 0, 0,
502 &p_term_mic1rp),
503 SND_SOC_DAPM_MUX("MIC1LM P-Terminal", SND_SOC_NOPM, 0, 0,
504 &p_term_mic1lm),
505
506 SND_SOC_DAPM_MUX("MIC1LM M-Terminal", SND_SOC_NOPM, 0, 0,
507 &m_term_mic1lm),
508 /* Enabling & Disabling MIC Gain Ctl */
509 SND_SOC_DAPM_PGA("MIC_GAIN_CTL", AIC31XX_MICPGA,
510 7, 1, NULL, 0),
511
512 /* Mic Bias */
513 SND_SOC_DAPM_SUPPLY("MICBIAS", SND_SOC_NOPM, 0, 0, mic_bias_event,
514 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
515
516 /* Outputs */
517 SND_SOC_DAPM_OUTPUT("HPL"),
518 SND_SOC_DAPM_OUTPUT("HPR"),
519
520 /* Inputs */
521 SND_SOC_DAPM_INPUT("MIC1LP"),
522 SND_SOC_DAPM_INPUT("MIC1RP"),
523 SND_SOC_DAPM_INPUT("MIC1LM"),
524};
525
526static const struct snd_soc_dapm_widget aic311x_dapm_widgets[] = {
527 /* AIC3111 and AIC3110 have stereo class-D amplifier */
528 SND_SOC_DAPM_OUT_DRV_E("SPL ClassD", AIC31XX_SPKAMP, 7, 0, NULL, 0,
529 aic31xx_dapm_power_event, SND_SOC_DAPM_POST_PMU |
530 SND_SOC_DAPM_POST_PMD),
531 SND_SOC_DAPM_OUT_DRV_E("SPR ClassD", AIC31XX_SPKAMP, 6, 0, NULL, 0,
532 aic31xx_dapm_power_event, SND_SOC_DAPM_POST_PMU |
533 SND_SOC_DAPM_POST_PMD),
534 SND_SOC_DAPM_SWITCH("Speaker Left", SND_SOC_NOPM, 0, 0,
535 &aic31xx_dapm_spl_switch),
536 SND_SOC_DAPM_SWITCH("Speaker Right", SND_SOC_NOPM, 0, 0,
537 &aic31xx_dapm_spr_switch),
538 SND_SOC_DAPM_OUTPUT("SPL"),
539 SND_SOC_DAPM_OUTPUT("SPR"),
540};
541
542/* AIC3100 and AIC3120 have only mono class-D amplifier */
543static const struct snd_soc_dapm_widget aic310x_dapm_widgets[] = {
544 SND_SOC_DAPM_OUT_DRV_E("SPK ClassD", AIC31XX_SPKAMP, 7, 0, NULL, 0,
545 aic31xx_dapm_power_event, SND_SOC_DAPM_POST_PMU |
546 SND_SOC_DAPM_POST_PMD),
547 SND_SOC_DAPM_SWITCH("Speaker", SND_SOC_NOPM, 0, 0,
548 &aic31xx_dapm_spl_switch),
549 SND_SOC_DAPM_OUTPUT("SPK"),
550};
551
552static const struct snd_soc_dapm_route
553aic31xx_audio_map[] = {
554 /* DAC Input Routing */
555 {"DAC Left Input", "Left Data", "DAC IN"},
556 {"DAC Left Input", "Right Data", "DAC IN"},
557 {"DAC Left Input", "Mono", "DAC IN"},
558 {"DAC Right Input", "Left Data", "DAC IN"},
559 {"DAC Right Input", "Right Data", "DAC IN"},
560 {"DAC Right Input", "Mono", "DAC IN"},
561 {"DAC Left", NULL, "DAC Left Input"},
562 {"DAC Right", NULL, "DAC Right Input"},
563
564 /* Mic input */
565 {"MIC1LP P-Terminal", "FFR 10 Ohm", "MIC1LP"},
566 {"MIC1LP P-Terminal", "FFR 20 Ohm", "MIC1LP"},
567 {"MIC1LP P-Terminal", "FFR 40 Ohm", "MIC1LP"},
568 {"MIC1RP P-Terminal", "FFR 10 Ohm", "MIC1RP"},
569 {"MIC1RP P-Terminal", "FFR 20 Ohm", "MIC1RP"},
570 {"MIC1RP P-Terminal", "FFR 40 Ohm", "MIC1RP"},
571 {"MIC1LM P-Terminal", "FFR 10 Ohm", "MIC1LM"},
572 {"MIC1LM P-Terminal", "FFR 20 Ohm", "MIC1LM"},
573 {"MIC1LM P-Terminal", "FFR 40 Ohm", "MIC1LM"},
574
575 {"MIC1LM M-Terminal", "FFR 10 Ohm", "MIC1LM"},
576 {"MIC1LM M-Terminal", "FFR 20 Ohm", "MIC1LM"},
577 {"MIC1LM M-Terminal", "FFR 40 Ohm", "MIC1LM"},
578
579 {"MIC_GAIN_CTL", NULL, "MIC1LP P-Terminal"},
580 {"MIC_GAIN_CTL", NULL, "MIC1RP P-Terminal"},
581 {"MIC_GAIN_CTL", NULL, "MIC1LM P-Terminal"},
582 {"MIC_GAIN_CTL", NULL, "MIC1LM M-Terminal"},
583
584 {"ADC", NULL, "MIC_GAIN_CTL"},
585
586 /* Left Output */
587 {"Output Left", "From Left DAC", "DAC Left"},
588 {"Output Left", "From MIC1LP", "MIC1LP"},
589 {"Output Left", "From MIC1RP", "MIC1RP"},
590
591 /* Right Output */
592 {"Output Right", "From Right DAC", "DAC Right"},
593 {"Output Right", "From MIC1RP", "MIC1RP"},
594
595 /* HPL path */
596 {"HP Left", "Switch", "Output Left"},
597 {"HPL Driver", NULL, "HP Left"},
598 {"HPL", NULL, "HPL Driver"},
599
600 /* HPR path */
601 {"HP Right", "Switch", "Output Right"},
602 {"HPR Driver", NULL, "HP Right"},
603 {"HPR", NULL, "HPR Driver"},
604};
605
606static const struct snd_soc_dapm_route
607aic311x_audio_map[] = {
608 /* SP L path */
609 {"Speaker Left", "Switch", "Output Left"},
610 {"SPL ClassD", NULL, "Speaker Left"},
611 {"SPL", NULL, "SPL ClassD"},
612
613 /* SP R path */
614 {"Speaker Right", "Switch", "Output Right"},
615 {"SPR ClassD", NULL, "Speaker Right"},
616 {"SPR", NULL, "SPR ClassD"},
617};
618
619static const struct snd_soc_dapm_route
620aic310x_audio_map[] = {
621 /* SP L path */
622 {"Speaker", "Switch", "Output Left"},
623 {"SPK ClassD", NULL, "Speaker"},
624 {"SPK", NULL, "SPK ClassD"},
625};
626
627static int aic31xx_add_controls(struct snd_soc_codec *codec)
628{
629 int ret = 0;
630 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
631
632 if (aic31xx->pdata.codec_type & AIC31XX_STEREO_CLASS_D_BIT)
633 ret = snd_soc_add_codec_controls(
634 codec, aic311x_snd_controls,
635 ARRAY_SIZE(aic311x_snd_controls));
636 else
637 ret = snd_soc_add_codec_controls(
638 codec, aic310x_snd_controls,
639 ARRAY_SIZE(aic310x_snd_controls));
640
641 return ret;
642}
643
644static int aic31xx_add_widgets(struct snd_soc_codec *codec)
645{
646 struct snd_soc_dapm_context *dapm = &codec->dapm;
647 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
648 int ret = 0;
649
650 if (aic31xx->pdata.codec_type & AIC31XX_STEREO_CLASS_D_BIT) {
651 ret = snd_soc_dapm_new_controls(
652 dapm, aic311x_dapm_widgets,
653 ARRAY_SIZE(aic311x_dapm_widgets));
654 if (ret)
655 return ret;
656
657 ret = snd_soc_dapm_add_routes(dapm, aic311x_audio_map,
658 ARRAY_SIZE(aic311x_audio_map));
659 if (ret)
660 return ret;
661 } else {
662 ret = snd_soc_dapm_new_controls(
663 dapm, aic310x_dapm_widgets,
664 ARRAY_SIZE(aic310x_dapm_widgets));
665 if (ret)
666 return ret;
667
668 ret = snd_soc_dapm_add_routes(dapm, aic310x_audio_map,
669 ARRAY_SIZE(aic310x_audio_map));
670 if (ret)
671 return ret;
672 }
673
674 return 0;
675}
676
677static int aic31xx_setup_pll(struct snd_soc_codec *codec,
678 struct snd_pcm_hw_params *params)
679{
680 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
681 int bclk_n = 0;
682 int i;
683
684 /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */
685 snd_soc_update_bits(codec, AIC31XX_CLKMUX,
686 AIC31XX_CODEC_CLKIN_MASK, AIC31XX_CODEC_CLKIN_PLL);
687 snd_soc_update_bits(codec, AIC31XX_IFACE2,
688 AIC31XX_BDIVCLK_MASK, AIC31XX_DAC2BCLK);
689
690 for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) {
691 if (aic31xx_divs[i].rate == params_rate(params) &&
692 aic31xx_divs[i].mclk == aic31xx->sysclk)
693 break;
694 }
695
696 if (i == ARRAY_SIZE(aic31xx_divs)) {
697 dev_err(codec->dev, "%s: Sampling rate %u not supported\n",
698 __func__, params_rate(params));
699 return -EINVAL;
700 }
701
702 /* PLL configuration */
703 snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK,
704 (aic31xx_divs[i].p_val << 4) | 0x01);
705 snd_soc_write(codec, AIC31XX_PLLJ, aic31xx_divs[i].pll_j);
706
707 snd_soc_write(codec, AIC31XX_PLLDMSB,
708 aic31xx_divs[i].pll_d >> 8);
709 snd_soc_write(codec, AIC31XX_PLLDLSB,
710 aic31xx_divs[i].pll_d & 0xff);
711
712 /* DAC dividers configuration */
713 snd_soc_update_bits(codec, AIC31XX_NDAC, AIC31XX_PLL_MASK,
714 aic31xx_divs[i].ndac);
715 snd_soc_update_bits(codec, AIC31XX_MDAC, AIC31XX_PLL_MASK,
716 aic31xx_divs[i].mdac);
717
718 snd_soc_write(codec, AIC31XX_DOSRMSB, aic31xx_divs[i].dosr >> 8);
719 snd_soc_write(codec, AIC31XX_DOSRLSB, aic31xx_divs[i].dosr & 0xff);
720
721 /* ADC dividers configuration. Write reset value 1 if not used. */
722 snd_soc_update_bits(codec, AIC31XX_NADC, AIC31XX_PLL_MASK,
723 aic31xx_divs[i].nadc ? aic31xx_divs[i].nadc : 1);
724 snd_soc_update_bits(codec, AIC31XX_MADC, AIC31XX_PLL_MASK,
725 aic31xx_divs[i].madc ? aic31xx_divs[i].madc : 1);
726
727 snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr);
728
729 /* Bit clock divider configuration. */
730 bclk_n = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac)
731 / snd_soc_params_to_frame_size(params);
732 if (bclk_n == 0) {
733 dev_err(codec->dev, "%s: Not enough BLCK bandwidth\n",
734 __func__);
735 return -EINVAL;
736 }
737
738 snd_soc_update_bits(codec, AIC31XX_BCLKN,
739 AIC31XX_PLL_MASK, bclk_n);
740
741 aic31xx->rate_div_line = i;
742
743 dev_dbg(codec->dev,
744 "pll %d.%04d/%d dosr %d n %d m %d aosr %d n %d m %d bclk_n %d\n",
745 aic31xx_divs[i].pll_j, aic31xx_divs[i].pll_d,
746 aic31xx_divs[i].p_val, aic31xx_divs[i].dosr,
747 aic31xx_divs[i].ndac, aic31xx_divs[i].mdac,
748 aic31xx_divs[i].aosr, aic31xx_divs[i].nadc,
749 aic31xx_divs[i].madc, bclk_n);
750
751 return 0;
752}
753
754static int aic31xx_hw_params(struct snd_pcm_substream *substream,
755 struct snd_pcm_hw_params *params,
756 struct snd_soc_dai *tmp)
757{
758 struct snd_soc_pcm_runtime *rtd = substream->private_data;
759 struct snd_soc_codec *codec = rtd->codec;
760 u8 data = 0;
761
762 dev_dbg(codec->dev, "## %s: format %d width %d rate %d\n",
763 __func__, params_format(params), params_width(params),
764 params_rate(params));
765
766 switch (params_width(params)) {
767 case 16:
768 break;
769 case 20:
770 data = (AIC31XX_WORD_LEN_20BITS <<
771 AIC31XX_IFACE1_DATALEN_SHIFT);
772 break;
773 case 24:
774 data = (AIC31XX_WORD_LEN_24BITS <<
775 AIC31XX_IFACE1_DATALEN_SHIFT);
776 break;
777 case 32:
778 data = (AIC31XX_WORD_LEN_32BITS <<
779 AIC31XX_IFACE1_DATALEN_SHIFT);
780 break;
781 default:
782 dev_err(codec->dev, "%s: Unsupported format %d\n",
783 __func__, params_format(params));
784 return -EINVAL;
785 }
786
787 snd_soc_update_bits(codec, AIC31XX_IFACE1,
788 AIC31XX_IFACE1_DATALEN_MASK,
789 data);
790
791 return aic31xx_setup_pll(codec, params);
792}
793
794static int aic31xx_dac_mute(struct snd_soc_dai *codec_dai, int mute)
795{
796 struct snd_soc_codec *codec = codec_dai->codec;
797
798 if (mute) {
799 snd_soc_update_bits(codec, AIC31XX_DACMUTE,
800 AIC31XX_DACMUTE_MASK,
801 AIC31XX_DACMUTE_MASK);
802 } else {
803 snd_soc_update_bits(codec, AIC31XX_DACMUTE,
804 AIC31XX_DACMUTE_MASK, 0x0);
805 }
806
807 return 0;
808}
809
810static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
811 unsigned int fmt)
812{
813 struct snd_soc_codec *codec = codec_dai->codec;
814 u8 iface_reg1 = 0;
815 u8 iface_reg3 = 0;
816 u8 dsp_a_val = 0;
817
818 dev_dbg(codec->dev, "## %s: fmt = 0x%x\n", __func__, fmt);
819
820 /* set master/slave audio interface */
821 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
822 case SND_SOC_DAIFMT_CBM_CFM:
823 iface_reg1 |= AIC31XX_BCLK_MASTER | AIC31XX_WCLK_MASTER;
824 break;
825 default:
826 dev_alert(codec->dev, "Invalid DAI master/slave interface\n");
827 return -EINVAL;
828 }
829
830 /* interface format */
831 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
832 case SND_SOC_DAIFMT_I2S:
833 break;
834 case SND_SOC_DAIFMT_DSP_A:
835 dsp_a_val = 0x1;
836 case SND_SOC_DAIFMT_DSP_B:
837 /* NOTE: BCLKINV bit value 1 equas NB and 0 equals IB */
838 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
839 case SND_SOC_DAIFMT_NB_NF:
840 iface_reg3 |= AIC31XX_BCLKINV_MASK;
841 break;
842 case SND_SOC_DAIFMT_IB_NF:
843 break;
844 default:
845 return -EINVAL;
846 }
847 iface_reg1 |= (AIC31XX_DSP_MODE <<
848 AIC31XX_IFACE1_DATATYPE_SHIFT);
849 break;
850 case SND_SOC_DAIFMT_RIGHT_J:
851 iface_reg1 |= (AIC31XX_RIGHT_JUSTIFIED_MODE <<
852 AIC31XX_IFACE1_DATATYPE_SHIFT);
853 break;
854 case SND_SOC_DAIFMT_LEFT_J:
855 iface_reg1 |= (AIC31XX_LEFT_JUSTIFIED_MODE <<
856 AIC31XX_IFACE1_DATATYPE_SHIFT);
857 break;
858 default:
859 dev_err(codec->dev, "Invalid DAI interface format\n");
860 return -EINVAL;
861 }
862
863 snd_soc_update_bits(codec, AIC31XX_IFACE1,
864 AIC31XX_IFACE1_DATATYPE_MASK |
865 AIC31XX_IFACE1_MASTER_MASK,
866 iface_reg1);
867 snd_soc_update_bits(codec, AIC31XX_DATA_OFFSET,
868 AIC31XX_DATA_OFFSET_MASK,
869 dsp_a_val);
870 snd_soc_update_bits(codec, AIC31XX_IFACE2,
871 AIC31XX_BCLKINV_MASK,
872 iface_reg3);
873
874 return 0;
875}
876
877static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
878 int clk_id, unsigned int freq, int dir)
879{
880 struct snd_soc_codec *codec = codec_dai->codec;
881 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
882 int i;
883
884 dev_dbg(codec->dev, "## %s: clk_id = %d, freq = %d, dir = %d\n",
885 __func__, clk_id, freq, dir);
886
887 for (i = 0; aic31xx_divs[i].mclk != freq; i++) {
888 if (i == ARRAY_SIZE(aic31xx_divs)) {
889 dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
890 __func__, freq);
891 return -EINVAL;
892 }
893 }
894
895 /* set clock on MCLK, BCLK, or GPIO1 as PLL input */
896 snd_soc_update_bits(codec, AIC31XX_CLKMUX, AIC31XX_PLL_CLKIN_MASK,
897 clk_id << AIC31XX_PLL_CLKIN_SHIFT);
898
899 aic31xx->sysclk = freq;
900 return 0;
901}
902
903static int aic31xx_regulator_event(struct notifier_block *nb,
904 unsigned long event, void *data)
905{
906 struct aic31xx_disable_nb *disable_nb =
907 container_of(nb, struct aic31xx_disable_nb, nb);
908 struct aic31xx_priv *aic31xx = disable_nb->aic31xx;
909
910 if (event & REGULATOR_EVENT_DISABLE) {
911 /*
912 * Put codec to reset and as at least one of the
913 * supplies was disabled.
914 */
915 if (gpio_is_valid(aic31xx->pdata.gpio_reset))
916 gpio_set_value(aic31xx->pdata.gpio_reset, 0);
917
918 regcache_mark_dirty(aic31xx->regmap);
919 dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__);
920 }
921
922 return 0;
923}
924
925static void aic31xx_clk_on(struct snd_soc_codec *codec)
926{
927 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
928 u8 mask = AIC31XX_PM_MASK;
929 u8 on = AIC31XX_PM_MASK;
930
931 dev_dbg(codec->dev, "codec clock -> on (rate %d)\n",
932 aic31xx_divs[aic31xx->rate_div_line].rate);
933 snd_soc_update_bits(codec, AIC31XX_PLLPR, mask, on);
934 mdelay(10);
935 snd_soc_update_bits(codec, AIC31XX_NDAC, mask, on);
936 snd_soc_update_bits(codec, AIC31XX_MDAC, mask, on);
937 if (aic31xx_divs[aic31xx->rate_div_line].nadc)
938 snd_soc_update_bits(codec, AIC31XX_NADC, mask, on);
939 if (aic31xx_divs[aic31xx->rate_div_line].madc)
940 snd_soc_update_bits(codec, AIC31XX_MADC, mask, on);
941 snd_soc_update_bits(codec, AIC31XX_BCLKN, mask, on);
942}
943
944static void aic31xx_clk_off(struct snd_soc_codec *codec)
945{
946 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
947 u8 mask = AIC31XX_PM_MASK;
948 u8 off = 0;
949
950 dev_dbg(codec->dev, "codec clock -> off\n");
951 snd_soc_update_bits(codec, AIC31XX_BCLKN, mask, off);
952 snd_soc_update_bits(codec, AIC31XX_MADC, mask, off);
953 snd_soc_update_bits(codec, AIC31XX_NADC, mask, off);
954 snd_soc_update_bits(codec, AIC31XX_MDAC, mask, off);
955 snd_soc_update_bits(codec, AIC31XX_NDAC, mask, off);
956 snd_soc_update_bits(codec, AIC31XX_PLLPR, mask, off);
957}
958
959static int aic31xx_power_on(struct snd_soc_codec *codec)
960{
961 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
962 int ret = 0;
963
964 ret = regulator_bulk_enable(ARRAY_SIZE(aic31xx->supplies),
965 aic31xx->supplies);
966 if (ret)
967 return ret;
968
969 if (gpio_is_valid(aic31xx->pdata.gpio_reset)) {
970 gpio_set_value(aic31xx->pdata.gpio_reset, 1);
971 udelay(100);
972 }
973 regcache_cache_only(aic31xx->regmap, false);
974 ret = regcache_sync(aic31xx->regmap);
975 if (ret != 0) {
976 dev_err(codec->dev,
977 "Failed to restore cache: %d\n", ret);
978 regcache_cache_only(aic31xx->regmap, true);
979 regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
980 aic31xx->supplies);
981 return ret;
982 }
983 return 0;
984}
985
986static int aic31xx_power_off(struct snd_soc_codec *codec)
987{
988 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
989 int ret = 0;
990
991 regcache_cache_only(aic31xx->regmap, true);
992 ret = regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
993 aic31xx->supplies);
994
995 return ret;
996}
997
998static int aic31xx_set_bias_level(struct snd_soc_codec *codec,
999 enum snd_soc_bias_level level)
1000{
1001 dev_dbg(codec->dev, "## %s: %d -> %d\n", __func__,
1002 codec->dapm.bias_level, level);
1003
1004 switch (level) {
1005 case SND_SOC_BIAS_ON:
1006 break;
1007 case SND_SOC_BIAS_PREPARE:
1008 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
1009 aic31xx_clk_on(codec);
1010 break;
1011 case SND_SOC_BIAS_STANDBY:
1012 switch (codec->dapm.bias_level) {
1013 case SND_SOC_BIAS_OFF:
1014 aic31xx_power_on(codec);
1015 break;
1016 case SND_SOC_BIAS_PREPARE:
1017 aic31xx_clk_off(codec);
1018 break;
1019 default:
1020 BUG();
1021 }
1022 break;
1023 case SND_SOC_BIAS_OFF:
1024 aic31xx_power_off(codec);
1025 break;
1026 }
1027 codec->dapm.bias_level = level;
1028
1029 return 0;
1030}
1031
1032static int aic31xx_suspend(struct snd_soc_codec *codec)
1033{
1034 aic31xx_set_bias_level(codec, SND_SOC_BIAS_OFF);
1035 return 0;
1036}
1037
1038static int aic31xx_resume(struct snd_soc_codec *codec)
1039{
1040 aic31xx_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1041 return 0;
1042}
1043
1044static int aic31xx_codec_probe(struct snd_soc_codec *codec)
1045{
1046 int ret = 0;
1047 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
1048 int i;
1049
1050 dev_dbg(aic31xx->dev, "## %s\n", __func__);
1051
1052 aic31xx = snd_soc_codec_get_drvdata(codec);
1053 codec->control_data = aic31xx->regmap;
1054
1055 aic31xx->codec = codec;
1056
1057 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1058
1059 if (ret != 0) {
1060 dev_err(codec->dev, "snd_soc_codec_set_cache_io failed %d\n",
1061 ret);
1062 return ret;
1063 }
1064
1065 for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) {
1066 aic31xx->disable_nb[i].nb.notifier_call =
1067 aic31xx_regulator_event;
1068 aic31xx->disable_nb[i].aic31xx = aic31xx;
1069 ret = regulator_register_notifier(aic31xx->supplies[i].consumer,
1070 &aic31xx->disable_nb[i].nb);
1071 if (ret) {
1072 dev_err(codec->dev,
1073 "Failed to request regulator notifier: %d\n",
1074 ret);
1075 return ret;
1076 }
1077 }
1078
1079 regcache_cache_only(aic31xx->regmap, true);
1080 regcache_mark_dirty(aic31xx->regmap);
1081
1082 ret = aic31xx_add_controls(codec);
1083 if (ret)
1084 return ret;
1085
1086 ret = aic31xx_add_widgets(codec);
1087
1088 return ret;
1089}
1090
1091static int aic31xx_codec_remove(struct snd_soc_codec *codec)
1092{
1093 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
1094 int i;
1095 /* power down chip */
1096 aic31xx_set_bias_level(codec, SND_SOC_BIAS_OFF);
1097
1098 for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
1099 regulator_unregister_notifier(aic31xx->supplies[i].consumer,
1100 &aic31xx->disable_nb[i].nb);
1101
1102 return 0;
1103}
1104
1105static struct snd_soc_codec_driver soc_codec_driver_aic31xx = {
1106 .probe = aic31xx_codec_probe,
1107 .remove = aic31xx_codec_remove,
1108 .suspend = aic31xx_suspend,
1109 .resume = aic31xx_resume,
1110 .set_bias_level = aic31xx_set_bias_level,
1111 .controls = aic31xx_snd_controls,
1112 .num_controls = ARRAY_SIZE(aic31xx_snd_controls),
1113 .dapm_widgets = aic31xx_dapm_widgets,
1114 .num_dapm_widgets = ARRAY_SIZE(aic31xx_dapm_widgets),
1115 .dapm_routes = aic31xx_audio_map,
1116 .num_dapm_routes = ARRAY_SIZE(aic31xx_audio_map),
1117};
1118
1119static struct snd_soc_dai_ops aic31xx_dai_ops = {
1120 .hw_params = aic31xx_hw_params,
1121 .set_sysclk = aic31xx_set_dai_sysclk,
1122 .set_fmt = aic31xx_set_dai_fmt,
1123 .digital_mute = aic31xx_dac_mute,
1124};
1125
1126static struct snd_soc_dai_driver aic31xx_dai_driver[] = {
1127 {
1128 .name = "tlv320aic31xx-hifi",
1129 .playback = {
1130 .stream_name = "Playback",
1131 .channels_min = 1,
1132 .channels_max = 2,
1133 .rates = AIC31XX_RATES,
1134 .formats = AIC31XX_FORMATS,
1135 },
1136 .capture = {
1137 .stream_name = "Capture",
1138 .channels_min = 1,
1139 .channels_max = 2,
1140 .rates = AIC31XX_RATES,
1141 .formats = AIC31XX_FORMATS,
1142 },
1143 .ops = &aic31xx_dai_ops,
1144 .symmetric_rates = 1,
1145 }
1146};
1147
1148#if defined(CONFIG_OF)
1149static const struct of_device_id tlv320aic31xx_of_match[] = {
1150 { .compatible = "ti,tlv320aic310x" },
1151 { .compatible = "ti,tlv320aic311x" },
1152 { .compatible = "ti,tlv320aic3100" },
1153 { .compatible = "ti,tlv320aic3110" },
1154 { .compatible = "ti,tlv320aic3120" },
1155 { .compatible = "ti,tlv320aic3111" },
1156 {},
1157};
1158MODULE_DEVICE_TABLE(of, tlv320aic31xx_of_match);
1159
1160static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
1161{
1162 struct device_node *np = aic31xx->dev->of_node;
1163 unsigned int value = MICBIAS_2_0V;
1164 int ret;
1165
1166 of_property_read_u32(np, "ai31xx-micbias-vg", &value);
1167 switch (value) {
1168 case MICBIAS_2_0V:
1169 case MICBIAS_2_5V:
1170 case MICBIAS_AVDDV:
1171 aic31xx->pdata.micbias_vg = value;
1172 break;
1173 default:
1174 dev_err(aic31xx->dev,
1175 "Bad ai31xx-micbias-vg value %d DT\n",
1176 value);
1177 aic31xx->pdata.micbias_vg = MICBIAS_2_0V;
1178 }
1179
1180 ret = of_get_named_gpio(np, "gpio-reset", 0);
1181 if (ret > 0)
1182 aic31xx->pdata.gpio_reset = ret;
1183}
1184#else /* CONFIG_OF */
1185static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
1186{
1187}
1188#endif /* CONFIG_OF */
1189
1190void aic31xx_device_init(struct aic31xx_priv *aic31xx)
1191{
1192 int ret, i;
1193
1194 dev_set_drvdata(aic31xx->dev, aic31xx);
1195
1196 if (dev_get_platdata(aic31xx->dev))
1197 memcpy(&aic31xx->pdata, dev_get_platdata(aic31xx->dev),
1198 sizeof(aic31xx->pdata));
1199 else if (aic31xx->dev->of_node)
1200 aic31xx_pdata_from_of(aic31xx);
1201
1202 if (aic31xx->pdata.gpio_reset) {
1203 ret = devm_gpio_request_one(aic31xx->dev,
1204 aic31xx->pdata.gpio_reset,
1205 GPIOF_OUT_INIT_HIGH,
1206 "aic31xx-reset-pin");
1207 if (ret < 0) {
1208 dev_err(aic31xx->dev, "not able to acquire gpio\n");
1209 return;
1210 }
1211 }
1212
1213 for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
1214 aic31xx->supplies[i].supply = aic31xx_supply_names[i];
1215
1216 ret = devm_regulator_bulk_get(aic31xx->dev,
1217 ARRAY_SIZE(aic31xx->supplies),
1218 aic31xx->supplies);
1219 if (ret != 0)
1220 dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret);
1221
1222}
1223
1224static int aic31xx_i2c_probe(struct i2c_client *i2c,
1225 const struct i2c_device_id *id)
1226{
1227 struct aic31xx_priv *aic31xx;
1228 int ret;
1229 const struct regmap_config *regmap_config;
1230
1231 dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
1232 id->name, (int) id->driver_data);
1233
1234 regmap_config = &aic31xx_i2c_regmap;
1235
1236 aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
1237 if (aic31xx == NULL)
1238 return -ENOMEM;
1239
1240 aic31xx->regmap = devm_regmap_init_i2c(i2c, regmap_config);
1241
1242 if (IS_ERR(aic31xx->regmap)) {
1243 ret = PTR_ERR(aic31xx->regmap);
1244 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
1245 ret);
1246 return ret;
1247 }
1248 aic31xx->dev = &i2c->dev;
1249
1250 aic31xx->pdata.codec_type = id->driver_data;
1251
1252 aic31xx_device_init(aic31xx);
1253
1254 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx,
1255 aic31xx_dai_driver,
1256 ARRAY_SIZE(aic31xx_dai_driver));
1257
1258 return ret;
1259}
1260
1261static int aic31xx_i2c_remove(struct i2c_client *i2c)
1262{
1263 struct aic31xx_priv *aic31xx = dev_get_drvdata(&i2c->dev);
1264
1265 kfree(aic31xx);
1266 return 0;
1267}
1268
1269static const struct i2c_device_id aic31xx_i2c_id[] = {
1270 { "tlv320aic310x", AIC3100 },
1271 { "tlv320aic311x", AIC3110 },
1272 { "tlv320aic3100", AIC3100 },
1273 { "tlv320aic3110", AIC3110 },
1274 { "tlv320aic3120", AIC3120 },
1275 { "tlv320aic3111", AIC3111 },
1276 { }
1277};
1278MODULE_DEVICE_TABLE(i2c, aic31xx_i2c_id);
1279
1280static struct i2c_driver aic31xx_i2c_driver = {
1281 .driver = {
1282 .name = "tlv320aic31xx-codec",
1283 .owner = THIS_MODULE,
1284 .of_match_table = of_match_ptr(tlv320aic31xx_of_match),
1285 },
1286 .probe = aic31xx_i2c_probe,
1287 .remove = (aic31xx_i2c_remove),
1288 .id_table = aic31xx_i2c_id,
1289};
1290
1291module_i2c_driver(aic31xx_i2c_driver);
1292
1293MODULE_DESCRIPTION("ASoC TLV320AIC3111 codec driver");
1294MODULE_AUTHOR("Jyri Sarha");
1295MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
new file mode 100644
index 000000000000..52ed57c69dfa
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -0,0 +1,258 @@
1/*
2 * ALSA SoC TLV320AIC31XX codec driver
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This package is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
11 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 */
15#ifndef _TLV320AIC31XX_H
16#define _TLV320AIC31XX_H
17
18#define AIC31XX_RATES SNDRV_PCM_RATE_8000_192000
19
20#define AIC31XX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
21 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
22
23
24#define AIC31XX_STEREO_CLASS_D_BIT 0x1
25#define AIC31XX_MINIDSP_BIT 0x2
26
27enum aic31xx_type {
28 AIC3100 = 0,
29 AIC3110 = AIC31XX_STEREO_CLASS_D_BIT,
30 AIC3120 = AIC31XX_MINIDSP_BIT,
31 AIC3111 = (AIC31XX_STEREO_CLASS_D_BIT | AIC31XX_MINIDSP_BIT),
32};
33
34struct aic31xx_pdata {
35 enum aic31xx_type codec_type;
36 unsigned int gpio_reset;
37 int micbias_vg;
38};
39
40/* Page Control Register */
41#define AIC31XX_PAGECTL 0x00
42
43/* Page 0 Registers */
44/* Software reset register */
45#define AIC31XX_RESET 0x01
46/* OT FLAG register */
47#define AIC31XX_OT_FLAG 0x03
48/* Clock clock Gen muxing, Multiplexers*/
49#define AIC31XX_CLKMUX 0x04
50/* PLL P and R-VAL register */
51#define AIC31XX_PLLPR 0x05
52/* PLL J-VAL register */
53#define AIC31XX_PLLJ 0x06
54/* PLL D-VAL MSB register */
55#define AIC31XX_PLLDMSB 0x07
56/* PLL D-VAL LSB register */
57#define AIC31XX_PLLDLSB 0x08
58/* DAC NDAC_VAL register*/
59#define AIC31XX_NDAC 0x0B
60/* DAC MDAC_VAL register */
61#define AIC31XX_MDAC 0x0C
62/* DAC OSR setting register 1, MSB value */
63#define AIC31XX_DOSRMSB 0x0D
64/* DAC OSR setting register 2, LSB value */
65#define AIC31XX_DOSRLSB 0x0E
66#define AIC31XX_MINI_DSP_INPOL 0x10
67/* Clock setting register 8, PLL */
68#define AIC31XX_NADC 0x12
69/* Clock setting register 9, PLL */
70#define AIC31XX_MADC 0x13
71/* ADC Oversampling (AOSR) Register */
72#define AIC31XX_AOSR 0x14
73/* Clock setting register 9, Multiplexers */
74#define AIC31XX_CLKOUTMUX 0x19
75/* Clock setting register 10, CLOCKOUT M divider value */
76#define AIC31XX_CLKOUTMVAL 0x1A
77/* Audio Interface Setting Register 1 */
78#define AIC31XX_IFACE1 0x1B
79/* Audio Data Slot Offset Programming */
80#define AIC31XX_DATA_OFFSET 0x1C
81/* Audio Interface Setting Register 2 */
82#define AIC31XX_IFACE2 0x1D
83/* Clock setting register 11, BCLK N Divider */
84#define AIC31XX_BCLKN 0x1E
85/* Audio Interface Setting Register 3, Secondary Audio Interface */
86#define AIC31XX_IFACESEC1 0x1F
87/* Audio Interface Setting Register 4 */
88#define AIC31XX_IFACESEC2 0x20
89/* Audio Interface Setting Register 5 */
90#define AIC31XX_IFACESEC3 0x21
91/* I2C Bus Condition */
92#define AIC31XX_I2C 0x22
93/* ADC FLAG */
94#define AIC31XX_ADCFLAG 0x24
95/* DAC Flag Registers */
96#define AIC31XX_DACFLAG1 0x25
97#define AIC31XX_DACFLAG2 0x26
98/* Sticky Interrupt flag (overflow) */
99#define AIC31XX_OFFLAG 0x27
100/* Sticy DAC Interrupt flags */
101#define AIC31XX_INTRDACFLAG 0x2C
102/* Sticy ADC Interrupt flags */
103#define AIC31XX_INTRADCFLAG 0x2D
104/* DAC Interrupt flags 2 */
105#define AIC31XX_INTRDACFLAG2 0x2E
106/* ADC Interrupt flags 2 */
107#define AIC31XX_INTRADCFLAG2 0x2F
108/* INT1 interrupt control */
109#define AIC31XX_INT1CTRL 0x30
110/* INT2 interrupt control */
111#define AIC31XX_INT2CTRL 0x31
112/* GPIO1 control */
113#define AIC31XX_GPIO1 0x33
114
115#define AIC31XX_DACPRB 0x3C
116/* ADC Instruction Set Register */
117#define AIC31XX_ADCPRB 0x3D
118/* DAC channel setup register */
119#define AIC31XX_DACSETUP 0x3F
120/* DAC Mute and volume control register */
121#define AIC31XX_DACMUTE 0x40
122/* Left DAC channel digital volume control */
123#define AIC31XX_LDACVOL 0x41
124/* Right DAC channel digital volume control */
125#define AIC31XX_RDACVOL 0x42
126/* Headset detection */
127#define AIC31XX_HSDETECT 0x43
128/* ADC Digital Mic */
129#define AIC31XX_ADCSETUP 0x51
130/* ADC Digital Volume Control Fine Adjust */
131#define AIC31XX_ADCFGA 0x52
132/* ADC Digital Volume Control Coarse Adjust */
133#define AIC31XX_ADCVOL 0x53
134
135
136/* Page 1 Registers */
137/* Headphone drivers */
138#define AIC31XX_HPDRIVER 0x9F
139/* Class-D Speakear Amplifier */
140#define AIC31XX_SPKAMP 0xA0
141/* HP Output Drivers POP Removal Settings */
142#define AIC31XX_HPPOP 0xA1
143/* Output Driver PGA Ramp-Down Period Control */
144#define AIC31XX_SPPGARAMP 0xA2
145/* DAC_L and DAC_R Output Mixer Routing */
146#define AIC31XX_DACMIXERROUTE 0xA3
147/* Left Analog Vol to HPL */
148#define AIC31XX_LANALOGHPL 0xA4
149/* Right Analog Vol to HPR */
150#define AIC31XX_RANALOGHPR 0xA5
151/* Left Analog Vol to SPL */
152#define AIC31XX_LANALOGSPL 0xA6
153/* Right Analog Vol to SPR */
154#define AIC31XX_RANALOGSPR 0xA7
155/* HPL Driver */
156#define AIC31XX_HPLGAIN 0xA8
157/* HPR Driver */
158#define AIC31XX_HPRGAIN 0xA9
159/* SPL Driver */
160#define AIC31XX_SPLGAIN 0xAA
161/* SPR Driver */
162#define AIC31XX_SPRGAIN 0xAB
163/* HP Driver Control */
164#define AIC31XX_HPCONTROL 0xAC
165/* MIC Bias Control */
166#define AIC31XX_MICBIAS 0xAE
167/* MIC PGA*/
168#define AIC31XX_MICPGA 0xAF
169/* Delta-Sigma Mono ADC Channel Fine-Gain Input Selection for P-Terminal */
170#define AIC31XX_MICPGAPI 0xB0
171/* ADC Input Selection for M-Terminal */
172#define AIC31XX_MICPGAMI 0xB1
173/* Input CM Settings */
174#define AIC31XX_MICPGACM 0xB2
175
176/* Bits, masks and shifts */
177
178/* AIC31XX_CLKMUX */
179#define AIC31XX_PLL_CLKIN_MASK 0x0c
180#define AIC31XX_PLL_CLKIN_SHIFT 2
181#define AIC31XX_PLL_CLKIN_MCLK 0
182#define AIC31XX_CODEC_CLKIN_MASK 0x03
183#define AIC31XX_CODEC_CLKIN_SHIFT 0
184#define AIC31XX_CODEC_CLKIN_PLL 3
185#define AIC31XX_CODEC_CLKIN_BCLK 1
186
187/* AIC31XX_PLLPR, AIC31XX_NDAC, AIC31XX_MDAC, AIC31XX_NADC, AIC31XX_MADC,
188 AIC31XX_BCLKN */
189#define AIC31XX_PLL_MASK 0x7f
190#define AIC31XX_PM_MASK 0x80
191
192/* AIC31XX_IFACE1 */
193#define AIC31XX_WORD_LEN_16BITS 0x00
194#define AIC31XX_WORD_LEN_20BITS 0x01
195#define AIC31XX_WORD_LEN_24BITS 0x02
196#define AIC31XX_WORD_LEN_32BITS 0x03
197#define AIC31XX_IFACE1_DATALEN_MASK 0x30
198#define AIC31XX_IFACE1_DATALEN_SHIFT (4)
199#define AIC31XX_IFACE1_DATATYPE_MASK 0xC0
200#define AIC31XX_IFACE1_DATATYPE_SHIFT (6)
201#define AIC31XX_I2S_MODE 0x00
202#define AIC31XX_DSP_MODE 0x01
203#define AIC31XX_RIGHT_JUSTIFIED_MODE 0x02
204#define AIC31XX_LEFT_JUSTIFIED_MODE 0x03
205#define AIC31XX_IFACE1_MASTER_MASK 0x0C
206#define AIC31XX_BCLK_MASTER 0x08
207#define AIC31XX_WCLK_MASTER 0x04
208
209/* AIC31XX_DATA_OFFSET */
210#define AIC31XX_DATA_OFFSET_MASK 0xFF
211
212/* AIC31XX_IFACE2 */
213#define AIC31XX_BCLKINV_MASK 0x08
214#define AIC31XX_BDIVCLK_MASK 0x03
215#define AIC31XX_DAC2BCLK 0x00
216#define AIC31XX_DACMOD2BCLK 0x01
217#define AIC31XX_ADC2BCLK 0x02
218#define AIC31XX_ADCMOD2BCLK 0x03
219
220/* AIC31XX_ADCFLAG */
221#define AIC31XX_ADCPWRSTATUS_MASK 0x40
222
223/* AIC31XX_DACFLAG1 */
224#define AIC31XX_LDACPWRSTATUS_MASK 0x80
225#define AIC31XX_RDACPWRSTATUS_MASK 0x08
226#define AIC31XX_HPLDRVPWRSTATUS_MASK 0x20
227#define AIC31XX_HPRDRVPWRSTATUS_MASK 0x02
228#define AIC31XX_SPLDRVPWRSTATUS_MASK 0x10
229#define AIC31XX_SPRDRVPWRSTATUS_MASK 0x01
230
231/* AIC31XX_INTRDACFLAG */
232#define AIC31XX_HPSCDETECT_MASK 0x80
233#define AIC31XX_BUTTONPRESS_MASK 0x20
234#define AIC31XX_HSPLUG_MASK 0x10
235#define AIC31XX_LDRCTHRES_MASK 0x08
236#define AIC31XX_RDRCTHRES_MASK 0x04
237#define AIC31XX_DACSINT_MASK 0x02
238#define AIC31XX_DACAINT_MASK 0x01
239
240/* AIC31XX_INT1CTRL */
241#define AIC31XX_HSPLUGDET_MASK 0x80
242#define AIC31XX_BUTTONPRESSDET_MASK 0x40
243#define AIC31XX_DRCTHRES_MASK 0x20
244#define AIC31XX_AGCNOISE_MASK 0x10
245#define AIC31XX_OC_MASK 0x08
246#define AIC31XX_ENGINE_MASK 0x04
247
248/* AIC31XX_DACSETUP */
249#define AIC31XX_SOFTSTEP_MASK 0x03
250
251/* AIC31XX_DACMUTE */
252#define AIC31XX_DACMUTE_MASK 0x0C
253
254/* AIC31XX_MICBIAS */
255#define AIC31XX_MICBIAS_MASK 0x03
256#define AIC31XX_MICBIAS_SHIFT 0
257
258#endif /* _TLV320AIC31XX_H */
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index c6bd7e75352d..1d9b117345a3 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -614,8 +614,6 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
614 struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); 614 struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
615 u32 tmp_reg; 615 u32 tmp_reg;
616 616
617 snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
618
619 if (gpio_is_valid(aic32x4->rstn_gpio)) { 617 if (gpio_is_valid(aic32x4->rstn_gpio)) {
620 ndelay(10); 618 ndelay(10);
621 gpio_set_value(aic32x4->rstn_gpio, 1); 619 gpio_set_value(aic32x4->rstn_gpio, 1);
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 470fbfb4b386..b1835103e9b4 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1344,12 +1344,6 @@ static int aic3x_probe(struct snd_soc_codec *codec)
1344 INIT_LIST_HEAD(&aic3x->list); 1344 INIT_LIST_HEAD(&aic3x->list);
1345 aic3x->codec = codec; 1345 aic3x->codec = codec;
1346 1346
1347 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1348 if (ret != 0) {
1349 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1350 return ret;
1351 }
1352
1353 for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) { 1347 for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) {
1354 aic3x->disable_nb[i].nb.notifier_call = aic3x_regulator_event; 1348 aic3x->disable_nb[i].nb.notifier_call = aic3x_regulator_event;
1355 aic3x->disable_nb[i].aic3x = aic3x; 1349 aic3x->disable_nb[i].aic3x = aic3x;
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 793516146670..6bfc8a17331b 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -122,7 +122,6 @@ struct tlv320dac33_priv {
122 unsigned int uthr; 122 unsigned int uthr;
123 123
124 enum dac33_state state; 124 enum dac33_state state;
125 enum snd_soc_control_type control_type;
126 void *control_data; 125 void *control_data;
127}; 126};
128 127
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 8ae50274ea8f..83a2c872925c 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -786,8 +786,6 @@ static int wm2000_probe(struct snd_soc_codec *codec)
786{ 786{
787 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); 787 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
788 788
789 snd_soc_codec_set_cache_io(codec, 16, 8, SND_SOC_REGMAP);
790
791 /* This will trigger a transition to standby mode by default */ 789 /* This will trigger a transition to standby mode by default */
792 wm2000_anc_set_mode(wm2000); 790 wm2000_anc_set_mode(wm2000);
793 791
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index 1e0a083d8345..2e721e06671b 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1554,15 +1554,8 @@ static int wm2200_probe(struct snd_soc_codec *codec)
1554 int ret; 1554 int ret;
1555 1555
1556 wm2200->codec = codec; 1556 wm2200->codec = codec;
1557 codec->control_data = wm2200->regmap;
1558 codec->dapm.bias_level = SND_SOC_BIAS_OFF; 1557 codec->dapm.bias_level = SND_SOC_BIAS_OFF;
1559 1558
1560 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
1561 if (ret != 0) {
1562 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1563 return ret;
1564 }
1565
1566 ret = snd_soc_add_codec_controls(codec, wm_adsp1_fw_controls, 2); 1559 ret = snd_soc_add_codec_controls(codec, wm_adsp1_fw_controls, 2);
1567 if (ret != 0) 1560 if (ret != 0)
1568 return ret; 1561 return ret;
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index d3fa65fd9e85..eca983fad891 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -2343,13 +2343,6 @@ static int wm5100_probe(struct snd_soc_codec *codec)
2343 int ret, i; 2343 int ret, i;
2344 2344
2345 wm5100->codec = codec; 2345 wm5100->codec = codec;
2346 codec->control_data = wm5100->regmap;
2347
2348 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
2349 if (ret != 0) {
2350 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2351 return ret;
2352 }
2353 2346
2354 for (i = 0; i < ARRAY_SIZE(wm5100_dig_vu); i++) 2347 for (i = 0; i < ARRAY_SIZE(wm5100_dig_vu); i++)
2355 snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU, 2348 snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU,
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 34109050ceed..dcf1d12cfef8 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -1760,9 +1760,7 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
1760 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); 1760 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1761 int ret; 1761 int ret;
1762 1762
1763 codec->control_data = priv->core.arizona->regmap; 1763 ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
1764
1765 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1766 if (ret != 0) 1764 if (ret != 0)
1767 return ret; 1765 return ret;
1768 1766
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index d7bf8848174a..df5a38dd8328 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -1587,10 +1587,9 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
1587 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); 1587 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1588 int ret; 1588 int ret;
1589 1589
1590 codec->control_data = priv->core.arizona->regmap;
1591 priv->core.arizona->dapm = &codec->dapm; 1590 priv->core.arizona->dapm = &codec->dapm;
1592 1591
1593 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); 1592 ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
1594 if (ret != 0) 1593 if (ret != 0)
1595 return ret; 1594 return ret;
1596 1595
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index a183dcf3d5c1..757256bf7672 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1505,9 +1505,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1505 if (ret != 0) 1505 if (ret != 0)
1506 return ret; 1506 return ret;
1507 1507
1508 codec->control_data = wm8350->regmap; 1508 snd_soc_codec_set_cache_io(codec, wm8350->regmap);
1509
1510 snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1511 1509
1512 /* Put the codec into reset if it wasn't already */ 1510 /* Put the codec into reset if it wasn't already */
1513 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1511 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 6d684d934f4d..146564feaea0 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -1316,10 +1316,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1316 1316
1317 snd_soc_codec_set_drvdata(codec, priv); 1317 snd_soc_codec_set_drvdata(codec, priv);
1318 priv->wm8400 = wm8400; 1318 priv->wm8400 = wm8400;
1319 codec->control_data = wm8400->regmap;
1320 priv->codec = codec; 1319 priv->codec = codec;
1321 1320
1322 snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); 1321 snd_soc_codec_set_cache_io(codec, wm8400->regmap);
1323 1322
1324 ret = devm_regulator_bulk_get(wm8400->dev, 1323 ret = devm_regulator_bulk_get(wm8400->dev,
1325 ARRAY_SIZE(power), &power[0]); 1324 ARRAY_SIZE(power), &power[0]);
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 7df7d4572755..1c1e328feeb8 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -589,20 +589,12 @@ static int wm8510_resume(struct snd_soc_codec *codec)
589 589
590static int wm8510_probe(struct snd_soc_codec *codec) 590static int wm8510_probe(struct snd_soc_codec *codec)
591{ 591{
592 int ret;
593
594 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
595 if (ret < 0) {
596 printk(KERN_ERR "wm8510: failed to set cache I/O: %d\n", ret);
597 return ret;
598 }
599
600 wm8510_reset(codec); 592 wm8510_reset(codec);
601 593
602 /* power on device */ 594 /* power on device */
603 wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 595 wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
604 596
605 return ret; 597 return 0;
606} 598}
607 599
608/* power down chip */ 600/* power down chip */
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 5dfd571b1a03..601ee8178af1 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -392,18 +392,11 @@ static int wm8523_resume(struct snd_soc_codec *codec)
392static int wm8523_probe(struct snd_soc_codec *codec) 392static int wm8523_probe(struct snd_soc_codec *codec)
393{ 393{
394 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); 394 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
395 int ret;
396 395
397 wm8523->rate_constraint.list = &wm8523->rate_constraint_list[0]; 396 wm8523->rate_constraint.list = &wm8523->rate_constraint_list[0];
398 wm8523->rate_constraint.count = 397 wm8523->rate_constraint.count =
399 ARRAY_SIZE(wm8523->rate_constraint_list); 398 ARRAY_SIZE(wm8523->rate_constraint_list);
400 399
401 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
402 if (ret != 0) {
403 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
404 return ret;
405 }
406
407 /* Change some default settings - latch VU and enable ZC */ 400 /* Change some default settings - latch VU and enable ZC */
408 snd_soc_update_bits(codec, WM8523_DAC_GAINR, 401 snd_soc_update_bits(codec, WM8523_DAC_GAINR,
409 WM8523_DACR_VU, WM8523_DACR_VU); 402 WM8523_DACR_VU, WM8523_DACR_VU);
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 318989acbbe5..7558c838193d 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -869,12 +869,6 @@ static int wm8580_probe(struct snd_soc_codec *codec)
869 struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec); 869 struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
870 int ret = 0; 870 int ret = 0;
871 871
872 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
873 if (ret < 0) {
874 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
875 return ret;
876 }
877
878 ret = regulator_bulk_enable(ARRAY_SIZE(wm8580->supplies), 872 ret = regulator_bulk_enable(ARRAY_SIZE(wm8580->supplies),
879 wm8580->supplies); 873 wm8580->supplies);
880 if (ret != 0) { 874 if (ret != 0) {
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 6efcc40a7cb3..b0fbcb377baf 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -367,12 +367,6 @@ static int wm8711_probe(struct snd_soc_codec *codec)
367{ 367{
368 int ret; 368 int ret;
369 369
370 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
371 if (ret < 0) {
372 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
373 return ret;
374 }
375
376 ret = wm8711_reset(codec); 370 ret = wm8711_reset(codec);
377 if (ret < 0) { 371 if (ret < 0) {
378 dev_err(codec->dev, "Failed to issue reset\n"); 372 dev_err(codec->dev, "Failed to issue reset\n");
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index cd89033e84c0..bac7fc28fe71 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -228,19 +228,10 @@ static int wm8728_resume(struct snd_soc_codec *codec)
228 228
229static int wm8728_probe(struct snd_soc_codec *codec) 229static int wm8728_probe(struct snd_soc_codec *codec)
230{ 230{
231 int ret;
232
233 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
234 if (ret < 0) {
235 printk(KERN_ERR "wm8728: failed to configure cache I/O: %d\n",
236 ret);
237 return ret;
238 }
239
240 /* power on device */ 231 /* power on device */
241 wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 232 wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
242 233
243 return ret; 234 return 0;
244} 235}
245 236
246static int wm8728_remove(struct snd_soc_codec *codec) 237static int wm8728_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index d9655f981df1..d74f43975b90 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -583,13 +583,6 @@ static int wm8731_probe(struct snd_soc_codec *codec)
583 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); 583 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
584 int ret = 0, i; 584 int ret = 0, i;
585 585
586 codec->control_data = wm8731->regmap;
587 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
588 if (ret < 0) {
589 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
590 return ret;
591 }
592
593 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++) 586 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
594 wm8731->supplies[i].supply = wm8731_supply_names[i]; 587 wm8731->supplies[i].supply = wm8731_supply_names[i];
595 588
diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
index ecc4e8725d5b..b27f26cdc049 100644
--- a/sound/soc/codecs/wm8737.c
+++ b/sound/soc/codecs/wm8737.c
@@ -570,12 +570,6 @@ static int wm8737_probe(struct snd_soc_codec *codec)
570 struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); 570 struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec);
571 int ret; 571 int ret;
572 572
573 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
574 if (ret != 0) {
575 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
576 return ret;
577 }
578
579 ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), 573 ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies),
580 wm8737->supplies); 574 wm8737->supplies);
581 if (ret != 0) { 575 if (ret != 0) {
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index dd02ebf88015..b33542a04607 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -429,12 +429,6 @@ static int wm8741_probe(struct snd_soc_codec *codec)
429 goto err_get; 429 goto err_get;
430 } 430 }
431 431
432 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
433 if (ret != 0) {
434 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
435 goto err_enable;
436 }
437
438 ret = wm8741_reset(codec); 432 ret = wm8741_reset(codec);
439 if (ret < 0) { 433 if (ret < 0) {
440 dev_err(codec->dev, "Failed to issue reset\n"); 434 dev_err(codec->dev, "Failed to issue reset\n");
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 78616a638a55..33990b63d214 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -702,12 +702,6 @@ static int wm8750_probe(struct snd_soc_codec *codec)
702{ 702{
703 int ret; 703 int ret;
704 704
705 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
706 if (ret < 0) {
707 printk(KERN_ERR "wm8750: failed to set cache I/O: %d\n", ret);
708 return ret;
709 }
710
711 ret = wm8750_reset(codec); 705 ret = wm8750_reset(codec);
712 if (ret < 0) { 706 if (ret < 0) {
713 printk(KERN_ERR "wm8750: failed to reset: %d\n", ret); 707 printk(KERN_ERR "wm8750: failed to reset: %d\n", ret);
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 6a6855d8b8ea..cbb8d55052a4 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1470,13 +1470,6 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1470 1470
1471 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8753_work); 1471 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8753_work);
1472 1472
1473 codec->control_data = wm8753->regmap;
1474 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
1475 if (ret < 0) {
1476 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1477 return ret;
1478 }
1479
1480 ret = wm8753_reset(codec); 1473 ret = wm8753_reset(codec);
1481 if (ret < 0) { 1474 if (ret < 0) {
1482 dev_err(codec->dev, "Failed to issue reset: %d\n", ret); 1475 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
index 5bce21013485..c61aeb38efb8 100644
--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -580,12 +580,6 @@ static int wm8770_probe(struct snd_soc_codec *codec)
580 wm8770 = snd_soc_codec_get_drvdata(codec); 580 wm8770 = snd_soc_codec_get_drvdata(codec);
581 wm8770->codec = codec; 581 wm8770->codec = codec;
582 582
583 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
584 if (ret < 0) {
585 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
586 return ret;
587 }
588
589 ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), 583 ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies),
590 wm8770->supplies); 584 wm8770->supplies);
591 if (ret) { 585 if (ret) {
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index ef8246725232..70952ceb278b 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -430,12 +430,6 @@ static int wm8776_probe(struct snd_soc_codec *codec)
430{ 430{
431 int ret = 0; 431 int ret = 0;
432 432
433 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
434 if (ret < 0) {
435 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
436 return ret;
437 }
438
439 ret = wm8776_reset(codec); 433 ret = wm8776_reset(codec);
440 if (ret < 0) { 434 if (ret < 0) {
441 dev_err(codec->dev, "Failed to issue reset: %d\n", ret); 435 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 72d12bbe1a56..ee76f0fb4299 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -546,14 +546,6 @@ static int wm8804_probe(struct snd_soc_codec *codec)
546 546
547 wm8804 = snd_soc_codec_get_drvdata(codec); 547 wm8804 = snd_soc_codec_get_drvdata(codec);
548 548
549 codec->control_data = wm8804->regmap;
550
551 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
552 if (ret < 0) {
553 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret);
554 return ret;
555 }
556
557 for (i = 0; i < ARRAY_SIZE(wm8804->supplies); i++) 549 for (i = 0; i < ARRAY_SIZE(wm8804->supplies); i++)
558 wm8804->supplies[i].supply = wm8804_supply_names[i]; 550 wm8804->supplies[i].supply = wm8804_supply_names[i];
559 551
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index 43c2201cb901..d09fdce57f5a 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -1178,13 +1178,7 @@ static int wm8900_resume(struct snd_soc_codec *codec)
1178 1178
1179static int wm8900_probe(struct snd_soc_codec *codec) 1179static int wm8900_probe(struct snd_soc_codec *codec)
1180{ 1180{
1181 int ret = 0, reg; 1181 int reg;
1182
1183 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1184 if (ret != 0) {
1185 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1186 return ret;
1187 }
1188 1182
1189 reg = snd_soc_read(codec, WM8900_REG_ID); 1183 reg = snd_soc_read(codec, WM8900_REG_ID);
1190 if (reg != 0x8900) { 1184 if (reg != 0x8900) {
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index b82b70a3b3d3..b0084a127d18 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1897,21 +1897,13 @@ static void wm8903_free_gpio(struct wm8903_priv *wm8903)
1897static int wm8903_probe(struct snd_soc_codec *codec) 1897static int wm8903_probe(struct snd_soc_codec *codec)
1898{ 1898{
1899 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); 1899 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1900 int ret;
1901 1900
1902 wm8903->codec = codec; 1901 wm8903->codec = codec;
1903 codec->control_data = wm8903->regmap;
1904
1905 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1906 if (ret != 0) {
1907 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1908 return ret;
1909 }
1910 1902
1911 /* power on device */ 1903 /* power on device */
1912 wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1904 wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1913 1905
1914 return ret; 1906 return 0;
1915} 1907}
1916 1908
1917/* power down chip */ 1909/* power down chip */
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 27299cda0e99..49c35c36935e 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -2048,9 +2048,6 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec)
2048static int wm8904_probe(struct snd_soc_codec *codec) 2048static int wm8904_probe(struct snd_soc_codec *codec)
2049{ 2049{
2050 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 2050 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2051 int ret;
2052
2053 codec->control_data = wm8904->regmap;
2054 2051
2055 switch (wm8904->devtype) { 2052 switch (wm8904->devtype) {
2056 case WM8904: 2053 case WM8904:
@@ -2064,12 +2061,6 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2064 return -EINVAL; 2061 return -EINVAL;
2065 } 2062 }
2066 2063
2067 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
2068 if (ret != 0) {
2069 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2070 return ret;
2071 }
2072
2073 wm8904_handle_pdata(codec); 2064 wm8904_handle_pdata(codec);
2074 2065
2075 wm8904_add_widgets(codec); 2066 wm8904_add_widgets(codec);
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 87f032d0d19f..fc6eec9ad66b 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -712,12 +712,6 @@ static int wm8940_probe(struct snd_soc_codec *codec)
712 int ret; 712 int ret;
713 u16 reg; 713 u16 reg;
714 714
715 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
716 if (ret < 0) {
717 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
718 return ret;
719 }
720
721 ret = wm8940_reset(codec); 715 ret = wm8940_reset(codec);
722 if (ret < 0) { 716 if (ret < 0) {
723 dev_err(codec->dev, "Failed to issue reset\n"); 717 dev_err(codec->dev, "Failed to issue reset\n");
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index d4dcaecc8a5f..fecd4e4f4c57 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -895,14 +895,6 @@ static int wm8955_probe(struct snd_soc_codec *codec)
895 struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); 895 struct wm8955_pdata *pdata = dev_get_platdata(codec->dev);
896 int ret, i; 896 int ret, i;
897 897
898 codec->control_data = wm8955->regmap;
899
900 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
901 if (ret != 0) {
902 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
903 return ret;
904 }
905
906 for (i = 0; i < ARRAY_SIZE(wm8955->supplies); i++) 898 for (i = 0; i < ARRAY_SIZE(wm8955->supplies); i++)
907 wm8955->supplies[i].supply = wm8955_supply_names[i]; 899 wm8955->supplies[i].supply = wm8955_supply_names[i];
908 900
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index f156010e52bc..d04e9cad445c 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -976,12 +976,6 @@ static int wm8960_probe(struct snd_soc_codec *codec)
976 wm8960->set_bias_level = wm8960_set_bias_level_capless; 976 wm8960->set_bias_level = wm8960_set_bias_level_capless;
977 } 977 }
978 978
979 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
980 if (ret < 0) {
981 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
982 return ret;
983 }
984
985 ret = wm8960_reset(codec); 979 ret = wm8960_reset(codec);
986 if (ret < 0) { 980 if (ret < 0) {
987 dev_err(codec->dev, "Failed to issue reset\n"); 981 dev_err(codec->dev, "Failed to issue reset\n");
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index ce8fa6e01cb4..9c88f04442b3 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -836,15 +836,8 @@ static struct snd_soc_dai_driver wm8961_dai = {
836static int wm8961_probe(struct snd_soc_codec *codec) 836static int wm8961_probe(struct snd_soc_codec *codec)
837{ 837{
838 struct snd_soc_dapm_context *dapm = &codec->dapm; 838 struct snd_soc_dapm_context *dapm = &codec->dapm;
839 int ret = 0;
840 u16 reg; 839 u16 reg;
841 840
842 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
843 if (ret != 0) {
844 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
845 return ret;
846 }
847
848 /* Enable class W */ 841 /* Enable class W */
849 reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_B); 842 reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_B);
850 reg |= WM8961_CP_DYN_PWR_MASK; 843 reg |= WM8961_CP_DYN_PWR_MASK;
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 62af9dc59fc5..5522d2566c67 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3424,13 +3424,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3424 bool dmicclk, dmicdat; 3424 bool dmicclk, dmicdat;
3425 3425
3426 wm8962->codec = codec; 3426 wm8962->codec = codec;
3427 codec->control_data = wm8962->regmap;
3428
3429 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
3430 if (ret != 0) {
3431 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
3432 return ret;
3433 }
3434 3427
3435 wm8962->disable_nb[0].notifier_call = wm8962_regulator_event_0; 3428 wm8962->disable_nb[0].notifier_call = wm8962_regulator_event_0;
3436 wm8962->disable_nb[1].notifier_call = wm8962_regulator_event_1; 3429 wm8962->disable_nb[1].notifier_call = wm8962_regulator_event_1;
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 67aba78a7ca5..09b7b4200221 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -648,12 +648,6 @@ static int wm8971_probe(struct snd_soc_codec *codec)
648 int ret = 0; 648 int ret = 0;
649 u16 reg; 649 u16 reg;
650 650
651 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
652 if (ret < 0) {
653 printk(KERN_ERR "wm8971: failed to set cache I/O: %d\n", ret);
654 return ret;
655 }
656
657 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work); 651 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work);
658 wm8971_workq = create_workqueue("wm8971"); 652 wm8971_workq = create_workqueue("wm8971");
659 if (wm8971_workq == NULL) 653 if (wm8971_workq == NULL)
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 6e16c4306461..0627c56fa44e 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -593,12 +593,6 @@ static int wm8974_probe(struct snd_soc_codec *codec)
593{ 593{
594 int ret = 0; 594 int ret = 0;
595 595
596 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
597 if (ret < 0) {
598 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
599 return ret;
600 }
601
602 ret = wm8974_reset(codec); 596 ret = wm8974_reset(codec);
603 if (ret < 0) { 597 if (ret < 0) {
604 dev_err(codec->dev, "Failed to issue reset\n"); 598 dev_err(codec->dev, "Failed to issue reset\n");
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index a9e2f465c331..28ef46c91f62 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -975,19 +975,13 @@ static const int update_reg[] = {
975static int wm8978_probe(struct snd_soc_codec *codec) 975static int wm8978_probe(struct snd_soc_codec *codec)
976{ 976{
977 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); 977 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
978 int ret = 0, i; 978 int i;
979 979
980 /* 980 /*
981 * Set default system clock to PLL, it is more precise, this is also the 981 * Set default system clock to PLL, it is more precise, this is also the
982 * default hardware setting 982 * default hardware setting
983 */ 983 */
984 wm8978->sysclk = WM8978_PLL; 984 wm8978->sysclk = WM8978_PLL;
985 codec->control_data = wm8978->regmap;
986 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
987 if (ret < 0) {
988 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
989 return ret;
990 }
991 985
992 /* 986 /*
993 * Set the update bit in all registers, that have one. This way all 987 * Set the update bit in all registers, that have one. This way all
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c
index 58f0551eed2d..2b9bfa53efbf 100644
--- a/sound/soc/codecs/wm8983.c
+++ b/sound/soc/codecs/wm8983.c
@@ -995,12 +995,6 @@ static int wm8983_probe(struct snd_soc_codec *codec)
995 int ret; 995 int ret;
996 int i; 996 int i;
997 997
998 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
999 if (ret < 0) {
1000 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret);
1001 return ret;
1002 }
1003
1004 ret = snd_soc_write(codec, WM8983_SOFTWARE_RESET, 0); 998 ret = snd_soc_write(codec, WM8983_SOFTWARE_RESET, 0);
1005 if (ret < 0) { 999 if (ret < 0) {
1006 dev_err(codec->dev, "Failed to issue reset: %d\n", ret); 1000 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index d786f2b39764..5473dc969585 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -995,13 +995,6 @@ static int wm8985_probe(struct snd_soc_codec *codec)
995 int ret; 995 int ret;
996 996
997 wm8985 = snd_soc_codec_get_drvdata(codec); 997 wm8985 = snd_soc_codec_get_drvdata(codec);
998 codec->control_data = wm8985->regmap;
999
1000 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
1001 if (ret < 0) {
1002 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret);
1003 return ret;
1004 }
1005 998
1006 for (i = 0; i < ARRAY_SIZE(wm8985->supplies); i++) 999 for (i = 0; i < ARRAY_SIZE(wm8985->supplies); i++)
1007 wm8985->supplies[i].supply = wm8985_supply_names[i]; 1000 wm8985->supplies[i].supply = wm8985_supply_names[i];
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 0277a76c6bef..3a1ae4f5164d 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -810,16 +810,8 @@ static int wm8988_resume(struct snd_soc_codec *codec)
810 810
811static int wm8988_probe(struct snd_soc_codec *codec) 811static int wm8988_probe(struct snd_soc_codec *codec)
812{ 812{
813 struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
814 int ret = 0; 813 int ret = 0;
815 814
816 codec->control_data = wm8988->regmap;
817 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
818 if (ret < 0) {
819 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
820 return ret;
821 }
822
823 ret = wm8988_reset(codec); 815 ret = wm8988_reset(codec);
824 if (ret < 0) { 816 if (ret < 0) {
825 dev_err(codec->dev, "Failed to issue reset\n"); 817 dev_err(codec->dev, "Failed to issue reset\n");
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 33f53ab1e7b0..c413c1991453 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -1289,14 +1289,6 @@ static int wm8990_resume(struct snd_soc_codec *codec)
1289 */ 1289 */
1290static int wm8990_probe(struct snd_soc_codec *codec) 1290static int wm8990_probe(struct snd_soc_codec *codec)
1291{ 1291{
1292 int ret;
1293
1294 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1295 if (ret < 0) {
1296 printk(KERN_ERR "wm8990: failed to set cache I/O: %d\n", ret);
1297 return ret;
1298 }
1299
1300 wm8990_reset(codec); 1292 wm8990_reset(codec);
1301 1293
1302 /* charge output caps */ 1294 /* charge output caps */
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c
index 32d219570cca..844cc4a60d66 100644
--- a/sound/soc/codecs/wm8991.c
+++ b/sound/soc/codecs/wm8991.c
@@ -1248,14 +1248,6 @@ static int wm8991_remove(struct snd_soc_codec *codec)
1248 1248
1249static int wm8991_probe(struct snd_soc_codec *codec) 1249static int wm8991_probe(struct snd_soc_codec *codec)
1250{ 1250{
1251 int ret;
1252
1253 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1254 if (ret < 0) {
1255 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret);
1256 return ret;
1257 }
1258
1259 wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1251 wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1260 1252
1261 return 0; 1253 return 0;
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 7b0630a076fa..f825dc04ebe1 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -1493,13 +1493,6 @@ static int wm8993_probe(struct snd_soc_codec *codec)
1493 wm8993->hubs_data.dcs_codes_r = -2; 1493 wm8993->hubs_data.dcs_codes_r = -2;
1494 wm8993->hubs_data.series_startup = 1; 1494 wm8993->hubs_data.series_startup = 1;
1495 1495
1496 codec->control_data = wm8993->regmap;
1497 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1498 if (ret != 0) {
1499 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1500 return ret;
1501 }
1502
1503 /* Latch volume update bits and default ZC on */ 1496 /* Latch volume update bits and default ZC on */
1504 snd_soc_update_bits(codec, WM8993_RIGHT_DAC_DIGITAL_VOLUME, 1497 snd_soc_update_bits(codec, WM8993_RIGHT_DAC_DIGITAL_VOLUME,
1505 WM8993_DAC_VU, WM8993_DAC_VU); 1498 WM8993_DAC_VU, WM8993_DAC_VU);
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 79854cb7feb6..6303537f54c6 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3998,9 +3998,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3998 int ret, i; 3998 int ret, i;
3999 3999
4000 wm8994->hubs.codec = codec; 4000 wm8994->hubs.codec = codec;
4001 codec->control_data = control->regmap;
4002 4001
4003 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); 4002 snd_soc_codec_set_cache_io(codec, control->regmap);
4004 4003
4005 mutex_init(&wm8994->accdet_lock); 4004 mutex_init(&wm8994->accdet_lock);
4006 INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap, 4005 INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap,
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index ddb197dc1d53..d3152cf5bd56 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -2042,13 +2042,6 @@ static int wm8995_probe(struct snd_soc_codec *codec)
2042 wm8995 = snd_soc_codec_get_drvdata(codec); 2042 wm8995 = snd_soc_codec_get_drvdata(codec);
2043 wm8995->codec = codec; 2043 wm8995->codec = codec;
2044 2044
2045 codec->control_data = wm8995->regmap;
2046 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
2047 if (ret < 0) {
2048 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret);
2049 return ret;
2050 }
2051
2052 for (i = 0; i < ARRAY_SIZE(wm8995->supplies); i++) 2045 for (i = 0; i < ARRAY_SIZE(wm8995->supplies); i++)
2053 wm8995->supplies[i].supply = wm8995_supply_names[i]; 2046 wm8995->supplies[i].supply = wm8995_supply_names[i];
2054 2047
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index c8244af7d56a..c6cbb3b8ace9 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2633,14 +2633,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2633 init_completion(&wm8996->dcs_done); 2633 init_completion(&wm8996->dcs_done);
2634 init_completion(&wm8996->fll_lock); 2634 init_completion(&wm8996->fll_lock);
2635 2635
2636 codec->control_data = wm8996->regmap;
2637
2638 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
2639 if (ret != 0) {
2640 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2641 goto err;
2642 }
2643
2644 if (wm8996->pdata.num_retune_mobile_cfgs) 2636 if (wm8996->pdata.num_retune_mobile_cfgs)
2645 wm8996_retune_mobile_pdata(codec); 2637 wm8996_retune_mobile_pdata(codec);
2646 else 2638 else
@@ -2679,13 +2671,11 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2679 } else { 2671 } else {
2680 dev_err(codec->dev, "Failed to request IRQ: %d\n", 2672 dev_err(codec->dev, "Failed to request IRQ: %d\n",
2681 ret); 2673 ret);
2674 return ret;
2682 } 2675 }
2683 } 2676 }
2684 2677
2685 return 0; 2678 return 0;
2686
2687err:
2688 return ret;
2689} 2679}
2690 2680
2691static int wm8996_remove(struct snd_soc_codec *codec) 2681static int wm8996_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index e10f44d7fdb7..004186b6bd48 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -1053,9 +1053,7 @@ static int wm8997_codec_probe(struct snd_soc_codec *codec)
1053 struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); 1053 struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
1054 int ret; 1054 int ret;
1055 1055
1056 codec->control_data = priv->core.arizona->regmap; 1056 ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
1057
1058 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1059 if (ret != 0) 1057 if (ret != 0)
1060 return ret; 1058 return ret;
1061 1059
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index 721cee71d5fc..d18eff31fbbc 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1260,15 +1260,6 @@ static struct snd_soc_dai_driver wm9081_dai = {
1260static int wm9081_probe(struct snd_soc_codec *codec) 1260static int wm9081_probe(struct snd_soc_codec *codec)
1261{ 1261{
1262 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); 1262 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1263 int ret;
1264
1265 codec->control_data = wm9081->regmap;
1266
1267 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1268 if (ret != 0) {
1269 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1270 return ret;
1271 }
1272 1263
1273 /* Enable zero cross by default */ 1264 /* Enable zero cross by default */
1274 snd_soc_update_bits(codec, WM9081_ANALOGUE_LINEOUT, 1265 snd_soc_update_bits(codec, WM9081_ANALOGUE_LINEOUT,
@@ -1283,7 +1274,7 @@ static int wm9081_probe(struct snd_soc_codec *codec)
1283 ARRAY_SIZE(wm9081_eq_controls)); 1274 ARRAY_SIZE(wm9081_eq_controls));
1284 } 1275 }
1285 1276
1286 return ret; 1277 return 0;
1287} 1278}
1288 1279
1289static int wm9081_remove(struct snd_soc_codec *codec) 1280static int wm9081_remove(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index a07fe1618eec..87934171f063 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -522,16 +522,6 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
522 522
523static int wm9090_probe(struct snd_soc_codec *codec) 523static int wm9090_probe(struct snd_soc_codec *codec)
524{ 524{
525 struct wm9090_priv *wm9090 = dev_get_drvdata(codec->dev);
526 int ret;
527
528 codec->control_data = wm9090->regmap;
529 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
530 if (ret != 0) {
531 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
532 return ret;
533 }
534
535 /* Configure some defaults; they will be written out when we 525 /* Configure some defaults; they will be written out when we
536 * bring the bias up. 526 * bring the bias up.
537 */ 527 */
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index 4577b69fcf2c..3c81b3891209 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -32,7 +32,7 @@ config SND_SOC_INTEL_BAYTRAIL
32 32
33config SND_SOC_INTEL_HASWELL_MACH 33config SND_SOC_INTEL_HASWELL_MACH
34 tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint" 34 tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint"
35 depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS 35 depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && I2C
36 select SND_SOC_INTEL_HASWELL 36 select SND_SOC_INTEL_HASWELL
37 select SND_SOC_RT5640 37 select SND_SOC_RT5640
38 help 38 help
@@ -43,7 +43,7 @@ config SND_SOC_INTEL_HASWELL_MACH
43 43
44config SND_SOC_INTEL_BYT_RT5640_MACH 44config SND_SOC_INTEL_BYT_RT5640_MACH
45 tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" 45 tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec"
46 depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS 46 depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && I2C
47 select SND_SOC_INTEL_BAYTRAIL 47 select SND_SOC_INTEL_BAYTRAIL
48 select SND_SOC_RT5640 48 select SND_SOC_RT5640
49 help 49 help
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig
index 78ed4a42ad21..2dc3ecf34801 100644
--- a/sound/soc/kirkwood/Kconfig
+++ b/sound/soc/kirkwood/Kconfig
@@ -1,11 +1,19 @@
1config SND_KIRKWOOD_SOC 1config SND_KIRKWOOD_SOC
2 tristate "SoC Audio for the Marvell Kirkwood and Dove chips" 2 tristate "SoC Audio for the Marvell Kirkwood and Dove chips"
3 depends on ARCH_KIRKWOOD || ARCH_DOVE || COMPILE_TEST 3 depends on ARCH_KIRKWOOD || ARCH_DOVE || ARCH_MVEBU || COMPILE_TEST
4 help 4 help
5 Say Y or M if you want to add support for codecs attached to 5 Say Y or M if you want to add support for codecs attached to
6 the Kirkwood I2S interface. You will also need to select the 6 the Kirkwood I2S interface. You will also need to select the
7 audio interfaces to support below. 7 audio interfaces to support below.
8 8
9config SND_KIRKWOOD_SOC_ARMADA370_DB
10 tristate "SoC Audio support for Armada 370 DB"
11 depends on SND_KIRKWOOD_SOC && (ARCH_MVEBU || COMPILE_TEST) && I2C
12 select SND_SOC_CS42L51
13 help
14 Say Y if you want to add support for SoC audio on
15 the Armada 370 Development Board.
16
9config SND_KIRKWOOD_SOC_OPENRD 17config SND_KIRKWOOD_SOC_OPENRD
10 tristate "SoC Audio support for Kirkwood Openrd Client" 18 tristate "SoC Audio support for Kirkwood Openrd Client"
11 depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE || COMPILE_TEST) 19 depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE || COMPILE_TEST)
diff --git a/sound/soc/kirkwood/Makefile b/sound/soc/kirkwood/Makefile
index 9e781385cb88..7c1d8fe09e6b 100644
--- a/sound/soc/kirkwood/Makefile
+++ b/sound/soc/kirkwood/Makefile
@@ -4,6 +4,8 @@ obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o
4 4
5snd-soc-openrd-objs := kirkwood-openrd.o 5snd-soc-openrd-objs := kirkwood-openrd.o
6snd-soc-t5325-objs := kirkwood-t5325.o 6snd-soc-t5325-objs := kirkwood-t5325.o
7snd-soc-armada-370-db-objs := armada-370-db.o
7 8
9obj-$(CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB) += snd-soc-armada-370-db.o
8obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o 10obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o
9obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o 11obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o
diff --git a/sound/soc/kirkwood/armada-370-db.c b/sound/soc/kirkwood/armada-370-db.c
new file mode 100644
index 000000000000..977639b3ffde
--- /dev/null
+++ b/sound/soc/kirkwood/armada-370-db.c
@@ -0,0 +1,120 @@
1/*
2 * Copyright (C) 2014 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 */
11
12#include <linux/module.h>
13#include <linux/moduleparam.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/slab.h>
17#include <sound/soc.h>
18#include <linux/of.h>
19#include <linux/platform_data/asoc-kirkwood.h>
20#include "../codecs/cs42l51.h"
21
22static int a370db_hw_params(struct snd_pcm_substream *substream,
23 struct snd_pcm_hw_params *params)
24{
25 struct snd_soc_pcm_runtime *rtd = substream->private_data;
26 struct snd_soc_dai *codec_dai = rtd->codec_dai;
27 unsigned int freq;
28
29 switch (params_rate(params)) {
30 default:
31 case 44100:
32 freq = 11289600;
33 break;
34 case 48000:
35 freq = 12288000;
36 break;
37 case 96000:
38 freq = 24576000;
39 break;
40 }
41
42 return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN);
43}
44
45static struct snd_soc_ops a370db_ops = {
46 .hw_params = a370db_hw_params,
47};
48
49static const struct snd_soc_dapm_widget a370db_dapm_widgets[] = {
50 SND_SOC_DAPM_HP("Out Jack", NULL),
51 SND_SOC_DAPM_LINE("In Jack", NULL),
52};
53
54static const struct snd_soc_dapm_route a370db_route[] = {
55 { "Out Jack", NULL, "HPL" },
56 { "Out Jack", NULL, "HPR" },
57 { "AIN1L", NULL, "In Jack" },
58 { "AIN1L", NULL, "In Jack" },
59};
60
61static struct snd_soc_dai_link a370db_dai[] = {
62{
63 .name = "CS42L51",
64 .stream_name = "analog",
65 .cpu_dai_name = "i2s",
66 .codec_dai_name = "cs42l51-hifi",
67 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
68 .ops = &a370db_ops,
69},
70};
71
72static struct snd_soc_card a370db = {
73 .name = "a370db",
74 .owner = THIS_MODULE,
75 .dai_link = a370db_dai,
76 .num_links = ARRAY_SIZE(a370db_dai),
77 .dapm_widgets = a370db_dapm_widgets,
78 .num_dapm_widgets = ARRAY_SIZE(a370db_dapm_widgets),
79 .dapm_routes = a370db_route,
80 .num_dapm_routes = ARRAY_SIZE(a370db_route),
81};
82
83static int a370db_probe(struct platform_device *pdev)
84{
85 struct snd_soc_card *card = &a370db;
86
87 card->dev = &pdev->dev;
88
89 a370db_dai[0].cpu_of_node =
90 of_parse_phandle(pdev->dev.of_node,
91 "marvell,audio-controller", 0);
92 a370db_dai[0].platform_of_node = a370db_dai[0].cpu_of_node;
93
94 a370db_dai[0].codec_of_node =
95 of_parse_phandle(pdev->dev.of_node,
96 "marvell,audio-codec", 0);
97
98 return devm_snd_soc_register_card(card->dev, card);
99}
100
101static const struct of_device_id a370db_dt_ids[] = {
102 { .compatible = "marvell,a370db-audio" },
103 { },
104};
105
106static struct platform_driver a370db_driver = {
107 .driver = {
108 .name = "a370db-audio",
109 .owner = THIS_MODULE,
110 .of_match_table = of_match_ptr(a370db_dt_ids),
111 },
112 .probe = a370db_probe,
113};
114
115module_platform_driver(a370db_driver);
116
117MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
118MODULE_DESCRIPTION("ALSA SoC a370db audio client");
119MODULE_LICENSE("GPL");
120MODULE_ALIAS("platform:a370db-audio");
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 3920a5e8125f..9f842222e798 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -633,6 +633,7 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
633static struct of_device_id mvebu_audio_of_match[] = { 633static struct of_device_id mvebu_audio_of_match[] = {
634 { .compatible = "marvell,kirkwood-audio" }, 634 { .compatible = "marvell,kirkwood-audio" },
635 { .compatible = "marvell,dove-audio" }, 635 { .compatible = "marvell,dove-audio" },
636 { .compatible = "marvell,armada370-audio" },
636 { } 637 { }
637}; 638};
638MODULE_DEVICE_TABLE(of, mvebu_audio_of_match); 639MODULE_DEVICE_TABLE(of, mvebu_audio_of_match);
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index f141435b0b4a..56a5219c0a00 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -325,7 +325,7 @@ static void cx81801_close(struct tty_struct *tty)
325 325
326 snd_soc_dapm_sync_unlocked(dapm); 326 snd_soc_dapm_sync_unlocked(dapm);
327 327
328 snd_soc_dapm_mutex_unlock(codec); 328 snd_soc_dapm_mutex_unlock(dapm);
329} 329}
330 330
331/* Line discipline .hangup() */ 331/* Line discipline .hangup() */
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index 41ab6678b65d..259e048681c0 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -41,9 +41,8 @@ static int magician_hp_switch;
41static int magician_spk_switch = 1; 41static int magician_spk_switch = 1;
42static int magician_in_sel = MAGICIAN_MIC; 42static int magician_in_sel = MAGICIAN_MIC;
43 43
44static void magician_ext_control(struct snd_soc_codec *codec) 44static void magician_ext_control(struct snd_soc_dapm_context *dapm)
45{ 45{
46 struct snd_soc_dapm_context *dapm = &codec->dapm;
47 46
48 snd_soc_dapm_mutex_lock(dapm); 47 snd_soc_dapm_mutex_lock(dapm);
49 48
@@ -75,10 +74,9 @@ static void magician_ext_control(struct snd_soc_codec *codec)
75static int magician_startup(struct snd_pcm_substream *substream) 74static int magician_startup(struct snd_pcm_substream *substream)
76{ 75{
77 struct snd_soc_pcm_runtime *rtd = substream->private_data; 76 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_codec *codec = rtd->codec;
79 77
80 /* check the jack status at stream startup */ 78 /* check the jack status at stream startup */
81 magician_ext_control(codec); 79 magician_ext_control(&rtd->card->dapm);
82 80
83 return 0; 81 return 0;
84} 82}
@@ -277,13 +275,13 @@ static int magician_get_hp(struct snd_kcontrol *kcontrol,
277static int magician_set_hp(struct snd_kcontrol *kcontrol, 275static int magician_set_hp(struct snd_kcontrol *kcontrol,
278 struct snd_ctl_elem_value *ucontrol) 276 struct snd_ctl_elem_value *ucontrol)
279{ 277{
280 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 278 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
281 279
282 if (magician_hp_switch == ucontrol->value.integer.value[0]) 280 if (magician_hp_switch == ucontrol->value.integer.value[0])
283 return 0; 281 return 0;
284 282
285 magician_hp_switch = ucontrol->value.integer.value[0]; 283 magician_hp_switch = ucontrol->value.integer.value[0];
286 magician_ext_control(codec); 284 magician_ext_control(&card->dapm);
287 return 1; 285 return 1;
288} 286}
289 287
@@ -297,13 +295,13 @@ static int magician_get_spk(struct snd_kcontrol *kcontrol,
297static int magician_set_spk(struct snd_kcontrol *kcontrol, 295static int magician_set_spk(struct snd_kcontrol *kcontrol,
298 struct snd_ctl_elem_value *ucontrol) 296 struct snd_ctl_elem_value *ucontrol)
299{ 297{
300 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 298 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
301 299
302 if (magician_spk_switch == ucontrol->value.integer.value[0]) 300 if (magician_spk_switch == ucontrol->value.integer.value[0])
303 return 0; 301 return 0;
304 302
305 magician_spk_switch = ucontrol->value.integer.value[0]; 303 magician_spk_switch = ucontrol->value.integer.value[0];
306 magician_ext_control(codec); 304 magician_ext_control(&card->dapm);
307 return 1; 305 return 1;
308} 306}
309 307
@@ -400,7 +398,6 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
400{ 398{
401 struct snd_soc_codec *codec = rtd->codec; 399 struct snd_soc_codec *codec = rtd->codec;
402 struct snd_soc_dapm_context *dapm = &codec->dapm; 400 struct snd_soc_dapm_context *dapm = &codec->dapm;
403 int err;
404 401
405 /* NC codec pins */ 402 /* NC codec pins */
406 snd_soc_dapm_nc_pin(dapm, "VOUTLHP"); 403 snd_soc_dapm_nc_pin(dapm, "VOUTLHP");
@@ -410,19 +407,6 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
410 snd_soc_dapm_nc_pin(dapm, "VINL"); 407 snd_soc_dapm_nc_pin(dapm, "VINL");
411 snd_soc_dapm_nc_pin(dapm, "VINR"); 408 snd_soc_dapm_nc_pin(dapm, "VINR");
412 409
413 /* Add magician specific controls */
414 err = snd_soc_add_codec_controls(codec, uda1380_magician_controls,
415 ARRAY_SIZE(uda1380_magician_controls));
416 if (err < 0)
417 return err;
418
419 /* Add magician specific widgets */
420 snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
421 ARRAY_SIZE(uda1380_dapm_widgets));
422
423 /* Set up magician specific audio path interconnects */
424 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
425
426 return 0; 410 return 0;
427} 411}
428 412
@@ -456,6 +440,12 @@ static struct snd_soc_card snd_soc_card_magician = {
456 .dai_link = magician_dai, 440 .dai_link = magician_dai,
457 .num_links = ARRAY_SIZE(magician_dai), 441 .num_links = ARRAY_SIZE(magician_dai),
458 442
443 .controls = uda1380_magician_controls,
444 .num_controls = ARRAY_SIZE(uda1380_magician_controls),
445 .dapm_widgets = uda1380_dapm_widgets,
446 .num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
447 .dapm_routes = audio_map,
448 .num_dapm_routes = ARRAY_SIZE(audio_map),
459}; 449};
460 450
461static struct platform_device *magician_snd_device; 451static struct platform_device *magician_snd_device;
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index cead1658d10a..4a956d1cb269 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -44,9 +44,8 @@
44static int tosa_jack_func; 44static int tosa_jack_func;
45static int tosa_spk_func; 45static int tosa_spk_func;
46 46
47static void tosa_ext_control(struct snd_soc_codec *codec) 47static void tosa_ext_control(struct snd_soc_dapm_context *dapm)
48{ 48{
49 struct snd_soc_dapm_context *dapm = &codec->dapm;
50 49
51 snd_soc_dapm_mutex_lock(dapm); 50 snd_soc_dapm_mutex_lock(dapm);
52 51
@@ -82,10 +81,9 @@ static void tosa_ext_control(struct snd_soc_codec *codec)
82static int tosa_startup(struct snd_pcm_substream *substream) 81static int tosa_startup(struct snd_pcm_substream *substream)
83{ 82{
84 struct snd_soc_pcm_runtime *rtd = substream->private_data; 83 struct snd_soc_pcm_runtime *rtd = substream->private_data;
85 struct snd_soc_codec *codec = rtd->codec;
86 84
87 /* check the jack status at stream startup */ 85 /* check the jack status at stream startup */
88 tosa_ext_control(codec); 86 tosa_ext_control(&rtd->card->dapm);
89 87
90 return 0; 88 return 0;
91} 89}
@@ -104,13 +102,13 @@ static int tosa_get_jack(struct snd_kcontrol *kcontrol,
104static int tosa_set_jack(struct snd_kcontrol *kcontrol, 102static int tosa_set_jack(struct snd_kcontrol *kcontrol,
105 struct snd_ctl_elem_value *ucontrol) 103 struct snd_ctl_elem_value *ucontrol)
106{ 104{
107 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 105 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
108 106
109 if (tosa_jack_func == ucontrol->value.integer.value[0]) 107 if (tosa_jack_func == ucontrol->value.integer.value[0])
110 return 0; 108 return 0;
111 109
112 tosa_jack_func = ucontrol->value.integer.value[0]; 110 tosa_jack_func = ucontrol->value.integer.value[0];
113 tosa_ext_control(codec); 111 tosa_ext_control(&card->dapm);
114 return 1; 112 return 1;
115} 113}
116 114
@@ -124,13 +122,13 @@ static int tosa_get_spk(struct snd_kcontrol *kcontrol,
124static int tosa_set_spk(struct snd_kcontrol *kcontrol, 122static int tosa_set_spk(struct snd_kcontrol *kcontrol,
125 struct snd_ctl_elem_value *ucontrol) 123 struct snd_ctl_elem_value *ucontrol)
126{ 124{
127 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 125 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
128 126
129 if (tosa_spk_func == ucontrol->value.integer.value[0]) 127 if (tosa_spk_func == ucontrol->value.integer.value[0])
130 return 0; 128 return 0;
131 129
132 tosa_spk_func = ucontrol->value.integer.value[0]; 130 tosa_spk_func = ucontrol->value.integer.value[0];
133 tosa_ext_control(codec); 131 tosa_ext_control(&card->dapm);
134 return 1; 132 return 1;
135} 133}
136 134
@@ -191,24 +189,10 @@ static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
191{ 189{
192 struct snd_soc_codec *codec = rtd->codec; 190 struct snd_soc_codec *codec = rtd->codec;
193 struct snd_soc_dapm_context *dapm = &codec->dapm; 191 struct snd_soc_dapm_context *dapm = &codec->dapm;
194 int err;
195 192
196 snd_soc_dapm_nc_pin(dapm, "OUT3"); 193 snd_soc_dapm_nc_pin(dapm, "OUT3");
197 snd_soc_dapm_nc_pin(dapm, "MONOOUT"); 194 snd_soc_dapm_nc_pin(dapm, "MONOOUT");
198 195
199 /* add tosa specific controls */
200 err = snd_soc_add_codec_controls(codec, tosa_controls,
201 ARRAY_SIZE(tosa_controls));
202 if (err < 0)
203 return err;
204
205 /* add tosa specific widgets */
206 snd_soc_dapm_new_controls(dapm, tosa_dapm_widgets,
207 ARRAY_SIZE(tosa_dapm_widgets));
208
209 /* set up tosa specific audio path audio_map */
210 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
211
212 return 0; 196 return 0;
213} 197}
214 198
@@ -239,6 +223,13 @@ static struct snd_soc_card tosa = {
239 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
240 .dai_link = tosa_dai, 224 .dai_link = tosa_dai,
241 .num_links = ARRAY_SIZE(tosa_dai), 225 .num_links = ARRAY_SIZE(tosa_dai),
226
227 .controls = tosa_controls,
228 .num_controls = ARRAY_SIZE(tosa_controls),
229 .dapm_widgets = tosa_dapm_widgets,
230 .num_dapm_widgets = ARRAY_SIZE(tosa_dapm_widgets),
231 .dapm_routes = audio_map,
232 .num_dapm_routes = ARRAY_SIZE(audio_map),
242}; 233};
243 234
244static int tosa_probe(struct platform_device *pdev) 235static int tosa_probe(struct platform_device *pdev)
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 945e8abdc10f..0b21d1dc80c1 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -104,8 +104,8 @@ static int output_type_get(struct snd_kcontrol *kcontrol,
104static int output_type_put(struct snd_kcontrol *kcontrol, 104static int output_type_put(struct snd_kcontrol *kcontrol,
105 struct snd_ctl_elem_value *ucontrol) 105 struct snd_ctl_elem_value *ucontrol)
106{ 106{
107 struct snd_soc_codec *codec = kcontrol->private_data; 107 struct snd_soc_card *card = kcontrol->private_data;
108 struct snd_soc_dapm_context *dapm = &codec->dapm; 108 struct snd_soc_dapm_context *dapm = &card->dapm;
109 unsigned int val = (ucontrol->value.enumerated.item[0] != 0); 109 unsigned int val = (ucontrol->value.enumerated.item[0] != 0);
110 char *differential = "Audio Out Differential"; 110 char *differential = "Audio Out Differential";
111 char *stereo = "Audio Out Stereo"; 111 char *stereo = "Audio Out Stereo";
@@ -137,13 +137,7 @@ static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd)
137{ 137{
138 struct snd_soc_codec *codec = rtd->codec; 138 struct snd_soc_codec *codec = rtd->codec;
139 struct snd_soc_dapm_context *dapm = &codec->dapm; 139 struct snd_soc_dapm_context *dapm = &codec->dapm;
140 140 struct snd_soc_card *card = rtd->card;
141 /* Add s6105 specific widgets */
142 snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
143 ARRAY_SIZE(aic3x_dapm_widgets));
144
145 /* Set up s6105 specific audio path audio_map */
146 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
147 141
148 /* not present */ 142 /* not present */
149 snd_soc_dapm_nc_pin(dapm, "MONO_LOUT"); 143 snd_soc_dapm_nc_pin(dapm, "MONO_LOUT");
@@ -157,17 +151,10 @@ static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd)
157 snd_soc_dapm_nc_pin(dapm, "RLOUT"); 151 snd_soc_dapm_nc_pin(dapm, "RLOUT");
158 snd_soc_dapm_nc_pin(dapm, "HPRCOM"); 152 snd_soc_dapm_nc_pin(dapm, "HPRCOM");
159 153
160 /* always connected */
161 snd_soc_dapm_enable_pin(dapm, "Audio In");
162
163 /* must correspond to audio_out_mux.private_value initializer */ 154 /* must correspond to audio_out_mux.private_value initializer */
164 snd_soc_dapm_disable_pin(dapm, "Audio Out Differential"); 155 snd_soc_dapm_disable_pin(&card->dapm, "Audio Out Differential");
165 snd_soc_dapm_sync(dapm);
166 snd_soc_dapm_enable_pin(dapm, "Audio Out Stereo");
167
168 snd_soc_dapm_sync(dapm);
169 156
170 snd_ctl_add(codec->card->snd_card, snd_ctl_new1(&audio_out_mux, codec)); 157 snd_ctl_add(card->snd_card, snd_ctl_new1(&audio_out_mux, card));
171 158
172 return 0; 159 return 0;
173} 160}
@@ -190,6 +177,11 @@ static struct snd_soc_card snd_soc_card_s6105 = {
190 .owner = THIS_MODULE, 177 .owner = THIS_MODULE,
191 .dai_link = &s6105_dai, 178 .dai_link = &s6105_dai,
192 .num_links = 1, 179 .num_links = 1,
180
181 .dapm_widgets = aic3x_dapm_widgets,
182 .num_dapm_widgets = ARRAY_SIZE(aic3x_dapm_widgets),
183 .dapm_routes = audio_map,
184 .num_dapm_routes = ARRAY_SIZE(audio_map),
193}; 185};
194 186
195static struct s6000_snd_platform_data s6105_snd_data __initdata = { 187static struct s6000_snd_platform_data s6105_snd_data __initdata = {
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 359c2849b364..b322cf294d06 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1137,6 +1137,16 @@ static int soc_probe_codec(struct snd_soc_card *card,
1137 1137
1138 codec->dapm.idle_bias_off = driver->idle_bias_off; 1138 codec->dapm.idle_bias_off = driver->idle_bias_off;
1139 1139
1140 if (!codec->write && dev_get_regmap(codec->dev, NULL)) {
1141 /* Set the default I/O up try regmap */
1142 ret = snd_soc_codec_set_cache_io(codec, NULL);
1143 if (ret < 0) {
1144 dev_err(codec->dev,
1145 "Failed to set cache I/O: %d\n", ret);
1146 goto err_probe;
1147 }
1148 }
1149
1140 if (driver->probe) { 1150 if (driver->probe) {
1141 ret = driver->probe(codec); 1151 ret = driver->probe(codec);
1142 if (ret < 0) { 1152 if (ret < 0) {
@@ -1150,10 +1160,6 @@ static int soc_probe_codec(struct snd_soc_card *card,
1150 codec->name); 1160 codec->name);
1151 } 1161 }
1152 1162
1153 /* If the driver didn't set I/O up try regmap */
1154 if (!codec->write && dev_get_regmap(codec->dev, NULL))
1155 snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
1156
1157 if (driver->controls) 1163 if (driver->controls)
1158 snd_soc_add_codec_controls(codec, driver->controls, 1164 snd_soc_add_codec_controls(codec, driver->controls,
1159 driver->num_controls); 1165 driver->num_controls);
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index aa886cca3ecf..8aa086996866 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -69,9 +69,7 @@ static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg)
69 * snd_soc_codec_set_cache_io: Set up standard I/O functions. 69 * snd_soc_codec_set_cache_io: Set up standard I/O functions.
70 * 70 *
71 * @codec: CODEC to configure. 71 * @codec: CODEC to configure.
72 * @addr_bits: Number of bits of register address data. 72 * @map: Register map to write to
73 * @data_bits: Number of bits of data per register.
74 * @control: Control bus used.
75 * 73 *
76 * Register formats are frequently shared between many I2C and SPI 74 * Register formats are frequently shared between many I2C and SPI
77 * devices. In order to promote code reuse the ASoC core provides 75 * devices. In order to promote code reuse the ASoC core provides
@@ -85,60 +83,36 @@ static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg)
85 * volatile registers. 83 * volatile registers.
86 */ 84 */
87int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 85int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
88 int addr_bits, int data_bits, 86 struct regmap *regmap)
89 enum snd_soc_control_type control)
90{ 87{
91 struct regmap_config config;
92 int ret; 88 int ret;
93 89
94 memset(&config, 0, sizeof(config)); 90 /* Device has made its own regmap arrangements */
95 codec->write = hw_write; 91 if (!regmap)
96 codec->read = hw_read; 92 codec->control_data = dev_get_regmap(codec->dev, NULL);
93 else
94 codec->control_data = regmap;
97 95
98 config.reg_bits = addr_bits; 96 if (IS_ERR(codec->control_data))
99 config.val_bits = data_bits; 97 return PTR_ERR(codec->control_data);
100 98
101 switch (control) { 99 codec->write = hw_write;
102#if IS_ENABLED(CONFIG_REGMAP_I2C) 100 codec->read = hw_read;
103 case SND_SOC_I2C:
104 codec->control_data = regmap_init_i2c(to_i2c_client(codec->dev),
105 &config);
106 break;
107#endif
108 101
109#if IS_ENABLED(CONFIG_REGMAP_SPI) 102 ret = regmap_get_val_bytes(codec->control_data);
110 case SND_SOC_SPI: 103 /* Errors are legitimate for non-integer byte
111 codec->control_data = regmap_init_spi(to_spi_device(codec->dev), 104 * multiples */
112 &config); 105 if (ret > 0)
113 break; 106 codec->val_bytes = ret;
114#endif
115 107
116 case SND_SOC_REGMAP: 108 codec->using_regmap = true;
117 /* Device has made its own regmap arrangements */
118 codec->using_regmap = true;
119 if (!codec->control_data)
120 codec->control_data = dev_get_regmap(codec->dev, NULL);
121
122 if (codec->control_data) {
123 ret = regmap_get_val_bytes(codec->control_data);
124 /* Errors are legitimate for non-integer byte
125 * multiples */
126 if (ret > 0)
127 codec->val_bytes = ret;
128 }
129 break;
130
131 default:
132 return -EINVAL;
133 }
134 109
135 return PTR_ERR_OR_ZERO(codec->control_data); 110 return 0;
136} 111}
137EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); 112EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
138#else 113#else
139int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 114int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
140 int addr_bits, int data_bits, 115 struct regmap *regmap)
141 enum snd_soc_control_type control)
142{ 116{
143 return -ENOTSUPP; 117 return -ENOTSUPP;
144} 118}
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 23d43dac91da..b903f822d1b2 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -250,7 +250,7 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
250 report = 0; 250 report = 0;
251 251
252 if (gpio->jack_status_check) 252 if (gpio->jack_status_check)
253 report = gpio->jack_status_check(); 253 report = gpio->jack_status_check(gpio->data);
254 254
255 snd_soc_jack_report(jack, report, gpio->report); 255 snd_soc_jack_report(jack, report, gpio->report);
256} 256}
@@ -342,7 +342,8 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
342 gpio_export(gpios[i].gpio, false); 342 gpio_export(gpios[i].gpio, false);
343 343
344 /* Update initial jack status */ 344 /* Update initial jack status */
345 snd_soc_jack_gpio_detect(&gpios[i]); 345 schedule_delayed_work(&gpios[i].work,
346 msecs_to_jiffies(gpios[i].debounce_time));
346 } 347 }
347 348
348 return 0; 349 return 0;