diff options
-rw-r--r-- | Documentation/devicetree/bindings/sound/tlv320aic32x4.txt | 30 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/sound/tlv320aic3x.txt | 1 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 4 | ||||
-rw-r--r-- | sound/soc/codecs/cs42l51.c | 15 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic23-spi.c | 1 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic23.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic26.c | 5 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic32x4.c | 232 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 32 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.c | 84 | ||||
-rw-r--r-- | sound/soc/codecs/twl6040.c | 17 | ||||
-rw-r--r-- | sound/soc/codecs/uda1380.c | 38 | ||||
-rw-r--r-- | sound/soc/codecs/wl1273.c | 7 | ||||
-rw-r--r-- | sound/soc/codecs/wm2200.c | 18 |
14 files changed, 336 insertions, 150 deletions
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt b/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt new file mode 100644 index 000000000000..5e2741af27be --- /dev/null +++ b/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | Texas Instruments - tlv320aic32x4 Codec module | ||
2 | |||
3 | The tlv320aic32x4 serial control bus communicates through I2C protocols | ||
4 | |||
5 | Required properties: | ||
6 | - compatible: Should be "ti,tlv320aic32x4" | ||
7 | - reg: I2C slave address | ||
8 | - supply-*: Required supply regulators are: | ||
9 | "iov" - digital IO power supply | ||
10 | "ldoin" - LDO power supply | ||
11 | "dv" - Digital core power supply | ||
12 | "av" - Analog core power supply | ||
13 | If you supply ldoin, dv and av are optional. Otherwise they are required | ||
14 | See regulator/regulator.txt for more information about the detailed binding | ||
15 | format. | ||
16 | |||
17 | Optional properties: | ||
18 | - reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt | ||
19 | - clocks/clock-names: Clock named 'mclk' for the master clock of the codec. | ||
20 | See clock/clock-bindings.txt for information about the detailed format. | ||
21 | |||
22 | |||
23 | Example: | ||
24 | |||
25 | codec: tlv320aic32x4@18 { | ||
26 | compatible = "ti,tlv320aic32x4"; | ||
27 | reg = <0x18>; | ||
28 | clocks = <&clks 201>; | ||
29 | clock-names = "mclk"; | ||
30 | }; | ||
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index 9d8ea14db490..5e6040c2c2e9 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt | |||
@@ -6,7 +6,6 @@ Required properties: | |||
6 | 6 | ||
7 | - compatible - "string" - One of: | 7 | - compatible - "string" - One of: |
8 | "ti,tlv320aic3x" - Generic TLV320AIC3x device | 8 | "ti,tlv320aic3x" - Generic TLV320AIC3x device |
9 | "ti,tlv320aic32x4" - TLV320AIC32x4 | ||
10 | "ti,tlv320aic33" - TLV320AIC33 | 9 | "ti,tlv320aic33" - TLV320AIC33 |
11 | "ti,tlv320aic3007" - TLV320AIC3007 | 10 | "ti,tlv320aic3007" - TLV320AIC3007 |
12 | "ti,tlv320aic3106" - TLV320AIC3106 | 11 | "ti,tlv320aic3106" - TLV320AIC3106 |
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index a906ef458c8f..cb46c4c78dc2 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -79,8 +79,8 @@ snd-soc-tlv320aic23-objs := tlv320aic23.o | |||
79 | snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o | 79 | snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o |
80 | snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o | 80 | snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o |
81 | snd-soc-tlv320aic26-objs := tlv320aic26.o | 81 | snd-soc-tlv320aic26-objs := tlv320aic26.o |
82 | snd-soc-tlv320aic3x-objs := tlv320aic3x.o | ||
83 | snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o | 82 | snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o |
83 | snd-soc-tlv320aic3x-objs := tlv320aic3x.o | ||
84 | snd-soc-tlv320dac33-objs := tlv320dac33.o | 84 | snd-soc-tlv320dac33-objs := tlv320dac33.o |
85 | snd-soc-twl4030-objs := twl4030.o | 85 | snd-soc-twl4030-objs := twl4030.o |
86 | snd-soc-twl6040-objs := twl6040.o | 86 | snd-soc-twl6040-objs := twl6040.o |
@@ -223,8 +223,8 @@ obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o | |||
223 | obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o | 223 | obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o |
224 | obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o | 224 | obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o |
225 | obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o | 225 | obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o |
226 | obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o | ||
227 | obj-$(CONFIG_SND_SOC_TLV320AIC32X4) += snd-soc-tlv320aic32x4.o | 226 | obj-$(CONFIG_SND_SOC_TLV320AIC32X4) += snd-soc-tlv320aic32x4.o |
227 | obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o | ||
228 | obj-$(CONFIG_SND_SOC_TLV320DAC33) += snd-soc-tlv320dac33.o | 228 | obj-$(CONFIG_SND_SOC_TLV320DAC33) += snd-soc-tlv320dac33.o |
229 | obj-$(CONFIG_SND_SOC_TWL4030) += snd-soc-twl4030.o | 229 | obj-$(CONFIG_SND_SOC_TWL4030) += snd-soc-twl4030.o |
230 | obj-$(CONFIG_SND_SOC_TWL6040) += snd-soc-twl6040.o | 230 | obj-$(CONFIG_SND_SOC_TWL6040) += snd-soc-twl6040.o |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 3eab46020a30..5caf75bc6bca 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
@@ -117,8 +117,7 @@ static const char *chan_mix[] = { | |||
117 | "R L", | 117 | "R L", |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static const struct soc_enum cs42l51_chan_mix = | 120 | static SOC_ENUM_SINGLE_EXT_DECL(cs42l51_chan_mix, chan_mix); |
121 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(chan_mix), chan_mix); | ||
122 | 121 | ||
123 | static const struct snd_kcontrol_new cs42l51_snd_controls[] = { | 122 | static const struct snd_kcontrol_new cs42l51_snd_controls[] = { |
124 | SOC_DOUBLE_R_SX_TLV("PCM Playback Volume", | 123 | SOC_DOUBLE_R_SX_TLV("PCM Playback Volume", |
@@ -174,22 +173,22 @@ static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w, | |||
174 | 173 | ||
175 | static const char *cs42l51_dac_names[] = {"Direct PCM", | 174 | static const char *cs42l51_dac_names[] = {"Direct PCM", |
176 | "DSP PCM", "ADC"}; | 175 | "DSP PCM", "ADC"}; |
177 | static const struct soc_enum cs42l51_dac_mux_enum = | 176 | static SOC_ENUM_SINGLE_DECL(cs42l51_dac_mux_enum, |
178 | SOC_ENUM_SINGLE(CS42L51_DAC_CTL, 6, 3, cs42l51_dac_names); | 177 | CS42L51_DAC_CTL, 6, cs42l51_dac_names); |
179 | static const struct snd_kcontrol_new cs42l51_dac_mux_controls = | 178 | static const struct snd_kcontrol_new cs42l51_dac_mux_controls = |
180 | SOC_DAPM_ENUM("Route", cs42l51_dac_mux_enum); | 179 | SOC_DAPM_ENUM("Route", cs42l51_dac_mux_enum); |
181 | 180 | ||
182 | static const char *cs42l51_adcl_names[] = {"AIN1 Left", "AIN2 Left", | 181 | static const char *cs42l51_adcl_names[] = {"AIN1 Left", "AIN2 Left", |
183 | "MIC Left", "MIC+preamp Left"}; | 182 | "MIC Left", "MIC+preamp Left"}; |
184 | static const struct soc_enum cs42l51_adcl_mux_enum = | 183 | static SOC_ENUM_SINGLE_DECL(cs42l51_adcl_mux_enum, |
185 | SOC_ENUM_SINGLE(CS42L51_ADC_INPUT, 4, 4, cs42l51_adcl_names); | 184 | CS42L51_ADC_INPUT, 4, cs42l51_adcl_names); |
186 | static const struct snd_kcontrol_new cs42l51_adcl_mux_controls = | 185 | static const struct snd_kcontrol_new cs42l51_adcl_mux_controls = |
187 | SOC_DAPM_ENUM("Route", cs42l51_adcl_mux_enum); | 186 | SOC_DAPM_ENUM("Route", cs42l51_adcl_mux_enum); |
188 | 187 | ||
189 | static const char *cs42l51_adcr_names[] = {"AIN1 Right", "AIN2 Right", | 188 | static const char *cs42l51_adcr_names[] = {"AIN1 Right", "AIN2 Right", |
190 | "MIC Right", "MIC+preamp Right"}; | 189 | "MIC Right", "MIC+preamp Right"}; |
191 | static const struct soc_enum cs42l51_adcr_mux_enum = | 190 | static SOC_ENUM_SINGLE_DECL(cs42l51_adcr_mux_enum, |
192 | SOC_ENUM_SINGLE(CS42L51_ADC_INPUT, 6, 4, cs42l51_adcr_names); | 191 | CS42L51_ADC_INPUT, 6, cs42l51_adcr_names); |
193 | static const struct snd_kcontrol_new cs42l51_adcr_mux_controls = | 192 | static const struct snd_kcontrol_new cs42l51_adcr_mux_controls = |
194 | SOC_DAPM_ENUM("Route", cs42l51_adcr_mux_enum); | 193 | SOC_DAPM_ENUM("Route", cs42l51_adcr_mux_enum); |
195 | 194 | ||
diff --git a/sound/soc/codecs/tlv320aic23-spi.c b/sound/soc/codecs/tlv320aic23-spi.c index 585aea436c6a..3b387e41d75d 100644 --- a/sound/soc/codecs/tlv320aic23-spi.c +++ b/sound/soc/codecs/tlv320aic23-spi.c | |||
@@ -25,7 +25,6 @@ static int aic23_spi_probe(struct spi_device *spi) | |||
25 | 25 | ||
26 | dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n"); | 26 | dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n"); |
27 | 27 | ||
28 | spi->bits_per_word = 16; | ||
29 | spi->mode = SPI_MODE_0; | 28 | spi->mode = SPI_MODE_0; |
30 | ret = spi_setup(spi); | 29 | ret = spi_setup(spi); |
31 | if (ret < 0) | 30 | if (ret < 0) |
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 27261e4b27c7..dc9a52fcb39a 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -59,6 +59,7 @@ const struct regmap_config tlv320aic23_regmap = { | |||
59 | .num_reg_defaults = ARRAY_SIZE(tlv320aic23_reg), | 59 | .num_reg_defaults = ARRAY_SIZE(tlv320aic23_reg), |
60 | .cache_type = REGCACHE_RBTREE, | 60 | .cache_type = REGCACHE_RBTREE, |
61 | }; | 61 | }; |
62 | EXPORT_SYMBOL(tlv320aic23_regmap); | ||
62 | 63 | ||
63 | static const char *rec_src_text[] = { "Line", "Mic" }; | 64 | static const char *rec_src_text[] = { "Line", "Mic" }; |
64 | static const char *deemph_text[] = {"None", "32Khz", "44.1Khz", "48Khz"}; | 65 | static const char *deemph_text[] = {"None", "32Khz", "44.1Khz", "48Khz"}; |
@@ -634,6 +635,7 @@ int tlv320aic23_probe(struct device *dev, struct regmap *regmap) | |||
634 | return snd_soc_register_codec(dev, &soc_codec_dev_tlv320aic23, | 635 | return snd_soc_register_codec(dev, &soc_codec_dev_tlv320aic23, |
635 | &tlv320aic23_dai, 1); | 636 | &tlv320aic23_dai, 1); |
636 | } | 637 | } |
638 | EXPORT_SYMBOL(tlv320aic23_probe); | ||
637 | 639 | ||
638 | MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); | 640 | MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); |
639 | MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); | 641 | MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); |
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 94a658fa6d97..ff5f23d482b7 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c | |||
@@ -238,8 +238,9 @@ static struct snd_soc_dai_driver aic26_dai = { | |||
238 | * ALSA controls | 238 | * ALSA controls |
239 | */ | 239 | */ |
240 | static const char *aic26_capture_src_text[] = {"Mic", "Aux"}; | 240 | static const char *aic26_capture_src_text[] = {"Mic", "Aux"}; |
241 | static const struct soc_enum aic26_capture_src_enum = | 241 | static SOC_ENUM_SINGLE_DECL(aic26_capture_src_enum, |
242 | SOC_ENUM_SINGLE(AIC26_REG_AUDIO_CTRL1, 12, 2, aic26_capture_src_text); | 242 | AIC26_REG_AUDIO_CTRL1, 12, |
243 | aic26_capture_src_text); | ||
243 | 244 | ||
244 | static const struct snd_kcontrol_new aic26_snd_controls[] = { | 245 | static const struct snd_kcontrol_new aic26_snd_controls[] = { |
245 | /* Output */ | 246 | /* Output */ |
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 688151ba309a..c6bd7e75352d 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c | |||
@@ -29,9 +29,12 @@ | |||
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/pm.h> | 30 | #include <linux/pm.h> |
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #include <linux/of_gpio.h> | ||
32 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
33 | #include <linux/cdev.h> | 34 | #include <linux/cdev.h> |
34 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/clk.h> | ||
37 | #include <linux/regulator/consumer.h> | ||
35 | 38 | ||
36 | #include <sound/tlv320aic32x4.h> | 39 | #include <sound/tlv320aic32x4.h> |
37 | #include <sound/core.h> | 40 | #include <sound/core.h> |
@@ -66,20 +69,32 @@ struct aic32x4_priv { | |||
66 | u32 micpga_routing; | 69 | u32 micpga_routing; |
67 | bool swapdacs; | 70 | bool swapdacs; |
68 | int rstn_gpio; | 71 | int rstn_gpio; |
72 | struct clk *mclk; | ||
73 | |||
74 | struct regulator *supply_ldo; | ||
75 | struct regulator *supply_iov; | ||
76 | struct regulator *supply_dv; | ||
77 | struct regulator *supply_av; | ||
69 | }; | 78 | }; |
70 | 79 | ||
71 | /* 0dB min, 1dB steps */ | ||
72 | static DECLARE_TLV_DB_SCALE(tlv_step_1, 0, 100, 0); | ||
73 | /* 0dB min, 0.5dB steps */ | 80 | /* 0dB min, 0.5dB steps */ |
74 | static DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0); | 81 | static DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0); |
82 | /* -63.5dB min, 0.5dB steps */ | ||
83 | static DECLARE_TLV_DB_SCALE(tlv_pcm, -6350, 50, 0); | ||
84 | /* -6dB min, 1dB steps */ | ||
85 | static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0); | ||
86 | /* -12dB min, 0.5dB steps */ | ||
87 | static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0); | ||
75 | 88 | ||
76 | static const struct snd_kcontrol_new aic32x4_snd_controls[] = { | 89 | static const struct snd_kcontrol_new aic32x4_snd_controls[] = { |
77 | SOC_DOUBLE_R_TLV("PCM Playback Volume", AIC32X4_LDACVOL, | 90 | SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL, |
78 | AIC32X4_RDACVOL, 0, 0x30, 0, tlv_step_0_5), | 91 | AIC32X4_RDACVOL, 0, -0x7f, 0x30, 7, 0, tlv_pcm), |
79 | SOC_DOUBLE_R_TLV("HP Driver Gain Volume", AIC32X4_HPLGAIN, | 92 | SOC_DOUBLE_R_S_TLV("HP Driver Gain Volume", AIC32X4_HPLGAIN, |
80 | AIC32X4_HPRGAIN, 0, 0x1D, 0, tlv_step_1), | 93 | AIC32X4_HPRGAIN, 0, -0x6, 0x1d, 5, 0, |
81 | SOC_DOUBLE_R_TLV("LO Driver Gain Volume", AIC32X4_LOLGAIN, | 94 | tlv_driver_gain), |
82 | AIC32X4_LORGAIN, 0, 0x1D, 0, tlv_step_1), | 95 | SOC_DOUBLE_R_S_TLV("LO Driver Gain Volume", AIC32X4_LOLGAIN, |
96 | AIC32X4_LORGAIN, 0, -0x6, 0x1d, 5, 0, | ||
97 | tlv_driver_gain), | ||
83 | SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN, | 98 | SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN, |
84 | AIC32X4_HPRGAIN, 6, 0x01, 1), | 99 | AIC32X4_HPRGAIN, 6, 0x01, 1), |
85 | SOC_DOUBLE_R("LO DAC Playback Switch", AIC32X4_LOLGAIN, | 100 | SOC_DOUBLE_R("LO DAC Playback Switch", AIC32X4_LOLGAIN, |
@@ -90,8 +105,8 @@ static const struct snd_kcontrol_new aic32x4_snd_controls[] = { | |||
90 | SOC_SINGLE("ADCFGA Left Mute Switch", AIC32X4_ADCFGA, 7, 1, 0), | 105 | SOC_SINGLE("ADCFGA Left Mute Switch", AIC32X4_ADCFGA, 7, 1, 0), |
91 | SOC_SINGLE("ADCFGA Right Mute Switch", AIC32X4_ADCFGA, 3, 1, 0), | 106 | SOC_SINGLE("ADCFGA Right Mute Switch", AIC32X4_ADCFGA, 3, 1, 0), |
92 | 107 | ||
93 | SOC_DOUBLE_R_TLV("ADC Level Volume", AIC32X4_LADCVOL, | 108 | SOC_DOUBLE_R_S_TLV("ADC Level Volume", AIC32X4_LADCVOL, |
94 | AIC32X4_RADCVOL, 0, 0x28, 0, tlv_step_0_5), | 109 | AIC32X4_RADCVOL, 0, -0x18, 0x28, 6, 0, tlv_adc_vol), |
95 | SOC_DOUBLE_R_TLV("PGA Level Volume", AIC32X4_LMICPGAVOL, | 110 | SOC_DOUBLE_R_TLV("PGA Level Volume", AIC32X4_LMICPGAVOL, |
96 | AIC32X4_RMICPGAVOL, 0, 0x5f, 0, tlv_step_0_5), | 111 | AIC32X4_RMICPGAVOL, 0, 0x5f, 0, tlv_step_0_5), |
97 | 112 | ||
@@ -480,8 +495,18 @@ static int aic32x4_mute(struct snd_soc_dai *dai, int mute) | |||
480 | static int aic32x4_set_bias_level(struct snd_soc_codec *codec, | 495 | static int aic32x4_set_bias_level(struct snd_soc_codec *codec, |
481 | enum snd_soc_bias_level level) | 496 | enum snd_soc_bias_level level) |
482 | { | 497 | { |
498 | struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); | ||
499 | int ret; | ||
500 | |||
483 | switch (level) { | 501 | switch (level) { |
484 | case SND_SOC_BIAS_ON: | 502 | case SND_SOC_BIAS_ON: |
503 | /* Switch on master clock */ | ||
504 | ret = clk_prepare_enable(aic32x4->mclk); | ||
505 | if (ret) { | ||
506 | dev_err(codec->dev, "Failed to enable master clock\n"); | ||
507 | return ret; | ||
508 | } | ||
509 | |||
485 | /* Switch on PLL */ | 510 | /* Switch on PLL */ |
486 | snd_soc_update_bits(codec, AIC32X4_PLLPR, | 511 | snd_soc_update_bits(codec, AIC32X4_PLLPR, |
487 | AIC32X4_PLLEN, AIC32X4_PLLEN); | 512 | AIC32X4_PLLEN, AIC32X4_PLLEN); |
@@ -509,29 +534,32 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, | |||
509 | case SND_SOC_BIAS_PREPARE: | 534 | case SND_SOC_BIAS_PREPARE: |
510 | break; | 535 | break; |
511 | case SND_SOC_BIAS_STANDBY: | 536 | case SND_SOC_BIAS_STANDBY: |
512 | /* Switch off PLL */ | 537 | /* Switch off BCLK_N Divider */ |
513 | snd_soc_update_bits(codec, AIC32X4_PLLPR, | 538 | snd_soc_update_bits(codec, AIC32X4_BCLKN, |
514 | AIC32X4_PLLEN, 0); | 539 | AIC32X4_BCLKEN, 0); |
515 | 540 | ||
516 | /* Switch off NDAC Divider */ | 541 | /* Switch off MADC Divider */ |
517 | snd_soc_update_bits(codec, AIC32X4_NDAC, | 542 | snd_soc_update_bits(codec, AIC32X4_MADC, |
518 | AIC32X4_NDACEN, 0); | 543 | AIC32X4_MADCEN, 0); |
544 | |||
545 | /* Switch off NADC Divider */ | ||
546 | snd_soc_update_bits(codec, AIC32X4_NADC, | ||
547 | AIC32X4_NADCEN, 0); | ||
519 | 548 | ||
520 | /* Switch off MDAC Divider */ | 549 | /* Switch off MDAC Divider */ |
521 | snd_soc_update_bits(codec, AIC32X4_MDAC, | 550 | snd_soc_update_bits(codec, AIC32X4_MDAC, |
522 | AIC32X4_MDACEN, 0); | 551 | AIC32X4_MDACEN, 0); |
523 | 552 | ||
524 | /* Switch off NADC Divider */ | 553 | /* Switch off NDAC Divider */ |
525 | snd_soc_update_bits(codec, AIC32X4_NADC, | 554 | snd_soc_update_bits(codec, AIC32X4_NDAC, |
526 | AIC32X4_NADCEN, 0); | 555 | AIC32X4_NDACEN, 0); |
527 | 556 | ||
528 | /* Switch off MADC Divider */ | 557 | /* Switch off PLL */ |
529 | snd_soc_update_bits(codec, AIC32X4_MADC, | 558 | snd_soc_update_bits(codec, AIC32X4_PLLPR, |
530 | AIC32X4_MADCEN, 0); | 559 | AIC32X4_PLLEN, 0); |
531 | 560 | ||
532 | /* Switch off BCLK_N Divider */ | 561 | /* Switch off master clock */ |
533 | snd_soc_update_bits(codec, AIC32X4_BCLKN, | 562 | clk_disable_unprepare(aic32x4->mclk); |
534 | AIC32X4_BCLKEN, 0); | ||
535 | break; | 563 | break; |
536 | case SND_SOC_BIAS_OFF: | 564 | case SND_SOC_BIAS_OFF: |
537 | break; | 565 | break; |
@@ -588,7 +616,7 @@ static int aic32x4_probe(struct snd_soc_codec *codec) | |||
588 | 616 | ||
589 | snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); | 617 | snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); |
590 | 618 | ||
591 | if (aic32x4->rstn_gpio >= 0) { | 619 | if (gpio_is_valid(aic32x4->rstn_gpio)) { |
592 | ndelay(10); | 620 | ndelay(10); |
593 | gpio_set_value(aic32x4->rstn_gpio, 1); | 621 | gpio_set_value(aic32x4->rstn_gpio, 1); |
594 | } | 622 | } |
@@ -663,11 +691,122 @@ static struct snd_soc_codec_driver soc_codec_dev_aic32x4 = { | |||
663 | .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), | 691 | .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), |
664 | }; | 692 | }; |
665 | 693 | ||
694 | static int aic32x4_parse_dt(struct aic32x4_priv *aic32x4, | ||
695 | struct device_node *np) | ||
696 | { | ||
697 | aic32x4->swapdacs = false; | ||
698 | aic32x4->micpga_routing = 0; | ||
699 | aic32x4->rstn_gpio = of_get_named_gpio(np, "reset-gpios", 0); | ||
700 | |||
701 | return 0; | ||
702 | } | ||
703 | |||
704 | static void aic32x4_disable_regulators(struct aic32x4_priv *aic32x4) | ||
705 | { | ||
706 | regulator_disable(aic32x4->supply_iov); | ||
707 | |||
708 | if (!IS_ERR(aic32x4->supply_ldo)) | ||
709 | regulator_disable(aic32x4->supply_ldo); | ||
710 | |||
711 | if (!IS_ERR(aic32x4->supply_dv)) | ||
712 | regulator_disable(aic32x4->supply_dv); | ||
713 | |||
714 | if (!IS_ERR(aic32x4->supply_av)) | ||
715 | regulator_disable(aic32x4->supply_av); | ||
716 | } | ||
717 | |||
718 | static int aic32x4_setup_regulators(struct device *dev, | ||
719 | struct aic32x4_priv *aic32x4) | ||
720 | { | ||
721 | int ret = 0; | ||
722 | |||
723 | aic32x4->supply_ldo = devm_regulator_get_optional(dev, "ldoin"); | ||
724 | aic32x4->supply_iov = devm_regulator_get(dev, "iov"); | ||
725 | aic32x4->supply_dv = devm_regulator_get_optional(dev, "dv"); | ||
726 | aic32x4->supply_av = devm_regulator_get_optional(dev, "av"); | ||
727 | |||
728 | /* Check if the regulator requirements are fulfilled */ | ||
729 | |||
730 | if (IS_ERR(aic32x4->supply_iov)) { | ||
731 | dev_err(dev, "Missing supply 'iov'\n"); | ||
732 | return PTR_ERR(aic32x4->supply_iov); | ||
733 | } | ||
734 | |||
735 | if (IS_ERR(aic32x4->supply_ldo)) { | ||
736 | if (PTR_ERR(aic32x4->supply_ldo) == -EPROBE_DEFER) | ||
737 | return -EPROBE_DEFER; | ||
738 | |||
739 | if (IS_ERR(aic32x4->supply_dv)) { | ||
740 | dev_err(dev, "Missing supply 'dv' or 'ldoin'\n"); | ||
741 | return PTR_ERR(aic32x4->supply_dv); | ||
742 | } | ||
743 | if (IS_ERR(aic32x4->supply_av)) { | ||
744 | dev_err(dev, "Missing supply 'av' or 'ldoin'\n"); | ||
745 | return PTR_ERR(aic32x4->supply_av); | ||
746 | } | ||
747 | } else { | ||
748 | if (IS_ERR(aic32x4->supply_dv) && | ||
749 | PTR_ERR(aic32x4->supply_dv) == -EPROBE_DEFER) | ||
750 | return -EPROBE_DEFER; | ||
751 | if (IS_ERR(aic32x4->supply_av) && | ||
752 | PTR_ERR(aic32x4->supply_av) == -EPROBE_DEFER) | ||
753 | return -EPROBE_DEFER; | ||
754 | } | ||
755 | |||
756 | ret = regulator_enable(aic32x4->supply_iov); | ||
757 | if (ret) { | ||
758 | dev_err(dev, "Failed to enable regulator iov\n"); | ||
759 | return ret; | ||
760 | } | ||
761 | |||
762 | if (!IS_ERR(aic32x4->supply_ldo)) { | ||
763 | ret = regulator_enable(aic32x4->supply_ldo); | ||
764 | if (ret) { | ||
765 | dev_err(dev, "Failed to enable regulator ldo\n"); | ||
766 | goto error_ldo; | ||
767 | } | ||
768 | } | ||
769 | |||
770 | if (!IS_ERR(aic32x4->supply_dv)) { | ||
771 | ret = regulator_enable(aic32x4->supply_dv); | ||
772 | if (ret) { | ||
773 | dev_err(dev, "Failed to enable regulator dv\n"); | ||
774 | goto error_dv; | ||
775 | } | ||
776 | } | ||
777 | |||
778 | if (!IS_ERR(aic32x4->supply_av)) { | ||
779 | ret = regulator_enable(aic32x4->supply_av); | ||
780 | if (ret) { | ||
781 | dev_err(dev, "Failed to enable regulator av\n"); | ||
782 | goto error_av; | ||
783 | } | ||
784 | } | ||
785 | |||
786 | if (!IS_ERR(aic32x4->supply_ldo) && IS_ERR(aic32x4->supply_av)) | ||
787 | aic32x4->power_cfg |= AIC32X4_PWR_AIC32X4_LDO_ENABLE; | ||
788 | |||
789 | return 0; | ||
790 | |||
791 | error_av: | ||
792 | if (!IS_ERR(aic32x4->supply_dv)) | ||
793 | regulator_disable(aic32x4->supply_dv); | ||
794 | |||
795 | error_dv: | ||
796 | if (!IS_ERR(aic32x4->supply_ldo)) | ||
797 | regulator_disable(aic32x4->supply_ldo); | ||
798 | |||
799 | error_ldo: | ||
800 | regulator_disable(aic32x4->supply_iov); | ||
801 | return ret; | ||
802 | } | ||
803 | |||
666 | static int aic32x4_i2c_probe(struct i2c_client *i2c, | 804 | static int aic32x4_i2c_probe(struct i2c_client *i2c, |
667 | const struct i2c_device_id *id) | 805 | const struct i2c_device_id *id) |
668 | { | 806 | { |
669 | struct aic32x4_pdata *pdata = i2c->dev.platform_data; | 807 | struct aic32x4_pdata *pdata = i2c->dev.platform_data; |
670 | struct aic32x4_priv *aic32x4; | 808 | struct aic32x4_priv *aic32x4; |
809 | struct device_node *np = i2c->dev.of_node; | ||
671 | int ret; | 810 | int ret; |
672 | 811 | ||
673 | aic32x4 = devm_kzalloc(&i2c->dev, sizeof(struct aic32x4_priv), | 812 | aic32x4 = devm_kzalloc(&i2c->dev, sizeof(struct aic32x4_priv), |
@@ -686,6 +825,12 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c, | |||
686 | aic32x4->swapdacs = pdata->swapdacs; | 825 | aic32x4->swapdacs = pdata->swapdacs; |
687 | aic32x4->micpga_routing = pdata->micpga_routing; | 826 | aic32x4->micpga_routing = pdata->micpga_routing; |
688 | aic32x4->rstn_gpio = pdata->rstn_gpio; | 827 | aic32x4->rstn_gpio = pdata->rstn_gpio; |
828 | } else if (np) { | ||
829 | ret = aic32x4_parse_dt(aic32x4, np); | ||
830 | if (ret) { | ||
831 | dev_err(&i2c->dev, "Failed to parse DT node\n"); | ||
832 | return ret; | ||
833 | } | ||
689 | } else { | 834 | } else { |
690 | aic32x4->power_cfg = 0; | 835 | aic32x4->power_cfg = 0; |
691 | aic32x4->swapdacs = false; | 836 | aic32x4->swapdacs = false; |
@@ -693,20 +838,44 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c, | |||
693 | aic32x4->rstn_gpio = -1; | 838 | aic32x4->rstn_gpio = -1; |
694 | } | 839 | } |
695 | 840 | ||
696 | if (aic32x4->rstn_gpio >= 0) { | 841 | aic32x4->mclk = devm_clk_get(&i2c->dev, "mclk"); |
842 | if (IS_ERR(aic32x4->mclk)) { | ||
843 | dev_err(&i2c->dev, "Failed getting the mclk. The current implementation does not support the usage of this codec without mclk\n"); | ||
844 | return PTR_ERR(aic32x4->mclk); | ||
845 | } | ||
846 | |||
847 | if (gpio_is_valid(aic32x4->rstn_gpio)) { | ||
697 | ret = devm_gpio_request_one(&i2c->dev, aic32x4->rstn_gpio, | 848 | ret = devm_gpio_request_one(&i2c->dev, aic32x4->rstn_gpio, |
698 | GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn"); | 849 | GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn"); |
699 | if (ret != 0) | 850 | if (ret != 0) |
700 | return ret; | 851 | return ret; |
701 | } | 852 | } |
702 | 853 | ||
854 | ret = aic32x4_setup_regulators(&i2c->dev, aic32x4); | ||
855 | if (ret) { | ||
856 | dev_err(&i2c->dev, "Failed to setup regulators\n"); | ||
857 | return ret; | ||
858 | } | ||
859 | |||
703 | ret = snd_soc_register_codec(&i2c->dev, | 860 | ret = snd_soc_register_codec(&i2c->dev, |
704 | &soc_codec_dev_aic32x4, &aic32x4_dai, 1); | 861 | &soc_codec_dev_aic32x4, &aic32x4_dai, 1); |
705 | return ret; | 862 | if (ret) { |
863 | dev_err(&i2c->dev, "Failed to register codec\n"); | ||
864 | aic32x4_disable_regulators(aic32x4); | ||
865 | return ret; | ||
866 | } | ||
867 | |||
868 | i2c_set_clientdata(i2c, aic32x4); | ||
869 | |||
870 | return 0; | ||
706 | } | 871 | } |
707 | 872 | ||
708 | static int aic32x4_i2c_remove(struct i2c_client *client) | 873 | static int aic32x4_i2c_remove(struct i2c_client *client) |
709 | { | 874 | { |
875 | struct aic32x4_priv *aic32x4 = i2c_get_clientdata(client); | ||
876 | |||
877 | aic32x4_disable_regulators(aic32x4); | ||
878 | |||
710 | snd_soc_unregister_codec(&client->dev); | 879 | snd_soc_unregister_codec(&client->dev); |
711 | return 0; | 880 | return 0; |
712 | } | 881 | } |
@@ -717,10 +886,17 @@ static const struct i2c_device_id aic32x4_i2c_id[] = { | |||
717 | }; | 886 | }; |
718 | MODULE_DEVICE_TABLE(i2c, aic32x4_i2c_id); | 887 | MODULE_DEVICE_TABLE(i2c, aic32x4_i2c_id); |
719 | 888 | ||
889 | static const struct of_device_id aic32x4_of_id[] = { | ||
890 | { .compatible = "ti,tlv320aic32x4", }, | ||
891 | { /* senitel */ } | ||
892 | }; | ||
893 | MODULE_DEVICE_TABLE(of, aic32x4_of_id); | ||
894 | |||
720 | static struct i2c_driver aic32x4_i2c_driver = { | 895 | static struct i2c_driver aic32x4_i2c_driver = { |
721 | .driver = { | 896 | .driver = { |
722 | .name = "tlv320aic32x4", | 897 | .name = "tlv320aic32x4", |
723 | .owner = THIS_MODULE, | 898 | .owner = THIS_MODULE, |
899 | .of_match_table = aic32x4_of_id, | ||
724 | }, | 900 | }, |
725 | .probe = aic32x4_i2c_probe, | 901 | .probe = aic32x4_i2c_probe, |
726 | .remove = aic32x4_i2c_remove, | 902 | .remove = aic32x4_i2c_remove, |
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 35b2d244e42e..793516146670 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -478,9 +478,7 @@ static const char *dac33_fifo_mode_texts[] = { | |||
478 | "Bypass", "Mode 1", "Mode 7" | 478 | "Bypass", "Mode 1", "Mode 7" |
479 | }; | 479 | }; |
480 | 480 | ||
481 | static const struct soc_enum dac33_fifo_mode_enum = | 481 | static SOC_ENUM_SINGLE_EXT_DECL(dac33_fifo_mode_enum, dac33_fifo_mode_texts); |
482 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dac33_fifo_mode_texts), | ||
483 | dac33_fifo_mode_texts); | ||
484 | 482 | ||
485 | /* L/R Line Output Gain */ | 483 | /* L/R Line Output Gain */ |
486 | static const char *lr_lineout_gain_texts[] = { | 484 | static const char *lr_lineout_gain_texts[] = { |
@@ -488,15 +486,13 @@ static const char *lr_lineout_gain_texts[] = { | |||
488 | "Line 0dB DAC 12dB", "Line 6dB DAC 18dB", | 486 | "Line 0dB DAC 12dB", "Line 6dB DAC 18dB", |
489 | }; | 487 | }; |
490 | 488 | ||
491 | static const struct soc_enum l_lineout_gain_enum = | 489 | static SOC_ENUM_SINGLE_DECL(l_lineout_gain_enum, |
492 | SOC_ENUM_SINGLE(DAC33_LDAC_PWR_CTRL, 0, | 490 | DAC33_LDAC_PWR_CTRL, 0, |
493 | ARRAY_SIZE(lr_lineout_gain_texts), | 491 | lr_lineout_gain_texts); |
494 | lr_lineout_gain_texts); | ||
495 | 492 | ||
496 | static const struct soc_enum r_lineout_gain_enum = | 493 | static SOC_ENUM_SINGLE_DECL(r_lineout_gain_enum, |
497 | SOC_ENUM_SINGLE(DAC33_RDAC_PWR_CTRL, 0, | 494 | DAC33_RDAC_PWR_CTRL, 0, |
498 | ARRAY_SIZE(lr_lineout_gain_texts), | 495 | lr_lineout_gain_texts); |
499 | lr_lineout_gain_texts); | ||
500 | 496 | ||
501 | /* | 497 | /* |
502 | * DACL/R digital volume control: | 498 | * DACL/R digital volume control: |
@@ -534,18 +530,16 @@ static const struct snd_kcontrol_new dac33_dapm_abypassr_control = | |||
534 | /* LOP L/R invert selection */ | 530 | /* LOP L/R invert selection */ |
535 | static const char *dac33_lr_lom_texts[] = {"DAC", "LOP"}; | 531 | static const char *dac33_lr_lom_texts[] = {"DAC", "LOP"}; |
536 | 532 | ||
537 | static const struct soc_enum dac33_left_lom_enum = | 533 | static SOC_ENUM_SINGLE_DECL(dac33_left_lom_enum, |
538 | SOC_ENUM_SINGLE(DAC33_OUT_AMP_CTRL, 3, | 534 | DAC33_OUT_AMP_CTRL, 3, |
539 | ARRAY_SIZE(dac33_lr_lom_texts), | 535 | dac33_lr_lom_texts); |
540 | dac33_lr_lom_texts); | ||
541 | 536 | ||
542 | static const struct snd_kcontrol_new dac33_dapm_left_lom_control = | 537 | static const struct snd_kcontrol_new dac33_dapm_left_lom_control = |
543 | SOC_DAPM_ENUM("Route", dac33_left_lom_enum); | 538 | SOC_DAPM_ENUM("Route", dac33_left_lom_enum); |
544 | 539 | ||
545 | static const struct soc_enum dac33_right_lom_enum = | 540 | static SOC_ENUM_SINGLE_DECL(dac33_right_lom_enum, |
546 | SOC_ENUM_SINGLE(DAC33_OUT_AMP_CTRL, 2, | 541 | DAC33_OUT_AMP_CTRL, 2, |
547 | ARRAY_SIZE(dac33_lr_lom_texts), | 542 | dac33_lr_lom_texts); |
548 | dac33_lr_lom_texts); | ||
549 | 543 | ||
550 | static const struct snd_kcontrol_new dac33_dapm_right_lom_control = | 544 | static const struct snd_kcontrol_new dac33_dapm_right_lom_control = |
551 | SOC_DAPM_ENUM("Route", dac33_right_lom_enum); | 545 | SOC_DAPM_ENUM("Route", dac33_right_lom_enum); |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 682e4ac88939..975e0f760ac1 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -415,10 +415,9 @@ static const struct snd_kcontrol_new twl4030_dapm_carkitr_controls[] = { | |||
415 | static const char *twl4030_handsfreel_texts[] = | 415 | static const char *twl4030_handsfreel_texts[] = |
416 | {"Voice", "AudioL1", "AudioL2", "AudioR2"}; | 416 | {"Voice", "AudioL1", "AudioL2", "AudioR2"}; |
417 | 417 | ||
418 | static const struct soc_enum twl4030_handsfreel_enum = | 418 | static SOC_ENUM_SINGLE_DECL(twl4030_handsfreel_enum, |
419 | SOC_ENUM_SINGLE(TWL4030_REG_HFL_CTL, 0, | 419 | TWL4030_REG_HFL_CTL, 0, |
420 | ARRAY_SIZE(twl4030_handsfreel_texts), | 420 | twl4030_handsfreel_texts); |
421 | twl4030_handsfreel_texts); | ||
422 | 421 | ||
423 | static const struct snd_kcontrol_new twl4030_dapm_handsfreel_control = | 422 | static const struct snd_kcontrol_new twl4030_dapm_handsfreel_control = |
424 | SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum); | 423 | SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum); |
@@ -431,10 +430,9 @@ static const struct snd_kcontrol_new twl4030_dapm_handsfreelmute_control = | |||
431 | static const char *twl4030_handsfreer_texts[] = | 430 | static const char *twl4030_handsfreer_texts[] = |
432 | {"Voice", "AudioR1", "AudioR2", "AudioL2"}; | 431 | {"Voice", "AudioR1", "AudioR2", "AudioL2"}; |
433 | 432 | ||
434 | static const struct soc_enum twl4030_handsfreer_enum = | 433 | static SOC_ENUM_SINGLE_DECL(twl4030_handsfreer_enum, |
435 | SOC_ENUM_SINGLE(TWL4030_REG_HFR_CTL, 0, | 434 | TWL4030_REG_HFR_CTL, 0, |
436 | ARRAY_SIZE(twl4030_handsfreer_texts), | 435 | twl4030_handsfreer_texts); |
437 | twl4030_handsfreer_texts); | ||
438 | 436 | ||
439 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = | 437 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = |
440 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); | 438 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); |
@@ -448,10 +446,9 @@ static const struct snd_kcontrol_new twl4030_dapm_handsfreermute_control = | |||
448 | static const char *twl4030_vibra_texts[] = | 446 | static const char *twl4030_vibra_texts[] = |
449 | {"AudioL1", "AudioR1", "AudioL2", "AudioR2"}; | 447 | {"AudioL1", "AudioR1", "AudioL2", "AudioR2"}; |
450 | 448 | ||
451 | static const struct soc_enum twl4030_vibra_enum = | 449 | static SOC_ENUM_SINGLE_DECL(twl4030_vibra_enum, |
452 | SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 2, | 450 | TWL4030_REG_VIBRA_CTL, 2, |
453 | ARRAY_SIZE(twl4030_vibra_texts), | 451 | twl4030_vibra_texts); |
454 | twl4030_vibra_texts); | ||
455 | 452 | ||
456 | static const struct snd_kcontrol_new twl4030_dapm_vibra_control = | 453 | static const struct snd_kcontrol_new twl4030_dapm_vibra_control = |
457 | SOC_DAPM_ENUM("Route", twl4030_vibra_enum); | 454 | SOC_DAPM_ENUM("Route", twl4030_vibra_enum); |
@@ -460,10 +457,9 @@ SOC_DAPM_ENUM("Route", twl4030_vibra_enum); | |||
460 | static const char *twl4030_vibrapath_texts[] = | 457 | static const char *twl4030_vibrapath_texts[] = |
461 | {"Local vibrator", "Audio"}; | 458 | {"Local vibrator", "Audio"}; |
462 | 459 | ||
463 | static const struct soc_enum twl4030_vibrapath_enum = | 460 | static SOC_ENUM_SINGLE_DECL(twl4030_vibrapath_enum, |
464 | SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 4, | 461 | TWL4030_REG_VIBRA_CTL, 4, |
465 | ARRAY_SIZE(twl4030_vibrapath_texts), | 462 | twl4030_vibrapath_texts); |
466 | twl4030_vibrapath_texts); | ||
467 | 463 | ||
468 | static const struct snd_kcontrol_new twl4030_dapm_vibrapath_control = | 464 | static const struct snd_kcontrol_new twl4030_dapm_vibrapath_control = |
469 | SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum); | 465 | SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum); |
@@ -490,10 +486,9 @@ static const struct snd_kcontrol_new twl4030_dapm_analogrmic_controls[] = { | |||
490 | static const char *twl4030_micpathtx1_texts[] = | 486 | static const char *twl4030_micpathtx1_texts[] = |
491 | {"Analog", "Digimic0"}; | 487 | {"Analog", "Digimic0"}; |
492 | 488 | ||
493 | static const struct soc_enum twl4030_micpathtx1_enum = | 489 | static SOC_ENUM_SINGLE_DECL(twl4030_micpathtx1_enum, |
494 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0, | 490 | TWL4030_REG_ADCMICSEL, 0, |
495 | ARRAY_SIZE(twl4030_micpathtx1_texts), | 491 | twl4030_micpathtx1_texts); |
496 | twl4030_micpathtx1_texts); | ||
497 | 492 | ||
498 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control = | 493 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control = |
499 | SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); | 494 | SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); |
@@ -502,10 +497,9 @@ SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); | |||
502 | static const char *twl4030_micpathtx2_texts[] = | 497 | static const char *twl4030_micpathtx2_texts[] = |
503 | {"Analog", "Digimic1"}; | 498 | {"Analog", "Digimic1"}; |
504 | 499 | ||
505 | static const struct soc_enum twl4030_micpathtx2_enum = | 500 | static SOC_ENUM_SINGLE_DECL(twl4030_micpathtx2_enum, |
506 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2, | 501 | TWL4030_REG_ADCMICSEL, 2, |
507 | ARRAY_SIZE(twl4030_micpathtx2_texts), | 502 | twl4030_micpathtx2_texts); |
508 | twl4030_micpathtx2_texts); | ||
509 | 503 | ||
510 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control = | 504 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control = |
511 | SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum); | 505 | SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum); |
@@ -955,10 +949,9 @@ static const char *twl4030_op_modes_texts[] = { | |||
955 | "Option 2 (voice/audio)", "Option 1 (audio)" | 949 | "Option 2 (voice/audio)", "Option 1 (audio)" |
956 | }; | 950 | }; |
957 | 951 | ||
958 | static const struct soc_enum twl4030_op_modes_enum = | 952 | static SOC_ENUM_SINGLE_DECL(twl4030_op_modes_enum, |
959 | SOC_ENUM_SINGLE(TWL4030_REG_CODEC_MODE, 0, | 953 | TWL4030_REG_CODEC_MODE, 0, |
960 | ARRAY_SIZE(twl4030_op_modes_texts), | 954 | twl4030_op_modes_texts); |
961 | twl4030_op_modes_texts); | ||
962 | 955 | ||
963 | static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol, | 956 | static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol, |
964 | struct snd_ctl_elem_value *ucontrol) | 957 | struct snd_ctl_elem_value *ucontrol) |
@@ -1029,10 +1022,9 @@ static const char *twl4030_avadc_clk_priority_texts[] = { | |||
1029 | "Voice high priority", "HiFi high priority" | 1022 | "Voice high priority", "HiFi high priority" |
1030 | }; | 1023 | }; |
1031 | 1024 | ||
1032 | static const struct soc_enum twl4030_avadc_clk_priority_enum = | 1025 | static SOC_ENUM_SINGLE_DECL(twl4030_avadc_clk_priority_enum, |
1033 | SOC_ENUM_SINGLE(TWL4030_REG_AVADC_CTL, 2, | 1026 | TWL4030_REG_AVADC_CTL, 2, |
1034 | ARRAY_SIZE(twl4030_avadc_clk_priority_texts), | 1027 | twl4030_avadc_clk_priority_texts); |
1035 | twl4030_avadc_clk_priority_texts); | ||
1036 | 1028 | ||
1037 | static const char *twl4030_rampdelay_texts[] = { | 1029 | static const char *twl4030_rampdelay_texts[] = { |
1038 | "27/20/14 ms", "55/40/27 ms", "109/81/55 ms", "218/161/109 ms", | 1030 | "27/20/14 ms", "55/40/27 ms", "109/81/55 ms", "218/161/109 ms", |
@@ -1040,40 +1032,36 @@ static const char *twl4030_rampdelay_texts[] = { | |||
1040 | "3495/2581/1748 ms" | 1032 | "3495/2581/1748 ms" |
1041 | }; | 1033 | }; |
1042 | 1034 | ||
1043 | static const struct soc_enum twl4030_rampdelay_enum = | 1035 | static SOC_ENUM_SINGLE_DECL(twl4030_rampdelay_enum, |
1044 | SOC_ENUM_SINGLE(TWL4030_REG_HS_POPN_SET, 2, | 1036 | TWL4030_REG_HS_POPN_SET, 2, |
1045 | ARRAY_SIZE(twl4030_rampdelay_texts), | 1037 | twl4030_rampdelay_texts); |
1046 | twl4030_rampdelay_texts); | ||
1047 | 1038 | ||
1048 | /* Vibra H-bridge direction mode */ | 1039 | /* Vibra H-bridge direction mode */ |
1049 | static const char *twl4030_vibradirmode_texts[] = { | 1040 | static const char *twl4030_vibradirmode_texts[] = { |
1050 | "Vibra H-bridge direction", "Audio data MSB", | 1041 | "Vibra H-bridge direction", "Audio data MSB", |
1051 | }; | 1042 | }; |
1052 | 1043 | ||
1053 | static const struct soc_enum twl4030_vibradirmode_enum = | 1044 | static SOC_ENUM_SINGLE_DECL(twl4030_vibradirmode_enum, |
1054 | SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 5, | 1045 | TWL4030_REG_VIBRA_CTL, 5, |
1055 | ARRAY_SIZE(twl4030_vibradirmode_texts), | 1046 | twl4030_vibradirmode_texts); |
1056 | twl4030_vibradirmode_texts); | ||
1057 | 1047 | ||
1058 | /* Vibra H-bridge direction */ | 1048 | /* Vibra H-bridge direction */ |
1059 | static const char *twl4030_vibradir_texts[] = { | 1049 | static const char *twl4030_vibradir_texts[] = { |
1060 | "Positive polarity", "Negative polarity", | 1050 | "Positive polarity", "Negative polarity", |
1061 | }; | 1051 | }; |
1062 | 1052 | ||
1063 | static const struct soc_enum twl4030_vibradir_enum = | 1053 | static SOC_ENUM_SINGLE_DECL(twl4030_vibradir_enum, |
1064 | SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 1, | 1054 | TWL4030_REG_VIBRA_CTL, 1, |
1065 | ARRAY_SIZE(twl4030_vibradir_texts), | 1055 | twl4030_vibradir_texts); |
1066 | twl4030_vibradir_texts); | ||
1067 | 1056 | ||
1068 | /* Digimic Left and right swapping */ | 1057 | /* Digimic Left and right swapping */ |
1069 | static const char *twl4030_digimicswap_texts[] = { | 1058 | static const char *twl4030_digimicswap_texts[] = { |
1070 | "Not swapped", "Swapped", | 1059 | "Not swapped", "Swapped", |
1071 | }; | 1060 | }; |
1072 | 1061 | ||
1073 | static const struct soc_enum twl4030_digimicswap_enum = | 1062 | static SOC_ENUM_SINGLE_DECL(twl4030_digimicswap_enum, |
1074 | SOC_ENUM_SINGLE(TWL4030_REG_MISC_SET_1, 0, | 1063 | TWL4030_REG_MISC_SET_1, 0, |
1075 | ARRAY_SIZE(twl4030_digimicswap_texts), | 1064 | twl4030_digimicswap_texts); |
1076 | twl4030_digimicswap_texts); | ||
1077 | 1065 | ||
1078 | static const struct snd_kcontrol_new twl4030_snd_controls[] = { | 1066 | static const struct snd_kcontrol_new twl4030_snd_controls[] = { |
1079 | /* Codec operation mode control */ | 1067 | /* Codec operation mode control */ |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 0afe8bef6765..bd3a20647fdf 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -81,7 +81,7 @@ struct twl6040_data { | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | /* set of rates for each pll: low-power and high-performance */ | 83 | /* set of rates for each pll: low-power and high-performance */ |
84 | static unsigned int lp_rates[] = { | 84 | static const unsigned int lp_rates[] = { |
85 | 8000, | 85 | 8000, |
86 | 11250, | 86 | 11250, |
87 | 16000, | 87 | 16000, |
@@ -93,7 +93,7 @@ static unsigned int lp_rates[] = { | |||
93 | 96000, | 93 | 96000, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static unsigned int hp_rates[] = { | 96 | static const unsigned int hp_rates[] = { |
97 | 8000, | 97 | 8000, |
98 | 16000, | 98 | 16000, |
99 | 32000, | 99 | 32000, |
@@ -101,7 +101,7 @@ static unsigned int hp_rates[] = { | |||
101 | 96000, | 101 | 96000, |
102 | }; | 102 | }; |
103 | 103 | ||
104 | static struct snd_pcm_hw_constraint_list sysclk_constraints[] = { | 104 | static const struct snd_pcm_hw_constraint_list sysclk_constraints[] = { |
105 | { .count = ARRAY_SIZE(lp_rates), .list = lp_rates, }, | 105 | { .count = ARRAY_SIZE(lp_rates), .list = lp_rates, }, |
106 | { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, | 106 | { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, |
107 | }; | 107 | }; |
@@ -392,8 +392,10 @@ static const char *twl6040_amicr_texts[] = | |||
392 | {"Headset Mic", "Sub Mic", "Aux/FM Right", "Off"}; | 392 | {"Headset Mic", "Sub Mic", "Aux/FM Right", "Off"}; |
393 | 393 | ||
394 | static const struct soc_enum twl6040_enum[] = { | 394 | static const struct soc_enum twl6040_enum[] = { |
395 | SOC_ENUM_SINGLE(TWL6040_REG_MICLCTL, 3, 4, twl6040_amicl_texts), | 395 | SOC_ENUM_SINGLE(TWL6040_REG_MICLCTL, 3, |
396 | SOC_ENUM_SINGLE(TWL6040_REG_MICRCTL, 3, 4, twl6040_amicr_texts), | 396 | ARRAY_SIZE(twl6040_amicl_texts), twl6040_amicl_texts), |
397 | SOC_ENUM_SINGLE(TWL6040_REG_MICRCTL, 3, | ||
398 | ARRAY_SIZE(twl6040_amicr_texts), twl6040_amicr_texts), | ||
397 | }; | 399 | }; |
398 | 400 | ||
399 | static const char *twl6040_hs_texts[] = { | 401 | static const char *twl6040_hs_texts[] = { |
@@ -476,9 +478,8 @@ static const char *twl6040_power_mode_texts[] = { | |||
476 | "Low-Power", "High-Performance", | 478 | "Low-Power", "High-Performance", |
477 | }; | 479 | }; |
478 | 480 | ||
479 | static const struct soc_enum twl6040_power_mode_enum = | 481 | static SOC_ENUM_SINGLE_EXT_DECL(twl6040_power_mode_enum, |
480 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl6040_power_mode_texts), | 482 | twl6040_power_mode_texts); |
481 | twl6040_power_mode_texts); | ||
482 | 483 | ||
483 | static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, | 484 | static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, |
484 | struct snd_ctl_elem_value *ucontrol) | 485 | struct snd_ctl_elem_value *ucontrol) |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 8e3940dcff20..4dadaa8ad46c 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -237,25 +237,27 @@ static const char *uda1380_os_setting[] = { | |||
237 | }; | 237 | }; |
238 | 238 | ||
239 | static const struct soc_enum uda1380_deemp_enum[] = { | 239 | static const struct soc_enum uda1380_deemp_enum[] = { |
240 | SOC_ENUM_SINGLE(UDA1380_DEEMP, 8, 5, uda1380_deemp), | 240 | SOC_ENUM_SINGLE(UDA1380_DEEMP, 8, ARRAY_SIZE(uda1380_deemp), |
241 | SOC_ENUM_SINGLE(UDA1380_DEEMP, 0, 5, uda1380_deemp), | 241 | uda1380_deemp), |
242 | SOC_ENUM_SINGLE(UDA1380_DEEMP, 0, ARRAY_SIZE(uda1380_deemp), | ||
243 | uda1380_deemp), | ||
242 | }; | 244 | }; |
243 | static const struct soc_enum uda1380_input_sel_enum = | 245 | static SOC_ENUM_SINGLE_DECL(uda1380_input_sel_enum, |
244 | SOC_ENUM_SINGLE(UDA1380_ADC, 2, 4, uda1380_input_sel); /* SEL_MIC, SEL_LNA */ | 246 | UDA1380_ADC, 2, uda1380_input_sel); /* SEL_MIC, SEL_LNA */ |
245 | static const struct soc_enum uda1380_output_sel_enum = | 247 | static SOC_ENUM_SINGLE_DECL(uda1380_output_sel_enum, |
246 | SOC_ENUM_SINGLE(UDA1380_PM, 7, 2, uda1380_output_sel); /* R02_EN_AVC */ | 248 | UDA1380_PM, 7, uda1380_output_sel); /* R02_EN_AVC */ |
247 | static const struct soc_enum uda1380_spf_enum = | 249 | static SOC_ENUM_SINGLE_DECL(uda1380_spf_enum, |
248 | SOC_ENUM_SINGLE(UDA1380_MODE, 14, 4, uda1380_spf_mode); /* M */ | 250 | UDA1380_MODE, 14, uda1380_spf_mode); /* M */ |
249 | static const struct soc_enum uda1380_capture_sel_enum = | 251 | static SOC_ENUM_SINGLE_DECL(uda1380_capture_sel_enum, |
250 | SOC_ENUM_SINGLE(UDA1380_IFACE, 6, 2, uda1380_capture_sel); /* SEL_SOURCE */ | 252 | UDA1380_IFACE, 6, uda1380_capture_sel); /* SEL_SOURCE */ |
251 | static const struct soc_enum uda1380_sel_ns_enum = | 253 | static SOC_ENUM_SINGLE_DECL(uda1380_sel_ns_enum, |
252 | SOC_ENUM_SINGLE(UDA1380_MIXER, 14, 2, uda1380_sel_ns); /* SEL_NS */ | 254 | UDA1380_MIXER, 14, uda1380_sel_ns); /* SEL_NS */ |
253 | static const struct soc_enum uda1380_mix_enum = | 255 | static SOC_ENUM_SINGLE_DECL(uda1380_mix_enum, |
254 | SOC_ENUM_SINGLE(UDA1380_MIXER, 12, 4, uda1380_mix_control); /* MIX, MIX_POS */ | 256 | UDA1380_MIXER, 12, uda1380_mix_control); /* MIX, MIX_POS */ |
255 | static const struct soc_enum uda1380_sdet_enum = | 257 | static SOC_ENUM_SINGLE_DECL(uda1380_sdet_enum, |
256 | SOC_ENUM_SINGLE(UDA1380_MIXER, 4, 4, uda1380_sdet_setting); /* SD_VALUE */ | 258 | UDA1380_MIXER, 4, uda1380_sdet_setting); /* SD_VALUE */ |
257 | static const struct soc_enum uda1380_os_enum = | 259 | static SOC_ENUM_SINGLE_DECL(uda1380_os_enum, |
258 | SOC_ENUM_SINGLE(UDA1380_MIXER, 0, 3, uda1380_os_setting); /* OS */ | 260 | UDA1380_MIXER, 0, uda1380_os_setting); /* OS */ |
259 | 261 | ||
260 | /* | 262 | /* |
261 | * from -48 dB in 1.5 dB steps (mute instead of -49.5 dB) | 263 | * from -48 dB in 1.5 dB steps (mute instead of -49.5 dB) |
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c index 47e96ff30064..6be5f80b65f1 100644 --- a/sound/soc/codecs/wl1273.c +++ b/sound/soc/codecs/wl1273.c | |||
@@ -209,8 +209,7 @@ static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol, | |||
209 | return 1; | 209 | return 1; |
210 | } | 210 | } |
211 | 211 | ||
212 | static const struct soc_enum wl1273_enum = | 212 | static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, wl1273_audio_route); |
213 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wl1273_audio_route), wl1273_audio_route); | ||
214 | 213 | ||
215 | static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, | 214 | static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, |
216 | struct snd_ctl_elem_value *ucontrol) | 215 | struct snd_ctl_elem_value *ucontrol) |
@@ -247,9 +246,7 @@ static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol, | |||
247 | 246 | ||
248 | static const char * const wl1273_audio_strings[] = { "Digital", "Analog" }; | 247 | static const char * const wl1273_audio_strings[] = { "Digital", "Analog" }; |
249 | 248 | ||
250 | static const struct soc_enum wl1273_audio_enum = | 249 | static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings); |
251 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wl1273_audio_strings), | ||
252 | wl1273_audio_strings); | ||
253 | 250 | ||
254 | static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, | 251 | static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, |
255 | struct snd_ctl_elem_value *ucontrol) | 252 | struct snd_ctl_elem_value *ucontrol) |
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c index 57ba315d0c84..1e0a083d8345 100644 --- a/sound/soc/codecs/wm2200.c +++ b/sound/soc/codecs/wm2200.c | |||
@@ -1113,11 +1113,10 @@ static const char *wm2200_rxanc_input_sel_texts[] = { | |||
1113 | "None", "IN1", "IN2", "IN3", | 1113 | "None", "IN1", "IN2", "IN3", |
1114 | }; | 1114 | }; |
1115 | 1115 | ||
1116 | static const struct soc_enum wm2200_rxanc_input_sel = | 1116 | static SOC_ENUM_SINGLE_DECL(wm2200_rxanc_input_sel, |
1117 | SOC_ENUM_SINGLE(WM2200_RXANC_SRC, | 1117 | WM2200_RXANC_SRC, |
1118 | WM2200_IN_RXANC_SEL_SHIFT, | 1118 | WM2200_IN_RXANC_SEL_SHIFT, |
1119 | ARRAY_SIZE(wm2200_rxanc_input_sel_texts), | 1119 | wm2200_rxanc_input_sel_texts); |
1120 | wm2200_rxanc_input_sel_texts); | ||
1121 | 1120 | ||
1122 | static const struct snd_kcontrol_new wm2200_snd_controls[] = { | 1121 | static const struct snd_kcontrol_new wm2200_snd_controls[] = { |
1123 | SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL, | 1122 | SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL, |
@@ -1288,11 +1287,10 @@ static const char *wm2200_aec_loopback_texts[] = { | |||
1288 | "OUT1L", "OUT1R", "OUT2L", "OUT2R", | 1287 | "OUT1L", "OUT1R", "OUT2L", "OUT2R", |
1289 | }; | 1288 | }; |
1290 | 1289 | ||
1291 | static const struct soc_enum wm2200_aec_loopback = | 1290 | static SOC_ENUM_SINGLE_DECL(wm2200_aec_loopback, |
1292 | SOC_ENUM_SINGLE(WM2200_DAC_AEC_CONTROL_1, | 1291 | WM2200_DAC_AEC_CONTROL_1, |
1293 | WM2200_AEC_LOOPBACK_SRC_SHIFT, | 1292 | WM2200_AEC_LOOPBACK_SRC_SHIFT, |
1294 | ARRAY_SIZE(wm2200_aec_loopback_texts), | 1293 | wm2200_aec_loopback_texts); |
1295 | wm2200_aec_loopback_texts); | ||
1296 | 1294 | ||
1297 | static const struct snd_kcontrol_new wm2200_aec_loopback_mux = | 1295 | static const struct snd_kcontrol_new wm2200_aec_loopback_mux = |
1298 | SOC_DAPM_ENUM("AEC Loopback", wm2200_aec_loopback); | 1296 | SOC_DAPM_ENUM("AEC Loopback", wm2200_aec_loopback); |