diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/arm/pxa2xx-ac97-lib.c | 25 | ||||
-rw-r--r-- | sound/core/sound.c | 4 | ||||
-rw-r--r-- | sound/i2c/other/tea575x-tuner.c | 6 | ||||
-rw-r--r-- | sound/oss/aedsp16.c | 2 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 2 | ||||
-rw-r--r-- | sound/soc/atmel/sam9g20_wm8731.c | 4 | ||||
-rw-r--r-- | sound/soc/au1x/dbdma2.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/Kconfig | 20 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.c | 417 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.h | 7 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 19 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.c | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-sffsdr.c | 4 | ||||
-rw-r--r-- | sound/soc/omap/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/omap/omap3pandora.c | 13 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-pcm.c | 4 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 120 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 137 | ||||
-rw-r--r-- | sound/sparc/cs4231.c | 2 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-device.c | 4 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 8 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 39 | ||||
-rw-r--r-- | sound/usb/usbmixer.c | 5 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 4 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 6 |
25 files changed, 552 insertions, 305 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index ef6539eea579..35afd0c33be5 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c | |||
@@ -321,10 +321,6 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
321 | { | 321 | { |
322 | int ret; | 322 | int ret; |
323 | 323 | ||
324 | ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL); | ||
325 | if (ret < 0) | ||
326 | goto err; | ||
327 | |||
328 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) { | 324 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) { |
329 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); | 325 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); |
330 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); | 326 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); |
@@ -339,7 +335,7 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
339 | if (IS_ERR(ac97conf_clk)) { | 335 | if (IS_ERR(ac97conf_clk)) { |
340 | ret = PTR_ERR(ac97conf_clk); | 336 | ret = PTR_ERR(ac97conf_clk); |
341 | ac97conf_clk = NULL; | 337 | ac97conf_clk = NULL; |
342 | goto err_irq; | 338 | goto err_conf; |
343 | } | 339 | } |
344 | } | 340 | } |
345 | 341 | ||
@@ -347,19 +343,30 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
347 | if (IS_ERR(ac97_clk)) { | 343 | if (IS_ERR(ac97_clk)) { |
348 | ret = PTR_ERR(ac97_clk); | 344 | ret = PTR_ERR(ac97_clk); |
349 | ac97_clk = NULL; | 345 | ac97_clk = NULL; |
350 | goto err_irq; | 346 | goto err_clk; |
351 | } | 347 | } |
352 | 348 | ||
353 | return clk_enable(ac97_clk); | 349 | ret = clk_enable(ac97_clk); |
350 | if (ret) | ||
351 | goto err_clk2; | ||
352 | |||
353 | ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, IRQF_DISABLED, "AC97", NULL); | ||
354 | if (ret < 0) | ||
355 | goto err_irq; | ||
356 | |||
357 | return 0; | ||
354 | 358 | ||
355 | err_irq: | 359 | err_irq: |
356 | GCR |= GCR_ACLINK_OFF; | 360 | GCR |= GCR_ACLINK_OFF; |
361 | err_clk2: | ||
362 | clk_put(ac97_clk); | ||
363 | ac97_clk = NULL; | ||
364 | err_clk: | ||
357 | if (ac97conf_clk) { | 365 | if (ac97conf_clk) { |
358 | clk_put(ac97conf_clk); | 366 | clk_put(ac97conf_clk); |
359 | ac97conf_clk = NULL; | 367 | ac97conf_clk = NULL; |
360 | } | 368 | } |
361 | free_irq(IRQ_AC97, NULL); | 369 | err_conf: |
362 | err: | ||
363 | return ret; | 370 | return ret; |
364 | } | 371 | } |
365 | EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); | 372 | EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 44a69bb8d4f0..7872a02f6ca9 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -152,6 +152,10 @@ static int __snd_open(struct inode *inode, struct file *file) | |||
152 | } | 152 | } |
153 | old_fops = file->f_op; | 153 | old_fops = file->f_op; |
154 | file->f_op = fops_get(mptr->f_ops); | 154 | file->f_op = fops_get(mptr->f_ops); |
155 | if (file->f_op == NULL) { | ||
156 | file->f_op = old_fops; | ||
157 | return -ENODEV; | ||
158 | } | ||
155 | if (file->f_op->open) | 159 | if (file->f_op->open) |
156 | err = file->f_op->open(inode, file); | 160 | err = file->f_op->open(inode, file); |
157 | if (err) { | 161 | if (err) { |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 549b4eba1496..9d98a6658ac9 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -84,7 +84,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) | |||
84 | * Linux Video interface | 84 | * Linux Video interface |
85 | */ | 85 | */ |
86 | 86 | ||
87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, | 87 | static long snd_tea575x_ioctl(struct file *file, |
88 | unsigned int cmd, unsigned long data) | 88 | unsigned int cmd, unsigned long data) |
89 | { | 89 | { |
90 | struct snd_tea575x *tea = video_drvdata(file); | 90 | struct snd_tea575x *tea = video_drvdata(file); |
@@ -174,14 +174,14 @@ static void snd_tea575x_release(struct video_device *vfd) | |||
174 | { | 174 | { |
175 | } | 175 | } |
176 | 176 | ||
177 | static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) | 177 | static int snd_tea575x_exclusive_open(struct file *file) |
178 | { | 178 | { |
179 | struct snd_tea575x *tea = video_drvdata(file); | 179 | struct snd_tea575x *tea = video_drvdata(file); |
180 | 180 | ||
181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; | 181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; |
182 | } | 182 | } |
183 | 183 | ||
184 | static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) | 184 | static int snd_tea575x_exclusive_release(struct file *file) |
185 | { | 185 | { |
186 | struct snd_tea575x *tea = video_drvdata(file); | 186 | struct snd_tea575x *tea = video_drvdata(file); |
187 | 187 | ||
diff --git a/sound/oss/aedsp16.c b/sound/oss/aedsp16.c index a0274f3dac08..3ee9900ffd7b 100644 --- a/sound/oss/aedsp16.c +++ b/sound/oss/aedsp16.c | |||
@@ -157,7 +157,7 @@ | |||
157 | 157 | ||
158 | Started Fri Mar 17 16:13:18 MET 1995 | 158 | Started Fri Mar 17 16:13:18 MET 1995 |
159 | 159 | ||
160 | v0.1 (ALPHA, was an user-level program called AudioExcelDSP16.c) | 160 | v0.1 (ALPHA, was a user-level program called AudioExcelDSP16.c) |
161 | - Initial code. | 161 | - Initial code. |
162 | v0.2 (ALPHA) | 162 | v0.2 (ALPHA) |
163 | - Cleanups. | 163 | - Cleanups. |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 0dfa0540ce2c..bb8d8c766b9d 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -1239,7 +1239,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) | |||
1239 | if (ice->force_pdma4 || ice->force_rdma1) | 1239 | if (ice->force_pdma4 || ice->force_rdma1) |
1240 | name = "ICE1724 Secondary"; | 1240 | name = "ICE1724 Secondary"; |
1241 | else | 1241 | else |
1242 | name = "IEC1724 IEC958"; | 1242 | name = "ICE1724 IEC958"; |
1243 | err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); | 1243 | err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); |
1244 | if (err < 0) | 1244 | if (err < 0) |
1245 | return err; | 1245 | return err; |
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index 1fb59a9d3719..6ea04be911d0 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c | |||
@@ -221,8 +221,8 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) | |||
221 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); | 221 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); |
222 | 222 | ||
223 | /* not connected */ | 223 | /* not connected */ |
224 | snd_soc_dapm_disable_pin(codec, "RLINEIN"); | 224 | snd_soc_dapm_nc_pin(codec, "RLINEIN"); |
225 | snd_soc_dapm_disable_pin(codec, "LLINEIN"); | 225 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); |
226 | 226 | ||
227 | /* always connected */ | 227 | /* always connected */ |
228 | snd_soc_dapm_enable_pin(codec, "Int Mic"); | 228 | snd_soc_dapm_enable_pin(codec, "Int Mic"); |
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 74c823d60f91..bc8d654576c0 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c | |||
@@ -187,7 +187,7 @@ static int au1x_pcm_dbdma_realloc(struct au1xpsc_audio_dmadata *pcd, | |||
187 | au1x_pcm_dmatx_cb, (void *)pcd); | 187 | au1x_pcm_dmatx_cb, (void *)pcd); |
188 | 188 | ||
189 | if (!pcd->ddma_chan) | 189 | if (!pcd->ddma_chan) |
190 | return -ENOMEM;; | 190 | return -ENOMEM; |
191 | 191 | ||
192 | au1xxx_dbdma_set_devwidth(pcd->ddma_chan, msbits); | 192 | au1xxx_dbdma_set_devwidth(pcd->ddma_chan, msbits); |
193 | au1xxx_dbdma_ring_alloc(pcd->ddma_chan, 2); | 193 | au1xxx_dbdma_ring_alloc(pcd->ddma_chan, 2); |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index c41289b5f586..d0e0d691ae51 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -1,3 +1,13 @@ | |||
1 | # Helper to resolve issues with configs that have SPI enabled but I2C | ||
2 | # modular, meaning we can't build the codec driver in with I2C support. | ||
3 | # We use an ordered list of conditional defaults to pick the appropriate | ||
4 | # setting - SPI can't be modular so that case doesn't need to be covered. | ||
5 | config SND_SOC_I2C_AND_SPI | ||
6 | tristate | ||
7 | default m if I2C=m | ||
8 | default y if I2C=y | ||
9 | default y if SPI_MASTER=y | ||
10 | |||
1 | config SND_SOC_ALL_CODECS | 11 | config SND_SOC_ALL_CODECS |
2 | tristate "Build all ASoC CODEC drivers" | 12 | tristate "Build all ASoC CODEC drivers" |
3 | select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS | 13 | select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS |
@@ -14,12 +24,12 @@ config SND_SOC_ALL_CODECS | |||
14 | select SND_SOC_UDA134X | 24 | select SND_SOC_UDA134X |
15 | select SND_SOC_UDA1380 if I2C | 25 | select SND_SOC_UDA1380 if I2C |
16 | select SND_SOC_WM8350 if MFD_WM8350 | 26 | select SND_SOC_WM8350 if MFD_WM8350 |
17 | select SND_SOC_WM8510 if (I2C || SPI_MASTER) | 27 | select SND_SOC_WM8510 if SND_SOC_I2C_AND_SPI |
18 | select SND_SOC_WM8580 if I2C | 28 | select SND_SOC_WM8580 if I2C |
19 | select SND_SOC_WM8728 if (I2C || SPI_MASTER) | 29 | select SND_SOC_WM8728 if SND_SOC_I2C_AND_SPI |
20 | select SND_SOC_WM8731 if (I2C || SPI_MASTER) | 30 | select SND_SOC_WM8731 if SND_SOC_I2C_AND_SPI |
21 | select SND_SOC_WM8750 if (I2C || SPI_MASTER) | 31 | select SND_SOC_WM8750 if SND_SOC_I2C_AND_SPI |
22 | select SND_SOC_WM8753 if (I2C || SPI_MASTER) | 32 | select SND_SOC_WM8753 if SND_SOC_I2C_AND_SPI |
23 | select SND_SOC_WM8900 if I2C | 33 | select SND_SOC_WM8900 if I2C |
24 | select SND_SOC_WM8903 if I2C | 34 | select SND_SOC_WM8903 if I2C |
25 | select SND_SOC_WM8971 if I2C | 35 | select SND_SOC_WM8971 if I2C |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 51848880504a..ea370a4f86d5 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -192,39 +192,51 @@ static void twl4030_init_chip(struct snd_soc_codec *codec) | |||
192 | 192 | ||
193 | /* Earpiece */ | 193 | /* Earpiece */ |
194 | static const char *twl4030_earpiece_texts[] = | 194 | static const char *twl4030_earpiece_texts[] = |
195 | {"Off", "DACL1", "DACL2", "Invalid", "DACR1"}; | 195 | {"Off", "DACL1", "DACL2", "DACR1"}; |
196 | |||
197 | static const unsigned int twl4030_earpiece_values[] = | ||
198 | {0x0, 0x1, 0x2, 0x4}; | ||
196 | 199 | ||
197 | static const struct soc_enum twl4030_earpiece_enum = | 200 | static const struct soc_enum twl4030_earpiece_enum = |
198 | SOC_ENUM_SINGLE(TWL4030_REG_EAR_CTL, 1, | 201 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_EAR_CTL, 1, 0x7, |
199 | ARRAY_SIZE(twl4030_earpiece_texts), | 202 | ARRAY_SIZE(twl4030_earpiece_texts), |
200 | twl4030_earpiece_texts); | 203 | twl4030_earpiece_texts, |
204 | twl4030_earpiece_values); | ||
201 | 205 | ||
202 | static const struct snd_kcontrol_new twl4030_dapm_earpiece_control = | 206 | static const struct snd_kcontrol_new twl4030_dapm_earpiece_control = |
203 | SOC_DAPM_ENUM("Route", twl4030_earpiece_enum); | 207 | SOC_DAPM_VALUE_ENUM("Route", twl4030_earpiece_enum); |
204 | 208 | ||
205 | /* PreDrive Left */ | 209 | /* PreDrive Left */ |
206 | static const char *twl4030_predrivel_texts[] = | 210 | static const char *twl4030_predrivel_texts[] = |
207 | {"Off", "DACL1", "DACL2", "Invalid", "DACR2"}; | 211 | {"Off", "DACL1", "DACL2", "DACR2"}; |
212 | |||
213 | static const unsigned int twl4030_predrivel_values[] = | ||
214 | {0x0, 0x1, 0x2, 0x4}; | ||
208 | 215 | ||
209 | static const struct soc_enum twl4030_predrivel_enum = | 216 | static const struct soc_enum twl4030_predrivel_enum = |
210 | SOC_ENUM_SINGLE(TWL4030_REG_PREDL_CTL, 1, | 217 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_PREDL_CTL, 1, 0x7, |
211 | ARRAY_SIZE(twl4030_predrivel_texts), | 218 | ARRAY_SIZE(twl4030_predrivel_texts), |
212 | twl4030_predrivel_texts); | 219 | twl4030_predrivel_texts, |
220 | twl4030_predrivel_values); | ||
213 | 221 | ||
214 | static const struct snd_kcontrol_new twl4030_dapm_predrivel_control = | 222 | static const struct snd_kcontrol_new twl4030_dapm_predrivel_control = |
215 | SOC_DAPM_ENUM("Route", twl4030_predrivel_enum); | 223 | SOC_DAPM_VALUE_ENUM("Route", twl4030_predrivel_enum); |
216 | 224 | ||
217 | /* PreDrive Right */ | 225 | /* PreDrive Right */ |
218 | static const char *twl4030_predriver_texts[] = | 226 | static const char *twl4030_predriver_texts[] = |
219 | {"Off", "DACR1", "DACR2", "Invalid", "DACL2"}; | 227 | {"Off", "DACR1", "DACR2", "DACL2"}; |
228 | |||
229 | static const unsigned int twl4030_predriver_values[] = | ||
230 | {0x0, 0x1, 0x2, 0x4}; | ||
220 | 231 | ||
221 | static const struct soc_enum twl4030_predriver_enum = | 232 | static const struct soc_enum twl4030_predriver_enum = |
222 | SOC_ENUM_SINGLE(TWL4030_REG_PREDR_CTL, 1, | 233 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_PREDR_CTL, 1, 0x7, |
223 | ARRAY_SIZE(twl4030_predriver_texts), | 234 | ARRAY_SIZE(twl4030_predriver_texts), |
224 | twl4030_predriver_texts); | 235 | twl4030_predriver_texts, |
236 | twl4030_predriver_values); | ||
225 | 237 | ||
226 | static const struct snd_kcontrol_new twl4030_dapm_predriver_control = | 238 | static const struct snd_kcontrol_new twl4030_dapm_predriver_control = |
227 | SOC_DAPM_ENUM("Route", twl4030_predriver_enum); | 239 | SOC_DAPM_VALUE_ENUM("Route", twl4030_predriver_enum); |
228 | 240 | ||
229 | /* Headset Left */ | 241 | /* Headset Left */ |
230 | static const char *twl4030_hsol_texts[] = | 242 | static const char *twl4030_hsol_texts[] = |
@@ -298,28 +310,90 @@ static const struct soc_enum twl4030_handsfreer_enum = | |||
298 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = | 310 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = |
299 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); | 311 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); |
300 | 312 | ||
301 | static int outmixer_event(struct snd_soc_dapm_widget *w, | 313 | /* Left analog microphone selection */ |
314 | static const char *twl4030_analoglmic_texts[] = | ||
315 | {"Off", "Main mic", "Headset mic", "AUXL", "Carkit mic"}; | ||
316 | |||
317 | static const unsigned int twl4030_analoglmic_values[] = | ||
318 | {0x0, 0x1, 0x2, 0x4, 0x8}; | ||
319 | |||
320 | static const struct soc_enum twl4030_analoglmic_enum = | ||
321 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICL, 0, 0xf, | ||
322 | ARRAY_SIZE(twl4030_analoglmic_texts), | ||
323 | twl4030_analoglmic_texts, | ||
324 | twl4030_analoglmic_values); | ||
325 | |||
326 | static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control = | ||
327 | SOC_DAPM_VALUE_ENUM("Route", twl4030_analoglmic_enum); | ||
328 | |||
329 | /* Right analog microphone selection */ | ||
330 | static const char *twl4030_analogrmic_texts[] = | ||
331 | {"Off", "Sub mic", "AUXR"}; | ||
332 | |||
333 | static const unsigned int twl4030_analogrmic_values[] = | ||
334 | {0x0, 0x1, 0x4}; | ||
335 | |||
336 | static const struct soc_enum twl4030_analogrmic_enum = | ||
337 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICR, 0, 0x5, | ||
338 | ARRAY_SIZE(twl4030_analogrmic_texts), | ||
339 | twl4030_analogrmic_texts, | ||
340 | twl4030_analogrmic_values); | ||
341 | |||
342 | static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control = | ||
343 | SOC_DAPM_VALUE_ENUM("Route", twl4030_analogrmic_enum); | ||
344 | |||
345 | /* TX1 L/R Analog/Digital microphone selection */ | ||
346 | static const char *twl4030_micpathtx1_texts[] = | ||
347 | {"Analog", "Digimic0"}; | ||
348 | |||
349 | static const struct soc_enum twl4030_micpathtx1_enum = | ||
350 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0, | ||
351 | ARRAY_SIZE(twl4030_micpathtx1_texts), | ||
352 | twl4030_micpathtx1_texts); | ||
353 | |||
354 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control = | ||
355 | SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); | ||
356 | |||
357 | /* TX2 L/R Analog/Digital microphone selection */ | ||
358 | static const char *twl4030_micpathtx2_texts[] = | ||
359 | {"Analog", "Digimic1"}; | ||
360 | |||
361 | static const struct soc_enum twl4030_micpathtx2_enum = | ||
362 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2, | ||
363 | ARRAY_SIZE(twl4030_micpathtx2_texts), | ||
364 | twl4030_micpathtx2_texts); | ||
365 | |||
366 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control = | ||
367 | SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum); | ||
368 | |||
369 | static int micpath_event(struct snd_soc_dapm_widget *w, | ||
302 | struct snd_kcontrol *kcontrol, int event) | 370 | struct snd_kcontrol *kcontrol, int event) |
303 | { | 371 | { |
304 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 372 | struct soc_enum *e = (struct soc_enum *)w->kcontrols->private_value; |
305 | int ret = 0; | 373 | unsigned char adcmicsel, micbias_ctl; |
306 | int val; | 374 | |
307 | 375 | adcmicsel = twl4030_read_reg_cache(w->codec, TWL4030_REG_ADCMICSEL); | |
308 | switch (e->reg) { | 376 | micbias_ctl = twl4030_read_reg_cache(w->codec, TWL4030_REG_MICBIAS_CTL); |
309 | case TWL4030_REG_PREDL_CTL: | 377 | /* Prepare the bits for the given TX path: |
310 | case TWL4030_REG_PREDR_CTL: | 378 | * shift_l == 0: TX1 microphone path |
311 | case TWL4030_REG_EAR_CTL: | 379 | * shift_l == 2: TX2 microphone path */ |
312 | val = w->value >> e->shift_l; | 380 | if (e->shift_l) { |
313 | if (val == 3) { | 381 | /* TX2 microphone path */ |
314 | printk(KERN_WARNING | 382 | if (adcmicsel & TWL4030_TX2IN_SEL) |
315 | "Invalid MUX setting for register 0x%02x (%d)\n", | 383 | micbias_ctl |= TWL4030_MICBIAS2_CTL; /* digimic */ |
316 | e->reg, val); | 384 | else |
317 | ret = -1; | 385 | micbias_ctl &= ~TWL4030_MICBIAS2_CTL; |
318 | } | 386 | } else { |
319 | break; | 387 | /* TX1 microphone path */ |
388 | if (adcmicsel & TWL4030_TX1IN_SEL) | ||
389 | micbias_ctl |= TWL4030_MICBIAS1_CTL; /* digimic */ | ||
390 | else | ||
391 | micbias_ctl &= ~TWL4030_MICBIAS1_CTL; | ||
320 | } | 392 | } |
321 | 393 | ||
322 | return ret; | 394 | twl4030_write(w->codec, TWL4030_REG_MICBIAS_CTL, micbias_ctl); |
395 | |||
396 | return 0; | ||
323 | } | 397 | } |
324 | 398 | ||
325 | static int handsfree_event(struct snd_soc_dapm_widget *w, | 399 | static int handsfree_event(struct snd_soc_dapm_widget *w, |
@@ -503,162 +577,6 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol, | |||
503 | return err; | 577 | return err; |
504 | } | 578 | } |
505 | 579 | ||
506 | static int twl4030_get_left_input(struct snd_kcontrol *kcontrol, | ||
507 | struct snd_ctl_elem_value *ucontrol) | ||
508 | { | ||
509 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
510 | u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); | ||
511 | int result = 0; | ||
512 | |||
513 | /* one bit must be set a time */ | ||
514 | reg &= TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN | ||
515 | | TWL4030_MAINMIC_EN; | ||
516 | if (reg != 0) { | ||
517 | result++; | ||
518 | while ((reg & 1) == 0) { | ||
519 | result++; | ||
520 | reg >>= 1; | ||
521 | } | ||
522 | } | ||
523 | |||
524 | ucontrol->value.integer.value[0] = result; | ||
525 | return 0; | ||
526 | } | ||
527 | |||
528 | static int twl4030_put_left_input(struct snd_kcontrol *kcontrol, | ||
529 | struct snd_ctl_elem_value *ucontrol) | ||
530 | { | ||
531 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
532 | int value = ucontrol->value.integer.value[0]; | ||
533 | u8 anamicl, micbias, avadc_ctl; | ||
534 | |||
535 | anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); | ||
536 | anamicl &= ~(TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN | ||
537 | | TWL4030_MAINMIC_EN); | ||
538 | micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL); | ||
539 | micbias &= ~(TWL4030_HSMICBIAS_EN | TWL4030_MICBIAS1_EN); | ||
540 | avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL); | ||
541 | |||
542 | switch (value) { | ||
543 | case 1: | ||
544 | anamicl |= TWL4030_MAINMIC_EN; | ||
545 | micbias |= TWL4030_MICBIAS1_EN; | ||
546 | break; | ||
547 | case 2: | ||
548 | anamicl |= TWL4030_HSMIC_EN; | ||
549 | micbias |= TWL4030_HSMICBIAS_EN; | ||
550 | break; | ||
551 | case 3: | ||
552 | anamicl |= TWL4030_AUXL_EN; | ||
553 | break; | ||
554 | case 4: | ||
555 | anamicl |= TWL4030_CKMIC_EN; | ||
556 | break; | ||
557 | default: | ||
558 | break; | ||
559 | } | ||
560 | |||
561 | /* If some input is selected, enable amp and ADC */ | ||
562 | if (value != 0) { | ||
563 | anamicl |= TWL4030_MICAMPL_EN; | ||
564 | avadc_ctl |= TWL4030_ADCL_EN; | ||
565 | } else { | ||
566 | anamicl &= ~TWL4030_MICAMPL_EN; | ||
567 | avadc_ctl &= ~TWL4030_ADCL_EN; | ||
568 | } | ||
569 | |||
570 | twl4030_write(codec, TWL4030_REG_ANAMICL, anamicl); | ||
571 | twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias); | ||
572 | twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl); | ||
573 | |||
574 | return 1; | ||
575 | } | ||
576 | |||
577 | static int twl4030_get_right_input(struct snd_kcontrol *kcontrol, | ||
578 | struct snd_ctl_elem_value *ucontrol) | ||
579 | { | ||
580 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
581 | u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR); | ||
582 | int value = 0; | ||
583 | |||
584 | reg &= TWL4030_SUBMIC_EN|TWL4030_AUXR_EN; | ||
585 | switch (reg) { | ||
586 | case TWL4030_SUBMIC_EN: | ||
587 | value = 1; | ||
588 | break; | ||
589 | case TWL4030_AUXR_EN: | ||
590 | value = 2; | ||
591 | break; | ||
592 | default: | ||
593 | break; | ||
594 | } | ||
595 | |||
596 | ucontrol->value.integer.value[0] = value; | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | static int twl4030_put_right_input(struct snd_kcontrol *kcontrol, | ||
601 | struct snd_ctl_elem_value *ucontrol) | ||
602 | { | ||
603 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
604 | int value = ucontrol->value.integer.value[0]; | ||
605 | u8 anamicr, micbias, avadc_ctl; | ||
606 | |||
607 | anamicr = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR); | ||
608 | anamicr &= ~(TWL4030_SUBMIC_EN|TWL4030_AUXR_EN); | ||
609 | micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL); | ||
610 | micbias &= ~TWL4030_MICBIAS2_EN; | ||
611 | avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL); | ||
612 | |||
613 | switch (value) { | ||
614 | case 1: | ||
615 | anamicr |= TWL4030_SUBMIC_EN; | ||
616 | micbias |= TWL4030_MICBIAS2_EN; | ||
617 | break; | ||
618 | case 2: | ||
619 | anamicr |= TWL4030_AUXR_EN; | ||
620 | break; | ||
621 | default: | ||
622 | break; | ||
623 | } | ||
624 | |||
625 | if (value != 0) { | ||
626 | anamicr |= TWL4030_MICAMPR_EN; | ||
627 | avadc_ctl |= TWL4030_ADCR_EN; | ||
628 | } else { | ||
629 | anamicr &= ~TWL4030_MICAMPR_EN; | ||
630 | avadc_ctl &= ~TWL4030_ADCR_EN; | ||
631 | } | ||
632 | |||
633 | twl4030_write(codec, TWL4030_REG_ANAMICR, anamicr); | ||
634 | twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias); | ||
635 | twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl); | ||
636 | |||
637 | return 1; | ||
638 | } | ||
639 | |||
640 | static const char *twl4030_left_in_sel[] = { | ||
641 | "None", | ||
642 | "Main Mic", | ||
643 | "Headset Mic", | ||
644 | "Line In", | ||
645 | "Carkit Mic", | ||
646 | }; | ||
647 | |||
648 | static const char *twl4030_right_in_sel[] = { | ||
649 | "None", | ||
650 | "Sub Mic", | ||
651 | "Line In", | ||
652 | }; | ||
653 | |||
654 | static const struct soc_enum twl4030_left_input_mux = | ||
655 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_left_in_sel), | ||
656 | twl4030_left_in_sel); | ||
657 | |||
658 | static const struct soc_enum twl4030_right_input_mux = | ||
659 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_right_in_sel), | ||
660 | twl4030_right_in_sel); | ||
661 | |||
662 | /* | 580 | /* |
663 | * FGAIN volume control: | 581 | * FGAIN volume control: |
664 | * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) | 582 | * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) |
@@ -741,18 +659,15 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = { | |||
741 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), | 659 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), |
742 | 660 | ||
743 | /* Common capture gain controls */ | 661 | /* Common capture gain controls */ |
744 | SOC_DOUBLE_R_TLV("Capture Volume", | 662 | SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume", |
745 | TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, | 663 | TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, |
746 | 0, 0x1f, 0, digital_capture_tlv), | 664 | 0, 0x1f, 0, digital_capture_tlv), |
665 | SOC_DOUBLE_R_TLV("TX2 Digital Capture Volume", | ||
666 | TWL4030_REG_AVTXL2PGA, TWL4030_REG_AVTXR2PGA, | ||
667 | 0, 0x1f, 0, digital_capture_tlv), | ||
747 | 668 | ||
748 | SOC_DOUBLE_TLV("Input Boost Volume", TWL4030_REG_ANAMIC_GAIN, | 669 | SOC_DOUBLE_TLV("Analog Capture Volume", TWL4030_REG_ANAMIC_GAIN, |
749 | 0, 3, 5, 0, input_gain_tlv), | 670 | 0, 3, 5, 0, input_gain_tlv), |
750 | |||
751 | /* Input source controls */ | ||
752 | SOC_ENUM_EXT("Left Input Source", twl4030_left_input_mux, | ||
753 | twl4030_get_left_input, twl4030_put_left_input), | ||
754 | SOC_ENUM_EXT("Right Input Source", twl4030_right_input_mux, | ||
755 | twl4030_get_right_input, twl4030_put_right_input), | ||
756 | }; | 671 | }; |
757 | 672 | ||
758 | /* add non dapm controls */ | 673 | /* add non dapm controls */ |
@@ -772,9 +687,19 @@ static int twl4030_add_controls(struct snd_soc_codec *codec) | |||
772 | } | 687 | } |
773 | 688 | ||
774 | static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | 689 | static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { |
775 | SND_SOC_DAPM_INPUT("INL"), | 690 | /* Left channel inputs */ |
776 | SND_SOC_DAPM_INPUT("INR"), | 691 | SND_SOC_DAPM_INPUT("MAINMIC"), |
777 | 692 | SND_SOC_DAPM_INPUT("HSMIC"), | |
693 | SND_SOC_DAPM_INPUT("AUXL"), | ||
694 | SND_SOC_DAPM_INPUT("CARKITMIC"), | ||
695 | /* Right channel inputs */ | ||
696 | SND_SOC_DAPM_INPUT("SUBMIC"), | ||
697 | SND_SOC_DAPM_INPUT("AUXR"), | ||
698 | /* Digital microphones (Stereo) */ | ||
699 | SND_SOC_DAPM_INPUT("DIGIMIC0"), | ||
700 | SND_SOC_DAPM_INPUT("DIGIMIC1"), | ||
701 | |||
702 | /* Outputs */ | ||
778 | SND_SOC_DAPM_OUTPUT("OUTL"), | 703 | SND_SOC_DAPM_OUTPUT("OUTL"), |
779 | SND_SOC_DAPM_OUTPUT("OUTR"), | 704 | SND_SOC_DAPM_OUTPUT("OUTR"), |
780 | SND_SOC_DAPM_OUTPUT("EARPIECE"), | 705 | SND_SOC_DAPM_OUTPUT("EARPIECE"), |
@@ -809,16 +734,13 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
809 | 734 | ||
810 | /* Output MUX controls */ | 735 | /* Output MUX controls */ |
811 | /* Earpiece */ | 736 | /* Earpiece */ |
812 | SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, | 737 | SND_SOC_DAPM_VALUE_MUX("Earpiece Mux", SND_SOC_NOPM, 0, 0, |
813 | &twl4030_dapm_earpiece_control, outmixer_event, | 738 | &twl4030_dapm_earpiece_control), |
814 | SND_SOC_DAPM_PRE_REG), | ||
815 | /* PreDrivL/R */ | 739 | /* PreDrivL/R */ |
816 | SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, | 740 | SND_SOC_DAPM_VALUE_MUX("PredriveL Mux", SND_SOC_NOPM, 0, 0, |
817 | &twl4030_dapm_predrivel_control, outmixer_event, | 741 | &twl4030_dapm_predrivel_control), |
818 | SND_SOC_DAPM_PRE_REG), | 742 | SND_SOC_DAPM_VALUE_MUX("PredriveR Mux", SND_SOC_NOPM, 0, 0, |
819 | SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, | 743 | &twl4030_dapm_predriver_control), |
820 | &twl4030_dapm_predriver_control, outmixer_event, | ||
821 | SND_SOC_DAPM_PRE_REG), | ||
822 | /* HeadsetL/R */ | 744 | /* HeadsetL/R */ |
823 | SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, | 745 | SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, |
824 | &twl4030_dapm_hsol_control), | 746 | &twl4030_dapm_hsol_control), |
@@ -837,8 +759,48 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
837 | &twl4030_dapm_handsfreer_control, handsfree_event, | 759 | &twl4030_dapm_handsfreer_control, handsfree_event, |
838 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), | 760 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), |
839 | 761 | ||
840 | SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), | 762 | /* Introducing four virtual ADC, since TWL4030 have four channel for |
841 | SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), | 763 | capture */ |
764 | SND_SOC_DAPM_ADC("ADC Virtual Left1", "Left Front Capture", | ||
765 | SND_SOC_NOPM, 0, 0), | ||
766 | SND_SOC_DAPM_ADC("ADC Virtual Right1", "Right Front Capture", | ||
767 | SND_SOC_NOPM, 0, 0), | ||
768 | SND_SOC_DAPM_ADC("ADC Virtual Left2", "Left Rear Capture", | ||
769 | SND_SOC_NOPM, 0, 0), | ||
770 | SND_SOC_DAPM_ADC("ADC Virtual Right2", "Right Rear Capture", | ||
771 | SND_SOC_NOPM, 0, 0), | ||
772 | |||
773 | /* Analog/Digital mic path selection. | ||
774 | TX1 Left/Right: either analog Left/Right or Digimic0 | ||
775 | TX2 Left/Right: either analog Left/Right or Digimic1 */ | ||
776 | SND_SOC_DAPM_MUX_E("TX1 Capture Route", SND_SOC_NOPM, 0, 0, | ||
777 | &twl4030_dapm_micpathtx1_control, micpath_event, | ||
778 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | ||
779 | SND_SOC_DAPM_POST_REG), | ||
780 | SND_SOC_DAPM_MUX_E("TX2 Capture Route", SND_SOC_NOPM, 0, 0, | ||
781 | &twl4030_dapm_micpathtx2_control, micpath_event, | ||
782 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | ||
783 | SND_SOC_DAPM_POST_REG), | ||
784 | |||
785 | /* Analog input muxes with power switch for the physical ADCL/R */ | ||
786 | SND_SOC_DAPM_VALUE_MUX("Analog Left Capture Route", | ||
787 | TWL4030_REG_AVADC_CTL, 3, 0, &twl4030_dapm_analoglmic_control), | ||
788 | SND_SOC_DAPM_VALUE_MUX("Analog Right Capture Route", | ||
789 | TWL4030_REG_AVADC_CTL, 1, 0, &twl4030_dapm_analogrmic_control), | ||
790 | |||
791 | SND_SOC_DAPM_PGA("Analog Left Amplifier", | ||
792 | TWL4030_REG_ANAMICL, 4, 0, NULL, 0), | ||
793 | SND_SOC_DAPM_PGA("Analog Right Amplifier", | ||
794 | TWL4030_REG_ANAMICR, 4, 0, NULL, 0), | ||
795 | |||
796 | SND_SOC_DAPM_PGA("Digimic0 Enable", | ||
797 | TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), | ||
798 | SND_SOC_DAPM_PGA("Digimic1 Enable", | ||
799 | TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0), | ||
800 | |||
801 | SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0), | ||
802 | SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0), | ||
803 | SND_SOC_DAPM_MICBIAS("Headset Mic Bias", TWL4030_REG_MICBIAS_CTL, 2, 0), | ||
842 | }; | 804 | }; |
843 | 805 | ||
844 | static const struct snd_soc_dapm_route intercon[] = { | 806 | static const struct snd_soc_dapm_route intercon[] = { |
@@ -894,9 +856,39 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
894 | {"HFL", NULL, "HandsfreeL Mux"}, | 856 | {"HFL", NULL, "HandsfreeL Mux"}, |
895 | {"HFR", NULL, "HandsfreeR Mux"}, | 857 | {"HFR", NULL, "HandsfreeR Mux"}, |
896 | 858 | ||
897 | /* inputs */ | 859 | /* Capture path */ |
898 | {"ADCL", NULL, "INL"}, | 860 | {"Analog Left Capture Route", "Main mic", "MAINMIC"}, |
899 | {"ADCR", NULL, "INR"}, | 861 | {"Analog Left Capture Route", "Headset mic", "HSMIC"}, |
862 | {"Analog Left Capture Route", "AUXL", "AUXL"}, | ||
863 | {"Analog Left Capture Route", "Carkit mic", "CARKITMIC"}, | ||
864 | |||
865 | {"Analog Right Capture Route", "Sub mic", "SUBMIC"}, | ||
866 | {"Analog Right Capture Route", "AUXR", "AUXR"}, | ||
867 | |||
868 | {"Analog Left Amplifier", NULL, "Analog Left Capture Route"}, | ||
869 | {"Analog Right Amplifier", NULL, "Analog Right Capture Route"}, | ||
870 | |||
871 | {"Digimic0 Enable", NULL, "DIGIMIC0"}, | ||
872 | {"Digimic1 Enable", NULL, "DIGIMIC1"}, | ||
873 | |||
874 | /* TX1 Left capture path */ | ||
875 | {"TX1 Capture Route", "Analog", "Analog Left Amplifier"}, | ||
876 | {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"}, | ||
877 | /* TX1 Right capture path */ | ||
878 | {"TX1 Capture Route", "Analog", "Analog Right Amplifier"}, | ||
879 | {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"}, | ||
880 | /* TX2 Left capture path */ | ||
881 | {"TX2 Capture Route", "Analog", "Analog Left Amplifier"}, | ||
882 | {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"}, | ||
883 | /* TX2 Right capture path */ | ||
884 | {"TX2 Capture Route", "Analog", "Analog Right Amplifier"}, | ||
885 | {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"}, | ||
886 | |||
887 | {"ADC Virtual Left1", NULL, "TX1 Capture Route"}, | ||
888 | {"ADC Virtual Right1", NULL, "TX1 Capture Route"}, | ||
889 | {"ADC Virtual Left2", NULL, "TX2 Capture Route"}, | ||
890 | {"ADC Virtual Right2", NULL, "TX2 Capture Route"}, | ||
891 | |||
900 | }; | 892 | }; |
901 | 893 | ||
902 | static int twl4030_add_widgets(struct snd_soc_codec *codec) | 894 | static int twl4030_add_widgets(struct snd_soc_codec *codec) |
@@ -923,6 +915,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec) | |||
923 | twl4030_write(codec, TWL4030_REG_ANAMICL, | 915 | twl4030_write(codec, TWL4030_REG_ANAMICL, |
924 | anamicl | TWL4030_CNCL_OFFSET_START); | 916 | anamicl | TWL4030_CNCL_OFFSET_START); |
925 | 917 | ||
918 | |||
926 | /* wait for offset cancellation to complete */ | 919 | /* wait for offset cancellation to complete */ |
927 | do { | 920 | do { |
928 | /* this takes a little while, so don't slam i2c */ | 921 | /* this takes a little while, so don't slam i2c */ |
@@ -1287,6 +1280,8 @@ static int twl4030_remove(struct platform_device *pdev) | |||
1287 | struct snd_soc_codec *codec = socdev->codec; | 1280 | struct snd_soc_codec *codec = socdev->codec; |
1288 | 1281 | ||
1289 | printk(KERN_INFO "TWL4030 Audio Codec remove\n"); | 1282 | printk(KERN_INFO "TWL4030 Audio Codec remove\n"); |
1283 | snd_soc_free_pcms(socdev); | ||
1284 | snd_soc_dapm_free(socdev); | ||
1290 | kfree(codec); | 1285 | kfree(codec); |
1291 | 1286 | ||
1292 | return 0; | 1287 | return 0; |
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h index 54615c76802b..442e5a828617 100644 --- a/sound/soc/codecs/twl4030.h +++ b/sound/soc/codecs/twl4030.h | |||
@@ -147,6 +147,13 @@ | |||
147 | #define TWL4030_AVADC_CLK_PRIORITY 0x04 | 147 | #define TWL4030_AVADC_CLK_PRIORITY 0x04 |
148 | #define TWL4030_ADCR_EN 0x02 | 148 | #define TWL4030_ADCR_EN 0x02 |
149 | 149 | ||
150 | /* TWL4030_REG_ADCMICSEL (0x08) Fields */ | ||
151 | |||
152 | #define TWL4030_DIGMIC1_EN 0x08 | ||
153 | #define TWL4030_TX2IN_SEL 0x04 | ||
154 | #define TWL4030_DIGMIC0_EN 0x02 | ||
155 | #define TWL4030_TX1IN_SEL 0x01 | ||
156 | |||
150 | /* AUDIO_IF (0x0E) Fields */ | 157 | /* AUDIO_IF (0x0E) Fields */ |
151 | 158 | ||
152 | #define TWL4030_AIF_SLAVE_EN 0x80 | 159 | #define TWL4030_AIF_SLAVE_EN 0x80 |
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 01b948bb55a1..54851f318568 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "davinci-pcm.h" | 26 | #include "davinci-pcm.h" |
27 | #include "davinci-i2s.h" | 27 | #include "davinci-i2s.h" |
28 | 28 | ||
29 | #define EVM_CODEC_CLOCK 22579200 | ||
30 | 29 | ||
31 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | 30 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
32 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) | 31 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
@@ -37,6 +36,21 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
37 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 36 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; |
38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 37 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
39 | int ret = 0; | 38 | int ret = 0; |
39 | unsigned sysclk; | ||
40 | |||
41 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ | ||
42 | if (machine_is_davinci_dm355_evm()) | ||
43 | sysclk = 27000000; | ||
44 | |||
45 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by | ||
46 | * board-dm644x-evm.c using GPIOs from U18. There are six | ||
47 | * options; here we "know" we use a 48 KHz sample rate. | ||
48 | */ | ||
49 | else if (machine_is_davinci_evm()) | ||
50 | sysclk = 12288000; | ||
51 | |||
52 | else | ||
53 | return -EINVAL; | ||
40 | 54 | ||
41 | /* set codec DAI configuration */ | 55 | /* set codec DAI configuration */ |
42 | ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); | 56 | ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); |
@@ -49,8 +63,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
49 | return ret; | 63 | return ret; |
50 | 64 | ||
51 | /* set the codec system clock */ | 65 | /* set the codec system clock */ |
52 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, EVM_CODEC_CLOCK, | 66 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT); |
53 | SND_SOC_CLOCK_OUT); | ||
54 | if (ret < 0) | 67 | if (ret < 0) |
55 | return ret; | 68 | return ret; |
56 | 69 | ||
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 74abc9b4f1cc..366049d8578c 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -212,7 +212,7 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream) | |||
212 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 212 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
213 | count = src - runtime->dma_addr; | 213 | count = src - runtime->dma_addr; |
214 | else | 214 | else |
215 | count = dst - runtime->dma_addr;; | 215 | count = dst - runtime->dma_addr; |
216 | 216 | ||
217 | spin_unlock(&prtd->lock); | 217 | spin_unlock(&prtd->lock); |
218 | 218 | ||
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index f67579d52765..4935d1bcbd8d 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <sound/soc-dapm.h> | 24 | #include <sound/soc-dapm.h> |
25 | 25 | ||
26 | #include <asm/dma.h> | 26 | #include <asm/dma.h> |
27 | #include <asm/mach-types.h> | ||
27 | #include <asm/plat-sffsdr/sffsdr-fpga.h> | 28 | #include <asm/plat-sffsdr/sffsdr-fpga.h> |
28 | 29 | ||
29 | #include <mach/mcbsp.h> | 30 | #include <mach/mcbsp.h> |
@@ -115,6 +116,9 @@ static int __init sffsdr_init(void) | |||
115 | { | 116 | { |
116 | int ret; | 117 | int ret; |
117 | 118 | ||
119 | if (!machine_is_sffsdr()) | ||
120 | return -EINVAL; | ||
121 | |||
118 | sffsdr_snd_device = platform_device_alloc("soc-audio", 0); | 122 | sffsdr_snd_device = platform_device_alloc("soc-audio", 0); |
119 | if (!sffsdr_snd_device) { | 123 | if (!sffsdr_snd_device) { |
120 | printk(KERN_ERR "platform device allocation failed\n"); | 124 | printk(KERN_ERR "platform device allocation failed\n"); |
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index a7b1d77b2105..4f7f04014585 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig | |||
@@ -10,6 +10,7 @@ config SND_OMAP_SOC_N810 | |||
10 | tristate "SoC Audio support for Nokia N810" | 10 | tristate "SoC Audio support for Nokia N810" |
11 | depends on SND_OMAP_SOC && MACH_NOKIA_N810 | 11 | depends on SND_OMAP_SOC && MACH_NOKIA_N810 |
12 | select SND_OMAP_SOC_MCBSP | 12 | select SND_OMAP_SOC_MCBSP |
13 | select OMAP_MUX | ||
13 | select SND_SOC_TLV320AIC3X | 14 | select SND_SOC_TLV320AIC3X |
14 | help | 15 | help |
15 | Say Y if you want to add support for SoC audio on Nokia N810. | 16 | Say Y if you want to add support for SoC audio on Nokia N810. |
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index bd91594496b1..fcc2f5d9a878 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c | |||
@@ -180,6 +180,19 @@ static int omap3pandora_in_init(struct snd_soc_codec *codec) | |||
180 | { | 180 | { |
181 | int ret; | 181 | int ret; |
182 | 182 | ||
183 | /* All TWL4030 output pins are floating */ | ||
184 | snd_soc_dapm_nc_pin(codec, "OUTL"), | ||
185 | snd_soc_dapm_nc_pin(codec, "OUTR"), | ||
186 | snd_soc_dapm_nc_pin(codec, "EARPIECE"), | ||
187 | snd_soc_dapm_nc_pin(codec, "PREDRIVEL"), | ||
188 | snd_soc_dapm_nc_pin(codec, "PREDRIVER"), | ||
189 | snd_soc_dapm_nc_pin(codec, "HSOL"), | ||
190 | snd_soc_dapm_nc_pin(codec, "HSOR"), | ||
191 | snd_soc_dapm_nc_pin(codec, "CARKITL"), | ||
192 | snd_soc_dapm_nc_pin(codec, "CARKITR"), | ||
193 | snd_soc_dapm_nc_pin(codec, "HFL"), | ||
194 | snd_soc_dapm_nc_pin(codec, "HFR"), | ||
195 | |||
183 | ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, | 196 | ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, |
184 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); | 197 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); |
185 | if (ret < 0) | 198 | if (ret < 0) |
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index c670d08e7c9e..53b9fb127a6d 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c | |||
@@ -61,9 +61,9 @@ static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
61 | 61 | ||
62 | __pxa2xx_pcm_hw_free(substream); | 62 | __pxa2xx_pcm_hw_free(substream); |
63 | 63 | ||
64 | if (prtd->dma_ch) { | 64 | if (prtd->dma_ch >= 0) { |
65 | pxa_free_dma(prtd->dma_ch); | 65 | pxa_free_dma(prtd->dma_ch); |
66 | prtd->dma_ch = 0; | 66 | prtd->dma_ch = -1; |
67 | } | 67 | } |
68 | 68 | ||
69 | return 0; | 69 | return 0; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b098c0b4c584..55fdb4abb179 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1300,6 +1300,8 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits); | |||
1300 | /** | 1300 | /** |
1301 | * snd_soc_new_pcms - create new sound card and pcms | 1301 | * snd_soc_new_pcms - create new sound card and pcms |
1302 | * @socdev: the SoC audio device | 1302 | * @socdev: the SoC audio device |
1303 | * @idx: ALSA card index | ||
1304 | * @xid: card identification | ||
1303 | * | 1305 | * |
1304 | * Create a new sound card based upon the codec and interface pcms. | 1306 | * Create a new sound card based upon the codec and interface pcms. |
1305 | * | 1307 | * |
@@ -1472,7 +1474,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams); | |||
1472 | * snd_soc_cnew - create new control | 1474 | * snd_soc_cnew - create new control |
1473 | * @_template: control template | 1475 | * @_template: control template |
1474 | * @data: control private data | 1476 | * @data: control private data |
1475 | * @lnng_name: control long name | 1477 | * @long_name: control long name |
1476 | * | 1478 | * |
1477 | * Create a new mixer control from a template control. | 1479 | * Create a new mixer control from a template control. |
1478 | * | 1480 | * |
@@ -1522,7 +1524,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double); | |||
1522 | /** | 1524 | /** |
1523 | * snd_soc_get_enum_double - enumerated double mixer get callback | 1525 | * snd_soc_get_enum_double - enumerated double mixer get callback |
1524 | * @kcontrol: mixer control | 1526 | * @kcontrol: mixer control |
1525 | * @uinfo: control element information | 1527 | * @ucontrol: control element information |
1526 | * | 1528 | * |
1527 | * Callback to get the value of a double enumerated mixer. | 1529 | * Callback to get the value of a double enumerated mixer. |
1528 | * | 1530 | * |
@@ -1551,7 +1553,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double); | |||
1551 | /** | 1553 | /** |
1552 | * snd_soc_put_enum_double - enumerated double mixer put callback | 1554 | * snd_soc_put_enum_double - enumerated double mixer put callback |
1553 | * @kcontrol: mixer control | 1555 | * @kcontrol: mixer control |
1554 | * @uinfo: control element information | 1556 | * @ucontrol: control element information |
1555 | * | 1557 | * |
1556 | * Callback to set the value of a double enumerated mixer. | 1558 | * Callback to set the value of a double enumerated mixer. |
1557 | * | 1559 | * |
@@ -1583,6 +1585,80 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1583 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); | 1585 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); |
1584 | 1586 | ||
1585 | /** | 1587 | /** |
1588 | * snd_soc_get_value_enum_double - semi enumerated double mixer get callback | ||
1589 | * @kcontrol: mixer control | ||
1590 | * @ucontrol: control element information | ||
1591 | * | ||
1592 | * Callback to get the value of a double semi enumerated mixer. | ||
1593 | * | ||
1594 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1595 | * used for handling bitfield coded enumeration for example. | ||
1596 | * | ||
1597 | * Returns 0 for success. | ||
1598 | */ | ||
1599 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1600 | struct snd_ctl_elem_value *ucontrol) | ||
1601 | { | ||
1602 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1603 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1604 | unsigned short reg_val, val, mux; | ||
1605 | |||
1606 | reg_val = snd_soc_read(codec, e->reg); | ||
1607 | val = (reg_val >> e->shift_l) & e->mask; | ||
1608 | for (mux = 0; mux < e->max; mux++) { | ||
1609 | if (val == e->values[mux]) | ||
1610 | break; | ||
1611 | } | ||
1612 | ucontrol->value.enumerated.item[0] = mux; | ||
1613 | if (e->shift_l != e->shift_r) { | ||
1614 | val = (reg_val >> e->shift_r) & e->mask; | ||
1615 | for (mux = 0; mux < e->max; mux++) { | ||
1616 | if (val == e->values[mux]) | ||
1617 | break; | ||
1618 | } | ||
1619 | ucontrol->value.enumerated.item[1] = mux; | ||
1620 | } | ||
1621 | |||
1622 | return 0; | ||
1623 | } | ||
1624 | EXPORT_SYMBOL_GPL(snd_soc_get_value_enum_double); | ||
1625 | |||
1626 | /** | ||
1627 | * snd_soc_put_value_enum_double - semi enumerated double mixer put callback | ||
1628 | * @kcontrol: mixer control | ||
1629 | * @ucontrol: control element information | ||
1630 | * | ||
1631 | * Callback to set the value of a double semi enumerated mixer. | ||
1632 | * | ||
1633 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1634 | * used for handling bitfield coded enumeration for example. | ||
1635 | * | ||
1636 | * Returns 0 for success. | ||
1637 | */ | ||
1638 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1639 | struct snd_ctl_elem_value *ucontrol) | ||
1640 | { | ||
1641 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1642 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1643 | unsigned short val; | ||
1644 | unsigned short mask; | ||
1645 | |||
1646 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | ||
1647 | return -EINVAL; | ||
1648 | val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; | ||
1649 | mask = e->mask << e->shift_l; | ||
1650 | if (e->shift_l != e->shift_r) { | ||
1651 | if (ucontrol->value.enumerated.item[1] > e->max - 1) | ||
1652 | return -EINVAL; | ||
1653 | val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; | ||
1654 | mask |= e->mask << e->shift_r; | ||
1655 | } | ||
1656 | |||
1657 | return snd_soc_update_bits(codec, e->reg, mask, val); | ||
1658 | } | ||
1659 | EXPORT_SYMBOL_GPL(snd_soc_put_value_enum_double); | ||
1660 | |||
1661 | /** | ||
1586 | * snd_soc_info_enum_ext - external enumerated single mixer info callback | 1662 | * snd_soc_info_enum_ext - external enumerated single mixer info callback |
1587 | * @kcontrol: mixer control | 1663 | * @kcontrol: mixer control |
1588 | * @uinfo: control element information | 1664 | * @uinfo: control element information |
@@ -1668,7 +1744,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw); | |||
1668 | /** | 1744 | /** |
1669 | * snd_soc_get_volsw - single mixer get callback | 1745 | * snd_soc_get_volsw - single mixer get callback |
1670 | * @kcontrol: mixer control | 1746 | * @kcontrol: mixer control |
1671 | * @uinfo: control element information | 1747 | * @ucontrol: control element information |
1672 | * | 1748 | * |
1673 | * Callback to get the value of a single mixer control. | 1749 | * Callback to get the value of a single mixer control. |
1674 | * | 1750 | * |
@@ -1707,7 +1783,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw); | |||
1707 | /** | 1783 | /** |
1708 | * snd_soc_put_volsw - single mixer put callback | 1784 | * snd_soc_put_volsw - single mixer put callback |
1709 | * @kcontrol: mixer control | 1785 | * @kcontrol: mixer control |
1710 | * @uinfo: control element information | 1786 | * @ucontrol: control element information |
1711 | * | 1787 | * |
1712 | * Callback to set the value of a single mixer control. | 1788 | * Callback to set the value of a single mixer control. |
1713 | * | 1789 | * |
@@ -1775,7 +1851,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r); | |||
1775 | /** | 1851 | /** |
1776 | * snd_soc_get_volsw_2r - double mixer get callback | 1852 | * snd_soc_get_volsw_2r - double mixer get callback |
1777 | * @kcontrol: mixer control | 1853 | * @kcontrol: mixer control |
1778 | * @uinfo: control element information | 1854 | * @ucontrol: control element information |
1779 | * | 1855 | * |
1780 | * Callback to get the value of a double mixer control that spans 2 registers. | 1856 | * Callback to get the value of a double mixer control that spans 2 registers. |
1781 | * | 1857 | * |
@@ -1812,7 +1888,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r); | |||
1812 | /** | 1888 | /** |
1813 | * snd_soc_put_volsw_2r - double mixer set callback | 1889 | * snd_soc_put_volsw_2r - double mixer set callback |
1814 | * @kcontrol: mixer control | 1890 | * @kcontrol: mixer control |
1815 | * @uinfo: control element information | 1891 | * @ucontrol: control element information |
1816 | * | 1892 | * |
1817 | * Callback to set the value of a double mixer control that spans 2 registers. | 1893 | * Callback to set the value of a double mixer control that spans 2 registers. |
1818 | * | 1894 | * |
@@ -1882,7 +1958,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8); | |||
1882 | /** | 1958 | /** |
1883 | * snd_soc_get_volsw_s8 - signed mixer get callback | 1959 | * snd_soc_get_volsw_s8 - signed mixer get callback |
1884 | * @kcontrol: mixer control | 1960 | * @kcontrol: mixer control |
1885 | * @uinfo: control element information | 1961 | * @ucontrol: control element information |
1886 | * | 1962 | * |
1887 | * Callback to get the value of a signed mixer control. | 1963 | * Callback to get the value of a signed mixer control. |
1888 | * | 1964 | * |
@@ -1909,7 +1985,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8); | |||
1909 | /** | 1985 | /** |
1910 | * snd_soc_put_volsw_sgn - signed mixer put callback | 1986 | * snd_soc_put_volsw_sgn - signed mixer put callback |
1911 | * @kcontrol: mixer control | 1987 | * @kcontrol: mixer control |
1912 | * @uinfo: control element information | 1988 | * @ucontrol: control element information |
1913 | * | 1989 | * |
1914 | * Callback to set the value of a signed mixer control. | 1990 | * Callback to set the value of a signed mixer control. |
1915 | * | 1991 | * |
@@ -1954,7 +2030,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); | |||
1954 | /** | 2030 | /** |
1955 | * snd_soc_dai_set_clkdiv - configure DAI clock dividers. | 2031 | * snd_soc_dai_set_clkdiv - configure DAI clock dividers. |
1956 | * @dai: DAI | 2032 | * @dai: DAI |
1957 | * @clk_id: DAI specific clock divider ID | 2033 | * @div_id: DAI specific clock divider ID |
1958 | * @div: new clock divisor. | 2034 | * @div: new clock divisor. |
1959 | * | 2035 | * |
1960 | * Configures the clock dividers. This is used to derive the best DAI bit and | 2036 | * Configures the clock dividers. This is used to derive the best DAI bit and |
@@ -2060,7 +2136,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); | |||
2060 | /** | 2136 | /** |
2061 | * snd_soc_register_card - Register a card with the ASoC core | 2137 | * snd_soc_register_card - Register a card with the ASoC core |
2062 | * | 2138 | * |
2063 | * @param card Card to register | 2139 | * @card: Card to register |
2064 | * | 2140 | * |
2065 | * Note that currently this is an internal only function: it will be | 2141 | * Note that currently this is an internal only function: it will be |
2066 | * exposed to machine drivers after further backporting of ASoC v2 | 2142 | * exposed to machine drivers after further backporting of ASoC v2 |
@@ -2087,7 +2163,7 @@ static int snd_soc_register_card(struct snd_soc_card *card) | |||
2087 | /** | 2163 | /** |
2088 | * snd_soc_unregister_card - Unregister a card with the ASoC core | 2164 | * snd_soc_unregister_card - Unregister a card with the ASoC core |
2089 | * | 2165 | * |
2090 | * @param card Card to unregister | 2166 | * @card: Card to unregister |
2091 | * | 2167 | * |
2092 | * Note that currently this is an internal only function: it will be | 2168 | * Note that currently this is an internal only function: it will be |
2093 | * exposed to machine drivers after further backporting of ASoC v2 | 2169 | * exposed to machine drivers after further backporting of ASoC v2 |
@@ -2107,7 +2183,7 @@ static int snd_soc_unregister_card(struct snd_soc_card *card) | |||
2107 | /** | 2183 | /** |
2108 | * snd_soc_register_dai - Register a DAI with the ASoC core | 2184 | * snd_soc_register_dai - Register a DAI with the ASoC core |
2109 | * | 2185 | * |
2110 | * @param dai DAI to register | 2186 | * @dai: DAI to register |
2111 | */ | 2187 | */ |
2112 | int snd_soc_register_dai(struct snd_soc_dai *dai) | 2188 | int snd_soc_register_dai(struct snd_soc_dai *dai) |
2113 | { | 2189 | { |
@@ -2134,7 +2210,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dai); | |||
2134 | /** | 2210 | /** |
2135 | * snd_soc_unregister_dai - Unregister a DAI from the ASoC core | 2211 | * snd_soc_unregister_dai - Unregister a DAI from the ASoC core |
2136 | * | 2212 | * |
2137 | * @param dai DAI to unregister | 2213 | * @dai: DAI to unregister |
2138 | */ | 2214 | */ |
2139 | void snd_soc_unregister_dai(struct snd_soc_dai *dai) | 2215 | void snd_soc_unregister_dai(struct snd_soc_dai *dai) |
2140 | { | 2216 | { |
@@ -2149,8 +2225,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai); | |||
2149 | /** | 2225 | /** |
2150 | * snd_soc_register_dais - Register multiple DAIs with the ASoC core | 2226 | * snd_soc_register_dais - Register multiple DAIs with the ASoC core |
2151 | * | 2227 | * |
2152 | * @param dai Array of DAIs to register | 2228 | * @dai: Array of DAIs to register |
2153 | * @param count Number of DAIs | 2229 | * @count: Number of DAIs |
2154 | */ | 2230 | */ |
2155 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) | 2231 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) |
2156 | { | 2232 | { |
@@ -2175,8 +2251,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dais); | |||
2175 | /** | 2251 | /** |
2176 | * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core | 2252 | * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core |
2177 | * | 2253 | * |
2178 | * @param dai Array of DAIs to unregister | 2254 | * @dai: Array of DAIs to unregister |
2179 | * @param count Number of DAIs | 2255 | * @count: Number of DAIs |
2180 | */ | 2256 | */ |
2181 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) | 2257 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) |
2182 | { | 2258 | { |
@@ -2190,7 +2266,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais); | |||
2190 | /** | 2266 | /** |
2191 | * snd_soc_register_platform - Register a platform with the ASoC core | 2267 | * snd_soc_register_platform - Register a platform with the ASoC core |
2192 | * | 2268 | * |
2193 | * @param platform platform to register | 2269 | * @platform: platform to register |
2194 | */ | 2270 | */ |
2195 | int snd_soc_register_platform(struct snd_soc_platform *platform) | 2271 | int snd_soc_register_platform(struct snd_soc_platform *platform) |
2196 | { | 2272 | { |
@@ -2213,7 +2289,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform); | |||
2213 | /** | 2289 | /** |
2214 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core | 2290 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core |
2215 | * | 2291 | * |
2216 | * @param platform platform to unregister | 2292 | * @platform: platform to unregister |
2217 | */ | 2293 | */ |
2218 | void snd_soc_unregister_platform(struct snd_soc_platform *platform) | 2294 | void snd_soc_unregister_platform(struct snd_soc_platform *platform) |
2219 | { | 2295 | { |
@@ -2228,7 +2304,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); | |||
2228 | /** | 2304 | /** |
2229 | * snd_soc_register_codec - Register a codec with the ASoC core | 2305 | * snd_soc_register_codec - Register a codec with the ASoC core |
2230 | * | 2306 | * |
2231 | * @param codec codec to register | 2307 | * @codec: codec to register |
2232 | */ | 2308 | */ |
2233 | int snd_soc_register_codec(struct snd_soc_codec *codec) | 2309 | int snd_soc_register_codec(struct snd_soc_codec *codec) |
2234 | { | 2310 | { |
@@ -2255,7 +2331,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec); | |||
2255 | /** | 2331 | /** |
2256 | * snd_soc_unregister_codec - Unregister a codec from the ASoC core | 2332 | * snd_soc_unregister_codec - Unregister a codec from the ASoC core |
2257 | * | 2333 | * |
2258 | * @param codec codec to unregister | 2334 | * @codec: codec to unregister |
2259 | */ | 2335 | */ |
2260 | void snd_soc_unregister_codec(struct snd_soc_codec *codec) | 2336 | void snd_soc_unregister_codec(struct snd_soc_codec *codec) |
2261 | { | 2337 | { |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8863eddbac02..493a4e8aa273 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -53,13 +53,15 @@ | |||
53 | /* dapm power sequences - make this per codec in the future */ | 53 | /* dapm power sequences - make this per codec in the future */ |
54 | static int dapm_up_seq[] = { | 54 | static int dapm_up_seq[] = { |
55 | snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, | 55 | snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, |
56 | snd_soc_dapm_mux, snd_soc_dapm_dac, snd_soc_dapm_mixer, snd_soc_dapm_pga, | 56 | snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_dac, |
57 | snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, snd_soc_dapm_post | 57 | snd_soc_dapm_mixer, snd_soc_dapm_pga, snd_soc_dapm_adc, snd_soc_dapm_hp, |
58 | snd_soc_dapm_spk, snd_soc_dapm_post | ||
58 | }; | 59 | }; |
59 | static int dapm_down_seq[] = { | 60 | static int dapm_down_seq[] = { |
60 | snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, | 61 | snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, |
61 | snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic, | 62 | snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic, |
62 | snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_post | 63 | snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_value_mux, |
64 | snd_soc_dapm_post | ||
63 | }; | 65 | }; |
64 | 66 | ||
65 | static int dapm_status = 1; | 67 | static int dapm_status = 1; |
@@ -134,6 +136,25 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
134 | } | 136 | } |
135 | } | 137 | } |
136 | break; | 138 | break; |
139 | case snd_soc_dapm_value_mux: { | ||
140 | struct soc_enum *e = (struct soc_enum *) | ||
141 | w->kcontrols[i].private_value; | ||
142 | int val, item; | ||
143 | |||
144 | val = snd_soc_read(w->codec, e->reg); | ||
145 | val = (val >> e->shift_l) & e->mask; | ||
146 | for (item = 0; item < e->max; item++) { | ||
147 | if (val == e->values[item]) | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | p->connect = 0; | ||
152 | for (i = 0; i < e->max; i++) { | ||
153 | if (!(strcmp(p->name, e->texts[i])) && item == i) | ||
154 | p->connect = 1; | ||
155 | } | ||
156 | } | ||
157 | break; | ||
137 | /* does not effect routing - always connected */ | 158 | /* does not effect routing - always connected */ |
138 | case snd_soc_dapm_pga: | 159 | case snd_soc_dapm_pga: |
139 | case snd_soc_dapm_output: | 160 | case snd_soc_dapm_output: |
@@ -653,6 +674,7 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action) | |||
653 | case snd_soc_dapm_vmid: | 674 | case snd_soc_dapm_vmid: |
654 | continue; | 675 | continue; |
655 | case snd_soc_dapm_mux: | 676 | case snd_soc_dapm_mux: |
677 | case snd_soc_dapm_value_mux: | ||
656 | case snd_soc_dapm_output: | 678 | case snd_soc_dapm_output: |
657 | case snd_soc_dapm_input: | 679 | case snd_soc_dapm_input: |
658 | case snd_soc_dapm_switch: | 680 | case snd_soc_dapm_switch: |
@@ -960,6 +982,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | |||
960 | path->connect = 1; | 982 | path->connect = 1; |
961 | return 0; | 983 | return 0; |
962 | case snd_soc_dapm_mux: | 984 | case snd_soc_dapm_mux: |
985 | case snd_soc_dapm_value_mux: | ||
963 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, | 986 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, |
964 | &wsink->kcontrols[0]); | 987 | &wsink->kcontrols[0]); |
965 | if (ret != 0) | 988 | if (ret != 0) |
@@ -1047,6 +1070,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) | |||
1047 | dapm_new_mixer(codec, w); | 1070 | dapm_new_mixer(codec, w); |
1048 | break; | 1071 | break; |
1049 | case snd_soc_dapm_mux: | 1072 | case snd_soc_dapm_mux: |
1073 | case snd_soc_dapm_value_mux: | ||
1050 | dapm_new_mux(codec, w); | 1074 | dapm_new_mux(codec, w); |
1051 | break; | 1075 | break; |
1052 | case snd_soc_dapm_adc: | 1076 | case snd_soc_dapm_adc: |
@@ -1077,7 +1101,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); | |||
1077 | /** | 1101 | /** |
1078 | * snd_soc_dapm_get_volsw - dapm mixer get callback | 1102 | * snd_soc_dapm_get_volsw - dapm mixer get callback |
1079 | * @kcontrol: mixer control | 1103 | * @kcontrol: mixer control |
1080 | * @uinfo: control element information | 1104 | * @ucontrol: control element information |
1081 | * | 1105 | * |
1082 | * Callback to get the value of a dapm mixer control. | 1106 | * Callback to get the value of a dapm mixer control. |
1083 | * | 1107 | * |
@@ -1122,7 +1146,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw); | |||
1122 | /** | 1146 | /** |
1123 | * snd_soc_dapm_put_volsw - dapm mixer set callback | 1147 | * snd_soc_dapm_put_volsw - dapm mixer set callback |
1124 | * @kcontrol: mixer control | 1148 | * @kcontrol: mixer control |
1125 | * @uinfo: control element information | 1149 | * @ucontrol: control element information |
1126 | * | 1150 | * |
1127 | * Callback to set the value of a dapm mixer control. | 1151 | * Callback to set the value of a dapm mixer control. |
1128 | * | 1152 | * |
@@ -1193,7 +1217,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); | |||
1193 | /** | 1217 | /** |
1194 | * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback | 1218 | * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback |
1195 | * @kcontrol: mixer control | 1219 | * @kcontrol: mixer control |
1196 | * @uinfo: control element information | 1220 | * @ucontrol: control element information |
1197 | * | 1221 | * |
1198 | * Callback to get the value of a dapm enumerated double mixer control. | 1222 | * Callback to get the value of a dapm enumerated double mixer control. |
1199 | * | 1223 | * |
@@ -1221,7 +1245,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); | |||
1221 | /** | 1245 | /** |
1222 | * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback | 1246 | * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback |
1223 | * @kcontrol: mixer control | 1247 | * @kcontrol: mixer control |
1224 | * @uinfo: control element information | 1248 | * @ucontrol: control element information |
1225 | * | 1249 | * |
1226 | * Callback to set the value of a dapm enumerated double mixer control. | 1250 | * Callback to set the value of a dapm enumerated double mixer control. |
1227 | * | 1251 | * |
@@ -1274,6 +1298,103 @@ out: | |||
1274 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double); | 1298 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double); |
1275 | 1299 | ||
1276 | /** | 1300 | /** |
1301 | * snd_soc_dapm_get_value_enum_double - dapm semi enumerated double mixer get | ||
1302 | * callback | ||
1303 | * @kcontrol: mixer control | ||
1304 | * @ucontrol: control element information | ||
1305 | * | ||
1306 | * Callback to get the value of a dapm semi enumerated double mixer control. | ||
1307 | * | ||
1308 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1309 | * used for handling bitfield coded enumeration for example. | ||
1310 | * | ||
1311 | * Returns 0 for success. | ||
1312 | */ | ||
1313 | int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1314 | struct snd_ctl_elem_value *ucontrol) | ||
1315 | { | ||
1316 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | ||
1317 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1318 | unsigned short reg_val, val, mux; | ||
1319 | |||
1320 | reg_val = snd_soc_read(widget->codec, e->reg); | ||
1321 | val = (reg_val >> e->shift_l) & e->mask; | ||
1322 | for (mux = 0; mux < e->max; mux++) { | ||
1323 | if (val == e->values[mux]) | ||
1324 | break; | ||
1325 | } | ||
1326 | ucontrol->value.enumerated.item[0] = mux; | ||
1327 | if (e->shift_l != e->shift_r) { | ||
1328 | val = (reg_val >> e->shift_r) & e->mask; | ||
1329 | for (mux = 0; mux < e->max; mux++) { | ||
1330 | if (val == e->values[mux]) | ||
1331 | break; | ||
1332 | } | ||
1333 | ucontrol->value.enumerated.item[1] = mux; | ||
1334 | } | ||
1335 | |||
1336 | return 0; | ||
1337 | } | ||
1338 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_value_enum_double); | ||
1339 | |||
1340 | /** | ||
1341 | * snd_soc_dapm_put_value_enum_double - dapm semi enumerated double mixer set | ||
1342 | * callback | ||
1343 | * @kcontrol: mixer control | ||
1344 | * @ucontrol: control element information | ||
1345 | * | ||
1346 | * Callback to set the value of a dapm semi enumerated double mixer control. | ||
1347 | * | ||
1348 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1349 | * used for handling bitfield coded enumeration for example. | ||
1350 | * | ||
1351 | * Returns 0 for success. | ||
1352 | */ | ||
1353 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1354 | struct snd_ctl_elem_value *ucontrol) | ||
1355 | { | ||
1356 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | ||
1357 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1358 | unsigned short val, mux; | ||
1359 | unsigned short mask; | ||
1360 | int ret = 0; | ||
1361 | |||
1362 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | ||
1363 | return -EINVAL; | ||
1364 | mux = ucontrol->value.enumerated.item[0]; | ||
1365 | val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; | ||
1366 | mask = e->mask << e->shift_l; | ||
1367 | if (e->shift_l != e->shift_r) { | ||
1368 | if (ucontrol->value.enumerated.item[1] > e->max - 1) | ||
1369 | return -EINVAL; | ||
1370 | val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; | ||
1371 | mask |= e->mask << e->shift_r; | ||
1372 | } | ||
1373 | |||
1374 | mutex_lock(&widget->codec->mutex); | ||
1375 | widget->value = val; | ||
1376 | dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); | ||
1377 | if (widget->event) { | ||
1378 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | ||
1379 | ret = widget->event(widget, | ||
1380 | kcontrol, SND_SOC_DAPM_PRE_REG); | ||
1381 | if (ret < 0) | ||
1382 | goto out; | ||
1383 | } | ||
1384 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); | ||
1385 | if (widget->event_flags & SND_SOC_DAPM_POST_REG) | ||
1386 | ret = widget->event(widget, | ||
1387 | kcontrol, SND_SOC_DAPM_POST_REG); | ||
1388 | } else | ||
1389 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); | ||
1390 | |||
1391 | out: | ||
1392 | mutex_unlock(&widget->codec->mutex); | ||
1393 | return ret; | ||
1394 | } | ||
1395 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_value_enum_double); | ||
1396 | |||
1397 | /** | ||
1277 | * snd_soc_dapm_new_control - create new dapm control | 1398 | * snd_soc_dapm_new_control - create new dapm control |
1278 | * @codec: audio codec | 1399 | * @codec: audio codec |
1279 | * @widget: widget template | 1400 | * @widget: widget template |
@@ -1419,7 +1540,7 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
1419 | 1540 | ||
1420 | /** | 1541 | /** |
1421 | * snd_soc_dapm_enable_pin - enable pin. | 1542 | * snd_soc_dapm_enable_pin - enable pin. |
1422 | * @snd_soc_codec: SoC codec | 1543 | * @codec: SoC codec |
1423 | * @pin: pin name | 1544 | * @pin: pin name |
1424 | * | 1545 | * |
1425 | * Enables input/output pin and it's parents or children widgets iff there is | 1546 | * Enables input/output pin and it's parents or children widgets iff there is |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index d44bf98e965e..41c387587474 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -2057,7 +2057,7 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_dev | |||
2057 | if (err) | 2057 | if (err) |
2058 | return err; | 2058 | return err; |
2059 | 2059 | ||
2060 | sprintf(card->longname, "%s at 0x%lx, irq %d", | 2060 | sprintf(card->longname, "%s at 0x%llx, irq %d", |
2061 | card->shortname, | 2061 | card->shortname, |
2062 | op->resource[0].start, | 2062 | op->resource[0].start, |
2063 | op->irqs[0]); | 2063 | op->irqs[0]); |
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index b143ef7152f7..a62500e387a6 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c | |||
@@ -446,7 +446,7 @@ static int __devinit snd_probe(struct usb_interface *intf, | |||
446 | if (!card) | 446 | if (!card) |
447 | return -ENOMEM; | 447 | return -ENOMEM; |
448 | 448 | ||
449 | dev_set_drvdata(&intf->dev, card); | 449 | usb_set_intfdata(intf, card); |
450 | ret = init_card(caiaqdev(card)); | 450 | ret = init_card(caiaqdev(card)); |
451 | if (ret < 0) { | 451 | if (ret < 0) { |
452 | log("unable to init card! (ret=%d)\n", ret); | 452 | log("unable to init card! (ret=%d)\n", ret); |
@@ -460,7 +460,7 @@ static int __devinit snd_probe(struct usb_interface *intf, | |||
460 | static void snd_disconnect(struct usb_interface *intf) | 460 | static void snd_disconnect(struct usb_interface *intf) |
461 | { | 461 | { |
462 | struct snd_usb_caiaqdev *dev; | 462 | struct snd_usb_caiaqdev *dev; |
463 | struct snd_card *card = dev_get_drvdata(&intf->dev); | 463 | struct snd_card *card = usb_get_intfdata(intf); |
464 | 464 | ||
465 | debug("%s(%p)\n", __func__, intf); | 465 | debug("%s(%p)\n", __func__, intf); |
466 | 466 | ||
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index bbd70d5814a0..c709b9563226 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -3709,7 +3709,7 @@ static int usb_audio_probe(struct usb_interface *intf, | |||
3709 | void *chip; | 3709 | void *chip; |
3710 | chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); | 3710 | chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); |
3711 | if (chip) { | 3711 | if (chip) { |
3712 | dev_set_drvdata(&intf->dev, chip); | 3712 | usb_set_intfdata(intf, chip); |
3713 | return 0; | 3713 | return 0; |
3714 | } else | 3714 | } else |
3715 | return -EIO; | 3715 | return -EIO; |
@@ -3718,13 +3718,13 @@ static int usb_audio_probe(struct usb_interface *intf, | |||
3718 | static void usb_audio_disconnect(struct usb_interface *intf) | 3718 | static void usb_audio_disconnect(struct usb_interface *intf) |
3719 | { | 3719 | { |
3720 | snd_usb_audio_disconnect(interface_to_usbdev(intf), | 3720 | snd_usb_audio_disconnect(interface_to_usbdev(intf), |
3721 | dev_get_drvdata(&intf->dev)); | 3721 | usb_get_intfdata(intf)); |
3722 | } | 3722 | } |
3723 | 3723 | ||
3724 | #ifdef CONFIG_PM | 3724 | #ifdef CONFIG_PM |
3725 | static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | 3725 | static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) |
3726 | { | 3726 | { |
3727 | struct snd_usb_audio *chip = dev_get_drvdata(&intf->dev); | 3727 | struct snd_usb_audio *chip = usb_get_intfdata(intf); |
3728 | struct list_head *p; | 3728 | struct list_head *p; |
3729 | struct snd_usb_stream *as; | 3729 | struct snd_usb_stream *as; |
3730 | 3730 | ||
@@ -3744,7 +3744,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | |||
3744 | 3744 | ||
3745 | static int usb_audio_resume(struct usb_interface *intf) | 3745 | static int usb_audio_resume(struct usb_interface *intf) |
3746 | { | 3746 | { |
3747 | struct snd_usb_audio *chip = dev_get_drvdata(&intf->dev); | 3747 | struct snd_usb_audio *chip = usb_get_intfdata(intf); |
3748 | 3748 | ||
3749 | if (chip == (void *)-1L) | 3749 | if (chip == (void *)-1L) |
3750 | return 0; | 3750 | return 0; |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 6d9f9b135c62..320641ab5be7 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1392,8 +1392,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1392 | for (i = 0; i < intfd->bNumEndpoints; ++i) { | 1392 | for (i = 0; i < intfd->bNumEndpoints; ++i) { |
1393 | hostep = &hostif->endpoint[i]; | 1393 | hostep = &hostif->endpoint[i]; |
1394 | ep = get_ep_desc(hostep); | 1394 | ep = get_ep_desc(hostep); |
1395 | if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && | 1395 | if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep)) |
1396 | (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
1397 | continue; | 1396 | continue; |
1398 | ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; | 1397 | ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; |
1399 | if (hostep->extralen < 4 || | 1398 | if (hostep->extralen < 4 || |
@@ -1401,15 +1400,15 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1401 | ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || | 1400 | ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || |
1402 | ms_ep->bDescriptorSubtype != MS_GENERAL) | 1401 | ms_ep->bDescriptorSubtype != MS_GENERAL) |
1403 | continue; | 1402 | continue; |
1404 | if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { | 1403 | if (usb_endpoint_dir_out(ep)) { |
1405 | if (endpoints[epidx].out_ep) { | 1404 | if (endpoints[epidx].out_ep) { |
1406 | if (++epidx >= MIDI_MAX_ENDPOINTS) { | 1405 | if (++epidx >= MIDI_MAX_ENDPOINTS) { |
1407 | snd_printk(KERN_WARNING "too many endpoints\n"); | 1406 | snd_printk(KERN_WARNING "too many endpoints\n"); |
1408 | break; | 1407 | break; |
1409 | } | 1408 | } |
1410 | } | 1409 | } |
1411 | endpoints[epidx].out_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1410 | endpoints[epidx].out_ep = usb_endpoint_num(ep); |
1412 | if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1411 | if (usb_endpoint_xfer_int(ep)) |
1413 | endpoints[epidx].out_interval = ep->bInterval; | 1412 | endpoints[epidx].out_interval = ep->bInterval; |
1414 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1413 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) |
1415 | /* | 1414 | /* |
@@ -1428,8 +1427,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1428 | break; | 1427 | break; |
1429 | } | 1428 | } |
1430 | } | 1429 | } |
1431 | endpoints[epidx].in_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1430 | endpoints[epidx].in_ep = usb_endpoint_num(ep); |
1432 | if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1431 | if (usb_endpoint_xfer_int(ep)) |
1433 | endpoints[epidx].in_interval = ep->bInterval; | 1432 | endpoints[epidx].in_interval = ep->bInterval; |
1434 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1433 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) |
1435 | endpoints[epidx].in_interval = 1; | 1434 | endpoints[epidx].in_interval = 1; |
@@ -1495,20 +1494,20 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, | |||
1495 | 1494 | ||
1496 | for (i = 0; i < intfd->bNumEndpoints; ++i) { | 1495 | for (i = 0; i < intfd->bNumEndpoints; ++i) { |
1497 | epd = get_endpoint(hostif, i); | 1496 | epd = get_endpoint(hostif, i); |
1498 | if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && | 1497 | if (!usb_endpoint_xfer_bulk(epd) && |
1499 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | 1498 | !usb_endpoint_xfer_int(epd)) |
1500 | continue; | 1499 | continue; |
1501 | if (out_eps < max_endpoints && | 1500 | if (out_eps < max_endpoints && |
1502 | (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { | 1501 | usb_endpoint_dir_out(epd)) { |
1503 | endpoint[out_eps].out_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1502 | endpoint[out_eps].out_ep = usb_endpoint_num(epd); |
1504 | if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1503 | if (usb_endpoint_xfer_int(epd)) |
1505 | endpoint[out_eps].out_interval = epd->bInterval; | 1504 | endpoint[out_eps].out_interval = epd->bInterval; |
1506 | ++out_eps; | 1505 | ++out_eps; |
1507 | } | 1506 | } |
1508 | if (in_eps < max_endpoints && | 1507 | if (in_eps < max_endpoints && |
1509 | (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) { | 1508 | usb_endpoint_dir_in(epd)) { |
1510 | endpoint[in_eps].in_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1509 | endpoint[in_eps].in_ep = usb_endpoint_num(epd); |
1511 | if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1510 | if (usb_endpoint_xfer_int(epd)) |
1512 | endpoint[in_eps].in_interval = epd->bInterval; | 1511 | endpoint[in_eps].in_interval = epd->bInterval; |
1513 | ++in_eps; | 1512 | ++in_eps; |
1514 | } | 1513 | } |
@@ -1607,21 +1606,19 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1607 | } | 1606 | } |
1608 | 1607 | ||
1609 | epd = get_endpoint(hostif, 0); | 1608 | epd = get_endpoint(hostif, 0); |
1610 | if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || | 1609 | if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) { |
1611 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) { | ||
1612 | snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); | 1610 | snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); |
1613 | return -ENXIO; | 1611 | return -ENXIO; |
1614 | } | 1612 | } |
1615 | epd = get_endpoint(hostif, 2); | 1613 | epd = get_endpoint(hostif, 2); |
1616 | if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || | 1614 | if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) { |
1617 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { | ||
1618 | snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); | 1615 | snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); |
1619 | return -ENXIO; | 1616 | return -ENXIO; |
1620 | } | 1617 | } |
1621 | if (endpoint->out_cables > 0x0001) { | 1618 | if (endpoint->out_cables > 0x0001) { |
1622 | epd = get_endpoint(hostif, 4); | 1619 | epd = get_endpoint(hostif, 4); |
1623 | if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || | 1620 | if (!usb_endpoint_dir_out(epd) || |
1624 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { | 1621 | !usb_endpoint_xfer_bulk(epd)) { |
1625 | snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); | 1622 | snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); |
1626 | return -ENXIO; | 1623 | return -ENXIO; |
1627 | } | 1624 | } |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index a49246113e75..00397c8a765b 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -1755,11 +1755,10 @@ static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer) | |||
1755 | if (get_iface_desc(hostif)->bNumEndpoints < 1) | 1755 | if (get_iface_desc(hostif)->bNumEndpoints < 1) |
1756 | return 0; | 1756 | return 0; |
1757 | ep = get_endpoint(hostif, 0); | 1757 | ep = get_endpoint(hostif, 0); |
1758 | if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || | 1758 | if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep)) |
1759 | (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
1760 | return 0; | 1759 | return 0; |
1761 | 1760 | ||
1762 | epnum = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1761 | epnum = usb_endpoint_num(ep); |
1763 | buffer_length = le16_to_cpu(ep->wMaxPacketSize); | 1762 | buffer_length = le16_to_cpu(ep->wMaxPacketSize); |
1764 | transfer_buffer = kmalloc(buffer_length, GFP_KERNEL); | 1763 | transfer_buffer = kmalloc(buffer_length, GFP_KERNEL); |
1765 | if (!transfer_buffer) | 1764 | if (!transfer_buffer) |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index c2515b680f9f..73e59f4403a4 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -589,7 +589,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message) | |||
589 | struct us122l *us122l; | 589 | struct us122l *us122l; |
590 | struct list_head *p; | 590 | struct list_head *p; |
591 | 591 | ||
592 | card = dev_get_drvdata(&intf->dev); | 592 | card = usb_get_intfdata(intf); |
593 | if (!card) | 593 | if (!card) |
594 | return 0; | 594 | return 0; |
595 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 595 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
@@ -615,7 +615,7 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
615 | struct list_head *p; | 615 | struct list_head *p; |
616 | int err; | 616 | int err; |
617 | 617 | ||
618 | card = dev_get_drvdata(&intf->dev); | 618 | card = usb_get_intfdata(intf); |
619 | if (!card) | 619 | if (!card) |
620 | return 0; | 620 | return 0; |
621 | 621 | ||
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index e5981a630314..11639bd72a51 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -238,7 +238,7 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
238 | send = 0; | 238 | send = 0; |
239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) | 239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) |
240 | if (0 == usX2Y->AS04.urb[j]->status) { | 240 | if (0 == usX2Y->AS04.urb[j]->status) { |
241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. | 241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. |
242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, | 242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, |
243 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, | 243 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, |
244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, | 244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, |
@@ -392,7 +392,7 @@ static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_i | |||
392 | void *chip; | 392 | void *chip; |
393 | chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); | 393 | chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); |
394 | if (chip) { | 394 | if (chip) { |
395 | dev_set_drvdata(&intf->dev, chip); | 395 | usb_set_intfdata(intf, chip); |
396 | return 0; | 396 | return 0; |
397 | } else | 397 | } else |
398 | return -EIO; | 398 | return -EIO; |
@@ -401,7 +401,7 @@ static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_i | |||
401 | static void snd_usX2Y_disconnect(struct usb_interface *intf) | 401 | static void snd_usX2Y_disconnect(struct usb_interface *intf) |
402 | { | 402 | { |
403 | usX2Y_usb_disconnect(interface_to_usbdev(intf), | 403 | usX2Y_usb_disconnect(interface_to_usbdev(intf), |
404 | dev_get_drvdata(&intf->dev)); | 404 | usb_get_intfdata(intf)); |
405 | } | 405 | } |
406 | 406 | ||
407 | MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table); | 407 | MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table); |