diff options
Diffstat (limited to 'sound')
267 files changed, 2391 insertions, 1590 deletions
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index 84bb07d39a7f..91852e49910e 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c | |||
@@ -33,6 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/slab.h> | ||
36 | MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); | 37 | MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); |
37 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
38 | MODULE_DESCRIPTION("pcm3052 (onyx) codec driver for snd-aoa"); | 39 | MODULE_DESCRIPTION("pcm3052 (onyx) codec driver for snd-aoa"); |
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index 1dd66ddffcaf..fd2188c3df2b 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/delay.h> | 66 | #include <linux/delay.h> |
67 | #include <linux/module.h> | 67 | #include <linux/module.h> |
68 | #include <linux/mutex.h> | 68 | #include <linux/mutex.h> |
69 | #include <linux/slab.h> | ||
69 | 70 | ||
70 | MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); | 71 | MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); |
71 | MODULE_LICENSE("GPL"); | 72 | MODULE_LICENSE("GPL"); |
diff --git a/sound/aoa/codecs/toonie.c b/sound/aoa/codecs/toonie.c index f13827e17562..69d2cb601f2a 100644 --- a/sound/aoa/codecs/toonie.c +++ b/sound/aoa/codecs/toonie.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/slab.h> | ||
14 | MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); | 15 | MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); |
15 | MODULE_LICENSE("GPL"); | 16 | MODULE_LICENSE("GPL"); |
16 | MODULE_DESCRIPTION("toonie codec driver for snd-aoa"); | 17 | MODULE_DESCRIPTION("toonie codec driver for snd-aoa"); |
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c index 1dd0c28d1fb7..6776d1c12b63 100644 --- a/sound/aoa/core/gpio-pmf.c +++ b/sound/aoa/core/gpio-pmf.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * GPL v2, can be found in COPYING. | 6 | * GPL v2, can be found in COPYING. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/slab.h> | ||
9 | #include <asm/pmac_feature.h> | 10 | #include <asm/pmac_feature.h> |
10 | #include <asm/pmac_pfunc.h> | 11 | #include <asm/pmac_pfunc.h> |
11 | #include "../aoa.h" | 12 | #include "../aoa.h" |
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index 7a437da05646..1cd9b301df03 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/prom.h> | 12 | #include <asm/prom.h> |
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | ||
15 | #include "../aoa.h" | 16 | #include "../aoa.h" |
16 | #include "../soundbus/soundbus.h" | 17 | #include "../soundbus/soundbus.h" |
17 | 18 | ||
diff --git a/sound/aoa/soundbus/i2sbus/control.c b/sound/aoa/soundbus/i2sbus/control.c index 87beb4ad4d63..47f854c2001f 100644 --- a/sound/aoa/soundbus/i2sbus/control.c +++ b/sound/aoa/soundbus/i2sbus/control.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
11 | #include <linux/slab.h> | ||
11 | 12 | ||
12 | #include <asm/io.h> | 13 | #include <asm/io.h> |
13 | #include <asm/prom.h> | 14 | #include <asm/prom.h> |
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index 4e3b819d4993..9d6f3b176ed1 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/slab.h> | ||
10 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
11 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
12 | #include <linux/dma-mapping.h> | 13 | #include <linux/dma-mapping.h> |
diff --git a/sound/aoa/soundbus/i2sbus/pcm.c b/sound/aoa/soundbus/i2sbus/pcm.c index 59bacd365733..be838993926d 100644 --- a/sound/aoa/soundbus/i2sbus/pcm.c +++ b/sound/aoa/soundbus/i2sbus/pcm.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <asm/io.h> | 9 | #include <asm/io.h> |
10 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
11 | #include <linux/slab.h> | ||
11 | #include <sound/core.h> | 12 | #include <sound/core.h> |
12 | #include <asm/macio.h> | 13 | #include <asm/macio.h> |
13 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 656e474dca47..91acc9a243ec 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -863,7 +863,6 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
863 | struct snd_ac97 *ac97; | 863 | struct snd_ac97 *ac97; |
864 | int ret; | 864 | int ret; |
865 | 865 | ||
866 | writel(0, aaci->base + AC97_POWERDOWN); | ||
867 | /* | 866 | /* |
868 | * Assert AACIRESET for 2us | 867 | * Assert AACIRESET for 2us |
869 | */ | 868 | */ |
@@ -1047,7 +1046,11 @@ static int __devinit aaci_probe(struct amba_device *dev, struct amba_id *id) | |||
1047 | 1046 | ||
1048 | writel(0x1fff, aaci->base + AACI_INTCLR); | 1047 | writel(0x1fff, aaci->base + AACI_INTCLR); |
1049 | writel(aaci->maincr, aaci->base + AACI_MAINCR); | 1048 | writel(aaci->maincr, aaci->base + AACI_MAINCR); |
1050 | 1049 | /* | |
1050 | * Fix: ac97 read back fail errors by reading | ||
1051 | * from any arbitrary aaci register. | ||
1052 | */ | ||
1053 | readl(aaci->base + AACI_CSCH1); | ||
1051 | ret = aaci_probe_ac97(aaci); | 1054 | ret = aaci_probe_ac97(aaci); |
1052 | if (ret) | 1055 | if (ret) |
1053 | goto out; | 1056 | goto out; |
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 6fdca97186e7..88eec3847df2 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
24 | #include <mach/regs-ac97.h> | 24 | #include <mach/regs-ac97.h> |
25 | #include <mach/pxa2xx-gpio.h> | ||
26 | #include <mach/audio.h> | 25 | #include <mach/audio.h> |
27 | 26 | ||
28 | static DEFINE_MUTEX(car_mutex); | 27 | static DEFINE_MUTEX(car_mutex); |
@@ -32,6 +31,8 @@ static struct clk *ac97_clk; | |||
32 | static struct clk *ac97conf_clk; | 31 | static struct clk *ac97conf_clk; |
33 | static int reset_gpio; | 32 | static int reset_gpio; |
34 | 33 | ||
34 | extern void pxa27x_assert_ac97reset(int reset_gpio, int on); | ||
35 | |||
35 | /* | 36 | /* |
36 | * Beware PXA27x bugs: | 37 | * Beware PXA27x bugs: |
37 | * | 38 | * |
@@ -42,45 +43,6 @@ static int reset_gpio; | |||
42 | * 1 jiffy timeout if interrupt never comes). | 43 | * 1 jiffy timeout if interrupt never comes). |
43 | */ | 44 | */ |
44 | 45 | ||
45 | enum { | ||
46 | RESETGPIO_FORCE_HIGH, | ||
47 | RESETGPIO_FORCE_LOW, | ||
48 | RESETGPIO_NORMAL_ALTFUNC | ||
49 | }; | ||
50 | |||
51 | /** | ||
52 | * set_resetgpio_mode - computes and sets the AC97_RESET gpio mode on PXA | ||
53 | * @mode: chosen action | ||
54 | * | ||
55 | * As the PXA27x CPUs suffer from a AC97 bug, a manual control of the reset line | ||
56 | * must be done to insure proper work of AC97 reset line. This function | ||
57 | * computes the correct gpio_mode for further use by reset functions, and | ||
58 | * applied the change through pxa_gpio_mode. | ||
59 | */ | ||
60 | static void set_resetgpio_mode(int resetgpio_action) | ||
61 | { | ||
62 | int mode = 0; | ||
63 | |||
64 | if (reset_gpio) | ||
65 | switch (resetgpio_action) { | ||
66 | case RESETGPIO_NORMAL_ALTFUNC: | ||
67 | if (reset_gpio == 113) | ||
68 | mode = 113 | GPIO_ALT_FN_2_OUT; | ||
69 | if (reset_gpio == 95) | ||
70 | mode = 95 | GPIO_ALT_FN_1_OUT; | ||
71 | break; | ||
72 | case RESETGPIO_FORCE_LOW: | ||
73 | mode = reset_gpio | GPIO_OUT | GPIO_DFLT_LOW; | ||
74 | break; | ||
75 | case RESETGPIO_FORCE_HIGH: | ||
76 | mode = reset_gpio | GPIO_OUT | GPIO_DFLT_HIGH; | ||
77 | break; | ||
78 | }; | ||
79 | |||
80 | if (mode) | ||
81 | pxa_gpio_mode(mode); | ||
82 | } | ||
83 | |||
84 | unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | 46 | unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) |
85 | { | 47 | { |
86 | unsigned short val = -1; | 48 | unsigned short val = -1; |
@@ -174,12 +136,11 @@ static inline void pxa_ac97_warm_pxa27x(void) | |||
174 | { | 136 | { |
175 | gsr_bits = 0; | 137 | gsr_bits = 0; |
176 | 138 | ||
177 | /* warm reset broken on Bulverde, | 139 | /* warm reset broken on Bulverde, so manually keep AC97 reset high */ |
178 | so manually keep AC97 reset high */ | 140 | pxa27x_assert_ac97reset(reset_gpio, 1); |
179 | set_resetgpio_mode(RESETGPIO_FORCE_HIGH); | ||
180 | udelay(10); | 141 | udelay(10); |
181 | GCR |= GCR_WARM_RST; | 142 | GCR |= GCR_WARM_RST; |
182 | set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); | 143 | pxa27x_assert_ac97reset(reset_gpio, 0); |
183 | udelay(500); | 144 | udelay(500); |
184 | } | 145 | } |
185 | 146 | ||
@@ -345,16 +306,6 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_suspend); | |||
345 | 306 | ||
346 | int pxa2xx_ac97_hw_resume(void) | 307 | int pxa2xx_ac97_hw_resume(void) |
347 | { | 308 | { |
348 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) { | ||
349 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); | ||
350 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); | ||
351 | pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); | ||
352 | pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD); | ||
353 | } | ||
354 | if (cpu_is_pxa27x()) { | ||
355 | /* Use GPIO 113 or 95 as AC97 Reset on Bulverde */ | ||
356 | set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); | ||
357 | } | ||
358 | clk_enable(ac97_clk); | 309 | clk_enable(ac97_clk); |
359 | return 0; | 310 | return 0; |
360 | } | 311 | } |
@@ -386,16 +337,9 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
386 | reset_gpio = 113; | 337 | reset_gpio = 113; |
387 | } | 338 | } |
388 | 339 | ||
389 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) { | ||
390 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); | ||
391 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); | ||
392 | pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); | ||
393 | pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD); | ||
394 | } | ||
395 | |||
396 | if (cpu_is_pxa27x()) { | 340 | if (cpu_is_pxa27x()) { |
397 | /* Use GPIO 113 as AC97 Reset on Bulverde */ | 341 | /* Use GPIO 113 as AC97 Reset on Bulverde */ |
398 | set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); | 342 | pxa27x_assert_ac97reset(reset_gpio, 0); |
399 | ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); | 343 | ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); |
400 | if (IS_ERR(ac97conf_clk)) { | 344 | if (IS_ERR(ac97conf_clk)) { |
401 | ret = PTR_ERR(ac97conf_clk); | 345 | ret = PTR_ERR(ac97conf_clk); |
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index 743ac6a29065..8808b82311b1 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * published by the Free Software Foundation. | 4 | * published by the Free Software Foundation. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/slab.h> | ||
7 | #include <linux/module.h> | 8 | #include <linux/module.h> |
8 | #include <linux/dma-mapping.h> | 9 | #include <linux/dma-mapping.h> |
9 | 10 | ||
@@ -205,6 +206,7 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream) | |||
205 | if (!rtd->dma_desc_array) | 206 | if (!rtd->dma_desc_array) |
206 | goto err1; | 207 | goto err1; |
207 | 208 | ||
209 | rtd->dma_ch = -1; | ||
208 | runtime->private_data = rtd; | 210 | runtime->private_data = rtd; |
209 | return 0; | 211 | return 0; |
210 | 212 | ||
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 368dc9c4aef8..426874429a5e 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c | |||
@@ -21,6 +21,7 @@ | |||
21 | /* this file included from control.c */ | 21 | /* this file included from control.c */ |
22 | 22 | ||
23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
24 | #include <linux/slab.h> | ||
24 | 25 | ||
25 | struct snd_ctl_elem_list32 { | 26 | struct snd_ctl_elem_list32 { |
26 | u32 offset; | 27 | u32 offset; |
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c index 7f4d744ae40a..7730575bfadd 100644 --- a/sound/core/hrtimer.c +++ b/sound/core/hrtimer.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
24 | #include <linux/hrtimer.h> | 25 | #include <linux/hrtimer.h> |
diff --git a/sound/core/info.c b/sound/core/info.c index d749a0d394a7..cc4a53d4b7f8 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/smp_lock.h> | 26 | #include <linux/smp_lock.h> |
26 | #include <linux/string.h> | 27 | #include <linux/string.h> |
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
diff --git a/sound/core/jack.c b/sound/core/jack.c index f705eec7372a..14b8a4ee690d 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/input.h> | 22 | #include <linux/input.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/jack.h> | 24 | #include <sound/jack.h> |
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | 26 | ||
diff --git a/sound/core/misc.c b/sound/core/misc.c index 3da4f92427d8..2c41825c836e 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | 27 | ||
diff --git a/sound/core/oss/route.c b/sound/core/oss/route.c index 0dcc2870d537..bbe25d8c450a 100644 --- a/sound/core/oss/route.c +++ b/sound/core/oss/route.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/time.h> | 22 | #include <linux/time.h> |
24 | #include <sound/core.h> | 23 | #include <sound/core.h> |
25 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 08bfed594a83..5fb2e28e796f 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
@@ -21,6 +21,7 @@ | |||
21 | /* This file included from pcm_native.c */ | 21 | /* This file included from pcm_native.c */ |
22 | 22 | ||
23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
24 | #include <linux/slab.h> | ||
24 | 25 | ||
25 | static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream, | 26 | static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream, |
26 | s32 __user *src) | 27 | s32 __user *src) |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index b546ac2660f9..a2ff86189d2a 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -148,6 +148,9 @@ static void pcm_debug_name(struct snd_pcm_substream *substream, | |||
148 | 148 | ||
149 | #define xrun_debug(substream, mask) \ | 149 | #define xrun_debug(substream, mask) \ |
150 | ((substream)->pstr->xrun_debug & (mask)) | 150 | ((substream)->pstr->xrun_debug & (mask)) |
151 | #else | ||
152 | #define xrun_debug(substream, mask) 0 | ||
153 | #endif | ||
151 | 154 | ||
152 | #define dump_stack_on_xrun(substream) do { \ | 155 | #define dump_stack_on_xrun(substream) do { \ |
153 | if (xrun_debug(substream, XRUN_DEBUG_STACK)) \ | 156 | if (xrun_debug(substream, XRUN_DEBUG_STACK)) \ |
@@ -169,6 +172,7 @@ static void xrun(struct snd_pcm_substream *substream) | |||
169 | } | 172 | } |
170 | } | 173 | } |
171 | 174 | ||
175 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | ||
172 | #define hw_ptr_error(substream, fmt, args...) \ | 176 | #define hw_ptr_error(substream, fmt, args...) \ |
173 | do { \ | 177 | do { \ |
174 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ | 178 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ |
@@ -255,8 +259,6 @@ static void xrun_log_show(struct snd_pcm_substream *substream) | |||
255 | 259 | ||
256 | #else /* ! CONFIG_SND_PCM_XRUN_DEBUG */ | 260 | #else /* ! CONFIG_SND_PCM_XRUN_DEBUG */ |
257 | 261 | ||
258 | #define xrun_debug(substream, mask) 0 | ||
259 | #define xrun(substream) do { } while (0) | ||
260 | #define hw_ptr_error(substream, fmt, args...) do { } while (0) | 262 | #define hw_ptr_error(substream, fmt, args...) do { } while (0) |
261 | #define xrun_log(substream, pos) do { } while (0) | 263 | #define xrun_log(substream, pos) do { } while (0) |
262 | #define xrun_log_show(substream) do { } while (0) | 264 | #define xrun_log_show(substream) do { } while (0) |
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index d6d49d6651f9..917e4055ee30 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
26 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index d0d721c22eac..685712276ac9 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "seq_oss_event.h" | 29 | #include "seq_oss_event.h" |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
32 | #include <linux/slab.h> | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * common variables | 35 | * common variables |
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 9dfb2f77be60..677dc84590c7 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <sound/seq_midi_event.h> | 28 | #include <sound/seq_midi_event.h> |
29 | #include "../seq_lock.h" | 29 | #include "../seq_lock.h" |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/slab.h> | ||
31 | 32 | ||
32 | 33 | ||
33 | /* | 34 | /* |
diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index f5de79f29f1e..73661c4ab82a 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <sound/seq_oss_legacy.h> | 25 | #include <sound/seq_oss_legacy.h> |
26 | #include "../seq_lock.h" | 26 | #include "../seq_lock.h" |
27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
28 | #include <linux/slab.h> | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * constants | 31 | * constants |
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index 945a27c34a9d..ee44ab9593c0 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "seq_oss_midi.h" | 24 | #include "seq_oss_midi.h" |
25 | #include "../seq_lock.h" | 25 | #include "../seq_lock.h" |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/slab.h> | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * constants | 30 | * constants |
diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c index c440fdacec93..ab59cbfbcaf2 100644 --- a/sound/core/seq/oss/seq_oss_timer.c +++ b/sound/core/seq/oss/seq_oss_timer.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "seq_oss_timer.h" | 23 | #include "seq_oss_timer.h" |
24 | #include "seq_oss_event.h" | 24 | #include "seq_oss_event.h" |
25 | #include <sound/seq_oss_legacy.h> | 25 | #include <sound/seq_oss_legacy.h> |
26 | #include <linux/slab.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | */ | 29 | */ |
diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c index 217424858191..d50338bbc21f 100644 --- a/sound/core/seq/oss/seq_oss_writeq.c +++ b/sound/core/seq/oss/seq_oss_writeq.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "../seq_lock.h" | 27 | #include "../seq_lock.h" |
28 | #include "../seq_clientmgr.h" | 28 | #include "../seq_clientmgr.h" |
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | 32 | ||
32 | /* | 33 | /* |
diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c index c956fe462569..81f7c109dc46 100644 --- a/sound/core/seq/seq_compat.c +++ b/sound/core/seq/seq_compat.c | |||
@@ -21,6 +21,7 @@ | |||
21 | /* This file included from seq.c */ | 21 | /* This file included from seq.c */ |
22 | 22 | ||
23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
24 | #include <linux/slab.h> | ||
24 | 25 | ||
25 | struct snd_seq_port_info32 { | 26 | struct snd_seq_port_info32 { |
26 | struct snd_seq_addr addr; /* client/port numbers */ | 27 | struct snd_seq_addr addr; /* client/port numbers */ |
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index 77884e62b648..c38b90cf3cb0 100644 --- a/sound/core/seq/seq_system.c +++ b/sound/core/seq/seq_system.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include "seq_system.h" | 25 | #include "seq_system.h" |
25 | #include "seq_timer.h" | 26 | #include "seq_timer.h" |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 8f8b17ac074d..73943651caed 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -393,7 +393,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) | |||
393 | event == SNDRV_TIMER_EVENT_CONTINUE) | 393 | event == SNDRV_TIMER_EVENT_CONTINUE) |
394 | resolution = snd_timer_resolution(ti); | 394 | resolution = snd_timer_resolution(ti); |
395 | if (ti->ccallback) | 395 | if (ti->ccallback) |
396 | ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); | 396 | ti->ccallback(ti, event, &tstamp, resolution); |
397 | if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) | 397 | if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) |
398 | return; | 398 | return; |
399 | timer = ti->timer; | 399 | timer = ti->timer; |
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 1950ffce2b54..a1282c1c0591 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | 40 | ||
41 | #include <linux/ioport.h> | 41 | #include <linux/ioport.h> |
42 | #include <linux/slab.h> | ||
42 | #include <linux/io.h> | 43 | #include <linux/io.h> |
43 | #include <linux/interrupt.h> | 44 | #include <linux/interrupt.h> |
44 | 45 | ||
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 2f8f295d6b0c..da03597fc893 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -54,7 +54,6 @@ | |||
54 | #include <linux/interrupt.h> | 54 | #include <linux/interrupt.h> |
55 | #include <linux/err.h> | 55 | #include <linux/err.h> |
56 | #include <linux/platform_device.h> | 56 | #include <linux/platform_device.h> |
57 | #include <linux/slab.h> | ||
58 | #include <linux/ioport.h> | 57 | #include <linux/ioport.h> |
59 | #include <linux/moduleparam.h> | 58 | #include <linux/moduleparam.h> |
60 | #include <sound/core.h> | 59 | #include <sound/core.h> |
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index 9284829bf927..8539ab0a0893 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/parport.h> | 23 | #include <linux/parport.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/slab.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/initval.h> | 28 | #include <sound/initval.h> |
28 | #include <sound/rawmidi.h> | 29 | #include <sound/rawmidi.h> |
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index a54b1dc5cc78..ade3ca52422e 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c | |||
@@ -19,7 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "opl3_voice.h" | 21 | #include "opl3_voice.h" |
22 | #include <linux/slab.h> | ||
23 | 22 | ||
24 | static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure); | 23 | static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure); |
25 | static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg); | 24 | static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg); |
diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index 6d57b6441dec..301acb6b9cf9 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include <sound/opl3.h> | 23 | #include <sound/opl3.h> |
23 | #include <sound/asound_fm.h> | 24 | #include <sound/asound_fm.h> |
24 | 25 | ||
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c index 01997f24c895..f07e38da59b8 100644 --- a/sound/drivers/opl4/opl4_lib.c +++ b/sound/drivers/opl4/opl4_lib.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "opl4_local.h" | 20 | #include "opl4_local.h" |
21 | #include <sound/initval.h> | 21 | #include <sound/initval.h> |
22 | #include <linux/ioport.h> | 22 | #include <linux/ioport.h> |
23 | #include <linux/slab.h> | ||
23 | #include <linux/init.h> | 24 | #include <linux/init.h> |
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | 26 | ||
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c index f6a2e72b8cde..ce9e7d170c0d 100644 --- a/sound/drivers/pcsp/pcsp_lib.c +++ b/sound/drivers/pcsp/pcsp_lib.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/gfp.h> | ||
10 | #include <linux/moduleparam.h> | 11 | #include <linux/moduleparam.h> |
11 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
12 | #include <sound/pcm.h> | 13 | #include <sound/pcm.h> |
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index 60158e2e0eaf..f2b0ba22d9ce 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/parport.h> | 42 | #include <linux/parport.h> |
43 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
44 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
45 | #include <linux/slab.h> | ||
45 | #include <sound/core.h> | 46 | #include <sound/core.h> |
46 | #include <sound/initval.h> | 47 | #include <sound/initval.h> |
47 | #include <sound/rawmidi.h> | 48 | #include <sound/rawmidi.h> |
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index 46df8817c18f..f7a6fbd313e3 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/firmware.h> | 24 | #include <linux/firmware.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/hwdep.h> | 28 | #include <sound/hwdep.h> |
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c index fff62cc8607c..971a84a4fa77 100644 --- a/sound/i2c/other/ak4113.c +++ b/sound/i2c/other/ak4113.c | |||
@@ -70,7 +70,7 @@ static int snd_ak4113_dev_free(struct snd_device *device) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, | 72 | int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, |
73 | ak4113_write_t *write, const unsigned char pgm[5], | 73 | ak4113_write_t *write, const unsigned char *pgm, |
74 | void *private_data, struct ak4113 **r_ak4113) | 74 | void *private_data, struct ak4113 **r_ak4113) |
75 | { | 75 | { |
76 | struct ak4113 *chip; | 76 | struct ak4113 *chip; |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index c4c6ef73f9bf..ee538f1ae846 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/version.h> | 28 | #include <linux/version.h> |
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include <sound/tea575x-tuner.h> | 30 | #include <sound/tea575x-tuner.h> |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 8246aae32ab4..fe79a169acb5 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/init.h> | 46 | #include <linux/init.h> |
47 | #include <linux/err.h> | 47 | #include <linux/err.h> |
48 | #include <linux/isa.h> | 48 | #include <linux/isa.h> |
49 | #include <linux/slab.h> | ||
50 | #include <linux/pnp.h> | 49 | #include <linux/pnp.h> |
51 | #include <linux/moduleparam.h> | 50 | #include <linux/moduleparam.h> |
52 | #include <sound/core.h> | 51 | #include <sound/core.h> |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index cc15d1d65a22..999dc1e0fdbd 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/err.h> | 23 | #include <linux/err.h> |
24 | #include <linux/isa.h> | 24 | #include <linux/isa.h> |
25 | #include <linux/slab.h> | ||
26 | #include <linux/pnp.h> | 25 | #include <linux/pnp.h> |
27 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
28 | #include <sound/core.h> | 27 | #include <sound/core.h> |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 9a43baae7250..fb4d6b34bbca 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -80,7 +80,6 @@ | |||
80 | #include <linux/init.h> | 80 | #include <linux/init.h> |
81 | #include <linux/err.h> | 81 | #include <linux/err.h> |
82 | #include <linux/isa.h> | 82 | #include <linux/isa.h> |
83 | #include <linux/slab.h> | ||
84 | #include <linux/pnp.h> | 83 | #include <linux/pnp.h> |
85 | #include <linux/isapnp.h> | 84 | #include <linux/isapnp.h> |
86 | #include <linux/moduleparam.h> | 85 | #include <linux/moduleparam.h> |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 534a6eced2b8..c7b80e4730fc 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/isa.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/slab.h> | ||
30 | #include <linux/pnp.h> | 29 | #include <linux/pnp.h> |
31 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
32 | #include <asm/dma.h> | 31 | #include <asm/dma.h> |
diff --git a/sound/isa/msnd/msnd_midi.c b/sound/isa/msnd/msnd_midi.c index 4be562b2cf21..787495674235 100644 --- a/sound/isa/msnd/msnd_midi.c +++ b/sound/isa/msnd/msnd_midi.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/slab.h> | ||
28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
29 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
30 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 0481a55334b9..265abcce9dba 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/isa.h> | 24 | #include <linux/isa.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/pnp.h> | 27 | #include <linux/pnp.h> |
29 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
30 | #include <sound/core.h> | 29 | #include <sound/core.h> |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index b865e45a8f9b..8c24102d0d93 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/isa.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/pnp.h> | 28 | #include <linux/pnp.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/slab.h> | ||
31 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
32 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
33 | #include <asm/io.h> | 32 | #include <asm/io.h> |
@@ -1558,7 +1557,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip, | |||
1558 | 1557 | ||
1559 | err = pnp_activate_dev(devmc); | 1558 | err = pnp_activate_dev(devmc); |
1560 | if (err < 0) { | 1559 | if (err < 0) { |
1561 | snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", | 1560 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", |
1562 | err); | 1561 | err); |
1563 | return err; | 1562 | return err; |
1564 | } | 1563 | } |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index a4af53b5c1cf..c35dc68930dc 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/isa.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/slab.h> | ||
31 | #include <linux/pnp.h> | 30 | #include <linux/pnp.h> |
32 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
33 | #include <asm/io.h> | 32 | #include <asm/io.h> |
@@ -144,12 +143,8 @@ struct snd_opti9xx { | |||
144 | 143 | ||
145 | spinlock_t lock; | 144 | spinlock_t lock; |
146 | 145 | ||
146 | long wss_base; | ||
147 | int irq; | 147 | int irq; |
148 | |||
149 | #ifdef CONFIG_PNP | ||
150 | struct pnp_dev *dev; | ||
151 | struct pnp_dev *devmpu; | ||
152 | #endif /* CONFIG_PNP */ | ||
153 | }; | 148 | }; |
154 | 149 | ||
155 | static int snd_opti9xx_pnp_is_probed; | 150 | static int snd_opti9xx_pnp_is_probed; |
@@ -159,12 +154,17 @@ static int snd_opti9xx_pnp_is_probed; | |||
159 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { | 154 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { |
160 | #ifndef OPTi93X | 155 | #ifndef OPTi93X |
161 | /* OPTi 82C924 */ | 156 | /* OPTi 82C924 */ |
162 | { .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, | 157 | { .id = "OPT0924", |
158 | .devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } }, | ||
159 | .driver_data = 0x0924 }, | ||
163 | /* OPTi 82C925 */ | 160 | /* OPTi 82C925 */ |
164 | { .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, | 161 | { .id = "OPT0925", |
162 | .devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } }, | ||
163 | .driver_data = 0x0925 }, | ||
165 | #else | 164 | #else |
166 | /* OPTi 82C931/3 */ | 165 | /* OPTi 82C931/3 */ |
167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, | 166 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, |
167 | .driver_data = 0x0931 }, | ||
168 | #endif /* OPTi93X */ | 168 | #endif /* OPTi93X */ |
169 | { .id = "" } | 169 | { .id = "" } |
170 | }; | 170 | }; |
@@ -207,24 +207,35 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, | |||
207 | chip->hardware = hardware; | 207 | chip->hardware = hardware; |
208 | strcpy(chip->name, snd_opti9xx_names[hardware]); | 208 | strcpy(chip->name, snd_opti9xx_names[hardware]); |
209 | 209 | ||
210 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
211 | |||
212 | spin_lock_init(&chip->lock); | 210 | spin_lock_init(&chip->lock); |
213 | 211 | ||
214 | chip->irq = -1; | 212 | chip->irq = -1; |
215 | 213 | ||
214 | #ifndef OPTi93X | ||
215 | #ifdef CONFIG_PNP | ||
216 | if (isapnp && chip->mc_base) | ||
217 | /* PnP resource gives the least 10 bits */ | ||
218 | chip->mc_base |= 0xc00; | ||
219 | else | ||
220 | #endif /* CONFIG_PNP */ | ||
221 | { | ||
222 | chip->mc_base = 0xf8c; | ||
223 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
224 | } | ||
225 | #else | ||
226 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
227 | #endif | ||
228 | |||
216 | switch (hardware) { | 229 | switch (hardware) { |
217 | #ifndef OPTi93X | 230 | #ifndef OPTi93X |
218 | case OPTi9XX_HW_82C928: | 231 | case OPTi9XX_HW_82C928: |
219 | case OPTi9XX_HW_82C929: | 232 | case OPTi9XX_HW_82C929: |
220 | chip->mc_base = 0xf8c; | ||
221 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; | 233 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; |
222 | chip->pwd_reg = 3; | 234 | chip->pwd_reg = 3; |
223 | break; | 235 | break; |
224 | 236 | ||
225 | case OPTi9XX_HW_82C924: | 237 | case OPTi9XX_HW_82C924: |
226 | case OPTi9XX_HW_82C925: | 238 | case OPTi9XX_HW_82C925: |
227 | chip->mc_base = 0xf8c; | ||
228 | chip->password = 0xe5; | 239 | chip->password = 0xe5; |
229 | chip->pwd_reg = 3; | 240 | chip->pwd_reg = 3; |
230 | break; | 241 | break; |
@@ -292,7 +303,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, | |||
292 | spin_unlock_irqrestore(&chip->lock, flags); | 303 | spin_unlock_irqrestore(&chip->lock, flags); |
293 | return retval; | 304 | return retval; |
294 | } | 305 | } |
295 | 306 | ||
296 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | 307 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, |
297 | unsigned char value) | 308 | unsigned char value) |
298 | { | 309 | { |
@@ -341,7 +352,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
341 | 352 | ||
342 | 353 | ||
343 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | 354 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, |
344 | long wss_base, | 355 | long port, |
345 | int irq, int dma1, int dma2, | 356 | int irq, int dma1, int dma2, |
346 | long mpu_port, int mpu_irq) | 357 | long mpu_port, int mpu_irq) |
347 | { | 358 | { |
@@ -354,16 +365,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
354 | switch (chip->hardware) { | 365 | switch (chip->hardware) { |
355 | #ifndef OPTi93X | 366 | #ifndef OPTi93X |
356 | case OPTi9XX_HW_82C924: | 367 | case OPTi9XX_HW_82C924: |
368 | /* opti 929 mode (?), OPL3 clock output, audio enable */ | ||
357 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); | 369 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); |
370 | /* enable wave audio */ | ||
358 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); | 371 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
359 | 372 | ||
360 | case OPTi9XX_HW_82C925: | 373 | case OPTi9XX_HW_82C925: |
374 | /* enable WSS mode */ | ||
361 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | 375 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); |
376 | /* OPL3 FM synthesis */ | ||
362 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); | 377 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); |
378 | /* disable Sound Blaster IRQ and DMA */ | ||
363 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); | 379 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); |
364 | #ifdef CS4231 | 380 | #ifdef CS4231 |
381 | /* cs4231/4248 fix enabled */ | ||
365 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | 382 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); |
366 | #else | 383 | #else |
384 | /* cs4231/4248 fix disabled */ | ||
367 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); | 385 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); |
368 | #endif /* CS4231 */ | 386 | #endif /* CS4231 */ |
369 | break; | 387 | break; |
@@ -411,21 +429,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
411 | return -EINVAL; | 429 | return -EINVAL; |
412 | } | 430 | } |
413 | 431 | ||
414 | switch (wss_base) { | 432 | /* PnP resource says it decodes only 10 bits of address */ |
415 | case 0x530: | 433 | switch (port & 0x3ff) { |
434 | case 0x130: | ||
435 | chip->wss_base = 0x530; | ||
416 | wss_base_bits = 0x00; | 436 | wss_base_bits = 0x00; |
417 | break; | 437 | break; |
418 | case 0x604: | 438 | case 0x204: |
439 | chip->wss_base = 0x604; | ||
419 | wss_base_bits = 0x03; | 440 | wss_base_bits = 0x03; |
420 | break; | 441 | break; |
421 | case 0xe80: | 442 | case 0x280: |
443 | chip->wss_base = 0xe80; | ||
422 | wss_base_bits = 0x01; | 444 | wss_base_bits = 0x01; |
423 | break; | 445 | break; |
424 | case 0xf40: | 446 | case 0x340: |
447 | chip->wss_base = 0xf40; | ||
425 | wss_base_bits = 0x02; | 448 | wss_base_bits = 0x02; |
426 | break; | 449 | break; |
427 | default: | 450 | default: |
428 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); | 451 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port); |
429 | goto __skip_base; | 452 | goto __skip_base; |
430 | } | 453 | } |
431 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); | 454 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); |
@@ -487,7 +510,7 @@ __skip_base: | |||
487 | #endif /* CS4231 || OPTi93X */ | 510 | #endif /* CS4231 || OPTi93X */ |
488 | 511 | ||
489 | #ifndef OPTi93X | 512 | #ifndef OPTi93X |
490 | outb(irq_bits << 3 | dma_bits, wss_base); | 513 | outb(irq_bits << 3 | dma_bits, chip->wss_base); |
491 | #else /* OPTi93X */ | 514 | #else /* OPTi93X */ |
492 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); | 515 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); |
493 | #endif /* OPTi93X */ | 516 | #endif /* OPTi93X */ |
@@ -729,15 +752,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
729 | { | 752 | { |
730 | struct pnp_dev *pdev; | 753 | struct pnp_dev *pdev; |
731 | int err; | 754 | int err; |
755 | struct pnp_dev *devmpu; | ||
756 | #ifndef OPTi93X | ||
757 | struct pnp_dev *devmc; | ||
758 | #endif | ||
732 | 759 | ||
733 | chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); | 760 | pdev = pnp_request_card_device(card, pid->devs[0].id, NULL); |
734 | if (chip->dev == NULL) | 761 | if (pdev == NULL) |
735 | return -EBUSY; | 762 | return -EBUSY; |
736 | 763 | ||
737 | chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); | ||
738 | |||
739 | pdev = chip->dev; | ||
740 | |||
741 | err = pnp_activate_dev(pdev); | 764 | err = pnp_activate_dev(pdev); |
742 | if (err < 0) { | 765 | if (err < 0) { |
743 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); | 766 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); |
@@ -750,9 +773,24 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
750 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; | 773 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; |
751 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; | 774 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; |
752 | #else | 775 | #else |
753 | if (pid->driver_data != 0x0924) | 776 | devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); |
754 | port = pnp_port_start(pdev, 1); | 777 | if (devmc == NULL) |
778 | return -EBUSY; | ||
779 | |||
780 | err = pnp_activate_dev(devmc); | ||
781 | if (err < 0) { | ||
782 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err); | ||
783 | return err; | ||
784 | } | ||
785 | |||
786 | port = pnp_port_start(pdev, 1); | ||
755 | fm_port = pnp_port_start(pdev, 2) + 8; | 787 | fm_port = pnp_port_start(pdev, 2) + 8; |
788 | /* | ||
789 | * The MC(0) is never accessed and card does not | ||
790 | * include it in the PnP resource range. OPTI93x include it. | ||
791 | */ | ||
792 | chip->mc_base = pnp_port_start(devmc, 0) - 1; | ||
793 | chip->mc_base_size = pnp_port_len(devmc, 0) + 1; | ||
756 | #endif /* OPTi93X */ | 794 | #endif /* OPTi93X */ |
757 | irq = pnp_irq(pdev, 0); | 795 | irq = pnp_irq(pdev, 0); |
758 | dma1 = pnp_dma(pdev, 0); | 796 | dma1 = pnp_dma(pdev, 0); |
@@ -760,16 +798,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
760 | dma2 = pnp_dma(pdev, 1); | 798 | dma2 = pnp_dma(pdev, 1); |
761 | #endif /* CS4231 || OPTi93X */ | 799 | #endif /* CS4231 || OPTi93X */ |
762 | 800 | ||
763 | pdev = chip->devmpu; | 801 | devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); |
764 | if (pdev && mpu_port > 0) { | 802 | |
765 | err = pnp_activate_dev(pdev); | 803 | if (devmpu && mpu_port > 0) { |
804 | err = pnp_activate_dev(devmpu); | ||
766 | if (err < 0) { | 805 | if (err < 0) { |
767 | snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); | 806 | snd_printk(KERN_ERR "MPU401 pnp configure failure\n"); |
768 | mpu_port = -1; | 807 | mpu_port = -1; |
769 | chip->devmpu = NULL; | ||
770 | } else { | 808 | } else { |
771 | mpu_port = pnp_port_start(pdev, 0); | 809 | mpu_port = pnp_port_start(devmpu, 0); |
772 | mpu_irq = pnp_irq(pdev, 0); | 810 | mpu_irq = pnp_irq(devmpu, 0); |
773 | } | 811 | } |
774 | } | 812 | } |
775 | return pid->driver_data; | 813 | return pid->driver_data; |
@@ -824,7 +862,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
824 | if (error) | 862 | if (error) |
825 | return error; | 863 | return error; |
826 | 864 | ||
827 | error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, | 865 | error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2, |
828 | #ifdef OPTi93X | 866 | #ifdef OPTi93X |
829 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, | 867 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, |
830 | #else | 868 | #else |
@@ -865,10 +903,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
865 | sprintf(card->shortname, "OPTi %s", card->driver); | 903 | sprintf(card->shortname, "OPTi %s", card->driver); |
866 | #if defined(CS4231) || defined(OPTi93X) | 904 | #if defined(CS4231) || defined(OPTi93X) |
867 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", | 905 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", |
868 | card->shortname, pcm->name, port + 4, irq, dma1, xdma2); | 906 | card->shortname, pcm->name, |
907 | chip->wss_base + 4, irq, dma1, xdma2); | ||
869 | #else | 908 | #else |
870 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", | 909 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", |
871 | card->shortname, pcm->name, port + 4, irq, dma1); | 910 | card->shortname, pcm->name, chip->wss_base + 4, irq, dma1); |
872 | #endif /* CS4231 || OPTi93X */ | 911 | #endif /* CS4231 || OPTi93X */ |
873 | 912 | ||
874 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) | 913 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) |
@@ -1062,9 +1101,6 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | |||
1062 | snd_card_free(card); | 1101 | snd_card_free(card); |
1063 | return error; | 1102 | return error; |
1064 | } | 1103 | } |
1065 | if (hw <= OPTi9XX_HW_82C930) | ||
1066 | chip->mc_base -= 0x80; | ||
1067 | |||
1068 | error = snd_opti9xx_read_check(chip); | 1104 | error = snd_opti9xx_read_check(chip); |
1069 | if (error) { | 1105 | if (error) { |
1070 | snd_printk(KERN_ERR "OPTI chip not found\n"); | 1106 | snd_printk(KERN_ERR "OPTI chip not found\n"); |
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index 91dc3d83e2cf..ccedbfed061a 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "emu8000_local.h" | 21 | #include "emu8000_local.h" |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/initval.h> | 24 | #include <sound/initval.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | 26 | ||
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 8d21a3feda3a..8ccbcddf08e1 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/delay.h> | ||
17 | #include <asm/dma.h> | 18 | #include <asm/dma.h> |
18 | #include <linux/isa.h> | 19 | #include <linux/isa.h> |
19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 519c36346dec..4d1c5a300ff8 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <asm/dma.h> | 22 | #include <asm/dma.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/slab.h> | ||
25 | #include <linux/pnp.h> | 24 | #include <linux/pnp.h> |
26 | #include <linux/err.h> | 25 | #include <linux/err.h> |
27 | #include <linux/isa.h> | 26 | #include <linux/isa.h> |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index 3cd57ee54660..81284a8fa0ce 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/err.h> | 23 | #include <linux/err.h> |
24 | #include <linux/isa.h> | 24 | #include <linux/isa.h> |
25 | #include <linux/slab.h> | ||
26 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
27 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
28 | #include <sound/core.h> | 27 | #include <sound/core.h> |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index a34ae7b1f7d0..711670e4a425 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/slab.h> | ||
25 | #include <linux/err.h> | 24 | #include <linux/err.h> |
26 | #include <linux/isa.h> | 25 | #include <linux/isa.h> |
27 | #include <linux/pnp.h> | 26 | #include <linux/pnp.h> |
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 2bb1cee09255..657e2d6c01ac 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/time.h> | 21 | #include <linux/time.h> |
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/slab.h> | ||
23 | #include <linux/firmware.h> | 24 | #include <linux/firmware.h> |
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/snd_wavefront.h> | 26 | #include <sound/snd_wavefront.h> |
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 5d4ff48c4345..4fb7b19ff393 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
29 | #include <linux/firmware.h> | 29 | #include <linux/firmware.h> |
30 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
31 | #include <linux/slab.h> | ||
31 | #include <sound/core.h> | 32 | #include <sound/core.h> |
32 | #include <sound/snd_wavefront.h> | 33 | #include <sound/snd_wavefront.h> |
33 | #include <sound/initval.h> | 34 | #include <sound/initval.h> |
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c index 9a88cdfd952a..453d343550a8 100644 --- a/sound/mips/hal2.c +++ b/sound/mips/hal2.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/slab.h> | ||
28 | 29 | ||
29 | #include <asm/sgi/hpc3.h> | 30 | #include <asm/sgi/hpc3.h> |
30 | #include <asm/sgi/ip22.h> | 31 | #include <asm/sgi/ip22.h> |
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index 6aff217379d9..717604c00f0a 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c | |||
@@ -25,11 +25,11 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/gfp.h> | ||
29 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
30 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
31 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
32 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/slab.h> | ||
33 | 33 | ||
34 | #include <asm/ip32/ip32_ints.h> | 34 | #include <asm/ip32/ip32_ints.h> |
35 | #include <asm/ip32/mace.h> | 35 | #include <asm/ip32/mace.h> |
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index d12bd98a37ba..24793c5b65ac 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/stddef.h> | 47 | #include <linux/stddef.h> |
48 | #include <linux/slab.h> | ||
48 | #include <linux/isapnp.h> | 49 | #include <linux/isapnp.h> |
49 | #include <linux/pnp.h> | 50 | #include <linux/pnp.h> |
50 | #include <linux/spinlock.h> | 51 | #include <linux/spinlock.h> |
diff --git a/sound/oss/coproc.h b/sound/oss/coproc.h index 7306346e9ac4..7bec21bbdd88 100644 --- a/sound/oss/coproc.h +++ b/sound/oss/coproc.h | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Coprocessor access types | 7 | * Coprocessor access types |
8 | */ | 8 | */ |
9 | #define COPR_CUSTOM 0x0001 /* Custom applications */ | 9 | #define COPR_CUSTOM 0x0001 /* Custom applications */ |
10 | #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ | 10 | #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ |
diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c index 1bfcf7e88546..bcc3e8e07122 100644 --- a/sound/oss/dmabuf.c +++ b/sound/oss/dmabuf.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #define SAMPLE_ROUNDUP 0 | 26 | #define SAMPLE_ROUNDUP 0 |
27 | 27 | ||
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/gfp.h> | ||
29 | #include "sound_config.h" | 30 | #include "sound_config.h" |
30 | 31 | ||
31 | #define DMAP_FREE_ON_CLOSE 0 | 32 | #define DMAP_FREE_ON_CLOSE 0 |
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c index 24d152ccf80d..52d06a334e8f 100644 --- a/sound/oss/kahlua.c +++ b/sound/oss/kahlua.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/slab.h> | ||
34 | 35 | ||
35 | #include "sound_config.h" | 36 | #include "sound_config.h" |
36 | 37 | ||
diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c index 0af9d24feb8f..25e4609f8339 100644 --- a/sound/oss/mpu401.c +++ b/sound/oss/mpu401.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
23 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
24 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c index 21eb6dce46df..c0cc951ba97d 100644 --- a/sound/oss/msnd.c +++ b/sound/oss/msnd.c | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
29 | #include <linux/types.h> | 28 | #include <linux/types.h> |
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index bf27e008f465..a1e3f9671bea 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c | |||
@@ -35,12 +35,12 @@ | |||
35 | 35 | ||
36 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/slab.h> | ||
39 | #include <linux/types.h> | 38 | #include <linux/types.h> |
40 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
41 | #include <linux/init.h> | 40 | #include <linux/init.h> |
42 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
43 | #include <linux/smp_lock.h> | 42 | #include <linux/smp_lock.h> |
43 | #include <linux/gfp.h> | ||
44 | #include <asm/irq.h> | 44 | #include <asm/irq.h> |
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include "sound_config.h" | 46 | #include "sound_config.h" |
diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index 7781c13c1476..938c48c43585 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
29 | 30 | ||
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index 7de18b58f2cd..84ef4d06c1c2 100644 --- a/sound/oss/sb_card.c +++ b/sound/oss/sb_card.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | #include "sound_config.h" | 29 | #include "sound_config.h" |
29 | #include "sb_mixer.h" | 30 | #include "sb_mixer.h" |
diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c index ce4db49291f7..7d42c5418d1b 100644 --- a/sound/oss/sb_common.c +++ b/sound/oss/sb_common.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/spinlock.h> | 33 | #include <linux/spinlock.h> |
34 | #include <linux/slab.h> | ||
34 | 35 | ||
35 | #include "sound_config.h" | 36 | #include "sound_config.h" |
36 | #include "sound_firmware.h" | 37 | #include "sound_firmware.h" |
diff --git a/sound/oss/sb_midi.c b/sound/oss/sb_midi.c index 8b796704e112..f139028e85c0 100644 --- a/sound/oss/sb_midi.c +++ b/sound/oss/sb_midi.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/slab.h> | ||
15 | 16 | ||
16 | #include "sound_config.h" | 17 | #include "sound_config.h" |
17 | 18 | ||
diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index fad1a4f25ad6..2039d31b7e22 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * Stanislav Voronyi <stas@esc.kharkov.com> : Support for AWE 3DSE device (Jun 7 1999) | 16 | * Stanislav Voronyi <stas@esc.kharkov.com> : Support for AWE 3DSE device (Jun 7 1999) |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/slab.h> | ||
20 | |||
19 | #include "sound_config.h" | 21 | #include "sound_config.h" |
20 | 22 | ||
21 | #define __SB_MIXER_C__ | 23 | #define __SB_MIXER_C__ |
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index c79874696bec..e85789e53816 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c | |||
@@ -1631,8 +1631,6 @@ unsigned long compute_finetune(unsigned long base_freq, int bend, int range, | |||
1631 | } | 1631 | } |
1632 | 1632 | ||
1633 | semitones = bend / 100; | 1633 | semitones = bend / 100; |
1634 | if (semitones > 99) | ||
1635 | semitones = 99; | ||
1636 | cents = bend % 100; | 1634 | cents = bend % 100; |
1637 | 1635 | ||
1638 | amount = (int) (semitone_tuning[semitones] * multiplier * cent_tuning[cents]) / 10000; | 1636 | amount = (int) (semitone_tuning[semitones] * multiplier * cent_tuning[cents]) / 10000; |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index fde7c12fe5da..2d9c51312622 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <asm/dma.h> | 36 | #include <asm/dma.h> |
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | #include <linux/wait.h> | 38 | #include <linux/wait.h> |
39 | #include <linux/slab.h> | ||
40 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
41 | #include <linux/major.h> | 40 | #include <linux/major.h> |
42 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c index a446b826d5fc..8e514a676a0d 100644 --- a/sound/oss/uart401.c +++ b/sound/oss/uart401.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
28 | #include "sound_config.h" | 29 | #include "sound_config.h" |
29 | 30 | ||
diff --git a/sound/oss/v_midi.c b/sound/oss/v_midi.c index 103940fd5b4f..f0b4151d9b17 100644 --- a/sound/oss/v_midi.c +++ b/sound/oss/v_midi.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
25 | #include "sound_config.h" | 26 | #include "sound_config.h" |
26 | 27 | ||
diff --git a/sound/oss/v_midi.h b/sound/oss/v_midi.h index 1b86cb45c607..08e2185ee816 100644 --- a/sound/oss/v_midi.h +++ b/sound/oss/v_midi.h | |||
@@ -2,9 +2,9 @@ typedef struct vmidi_devc { | |||
2 | int dev; | 2 | int dev; |
3 | 3 | ||
4 | /* State variables */ | 4 | /* State variables */ |
5 | int opened; | 5 | int opened; |
6 | spinlock_t lock; | 6 | spinlock_t lock; |
7 | 7 | ||
8 | /* MIDI fields */ | 8 | /* MIDI fields */ |
9 | int my_mididev; | 9 | int my_mididev; |
10 | int pair_mididev; | 10 | int pair_mididev; |
@@ -12,4 +12,3 @@ typedef struct vmidi_devc { | |||
12 | int intr_active; | 12 | int intr_active; |
13 | void (*midi_input_intr) (int dev, unsigned char data); | 13 | void (*midi_input_intr) (int dev, unsigned char data); |
14 | } vmidi_devc; | 14 | } vmidi_devc; |
15 | |||
diff --git a/sound/oss/vidc.c b/sound/oss/vidc.c index 725fef0f59a3..ac39a531df19 100644 --- a/sound/oss/vidc.c +++ b/sound/oss/vidc.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * We currently support a mixer device, but it is currently non-functional. | 17 | * We currently support a mixer device, but it is currently non-functional. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/gfp.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
@@ -363,13 +364,13 @@ static void vidc_audio_trigger(int dev, int enable_bits) | |||
363 | struct audio_operations *adev = audio_devs[dev]; | 364 | struct audio_operations *adev = audio_devs[dev]; |
364 | 365 | ||
365 | if (enable_bits & PCM_ENABLE_OUTPUT) { | 366 | if (enable_bits & PCM_ENABLE_OUTPUT) { |
366 | if (!(adev->flags & DMA_ACTIVE)) { | 367 | if (!(adev->dmap_out->flags & DMA_ACTIVE)) { |
367 | unsigned long flags; | 368 | unsigned long flags; |
368 | 369 | ||
369 | local_irq_save(flags); | 370 | local_irq_save(flags); |
370 | 371 | ||
371 | /* prevent recusion */ | 372 | /* prevent recusion */ |
372 | adev->flags |= DMA_ACTIVE; | 373 | adev->dmap_out->flags |= DMA_ACTIVE; |
373 | 374 | ||
374 | dma_interrupt = vidc_audio_dma_interrupt; | 375 | dma_interrupt = vidc_audio_dma_interrupt; |
375 | vidc_sound_dma_irq(0, NULL); | 376 | vidc_sound_dma_irq(0, NULL); |
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 6713110bdc75..20b3b325aa80 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c | |||
@@ -149,6 +149,7 @@ | |||
149 | #include <linux/wait.h> | 149 | #include <linux/wait.h> |
150 | #include <linux/interrupt.h> | 150 | #include <linux/interrupt.h> |
151 | #include <linux/mutex.h> | 151 | #include <linux/mutex.h> |
152 | #include <linux/slab.h> | ||
152 | 153 | ||
153 | #include <asm/visws/cobalt.h> | 154 | #include <asm/visws/cobalt.h> |
154 | 155 | ||
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index 2c63bb9da74a..e688dde6bbde 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/slab.h> | ||
38 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
39 | #include <linux/interrupt.h> | 40 | #include <linux/interrupt.h> |
40 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 1caf5e3c1f6a..e68c98ef4041 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -1852,12 +1852,14 @@ static unsigned int ad1981_jacks_blacklist[] = { | |||
1852 | 0x10140523, /* Thinkpad R40 */ | 1852 | 0x10140523, /* Thinkpad R40 */ |
1853 | 0x10140534, /* Thinkpad X31 */ | 1853 | 0x10140534, /* Thinkpad X31 */ |
1854 | 0x10140537, /* Thinkpad T41p */ | 1854 | 0x10140537, /* Thinkpad T41p */ |
1855 | 0x1014053e, /* Thinkpad R40e */ | ||
1855 | 0x10140554, /* Thinkpad T42p/R50p */ | 1856 | 0x10140554, /* Thinkpad T42p/R50p */ |
1856 | 0x10140567, /* Thinkpad T43p 2668-G7U */ | 1857 | 0x10140567, /* Thinkpad T43p 2668-G7U */ |
1857 | 0x10140581, /* Thinkpad X41-2527 */ | 1858 | 0x10140581, /* Thinkpad X41-2527 */ |
1858 | 0x10280160, /* Dell Dimension 2400 */ | 1859 | 0x10280160, /* Dell Dimension 2400 */ |
1859 | 0x104380b0, /* Asus A7V8X-MX */ | 1860 | 0x104380b0, /* Asus A7V8X-MX */ |
1860 | 0x11790241, /* Toshiba Satellite A-15 S127 */ | 1861 | 0x11790241, /* Toshiba Satellite A-15 S127 */ |
1862 | 0x1179ff10, /* Toshiba P500 */ | ||
1861 | 0x144dc01a, /* Samsung NP-X20C004/SEG */ | 1863 | 0x144dc01a, /* Samsung NP-X20C004/SEG */ |
1862 | 0 /* end */ | 1864 | 0 /* end */ |
1863 | }; | 1865 | }; |
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index 73b17d526c8b..6320bf084e47 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c | |||
@@ -22,7 +22,6 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
27 | 26 | ||
28 | #include <sound/core.h> | 27 | #include <sound/core.h> |
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index d75cf7b06426..6cf1de8042e8 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -68,7 +68,6 @@ | |||
68 | #include <asm/io.h> | 68 | #include <asm/io.h> |
69 | #include <linux/init.h> | 69 | #include <linux/init.h> |
70 | #include <linux/pci.h> | 70 | #include <linux/pci.h> |
71 | #include <linux/slab.h> | ||
72 | #include <linux/gameport.h> | 71 | #include <linux/gameport.h> |
73 | #include <linux/moduleparam.h> | 72 | #include <linux/moduleparam.h> |
74 | #include <linux/dma-mapping.h> | 73 | #include <linux/dma-mapping.h> |
diff --git a/sound/pci/aw2/aw2-saa7146.c b/sound/pci/aw2/aw2-saa7146.c index 296123ab74f7..8afd8b5d1ac7 100644 --- a/sound/pci/aw2/aw2-saa7146.c +++ b/sound/pci/aw2/aw2-saa7146.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/slab.h> | ||
29 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
31 | #include <asm/system.h> | 30 | #include <asm/system.h> |
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index 8f443a9d61ec..85fd315d9999 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <linux/delay.h> | 63 | #include <linux/delay.h> |
64 | #include <linux/init.h> | 64 | #include <linux/init.h> |
65 | #include <linux/interrupt.h> | 65 | #include <linux/interrupt.h> |
66 | #include <linux/slab.h> | ||
67 | #include <linux/moduleparam.h> | 66 | #include <linux/moduleparam.h> |
68 | #include <sound/core.h> | 67 | #include <sound/core.h> |
69 | #include <sound/initval.h> | 68 | #include <sound/initval.h> |
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index 0470461cc03e..ba96428c9f4c 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <linux/delay.h> | 63 | #include <linux/delay.h> |
64 | #include <linux/init.h> | 64 | #include <linux/init.h> |
65 | #include <linux/interrupt.h> | 65 | #include <linux/interrupt.h> |
66 | #include <linux/slab.h> | ||
67 | #include <linux/moduleparam.h> | 66 | #include <linux/moduleparam.h> |
68 | #include <sound/core.h> | 67 | #include <sound/core.h> |
69 | #include <sound/initval.h> | 68 | #include <sound/initval.h> |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 1ded64e05643..329968edca9b 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -941,13 +941,21 @@ static snd_pcm_uframes_t snd_cmipci_pcm_pointer(struct cmipci *cm, struct cmipci | |||
941 | struct snd_pcm_substream *substream) | 941 | struct snd_pcm_substream *substream) |
942 | { | 942 | { |
943 | size_t ptr; | 943 | size_t ptr; |
944 | unsigned int reg; | 944 | unsigned int reg, rem, tries; |
945 | |||
945 | if (!rec->running) | 946 | if (!rec->running) |
946 | return 0; | 947 | return 0; |
947 | #if 1 // this seems better.. | 948 | #if 1 // this seems better.. |
948 | reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2; | 949 | reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2; |
949 | ptr = rec->dma_size - (snd_cmipci_read_w(cm, reg) + 1); | 950 | for (tries = 0; tries < 3; tries++) { |
950 | ptr >>= rec->shift; | 951 | rem = snd_cmipci_read_w(cm, reg); |
952 | if (rem < rec->dma_size) | ||
953 | goto ok; | ||
954 | } | ||
955 | printk(KERN_ERR "cmipci: invalid PCM pointer: %#x\n", rem); | ||
956 | return SNDRV_PCM_POS_XRUN; | ||
957 | ok: | ||
958 | ptr = (rec->dma_size - (rem + 1)) >> rec->shift; | ||
951 | #else | 959 | #else |
952 | reg = rec->ch ? CM_REG_CH1_FRAME1 : CM_REG_CH0_FRAME1; | 960 | reg = rec->ch ? CM_REG_CH1_FRAME1 : CM_REG_CH0_FRAME1; |
953 | ptr = snd_cmipci_read(cm, reg) - rec->offset; | 961 | ptr = snd_cmipci_read(cm, reg) - rec->offset; |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 207479a641cf..bc07e275d4d4 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/moduleparam.h> | 40 | #include <linux/moduleparam.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
42 | #include <linux/slab.h> | ||
42 | #include <sound/core.h> | 43 | #include <sound/core.h> |
43 | #include <sound/sb.h> | 44 | #include <sound/sb.h> |
44 | #include <sound/initval.h> | 45 | #include <sound/initval.h> |
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index 0f48a871f17b..f16bc8aad6ed 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c | |||
@@ -23,7 +23,6 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/slab.h> | ||
27 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
28 | #include <sound/core.h> | 27 | #include <sound/core.h> |
29 | #include <sound/control.h> | 28 | #include <sound/control.h> |
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index 564c33b60953..a3301cc4ab82 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c | |||
@@ -19,7 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/slab.h> | ||
23 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
25 | #include <sound/core.h> | 24 | #include <sound/core.h> |
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 480cb1e905b6..1bff80cde0a2 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "ctdaio.h" | 24 | #include "ctdaio.h" |
25 | #include "cttimer.h" | 25 | #include "cttimer.h" |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/slab.h> | ||
27 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
28 | #include <sound/control.h> | 29 | #include <sound/control.h> |
29 | #include <sound/asoundef.h> | 30 | #include <sound/asoundef.h> |
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index d0dc227fbdd3..85ab43e89212 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include "ctpcm.h" | 18 | #include "ctpcm.h" |
19 | #include "cttimer.h" | 19 | #include "cttimer.h" |
20 | #include <linux/slab.h> | ||
20 | #include <sound/pcm.h> | 21 | #include <sound/pcm.h> |
21 | 22 | ||
22 | /* Hardware descriptions for playback */ | 23 | /* Hardware descriptions for playback */ |
diff --git a/sound/pci/echoaudio/darla20.c b/sound/pci/echoaudio/darla20.c index a65bafe0800f..fe7ad64dccd7 100644 --- a/sound/pci/echoaudio/darla20.c +++ b/sound/pci/echoaudio/darla20.c | |||
@@ -40,9 +40,9 @@ | |||
40 | #include <linux/init.h> | 40 | #include <linux/init.h> |
41 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
42 | #include <linux/pci.h> | 42 | #include <linux/pci.h> |
43 | #include <linux/slab.h> | ||
44 | #include <linux/moduleparam.h> | 43 | #include <linux/moduleparam.h> |
45 | #include <linux/firmware.h> | 44 | #include <linux/firmware.h> |
45 | #include <linux/slab.h> | ||
46 | #include <sound/core.h> | 46 | #include <sound/core.h> |
47 | #include <sound/info.h> | 47 | #include <sound/info.h> |
48 | #include <sound/control.h> | 48 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/darla24.c b/sound/pci/echoaudio/darla24.c index 0a6c50bcd758..d1fd34b1a8e3 100644 --- a/sound/pci/echoaudio/darla24.c +++ b/sound/pci/echoaudio/darla24.c | |||
@@ -44,9 +44,9 @@ | |||
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
46 | #include <linux/pci.h> | 46 | #include <linux/pci.h> |
47 | #include <linux/slab.h> | ||
48 | #include <linux/moduleparam.h> | 47 | #include <linux/moduleparam.h> |
49 | #include <linux/firmware.h> | 48 | #include <linux/firmware.h> |
49 | #include <linux/slab.h> | ||
50 | #include <sound/core.h> | 50 | #include <sound/core.h> |
51 | #include <sound/info.h> | 51 | #include <sound/info.h> |
52 | #include <sound/control.h> | 52 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/echo3g.c b/sound/pci/echoaudio/echo3g.c index f5142796989b..1dffdc54416d 100644 --- a/sound/pci/echoaudio/echo3g.c +++ b/sound/pci/echoaudio/echo3g.c | |||
@@ -51,9 +51,9 @@ | |||
51 | #include <linux/init.h> | 51 | #include <linux/init.h> |
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
54 | #include <linux/slab.h> | ||
55 | #include <linux/moduleparam.h> | 54 | #include <linux/moduleparam.h> |
56 | #include <linux/firmware.h> | 55 | #include <linux/firmware.h> |
56 | #include <linux/slab.h> | ||
57 | #include <sound/core.h> | 57 | #include <sound/core.h> |
58 | #include <sound/info.h> | 58 | #include <sound/info.h> |
59 | #include <sound/control.h> | 59 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 8dab82d7d19d..668a5ec04499 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -2184,10 +2184,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
2184 | goto ctl_error; | 2184 | goto ctl_error; |
2185 | #endif | 2185 | #endif |
2186 | 2186 | ||
2187 | if ((err = snd_card_register(card)) < 0) { | 2187 | err = snd_card_register(card); |
2188 | snd_card_free(card); | 2188 | if (err < 0) |
2189 | goto ctl_error; | 2189 | goto ctl_error; |
2190 | } | ||
2191 | snd_printk(KERN_INFO "Card registered: %s\n", card->longname); | 2190 | snd_printk(KERN_INFO "Card registered: %s\n", card->longname); |
2192 | 2191 | ||
2193 | pci_set_drvdata(pci, chip); | 2192 | pci_set_drvdata(pci, chip); |
diff --git a/sound/pci/echoaudio/gina20.c b/sound/pci/echoaudio/gina20.c index 2364f8a1bc21..050e54aa693f 100644 --- a/sound/pci/echoaudio/gina20.c +++ b/sound/pci/echoaudio/gina20.c | |||
@@ -44,9 +44,9 @@ | |||
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
46 | #include <linux/pci.h> | 46 | #include <linux/pci.h> |
47 | #include <linux/slab.h> | ||
48 | #include <linux/moduleparam.h> | 47 | #include <linux/moduleparam.h> |
49 | #include <linux/firmware.h> | 48 | #include <linux/firmware.h> |
49 | #include <linux/slab.h> | ||
50 | #include <sound/core.h> | 50 | #include <sound/core.h> |
51 | #include <sound/info.h> | 51 | #include <sound/info.h> |
52 | #include <sound/control.h> | 52 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/gina24.c b/sound/pci/echoaudio/gina24.c index 616b55825a19..5748fc6d29d6 100644 --- a/sound/pci/echoaudio/gina24.c +++ b/sound/pci/echoaudio/gina24.c | |||
@@ -50,9 +50,9 @@ | |||
50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
51 | #include <linux/interrupt.h> | 51 | #include <linux/interrupt.h> |
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include <linux/slab.h> | ||
54 | #include <linux/moduleparam.h> | 53 | #include <linux/moduleparam.h> |
55 | #include <linux/firmware.h> | 54 | #include <linux/firmware.h> |
55 | #include <linux/slab.h> | ||
56 | #include <sound/core.h> | 56 | #include <sound/core.h> |
57 | #include <sound/info.h> | 57 | #include <sound/info.h> |
58 | #include <sound/control.h> | 58 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/indigo.c b/sound/pci/echoaudio/indigo.c index 776175c0bdad..4ae5e35cb5f1 100644 --- a/sound/pci/echoaudio/indigo.c +++ b/sound/pci/echoaudio/indigo.c | |||
@@ -42,9 +42,9 @@ | |||
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
44 | #include <linux/pci.h> | 44 | #include <linux/pci.h> |
45 | #include <linux/slab.h> | ||
46 | #include <linux/moduleparam.h> | 45 | #include <linux/moduleparam.h> |
47 | #include <linux/firmware.h> | 46 | #include <linux/firmware.h> |
47 | #include <linux/slab.h> | ||
48 | #include <sound/core.h> | 48 | #include <sound/core.h> |
49 | #include <sound/info.h> | 49 | #include <sound/info.h> |
50 | #include <sound/control.h> | 50 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/indigodj.c b/sound/pci/echoaudio/indigodj.c index 8816b0bd2ba6..3550715bab1c 100644 --- a/sound/pci/echoaudio/indigodj.c +++ b/sound/pci/echoaudio/indigodj.c | |||
@@ -42,9 +42,9 @@ | |||
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
44 | #include <linux/pci.h> | 44 | #include <linux/pci.h> |
45 | #include <linux/slab.h> | ||
46 | #include <linux/moduleparam.h> | 45 | #include <linux/moduleparam.h> |
47 | #include <linux/firmware.h> | 46 | #include <linux/firmware.h> |
47 | #include <linux/slab.h> | ||
48 | #include <sound/core.h> | 48 | #include <sound/core.h> |
49 | #include <sound/info.h> | 49 | #include <sound/info.h> |
50 | #include <sound/control.h> | 50 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/indigodjx.c b/sound/pci/echoaudio/indigodjx.c index b1e3652f2f48..19b191fd0120 100644 --- a/sound/pci/echoaudio/indigodjx.c +++ b/sound/pci/echoaudio/indigodjx.c | |||
@@ -42,10 +42,10 @@ | |||
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
44 | #include <linux/pci.h> | 44 | #include <linux/pci.h> |
45 | #include <linux/slab.h> | ||
46 | #include <linux/moduleparam.h> | 45 | #include <linux/moduleparam.h> |
47 | #include <linux/firmware.h> | 46 | #include <linux/firmware.h> |
48 | #include <linux/io.h> | 47 | #include <linux/io.h> |
48 | #include <linux/slab.h> | ||
49 | #include <sound/core.h> | 49 | #include <sound/core.h> |
50 | #include <sound/info.h> | 50 | #include <sound/info.h> |
51 | #include <sound/control.h> | 51 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/indigoio.c b/sound/pci/echoaudio/indigoio.c index 1035125336d6..a9fcedf317a4 100644 --- a/sound/pci/echoaudio/indigoio.c +++ b/sound/pci/echoaudio/indigoio.c | |||
@@ -43,9 +43,9 @@ | |||
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/interrupt.h> | 44 | #include <linux/interrupt.h> |
45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
46 | #include <linux/slab.h> | ||
47 | #include <linux/moduleparam.h> | 46 | #include <linux/moduleparam.h> |
48 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
48 | #include <linux/slab.h> | ||
49 | #include <sound/core.h> | 49 | #include <sound/core.h> |
50 | #include <sound/info.h> | 50 | #include <sound/info.h> |
51 | #include <sound/control.h> | 51 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/indigoiox.c b/sound/pci/echoaudio/indigoiox.c index 60b7cb2753cf..bcdfac63212c 100644 --- a/sound/pci/echoaudio/indigoiox.c +++ b/sound/pci/echoaudio/indigoiox.c | |||
@@ -43,10 +43,10 @@ | |||
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/interrupt.h> | 44 | #include <linux/interrupt.h> |
45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
46 | #include <linux/slab.h> | ||
47 | #include <linux/moduleparam.h> | 46 | #include <linux/moduleparam.h> |
48 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
49 | #include <linux/io.h> | 48 | #include <linux/io.h> |
49 | #include <linux/slab.h> | ||
50 | #include <sound/core.h> | 50 | #include <sound/core.h> |
51 | #include <sound/info.h> | 51 | #include <sound/info.h> |
52 | #include <sound/control.h> | 52 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/layla20.c b/sound/pci/echoaudio/layla20.c index 8c3f5c5b5301..d3a98c5dac86 100644 --- a/sound/pci/echoaudio/layla20.c +++ b/sound/pci/echoaudio/layla20.c | |||
@@ -49,9 +49,9 @@ | |||
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/interrupt.h> | 50 | #include <linux/interrupt.h> |
51 | #include <linux/pci.h> | 51 | #include <linux/pci.h> |
52 | #include <linux/slab.h> | ||
53 | #include <linux/moduleparam.h> | 52 | #include <linux/moduleparam.h> |
54 | #include <linux/firmware.h> | 53 | #include <linux/firmware.h> |
54 | #include <linux/slab.h> | ||
55 | #include <sound/core.h> | 55 | #include <sound/core.h> |
56 | #include <sound/info.h> | 56 | #include <sound/info.h> |
57 | #include <sound/control.h> | 57 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/layla24.c b/sound/pci/echoaudio/layla24.c index ed1cc0abc2b8..2a1dca6dce17 100644 --- a/sound/pci/echoaudio/layla24.c +++ b/sound/pci/echoaudio/layla24.c | |||
@@ -51,9 +51,9 @@ | |||
51 | #include <linux/init.h> | 51 | #include <linux/init.h> |
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
54 | #include <linux/slab.h> | ||
55 | #include <linux/moduleparam.h> | 54 | #include <linux/moduleparam.h> |
56 | #include <linux/firmware.h> | 55 | #include <linux/firmware.h> |
56 | #include <linux/slab.h> | ||
57 | #include <sound/core.h> | 57 | #include <sound/core.h> |
58 | #include <sound/info.h> | 58 | #include <sound/info.h> |
59 | #include <sound/control.h> | 59 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index cc2bbfc65327..9cdf14cfdd74 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c | |||
@@ -50,9 +50,9 @@ | |||
50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
51 | #include <linux/interrupt.h> | 51 | #include <linux/interrupt.h> |
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include <linux/slab.h> | ||
54 | #include <linux/moduleparam.h> | 53 | #include <linux/moduleparam.h> |
55 | #include <linux/firmware.h> | 54 | #include <linux/firmware.h> |
55 | #include <linux/slab.h> | ||
56 | #include <sound/core.h> | 56 | #include <sound/core.h> |
57 | #include <sound/info.h> | 57 | #include <sound/info.h> |
58 | #include <sound/control.h> | 58 | #include <sound/control.h> |
diff --git a/sound/pci/echoaudio/mona.c b/sound/pci/echoaudio/mona.c index 3e7e01824b40..1047be405ebe 100644 --- a/sound/pci/echoaudio/mona.c +++ b/sound/pci/echoaudio/mona.c | |||
@@ -48,9 +48,9 @@ | |||
48 | #include <linux/init.h> | 48 | #include <linux/init.h> |
49 | #include <linux/interrupt.h> | 49 | #include <linux/interrupt.h> |
50 | #include <linux/pci.h> | 50 | #include <linux/pci.h> |
51 | #include <linux/slab.h> | ||
52 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
53 | #include <linux/firmware.h> | 52 | #include <linux/firmware.h> |
53 | #include <linux/slab.h> | ||
54 | #include <sound/core.h> | 54 | #include <sound/core.h> |
55 | #include <sound/info.h> | 55 | #include <sound/info.h> |
56 | #include <sound/control.h> | 56 | #include <sound/control.h> |
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index 6a47672f930a..ffb1ddb8dc28 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/gfp.h> | ||
25 | #include <linux/time.h> | 26 | #include <linux/time.h> |
26 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
27 | 28 | ||
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 556cff937be7..567348b05b5a 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -157,7 +157,7 @@ config SND_HDA_CODEC_INTELHDMI | |||
157 | 157 | ||
158 | config SND_HDA_ELD | 158 | config SND_HDA_ELD |
159 | def_bool y | 159 | def_bool y |
160 | depends on SND_HDA_CODEC_INTELHDMI | 160 | depends on SND_HDA_CODEC_INTELHDMI || SND_HDA_CODEC_NVHDMI |
161 | 161 | ||
162 | config SND_HDA_CODEC_CIRRUS | 162 | config SND_HDA_CODEC_CIRRUS |
163 | bool "Build Cirrus Logic codec support" | 163 | bool "Build Cirrus Logic codec support" |
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 315a1c4f8998..24bc195b02da 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -3,7 +3,7 @@ snd-hda-intel-objs := hda_intel.o | |||
3 | snd-hda-codec-y := hda_codec.o | 3 | snd-hda-codec-y := hda_codec.o |
4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o | 5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o |
6 | # snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o | 6 | snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o |
7 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 7 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
8 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o | 8 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o |
9 | 9 | ||
@@ -18,7 +18,7 @@ snd-hda-codec-ca0110-objs := patch_ca0110.o | |||
18 | snd-hda-codec-conexant-objs := patch_conexant.o | 18 | snd-hda-codec-conexant-objs := patch_conexant.o |
19 | snd-hda-codec-via-objs := patch_via.o | 19 | snd-hda-codec-via-objs := patch_via.o |
20 | snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o | 20 | snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o |
21 | snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o hda_eld.o | 21 | snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o |
22 | 22 | ||
23 | # common driver | 23 | # common driver |
24 | obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o | 24 | obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index e4581a42ace5..29714c818b53 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/input.h> | 22 | #include <linux/input.h> |
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include "hda_beep.h" | 27 | #include "hda_beep.h" |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 76d3c4c049db..0e76ac2b2ace 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -978,8 +978,9 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
978 | * | 978 | * |
979 | * Returns 0 if successful, or a negative error code. | 979 | * Returns 0 if successful, or a negative error code. |
980 | */ | 980 | */ |
981 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 981 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, |
982 | struct hda_codec **codecp) | 982 | unsigned int codec_addr, |
983 | struct hda_codec **codecp) | ||
983 | { | 984 | { |
984 | struct hda_codec *codec; | 985 | struct hda_codec *codec; |
985 | char component[31]; | 986 | char component[31]; |
@@ -1186,7 +1187,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); | |||
1186 | */ | 1187 | */ |
1187 | 1188 | ||
1188 | /* FIXME: more better hash key? */ | 1189 | /* FIXME: more better hash key? */ |
1189 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) | 1190 | #define HDA_HASH_KEY(nid, dir, idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) |
1190 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) | 1191 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) |
1191 | #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) | 1192 | #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) |
1192 | #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) | 1193 | #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) |
@@ -1356,7 +1357,8 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | |||
1356 | if (!codec->no_trigger_sense) { | 1357 | if (!codec->no_trigger_sense) { |
1357 | pincap = snd_hda_query_pin_caps(codec, nid); | 1358 | pincap = snd_hda_query_pin_caps(codec, nid); |
1358 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | 1359 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
1359 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | 1360 | snd_hda_codec_read(codec, nid, 0, |
1361 | AC_VERB_SET_PIN_SENSE, 0); | ||
1360 | } | 1362 | } |
1361 | return snd_hda_codec_read(codec, nid, 0, | 1363 | return snd_hda_codec_read(codec, nid, 0, |
1362 | AC_VERB_GET_PIN_SENSE, 0); | 1364 | AC_VERB_GET_PIN_SENSE, 0); |
@@ -1372,8 +1374,8 @@ EXPORT_SYMBOL_HDA(snd_hda_pin_sense); | |||
1372 | */ | 1374 | */ |
1373 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) | 1375 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) |
1374 | { | 1376 | { |
1375 | u32 sense = snd_hda_pin_sense(codec, nid); | 1377 | u32 sense = snd_hda_pin_sense(codec, nid); |
1376 | return !!(sense & AC_PINSENSE_PRESENCE); | 1378 | return !!(sense & AC_PINSENSE_PRESENCE); |
1377 | } | 1379 | } |
1378 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); | 1380 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); |
1379 | 1381 | ||
@@ -1804,6 +1806,8 @@ int snd_hda_add_nid(struct hda_codec *codec, struct snd_kcontrol *kctl, | |||
1804 | item->nid = nid; | 1806 | item->nid = nid; |
1805 | return 0; | 1807 | return 0; |
1806 | } | 1808 | } |
1809 | printk(KERN_ERR "hda-codec: no NID for mapping control %s:%d:%d\n", | ||
1810 | kctl->id.name, kctl->id.index, index); | ||
1807 | return -EINVAL; | 1811 | return -EINVAL; |
1808 | } | 1812 | } |
1809 | EXPORT_SYMBOL_HDA(snd_hda_add_nid); | 1813 | EXPORT_SYMBOL_HDA(snd_hda_add_nid); |
@@ -1952,7 +1956,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
1952 | err = snd_hda_ctl_add(codec, 0, kctl); | 1956 | err = snd_hda_ctl_add(codec, 0, kctl); |
1953 | if (err < 0) | 1957 | if (err < 0) |
1954 | return err; | 1958 | return err; |
1955 | 1959 | ||
1956 | for (s = slaves; *s; s++) { | 1960 | for (s = slaves; *s; s++) { |
1957 | struct snd_kcontrol *sctl; | 1961 | struct snd_kcontrol *sctl; |
1958 | int i = 0; | 1962 | int i = 0; |
@@ -2439,27 +2443,27 @@ static struct snd_kcontrol_new dig_mixes[] = { | |||
2439 | { | 2443 | { |
2440 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2444 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2445 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2442 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 2446 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
2443 | .info = snd_hda_spdif_mask_info, | 2447 | .info = snd_hda_spdif_mask_info, |
2444 | .get = snd_hda_spdif_cmask_get, | 2448 | .get = snd_hda_spdif_cmask_get, |
2445 | }, | 2449 | }, |
2446 | { | 2450 | { |
2447 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2451 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2448 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2452 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2449 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 2453 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
2450 | .info = snd_hda_spdif_mask_info, | 2454 | .info = snd_hda_spdif_mask_info, |
2451 | .get = snd_hda_spdif_pmask_get, | 2455 | .get = snd_hda_spdif_pmask_get, |
2452 | }, | 2456 | }, |
2453 | { | 2457 | { |
2454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2458 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2455 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 2459 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), |
2456 | .info = snd_hda_spdif_mask_info, | 2460 | .info = snd_hda_spdif_mask_info, |
2457 | .get = snd_hda_spdif_default_get, | 2461 | .get = snd_hda_spdif_default_get, |
2458 | .put = snd_hda_spdif_default_put, | 2462 | .put = snd_hda_spdif_default_put, |
2459 | }, | 2463 | }, |
2460 | { | 2464 | { |
2461 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2462 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), | 2466 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), |
2463 | .info = snd_hda_spdif_out_switch_info, | 2467 | .info = snd_hda_spdif_out_switch_info, |
2464 | .get = snd_hda_spdif_out_switch_get, | 2468 | .get = snd_hda_spdif_out_switch_get, |
2465 | .put = snd_hda_spdif_out_switch_put, | 2469 | .put = snd_hda_spdif_out_switch_put, |
@@ -2610,7 +2614,7 @@ static int snd_hda_spdif_in_status_get(struct snd_kcontrol *kcontrol, | |||
2610 | static struct snd_kcontrol_new dig_in_ctls[] = { | 2614 | static struct snd_kcontrol_new dig_in_ctls[] = { |
2611 | { | 2615 | { |
2612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2616 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2613 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), | 2617 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH), |
2614 | .info = snd_hda_spdif_in_switch_info, | 2618 | .info = snd_hda_spdif_in_switch_info, |
2615 | .get = snd_hda_spdif_in_switch_get, | 2619 | .get = snd_hda_spdif_in_switch_get, |
2616 | .put = snd_hda_spdif_in_switch_put, | 2620 | .put = snd_hda_spdif_in_switch_put, |
@@ -2618,7 +2622,7 @@ static struct snd_kcontrol_new dig_in_ctls[] = { | |||
2618 | { | 2622 | { |
2619 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2623 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2624 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2621 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), | 2625 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT), |
2622 | .info = snd_hda_spdif_mask_info, | 2626 | .info = snd_hda_spdif_mask_info, |
2623 | .get = snd_hda_spdif_in_status_get, | 2627 | .get = snd_hda_spdif_in_status_get, |
2624 | }, | 2628 | }, |
@@ -2882,8 +2886,8 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) | |||
2882 | list_for_each_entry(codec, &bus->codec_list, list) { | 2886 | list_for_each_entry(codec, &bus->codec_list, list) { |
2883 | int err = snd_hda_codec_build_controls(codec); | 2887 | int err = snd_hda_codec_build_controls(codec); |
2884 | if (err < 0) { | 2888 | if (err < 0) { |
2885 | printk(KERN_ERR "hda_codec: cannot build controls" | 2889 | printk(KERN_ERR "hda_codec: cannot build controls " |
2886 | "for #%d (error %d)\n", codec->addr, err); | 2890 | "for #%d (error %d)\n", codec->addr, err); |
2887 | err = snd_hda_codec_reset(codec); | 2891 | err = snd_hda_codec_reset(codec); |
2888 | if (err < 0) { | 2892 | if (err < 0) { |
2889 | printk(KERN_ERR | 2893 | printk(KERN_ERR |
@@ -2979,8 +2983,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
2979 | val |= channels - 1; | 2983 | val |= channels - 1; |
2980 | 2984 | ||
2981 | switch (snd_pcm_format_width(format)) { | 2985 | switch (snd_pcm_format_width(format)) { |
2982 | case 8: val |= 0x00; break; | 2986 | case 8: |
2983 | case 16: val |= 0x10; break; | 2987 | val |= 0x00; |
2988 | break; | ||
2989 | case 16: | ||
2990 | val |= 0x10; | ||
2991 | break; | ||
2984 | case 20: | 2992 | case 20: |
2985 | case 24: | 2993 | case 24: |
2986 | case 32: | 2994 | case 32: |
@@ -3298,7 +3306,8 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) | |||
3298 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) | 3306 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) |
3299 | return audio_idx[type][i]; | 3307 | return audio_idx[type][i]; |
3300 | 3308 | ||
3301 | snd_printk(KERN_WARNING "Too many %s devices\n", snd_hda_pcm_type_name[type]); | 3309 | snd_printk(KERN_WARNING "Too many %s devices\n", |
3310 | snd_hda_pcm_type_name[type]); | ||
3302 | return -EAGAIN; | 3311 | return -EAGAIN; |
3303 | } | 3312 | } |
3304 | 3313 | ||
@@ -3336,7 +3345,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) | |||
3336 | err = codec->patch_ops.build_pcms(codec); | 3345 | err = codec->patch_ops.build_pcms(codec); |
3337 | if (err < 0) { | 3346 | if (err < 0) { |
3338 | printk(KERN_ERR "hda_codec: cannot build PCMs" | 3347 | printk(KERN_ERR "hda_codec: cannot build PCMs" |
3339 | "for #%d (error %d)\n", codec->addr, err); | 3348 | "for #%d (error %d)\n", codec->addr, err); |
3340 | err = snd_hda_codec_reset(codec); | 3349 | err = snd_hda_codec_reset(codec); |
3341 | if (err < 0) { | 3350 | if (err < 0) { |
3342 | printk(KERN_ERR | 3351 | printk(KERN_ERR |
@@ -3466,8 +3475,8 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | |||
3466 | 3475 | ||
3467 | /** | 3476 | /** |
3468 | * snd_hda_check_board_codec_sid_config - compare the current codec | 3477 | * snd_hda_check_board_codec_sid_config - compare the current codec |
3469 | subsystem ID with the | 3478 | subsystem ID with the |
3470 | config table | 3479 | config table |
3471 | 3480 | ||
3472 | This is important for Gateway notebooks with SB450 HDA Audio | 3481 | This is important for Gateway notebooks with SB450 HDA Audio |
3473 | where the vendor ID of the PCI device is: | 3482 | where the vendor ID of the PCI device is: |
@@ -3607,7 +3616,7 @@ void snd_hda_update_power_acct(struct hda_codec *codec) | |||
3607 | * | 3616 | * |
3608 | * Increment the power-up counter and power up the hardware really when | 3617 | * Increment the power-up counter and power up the hardware really when |
3609 | * not turned on yet. | 3618 | * not turned on yet. |
3610 | */ | 3619 | */ |
3611 | void snd_hda_power_up(struct hda_codec *codec) | 3620 | void snd_hda_power_up(struct hda_codec *codec) |
3612 | { | 3621 | { |
3613 | struct hda_bus *bus = codec->bus; | 3622 | struct hda_bus *bus = codec->bus; |
@@ -3636,7 +3645,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up); | |||
3636 | * | 3645 | * |
3637 | * Decrement the power-up counter and schedules the power-off work if | 3646 | * Decrement the power-up counter and schedules the power-off work if |
3638 | * the counter rearches to zero. | 3647 | * the counter rearches to zero. |
3639 | */ | 3648 | */ |
3640 | void snd_hda_power_down(struct hda_codec *codec) | 3649 | void snd_hda_power_down(struct hda_codec *codec) |
3641 | { | 3650 | { |
3642 | --codec->power_count; | 3651 | --codec->power_count; |
@@ -3662,7 +3671,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_down); | |||
3662 | * | 3671 | * |
3663 | * This function is supposed to be set or called from the check_power_status | 3672 | * This function is supposed to be set or called from the check_power_status |
3664 | * patch ops. | 3673 | * patch ops. |
3665 | */ | 3674 | */ |
3666 | int snd_hda_check_amp_list_power(struct hda_codec *codec, | 3675 | int snd_hda_check_amp_list_power(struct hda_codec *codec, |
3667 | struct hda_loopback_check *check, | 3676 | struct hda_loopback_check *check, |
3668 | hda_nid_t nid) | 3677 | hda_nid_t nid) |
@@ -3830,7 +3839,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, | |||
3830 | { | 3839 | { |
3831 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 3840 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
3832 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) | 3841 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
3833 | set_dig_out_convert(codec, nid, | 3842 | set_dig_out_convert(codec, nid, |
3834 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, | 3843 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, |
3835 | -1); | 3844 | -1); |
3836 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | 3845 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
@@ -4089,13 +4098,13 @@ static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) | |||
4089 | /* | 4098 | /* |
4090 | * Sort an associated group of pins according to their sequence numbers. | 4099 | * Sort an associated group of pins according to their sequence numbers. |
4091 | */ | 4100 | */ |
4092 | static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, | 4101 | static void sort_pins_by_sequence(hda_nid_t *pins, short *sequences, |
4093 | int num_pins) | 4102 | int num_pins) |
4094 | { | 4103 | { |
4095 | int i, j; | 4104 | int i, j; |
4096 | short seq; | 4105 | short seq; |
4097 | hda_nid_t nid; | 4106 | hda_nid_t nid; |
4098 | 4107 | ||
4099 | for (i = 0; i < num_pins; i++) { | 4108 | for (i = 0; i < num_pins; i++) { |
4100 | for (j = i + 1; j < num_pins; j++) { | 4109 | for (j = i + 1; j < num_pins; j++) { |
4101 | if (sequences[i] > sequences[j]) { | 4110 | if (sequences[i] > sequences[j]) { |
@@ -4123,7 +4132,7 @@ static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, | |||
4123 | * is detected, one of speaker of HP pins is assigned as the primary | 4132 | * is detected, one of speaker of HP pins is assigned as the primary |
4124 | * output, i.e. to line_out_pins[0]. So, line_outs is always positive | 4133 | * output, i.e. to line_out_pins[0]. So, line_outs is always positive |
4125 | * if any analog output exists. | 4134 | * if any analog output exists. |
4126 | * | 4135 | * |
4127 | * The analog input pins are assigned to input_pins array. | 4136 | * The analog input pins are assigned to input_pins array. |
4128 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, | 4137 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, |
4129 | * respectively. | 4138 | * respectively. |
@@ -4186,9 +4195,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4186 | case AC_JACK_SPEAKER: | 4195 | case AC_JACK_SPEAKER: |
4187 | seq = get_defcfg_sequence(def_conf); | 4196 | seq = get_defcfg_sequence(def_conf); |
4188 | assoc = get_defcfg_association(def_conf); | 4197 | assoc = get_defcfg_association(def_conf); |
4189 | if (! assoc) | 4198 | if (!assoc) |
4190 | continue; | 4199 | continue; |
4191 | if (! assoc_speaker) | 4200 | if (!assoc_speaker) |
4192 | assoc_speaker = assoc; | 4201 | assoc_speaker = assoc; |
4193 | else if (assoc_speaker != assoc) | 4202 | else if (assoc_speaker != assoc) |
4194 | continue; | 4203 | continue; |
@@ -4286,7 +4295,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4286 | cfg->speaker_outs); | 4295 | cfg->speaker_outs); |
4287 | sort_pins_by_sequence(cfg->hp_pins, sequences_hp, | 4296 | sort_pins_by_sequence(cfg->hp_pins, sequences_hp, |
4288 | cfg->hp_outs); | 4297 | cfg->hp_outs); |
4289 | 4298 | ||
4290 | /* if we have only one mic, make it AUTO_PIN_MIC */ | 4299 | /* if we have only one mic, make it AUTO_PIN_MIC */ |
4291 | if (!cfg->input_pins[AUTO_PIN_MIC] && | 4300 | if (!cfg->input_pins[AUTO_PIN_MIC] && |
4292 | cfg->input_pins[AUTO_PIN_FRONT_MIC]) { | 4301 | cfg->input_pins[AUTO_PIN_FRONT_MIC]) { |
@@ -4436,7 +4445,7 @@ EXPORT_SYMBOL_HDA(snd_hda_resume); | |||
4436 | /** | 4445 | /** |
4437 | * snd_array_new - get a new element from the given array | 4446 | * snd_array_new - get a new element from the given array |
4438 | * @array: the array object | 4447 | * @array: the array object |
4439 | * | 4448 | * |
4440 | * Get a new element from the given array. If it exceeds the | 4449 | * Get a new element from the given array. If it exceeds the |
4441 | * pre-allocated array size, re-allocate the array. | 4450 | * pre-allocated array size, re-allocate the array. |
4442 | * | 4451 | * |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 4228f2fe5956..d8da18a9e98b 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/slab.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include <asm/unaligned.h> | 27 | #include <asm/unaligned.h> |
27 | #include "hda_codec.h" | 28 | #include "hda_codec.h" |
@@ -331,6 +332,7 @@ int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid) | |||
331 | return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, | 332 | return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, |
332 | AC_DIPSIZE_ELD_BUF); | 333 | AC_DIPSIZE_ELD_BUF); |
333 | } | 334 | } |
335 | EXPORT_SYMBOL_HDA(snd_hdmi_get_eld_size); | ||
334 | 336 | ||
335 | int snd_hdmi_get_eld(struct hdmi_eld *eld, | 337 | int snd_hdmi_get_eld(struct hdmi_eld *eld, |
336 | struct hda_codec *codec, hda_nid_t nid) | 338 | struct hda_codec *codec, hda_nid_t nid) |
@@ -366,6 +368,7 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
366 | kfree(buf); | 368 | kfree(buf); |
367 | return ret; | 369 | return ret; |
368 | } | 370 | } |
371 | EXPORT_SYMBOL_HDA(snd_hdmi_get_eld); | ||
369 | 372 | ||
370 | static void hdmi_show_short_audio_desc(struct cea_sad *a) | 373 | static void hdmi_show_short_audio_desc(struct cea_sad *a) |
371 | { | 374 | { |
@@ -404,6 +407,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) | |||
404 | } | 407 | } |
405 | buf[j] = '\0'; /* necessary when j == 0 */ | 408 | buf[j] = '\0'; /* necessary when j == 0 */ |
406 | } | 409 | } |
410 | EXPORT_SYMBOL_HDA(snd_print_channel_allocation); | ||
407 | 411 | ||
408 | void snd_hdmi_show_eld(struct hdmi_eld *e) | 412 | void snd_hdmi_show_eld(struct hdmi_eld *e) |
409 | { | 413 | { |
@@ -422,6 +426,7 @@ void snd_hdmi_show_eld(struct hdmi_eld *e) | |||
422 | for (i = 0; i < e->sad_count; i++) | 426 | for (i = 0; i < e->sad_count; i++) |
423 | hdmi_show_short_audio_desc(e->sad + i); | 427 | hdmi_show_short_audio_desc(e->sad + i); |
424 | } | 428 | } |
429 | EXPORT_SYMBOL_HDA(snd_hdmi_show_eld); | ||
425 | 430 | ||
426 | #ifdef CONFIG_PROC_FS | 431 | #ifdef CONFIG_PROC_FS |
427 | 432 | ||
@@ -580,6 +585,7 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld, | |||
580 | 585 | ||
581 | return 0; | 586 | return 0; |
582 | } | 587 | } |
588 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_new); | ||
583 | 589 | ||
584 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | 590 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) |
585 | { | 591 | { |
@@ -588,5 +594,6 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | |||
588 | eld->proc_entry = NULL; | 594 | eld->proc_entry = NULL; |
589 | } | 595 | } |
590 | } | 596 | } |
597 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free); | ||
591 | 598 | ||
592 | #endif /* CONFIG_PROC_FS */ | 599 | #endif /* CONFIG_PROC_FS */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d5c93ad852ee..cec68152dcb1 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -267,7 +267,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
267 | #define RIRB_INT_MASK 0x05 | 267 | #define RIRB_INT_MASK 0x05 |
268 | 268 | ||
269 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ | 269 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ |
270 | #define AZX_MAX_CODECS 4 | 270 | #define AZX_MAX_CODECS 8 |
271 | #define AZX_DEFAULT_CODECS 4 | ||
271 | #define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) | 272 | #define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) |
272 | 273 | ||
273 | /* SD_CTL bits */ | 274 | /* SD_CTL bits */ |
@@ -1367,6 +1368,7 @@ static void azx_bus_reset(struct hda_bus *bus) | |||
1367 | 1368 | ||
1368 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ | 1369 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ |
1369 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | 1370 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { |
1371 | [AZX_DRIVER_NVIDIA] = 8, | ||
1370 | [AZX_DRIVER_TERA] = 1, | 1372 | [AZX_DRIVER_TERA] = 1, |
1371 | }; | 1373 | }; |
1372 | 1374 | ||
@@ -1399,7 +1401,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model) | |||
1399 | codecs = 0; | 1401 | codecs = 0; |
1400 | max_slots = azx_max_codecs[chip->driver_type]; | 1402 | max_slots = azx_max_codecs[chip->driver_type]; |
1401 | if (!max_slots) | 1403 | if (!max_slots) |
1402 | max_slots = AZX_MAX_CODECS; | 1404 | max_slots = AZX_DEFAULT_CODECS; |
1403 | 1405 | ||
1404 | /* First try to probe all given codec slots */ | 1406 | /* First try to probe all given codec slots */ |
1405 | for (c = 0; c < max_slots; c++) { | 1407 | for (c = 0; c < max_slots; c++) { |
@@ -2263,10 +2265,16 @@ static int azx_dev_free(struct snd_device *device) | |||
2263 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { | 2265 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { |
2264 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2266 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
2265 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2267 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
2268 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), | ||
2266 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2269 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
2267 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), | 2270 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), |
2268 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2271 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2272 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), | ||
2269 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), | 2273 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), |
2274 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), | ||
2275 | SND_PCI_QUIRK(0x1565, 0x8218, "Biostar Microtech", POS_FIX_LPIB), | ||
2276 | SND_PCI_QUIRK(0x8086, 0x2503, "DG965OT AAD63733-203", POS_FIX_LPIB), | ||
2277 | SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB), | ||
2270 | {} | 2278 | {} |
2271 | }; | 2279 | }; |
2272 | 2280 | ||
@@ -2354,6 +2362,9 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2354 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { | 2362 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { |
2355 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ | 2363 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ |
2356 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ | 2364 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ |
2365 | SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ | ||
2366 | SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ | ||
2367 | SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */ | ||
2357 | {} | 2368 | {} |
2358 | }; | 2369 | }; |
2359 | 2370 | ||
@@ -2372,6 +2383,13 @@ static void __devinit check_msi(struct azx *chip) | |||
2372 | "hda_intel: msi for device %04x:%04x set to %d\n", | 2383 | "hda_intel: msi for device %04x:%04x set to %d\n", |
2373 | q->subvendor, q->subdevice, q->value); | 2384 | q->subvendor, q->subdevice, q->value); |
2374 | chip->msi = q->value; | 2385 | chip->msi = q->value; |
2386 | return; | ||
2387 | } | ||
2388 | |||
2389 | /* NVidia chipsets seem to cause troubles with MSI */ | ||
2390 | if (chip->driver_type == AZX_DRIVER_NVIDIA) { | ||
2391 | printk(KERN_INFO "hda_intel: Disable MSI for Nvidia chipset\n"); | ||
2392 | chip->msi = 0; | ||
2375 | } | 2393 | } |
2376 | } | 2394 | } |
2377 | 2395 | ||
@@ -2700,6 +2718,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
2700 | { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH }, | 2718 | { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH }, |
2701 | /* PCH */ | 2719 | /* PCH */ |
2702 | { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_ICH }, | 2720 | { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_ICH }, |
2721 | { PCI_DEVICE(0x8086, 0x3b57), .driver_data = AZX_DRIVER_ICH }, | ||
2703 | /* CPT */ | 2722 | /* CPT */ |
2704 | { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, | 2723 | { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, |
2705 | /* SCH */ | 2724 | /* SCH */ |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e6d1bdff1b6e..e9fdfc4b1c57 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -519,14 +519,6 @@ static int ad198x_suspend(struct hda_codec *codec, pm_message_t state) | |||
519 | ad198x_power_eapd(codec); | 519 | ad198x_power_eapd(codec); |
520 | return 0; | 520 | return 0; |
521 | } | 521 | } |
522 | |||
523 | static int ad198x_resume(struct hda_codec *codec) | ||
524 | { | ||
525 | ad198x_init(codec); | ||
526 | snd_hda_codec_resume_amp(codec); | ||
527 | snd_hda_codec_resume_cache(codec); | ||
528 | return 0; | ||
529 | } | ||
530 | #endif | 522 | #endif |
531 | 523 | ||
532 | static struct hda_codec_ops ad198x_patch_ops = { | 524 | static struct hda_codec_ops ad198x_patch_ops = { |
@@ -539,7 +531,6 @@ static struct hda_codec_ops ad198x_patch_ops = { | |||
539 | #endif | 531 | #endif |
540 | #ifdef SND_HDA_NEEDS_RESUME | 532 | #ifdef SND_HDA_NEEDS_RESUME |
541 | .suspend = ad198x_suspend, | 533 | .suspend = ad198x_suspend, |
542 | .resume = ad198x_resume, | ||
543 | #endif | 534 | #endif |
544 | .reboot_notify = ad198x_shutup, | 535 | .reboot_notify = ad198x_shutup, |
545 | }; | 536 | }; |
@@ -1896,6 +1887,14 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1896 | case AD1981_THINKPAD: | 1887 | case AD1981_THINKPAD: |
1897 | spec->mixers[0] = ad1981_thinkpad_mixers; | 1888 | spec->mixers[0] = ad1981_thinkpad_mixers; |
1898 | spec->input_mux = &ad1981_thinkpad_capture_source; | 1889 | spec->input_mux = &ad1981_thinkpad_capture_source; |
1890 | /* set the upper-limit for mixer amp to 0dB for avoiding the | ||
1891 | * possible damage by overloading | ||
1892 | */ | ||
1893 | snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, | ||
1894 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
1895 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
1896 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
1897 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
1899 | break; | 1898 | break; |
1900 | case AD1981_TOSHIBA: | 1899 | case AD1981_TOSHIBA: |
1901 | spec->mixers[0] = ad1981_hp_mixers; | 1900 | spec->mixers[0] = ad1981_hp_mixers; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 194a28c54992..61682e1d09da 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -1591,6 +1591,21 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1591 | #endif | 1591 | #endif |
1592 | } | 1592 | } |
1593 | spec->vmaster_nid = 0x13; | 1593 | spec->vmaster_nid = 0x13; |
1594 | |||
1595 | switch (codec->subsystem_id >> 16) { | ||
1596 | case 0x103c: | ||
1597 | /* HP laptops have really bad sound over 0 dB on NID 0x10. | ||
1598 | * Fix max PCM level to 0 dB (originally it has 0x1e steps | ||
1599 | * with 0 dB offset 0x17) | ||
1600 | */ | ||
1601 | snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, | ||
1602 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
1603 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
1604 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
1605 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
1606 | break; | ||
1607 | } | ||
1608 | |||
1594 | return 0; | 1609 | return 0; |
1595 | } | 1610 | } |
1596 | 1611 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c new file mode 100644 index 000000000000..2c2bafbf0258 --- /dev/null +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -0,0 +1,849 @@ | |||
1 | /* | ||
2 | * | ||
3 | * patch_hdmi.c - routines for HDMI/DisplayPort codecs | ||
4 | * | ||
5 | * Copyright(c) 2008-2010 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * Authors: | ||
8 | * Wu Fengguang <wfg@linux.intel.com> | ||
9 | * | ||
10 | * Maintained by: | ||
11 | * Wu Fengguang <wfg@linux.intel.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the Free | ||
15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
16 | * any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but | ||
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
20 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
21 | * for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software Foundation, | ||
25 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
26 | */ | ||
27 | |||
28 | |||
29 | struct hdmi_spec { | ||
30 | int num_cvts; | ||
31 | int num_pins; | ||
32 | hda_nid_t cvt[MAX_HDMI_CVTS+1]; /* audio sources */ | ||
33 | hda_nid_t pin[MAX_HDMI_PINS+1]; /* audio sinks */ | ||
34 | |||
35 | /* | ||
36 | * source connection for each pin | ||
37 | */ | ||
38 | hda_nid_t pin_cvt[MAX_HDMI_PINS+1]; | ||
39 | |||
40 | /* | ||
41 | * HDMI sink attached to each pin | ||
42 | */ | ||
43 | struct hdmi_eld sink_eld[MAX_HDMI_PINS]; | ||
44 | |||
45 | /* | ||
46 | * export one pcm per pipe | ||
47 | */ | ||
48 | struct hda_pcm pcm_rec[MAX_HDMI_CVTS]; | ||
49 | |||
50 | /* | ||
51 | * nvhdmi specific | ||
52 | */ | ||
53 | struct hda_multi_out multiout; | ||
54 | unsigned int codec_type; | ||
55 | }; | ||
56 | |||
57 | |||
58 | struct hdmi_audio_infoframe { | ||
59 | u8 type; /* 0x84 */ | ||
60 | u8 ver; /* 0x01 */ | ||
61 | u8 len; /* 0x0a */ | ||
62 | |||
63 | u8 checksum; /* PB0 */ | ||
64 | u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */ | ||
65 | u8 SS01_SF24; | ||
66 | u8 CXT04; | ||
67 | u8 CA; | ||
68 | u8 LFEPBL01_LSV36_DM_INH7; | ||
69 | u8 reserved[5]; /* PB6 - PB10 */ | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * CEA speaker placement: | ||
74 | * | ||
75 | * FLH FCH FRH | ||
76 | * FLW FL FLC FC FRC FR FRW | ||
77 | * | ||
78 | * LFE | ||
79 | * TC | ||
80 | * | ||
81 | * RL RLC RC RRC RR | ||
82 | * | ||
83 | * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M corresponds to | ||
84 | * CEA RL/RR; The SMPTE channel _assignment_ C/LFE is swapped to CEA LFE/FC. | ||
85 | */ | ||
86 | enum cea_speaker_placement { | ||
87 | FL = (1 << 0), /* Front Left */ | ||
88 | FC = (1 << 1), /* Front Center */ | ||
89 | FR = (1 << 2), /* Front Right */ | ||
90 | FLC = (1 << 3), /* Front Left Center */ | ||
91 | FRC = (1 << 4), /* Front Right Center */ | ||
92 | RL = (1 << 5), /* Rear Left */ | ||
93 | RC = (1 << 6), /* Rear Center */ | ||
94 | RR = (1 << 7), /* Rear Right */ | ||
95 | RLC = (1 << 8), /* Rear Left Center */ | ||
96 | RRC = (1 << 9), /* Rear Right Center */ | ||
97 | LFE = (1 << 10), /* Low Frequency Effect */ | ||
98 | FLW = (1 << 11), /* Front Left Wide */ | ||
99 | FRW = (1 << 12), /* Front Right Wide */ | ||
100 | FLH = (1 << 13), /* Front Left High */ | ||
101 | FCH = (1 << 14), /* Front Center High */ | ||
102 | FRH = (1 << 15), /* Front Right High */ | ||
103 | TC = (1 << 16), /* Top Center */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * ELD SA bits in the CEA Speaker Allocation data block | ||
108 | */ | ||
109 | static int eld_speaker_allocation_bits[] = { | ||
110 | [0] = FL | FR, | ||
111 | [1] = LFE, | ||
112 | [2] = FC, | ||
113 | [3] = RL | RR, | ||
114 | [4] = RC, | ||
115 | [5] = FLC | FRC, | ||
116 | [6] = RLC | RRC, | ||
117 | /* the following are not defined in ELD yet */ | ||
118 | [7] = FLW | FRW, | ||
119 | [8] = FLH | FRH, | ||
120 | [9] = TC, | ||
121 | [10] = FCH, | ||
122 | }; | ||
123 | |||
124 | struct cea_channel_speaker_allocation { | ||
125 | int ca_index; | ||
126 | int speakers[8]; | ||
127 | |||
128 | /* derived values, just for convenience */ | ||
129 | int channels; | ||
130 | int spk_mask; | ||
131 | }; | ||
132 | |||
133 | /* | ||
134 | * ALSA sequence is: | ||
135 | * | ||
136 | * surround40 surround41 surround50 surround51 surround71 | ||
137 | * ch0 front left = = = = | ||
138 | * ch1 front right = = = = | ||
139 | * ch2 rear left = = = = | ||
140 | * ch3 rear right = = = = | ||
141 | * ch4 LFE center center center | ||
142 | * ch5 LFE LFE | ||
143 | * ch6 side left | ||
144 | * ch7 side right | ||
145 | * | ||
146 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
147 | */ | ||
148 | static int hdmi_channel_mapping[0x32][8] = { | ||
149 | /* stereo */ | ||
150 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
151 | /* 2.1 */ | ||
152 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
153 | /* Dolby Surround */ | ||
154 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
155 | /* surround40 */ | ||
156 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
157 | /* 4ch */ | ||
158 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
159 | /* surround41 */ | ||
160 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
161 | /* surround50 */ | ||
162 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
163 | /* surround51 */ | ||
164 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
165 | /* 7.1 */ | ||
166 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
167 | }; | ||
168 | |||
169 | /* | ||
170 | * This is an ordered list! | ||
171 | * | ||
172 | * The preceding ones have better chances to be selected by | ||
173 | * hdmi_setup_channel_allocation(). | ||
174 | */ | ||
175 | static struct cea_channel_speaker_allocation channel_allocations[] = { | ||
176 | /* channel: 7 6 5 4 3 2 1 0 */ | ||
177 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | ||
178 | /* 2.1 */ | ||
179 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | ||
180 | /* Dolby Surround */ | ||
181 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | ||
182 | /* surround40 */ | ||
183 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
184 | /* surround41 */ | ||
185 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
186 | /* surround50 */ | ||
187 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
188 | /* surround51 */ | ||
189 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
190 | /* 6.1 */ | ||
191 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
192 | /* surround71 */ | ||
193 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
194 | |||
195 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | ||
196 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | ||
197 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | ||
198 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | ||
199 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | ||
200 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | ||
201 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | ||
202 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | ||
203 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | ||
204 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | ||
205 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | ||
206 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | ||
207 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | ||
208 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | ||
209 | { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, | ||
210 | { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, | ||
211 | { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, | ||
212 | { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, | ||
213 | { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, | ||
214 | { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, | ||
215 | { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, | ||
216 | { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, | ||
217 | { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, | ||
218 | { .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, | ||
219 | { .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
220 | { .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, | ||
221 | { .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, | ||
222 | { .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, | ||
223 | { .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, | ||
224 | { .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, | ||
225 | { .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, | ||
226 | { .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, | ||
227 | { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, | ||
228 | { .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, | ||
229 | { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, | ||
230 | { .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, | ||
231 | { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
232 | { .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, | ||
233 | { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, | ||
234 | { .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, | ||
235 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | ||
236 | }; | ||
237 | |||
238 | |||
239 | /* | ||
240 | * HDMI routines | ||
241 | */ | ||
242 | |||
243 | static int hda_node_index(hda_nid_t *nids, hda_nid_t nid) | ||
244 | { | ||
245 | int i; | ||
246 | |||
247 | for (i = 0; nids[i]; i++) | ||
248 | if (nids[i] == nid) | ||
249 | return i; | ||
250 | |||
251 | snd_printk(KERN_WARNING "HDMI: nid %d not registered\n", nid); | ||
252 | return -EINVAL; | ||
253 | } | ||
254 | |||
255 | static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid, | ||
256 | struct hdmi_eld *eld) | ||
257 | { | ||
258 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | ||
259 | snd_hdmi_show_eld(eld); | ||
260 | } | ||
261 | |||
262 | #ifdef BE_PARANOID | ||
263 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
264 | int *packet_index, int *byte_index) | ||
265 | { | ||
266 | int val; | ||
267 | |||
268 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
269 | AC_VERB_GET_HDMI_DIP_INDEX, 0); | ||
270 | |||
271 | *packet_index = val >> 5; | ||
272 | *byte_index = val & 0x1f; | ||
273 | } | ||
274 | #endif | ||
275 | |||
276 | static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
277 | int packet_index, int byte_index) | ||
278 | { | ||
279 | int val; | ||
280 | |||
281 | val = (packet_index << 5) | (byte_index & 0x1f); | ||
282 | |||
283 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); | ||
284 | } | ||
285 | |||
286 | static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, | ||
287 | unsigned char val) | ||
288 | { | ||
289 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); | ||
290 | } | ||
291 | |||
292 | static void hdmi_enable_output(struct hda_codec *codec, hda_nid_t pin_nid) | ||
293 | { | ||
294 | /* Unmute */ | ||
295 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | ||
296 | snd_hda_codec_write(codec, pin_nid, 0, | ||
297 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
298 | /* Enable pin out */ | ||
299 | snd_hda_codec_write(codec, pin_nid, 0, | ||
300 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
301 | } | ||
302 | |||
303 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t nid) | ||
304 | { | ||
305 | return 1 + snd_hda_codec_read(codec, nid, 0, | ||
306 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | ||
307 | } | ||
308 | |||
309 | static void hdmi_set_channel_count(struct hda_codec *codec, | ||
310 | hda_nid_t nid, int chs) | ||
311 | { | ||
312 | if (chs != hdmi_get_channel_count(codec, nid)) | ||
313 | snd_hda_codec_write(codec, nid, 0, | ||
314 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | ||
315 | } | ||
316 | |||
317 | |||
318 | /* | ||
319 | * Channel mapping routines | ||
320 | */ | ||
321 | |||
322 | /* | ||
323 | * Compute derived values in channel_allocations[]. | ||
324 | */ | ||
325 | static void init_channel_allocations(void) | ||
326 | { | ||
327 | int i, j; | ||
328 | struct cea_channel_speaker_allocation *p; | ||
329 | |||
330 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
331 | p = channel_allocations + i; | ||
332 | p->channels = 0; | ||
333 | p->spk_mask = 0; | ||
334 | for (j = 0; j < ARRAY_SIZE(p->speakers); j++) | ||
335 | if (p->speakers[j]) { | ||
336 | p->channels++; | ||
337 | p->spk_mask |= p->speakers[j]; | ||
338 | } | ||
339 | } | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * The transformation takes two steps: | ||
344 | * | ||
345 | * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask | ||
346 | * spk_mask => (channel_allocations[]) => ai->CA | ||
347 | * | ||
348 | * TODO: it could select the wrong CA from multiple candidates. | ||
349 | */ | ||
350 | static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | ||
351 | struct hdmi_audio_infoframe *ai) | ||
352 | { | ||
353 | struct hdmi_spec *spec = codec->spec; | ||
354 | struct hdmi_eld *eld; | ||
355 | int i; | ||
356 | int spk_mask = 0; | ||
357 | int channels = 1 + (ai->CC02_CT47 & 0x7); | ||
358 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | ||
359 | |||
360 | /* | ||
361 | * CA defaults to 0 for basic stereo audio | ||
362 | */ | ||
363 | if (channels <= 2) | ||
364 | return 0; | ||
365 | |||
366 | i = hda_node_index(spec->pin_cvt, nid); | ||
367 | if (i < 0) | ||
368 | return 0; | ||
369 | eld = &spec->sink_eld[i]; | ||
370 | |||
371 | /* | ||
372 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
373 | * in console or for audio devices. Assume the highest speakers | ||
374 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
375 | */ | ||
376 | if (!eld->spk_alloc) | ||
377 | eld->spk_alloc = 0xffff; | ||
378 | |||
379 | /* | ||
380 | * expand ELD's speaker allocation mask | ||
381 | * | ||
382 | * ELD tells the speaker mask in a compact(paired) form, | ||
383 | * expand ELD's notions to match the ones used by Audio InfoFrame. | ||
384 | */ | ||
385 | for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { | ||
386 | if (eld->spk_alloc & (1 << i)) | ||
387 | spk_mask |= eld_speaker_allocation_bits[i]; | ||
388 | } | ||
389 | |||
390 | /* search for the first working match in the CA table */ | ||
391 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
392 | if (channels == channel_allocations[i].channels && | ||
393 | (spk_mask & channel_allocations[i].spk_mask) == | ||
394 | channel_allocations[i].spk_mask) { | ||
395 | ai->CA = channel_allocations[i].ca_index; | ||
396 | break; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | snd_print_channel_allocation(eld->spk_alloc, buf, sizeof(buf)); | ||
401 | snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", | ||
402 | ai->CA, channels, buf); | ||
403 | |||
404 | return ai->CA; | ||
405 | } | ||
406 | |||
407 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, | ||
408 | hda_nid_t pin_nid) | ||
409 | { | ||
410 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
411 | int i; | ||
412 | int slot; | ||
413 | |||
414 | for (i = 0; i < 8; i++) { | ||
415 | slot = snd_hda_codec_read(codec, pin_nid, 0, | ||
416 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | ||
417 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | ||
418 | slot >> 4, slot & 0xf); | ||
419 | } | ||
420 | #endif | ||
421 | } | ||
422 | |||
423 | |||
424 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
425 | hda_nid_t pin_nid, | ||
426 | struct hdmi_audio_infoframe *ai) | ||
427 | { | ||
428 | int i; | ||
429 | int ca = ai->CA; | ||
430 | int err; | ||
431 | |||
432 | if (hdmi_channel_mapping[ca][1] == 0) { | ||
433 | for (i = 0; i < channel_allocations[ca].channels; i++) | ||
434 | hdmi_channel_mapping[ca][i] = i | (i << 4); | ||
435 | for (; i < 8; i++) | ||
436 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | ||
437 | } | ||
438 | |||
439 | for (i = 0; i < 8; i++) { | ||
440 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
441 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
442 | hdmi_channel_mapping[ca][i]); | ||
443 | if (err) { | ||
444 | snd_printdd(KERN_NOTICE | ||
445 | "HDMI: channel mapping failed\n"); | ||
446 | break; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | hdmi_debug_channel_mapping(codec, pin_nid); | ||
451 | } | ||
452 | |||
453 | |||
454 | /* | ||
455 | * Audio InfoFrame routines | ||
456 | */ | ||
457 | |||
458 | /* | ||
459 | * Enable Audio InfoFrame Transmission | ||
460 | */ | ||
461 | static void hdmi_start_infoframe_trans(struct hda_codec *codec, | ||
462 | hda_nid_t pin_nid) | ||
463 | { | ||
464 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
465 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
466 | AC_DIPXMIT_BEST); | ||
467 | } | ||
468 | |||
469 | /* | ||
470 | * Disable Audio InfoFrame Transmission | ||
471 | */ | ||
472 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec, | ||
473 | hda_nid_t pin_nid) | ||
474 | { | ||
475 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
476 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
477 | AC_DIPXMIT_DISABLE); | ||
478 | } | ||
479 | |||
480 | static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) | ||
481 | { | ||
482 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
483 | int i; | ||
484 | int size; | ||
485 | |||
486 | size = snd_hdmi_get_eld_size(codec, pin_nid); | ||
487 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | ||
488 | |||
489 | for (i = 0; i < 8; i++) { | ||
490 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
491 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
492 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | ||
493 | } | ||
494 | #endif | ||
495 | } | ||
496 | |||
497 | static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) | ||
498 | { | ||
499 | #ifdef BE_PARANOID | ||
500 | int i, j; | ||
501 | int size; | ||
502 | int pi, bi; | ||
503 | for (i = 0; i < 8; i++) { | ||
504 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
505 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
506 | if (size == 0) | ||
507 | continue; | ||
508 | |||
509 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); | ||
510 | for (j = 1; j < 1000; j++) { | ||
511 | hdmi_write_dip_byte(codec, pin_nid, 0x0); | ||
512 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); | ||
513 | if (pi != i) | ||
514 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | ||
515 | bi, pi, i); | ||
516 | if (bi == 0) /* byte index wrapped around */ | ||
517 | break; | ||
518 | } | ||
519 | snd_printd(KERN_INFO | ||
520 | "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", | ||
521 | i, size, j); | ||
522 | } | ||
523 | #endif | ||
524 | } | ||
525 | |||
526 | static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *ai) | ||
527 | { | ||
528 | u8 *bytes = (u8 *)ai; | ||
529 | u8 sum = 0; | ||
530 | int i; | ||
531 | |||
532 | ai->checksum = 0; | ||
533 | |||
534 | for (i = 0; i < sizeof(*ai); i++) | ||
535 | sum += bytes[i]; | ||
536 | |||
537 | ai->checksum = -sum; | ||
538 | } | ||
539 | |||
540 | static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | ||
541 | hda_nid_t pin_nid, | ||
542 | struct hdmi_audio_infoframe *ai) | ||
543 | { | ||
544 | u8 *bytes = (u8 *)ai; | ||
545 | int i; | ||
546 | |||
547 | hdmi_debug_dip_size(codec, pin_nid); | ||
548 | hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ | ||
549 | |||
550 | hdmi_checksum_audio_infoframe(ai); | ||
551 | |||
552 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
553 | for (i = 0; i < sizeof(*ai); i++) | ||
554 | hdmi_write_dip_byte(codec, pin_nid, bytes[i]); | ||
555 | } | ||
556 | |||
557 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | ||
558 | struct hdmi_audio_infoframe *ai) | ||
559 | { | ||
560 | u8 *bytes = (u8 *)ai; | ||
561 | u8 val; | ||
562 | int i; | ||
563 | |||
564 | if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) | ||
565 | != AC_DIPXMIT_BEST) | ||
566 | return false; | ||
567 | |||
568 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
569 | for (i = 0; i < sizeof(*ai); i++) { | ||
570 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
571 | AC_VERB_GET_HDMI_DIP_DATA, 0); | ||
572 | if (val != bytes[i]) | ||
573 | return false; | ||
574 | } | ||
575 | |||
576 | return true; | ||
577 | } | ||
578 | |||
579 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | ||
580 | struct snd_pcm_substream *substream) | ||
581 | { | ||
582 | struct hdmi_spec *spec = codec->spec; | ||
583 | hda_nid_t pin_nid; | ||
584 | int i; | ||
585 | struct hdmi_audio_infoframe ai = { | ||
586 | .type = 0x84, | ||
587 | .ver = 0x01, | ||
588 | .len = 0x0a, | ||
589 | .CC02_CT47 = substream->runtime->channels - 1, | ||
590 | }; | ||
591 | |||
592 | hdmi_setup_channel_allocation(codec, nid, &ai); | ||
593 | |||
594 | for (i = 0; i < spec->num_pins; i++) { | ||
595 | if (spec->pin_cvt[i] != nid) | ||
596 | continue; | ||
597 | if (!spec->sink_eld[i].monitor_present) | ||
598 | continue; | ||
599 | |||
600 | pin_nid = spec->pin[i]; | ||
601 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | ||
602 | snd_printdd("hdmi_setup_audio_infoframe: " | ||
603 | "cvt=%d pin=%d channels=%d\n", | ||
604 | nid, pin_nid, | ||
605 | substream->runtime->channels); | ||
606 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
607 | hdmi_stop_infoframe_trans(codec, pin_nid); | ||
608 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | ||
609 | hdmi_start_infoframe_trans(codec, pin_nid); | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | |||
614 | |||
615 | /* | ||
616 | * Unsolicited events | ||
617 | */ | ||
618 | |||
619 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
620 | { | ||
621 | struct hdmi_spec *spec = codec->spec; | ||
622 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
623 | int pind = !!(res & AC_UNSOL_RES_PD); | ||
624 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
625 | int index; | ||
626 | |||
627 | printk(KERN_INFO | ||
628 | "HDMI hot plug event: Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | ||
629 | tag, pind, eldv); | ||
630 | |||
631 | index = hda_node_index(spec->pin, tag); | ||
632 | if (index < 0) | ||
633 | return; | ||
634 | |||
635 | spec->sink_eld[index].monitor_present = pind; | ||
636 | spec->sink_eld[index].eld_valid = eldv; | ||
637 | |||
638 | if (pind && eldv) { | ||
639 | hdmi_get_show_eld(codec, spec->pin[index], | ||
640 | &spec->sink_eld[index]); | ||
641 | /* TODO: do real things about ELD */ | ||
642 | } | ||
643 | } | ||
644 | |||
645 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
646 | { | ||
647 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
648 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
649 | int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); | ||
650 | int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); | ||
651 | |||
652 | printk(KERN_INFO | ||
653 | "HDMI CP event: PIN=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", | ||
654 | tag, | ||
655 | subtag, | ||
656 | cp_state, | ||
657 | cp_ready); | ||
658 | |||
659 | /* TODO */ | ||
660 | if (cp_state) | ||
661 | ; | ||
662 | if (cp_ready) | ||
663 | ; | ||
664 | } | ||
665 | |||
666 | |||
667 | static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | ||
668 | { | ||
669 | struct hdmi_spec *spec = codec->spec; | ||
670 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
671 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
672 | |||
673 | if (hda_node_index(spec->pin, tag) < 0) { | ||
674 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | ||
675 | return; | ||
676 | } | ||
677 | |||
678 | if (subtag == 0) | ||
679 | hdmi_intrinsic_event(codec, res); | ||
680 | else | ||
681 | hdmi_non_intrinsic_event(codec, res); | ||
682 | } | ||
683 | |||
684 | /* | ||
685 | * Callbacks | ||
686 | */ | ||
687 | |||
688 | static void hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
689 | u32 stream_tag, int format) | ||
690 | { | ||
691 | int tag; | ||
692 | int fmt; | ||
693 | |||
694 | tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; | ||
695 | fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); | ||
696 | |||
697 | snd_printdd("hdmi_setup_stream: " | ||
698 | "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n", | ||
699 | nid, | ||
700 | tag == stream_tag ? "" : "new-", | ||
701 | stream_tag, | ||
702 | fmt == format ? "" : "new-", | ||
703 | format); | ||
704 | |||
705 | if (tag != stream_tag) | ||
706 | snd_hda_codec_write(codec, nid, 0, | ||
707 | AC_VERB_SET_CHANNEL_STREAMID, | ||
708 | stream_tag << 4); | ||
709 | if (fmt != format) | ||
710 | snd_hda_codec_write(codec, nid, 0, | ||
711 | AC_VERB_SET_STREAM_FORMAT, format); | ||
712 | } | ||
713 | |||
714 | /* | ||
715 | * HDA/HDMI auto parsing | ||
716 | */ | ||
717 | |||
718 | static int hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) | ||
719 | { | ||
720 | struct hdmi_spec *spec = codec->spec; | ||
721 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
722 | int conn_len, curr; | ||
723 | int index; | ||
724 | |||
725 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { | ||
726 | snd_printk(KERN_WARNING | ||
727 | "HDMI: pin %d wcaps %#x " | ||
728 | "does not support connection list\n", | ||
729 | pin_nid, get_wcaps(codec, pin_nid)); | ||
730 | return -EINVAL; | ||
731 | } | ||
732 | |||
733 | conn_len = snd_hda_get_connections(codec, pin_nid, conn_list, | ||
734 | HDA_MAX_CONNECTIONS); | ||
735 | if (conn_len > 1) | ||
736 | curr = snd_hda_codec_read(codec, pin_nid, 0, | ||
737 | AC_VERB_GET_CONNECT_SEL, 0); | ||
738 | else | ||
739 | curr = 0; | ||
740 | |||
741 | index = hda_node_index(spec->pin, pin_nid); | ||
742 | if (index < 0) | ||
743 | return -EINVAL; | ||
744 | |||
745 | spec->pin_cvt[index] = conn_list[curr]; | ||
746 | |||
747 | return 0; | ||
748 | } | ||
749 | |||
750 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | ||
751 | struct hdmi_eld *eld) | ||
752 | { | ||
753 | int present = snd_hda_pin_sense(codec, pin_nid); | ||
754 | |||
755 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | ||
756 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | ||
757 | |||
758 | if (present & AC_PINSENSE_ELDV) | ||
759 | hdmi_get_show_eld(codec, pin_nid, eld); | ||
760 | } | ||
761 | |||
762 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | ||
763 | { | ||
764 | struct hdmi_spec *spec = codec->spec; | ||
765 | |||
766 | if (spec->num_pins >= MAX_HDMI_PINS) { | ||
767 | snd_printk(KERN_WARNING | ||
768 | "HDMI: no space for pin %d\n", pin_nid); | ||
769 | return -EINVAL; | ||
770 | } | ||
771 | |||
772 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | ||
773 | |||
774 | spec->pin[spec->num_pins] = pin_nid; | ||
775 | spec->num_pins++; | ||
776 | |||
777 | /* | ||
778 | * It is assumed that converter nodes come first in the node list and | ||
779 | * hence have been registered and usable now. | ||
780 | */ | ||
781 | return hdmi_read_pin_conn(codec, pin_nid); | ||
782 | } | ||
783 | |||
784 | static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) | ||
785 | { | ||
786 | struct hdmi_spec *spec = codec->spec; | ||
787 | |||
788 | if (spec->num_cvts >= MAX_HDMI_CVTS) { | ||
789 | snd_printk(KERN_WARNING | ||
790 | "HDMI: no space for converter %d\n", nid); | ||
791 | return -EINVAL; | ||
792 | } | ||
793 | |||
794 | spec->cvt[spec->num_cvts] = nid; | ||
795 | spec->num_cvts++; | ||
796 | |||
797 | return 0; | ||
798 | } | ||
799 | |||
800 | static int hdmi_parse_codec(struct hda_codec *codec) | ||
801 | { | ||
802 | hda_nid_t nid; | ||
803 | int i, nodes; | ||
804 | |||
805 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); | ||
806 | if (!nid || nodes < 0) { | ||
807 | snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); | ||
808 | return -EINVAL; | ||
809 | } | ||
810 | |||
811 | for (i = 0; i < nodes; i++, nid++) { | ||
812 | unsigned int caps; | ||
813 | unsigned int type; | ||
814 | |||
815 | caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); | ||
816 | type = get_wcaps_type(caps); | ||
817 | |||
818 | if (!(caps & AC_WCAP_DIGITAL)) | ||
819 | continue; | ||
820 | |||
821 | switch (type) { | ||
822 | case AC_WID_AUD_OUT: | ||
823 | if (hdmi_add_cvt(codec, nid) < 0) | ||
824 | return -EINVAL; | ||
825 | break; | ||
826 | case AC_WID_PIN: | ||
827 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
828 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) | ||
829 | continue; | ||
830 | if (hdmi_add_pin(codec, nid) < 0) | ||
831 | return -EINVAL; | ||
832 | break; | ||
833 | } | ||
834 | } | ||
835 | |||
836 | /* | ||
837 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
838 | * can be lost and presence sense verb will become inaccurate if the | ||
839 | * HDA link is powered off at hot plug or hw initialization time. | ||
840 | */ | ||
841 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
842 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
843 | AC_PWRST_EPSS)) | ||
844 | codec->bus->power_keep_link_on = 1; | ||
845 | #endif | ||
846 | |||
847 | return 0; | ||
848 | } | ||
849 | |||
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 918f40378d52..88d035104cc5 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -40,815 +40,20 @@ | |||
40 | * | 40 | * |
41 | * The HDA correspondence of pipes/ports are converter/pin nodes. | 41 | * The HDA correspondence of pipes/ports are converter/pin nodes. |
42 | */ | 42 | */ |
43 | #define INTEL_HDMI_CVTS 2 | 43 | #define MAX_HDMI_CVTS 2 |
44 | #define INTEL_HDMI_PINS 3 | 44 | #define MAX_HDMI_PINS 3 |
45 | 45 | ||
46 | static char *intel_hdmi_pcm_names[INTEL_HDMI_CVTS] = { | 46 | #include "patch_hdmi.c" |
47 | |||
48 | static char *intel_hdmi_pcm_names[MAX_HDMI_CVTS] = { | ||
47 | "INTEL HDMI 0", | 49 | "INTEL HDMI 0", |
48 | "INTEL HDMI 1", | 50 | "INTEL HDMI 1", |
49 | }; | 51 | }; |
50 | 52 | ||
51 | struct intel_hdmi_spec { | ||
52 | int num_cvts; | ||
53 | int num_pins; | ||
54 | hda_nid_t cvt[INTEL_HDMI_CVTS+1]; /* audio sources */ | ||
55 | hda_nid_t pin[INTEL_HDMI_PINS+1]; /* audio sinks */ | ||
56 | |||
57 | /* | ||
58 | * source connection for each pin | ||
59 | */ | ||
60 | hda_nid_t pin_cvt[INTEL_HDMI_PINS+1]; | ||
61 | |||
62 | /* | ||
63 | * HDMI sink attached to each pin | ||
64 | */ | ||
65 | struct hdmi_eld sink_eld[INTEL_HDMI_PINS]; | ||
66 | |||
67 | /* | ||
68 | * export one pcm per pipe | ||
69 | */ | ||
70 | struct hda_pcm pcm_rec[INTEL_HDMI_CVTS]; | ||
71 | }; | ||
72 | |||
73 | struct hdmi_audio_infoframe { | ||
74 | u8 type; /* 0x84 */ | ||
75 | u8 ver; /* 0x01 */ | ||
76 | u8 len; /* 0x0a */ | ||
77 | |||
78 | u8 checksum; /* PB0 */ | ||
79 | u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */ | ||
80 | u8 SS01_SF24; | ||
81 | u8 CXT04; | ||
82 | u8 CA; | ||
83 | u8 LFEPBL01_LSV36_DM_INH7; | ||
84 | u8 reserved[5]; /* PB6 - PB10 */ | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * CEA speaker placement: | ||
89 | * | ||
90 | * FLH FCH FRH | ||
91 | * FLW FL FLC FC FRC FR FRW | ||
92 | * | ||
93 | * LFE | ||
94 | * TC | ||
95 | * | ||
96 | * RL RLC RC RRC RR | ||
97 | * | ||
98 | * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M corresponds to | ||
99 | * CEA RL/RR; The SMPTE channel _assignment_ C/LFE is swapped to CEA LFE/FC. | ||
100 | */ | ||
101 | enum cea_speaker_placement { | ||
102 | FL = (1 << 0), /* Front Left */ | ||
103 | FC = (1 << 1), /* Front Center */ | ||
104 | FR = (1 << 2), /* Front Right */ | ||
105 | FLC = (1 << 3), /* Front Left Center */ | ||
106 | FRC = (1 << 4), /* Front Right Center */ | ||
107 | RL = (1 << 5), /* Rear Left */ | ||
108 | RC = (1 << 6), /* Rear Center */ | ||
109 | RR = (1 << 7), /* Rear Right */ | ||
110 | RLC = (1 << 8), /* Rear Left Center */ | ||
111 | RRC = (1 << 9), /* Rear Right Center */ | ||
112 | LFE = (1 << 10), /* Low Frequency Effect */ | ||
113 | FLW = (1 << 11), /* Front Left Wide */ | ||
114 | FRW = (1 << 12), /* Front Right Wide */ | ||
115 | FLH = (1 << 13), /* Front Left High */ | ||
116 | FCH = (1 << 14), /* Front Center High */ | ||
117 | FRH = (1 << 15), /* Front Right High */ | ||
118 | TC = (1 << 16), /* Top Center */ | ||
119 | }; | ||
120 | |||
121 | /* | ||
122 | * ELD SA bits in the CEA Speaker Allocation data block | ||
123 | */ | ||
124 | static int eld_speaker_allocation_bits[] = { | ||
125 | [0] = FL | FR, | ||
126 | [1] = LFE, | ||
127 | [2] = FC, | ||
128 | [3] = RL | RR, | ||
129 | [4] = RC, | ||
130 | [5] = FLC | FRC, | ||
131 | [6] = RLC | RRC, | ||
132 | /* the following are not defined in ELD yet */ | ||
133 | [7] = FLW | FRW, | ||
134 | [8] = FLH | FRH, | ||
135 | [9] = TC, | ||
136 | [10] = FCH, | ||
137 | }; | ||
138 | |||
139 | struct cea_channel_speaker_allocation { | ||
140 | int ca_index; | ||
141 | int speakers[8]; | ||
142 | |||
143 | /* derived values, just for convenience */ | ||
144 | int channels; | ||
145 | int spk_mask; | ||
146 | }; | ||
147 | |||
148 | /* | ||
149 | * ALSA sequence is: | ||
150 | * | ||
151 | * surround40 surround41 surround50 surround51 surround71 | ||
152 | * ch0 front left = = = = | ||
153 | * ch1 front right = = = = | ||
154 | * ch2 rear left = = = = | ||
155 | * ch3 rear right = = = = | ||
156 | * ch4 LFE center center center | ||
157 | * ch5 LFE LFE | ||
158 | * ch6 side left | ||
159 | * ch7 side right | ||
160 | * | ||
161 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
162 | */ | ||
163 | static int hdmi_channel_mapping[0x32][8] = { | ||
164 | /* stereo */ | ||
165 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
166 | /* 2.1 */ | ||
167 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
168 | /* Dolby Surround */ | ||
169 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
170 | /* surround40 */ | ||
171 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
172 | /* 4ch */ | ||
173 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
174 | /* surround41 */ | ||
175 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
176 | /* surround50 */ | ||
177 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
178 | /* surround51 */ | ||
179 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
180 | /* 7.1 */ | ||
181 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
182 | }; | ||
183 | |||
184 | /* | ||
185 | * This is an ordered list! | ||
186 | * | ||
187 | * The preceding ones have better chances to be selected by | ||
188 | * hdmi_setup_channel_allocation(). | ||
189 | */ | ||
190 | static struct cea_channel_speaker_allocation channel_allocations[] = { | ||
191 | /* channel: 7 6 5 4 3 2 1 0 */ | ||
192 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | ||
193 | /* 2.1 */ | ||
194 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | ||
195 | /* Dolby Surround */ | ||
196 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | ||
197 | /* surround40 */ | ||
198 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
199 | /* surround41 */ | ||
200 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
201 | /* surround50 */ | ||
202 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
203 | /* surround51 */ | ||
204 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
205 | /* 6.1 */ | ||
206 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
207 | /* surround71 */ | ||
208 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
209 | |||
210 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | ||
211 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | ||
212 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | ||
213 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | ||
214 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | ||
215 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | ||
216 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | ||
217 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | ||
218 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | ||
219 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | ||
220 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | ||
221 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | ||
222 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | ||
223 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | ||
224 | { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, | ||
225 | { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, | ||
226 | { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, | ||
227 | { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, | ||
228 | { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, | ||
229 | { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, | ||
230 | { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, | ||
231 | { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, | ||
232 | { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, | ||
233 | { .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, | ||
234 | { .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
235 | { .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, | ||
236 | { .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, | ||
237 | { .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, | ||
238 | { .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, | ||
239 | { .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, | ||
240 | { .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, | ||
241 | { .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, | ||
242 | { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, | ||
243 | { .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, | ||
244 | { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, | ||
245 | { .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, | ||
246 | { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
247 | { .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, | ||
248 | { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, | ||
249 | { .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, | ||
250 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | ||
251 | }; | ||
252 | |||
253 | /* | ||
254 | * HDA/HDMI auto parsing | ||
255 | */ | ||
256 | |||
257 | static int hda_node_index(hda_nid_t *nids, hda_nid_t nid) | ||
258 | { | ||
259 | int i; | ||
260 | |||
261 | for (i = 0; nids[i]; i++) | ||
262 | if (nids[i] == nid) | ||
263 | return i; | ||
264 | |||
265 | snd_printk(KERN_WARNING "HDMI: nid %d not registered\n", nid); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | static int intel_hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) | ||
270 | { | ||
271 | struct intel_hdmi_spec *spec = codec->spec; | ||
272 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
273 | int conn_len, curr; | ||
274 | int index; | ||
275 | |||
276 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { | ||
277 | snd_printk(KERN_WARNING | ||
278 | "HDMI: pin %d wcaps %#x " | ||
279 | "does not support connection list\n", | ||
280 | pin_nid, get_wcaps(codec, pin_nid)); | ||
281 | return -EINVAL; | ||
282 | } | ||
283 | |||
284 | conn_len = snd_hda_get_connections(codec, pin_nid, conn_list, | ||
285 | HDA_MAX_CONNECTIONS); | ||
286 | if (conn_len > 1) | ||
287 | curr = snd_hda_codec_read(codec, pin_nid, 0, | ||
288 | AC_VERB_GET_CONNECT_SEL, 0); | ||
289 | else | ||
290 | curr = 0; | ||
291 | |||
292 | index = hda_node_index(spec->pin, pin_nid); | ||
293 | if (index < 0) | ||
294 | return -EINVAL; | ||
295 | |||
296 | spec->pin_cvt[index] = conn_list[curr]; | ||
297 | |||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid, | ||
302 | struct hdmi_eld *eld) | ||
303 | { | ||
304 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | ||
305 | snd_hdmi_show_eld(eld); | ||
306 | } | ||
307 | |||
308 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | ||
309 | struct hdmi_eld *eld) | ||
310 | { | ||
311 | int present = snd_hda_pin_sense(codec, pin_nid); | ||
312 | |||
313 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | ||
314 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | ||
315 | |||
316 | if (present & AC_PINSENSE_ELDV) | ||
317 | hdmi_get_show_eld(codec, pin_nid, eld); | ||
318 | } | ||
319 | |||
320 | static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | ||
321 | { | ||
322 | struct intel_hdmi_spec *spec = codec->spec; | ||
323 | |||
324 | if (spec->num_pins >= INTEL_HDMI_PINS) { | ||
325 | snd_printk(KERN_WARNING | ||
326 | "HDMI: no space for pin %d \n", pin_nid); | ||
327 | return -EINVAL; | ||
328 | } | ||
329 | |||
330 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | ||
331 | |||
332 | spec->pin[spec->num_pins] = pin_nid; | ||
333 | spec->num_pins++; | ||
334 | |||
335 | /* | ||
336 | * It is assumed that converter nodes come first in the node list and | ||
337 | * hence have been registered and usable now. | ||
338 | */ | ||
339 | return intel_hdmi_read_pin_conn(codec, pin_nid); | ||
340 | } | ||
341 | |||
342 | static int intel_hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) | ||
343 | { | ||
344 | struct intel_hdmi_spec *spec = codec->spec; | ||
345 | |||
346 | if (spec->num_cvts >= INTEL_HDMI_CVTS) { | ||
347 | snd_printk(KERN_WARNING | ||
348 | "HDMI: no space for converter %d \n", nid); | ||
349 | return -EINVAL; | ||
350 | } | ||
351 | |||
352 | spec->cvt[spec->num_cvts] = nid; | ||
353 | spec->num_cvts++; | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static int intel_hdmi_parse_codec(struct hda_codec *codec) | ||
359 | { | ||
360 | hda_nid_t nid; | ||
361 | int i, nodes; | ||
362 | |||
363 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); | ||
364 | if (!nid || nodes < 0) { | ||
365 | snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); | ||
366 | return -EINVAL; | ||
367 | } | ||
368 | |||
369 | for (i = 0; i < nodes; i++, nid++) { | ||
370 | unsigned int caps; | ||
371 | unsigned int type; | ||
372 | |||
373 | caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); | ||
374 | type = get_wcaps_type(caps); | ||
375 | |||
376 | if (!(caps & AC_WCAP_DIGITAL)) | ||
377 | continue; | ||
378 | |||
379 | switch (type) { | ||
380 | case AC_WID_AUD_OUT: | ||
381 | if (intel_hdmi_add_cvt(codec, nid) < 0) | ||
382 | return -EINVAL; | ||
383 | break; | ||
384 | case AC_WID_PIN: | ||
385 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
386 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) | ||
387 | continue; | ||
388 | if (intel_hdmi_add_pin(codec, nid) < 0) | ||
389 | return -EINVAL; | ||
390 | break; | ||
391 | } | ||
392 | } | ||
393 | |||
394 | /* | ||
395 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
396 | * can be lost and presence sense verb will become inaccurate if the | ||
397 | * HDA link is powered off at hot plug or hw initialization time. | ||
398 | */ | ||
399 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
400 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
401 | AC_PWRST_EPSS)) | ||
402 | codec->bus->power_keep_link_on = 1; | ||
403 | #endif | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | /* | ||
409 | * HDMI routines | ||
410 | */ | ||
411 | |||
412 | #ifdef BE_PARANOID | ||
413 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
414 | int *packet_index, int *byte_index) | ||
415 | { | ||
416 | int val; | ||
417 | |||
418 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
419 | AC_VERB_GET_HDMI_DIP_INDEX, 0); | ||
420 | |||
421 | *packet_index = val >> 5; | ||
422 | *byte_index = val & 0x1f; | ||
423 | } | ||
424 | #endif | ||
425 | |||
426 | static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
427 | int packet_index, int byte_index) | ||
428 | { | ||
429 | int val; | ||
430 | |||
431 | val = (packet_index << 5) | (byte_index & 0x1f); | ||
432 | |||
433 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); | ||
434 | } | ||
435 | |||
436 | static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, | ||
437 | unsigned char val) | ||
438 | { | ||
439 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); | ||
440 | } | ||
441 | |||
442 | static void hdmi_enable_output(struct hda_codec *codec, hda_nid_t pin_nid) | ||
443 | { | ||
444 | /* Unmute */ | ||
445 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | ||
446 | snd_hda_codec_write(codec, pin_nid, 0, | ||
447 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
448 | /* Enable pin out */ | ||
449 | snd_hda_codec_write(codec, pin_nid, 0, | ||
450 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
451 | } | ||
452 | |||
453 | /* | ||
454 | * Enable Audio InfoFrame Transmission | ||
455 | */ | ||
456 | static void hdmi_start_infoframe_trans(struct hda_codec *codec, | ||
457 | hda_nid_t pin_nid) | ||
458 | { | ||
459 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
460 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
461 | AC_DIPXMIT_BEST); | ||
462 | } | ||
463 | |||
464 | /* | ||
465 | * Disable Audio InfoFrame Transmission | ||
466 | */ | ||
467 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec, | ||
468 | hda_nid_t pin_nid) | ||
469 | { | ||
470 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
471 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
472 | AC_DIPXMIT_DISABLE); | ||
473 | } | ||
474 | |||
475 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t nid) | ||
476 | { | ||
477 | return 1 + snd_hda_codec_read(codec, nid, 0, | ||
478 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | ||
479 | } | ||
480 | |||
481 | static void hdmi_set_channel_count(struct hda_codec *codec, | ||
482 | hda_nid_t nid, int chs) | ||
483 | { | ||
484 | if (chs != hdmi_get_channel_count(codec, nid)) | ||
485 | snd_hda_codec_write(codec, nid, 0, | ||
486 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | ||
487 | } | ||
488 | |||
489 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, | ||
490 | hda_nid_t pin_nid) | ||
491 | { | ||
492 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
493 | int i; | ||
494 | int slot; | ||
495 | |||
496 | for (i = 0; i < 8; i++) { | ||
497 | slot = snd_hda_codec_read(codec, pin_nid, 0, | ||
498 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | ||
499 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | ||
500 | slot >> 4, slot & 0xf); | ||
501 | } | ||
502 | #endif | ||
503 | } | ||
504 | |||
505 | |||
506 | /* | ||
507 | * Audio InfoFrame routines | ||
508 | */ | ||
509 | |||
510 | static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) | ||
511 | { | ||
512 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
513 | int i; | ||
514 | int size; | ||
515 | |||
516 | size = snd_hdmi_get_eld_size(codec, pin_nid); | ||
517 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | ||
518 | |||
519 | for (i = 0; i < 8; i++) { | ||
520 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
521 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
522 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | ||
523 | } | ||
524 | #endif | ||
525 | } | ||
526 | |||
527 | static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) | ||
528 | { | ||
529 | #ifdef BE_PARANOID | ||
530 | int i, j; | ||
531 | int size; | ||
532 | int pi, bi; | ||
533 | for (i = 0; i < 8; i++) { | ||
534 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
535 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
536 | if (size == 0) | ||
537 | continue; | ||
538 | |||
539 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); | ||
540 | for (j = 1; j < 1000; j++) { | ||
541 | hdmi_write_dip_byte(codec, pin_nid, 0x0); | ||
542 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); | ||
543 | if (pi != i) | ||
544 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | ||
545 | bi, pi, i); | ||
546 | if (bi == 0) /* byte index wrapped around */ | ||
547 | break; | ||
548 | } | ||
549 | snd_printd(KERN_INFO | ||
550 | "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", | ||
551 | i, size, j); | ||
552 | } | ||
553 | #endif | ||
554 | } | ||
555 | |||
556 | static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *ai) | ||
557 | { | ||
558 | u8 *bytes = (u8 *)ai; | ||
559 | u8 sum = 0; | ||
560 | int i; | ||
561 | |||
562 | ai->checksum = 0; | ||
563 | |||
564 | for (i = 0; i < sizeof(*ai); i++) | ||
565 | sum += bytes[i]; | ||
566 | |||
567 | ai->checksum = - sum; | ||
568 | } | ||
569 | |||
570 | static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | ||
571 | hda_nid_t pin_nid, | ||
572 | struct hdmi_audio_infoframe *ai) | ||
573 | { | ||
574 | u8 *bytes = (u8 *)ai; | ||
575 | int i; | ||
576 | |||
577 | hdmi_debug_dip_size(codec, pin_nid); | ||
578 | hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ | ||
579 | |||
580 | hdmi_checksum_audio_infoframe(ai); | ||
581 | |||
582 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
583 | for (i = 0; i < sizeof(*ai); i++) | ||
584 | hdmi_write_dip_byte(codec, pin_nid, bytes[i]); | ||
585 | } | ||
586 | |||
587 | /* | ||
588 | * Compute derived values in channel_allocations[]. | ||
589 | */ | ||
590 | static void init_channel_allocations(void) | ||
591 | { | ||
592 | int i, j; | ||
593 | struct cea_channel_speaker_allocation *p; | ||
594 | |||
595 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
596 | p = channel_allocations + i; | ||
597 | p->channels = 0; | ||
598 | p->spk_mask = 0; | ||
599 | for (j = 0; j < ARRAY_SIZE(p->speakers); j++) | ||
600 | if (p->speakers[j]) { | ||
601 | p->channels++; | ||
602 | p->spk_mask |= p->speakers[j]; | ||
603 | } | ||
604 | } | ||
605 | } | ||
606 | |||
607 | /* | ||
608 | * The transformation takes two steps: | ||
609 | * | ||
610 | * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask | ||
611 | * spk_mask => (channel_allocations[]) => ai->CA | ||
612 | * | ||
613 | * TODO: it could select the wrong CA from multiple candidates. | ||
614 | */ | ||
615 | static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | ||
616 | struct hdmi_audio_infoframe *ai) | ||
617 | { | ||
618 | struct intel_hdmi_spec *spec = codec->spec; | ||
619 | struct hdmi_eld *eld; | ||
620 | int i; | ||
621 | int spk_mask = 0; | ||
622 | int channels = 1 + (ai->CC02_CT47 & 0x7); | ||
623 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | ||
624 | |||
625 | /* | ||
626 | * CA defaults to 0 for basic stereo audio | ||
627 | */ | ||
628 | if (channels <= 2) | ||
629 | return 0; | ||
630 | |||
631 | i = hda_node_index(spec->pin_cvt, nid); | ||
632 | if (i < 0) | ||
633 | return 0; | ||
634 | eld = &spec->sink_eld[i]; | ||
635 | |||
636 | /* | ||
637 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
638 | * in console or for audio devices. Assume the highest speakers | ||
639 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
640 | */ | ||
641 | if (!eld->spk_alloc) | ||
642 | eld->spk_alloc = 0xffff; | ||
643 | |||
644 | /* | ||
645 | * expand ELD's speaker allocation mask | ||
646 | * | ||
647 | * ELD tells the speaker mask in a compact(paired) form, | ||
648 | * expand ELD's notions to match the ones used by Audio InfoFrame. | ||
649 | */ | ||
650 | for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { | ||
651 | if (eld->spk_alloc & (1 << i)) | ||
652 | spk_mask |= eld_speaker_allocation_bits[i]; | ||
653 | } | ||
654 | |||
655 | /* search for the first working match in the CA table */ | ||
656 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
657 | if (channels == channel_allocations[i].channels && | ||
658 | (spk_mask & channel_allocations[i].spk_mask) == | ||
659 | channel_allocations[i].spk_mask) { | ||
660 | ai->CA = channel_allocations[i].ca_index; | ||
661 | break; | ||
662 | } | ||
663 | } | ||
664 | |||
665 | snd_print_channel_allocation(eld->spk_alloc, buf, sizeof(buf)); | ||
666 | snd_printdd(KERN_INFO | ||
667 | "HDMI: select CA 0x%x for %d-channel allocation: %s\n", | ||
668 | ai->CA, channels, buf); | ||
669 | |||
670 | return ai->CA; | ||
671 | } | ||
672 | |||
673 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
674 | hda_nid_t pin_nid, | ||
675 | struct hdmi_audio_infoframe *ai) | ||
676 | { | ||
677 | int i; | ||
678 | int ca = ai->CA; | ||
679 | int err; | ||
680 | |||
681 | if (hdmi_channel_mapping[ca][1] == 0) { | ||
682 | for (i = 0; i < channel_allocations[ca].channels; i++) | ||
683 | hdmi_channel_mapping[ca][i] = i | (i << 4); | ||
684 | for (; i < 8; i++) | ||
685 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | ||
686 | } | ||
687 | |||
688 | for (i = 0; i < 8; i++) { | ||
689 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
690 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
691 | hdmi_channel_mapping[ca][i]); | ||
692 | if (err) { | ||
693 | snd_printdd(KERN_INFO "HDMI: channel mapping failed\n"); | ||
694 | break; | ||
695 | } | ||
696 | } | ||
697 | |||
698 | hdmi_debug_channel_mapping(codec, pin_nid); | ||
699 | } | ||
700 | |||
701 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | ||
702 | struct hdmi_audio_infoframe *ai) | ||
703 | { | ||
704 | u8 *bytes = (u8 *)ai; | ||
705 | u8 val; | ||
706 | int i; | ||
707 | |||
708 | if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) | ||
709 | != AC_DIPXMIT_BEST) | ||
710 | return false; | ||
711 | |||
712 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
713 | for (i = 0; i < sizeof(*ai); i++) { | ||
714 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
715 | AC_VERB_GET_HDMI_DIP_DATA, 0); | ||
716 | if (val != bytes[i]) | ||
717 | return false; | ||
718 | } | ||
719 | |||
720 | return true; | ||
721 | } | ||
722 | |||
723 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | ||
724 | struct snd_pcm_substream *substream) | ||
725 | { | ||
726 | struct intel_hdmi_spec *spec = codec->spec; | ||
727 | hda_nid_t pin_nid; | ||
728 | int i; | ||
729 | struct hdmi_audio_infoframe ai = { | ||
730 | .type = 0x84, | ||
731 | .ver = 0x01, | ||
732 | .len = 0x0a, | ||
733 | .CC02_CT47 = substream->runtime->channels - 1, | ||
734 | }; | ||
735 | |||
736 | hdmi_setup_channel_allocation(codec, nid, &ai); | ||
737 | |||
738 | for (i = 0; i < spec->num_pins; i++) { | ||
739 | if (spec->pin_cvt[i] != nid) | ||
740 | continue; | ||
741 | if (!spec->sink_eld[i].monitor_present) | ||
742 | continue; | ||
743 | |||
744 | pin_nid = spec->pin[i]; | ||
745 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | ||
746 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
747 | hdmi_stop_infoframe_trans(codec, pin_nid); | ||
748 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | ||
749 | hdmi_start_infoframe_trans(codec, pin_nid); | ||
750 | } | ||
751 | } | ||
752 | } | ||
753 | |||
754 | |||
755 | /* | 53 | /* |
756 | * Unsolicited events | 54 | * HDMI callbacks |
757 | */ | 55 | */ |
758 | 56 | ||
759 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
760 | { | ||
761 | struct intel_hdmi_spec *spec = codec->spec; | ||
762 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
763 | int pind = !!(res & AC_UNSOL_RES_PD); | ||
764 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
765 | int index; | ||
766 | |||
767 | printk(KERN_INFO | ||
768 | "HDMI hot plug event: Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | ||
769 | tag, pind, eldv); | ||
770 | |||
771 | index = hda_node_index(spec->pin, tag); | ||
772 | if (index < 0) | ||
773 | return; | ||
774 | |||
775 | spec->sink_eld[index].monitor_present = pind; | ||
776 | spec->sink_eld[index].eld_valid = eldv; | ||
777 | |||
778 | if (pind && eldv) { | ||
779 | hdmi_get_show_eld(codec, spec->pin[index], &spec->sink_eld[index]); | ||
780 | /* TODO: do real things about ELD */ | ||
781 | } | ||
782 | } | ||
783 | |||
784 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
785 | { | ||
786 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
787 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
788 | int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); | ||
789 | int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); | ||
790 | |||
791 | printk(KERN_INFO | ||
792 | "HDMI CP event: PIN=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", | ||
793 | tag, | ||
794 | subtag, | ||
795 | cp_state, | ||
796 | cp_ready); | ||
797 | |||
798 | /* TODO */ | ||
799 | if (cp_state) | ||
800 | ; | ||
801 | if (cp_ready) | ||
802 | ; | ||
803 | } | ||
804 | |||
805 | |||
806 | static void intel_hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | ||
807 | { | ||
808 | struct intel_hdmi_spec *spec = codec->spec; | ||
809 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
810 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
811 | |||
812 | if (hda_node_index(spec->pin, tag) < 0) { | ||
813 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | ||
814 | return; | ||
815 | } | ||
816 | |||
817 | if (subtag == 0) | ||
818 | hdmi_intrinsic_event(codec, res); | ||
819 | else | ||
820 | hdmi_non_intrinsic_event(codec, res); | ||
821 | } | ||
822 | |||
823 | /* | ||
824 | * Callbacks | ||
825 | */ | ||
826 | |||
827 | static void hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
828 | u32 stream_tag, int format) | ||
829 | { | ||
830 | int tag; | ||
831 | int fmt; | ||
832 | |||
833 | tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; | ||
834 | fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); | ||
835 | |||
836 | snd_printdd("hdmi_setup_stream: " | ||
837 | "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n", | ||
838 | nid, | ||
839 | tag == stream_tag ? "" : "new-", | ||
840 | stream_tag, | ||
841 | fmt == format ? "" : "new-", | ||
842 | format); | ||
843 | |||
844 | if (tag != stream_tag) | ||
845 | snd_hda_codec_write(codec, nid, 0, | ||
846 | AC_VERB_SET_CHANNEL_STREAMID, stream_tag << 4); | ||
847 | if (fmt != format) | ||
848 | snd_hda_codec_write(codec, nid, 0, | ||
849 | AC_VERB_SET_STREAM_FORMAT, format); | ||
850 | } | ||
851 | |||
852 | static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 57 | static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
853 | struct hda_codec *codec, | 58 | struct hda_codec *codec, |
854 | unsigned int stream_tag, | 59 | unsigned int stream_tag, |
@@ -882,7 +87,7 @@ static struct hda_pcm_stream intel_hdmi_pcm_playback = { | |||
882 | 87 | ||
883 | static int intel_hdmi_build_pcms(struct hda_codec *codec) | 88 | static int intel_hdmi_build_pcms(struct hda_codec *codec) |
884 | { | 89 | { |
885 | struct intel_hdmi_spec *spec = codec->spec; | 90 | struct hdmi_spec *spec = codec->spec; |
886 | struct hda_pcm *info = spec->pcm_rec; | 91 | struct hda_pcm *info = spec->pcm_rec; |
887 | int i; | 92 | int i; |
888 | 93 | ||
@@ -908,7 +113,7 @@ static int intel_hdmi_build_pcms(struct hda_codec *codec) | |||
908 | 113 | ||
909 | static int intel_hdmi_build_controls(struct hda_codec *codec) | 114 | static int intel_hdmi_build_controls(struct hda_codec *codec) |
910 | { | 115 | { |
911 | struct intel_hdmi_spec *spec = codec->spec; | 116 | struct hdmi_spec *spec = codec->spec; |
912 | int err; | 117 | int err; |
913 | int i; | 118 | int i; |
914 | 119 | ||
@@ -923,7 +128,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec) | |||
923 | 128 | ||
924 | static int intel_hdmi_init(struct hda_codec *codec) | 129 | static int intel_hdmi_init(struct hda_codec *codec) |
925 | { | 130 | { |
926 | struct intel_hdmi_spec *spec = codec->spec; | 131 | struct hdmi_spec *spec = codec->spec; |
927 | int i; | 132 | int i; |
928 | 133 | ||
929 | for (i = 0; spec->pin[i]; i++) { | 134 | for (i = 0; spec->pin[i]; i++) { |
@@ -937,7 +142,7 @@ static int intel_hdmi_init(struct hda_codec *codec) | |||
937 | 142 | ||
938 | static void intel_hdmi_free(struct hda_codec *codec) | 143 | static void intel_hdmi_free(struct hda_codec *codec) |
939 | { | 144 | { |
940 | struct intel_hdmi_spec *spec = codec->spec; | 145 | struct hdmi_spec *spec = codec->spec; |
941 | int i; | 146 | int i; |
942 | 147 | ||
943 | for (i = 0; i < spec->num_pins; i++) | 148 | for (i = 0; i < spec->num_pins; i++) |
@@ -951,12 +156,12 @@ static struct hda_codec_ops intel_hdmi_patch_ops = { | |||
951 | .free = intel_hdmi_free, | 156 | .free = intel_hdmi_free, |
952 | .build_pcms = intel_hdmi_build_pcms, | 157 | .build_pcms = intel_hdmi_build_pcms, |
953 | .build_controls = intel_hdmi_build_controls, | 158 | .build_controls = intel_hdmi_build_controls, |
954 | .unsol_event = intel_hdmi_unsol_event, | 159 | .unsol_event = hdmi_unsol_event, |
955 | }; | 160 | }; |
956 | 161 | ||
957 | static int patch_intel_hdmi(struct hda_codec *codec) | 162 | static int patch_intel_hdmi(struct hda_codec *codec) |
958 | { | 163 | { |
959 | struct intel_hdmi_spec *spec; | 164 | struct hdmi_spec *spec; |
960 | int i; | 165 | int i; |
961 | 166 | ||
962 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 167 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -964,7 +169,7 @@ static int patch_intel_hdmi(struct hda_codec *codec) | |||
964 | return -ENOMEM; | 169 | return -ENOMEM; |
965 | 170 | ||
966 | codec->spec = spec; | 171 | codec->spec = spec; |
967 | if (intel_hdmi_parse_codec(codec) < 0) { | 172 | if (hdmi_parse_codec(codec) < 0) { |
968 | codec->spec = NULL; | 173 | codec->spec = NULL; |
969 | kfree(spec); | 174 | kfree(spec); |
970 | return -EINVAL; | 175 | return -EINVAL; |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 6afdab09bab7..3c10c0b149f4 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -29,13 +29,23 @@ | |||
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | 31 | ||
32 | #define MAX_HDMI_CVTS 1 | ||
33 | #define MAX_HDMI_PINS 1 | ||
34 | |||
35 | #include "patch_hdmi.c" | ||
36 | |||
37 | static char *nvhdmi_pcm_names[MAX_HDMI_CVTS] = { | ||
38 | "NVIDIA HDMI", | ||
39 | }; | ||
40 | |||
32 | /* define below to restrict the supported rates and formats */ | 41 | /* define below to restrict the supported rates and formats */ |
33 | /* #define LIMITED_RATE_FMT_SUPPORT */ | 42 | /* #define LIMITED_RATE_FMT_SUPPORT */ |
34 | 43 | ||
35 | struct nvhdmi_spec { | 44 | enum HDACodec { |
36 | struct hda_multi_out multiout; | 45 | HDA_CODEC_NVIDIA_MCP7X, |
37 | 46 | HDA_CODEC_NVIDIA_MCP89, | |
38 | struct hda_pcm pcm_rec; | 47 | HDA_CODEC_NVIDIA_GT21X, |
48 | HDA_CODEC_INVALID | ||
39 | }; | 49 | }; |
40 | 50 | ||
41 | #define Nv_VERB_SET_Channel_Allocation 0xF79 | 51 | #define Nv_VERB_SET_Channel_Allocation 0xF79 |
@@ -43,15 +53,18 @@ struct nvhdmi_spec { | |||
43 | #define Nv_VERB_SET_Audio_Protection_On 0xF98 | 53 | #define Nv_VERB_SET_Audio_Protection_On 0xF98 |
44 | #define Nv_VERB_SET_Audio_Protection_Off 0xF99 | 54 | #define Nv_VERB_SET_Audio_Protection_Off 0xF99 |
45 | 55 | ||
46 | #define Nv_Master_Convert_nid 0x04 | 56 | #define nvhdmi_master_con_nid_7x 0x04 |
47 | #define Nv_Master_Pin_nid 0x05 | 57 | #define nvhdmi_master_pin_nid_7x 0x05 |
48 | 58 | ||
49 | static hda_nid_t nvhdmi_convert_nids[4] = { | 59 | #define nvhdmi_master_con_nid_89 0x04 |
60 | #define nvhdmi_master_pin_nid_89 0x05 | ||
61 | |||
62 | static hda_nid_t nvhdmi_con_nids_7x[4] = { | ||
50 | /*front, rear, clfe, rear_surr */ | 63 | /*front, rear, clfe, rear_surr */ |
51 | 0x6, 0x8, 0xa, 0xc, | 64 | 0x6, 0x8, 0xa, 0xc, |
52 | }; | 65 | }; |
53 | 66 | ||
54 | static struct hda_verb nvhdmi_basic_init[] = { | 67 | static struct hda_verb nvhdmi_basic_init_7x[] = { |
55 | /* set audio protect on */ | 68 | /* set audio protect on */ |
56 | { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, | 69 | { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, |
57 | /* enable digital output on pin widget */ | 70 | /* enable digital output on pin widget */ |
@@ -84,22 +97,60 @@ static struct hda_verb nvhdmi_basic_init[] = { | |||
84 | */ | 97 | */ |
85 | static int nvhdmi_build_controls(struct hda_codec *codec) | 98 | static int nvhdmi_build_controls(struct hda_codec *codec) |
86 | { | 99 | { |
87 | struct nvhdmi_spec *spec = codec->spec; | 100 | struct hdmi_spec *spec = codec->spec; |
88 | int err; | 101 | int err; |
102 | int i; | ||
89 | 103 | ||
90 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 104 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) |
91 | if (err < 0) | 105 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { |
92 | return err; | 106 | for (i = 0; i < codec->num_pcms; i++) { |
107 | err = snd_hda_create_spdif_out_ctls(codec, | ||
108 | spec->cvt[i]); | ||
109 | if (err < 0) | ||
110 | return err; | ||
111 | } | ||
112 | } else { | ||
113 | err = snd_hda_create_spdif_out_ctls(codec, | ||
114 | spec->multiout.dig_out_nid); | ||
115 | if (err < 0) | ||
116 | return err; | ||
117 | } | ||
93 | 118 | ||
94 | return 0; | 119 | return 0; |
95 | } | 120 | } |
96 | 121 | ||
97 | static int nvhdmi_init(struct hda_codec *codec) | 122 | static int nvhdmi_init(struct hda_codec *codec) |
98 | { | 123 | { |
99 | snd_hda_sequence_write(codec, nvhdmi_basic_init); | 124 | struct hdmi_spec *spec = codec->spec; |
125 | int i; | ||
126 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) | ||
127 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { | ||
128 | for (i = 0; spec->pin[i]; i++) { | ||
129 | hdmi_enable_output(codec, spec->pin[i]); | ||
130 | snd_hda_codec_write(codec, spec->pin[i], 0, | ||
131 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
132 | AC_USRSP_EN | spec->pin[i]); | ||
133 | } | ||
134 | } else { | ||
135 | snd_hda_sequence_write(codec, nvhdmi_basic_init_7x); | ||
136 | } | ||
100 | return 0; | 137 | return 0; |
101 | } | 138 | } |
102 | 139 | ||
140 | static void nvhdmi_free(struct hda_codec *codec) | ||
141 | { | ||
142 | struct hdmi_spec *spec = codec->spec; | ||
143 | int i; | ||
144 | |||
145 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) | ||
146 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { | ||
147 | for (i = 0; i < spec->num_pins; i++) | ||
148 | snd_hda_eld_proc_free(codec, &spec->sink_eld[i]); | ||
149 | } | ||
150 | |||
151 | kfree(spec); | ||
152 | } | ||
153 | |||
103 | /* | 154 | /* |
104 | * Digital out | 155 | * Digital out |
105 | */ | 156 | */ |
@@ -107,25 +158,25 @@ static int nvhdmi_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
107 | struct hda_codec *codec, | 158 | struct hda_codec *codec, |
108 | struct snd_pcm_substream *substream) | 159 | struct snd_pcm_substream *substream) |
109 | { | 160 | { |
110 | struct nvhdmi_spec *spec = codec->spec; | 161 | struct hdmi_spec *spec = codec->spec; |
111 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | 162 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
112 | } | 163 | } |
113 | 164 | ||
114 | static int nvhdmi_dig_playback_pcm_close_8ch(struct hda_pcm_stream *hinfo, | 165 | static int nvhdmi_dig_playback_pcm_close_8ch_7x(struct hda_pcm_stream *hinfo, |
115 | struct hda_codec *codec, | 166 | struct hda_codec *codec, |
116 | struct snd_pcm_substream *substream) | 167 | struct snd_pcm_substream *substream) |
117 | { | 168 | { |
118 | struct nvhdmi_spec *spec = codec->spec; | 169 | struct hdmi_spec *spec = codec->spec; |
119 | int i; | 170 | int i; |
120 | 171 | ||
121 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, | 172 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, |
122 | 0, AC_VERB_SET_CHANNEL_STREAMID, 0); | 173 | 0, AC_VERB_SET_CHANNEL_STREAMID, 0); |
123 | for (i = 0; i < 4; i++) { | 174 | for (i = 0; i < 4; i++) { |
124 | /* set the stream id */ | 175 | /* set the stream id */ |
125 | snd_hda_codec_write(codec, nvhdmi_convert_nids[i], 0, | 176 | snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0, |
126 | AC_VERB_SET_CHANNEL_STREAMID, 0); | 177 | AC_VERB_SET_CHANNEL_STREAMID, 0); |
127 | /* set the stream format */ | 178 | /* set the stream format */ |
128 | snd_hda_codec_write(codec, nvhdmi_convert_nids[i], 0, | 179 | snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0, |
129 | AC_VERB_SET_STREAM_FORMAT, 0); | 180 | AC_VERB_SET_STREAM_FORMAT, 0); |
130 | } | 181 | } |
131 | 182 | ||
@@ -136,10 +187,25 @@ static int nvhdmi_dig_playback_pcm_close_2ch(struct hda_pcm_stream *hinfo, | |||
136 | struct hda_codec *codec, | 187 | struct hda_codec *codec, |
137 | struct snd_pcm_substream *substream) | 188 | struct snd_pcm_substream *substream) |
138 | { | 189 | { |
139 | struct nvhdmi_spec *spec = codec->spec; | 190 | struct hdmi_spec *spec = codec->spec; |
140 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | 191 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
141 | } | 192 | } |
142 | 193 | ||
194 | static int nvhdmi_dig_playback_pcm_prepare_8ch_89(struct hda_pcm_stream *hinfo, | ||
195 | struct hda_codec *codec, | ||
196 | unsigned int stream_tag, | ||
197 | unsigned int format, | ||
198 | struct snd_pcm_substream *substream) | ||
199 | { | ||
200 | hdmi_set_channel_count(codec, hinfo->nid, | ||
201 | substream->runtime->channels); | ||
202 | |||
203 | hdmi_setup_audio_infoframe(codec, hinfo->nid, substream); | ||
204 | |||
205 | hdmi_setup_stream(codec, hinfo->nid, stream_tag, format); | ||
206 | return 0; | ||
207 | } | ||
208 | |||
143 | static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | 209 | static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, |
144 | struct hda_codec *codec, | 210 | struct hda_codec *codec, |
145 | unsigned int stream_tag, | 211 | unsigned int stream_tag, |
@@ -181,29 +247,29 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
181 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 247 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
182 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) | 248 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
183 | snd_hda_codec_write(codec, | 249 | snd_hda_codec_write(codec, |
184 | Nv_Master_Convert_nid, | 250 | nvhdmi_master_con_nid_7x, |
185 | 0, | 251 | 0, |
186 | AC_VERB_SET_DIGI_CONVERT_1, | 252 | AC_VERB_SET_DIGI_CONVERT_1, |
187 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 253 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); |
188 | 254 | ||
189 | /* set the stream id */ | 255 | /* set the stream id */ |
190 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, 0, | 256 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, |
191 | AC_VERB_SET_CHANNEL_STREAMID, (stream_tag << 4) | 0x0); | 257 | AC_VERB_SET_CHANNEL_STREAMID, (stream_tag << 4) | 0x0); |
192 | 258 | ||
193 | /* set the stream format */ | 259 | /* set the stream format */ |
194 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, 0, | 260 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, |
195 | AC_VERB_SET_STREAM_FORMAT, format); | 261 | AC_VERB_SET_STREAM_FORMAT, format); |
196 | 262 | ||
197 | /* turn on again (if needed) */ | 263 | /* turn on again (if needed) */ |
198 | /* enable and set the channel status audio/data flag */ | 264 | /* enable and set the channel status audio/data flag */ |
199 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { | 265 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { |
200 | snd_hda_codec_write(codec, | 266 | snd_hda_codec_write(codec, |
201 | Nv_Master_Convert_nid, | 267 | nvhdmi_master_con_nid_7x, |
202 | 0, | 268 | 0, |
203 | AC_VERB_SET_DIGI_CONVERT_1, | 269 | AC_VERB_SET_DIGI_CONVERT_1, |
204 | codec->spdif_ctls & 0xff); | 270 | codec->spdif_ctls & 0xff); |
205 | snd_hda_codec_write(codec, | 271 | snd_hda_codec_write(codec, |
206 | Nv_Master_Convert_nid, | 272 | nvhdmi_master_con_nid_7x, |
207 | 0, | 273 | 0, |
208 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); | 274 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); |
209 | } | 275 | } |
@@ -220,19 +286,19 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
220 | if (codec->spdif_status_reset && | 286 | if (codec->spdif_status_reset && |
221 | (codec->spdif_ctls & AC_DIG1_ENABLE)) | 287 | (codec->spdif_ctls & AC_DIG1_ENABLE)) |
222 | snd_hda_codec_write(codec, | 288 | snd_hda_codec_write(codec, |
223 | nvhdmi_convert_nids[i], | 289 | nvhdmi_con_nids_7x[i], |
224 | 0, | 290 | 0, |
225 | AC_VERB_SET_DIGI_CONVERT_1, | 291 | AC_VERB_SET_DIGI_CONVERT_1, |
226 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 292 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); |
227 | /* set the stream id */ | 293 | /* set the stream id */ |
228 | snd_hda_codec_write(codec, | 294 | snd_hda_codec_write(codec, |
229 | nvhdmi_convert_nids[i], | 295 | nvhdmi_con_nids_7x[i], |
230 | 0, | 296 | 0, |
231 | AC_VERB_SET_CHANNEL_STREAMID, | 297 | AC_VERB_SET_CHANNEL_STREAMID, |
232 | (stream_tag << 4) | channel_id); | 298 | (stream_tag << 4) | channel_id); |
233 | /* set the stream format */ | 299 | /* set the stream format */ |
234 | snd_hda_codec_write(codec, | 300 | snd_hda_codec_write(codec, |
235 | nvhdmi_convert_nids[i], | 301 | nvhdmi_con_nids_7x[i], |
236 | 0, | 302 | 0, |
237 | AC_VERB_SET_STREAM_FORMAT, | 303 | AC_VERB_SET_STREAM_FORMAT, |
238 | format); | 304 | format); |
@@ -241,12 +307,12 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
241 | if (codec->spdif_status_reset && | 307 | if (codec->spdif_status_reset && |
242 | (codec->spdif_ctls & AC_DIG1_ENABLE)) { | 308 | (codec->spdif_ctls & AC_DIG1_ENABLE)) { |
243 | snd_hda_codec_write(codec, | 309 | snd_hda_codec_write(codec, |
244 | nvhdmi_convert_nids[i], | 310 | nvhdmi_con_nids_7x[i], |
245 | 0, | 311 | 0, |
246 | AC_VERB_SET_DIGI_CONVERT_1, | 312 | AC_VERB_SET_DIGI_CONVERT_1, |
247 | codec->spdif_ctls & 0xff); | 313 | codec->spdif_ctls & 0xff); |
248 | snd_hda_codec_write(codec, | 314 | snd_hda_codec_write(codec, |
249 | nvhdmi_convert_nids[i], | 315 | nvhdmi_con_nids_7x[i], |
250 | 0, | 316 | 0, |
251 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); | 317 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); |
252 | } | 318 | } |
@@ -261,28 +327,47 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
261 | return 0; | 327 | return 0; |
262 | } | 328 | } |
263 | 329 | ||
330 | static int nvhdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
331 | struct hda_codec *codec, | ||
332 | struct snd_pcm_substream *substream) | ||
333 | { | ||
334 | return 0; | ||
335 | } | ||
336 | |||
264 | static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, | 337 | static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, |
265 | struct hda_codec *codec, | 338 | struct hda_codec *codec, |
266 | unsigned int stream_tag, | 339 | unsigned int stream_tag, |
267 | unsigned int format, | 340 | unsigned int format, |
268 | struct snd_pcm_substream *substream) | 341 | struct snd_pcm_substream *substream) |
269 | { | 342 | { |
270 | struct nvhdmi_spec *spec = codec->spec; | 343 | struct hdmi_spec *spec = codec->spec; |
271 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | 344 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, |
272 | format, substream); | 345 | format, substream); |
273 | } | 346 | } |
274 | 347 | ||
275 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = { | 348 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_89 = { |
349 | .substreams = 1, | ||
350 | .channels_min = 2, | ||
351 | .rates = SUPPORTED_RATES, | ||
352 | .maxbps = SUPPORTED_MAXBPS, | ||
353 | .formats = SUPPORTED_FORMATS, | ||
354 | .ops = { | ||
355 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch_89, | ||
356 | .cleanup = nvhdmi_playback_pcm_cleanup, | ||
357 | }, | ||
358 | }; | ||
359 | |||
360 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_7x = { | ||
276 | .substreams = 1, | 361 | .substreams = 1, |
277 | .channels_min = 2, | 362 | .channels_min = 2, |
278 | .channels_max = 8, | 363 | .channels_max = 8, |
279 | .nid = Nv_Master_Convert_nid, | 364 | .nid = nvhdmi_master_con_nid_7x, |
280 | .rates = SUPPORTED_RATES, | 365 | .rates = SUPPORTED_RATES, |
281 | .maxbps = SUPPORTED_MAXBPS, | 366 | .maxbps = SUPPORTED_MAXBPS, |
282 | .formats = SUPPORTED_FORMATS, | 367 | .formats = SUPPORTED_FORMATS, |
283 | .ops = { | 368 | .ops = { |
284 | .open = nvhdmi_dig_playback_pcm_open, | 369 | .open = nvhdmi_dig_playback_pcm_open, |
285 | .close = nvhdmi_dig_playback_pcm_close_8ch, | 370 | .close = nvhdmi_dig_playback_pcm_close_8ch_7x, |
286 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch | 371 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch |
287 | }, | 372 | }, |
288 | }; | 373 | }; |
@@ -291,7 +376,7 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
291 | .substreams = 1, | 376 | .substreams = 1, |
292 | .channels_min = 2, | 377 | .channels_min = 2, |
293 | .channels_max = 2, | 378 | .channels_max = 2, |
294 | .nid = Nv_Master_Convert_nid, | 379 | .nid = nvhdmi_master_con_nid_7x, |
295 | .rates = SUPPORTED_RATES, | 380 | .rates = SUPPORTED_RATES, |
296 | .maxbps = SUPPORTED_MAXBPS, | 381 | .maxbps = SUPPORTED_MAXBPS, |
297 | .formats = SUPPORTED_FORMATS, | 382 | .formats = SUPPORTED_FORMATS, |
@@ -302,10 +387,36 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
302 | }, | 387 | }, |
303 | }; | 388 | }; |
304 | 389 | ||
305 | static int nvhdmi_build_pcms_8ch(struct hda_codec *codec) | 390 | static int nvhdmi_build_pcms_8ch_89(struct hda_codec *codec) |
391 | { | ||
392 | struct hdmi_spec *spec = codec->spec; | ||
393 | struct hda_pcm *info = spec->pcm_rec; | ||
394 | int i; | ||
395 | |||
396 | codec->num_pcms = spec->num_cvts; | ||
397 | codec->pcm_info = info; | ||
398 | |||
399 | for (i = 0; i < codec->num_pcms; i++, info++) { | ||
400 | unsigned int chans; | ||
401 | |||
402 | chans = get_wcaps(codec, spec->cvt[i]); | ||
403 | chans = get_wcaps_channels(chans); | ||
404 | |||
405 | info->name = nvhdmi_pcm_names[i]; | ||
406 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
407 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] | ||
408 | = nvhdmi_pcm_digital_playback_8ch_89; | ||
409 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->cvt[i]; | ||
410 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; | ||
411 | } | ||
412 | |||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | static int nvhdmi_build_pcms_8ch_7x(struct hda_codec *codec) | ||
306 | { | 417 | { |
307 | struct nvhdmi_spec *spec = codec->spec; | 418 | struct hdmi_spec *spec = codec->spec; |
308 | struct hda_pcm *info = &spec->pcm_rec; | 419 | struct hda_pcm *info = spec->pcm_rec; |
309 | 420 | ||
310 | codec->num_pcms = 1; | 421 | codec->num_pcms = 1; |
311 | codec->pcm_info = info; | 422 | codec->pcm_info = info; |
@@ -313,15 +424,15 @@ static int nvhdmi_build_pcms_8ch(struct hda_codec *codec) | |||
313 | info->name = "NVIDIA HDMI"; | 424 | info->name = "NVIDIA HDMI"; |
314 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 425 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
315 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] | 426 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] |
316 | = nvhdmi_pcm_digital_playback_8ch; | 427 | = nvhdmi_pcm_digital_playback_8ch_7x; |
317 | 428 | ||
318 | return 0; | 429 | return 0; |
319 | } | 430 | } |
320 | 431 | ||
321 | static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) | 432 | static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) |
322 | { | 433 | { |
323 | struct nvhdmi_spec *spec = codec->spec; | 434 | struct hdmi_spec *spec = codec->spec; |
324 | struct hda_pcm *info = &spec->pcm_rec; | 435 | struct hda_pcm *info = spec->pcm_rec; |
325 | 436 | ||
326 | codec->num_pcms = 1; | 437 | codec->num_pcms = 1; |
327 | codec->pcm_info = info; | 438 | codec->pcm_info = info; |
@@ -334,14 +445,17 @@ static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) | |||
334 | return 0; | 445 | return 0; |
335 | } | 446 | } |
336 | 447 | ||
337 | static void nvhdmi_free(struct hda_codec *codec) | 448 | static struct hda_codec_ops nvhdmi_patch_ops_8ch_89 = { |
338 | { | 449 | .build_controls = nvhdmi_build_controls, |
339 | kfree(codec->spec); | 450 | .build_pcms = nvhdmi_build_pcms_8ch_89, |
340 | } | 451 | .init = nvhdmi_init, |
452 | .free = nvhdmi_free, | ||
453 | .unsol_event = hdmi_unsol_event, | ||
454 | }; | ||
341 | 455 | ||
342 | static struct hda_codec_ops nvhdmi_patch_ops_8ch = { | 456 | static struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = { |
343 | .build_controls = nvhdmi_build_controls, | 457 | .build_controls = nvhdmi_build_controls, |
344 | .build_pcms = nvhdmi_build_pcms_8ch, | 458 | .build_pcms = nvhdmi_build_pcms_8ch_7x, |
345 | .init = nvhdmi_init, | 459 | .init = nvhdmi_init, |
346 | .free = nvhdmi_free, | 460 | .free = nvhdmi_free, |
347 | }; | 461 | }; |
@@ -353,9 +467,36 @@ static struct hda_codec_ops nvhdmi_patch_ops_2ch = { | |||
353 | .free = nvhdmi_free, | 467 | .free = nvhdmi_free, |
354 | }; | 468 | }; |
355 | 469 | ||
356 | static int patch_nvhdmi_8ch(struct hda_codec *codec) | 470 | static int patch_nvhdmi_8ch_89(struct hda_codec *codec) |
471 | { | ||
472 | struct hdmi_spec *spec; | ||
473 | int i; | ||
474 | |||
475 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
476 | if (spec == NULL) | ||
477 | return -ENOMEM; | ||
478 | |||
479 | codec->spec = spec; | ||
480 | spec->codec_type = HDA_CODEC_NVIDIA_MCP89; | ||
481 | |||
482 | if (hdmi_parse_codec(codec) < 0) { | ||
483 | codec->spec = NULL; | ||
484 | kfree(spec); | ||
485 | return -EINVAL; | ||
486 | } | ||
487 | codec->patch_ops = nvhdmi_patch_ops_8ch_89; | ||
488 | |||
489 | for (i = 0; i < spec->num_pins; i++) | ||
490 | snd_hda_eld_proc_new(codec, &spec->sink_eld[i], i); | ||
491 | |||
492 | init_channel_allocations(); | ||
493 | |||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) | ||
357 | { | 498 | { |
358 | struct nvhdmi_spec *spec; | 499 | struct hdmi_spec *spec; |
359 | 500 | ||
360 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 501 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
361 | if (spec == NULL) | 502 | if (spec == NULL) |
@@ -365,16 +506,17 @@ static int patch_nvhdmi_8ch(struct hda_codec *codec) | |||
365 | 506 | ||
366 | spec->multiout.num_dacs = 0; /* no analog */ | 507 | spec->multiout.num_dacs = 0; /* no analog */ |
367 | spec->multiout.max_channels = 8; | 508 | spec->multiout.max_channels = 8; |
368 | spec->multiout.dig_out_nid = Nv_Master_Convert_nid; | 509 | spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; |
510 | spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; | ||
369 | 511 | ||
370 | codec->patch_ops = nvhdmi_patch_ops_8ch; | 512 | codec->patch_ops = nvhdmi_patch_ops_8ch_7x; |
371 | 513 | ||
372 | return 0; | 514 | return 0; |
373 | } | 515 | } |
374 | 516 | ||
375 | static int patch_nvhdmi_2ch(struct hda_codec *codec) | 517 | static int patch_nvhdmi_2ch(struct hda_codec *codec) |
376 | { | 518 | { |
377 | struct nvhdmi_spec *spec; | 519 | struct hdmi_spec *spec; |
378 | 520 | ||
379 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 521 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
380 | if (spec == NULL) | 522 | if (spec == NULL) |
@@ -384,7 +526,8 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
384 | 526 | ||
385 | spec->multiout.num_dacs = 0; /* no analog */ | 527 | spec->multiout.num_dacs = 0; /* no analog */ |
386 | spec->multiout.max_channels = 2; | 528 | spec->multiout.max_channels = 2; |
387 | spec->multiout.dig_out_nid = Nv_Master_Convert_nid; | 529 | spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; |
530 | spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; | ||
388 | 531 | ||
389 | codec->patch_ops = nvhdmi_patch_ops_2ch; | 532 | codec->patch_ops = nvhdmi_patch_ops_2ch; |
390 | 533 | ||
@@ -395,11 +538,24 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
395 | * patch entries | 538 | * patch entries |
396 | */ | 539 | */ |
397 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | 540 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { |
398 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | 541 | { .id = 0x10de0002, .name = "MCP77/78 HDMI", |
399 | { .id = 0x10de0003, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | 542 | .patch = patch_nvhdmi_8ch_7x }, |
400 | { .id = 0x10de0005, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | 543 | { .id = 0x10de0003, .name = "MCP77/78 HDMI", |
401 | { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | 544 | .patch = patch_nvhdmi_8ch_7x }, |
402 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi_8ch }, | 545 | { .id = 0x10de0005, .name = "MCP77/78 HDMI", |
546 | .patch = patch_nvhdmi_8ch_7x }, | ||
547 | { .id = 0x10de0006, .name = "MCP77/78 HDMI", | ||
548 | .patch = patch_nvhdmi_8ch_7x }, | ||
549 | { .id = 0x10de0007, .name = "MCP79/7A HDMI", | ||
550 | .patch = patch_nvhdmi_8ch_7x }, | ||
551 | { .id = 0x10de000a, .name = "GT220 HDMI", | ||
552 | .patch = patch_nvhdmi_8ch_89 }, | ||
553 | { .id = 0x10de000b, .name = "GT21x HDMI", | ||
554 | .patch = patch_nvhdmi_8ch_89 }, | ||
555 | { .id = 0x10de000c, .name = "MCP89 HDMI", | ||
556 | .patch = patch_nvhdmi_8ch_89 }, | ||
557 | { .id = 0x10de000d, .name = "GT240 HDMI", | ||
558 | .patch = patch_nvhdmi_8ch_89 }, | ||
403 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, | 559 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, |
404 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, | 560 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, |
405 | {} /* terminator */ | 561 | {} /* terminator */ |
@@ -410,11 +566,15 @@ MODULE_ALIAS("snd-hda-codec-id:10de0003"); | |||
410 | MODULE_ALIAS("snd-hda-codec-id:10de0005"); | 566 | MODULE_ALIAS("snd-hda-codec-id:10de0005"); |
411 | MODULE_ALIAS("snd-hda-codec-id:10de0006"); | 567 | MODULE_ALIAS("snd-hda-codec-id:10de0006"); |
412 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); | 568 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); |
569 | MODULE_ALIAS("snd-hda-codec-id:10de000a"); | ||
570 | MODULE_ALIAS("snd-hda-codec-id:10de000b"); | ||
571 | MODULE_ALIAS("snd-hda-codec-id:10de000c"); | ||
572 | MODULE_ALIAS("snd-hda-codec-id:10de000d"); | ||
413 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 573 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
414 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | 574 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); |
415 | 575 | ||
416 | MODULE_LICENSE("GPL"); | 576 | MODULE_LICENSE("GPL"); |
417 | MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec"); | 577 | MODULE_DESCRIPTION("NVIDIA HDMI HD-audio codec"); |
418 | 578 | ||
419 | static struct hda_codec_preset_list nvhdmi_list = { | 579 | static struct hda_codec_preset_list nvhdmi_list = { |
420 | .preset = snd_hda_preset_nvhdmi, | 580 | .preset = snd_hda_preset_nvhdmi, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e8cbe216e912..7404dba16f83 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -230,6 +230,7 @@ enum { | |||
230 | ALC888_ACER_ASPIRE_7730G, | 230 | ALC888_ACER_ASPIRE_7730G, |
231 | ALC883_MEDION, | 231 | ALC883_MEDION, |
232 | ALC883_MEDION_MD2, | 232 | ALC883_MEDION_MD2, |
233 | ALC883_MEDION_WIM2160, | ||
233 | ALC883_LAPTOP_EAPD, | 234 | ALC883_LAPTOP_EAPD, |
234 | ALC883_LENOVO_101E_2ch, | 235 | ALC883_LENOVO_101E_2ch, |
235 | ALC883_LENOVO_NB0763, | 236 | ALC883_LENOVO_NB0763, |
@@ -411,6 +412,8 @@ static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, | |||
411 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); | 412 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
412 | if (mux_idx >= spec->num_mux_defs) | 413 | if (mux_idx >= spec->num_mux_defs) |
413 | mux_idx = 0; | 414 | mux_idx = 0; |
415 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) | ||
416 | mux_idx = 0; | ||
414 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | 417 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
415 | } | 418 | } |
416 | 419 | ||
@@ -439,6 +442,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
439 | 442 | ||
440 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 443 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
441 | imux = &spec->input_mux[mux_idx]; | 444 | imux = &spec->input_mux[mux_idx]; |
445 | if (!imux->num_items && mux_idx > 0) | ||
446 | imux = &spec->input_mux[0]; | ||
442 | 447 | ||
443 | type = get_wcaps_type(get_wcaps(codec, nid)); | 448 | type = get_wcaps_type(get_wcaps(codec, nid)); |
444 | if (type == AC_WID_AUD_MIX) { | 449 | if (type == AC_WID_AUD_MIX) { |
@@ -1385,22 +1390,31 @@ struct alc_fixup { | |||
1385 | 1390 | ||
1386 | static void alc_pick_fixup(struct hda_codec *codec, | 1391 | static void alc_pick_fixup(struct hda_codec *codec, |
1387 | const struct snd_pci_quirk *quirk, | 1392 | const struct snd_pci_quirk *quirk, |
1388 | const struct alc_fixup *fix) | 1393 | const struct alc_fixup *fix, |
1394 | int pre_init) | ||
1389 | { | 1395 | { |
1390 | const struct alc_pincfg *cfg; | 1396 | const struct alc_pincfg *cfg; |
1391 | 1397 | ||
1392 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | 1398 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
1393 | if (!quirk) | 1399 | if (!quirk) |
1394 | return; | 1400 | return; |
1395 | |||
1396 | fix += quirk->value; | 1401 | fix += quirk->value; |
1397 | cfg = fix->pins; | 1402 | cfg = fix->pins; |
1398 | if (cfg) { | 1403 | if (pre_init && cfg) { |
1404 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
1405 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | ||
1406 | codec->chip_name, quirk->name); | ||
1407 | #endif | ||
1399 | for (; cfg->nid; cfg++) | 1408 | for (; cfg->nid; cfg++) |
1400 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | 1409 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
1401 | } | 1410 | } |
1402 | if (fix->verbs) | 1411 | if (!pre_init && fix->verbs) { |
1412 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
1413 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | ||
1414 | codec->chip_name, quirk->name); | ||
1415 | #endif | ||
1403 | add_verb(codec->spec, fix->verbs); | 1416 | add_verb(codec->spec, fix->verbs); |
1417 | } | ||
1404 | } | 1418 | } |
1405 | 1419 | ||
1406 | static int alc_read_coef_idx(struct hda_codec *codec, | 1420 | static int alc_read_coef_idx(struct hda_codec *codec, |
@@ -1617,6 +1631,11 @@ static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |||
1617 | */ | 1631 | */ |
1618 | 1632 | ||
1619 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | 1633 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
1634 | /* Route to built-in subwoofer as well as speakers */ | ||
1635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1636 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
1638 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
1620 | /* Bias voltage on for external mic port */ | 1639 | /* Bias voltage on for external mic port */ |
1621 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | 1640 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
1622 | /* Front Mic: set to PIN_IN (empty by default) */ | 1641 | /* Front Mic: set to PIN_IN (empty by default) */ |
@@ -1628,10 +1647,12 @@ static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |||
1628 | /* Enable speaker output */ | 1647 | /* Enable speaker output */ |
1629 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 1648 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1630 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 1649 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1650 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
1631 | /* Enable headphone output */ | 1651 | /* Enable headphone output */ |
1632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | 1652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
1633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 1653 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1634 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 1654 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1655 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
1635 | { } | 1656 | { } |
1636 | }; | 1657 | }; |
1637 | 1658 | ||
@@ -2528,8 +2549,6 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2528 | return err; | 2549 | return err; |
2529 | } | 2550 | } |
2530 | 2551 | ||
2531 | alc_free_kctls(codec); /* no longer needed */ | ||
2532 | |||
2533 | /* assign Capture Source enums to NID */ | 2552 | /* assign Capture Source enums to NID */ |
2534 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | 2553 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
2535 | if (!kctl) | 2554 | if (!kctl) |
@@ -2598,6 +2617,9 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2598 | } | 2617 | } |
2599 | } | 2618 | } |
2600 | } | 2619 | } |
2620 | |||
2621 | alc_free_kctls(codec); /* no longer needed */ | ||
2622 | |||
2601 | return 0; | 2623 | return 0; |
2602 | } | 2624 | } |
2603 | 2625 | ||
@@ -4121,7 +4143,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { | |||
4121 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | 4143 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
4122 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | 4144 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
4123 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), | 4145 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
4124 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), | 4146 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
4125 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | 4147 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
4126 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | 4148 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
4127 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | 4149 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
@@ -4796,6 +4818,25 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
4796 | } | 4818 | } |
4797 | } | 4819 | } |
4798 | 4820 | ||
4821 | static void alc880_auto_init_input_src(struct hda_codec *codec) | ||
4822 | { | ||
4823 | struct alc_spec *spec = codec->spec; | ||
4824 | int c; | ||
4825 | |||
4826 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
4827 | unsigned int mux_idx; | ||
4828 | const struct hda_input_mux *imux; | ||
4829 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
4830 | imux = &spec->input_mux[mux_idx]; | ||
4831 | if (!imux->num_items && mux_idx > 0) | ||
4832 | imux = &spec->input_mux[0]; | ||
4833 | if (imux) | ||
4834 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | ||
4835 | AC_VERB_SET_CONNECT_SEL, | ||
4836 | imux->items[0].index); | ||
4837 | } | ||
4838 | } | ||
4839 | |||
4799 | /* parse the BIOS configuration and set up the alc_spec */ | 4840 | /* parse the BIOS configuration and set up the alc_spec */ |
4800 | /* return 1 if successful, 0 if the proper config is not found, | 4841 | /* return 1 if successful, 0 if the proper config is not found, |
4801 | * or a negative error code | 4842 | * or a negative error code |
@@ -4874,6 +4915,7 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
4874 | alc880_auto_init_multi_out(codec); | 4915 | alc880_auto_init_multi_out(codec); |
4875 | alc880_auto_init_extra_out(codec); | 4916 | alc880_auto_init_extra_out(codec); |
4876 | alc880_auto_init_analog_input(codec); | 4917 | alc880_auto_init_analog_input(codec); |
4918 | alc880_auto_init_input_src(codec); | ||
4877 | if (spec->unsol_event) | 4919 | if (spec->unsol_event) |
4878 | alc_inithook(codec); | 4920 | alc_inithook(codec); |
4879 | } | 4921 | } |
@@ -4915,7 +4957,7 @@ static void fixup_automic_adc(struct hda_codec *codec) | |||
4915 | static void fixup_single_adc(struct hda_codec *codec) | 4957 | static void fixup_single_adc(struct hda_codec *codec) |
4916 | { | 4958 | { |
4917 | struct alc_spec *spec = codec->spec; | 4959 | struct alc_spec *spec = codec->spec; |
4918 | hda_nid_t pin; | 4960 | hda_nid_t pin = 0; |
4919 | int i; | 4961 | int i; |
4920 | 4962 | ||
4921 | /* search for the input pin; there must be only one */ | 4963 | /* search for the input pin; there must be only one */ |
@@ -4979,6 +5021,70 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
4979 | } | 5021 | } |
4980 | } | 5022 | } |
4981 | 5023 | ||
5024 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ | ||
5025 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | ||
5026 | int num_nids) | ||
5027 | { | ||
5028 | struct alc_spec *spec = codec->spec; | ||
5029 | int n; | ||
5030 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | ||
5031 | |||
5032 | for (n = 0; n < num_nids; n++) { | ||
5033 | hda_nid_t adc, cap; | ||
5034 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
5035 | int nconns, i, j; | ||
5036 | |||
5037 | adc = nids[n]; | ||
5038 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | ||
5039 | continue; | ||
5040 | cap = adc; | ||
5041 | nconns = snd_hda_get_connections(codec, cap, conn, | ||
5042 | ARRAY_SIZE(conn)); | ||
5043 | if (nconns == 1) { | ||
5044 | cap = conn[0]; | ||
5045 | nconns = snd_hda_get_connections(codec, cap, conn, | ||
5046 | ARRAY_SIZE(conn)); | ||
5047 | } | ||
5048 | if (nconns <= 0) | ||
5049 | continue; | ||
5050 | if (!fallback_adc) { | ||
5051 | fallback_adc = adc; | ||
5052 | fallback_cap = cap; | ||
5053 | } | ||
5054 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
5055 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
5056 | if (!nid) | ||
5057 | continue; | ||
5058 | for (j = 0; j < nconns; j++) { | ||
5059 | if (conn[j] == nid) | ||
5060 | break; | ||
5061 | } | ||
5062 | if (j >= nconns) | ||
5063 | break; | ||
5064 | } | ||
5065 | if (i >= AUTO_PIN_LAST) { | ||
5066 | int num_adcs = spec->num_adc_nids; | ||
5067 | spec->private_adc_nids[num_adcs] = adc; | ||
5068 | spec->private_capsrc_nids[num_adcs] = cap; | ||
5069 | spec->num_adc_nids++; | ||
5070 | spec->adc_nids = spec->private_adc_nids; | ||
5071 | if (adc != cap) | ||
5072 | spec->capsrc_nids = spec->private_capsrc_nids; | ||
5073 | } | ||
5074 | } | ||
5075 | if (!spec->num_adc_nids) { | ||
5076 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | ||
5077 | " using fallback 0x%x\n", | ||
5078 | codec->chip_name, fallback_adc); | ||
5079 | spec->private_adc_nids[0] = fallback_adc; | ||
5080 | spec->adc_nids = spec->private_adc_nids; | ||
5081 | if (fallback_adc != fallback_cap) { | ||
5082 | spec->private_capsrc_nids[0] = fallback_cap; | ||
5083 | spec->capsrc_nids = spec->private_adc_nids; | ||
5084 | } | ||
5085 | } | ||
5086 | } | ||
5087 | |||
4982 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | 5088 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
4983 | #define set_beep_amp(spec, nid, idx, dir) \ | 5089 | #define set_beep_amp(spec, nid, idx, dir) \ |
4984 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | 5090 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
@@ -6321,6 +6427,8 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec) | |||
6321 | } | 6427 | } |
6322 | } | 6428 | } |
6323 | 6429 | ||
6430 | #define alc260_auto_init_input_src alc880_auto_init_input_src | ||
6431 | |||
6324 | /* | 6432 | /* |
6325 | * generic initialization of ADC, input mixers and output mixers | 6433 | * generic initialization of ADC, input mixers and output mixers |
6326 | */ | 6434 | */ |
@@ -6407,6 +6515,7 @@ static void alc260_auto_init(struct hda_codec *codec) | |||
6407 | struct alc_spec *spec = codec->spec; | 6515 | struct alc_spec *spec = codec->spec; |
6408 | alc260_auto_init_multi_out(codec); | 6516 | alc260_auto_init_multi_out(codec); |
6409 | alc260_auto_init_analog_input(codec); | 6517 | alc260_auto_init_analog_input(codec); |
6518 | alc260_auto_init_input_src(codec); | ||
6410 | if (spec->unsol_event) | 6519 | if (spec->unsol_event) |
6411 | alc_inithook(codec); | 6520 | alc_inithook(codec); |
6412 | } | 6521 | } |
@@ -6473,7 +6582,7 @@ static struct alc_config_preset alc260_presets[] = { | |||
6473 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | 6582 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
6474 | .dac_nids = alc260_dac_nids, | 6583 | .dac_nids = alc260_dac_nids, |
6475 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | 6584 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
6476 | .adc_nids = alc260_adc_nids, | 6585 | .adc_nids = alc260_dual_adc_nids, |
6477 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | 6586 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
6478 | .channel_mode = alc260_modes, | 6587 | .channel_mode = alc260_modes, |
6479 | .input_mux = &alc260_capture_source, | 6588 | .input_mux = &alc260_capture_source, |
@@ -8379,6 +8488,42 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |||
8379 | { } /* end */ | 8488 | { } /* end */ |
8380 | }; | 8489 | }; |
8381 | 8490 | ||
8491 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { | ||
8492 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
8493 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
8494 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
8495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
8496 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | ||
8497 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | ||
8498 | { } /* end */ | ||
8499 | }; | ||
8500 | |||
8501 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | ||
8502 | /* Unmute front mixer */ | ||
8503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8505 | |||
8506 | /* Set speaker pin to front mixer */ | ||
8507 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8508 | |||
8509 | /* Init headphone pin */ | ||
8510 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8511 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8512 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8513 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8514 | |||
8515 | { } /* end */ | ||
8516 | }; | ||
8517 | |||
8518 | /* toggle speaker-output according to the hp-jack state */ | ||
8519 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | ||
8520 | { | ||
8521 | struct alc_spec *spec = codec->spec; | ||
8522 | |||
8523 | spec->autocfg.hp_pins[0] = 0x1a; | ||
8524 | spec->autocfg.speaker_pins[0] = 0x15; | ||
8525 | } | ||
8526 | |||
8382 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | 8527 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
8383 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 8528 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8384 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 8529 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -8393,9 +8538,7 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | |||
8393 | 8538 | ||
8394 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { | 8539 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
8395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 8540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8396 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
8397 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 8541 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
8398 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), | ||
8399 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 8542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8400 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 8543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
8401 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 8544 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
@@ -9090,6 +9233,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = { | |||
9090 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | 9233 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
9091 | [ALC883_MEDION] = "medion", | 9234 | [ALC883_MEDION] = "medion", |
9092 | [ALC883_MEDION_MD2] = "medion-md2", | 9235 | [ALC883_MEDION_MD2] = "medion-md2", |
9236 | [ALC883_MEDION_WIM2160] = "medion-wim2160", | ||
9093 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | 9237 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
9094 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | 9238 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
9095 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | 9239 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
@@ -9191,6 +9335,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9191 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | 9335 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
9192 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | 9336 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
9193 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | 9337 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
9338 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), | ||
9194 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), | 9339 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
9195 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | 9340 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
9196 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | 9341 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
@@ -9200,10 +9345,12 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9200 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | 9345 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
9201 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | 9346 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
9202 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | 9347 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
9348 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), | ||
9203 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | 9349 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
9204 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | 9350 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
9205 | 9351 | ||
9206 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | 9352 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
9353 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), | ||
9207 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | 9354 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
9208 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | 9355 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
9209 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | 9356 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
@@ -9231,7 +9378,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9231 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), | 9378 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
9232 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | 9379 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
9233 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | 9380 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
9234 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | 9381 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
9235 | 9382 | ||
9236 | {} | 9383 | {} |
9237 | }; | 9384 | }; |
@@ -9742,6 +9889,21 @@ static struct alc_config_preset alc882_presets[] = { | |||
9742 | .setup = alc883_medion_md2_setup, | 9889 | .setup = alc883_medion_md2_setup, |
9743 | .init_hook = alc_automute_amp, | 9890 | .init_hook = alc_automute_amp, |
9744 | }, | 9891 | }, |
9892 | [ALC883_MEDION_WIM2160] = { | ||
9893 | .mixers = { alc883_medion_wim2160_mixer }, | ||
9894 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | ||
9895 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9896 | .dac_nids = alc883_dac_nids, | ||
9897 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9898 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
9899 | .adc_nids = alc883_adc_nids, | ||
9900 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
9901 | .channel_mode = alc883_3ST_2ch_modes, | ||
9902 | .input_mux = &alc883_capture_source, | ||
9903 | .unsol_event = alc_automute_amp_unsol_event, | ||
9904 | .setup = alc883_medion_wim2160_setup, | ||
9905 | .init_hook = alc_automute_amp, | ||
9906 | }, | ||
9745 | [ALC883_LAPTOP_EAPD] = { | 9907 | [ALC883_LAPTOP_EAPD] = { |
9746 | .mixers = { alc883_base_mixer }, | 9908 | .mixers = { alc883_base_mixer }, |
9747 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | 9909 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
@@ -10034,6 +10196,8 @@ static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |||
10034 | int idx; | 10196 | int idx; |
10035 | 10197 | ||
10036 | alc_set_pin_output(codec, nid, pin_type); | 10198 | alc_set_pin_output(codec, nid, pin_type); |
10199 | if (dac_idx >= spec->multiout.num_dacs) | ||
10200 | return; | ||
10037 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | 10201 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
10038 | idx = 4; | 10202 | idx = 4; |
10039 | else | 10203 | else |
@@ -10105,6 +10269,8 @@ static void alc882_auto_init_input_src(struct hda_codec *codec) | |||
10105 | continue; | 10269 | continue; |
10106 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | 10270 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
10107 | imux = &spec->input_mux[mux_idx]; | 10271 | imux = &spec->input_mux[mux_idx]; |
10272 | if (!imux->num_items && mux_idx > 0) | ||
10273 | imux = &spec->input_mux[0]; | ||
10108 | for (idx = 0; idx < conns; idx++) { | 10274 | for (idx = 0; idx < conns; idx++) { |
10109 | /* if the current connection is the selected one, | 10275 | /* if the current connection is the selected one, |
10110 | * unmute it as default - otherwise mute it | 10276 | * unmute it as default - otherwise mute it |
@@ -10283,7 +10449,8 @@ static int patch_alc882(struct hda_codec *codec) | |||
10283 | board_config = ALC882_AUTO; | 10449 | board_config = ALC882_AUTO; |
10284 | } | 10450 | } |
10285 | 10451 | ||
10286 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); | 10452 | if (board_config == ALC882_AUTO) |
10453 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | ||
10287 | 10454 | ||
10288 | if (board_config == ALC882_AUTO) { | 10455 | if (board_config == ALC882_AUTO) { |
10289 | /* automatic parse from the BIOS config */ | 10456 | /* automatic parse from the BIOS config */ |
@@ -10356,6 +10523,9 @@ static int patch_alc882(struct hda_codec *codec) | |||
10356 | set_capture_mixer(codec); | 10523 | set_capture_mixer(codec); |
10357 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 10524 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
10358 | 10525 | ||
10526 | if (board_config == ALC882_AUTO) | ||
10527 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | ||
10528 | |||
10359 | spec->vmaster_nid = 0x0c; | 10529 | spec->vmaster_nid = 0x0c; |
10360 | 10530 | ||
10361 | codec->patch_ops = alc_patch_ops; | 10531 | codec->patch_ops = alc_patch_ops; |
@@ -12447,11 +12617,11 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |||
12447 | unsigned char bits; | 12617 | unsigned char bits; |
12448 | 12618 | ||
12449 | present = snd_hda_jack_detect(codec, 0x15); | 12619 | present = snd_hda_jack_detect(codec, 0x15); |
12450 | bits = present ? AMP_IN_MUTE(0) : 0; | 12620 | bits = present ? HDA_AMP_MUTE : 0; |
12451 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | 12621 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
12452 | AMP_IN_MUTE(0), bits); | 12622 | HDA_AMP_MUTE, bits); |
12453 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | 12623 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
12454 | AMP_IN_MUTE(0), bits); | 12624 | HDA_AMP_MUTE, bits); |
12455 | } | 12625 | } |
12456 | 12626 | ||
12457 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | 12627 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
@@ -12736,6 +12906,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
12736 | dac = 0x02; | 12906 | dac = 0x02; |
12737 | break; | 12907 | break; |
12738 | case 0x15: | 12908 | case 0x15: |
12909 | case 0x21: /* ALC269vb has this pin, too */ | ||
12739 | dac = 0x03; | 12910 | dac = 0x03; |
12740 | break; | 12911 | break; |
12741 | default: | 12912 | default: |
@@ -13201,7 +13372,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
13201 | 13372 | ||
13202 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) | 13373 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
13203 | board_config = snd_hda_check_board_codec_sid_config(codec, | 13374 | board_config = snd_hda_check_board_codec_sid_config(codec, |
13204 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | 13375 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
13205 | 13376 | ||
13206 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | 13377 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
13207 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | 13378 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
@@ -13321,9 +13492,9 @@ static hda_nid_t alc269vb_capsrc_nids[1] = { | |||
13321 | 0x22, | 13492 | 0x22, |
13322 | }; | 13493 | }; |
13323 | 13494 | ||
13324 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | 13495 | static hda_nid_t alc269_adc_candidates[] = { |
13325 | * not a mux! | 13496 | 0x08, 0x09, 0x07, |
13326 | */ | 13497 | }; |
13327 | 13498 | ||
13328 | #define alc269_modes alc260_modes | 13499 | #define alc269_modes alc260_modes |
13329 | #define alc269_capture_source alc880_lg_lw_capture_source | 13500 | #define alc269_capture_source alc880_lg_lw_capture_source |
@@ -13470,11 +13641,11 @@ static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |||
13470 | unsigned char bits; | 13641 | unsigned char bits; |
13471 | 13642 | ||
13472 | present = snd_hda_jack_detect(codec, 0x15); | 13643 | present = snd_hda_jack_detect(codec, 0x15); |
13473 | bits = present ? AMP_IN_MUTE(0) : 0; | 13644 | bits = present ? HDA_AMP_MUTE : 0; |
13474 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 13645 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
13475 | AMP_IN_MUTE(0), bits); | 13646 | HDA_AMP_MUTE, bits); |
13476 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 13647 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
13477 | AMP_IN_MUTE(0), bits); | 13648 | HDA_AMP_MUTE, bits); |
13478 | 13649 | ||
13479 | snd_hda_codec_write(codec, 0x20, 0, | 13650 | snd_hda_codec_write(codec, 0x20, 0, |
13480 | AC_VERB_SET_COEF_INDEX, 0x0c); | 13651 | AC_VERB_SET_COEF_INDEX, 0x0c); |
@@ -13499,11 +13670,11 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |||
13499 | /* Check port replicator headphone socket */ | 13670 | /* Check port replicator headphone socket */ |
13500 | present |= snd_hda_jack_detect(codec, 0x1a); | 13671 | present |= snd_hda_jack_detect(codec, 0x1a); |
13501 | 13672 | ||
13502 | bits = present ? AMP_IN_MUTE(0) : 0; | 13673 | bits = present ? HDA_AMP_MUTE : 0; |
13503 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 13674 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
13504 | AMP_IN_MUTE(0), bits); | 13675 | HDA_AMP_MUTE, bits); |
13505 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 13676 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
13506 | AMP_IN_MUTE(0), bits); | 13677 | HDA_AMP_MUTE, bits); |
13507 | 13678 | ||
13508 | snd_hda_codec_write(codec, 0x20, 0, | 13679 | snd_hda_codec_write(codec, 0x20, 0, |
13509 | AC_VERB_SET_COEF_INDEX, 0x0c); | 13680 | AC_VERB_SET_COEF_INDEX, 0x0c); |
@@ -13561,6 +13732,8 @@ static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |||
13561 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | 13732 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
13562 | { | 13733 | { |
13563 | struct alc_spec *spec = codec->spec; | 13734 | struct alc_spec *spec = codec->spec; |
13735 | spec->autocfg.hp_pins[0] = 0x15; | ||
13736 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13564 | spec->ext_mic.pin = 0x18; | 13737 | spec->ext_mic.pin = 0x18; |
13565 | spec->ext_mic.mux_idx = 0; | 13738 | spec->ext_mic.mux_idx = 0; |
13566 | spec->int_mic.pin = 0x19; | 13739 | spec->int_mic.pin = 0x19; |
@@ -13632,11 +13805,11 @@ static void alc269_speaker_automute(struct hda_codec *codec) | |||
13632 | unsigned char bits; | 13805 | unsigned char bits; |
13633 | 13806 | ||
13634 | present = snd_hda_jack_detect(codec, nid); | 13807 | present = snd_hda_jack_detect(codec, nid); |
13635 | bits = present ? AMP_IN_MUTE(0) : 0; | 13808 | bits = present ? HDA_AMP_MUTE : 0; |
13636 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 13809 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
13637 | AMP_IN_MUTE(0), bits); | 13810 | HDA_AMP_MUTE, bits); |
13638 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 13811 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
13639 | AMP_IN_MUTE(0), bits); | 13812 | HDA_AMP_MUTE, bits); |
13640 | } | 13813 | } |
13641 | 13814 | ||
13642 | /* unsolicited event for HP jack sensing */ | 13815 | /* unsolicited event for HP jack sensing */ |
@@ -13653,29 +13826,35 @@ static void alc269_laptop_unsol_event(struct hda_codec *codec, | |||
13653 | } | 13826 | } |
13654 | } | 13827 | } |
13655 | 13828 | ||
13656 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | 13829 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
13657 | { | 13830 | { |
13658 | struct alc_spec *spec = codec->spec; | 13831 | struct alc_spec *spec = codec->spec; |
13832 | spec->autocfg.hp_pins[0] = 0x15; | ||
13833 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13659 | spec->ext_mic.pin = 0x18; | 13834 | spec->ext_mic.pin = 0x18; |
13660 | spec->ext_mic.mux_idx = 0; | 13835 | spec->ext_mic.mux_idx = 0; |
13661 | spec->int_mic.pin = 0x12; | 13836 | spec->int_mic.pin = 0x19; |
13662 | spec->int_mic.mux_idx = 5; | 13837 | spec->int_mic.mux_idx = 1; |
13663 | spec->auto_mic = 1; | 13838 | spec->auto_mic = 1; |
13664 | } | 13839 | } |
13665 | 13840 | ||
13666 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | 13841 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
13667 | { | 13842 | { |
13668 | struct alc_spec *spec = codec->spec; | 13843 | struct alc_spec *spec = codec->spec; |
13844 | spec->autocfg.hp_pins[0] = 0x15; | ||
13845 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13669 | spec->ext_mic.pin = 0x18; | 13846 | spec->ext_mic.pin = 0x18; |
13670 | spec->ext_mic.mux_idx = 0; | 13847 | spec->ext_mic.mux_idx = 0; |
13671 | spec->int_mic.pin = 0x12; | 13848 | spec->int_mic.pin = 0x12; |
13672 | spec->int_mic.mux_idx = 6; | 13849 | spec->int_mic.mux_idx = 5; |
13673 | spec->auto_mic = 1; | 13850 | spec->auto_mic = 1; |
13674 | } | 13851 | } |
13675 | 13852 | ||
13676 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | 13853 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
13677 | { | 13854 | { |
13678 | struct alc_spec *spec = codec->spec; | 13855 | struct alc_spec *spec = codec->spec; |
13856 | spec->autocfg.hp_pins[0] = 0x21; | ||
13857 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13679 | spec->ext_mic.pin = 0x18; | 13858 | spec->ext_mic.pin = 0x18; |
13680 | spec->ext_mic.mux_idx = 0; | 13859 | spec->ext_mic.mux_idx = 0; |
13681 | spec->int_mic.pin = 0x19; | 13860 | spec->int_mic.pin = 0x19; |
@@ -13683,6 +13862,18 @@ static void alc269_laptop_amic_setup(struct hda_codec *codec) | |||
13683 | spec->auto_mic = 1; | 13862 | spec->auto_mic = 1; |
13684 | } | 13863 | } |
13685 | 13864 | ||
13865 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | ||
13866 | { | ||
13867 | struct alc_spec *spec = codec->spec; | ||
13868 | spec->autocfg.hp_pins[0] = 0x21; | ||
13869 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13870 | spec->ext_mic.pin = 0x18; | ||
13871 | spec->ext_mic.mux_idx = 0; | ||
13872 | spec->int_mic.pin = 0x12; | ||
13873 | spec->int_mic.mux_idx = 6; | ||
13874 | spec->auto_mic = 1; | ||
13875 | } | ||
13876 | |||
13686 | static void alc269_laptop_inithook(struct hda_codec *codec) | 13877 | static void alc269_laptop_inithook(struct hda_codec *codec) |
13687 | { | 13878 | { |
13688 | alc269_speaker_automute(codec); | 13879 | alc269_speaker_automute(codec); |
@@ -13822,7 +14013,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13822 | struct alc_spec *spec = codec->spec; | 14013 | struct alc_spec *spec = codec->spec; |
13823 | int err; | 14014 | int err; |
13824 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | 14015 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
13825 | hda_nid_t real_capsrc_nids; | ||
13826 | 14016 | ||
13827 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 14017 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
13828 | alc269_ignore); | 14018 | alc269_ignore); |
@@ -13846,18 +14036,19 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13846 | 14036 | ||
13847 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { | 14037 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
13848 | add_verb(spec, alc269vb_init_verbs); | 14038 | add_verb(spec, alc269vb_init_verbs); |
13849 | real_capsrc_nids = alc269vb_capsrc_nids[0]; | ||
13850 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); | 14039 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
13851 | } else { | 14040 | } else { |
13852 | add_verb(spec, alc269_init_verbs); | 14041 | add_verb(spec, alc269_init_verbs); |
13853 | real_capsrc_nids = alc269_capsrc_nids[0]; | ||
13854 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | 14042 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
13855 | } | 14043 | } |
13856 | 14044 | ||
13857 | spec->num_mux_defs = 1; | 14045 | spec->num_mux_defs = 1; |
13858 | spec->input_mux = &spec->private_imux[0]; | 14046 | spec->input_mux = &spec->private_imux[0]; |
14047 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | ||
14048 | sizeof(alc269_adc_candidates)); | ||
14049 | |||
13859 | /* set default input source */ | 14050 | /* set default input source */ |
13860 | snd_hda_codec_write_cache(codec, real_capsrc_nids, | 14051 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
13861 | 0, AC_VERB_SET_CONNECT_SEL, | 14052 | 0, AC_VERB_SET_CONNECT_SEL, |
13862 | spec->input_mux->items[0].index); | 14053 | spec->input_mux->items[0].index); |
13863 | 14054 | ||
@@ -13887,6 +14078,27 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
13887 | alc_inithook(codec); | 14078 | alc_inithook(codec); |
13888 | } | 14079 | } |
13889 | 14080 | ||
14081 | enum { | ||
14082 | ALC269_FIXUP_SONY_VAIO, | ||
14083 | }; | ||
14084 | |||
14085 | const static struct hda_verb alc269_sony_vaio_fixup_verbs[] = { | ||
14086 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | ||
14087 | {} | ||
14088 | }; | ||
14089 | |||
14090 | static const struct alc_fixup alc269_fixups[] = { | ||
14091 | [ALC269_FIXUP_SONY_VAIO] = { | ||
14092 | .verbs = alc269_sony_vaio_fixup_verbs | ||
14093 | }, | ||
14094 | }; | ||
14095 | |||
14096 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
14097 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | ||
14098 | {} | ||
14099 | }; | ||
14100 | |||
14101 | |||
13890 | /* | 14102 | /* |
13891 | * configuration and preset | 14103 | * configuration and preset |
13892 | */ | 14104 | */ |
@@ -13946,7 +14158,7 @@ static struct snd_pci_quirk alc269_cfg_tbl[] = { | |||
13946 | ALC269_DMIC), | 14158 | ALC269_DMIC), |
13947 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | 14159 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
13948 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | 14160 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
13949 | SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC), | 14161 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
13950 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | 14162 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
13951 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), | 14163 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
13952 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | 14164 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
@@ -14020,7 +14232,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
14020 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 14232 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
14021 | .channel_mode = alc269_modes, | 14233 | .channel_mode = alc269_modes, |
14022 | .unsol_event = alc269_laptop_unsol_event, | 14234 | .unsol_event = alc269_laptop_unsol_event, |
14023 | .setup = alc269_laptop_amic_setup, | 14235 | .setup = alc269vb_laptop_amic_setup, |
14024 | .init_hook = alc269_laptop_inithook, | 14236 | .init_hook = alc269_laptop_inithook, |
14025 | }, | 14237 | }, |
14026 | [ALC269VB_DMIC] = { | 14238 | [ALC269VB_DMIC] = { |
@@ -14100,6 +14312,9 @@ static int patch_alc269(struct hda_codec *codec) | |||
14100 | board_config = ALC269_AUTO; | 14312 | board_config = ALC269_AUTO; |
14101 | } | 14313 | } |
14102 | 14314 | ||
14315 | if (board_config == ALC269_AUTO) | ||
14316 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | ||
14317 | |||
14103 | if (board_config == ALC269_AUTO) { | 14318 | if (board_config == ALC269_AUTO) { |
14104 | /* automatic parse from the BIOS config */ | 14319 | /* automatic parse from the BIOS config */ |
14105 | err = alc269_parse_auto_config(codec); | 14320 | err = alc269_parse_auto_config(codec); |
@@ -14136,20 +14351,25 @@ static int patch_alc269(struct hda_codec *codec) | |||
14136 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | 14351 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
14137 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | 14352 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
14138 | 14353 | ||
14139 | if (!is_alc269vb) { | 14354 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
14140 | spec->adc_nids = alc269_adc_nids; | 14355 | if (!is_alc269vb) { |
14141 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 14356 | spec->adc_nids = alc269_adc_nids; |
14142 | spec->capsrc_nids = alc269_capsrc_nids; | 14357 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
14143 | } else { | 14358 | spec->capsrc_nids = alc269_capsrc_nids; |
14144 | spec->adc_nids = alc269vb_adc_nids; | 14359 | } else { |
14145 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | 14360 | spec->adc_nids = alc269vb_adc_nids; |
14146 | spec->capsrc_nids = alc269vb_capsrc_nids; | 14361 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
14362 | spec->capsrc_nids = alc269vb_capsrc_nids; | ||
14363 | } | ||
14147 | } | 14364 | } |
14148 | 14365 | ||
14149 | if (!spec->cap_mixer) | 14366 | if (!spec->cap_mixer) |
14150 | set_capture_mixer(codec); | 14367 | set_capture_mixer(codec); |
14151 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 14368 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
14152 | 14369 | ||
14370 | if (board_config == ALC269_AUTO) | ||
14371 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | ||
14372 | |||
14153 | spec->vmaster_nid = 0x02; | 14373 | spec->vmaster_nid = 0x02; |
14154 | 14374 | ||
14155 | codec->patch_ops = alc_patch_ops; | 14375 | codec->patch_ops = alc_patch_ops; |
@@ -15238,7 +15458,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
15238 | board_config = ALC861_AUTO; | 15458 | board_config = ALC861_AUTO; |
15239 | } | 15459 | } |
15240 | 15460 | ||
15241 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); | 15461 | if (board_config == ALC861_AUTO) |
15462 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | ||
15242 | 15463 | ||
15243 | if (board_config == ALC861_AUTO) { | 15464 | if (board_config == ALC861_AUTO) { |
15244 | /* automatic parse from the BIOS config */ | 15465 | /* automatic parse from the BIOS config */ |
@@ -15275,6 +15496,9 @@ static int patch_alc861(struct hda_codec *codec) | |||
15275 | 15496 | ||
15276 | spec->vmaster_nid = 0x03; | 15497 | spec->vmaster_nid = 0x03; |
15277 | 15498 | ||
15499 | if (board_config == ALC861_AUTO) | ||
15500 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | ||
15501 | |||
15278 | codec->patch_ops = alc_patch_ops; | 15502 | codec->patch_ops = alc_patch_ops; |
15279 | if (board_config == ALC861_AUTO) { | 15503 | if (board_config == ALC861_AUTO) { |
15280 | spec->init_hook = alc861_auto_init; | 15504 | spec->init_hook = alc861_auto_init; |
@@ -16209,7 +16433,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
16209 | board_config = ALC861VD_AUTO; | 16433 | board_config = ALC861VD_AUTO; |
16210 | } | 16434 | } |
16211 | 16435 | ||
16212 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); | 16436 | if (board_config == ALC861VD_AUTO) |
16437 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | ||
16213 | 16438 | ||
16214 | if (board_config == ALC861VD_AUTO) { | 16439 | if (board_config == ALC861VD_AUTO) { |
16215 | /* automatic parse from the BIOS config */ | 16440 | /* automatic parse from the BIOS config */ |
@@ -16257,6 +16482,9 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
16257 | 16482 | ||
16258 | spec->vmaster_nid = 0x02; | 16483 | spec->vmaster_nid = 0x02; |
16259 | 16484 | ||
16485 | if (board_config == ALC861VD_AUTO) | ||
16486 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | ||
16487 | |||
16260 | codec->patch_ops = alc_patch_ops; | 16488 | codec->patch_ops = alc_patch_ops; |
16261 | 16489 | ||
16262 | if (board_config == ALC861VD_AUTO) | 16490 | if (board_config == ALC861VD_AUTO) |
@@ -17095,9 +17323,9 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec) | |||
17095 | present = snd_hda_jack_detect(codec, 0x21); | 17323 | present = snd_hda_jack_detect(codec, 0x21); |
17096 | bits = present ? HDA_AMP_MUTE : 0; | 17324 | bits = present ? HDA_AMP_MUTE : 0; |
17097 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 17325 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
17098 | AMP_IN_MUTE(0), bits); | 17326 | HDA_AMP_MUTE, bits); |
17099 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 17327 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
17100 | AMP_IN_MUTE(0), bits); | 17328 | HDA_AMP_MUTE, bits); |
17101 | } | 17329 | } |
17102 | 17330 | ||
17103 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | 17331 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
@@ -17108,13 +17336,13 @@ static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |||
17108 | present = snd_hda_jack_detect(codec, 0x21); | 17336 | present = snd_hda_jack_detect(codec, 0x21); |
17109 | bits = present ? HDA_AMP_MUTE : 0; | 17337 | bits = present ? HDA_AMP_MUTE : 0; |
17110 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 17338 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
17111 | AMP_IN_MUTE(0), bits); | 17339 | HDA_AMP_MUTE, bits); |
17112 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 17340 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
17113 | AMP_IN_MUTE(0), bits); | 17341 | HDA_AMP_MUTE, bits); |
17114 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | 17342 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
17115 | AMP_IN_MUTE(0), bits); | 17343 | HDA_AMP_MUTE, bits); |
17116 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | 17344 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
17117 | AMP_IN_MUTE(0), bits); | 17345 | HDA_AMP_MUTE, bits); |
17118 | } | 17346 | } |
17119 | 17347 | ||
17120 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | 17348 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
@@ -17125,13 +17353,13 @@ static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |||
17125 | present = snd_hda_jack_detect(codec, 0x15); | 17353 | present = snd_hda_jack_detect(codec, 0x15); |
17126 | bits = present ? HDA_AMP_MUTE : 0; | 17354 | bits = present ? HDA_AMP_MUTE : 0; |
17127 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 17355 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
17128 | AMP_IN_MUTE(0), bits); | 17356 | HDA_AMP_MUTE, bits); |
17129 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 17357 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
17130 | AMP_IN_MUTE(0), bits); | 17358 | HDA_AMP_MUTE, bits); |
17131 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | 17359 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
17132 | AMP_IN_MUTE(0), bits); | 17360 | HDA_AMP_MUTE, bits); |
17133 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | 17361 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
17134 | AMP_IN_MUTE(0), bits); | 17362 | HDA_AMP_MUTE, bits); |
17135 | } | 17363 | } |
17136 | 17364 | ||
17137 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | 17365 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
@@ -17170,14 +17398,14 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |||
17170 | 17398 | ||
17171 | if (present1 || present2) { | 17399 | if (present1 || present2) { |
17172 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 17400 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
17173 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | 17401 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
17174 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 17402 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
17175 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | 17403 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
17176 | } else { | 17404 | } else { |
17177 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 17405 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
17178 | AMP_IN_MUTE(0), 0); | 17406 | HDA_AMP_MUTE, 0); |
17179 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 17407 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
17180 | AMP_IN_MUTE(0), 0); | 17408 | HDA_AMP_MUTE, 0); |
17181 | } | 17409 | } |
17182 | } | 17410 | } |
17183 | 17411 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 8c416bb18a57..7fb7d017a347 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1607,6 +1607,10 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1607 | "Dell Studio 1555", STAC_DELL_M6_DMIC), | 1607 | "Dell Studio 1555", STAC_DELL_M6_DMIC), |
1608 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd, | 1608 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd, |
1609 | "Dell Studio 1557", STAC_DELL_M6_DMIC), | 1609 | "Dell Studio 1557", STAC_DELL_M6_DMIC), |
1610 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe, | ||
1611 | "Dell Studio XPS 1645", STAC_DELL_M6_BOTH), | ||
1612 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, | ||
1613 | "Dell Studio 1558", STAC_DELL_M6_BOTH), | ||
1610 | {} /* terminator */ | 1614 | {} /* terminator */ |
1611 | }; | 1615 | }; |
1612 | 1616 | ||
@@ -1730,6 +1734,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1730 | "HP HDX", STAC_HP_HDX), /* HDX16 */ | 1734 | "HP HDX", STAC_HP_HDX), /* HDX16 */ |
1731 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620, | 1735 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620, |
1732 | "HP dv6", STAC_HP_DV5), | 1736 | "HP dv6", STAC_HP_DV5), |
1737 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061, | ||
1738 | "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */ | ||
1733 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, | 1739 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, |
1734 | "HP", STAC_HP_DV5), | 1740 | "HP", STAC_HP_DV5), |
1735 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1741 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 9ddc37300f6b..73453814e098 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -476,7 +476,7 @@ static struct snd_kcontrol_new *via_clone_control(struct via_spec *spec, | |||
476 | knew->name = kstrdup(tmpl->name, GFP_KERNEL); | 476 | knew->name = kstrdup(tmpl->name, GFP_KERNEL); |
477 | if (!knew->name) | 477 | if (!knew->name) |
478 | return NULL; | 478 | return NULL; |
479 | return 0; | 479 | return knew; |
480 | } | 480 | } |
481 | 481 | ||
482 | static void via_free_kctls(struct hda_codec *codec) | 482 | static void via_free_kctls(struct hda_codec *codec) |
@@ -1215,14 +1215,13 @@ static struct snd_kcontrol_new via_hp_mixer[2] = { | |||
1215 | }, | 1215 | }, |
1216 | }; | 1216 | }; |
1217 | 1217 | ||
1218 | static int via_hp_build(struct via_spec *spec) | 1218 | static int via_hp_build(struct hda_codec *codec) |
1219 | { | 1219 | { |
1220 | struct via_spec *spec = codec->spec; | ||
1220 | struct snd_kcontrol_new *knew; | 1221 | struct snd_kcontrol_new *knew; |
1221 | hda_nid_t nid; | 1222 | hda_nid_t nid; |
1222 | 1223 | int nums; | |
1223 | knew = via_clone_control(spec, &via_hp_mixer[0]); | 1224 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
1224 | if (knew == NULL) | ||
1225 | return -ENOMEM; | ||
1226 | 1225 | ||
1227 | switch (spec->codec_type) { | 1226 | switch (spec->codec_type) { |
1228 | case VT1718S: | 1227 | case VT1718S: |
@@ -1239,6 +1238,14 @@ static int via_hp_build(struct via_spec *spec) | |||
1239 | break; | 1238 | break; |
1240 | } | 1239 | } |
1241 | 1240 | ||
1241 | nums = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS); | ||
1242 | if (nums <= 1) | ||
1243 | return 0; | ||
1244 | |||
1245 | knew = via_clone_control(spec, &via_hp_mixer[0]); | ||
1246 | if (knew == NULL) | ||
1247 | return -ENOMEM; | ||
1248 | |||
1242 | knew->subdevice = HDA_SUBDEV_NID_FLAG | nid; | 1249 | knew->subdevice = HDA_SUBDEV_NID_FLAG | nid; |
1243 | knew->private_value = nid; | 1250 | knew->private_value = nid; |
1244 | 1251 | ||
@@ -2561,7 +2568,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) | |||
2561 | spec->input_mux = &spec->private_imux[0]; | 2568 | spec->input_mux = &spec->private_imux[0]; |
2562 | 2569 | ||
2563 | if (spec->hp_mux) | 2570 | if (spec->hp_mux) |
2564 | via_hp_build(spec); | 2571 | via_hp_build(codec); |
2565 | 2572 | ||
2566 | via_smart51_build(spec); | 2573 | via_smart51_build(spec); |
2567 | return 1; | 2574 | return 1; |
@@ -3087,7 +3094,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) | |||
3087 | spec->input_mux = &spec->private_imux[0]; | 3094 | spec->input_mux = &spec->private_imux[0]; |
3088 | 3095 | ||
3089 | if (spec->hp_mux) | 3096 | if (spec->hp_mux) |
3090 | via_hp_build(spec); | 3097 | via_hp_build(codec); |
3091 | 3098 | ||
3092 | via_smart51_build(spec); | 3099 | via_smart51_build(spec); |
3093 | return 1; | 3100 | return 1; |
@@ -3654,7 +3661,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) | |||
3654 | spec->input_mux = &spec->private_imux[0]; | 3661 | spec->input_mux = &spec->private_imux[0]; |
3655 | 3662 | ||
3656 | if (spec->hp_mux) | 3663 | if (spec->hp_mux) |
3657 | via_hp_build(spec); | 3664 | via_hp_build(codec); |
3658 | 3665 | ||
3659 | via_smart51_build(spec); | 3666 | via_smart51_build(spec); |
3660 | return 1; | 3667 | return 1; |
@@ -4140,7 +4147,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) | |||
4140 | spec->input_mux = &spec->private_imux[0]; | 4147 | spec->input_mux = &spec->private_imux[0]; |
4141 | 4148 | ||
4142 | if (spec->hp_mux) | 4149 | if (spec->hp_mux) |
4143 | via_hp_build(spec); | 4150 | via_hp_build(codec); |
4144 | 4151 | ||
4145 | via_smart51_build(spec); | 4152 | via_smart51_build(spec); |
4146 | return 1; | 4153 | return 1; |
@@ -4510,7 +4517,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) | |||
4510 | spec->input_mux = &spec->private_imux[0]; | 4517 | spec->input_mux = &spec->private_imux[0]; |
4511 | 4518 | ||
4512 | if (spec->hp_mux) | 4519 | if (spec->hp_mux) |
4513 | via_hp_build(spec); | 4520 | via_hp_build(codec); |
4514 | 4521 | ||
4515 | return 1; | 4522 | return 1; |
4516 | } | 4523 | } |
@@ -4930,7 +4937,7 @@ static int vt1718S_parse_auto_config(struct hda_codec *codec) | |||
4930 | spec->input_mux = &spec->private_imux[0]; | 4937 | spec->input_mux = &spec->private_imux[0]; |
4931 | 4938 | ||
4932 | if (spec->hp_mux) | 4939 | if (spec->hp_mux) |
4933 | via_hp_build(spec); | 4940 | via_hp_build(codec); |
4934 | 4941 | ||
4935 | via_smart51_build(spec); | 4942 | via_smart51_build(spec); |
4936 | 4943 | ||
@@ -5425,7 +5432,7 @@ static int vt1716S_parse_auto_config(struct hda_codec *codec) | |||
5425 | spec->input_mux = &spec->private_imux[0]; | 5432 | spec->input_mux = &spec->private_imux[0]; |
5426 | 5433 | ||
5427 | if (spec->hp_mux) | 5434 | if (spec->hp_mux) |
5428 | via_hp_build(spec); | 5435 | via_hp_build(codec); |
5429 | 5436 | ||
5430 | via_smart51_build(spec); | 5437 | via_smart51_build(spec); |
5431 | 5438 | ||
@@ -5781,7 +5788,7 @@ static int vt2002P_parse_auto_config(struct hda_codec *codec) | |||
5781 | spec->input_mux = &spec->private_imux[0]; | 5788 | spec->input_mux = &spec->private_imux[0]; |
5782 | 5789 | ||
5783 | if (spec->hp_mux) | 5790 | if (spec->hp_mux) |
5784 | via_hp_build(spec); | 5791 | via_hp_build(codec); |
5785 | 5792 | ||
5786 | return 1; | 5793 | return 1; |
5787 | } | 5794 | } |
@@ -6000,12 +6007,12 @@ static int vt1812_auto_create_multi_out_ctls(struct via_spec *spec, | |||
6000 | 6007 | ||
6001 | /* Line-Out: PortE */ | 6008 | /* Line-Out: PortE */ |
6002 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | 6009 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, |
6003 | "Master Front Playback Volume", | 6010 | "Front Playback Volume", |
6004 | HDA_COMPOSE_AMP_VAL(0x8, 3, 0, HDA_OUTPUT)); | 6011 | HDA_COMPOSE_AMP_VAL(0x8, 3, 0, HDA_OUTPUT)); |
6005 | if (err < 0) | 6012 | if (err < 0) |
6006 | return err; | 6013 | return err; |
6007 | err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE, | 6014 | err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE, |
6008 | "Master Front Playback Switch", | 6015 | "Front Playback Switch", |
6009 | HDA_COMPOSE_AMP_VAL(0x28, 3, 0, HDA_OUTPUT)); | 6016 | HDA_COMPOSE_AMP_VAL(0x28, 3, 0, HDA_OUTPUT)); |
6010 | if (err < 0) | 6017 | if (err < 0) |
6011 | return err; | 6018 | return err; |
@@ -6130,7 +6137,7 @@ static int vt1812_parse_auto_config(struct hda_codec *codec) | |||
6130 | spec->input_mux = &spec->private_imux[0]; | 6137 | spec->input_mux = &spec->private_imux[0]; |
6131 | 6138 | ||
6132 | if (spec->hp_mux) | 6139 | if (spec->hp_mux) |
6133 | via_hp_build(spec); | 6140 | via_hp_build(codec); |
6134 | 6141 | ||
6135 | return 1; | 6142 | return 1; |
6136 | } | 6143 | } |
diff --git a/sound/pci/ice1712/ak4xxx.c b/sound/pci/ice1712/ak4xxx.c index 03391da8c8c7..90d560c3df13 100644 --- a/sound/pci/ice1712/ak4xxx.c +++ b/sound/pci/ice1712/ak4xxx.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include <sound/initval.h> | 30 | #include <sound/initval.h> |
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index 6da21a2bcade..e328cfb7620c 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/slab.h> | ||
29 | #include <sound/core.h> | 28 | #include <sound/core.h> |
30 | 29 | ||
31 | #include "ice1712.h" | 30 | #include "ice1712.h" |
diff --git a/sound/pci/ice1712/vt1720_mobo.c b/sound/pci/ice1712/vt1720_mobo.c index 7f9674b641c0..4c551e147c08 100644 --- a/sound/pci/ice1712/vt1720_mobo.c +++ b/sound/pci/ice1712/vt1720_mobo.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/slab.h> | ||
29 | #include <sound/core.h> | 28 | #include <sound/core.h> |
30 | 29 | ||
31 | #include "ice1712.h" | 30 | #include "ice1712.h" |
diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c index 5af9e84456d1..e618f789026e 100644 --- a/sound/pci/ice1712/wtm.c +++ b/sound/pci/ice1712/wtm.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/slab.h> | ||
33 | #include <sound/core.h> | 32 | #include <sound/core.h> |
34 | 33 | ||
35 | #include "ice1712.h" | 34 | #include "ice1712.h" |
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 0cca56038cd9..ef9af3f4ace2 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/slab.h> | ||
29 | 30 | ||
30 | #include <sound/initval.h> | 31 | #include <sound/initval.h> |
31 | #include <sound/control.h> | 32 | #include <sound/control.h> |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index b64e78139d63..b56e33676780 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -849,6 +849,7 @@ struct snd_m3 { | |||
849 | struct snd_kcontrol *master_switch; | 849 | struct snd_kcontrol *master_switch; |
850 | struct snd_kcontrol *master_volume; | 850 | struct snd_kcontrol *master_volume; |
851 | struct tasklet_struct hwvol_tq; | 851 | struct tasklet_struct hwvol_tq; |
852 | unsigned int in_suspend; | ||
852 | 853 | ||
853 | #ifdef CONFIG_PM | 854 | #ifdef CONFIG_PM |
854 | u16 *suspend_mem; | 855 | u16 *suspend_mem; |
@@ -884,6 +885,7 @@ static DEFINE_PCI_DEVICE_TABLE(snd_m3_ids) = { | |||
884 | MODULE_DEVICE_TABLE(pci, snd_m3_ids); | 885 | MODULE_DEVICE_TABLE(pci, snd_m3_ids); |
885 | 886 | ||
886 | static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = { | 887 | static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = { |
888 | SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c), | ||
887 | SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d), | 889 | SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d), |
888 | SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d), | 890 | SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d), |
889 | SND_PCI_QUIRK(0x1033, 0x80f1, "NEC LM800J/7", 0x03), | 891 | SND_PCI_QUIRK(0x1033, 0x80f1, "NEC LM800J/7", 0x03), |
@@ -1613,6 +1615,11 @@ static void snd_m3_update_hw_volume(unsigned long private_data) | |||
1613 | outb(0x88, chip->iobase + SHADOW_MIX_REG_MASTER); | 1615 | outb(0x88, chip->iobase + SHADOW_MIX_REG_MASTER); |
1614 | outb(0x88, chip->iobase + HW_VOL_COUNTER_MASTER); | 1616 | outb(0x88, chip->iobase + HW_VOL_COUNTER_MASTER); |
1615 | 1617 | ||
1618 | /* Ignore spurious HV interrupts during suspend / resume, this avoids | ||
1619 | mistaking them for a mute button press. */ | ||
1620 | if (chip->in_suspend) | ||
1621 | return; | ||
1622 | |||
1616 | if (!chip->master_switch || !chip->master_volume) | 1623 | if (!chip->master_switch || !chip->master_volume) |
1617 | return; | 1624 | return; |
1618 | 1625 | ||
@@ -2424,6 +2431,7 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state) | |||
2424 | if (chip->suspend_mem == NULL) | 2431 | if (chip->suspend_mem == NULL) |
2425 | return 0; | 2432 | return 0; |
2426 | 2433 | ||
2434 | chip->in_suspend = 1; | ||
2427 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2435 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2428 | snd_pcm_suspend_all(chip->pcm); | 2436 | snd_pcm_suspend_all(chip->pcm); |
2429 | snd_ac97_suspend(chip->ac97); | 2437 | snd_ac97_suspend(chip->ac97); |
@@ -2497,6 +2505,7 @@ static int m3_resume(struct pci_dev *pci) | |||
2497 | snd_m3_hv_init(chip); | 2505 | snd_m3_hv_init(chip); |
2498 | 2506 | ||
2499 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 2507 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
2508 | chip->in_suspend = 0; | ||
2500 | return 0; | 2509 | return 0; |
2501 | } | 2510 | } |
2502 | #endif /* CONFIG_PM */ | 2511 | #endif /* CONFIG_PM */ |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 7e8e7da592a9..3be8f97c8bc0 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include <sound/core.h> | 32 | #include <sound/core.h> |
32 | #include <sound/initval.h> | 33 | #include <sound/initval.h> |
@@ -1161,13 +1162,15 @@ static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private | |||
1161 | unsigned long count, unsigned long pos) | 1162 | unsigned long count, unsigned long pos) |
1162 | { | 1163 | { |
1163 | struct mixart_mgr *mgr = entry->private_data; | 1164 | struct mixart_mgr *mgr = entry->private_data; |
1165 | unsigned long maxsize; | ||
1164 | 1166 | ||
1165 | count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ | 1167 | if (pos >= MIXART_BA0_SIZE) |
1166 | if(count <= 0) | ||
1167 | return 0; | 1168 | return 0; |
1168 | if(pos + count > MIXART_BA0_SIZE) | 1169 | maxsize = MIXART_BA0_SIZE - pos; |
1169 | count = (long)(MIXART_BA0_SIZE - pos); | 1170 | if (count > maxsize) |
1170 | if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count)) | 1171 | count = maxsize; |
1172 | count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ | ||
1173 | if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count)) | ||
1171 | return -EFAULT; | 1174 | return -EFAULT; |
1172 | return count; | 1175 | return count; |
1173 | } | 1176 | } |
@@ -1180,13 +1183,15 @@ static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private | |||
1180 | unsigned long count, unsigned long pos) | 1183 | unsigned long count, unsigned long pos) |
1181 | { | 1184 | { |
1182 | struct mixart_mgr *mgr = entry->private_data; | 1185 | struct mixart_mgr *mgr = entry->private_data; |
1186 | unsigned long maxsize; | ||
1183 | 1187 | ||
1184 | count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ | 1188 | if (pos > MIXART_BA1_SIZE) |
1185 | if(count <= 0) | ||
1186 | return 0; | 1189 | return 0; |
1187 | if(pos + count > MIXART_BA1_SIZE) | 1190 | maxsize = MIXART_BA1_SIZE - pos; |
1188 | count = (long)(MIXART_BA1_SIZE - pos); | 1191 | if (count > maxsize) |
1189 | if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count)) | 1192 | count = maxsize; |
1193 | count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ | ||
1194 | if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count)) | ||
1190 | return -EFAULT; | 1195 | return -EFAULT; |
1191 | return count; | 1196 | return count; |
1192 | } | 1197 | } |
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 4cf4cd8c939c..bf2696aa5d49 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
27 | #include <linux/slab.h> | ||
27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "mixart.h" | 30 | #include "mixart.h" |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 9c5e6450eebb..fad03d64e3ad 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <linux/slab.h> | ||
24 | #include <sound/ac97_codec.h> | 25 | #include <sound/ac97_codec.h> |
25 | #include <sound/asoundef.h> | 26 | #include <sound/asoundef.h> |
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c index 7754db166d9e..dbc4b89d74e4 100644 --- a/sound/pci/oxygen/xonar_wm87x6.c +++ b/sound/pci/oxygen/xonar_wm87x6.c | |||
@@ -68,7 +68,7 @@ static void wm8776_write(struct oxygen *chip, | |||
68 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, | 68 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, |
69 | (reg << 9) | value); | 69 | (reg << 9) | value); |
70 | if (reg < ARRAY_SIZE(data->wm8776_regs)) { | 70 | if (reg < ARRAY_SIZE(data->wm8776_regs)) { |
71 | if (reg >= WM8776_HPLVOL || reg <= WM8776_DACMASTER) | 71 | if (reg >= WM8776_HPLVOL && reg <= WM8776_DACMASTER) |
72 | value &= ~WM8776_UPDATE; | 72 | value &= ~WM8776_UPDATE; |
73 | data->wm8776_regs[reg] = value; | 73 | data->wm8776_regs[reg] = value; |
74 | } | 74 | } |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 960a227eb653..ad4462677615 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry, | |||
1974 | } | 1974 | } |
1975 | snd_iprintf(buffer, "Paths:\n"); | 1975 | snd_iprintf(buffer, "Paths:\n"); |
1976 | i = getpaths(cif, p); | 1976 | i = getpaths(cif, p); |
1977 | while (i--) { | 1977 | while (i >= 2) { |
1978 | snd_iprintf(buffer, "%x->%x ", p[i - 1], p[i]); | 1978 | i -= 2; |
1979 | i--; | 1979 | snd_iprintf(buffer, "%x->%x ", p[i], p[i + 1]); |
1980 | } | 1980 | } |
1981 | snd_iprintf(buffer, "\n"); | 1981 | snd_iprintf(buffer, "\n"); |
1982 | } | 1982 | } |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index d5e1c6eb7b7b..3c04524de37c 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -70,10 +70,10 @@ | |||
70 | 70 | ||
71 | 71 | ||
72 | #include <linux/delay.h> | 72 | #include <linux/delay.h> |
73 | #include <linux/gfp.h> | ||
73 | #include <linux/init.h> | 74 | #include <linux/init.h> |
74 | #include <linux/interrupt.h> | 75 | #include <linux/interrupt.h> |
75 | #include <linux/pci.h> | 76 | #include <linux/pci.h> |
76 | #include <linux/slab.h> | ||
77 | #include <linux/moduleparam.h> | 77 | #include <linux/moduleparam.h> |
78 | 78 | ||
79 | #include <sound/core.h> | 79 | #include <sound/core.h> |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 9d5252bc870c..d19dc052c391 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/slab.h> | ||
31 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
32 | 31 | ||
33 | #include <sound/core.h> | 32 | #include <sound/core.h> |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 52c6eb57cc3f..b92adef8e81e 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
29 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
30 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 3d72c1effeef..547b713d7204 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -2479,7 +2479,7 @@ static int snd_hdspm_put_qs_wire(struct snd_kcontrol *kcontrol, | |||
2479 | on MADICARD | 2479 | on MADICARD |
2480 | - playback mixer matrix: [channelout+64] [output] [value] | 2480 | - playback mixer matrix: [channelout+64] [output] [value] |
2481 | - input(thru) mixer matrix: [channelin] [output] [value] | 2481 | - input(thru) mixer matrix: [channelin] [output] [value] |
2482 | (better do 2 kontrols for seperation ?) | 2482 | (better do 2 kontrols for separation ?) |
2483 | */ | 2483 | */ |
2484 | 2484 | ||
2485 | #define HDSPM_MIXER(xname, xindex) \ | 2485 | #define HDSPM_MIXER(xname, xindex) \ |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 44a3e2d8c556..c492af5b25f3 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
29 | 28 | ||
30 | #include <sound/core.h> | 29 | #include <sound/core.h> |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 7e3e8fbc90fe..9cc1b5aa0148 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
29 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index 5d2afa0b0ce4..9dce0bde5c05 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/info.h> | 24 | #include <sound/info.h> |
24 | #include "pdaudiocf.h" | 25 | #include "pdaudiocf.h" |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index 0d668f471620..43f995a3f960 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
25 | #include <sound/core.h> | 24 | #include <sound/core.h> |
26 | #include <sound/asoundef.h> | 25 | #include <sound/asoundef.h> |
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 7be3b3357045..cfd1438bcc64 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
24 | #include <linux/slab.h> | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include "vxpocket.h" | 26 | #include "vxpocket.h" |
26 | #include <pcmcia/ciscode.h> | 27 | #include <pcmcia/ciscode.h> |
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index 1f72e1c786bf..00e2d5166d0a 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/slab.h> | ||
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
26 | #include <sound/core.h> | 25 | #include <sound/core.h> |
27 | #include "pmac.h" | 26 | #include "pmac.h" |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index d06f780bd7e8..8f064c7ce745 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/i2c.h> | 23 | #include <linux/i2c.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/slab.h> | ||
26 | #include <sound/core.h> | 25 | #include <sound/core.h> |
27 | #include "pmac.h" | 26 | #include "pmac.h" |
28 | 27 | ||
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 53c81a547613..2f12da4da561 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -20,10 +20,10 @@ | |||
20 | 20 | ||
21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
22 | #include <linux/dmapool.h> | 22 | #include <linux/dmapool.h> |
23 | #include <linux/gfp.h> | ||
23 | #include <linux/init.h> | 24 | #include <linux/init.h> |
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
26 | #include <linux/slab.h> | ||
27 | 27 | ||
28 | #include <sound/asound.h> | 28 | #include <sound/asound.h> |
29 | #include <sound/control.h> | 29 | #include <sound/control.h> |
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c index 76d9ad27d91c..68e0dee4ff05 100644 --- a/sound/sh/sh_dac_audio.c +++ b/sound/sh/sh_dac_audio.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/slab.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/initval.h> | 31 | #include <sound/initval.h> |
31 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c index 9ef6b96373f5..3e6628c8e665 100644 --- a/sound/soc/atmel/atmel-pcm.c +++ b/sound/soc/atmel/atmel-pcm.c | |||
@@ -180,7 +180,7 @@ static int atmel_pcm_hw_params(struct snd_pcm_substream *substream, | |||
180 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 180 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
181 | runtime->dma_bytes = params_buffer_bytes(params); | 181 | runtime->dma_bytes = params_buffer_bytes(params); |
182 | 182 | ||
183 | prtd->params = rtd->dai->cpu_dai->dma_data; | 183 | prtd->params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); |
184 | prtd->params->dma_intr_handler = atmel_pcm_dma_irq; | 184 | prtd->params->dma_intr_handler = atmel_pcm_dma_irq; |
185 | 185 | ||
186 | prtd->dma_buffer = runtime->dma_addr; | 186 | prtd->dma_buffer = runtime->dma_addr; |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index e588e63f18d2..0b59806905d1 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
@@ -363,12 +363,12 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
363 | ssc_p->dma_params[dir] = dma_params; | 363 | ssc_p->dma_params[dir] = dma_params; |
364 | 364 | ||
365 | /* | 365 | /* |
366 | * The cpu_dai->dma_data field is only used to communicate the | 366 | * The snd_soc_pcm_stream->dma_data field is only used to communicate |
367 | * appropriate DMA parameters to the pcm driver hw_params() | 367 | * the appropriate DMA parameters to the pcm driver hw_params() |
368 | * function. It should not be used for other purposes | 368 | * function. It should not be used for other purposes |
369 | * as it is common to all substreams. | 369 | * as it is common to all substreams. |
370 | */ | 370 | */ |
371 | rtd->dai->cpu_dai->dma_data = dma_params; | 371 | snd_soc_dai_set_dma_data(rtd->dai->cpu_dai, substream, dma_params); |
372 | 372 | ||
373 | channels = params_channels(params); | 373 | channels = params_channels(params); |
374 | 374 | ||
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index 340311d7fed5..a61ccd2d505f 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/device.h> | 21 | #include <linux/device.h> |
21 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
22 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 0cf2ca61c776..495be6e71931 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/suspend.h> | 22 | #include <linux/suspend.h> |
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 67cbfe7283da..5e7aacf3bb5a 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/slab.h> | ||
33 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/gfp.h> | ||
34 | 34 | ||
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index e69322978739..523b7fc33f4e 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/wait.h> | 17 | #include <linux/wait.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #include <sound/core.h> | 21 | #include <sound/core.h> |
21 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index c6c6a4a7d948..1d2a1adf2575 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/slab.h> | ||
33 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/gfp.h> | ||
34 | 34 | ||
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c index 5e03bb2f3cd7..6bac1ac1a315 100644 --- a/sound/soc/blackfin/bf5xx-tdm-pcm.c +++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/slab.h> | ||
33 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/gfp.h> | ||
34 | 34 | ||
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index a1bbe16b7f96..1f5e57a4bb7a 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/device.h> | 18 | #include <linux/device.h> |
18 | #include <sound/core.h> | 19 | #include <sound/core.h> |
@@ -80,9 +81,11 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
80 | static int ac97_soc_probe(struct platform_device *pdev) | 81 | static int ac97_soc_probe(struct platform_device *pdev) |
81 | { | 82 | { |
82 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 83 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
84 | struct snd_soc_card *card = socdev->card; | ||
83 | struct snd_soc_codec *codec; | 85 | struct snd_soc_codec *codec; |
84 | struct snd_ac97_bus *ac97_bus; | 86 | struct snd_ac97_bus *ac97_bus; |
85 | struct snd_ac97_template ac97_template; | 87 | struct snd_ac97_template ac97_template; |
88 | int i; | ||
86 | int ret = 0; | 89 | int ret = 0; |
87 | 90 | ||
88 | printk(KERN_INFO "AC97 SoC Audio Codec %s\n", AC97_VERSION); | 91 | printk(KERN_INFO "AC97 SoC Audio Codec %s\n", AC97_VERSION); |
@@ -102,12 +105,6 @@ static int ac97_soc_probe(struct platform_device *pdev) | |||
102 | INIT_LIST_HEAD(&codec->dapm_widgets); | 105 | INIT_LIST_HEAD(&codec->dapm_widgets); |
103 | INIT_LIST_HEAD(&codec->dapm_paths); | 106 | INIT_LIST_HEAD(&codec->dapm_paths); |
104 | 107 | ||
105 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | ||
106 | if (ret < 0) { | ||
107 | printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n"); | ||
108 | goto err; | ||
109 | } | ||
110 | |||
111 | /* register pcms */ | 108 | /* register pcms */ |
112 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 109 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
113 | if (ret < 0) | 110 | if (ret < 0) |
@@ -123,6 +120,13 @@ static int ac97_soc_probe(struct platform_device *pdev) | |||
123 | if (ret < 0) | 120 | if (ret < 0) |
124 | goto bus_err; | 121 | goto bus_err; |
125 | 122 | ||
123 | for (i = 0; i < card->num_links; i++) { | ||
124 | if (card->dai_link[i].codec_dai->ac97_control) { | ||
125 | snd_ac97_dev_add_pdata(codec->ac97, | ||
126 | card->dai_link[i].cpu_dai->ac97_pdata); | ||
127 | } | ||
128 | } | ||
129 | |||
126 | return 0; | 130 | return 0; |
127 | 131 | ||
128 | bus_err: | 132 | bus_err: |
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index 3c80137d5938..11b62dee842c 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/device.h> | 23 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/ad1938.c b/sound/soc/codecs/ad1938.c index c233810d463d..240cd155b313 100644 --- a/sound/soc/codecs/ad1938.c +++ b/sound/soc/codecs/ad1938.c | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/slab.h> | ||
30 | #include <linux/module.h> | 31 | #include <linux/module.h> |
31 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
32 | #include <linux/device.h> | 33 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 39c0f7584e65..042072738cdc 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/device.h> | 18 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/ad73311.c b/sound/soc/codecs/ad73311.c index d2fcc601722c..475807bea2c2 100644 --- a/sound/soc/codecs/ad73311.c +++ b/sound/soc/codecs/ad73311.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/device.h> | 17 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/ads117x.c b/sound/soc/codecs/ads117x.c index cc96411ca3e6..f8e75edb27b7 100644 --- a/sound/soc/codecs/ads117x.c +++ b/sound/soc/codecs/ads117x.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
16 | #include <sound/core.h> | 17 | #include <sound/core.h> |
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index b9ef7e45891d..bdeb10dfd887 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/slab.h> | ||
13 | #include <sound/core.h> | 14 | #include <sound/core.h> |
14 | #include <sound/soc.h> | 15 | #include <sound/soc.h> |
15 | #include <sound/initval.h> | 16 | #include <sound/initval.h> |
@@ -90,12 +91,10 @@ static int ak4104_spi_write(struct snd_soc_codec *codec, unsigned int reg, | |||
90 | if (reg >= codec->reg_cache_size) | 91 | if (reg >= codec->reg_cache_size) |
91 | return -EINVAL; | 92 | return -EINVAL; |
92 | 93 | ||
93 | reg &= AK4104_REG_MASK; | ||
94 | reg |= AK4104_WRITE; | ||
95 | |||
96 | /* only write to the hardware if value has changed */ | 94 | /* only write to the hardware if value has changed */ |
97 | if (cache[reg] != value) { | 95 | if (cache[reg] != value) { |
98 | u8 tmp[2] = { reg, value }; | 96 | u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value }; |
97 | |||
99 | if (spi_write(spi, tmp, sizeof(tmp))) { | 98 | if (spi_write(spi, tmp, sizeof(tmp))) { |
100 | dev_err(&spi->dev, "SPI write failed\n"); | 99 | dev_err(&spi->dev, "SPI write failed\n"); |
101 | return -EIO; | 100 | return -EIO; |
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index ff966567e2ba..352d1d08dbd9 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 3ef16bbc8c83..729859cf6ca8 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/pm.h> | 29 | #include <linux/pm.h> |
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/slab.h> | ||
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/pcm.h> | 34 | #include <sound/pcm.h> |
34 | #include <sound/pcm_params.h> | 35 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index 82fca284d007..926797a014c7 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/slab.h> | ||
18 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
19 | #include <sound/soc-dapm.h> | 20 | #include <sound/soc-dapm.h> |
20 | #include <sound/initval.h> | 21 | #include <sound/initval.h> |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index dfbeb2db61b3..81a62d198b70 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/slab.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/soc.h> | 28 | #include <sound/soc.h> |
28 | #include <sound/initval.h> | 29 | #include <sound/initval.h> |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index e000cdfec1ec..9f169c477108 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/tty.h> | 16 | #include <linux/tty.h> |
17 | #include <linux/slab.h> | ||
17 | 18 | ||
18 | #include <sound/core.h> | 19 | #include <sound/core.h> |
19 | #include <sound/initval.h> | 20 | #include <sound/initval.h> |
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index cf2975a7294a..366daf1d044e 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/slab.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
28 | #include <sound/pcm_params.h> | 29 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index 2afcd0a8669d..5a5f187a2657 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/initval.h> | 25 | #include <sound/initval.h> |
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index d2ff1cde6883..29d0906a924a 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/pm.h> | 33 | #include <linux/pm.h> |
34 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
35 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
36 | #include <linux/slab.h> | ||
36 | #include <sound/core.h> | 37 | #include <sound/core.h> |
37 | #include <sound/pcm.h> | 38 | #include <sound/pcm.h> |
38 | #include <sound/pcm_params.h> | 39 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 81b8c9dfe7fc..3293629dcb3b 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/slab.h> | ||
18 | #include <linux/module.h> | 19 | #include <linux/module.h> |
19 | #include <linux/device.h> | 20 | #include <linux/device.h> |
20 | #include <sound/core.h> | 21 | #include <sound/core.h> |
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index da589d8664d0..776b79cde904 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | ||
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include <sound/pcm.h> | 30 | #include <sound/pcm.h> |
30 | #include <sound/pcm_params.h> | 31 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 357b609196e3..b5b7d6a03844 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/sysfs.h> | 14 | #include <linux/sysfs.h> |
15 | #include <linux/spi/spi.h> | 15 | #include <linux/spi/spi.h> |
16 | #include <linux/slab.h> | ||
16 | #include <sound/core.h> | 17 | #include <sound/core.h> |
17 | #include <sound/pcm.h> | 18 | #include <sound/pcm.h> |
18 | #include <sound/pcm_params.h> | 19 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index e4b946a19ea3..4a6d56c3fed9 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/pm.h> | 39 | #include <linux/pm.h> |
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
42 | #include <linux/slab.h> | ||
42 | #include <sound/core.h> | 43 | #include <sound/core.h> |
43 | #include <sound/pcm.h> | 44 | #include <sound/pcm.h> |
44 | #include <sound/pcm_params.h> | 45 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index f9f367d29a90..d1e0e81ef30c 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/regulator/consumer.h> | 33 | #include <linux/regulator/consumer.h> |
34 | #include <linux/slab.h> | ||
34 | #include <sound/core.h> | 35 | #include <sound/core.h> |
35 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
36 | #include <sound/pcm_params.h> | 37 | #include <sound/pcm_params.h> |
@@ -778,7 +779,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) | |||
778 | if (dac33->fifo_mode) { | 779 | if (dac33->fifo_mode) { |
779 | /* Generic for all FIFO modes */ | 780 | /* Generic for all FIFO modes */ |
780 | /* 50-51 : ASRC Control registers */ | 781 | /* 50-51 : ASRC Control registers */ |
781 | dac33_write(codec, DAC33_ASRC_CTRL_A, (1 << 4)); /* div=2 */ | 782 | dac33_write(codec, DAC33_ASRC_CTRL_A, DAC33_SRCLKDIV(1)); |
782 | dac33_write(codec, DAC33_ASRC_CTRL_B, 1); /* ??? */ | 783 | dac33_write(codec, DAC33_ASRC_CTRL_B, 1); /* ??? */ |
783 | 784 | ||
784 | /* Write registers 0x34 and 0x35 (MSB, LSB) */ | 785 | /* Write registers 0x34 and 0x35 (MSB, LSB) */ |
@@ -1038,11 +1039,7 @@ static int dac33_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1038 | case SND_SOC_DAIFMT_DSP_A: | 1039 | case SND_SOC_DAIFMT_DSP_A: |
1039 | aictrl_a |= DAC33_AFMT_DSP; | 1040 | aictrl_a |= DAC33_AFMT_DSP; |
1040 | aictrl_b &= ~DAC33_DATA_DELAY_MASK; | 1041 | aictrl_b &= ~DAC33_DATA_DELAY_MASK; |
1041 | aictrl_b |= DAC33_DATA_DELAY(1); /* 1 bit delay */ | 1042 | aictrl_b |= DAC33_DATA_DELAY(0); |
1042 | break; | ||
1043 | case SND_SOC_DAIFMT_DSP_B: | ||
1044 | aictrl_a |= DAC33_AFMT_DSP; | ||
1045 | aictrl_b &= ~DAC33_DATA_DELAY_MASK; /* No delay */ | ||
1046 | break; | 1043 | break; |
1047 | case SND_SOC_DAIFMT_RIGHT_J: | 1044 | case SND_SOC_DAIFMT_RIGHT_J: |
1048 | aictrl_a |= DAC33_AFMT_RIGHT_J; | 1045 | aictrl_a |= DAC33_AFMT_RIGHT_J; |
@@ -1066,7 +1063,7 @@ static void dac33_init_chip(struct snd_soc_codec *codec) | |||
1066 | { | 1063 | { |
1067 | /* 44-46: DAC Control Registers */ | 1064 | /* 44-46: DAC Control Registers */ |
1068 | /* A : DAC sample rate Fsref/1.5 */ | 1065 | /* A : DAC sample rate Fsref/1.5 */ |
1069 | dac33_write(codec, DAC33_DAC_CTRL_A, DAC33_DACRATE(1)); | 1066 | dac33_write(codec, DAC33_DAC_CTRL_A, DAC33_DACRATE(0)); |
1070 | /* B : DAC src=normal, not muted */ | 1067 | /* B : DAC src=normal, not muted */ |
1071 | dac33_write(codec, DAC33_DAC_CTRL_B, DAC33_DACSRCR_RIGHT | | 1068 | dac33_write(codec, DAC33_DAC_CTRL_B, DAC33_DACSRCR_RIGHT | |
1072 | DAC33_DACSRCL_LEFT); | 1069 | DAC33_DACSRCL_LEFT); |
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 958d49c969ac..569ad8758a84 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/regulator/consumer.h> | 28 | #include <linux/regulator/consumer.h> |
29 | #include <linux/slab.h> | ||
29 | #include <sound/tpa6130a2-plat.h> | 30 | #include <sound/tpa6130a2-plat.h> |
30 | #include <sound/soc.h> | 31 | #include <sound/soc.h> |
31 | #include <sound/soc-dapm.h> | 32 | #include <sound/soc-dapm.h> |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 6f5d4af20052..520ffd6536c3 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/i2c/twl.h> | 29 | #include <linux/i2c/twl.h> |
30 | #include <linux/slab.h> | ||
30 | #include <sound/core.h> | 31 | #include <sound/core.h> |
31 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
32 | #include <sound/pcm_params.h> | 33 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 3e99fe5131dd..a8dcd5a5bbcb 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/slab.h> | ||
18 | #include <sound/pcm.h> | 19 | #include <sound/pcm.h> |
19 | #include <sound/pcm_params.h> | 20 | #include <sound/pcm_params.h> |
20 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index a2763c2e7348..9cd0a66b7663 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -137,7 +137,7 @@ static void uda1380_flush_work(struct work_struct *work) | |||
137 | { | 137 | { |
138 | int bit, reg; | 138 | int bit, reg; |
139 | 139 | ||
140 | for_each_bit(bit, &uda1380_cache_dirty, UDA1380_CACHEREGNUM - 0x10) { | 140 | for_each_set_bit(bit, &uda1380_cache_dirty, UDA1380_CACHEREGNUM - 0x10) { |
141 | reg = 0x10 + bit; | 141 | reg = 0x10 + bit; |
142 | pr_debug("uda1380: flush reg %x val %x:\n", reg, | 142 | pr_debug("uda1380: flush reg %x val %x:\n", reg, |
143 | uda1380_read_reg_cache(uda1380_codec, reg)); | 143 | uda1380_read_reg_cache(uda1380_codec, reg)); |
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 217b02680597..002e289d1255 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
26 | #include <linux/version.h> | ||
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
29 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
@@ -32,6 +31,7 @@ | |||
32 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
33 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
34 | #include <linux/debugfs.h> | 33 | #include <linux/debugfs.h> |
34 | #include <linux/slab.h> | ||
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
37 | #include <sound/pcm_params.h> | 37 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 718ef912e758..2e0772f9c456 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
17 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
@@ -1349,7 +1350,7 @@ static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) | |||
1349 | int mask; | 1350 | int mask; |
1350 | struct wm8350_jack_data *jack = NULL; | 1351 | struct wm8350_jack_data *jack = NULL; |
1351 | 1352 | ||
1352 | switch (irq) { | 1353 | switch (irq - wm8350->irq_base) { |
1353 | case WM8350_IRQ_CODEC_JCK_DET_L: | 1354 | case WM8350_IRQ_CODEC_JCK_DET_L: |
1354 | jack = &priv->hpl; | 1355 | jack = &priv->hpl; |
1355 | mask = WM8350_JACK_L_LVL; | 1356 | mask = WM8350_JACK_L_LVL; |
@@ -1424,7 +1425,7 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, | |||
1424 | wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); | 1425 | wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); |
1425 | 1426 | ||
1426 | /* Sync status */ | 1427 | /* Sync status */ |
1427 | wm8350_hp_jack_handler(irq, priv); | 1428 | wm8350_hp_jack_handler(irq + wm8350->irq_base, priv); |
1428 | 1429 | ||
1429 | return 0; | 1430 | return 0; |
1430 | } | 1431 | } |
@@ -1521,8 +1522,8 @@ static int wm8350_remove(struct platform_device *pdev) | |||
1521 | WM8350_JDL_ENA | WM8350_JDR_ENA); | 1522 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
1522 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); | 1523 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); |
1523 | 1524 | ||
1524 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); | 1525 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, priv); |
1525 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); | 1526 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, priv); |
1526 | 1527 | ||
1527 | priv->hpl.jack = NULL; | 1528 | priv->hpl.jack = NULL; |
1528 | priv->hpr.jack = NULL; | 1529 | priv->hpr.jack = NULL; |
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index b432f4d4a324..6acc885cf9b7 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
19 | #include <linux/pm.h> | 20 | #include <linux/pm.h> |
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index af8cb6995a1f..9000b1d19afb 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index d3a61d7ea0c5..19cd47293424 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/regulator/consumer.h> | 21 | #include <linux/regulator/consumer.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index d077df6f5e75..8cc9042965eb 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/regulator/consumer.h> | 27 | #include <linux/regulator/consumer.h> |
28 | #include <linux/slab.h> | ||
28 | 29 | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/pcm.h> | 31 | #include <sound/pcm.h> |
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index 24a35603bcf7..8ca3812f2f2f 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | #include <sound/pcm_params.h> | 26 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c index 63a254e293ca..1072621e93fd 100644 --- a/sound/soc/codecs/wm8727.c +++ b/sound/soc/codecs/wm8727.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 3fb653ba363a..07adc375a706 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 5a2619dbf283..e7c6bf163185 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
22 | #include <linux/regulator/consumer.h> | 23 | #include <linux/regulator/consumer.h> |
23 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 475c67ac7818..2916ed4d3844 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | #include <sound/pcm_params.h> | 26 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index c2444e7c8480..613199a0f799 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
42 | #include <linux/spi/spi.h> | 42 | #include <linux/spi/spi.h> |
43 | #include <linux/slab.h> | ||
43 | #include <sound/core.h> | 44 | #include <sound/core.h> |
44 | #include <sound/pcm.h> | 45 | #include <sound/pcm.h> |
45 | #include <sound/pcm_params.h> | 46 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 44e7d9d82f87..60b1b3e1094b 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | #include <sound/pcm_params.h> | 26 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index dbc368c08263..b7fd96adac64 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pm.h> | 24 | #include <linux/pm.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/slab.h> | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include <sound/pcm.h> | 29 | #include <sound/pcm.h> |
29 | #include <sound/pcm_params.h> | 30 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 3595bd57c4eb..fa5f99fde68b 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/slab.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
28 | #include <sound/pcm_params.h> | 29 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 593e47d0e0eb..c6f0abcc5711 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/regulator/consumer.h> | 21 | #include <linux/regulator/consumer.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 31e39ffd1d8e..0c04b476487f 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/spi/spi.h> | 32 | #include <linux/spi/spi.h> |
33 | #include <linux/slab.h> | ||
33 | #include <sound/core.h> | 34 | #include <sound/core.h> |
34 | #include <sound/pcm.h> | 35 | #include <sound/pcm.h> |
35 | #include <sound/pcm_params.h> | 36 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 615dab2b62ef..c8d7a809af4d 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/regulator/consumer.h> | 20 | #include <linux/regulator/consumer.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index d07bcc1e1c60..f1e63e01b04d 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pm.h> | 15 | #include <linux/pm.h> |
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/slab.h> | ||
18 | #include <sound/core.h> | 19 | #include <sound/core.h> |
19 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
20 | #include <sound/pcm_params.h> | 21 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index d2342c5e0425..50634ab76a5c 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index d9540d55fc89..a65b781af512 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/pm.h> | 20 | #include <linux/pm.h> |
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | #include <sound/pcm_params.h> | 26 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index ee637af4737a..69708c4cc004 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 28bb59ea6ea1..526f56b09066 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 2862e4dced27..bb18c3ecfeb9 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index a54dc77b7f34..831f4730bfd5 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
@@ -990,7 +991,7 @@ static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, | |||
990 | reg = snd_soc_read(codec, WM8990_CLOCKING_2); | 991 | reg = snd_soc_read(codec, WM8990_CLOCKING_2); |
991 | snd_soc_write(codec, WM8990_CLOCKING_2, reg | WM8990_SYSCLK_SRC); | 992 | snd_soc_write(codec, WM8990_CLOCKING_2, reg | WM8990_SYSCLK_SRC); |
992 | 993 | ||
993 | /* set up N , fractional mode and pre-divisor if neccessary */ | 994 | /* set up N , fractional mode and pre-divisor if necessary */ |
994 | snd_soc_write(codec, WM8990_PLL1, pll_div.n | WM8990_SDM | | 995 | snd_soc_write(codec, WM8990_PLL1, pll_div.n | WM8990_SDM | |
995 | (pll_div.div2?WM8990_PRESCALE:0)); | 996 | (pll_div.div2?WM8990_PRESCALE:0)); |
996 | snd_soc_write(codec, WM8990_PLL2, (u8)(pll_div.k>>8)); | 997 | snd_soc_write(codec, WM8990_PLL2, (u8)(pll_div.k>>8)); |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index bf022f68b84f..03e8b1a6a56c 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/regulator/consumer.h> | 19 | #include <linux/regulator/consumer.h> |
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 29f3771c33a4..9da0724cd47a 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/regulator/consumer.h> | 21 | #include <linux/regulator/consumer.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
@@ -3007,34 +3008,39 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
3007 | break; | 3008 | break; |
3008 | 3009 | ||
3009 | case SND_SOC_BIAS_OFF: | 3010 | case SND_SOC_BIAS_OFF: |
3010 | /* Switch over to startup biases */ | 3011 | if (codec->bias_level == SND_SOC_BIAS_STANDBY) { |
3011 | snd_soc_update_bits(codec, WM8994_ANTIPOP_2, | 3012 | /* Switch over to startup biases */ |
3012 | WM8994_BIAS_SRC | WM8994_STARTUP_BIAS_ENA | | 3013 | snd_soc_update_bits(codec, WM8994_ANTIPOP_2, |
3013 | WM8994_VMID_BUF_ENA | | 3014 | WM8994_BIAS_SRC | |
3014 | WM8994_VMID_RAMP_MASK, | 3015 | WM8994_STARTUP_BIAS_ENA | |
3015 | WM8994_BIAS_SRC | WM8994_STARTUP_BIAS_ENA | | 3016 | WM8994_VMID_BUF_ENA | |
3016 | WM8994_VMID_BUF_ENA | | 3017 | WM8994_VMID_RAMP_MASK, |
3017 | (1 << WM8994_VMID_RAMP_SHIFT)); | 3018 | WM8994_BIAS_SRC | |
3018 | 3019 | WM8994_STARTUP_BIAS_ENA | | |
3019 | /* Disable main biases */ | 3020 | WM8994_VMID_BUF_ENA | |
3020 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, | 3021 | (1 << WM8994_VMID_RAMP_SHIFT)); |
3021 | WM8994_BIAS_ENA | WM8994_VMID_SEL_MASK, 0); | ||
3022 | 3022 | ||
3023 | /* Discharge line */ | 3023 | /* Disable main biases */ |
3024 | snd_soc_update_bits(codec, WM8994_ANTIPOP_1, | 3024 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, |
3025 | WM8994_LINEOUT1_DISCH | | 3025 | WM8994_BIAS_ENA | |
3026 | WM8994_LINEOUT2_DISCH, | 3026 | WM8994_VMID_SEL_MASK, 0); |
3027 | WM8994_LINEOUT1_DISCH | | ||
3028 | WM8994_LINEOUT2_DISCH); | ||
3029 | 3027 | ||
3030 | msleep(5); | 3028 | /* Discharge line */ |
3029 | snd_soc_update_bits(codec, WM8994_ANTIPOP_1, | ||
3030 | WM8994_LINEOUT1_DISCH | | ||
3031 | WM8994_LINEOUT2_DISCH, | ||
3032 | WM8994_LINEOUT1_DISCH | | ||
3033 | WM8994_LINEOUT2_DISCH); | ||
3031 | 3034 | ||
3032 | /* Switch off startup biases */ | 3035 | msleep(5); |
3033 | snd_soc_update_bits(codec, WM8994_ANTIPOP_2, | ||
3034 | WM8994_BIAS_SRC | WM8994_STARTUP_BIAS_ENA | | ||
3035 | WM8994_VMID_BUF_ENA | | ||
3036 | WM8994_VMID_RAMP_MASK, 0); | ||
3037 | 3036 | ||
3037 | /* Switch off startup biases */ | ||
3038 | snd_soc_update_bits(codec, WM8994_ANTIPOP_2, | ||
3039 | WM8994_BIAS_SRC | | ||
3040 | WM8994_STARTUP_BIAS_ENA | | ||
3041 | WM8994_VMID_BUF_ENA | | ||
3042 | WM8994_VMID_RAMP_MASK, 0); | ||
3043 | } | ||
3038 | break; | 3044 | break; |
3039 | } | 3045 | } |
3040 | codec->bias_level = level; | 3046 | codec->bias_level = level; |
@@ -3401,7 +3407,7 @@ struct snd_soc_dai wm8994_dai[] = { | |||
3401 | .rates = WM8994_RATES, | 3407 | .rates = WM8994_RATES, |
3402 | .formats = WM8994_FORMATS, | 3408 | .formats = WM8994_FORMATS, |
3403 | }, | 3409 | }, |
3404 | .playback = { | 3410 | .capture = { |
3405 | .stream_name = "AIF3 Capture", | 3411 | .stream_name = "AIF3 Capture", |
3406 | .channels_min = 2, | 3412 | .channels_min = 2, |
3407 | .channels_max = 2, | 3413 | .channels_max = 2, |
@@ -3730,11 +3736,12 @@ static int wm8994_codec_probe(struct platform_device *pdev) | |||
3730 | case 3: | 3736 | case 3: |
3731 | wm8994->hubs.dcs_codes = -5; | 3737 | wm8994->hubs.dcs_codes = -5; |
3732 | wm8994->hubs.hp_startup_mode = 1; | 3738 | wm8994->hubs.hp_startup_mode = 1; |
3739 | wm8994->hubs.dcs_readback_mode = 1; | ||
3733 | break; | 3740 | break; |
3734 | default: | 3741 | default: |
3742 | wm8994->hubs.dcs_readback_mode = 1; | ||
3735 | break; | 3743 | break; |
3736 | } | 3744 | } |
3737 | |||
3738 | 3745 | ||
3739 | /* Remember if AIFnLRCLK is configured as a GPIO. This should be | 3746 | /* Remember if AIFnLRCLK is configured as a GPIO. This should be |
3740 | * configured on init - if a system wants to do this dynamically | 3747 | * configured on init - if a system wants to do this dynamically |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index c468497314ba..3a184fcb702b 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index ec54c6da9856..8793341849d1 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index e237bf615129..2f48a8aae22c 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/device.h> | 17 | #include <linux/device.h> |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index ceb86b4ddb25..2fca514fde58 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/slab.h> | ||
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/device.h> | 21 | #include <linux/device.h> |
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 0ad9f5d536c6..e1f225a3ac46 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -62,21 +62,27 @@ static const char *speaker_mode_text[] = { | |||
62 | static const struct soc_enum speaker_mode = | 62 | static const struct soc_enum speaker_mode = |
63 | SOC_ENUM_SINGLE(WM8993_SPKMIXR_ATTENUATION, 8, 2, speaker_mode_text); | 63 | SOC_ENUM_SINGLE(WM8993_SPKMIXR_ATTENUATION, 8, 2, speaker_mode_text); |
64 | 64 | ||
65 | static void wait_for_dc_servo(struct snd_soc_codec *codec) | 65 | static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) |
66 | { | 66 | { |
67 | unsigned int reg; | 67 | unsigned int reg; |
68 | int count = 0; | 68 | int count = 0; |
69 | unsigned int val; | ||
70 | |||
71 | val = op | WM8993_DCS_ENA_CHAN_0 | WM8993_DCS_ENA_CHAN_1; | ||
72 | |||
73 | /* Trigger the command */ | ||
74 | snd_soc_write(codec, WM8993_DC_SERVO_0, val); | ||
69 | 75 | ||
70 | dev_dbg(codec->dev, "Waiting for DC servo...\n"); | 76 | dev_dbg(codec->dev, "Waiting for DC servo...\n"); |
71 | 77 | ||
72 | do { | 78 | do { |
73 | count++; | 79 | count++; |
74 | msleep(1); | 80 | msleep(1); |
75 | reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_0); | 81 | reg = snd_soc_read(codec, WM8993_DC_SERVO_0); |
76 | dev_dbg(codec->dev, "DC servo: %x\n", reg); | 82 | dev_dbg(codec->dev, "DC servo: %x\n", reg); |
77 | } while (reg & WM8993_DCS_DATAPATH_BUSY); | 83 | } while (reg & op && count < 400); |
78 | 84 | ||
79 | if (reg & WM8993_DCS_DATAPATH_BUSY) | 85 | if (reg & op) |
80 | dev_err(codec->dev, "Timed out waiting for DC Servo\n"); | 86 | dev_err(codec->dev, "Timed out waiting for DC Servo\n"); |
81 | } | 87 | } |
82 | 88 | ||
@@ -86,51 +92,58 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec) | |||
86 | static void calibrate_dc_servo(struct snd_soc_codec *codec) | 92 | static void calibrate_dc_servo(struct snd_soc_codec *codec) |
87 | { | 93 | { |
88 | struct wm_hubs_data *hubs = codec->private_data; | 94 | struct wm_hubs_data *hubs = codec->private_data; |
89 | u16 reg, dcs_cfg; | 95 | u16 reg, reg_l, reg_r, dcs_cfg; |
90 | 96 | ||
91 | /* Set for 32 series updates */ | 97 | /* Set for 32 series updates */ |
92 | snd_soc_update_bits(codec, WM8993_DC_SERVO_1, | 98 | snd_soc_update_bits(codec, WM8993_DC_SERVO_1, |
93 | WM8993_DCS_SERIES_NO_01_MASK, | 99 | WM8993_DCS_SERIES_NO_01_MASK, |
94 | 32 << WM8993_DCS_SERIES_NO_01_SHIFT); | 100 | 32 << WM8993_DCS_SERIES_NO_01_SHIFT); |
95 | 101 | wait_for_dc_servo(codec, | |
96 | /* Enable the DC servo. Write all bits to avoid triggering startup | 102 | WM8993_DCS_TRIG_SERIES_0 | WM8993_DCS_TRIG_SERIES_1); |
97 | * or write calibration. | ||
98 | */ | ||
99 | snd_soc_update_bits(codec, WM8993_DC_SERVO_0, | ||
100 | 0xFFFF, | ||
101 | WM8993_DCS_ENA_CHAN_0 | | ||
102 | WM8993_DCS_ENA_CHAN_1 | | ||
103 | WM8993_DCS_TRIG_SERIES_1 | | ||
104 | WM8993_DCS_TRIG_SERIES_0); | ||
105 | |||
106 | wait_for_dc_servo(codec); | ||
107 | 103 | ||
108 | /* Apply correction to DC servo result */ | 104 | /* Apply correction to DC servo result */ |
109 | if (hubs->dcs_codes) { | 105 | if (hubs->dcs_codes) { |
110 | dev_dbg(codec->dev, "Applying %d code DC servo correction\n", | 106 | dev_dbg(codec->dev, "Applying %d code DC servo correction\n", |
111 | hubs->dcs_codes); | 107 | hubs->dcs_codes); |
112 | 108 | ||
109 | /* Different chips in the family support different | ||
110 | * readback methods. | ||
111 | */ | ||
112 | switch (hubs->dcs_readback_mode) { | ||
113 | case 0: | ||
114 | reg_l = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1) | ||
115 | & WM8993_DCS_INTEG_CHAN_0_MASK;; | ||
116 | reg_r = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2) | ||
117 | & WM8993_DCS_INTEG_CHAN_1_MASK; | ||
118 | break; | ||
119 | case 1: | ||
120 | reg = snd_soc_read(codec, WM8993_DC_SERVO_3); | ||
121 | reg_l = (reg & WM8993_DCS_DAC_WR_VAL_1_MASK) | ||
122 | >> WM8993_DCS_DAC_WR_VAL_1_SHIFT; | ||
123 | reg_r = reg & WM8993_DCS_DAC_WR_VAL_0_MASK; | ||
124 | break; | ||
125 | default: | ||
126 | WARN(1, "Unknown DCS readback method"); | ||
127 | break; | ||
128 | } | ||
129 | |||
113 | /* HPOUT1L */ | 130 | /* HPOUT1L */ |
114 | reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1) & | 131 | if (reg_l + hubs->dcs_codes > 0 && |
115 | WM8993_DCS_INTEG_CHAN_0_MASK;; | 132 | reg_l + hubs->dcs_codes < 0xff) |
116 | reg += hubs->dcs_codes; | 133 | reg_l += hubs->dcs_codes; |
117 | dcs_cfg = reg << WM8993_DCS_DAC_WR_VAL_1_SHIFT; | 134 | dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT; |
118 | 135 | ||
119 | /* HPOUT1R */ | 136 | /* HPOUT1R */ |
120 | reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2) & | 137 | if (reg_r + hubs->dcs_codes > 0 && |
121 | WM8993_DCS_INTEG_CHAN_1_MASK; | 138 | reg_r + hubs->dcs_codes < 0xff) |
122 | reg += hubs->dcs_codes; | 139 | reg_r += hubs->dcs_codes; |
123 | dcs_cfg |= reg; | 140 | dcs_cfg |= reg_r; |
124 | 141 | ||
125 | /* Do it */ | 142 | /* Do it */ |
126 | snd_soc_write(codec, WM8993_DC_SERVO_3, dcs_cfg); | 143 | snd_soc_write(codec, WM8993_DC_SERVO_3, dcs_cfg); |
127 | snd_soc_update_bits(codec, WM8993_DC_SERVO_0, | 144 | wait_for_dc_servo(codec, |
128 | WM8993_DCS_TRIG_DAC_WR_0 | | 145 | WM8993_DCS_TRIG_DAC_WR_0 | |
129 | WM8993_DCS_TRIG_DAC_WR_1, | 146 | WM8993_DCS_TRIG_DAC_WR_1); |
130 | WM8993_DCS_TRIG_DAC_WR_0 | | ||
131 | WM8993_DCS_TRIG_DAC_WR_1); | ||
132 | |||
133 | wait_for_dc_servo(codec); | ||
134 | } | 147 | } |
135 | } | 148 | } |
136 | 149 | ||
@@ -141,10 +154,16 @@ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol, | |||
141 | struct snd_ctl_elem_value *ucontrol) | 154 | struct snd_ctl_elem_value *ucontrol) |
142 | { | 155 | { |
143 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 156 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
157 | struct wm_hubs_data *hubs = codec->private_data; | ||
144 | int ret; | 158 | int ret; |
145 | 159 | ||
146 | ret = snd_soc_put_volsw_2r(kcontrol, ucontrol); | 160 | ret = snd_soc_put_volsw_2r(kcontrol, ucontrol); |
147 | 161 | ||
162 | /* If we're applying an offset correction then updating the | ||
163 | * callibration would be likely to introduce further offsets. */ | ||
164 | if (hubs->dcs_codes) | ||
165 | return ret; | ||
166 | |||
148 | /* Only need to do this if the outputs are active */ | 167 | /* Only need to do this if the outputs are active */ |
149 | if (snd_soc_read(codec, WM8993_POWER_MANAGEMENT_1) | 168 | if (snd_soc_read(codec, WM8993_POWER_MANAGEMENT_1) |
150 | & (WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA)) | 169 | & (WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA)) |
diff --git a/sound/soc/codecs/wm_hubs.h b/sound/soc/codecs/wm_hubs.h index 420104fe9c90..e51c16683589 100644 --- a/sound/soc/codecs/wm_hubs.h +++ b/sound/soc/codecs/wm_hubs.h | |||
@@ -21,6 +21,7 @@ extern const unsigned int wm_hubs_spkmix_tlv[]; | |||
21 | /* This *must* be the first element of the codec->private_data struct */ | 21 | /* This *must* be the first element of the codec->private_data struct */ |
22 | struct wm_hubs_data { | 22 | struct wm_hubs_data { |
23 | int dcs_codes; | 23 | int dcs_codes; |
24 | int dcs_readback_mode; | ||
24 | int hp_startup_mode; | 25 | int hp_startup_mode; |
25 | }; | 26 | }; |
26 | 27 | ||
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 6362ca05506e..adadcd3aa1b1 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
16 | #include <linux/io.h> | 17 | #include <linux/io.h> |
17 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
@@ -585,7 +586,8 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
585 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; | 586 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; |
586 | 587 | ||
587 | davinci_i2s_dai.private_data = dev; | 588 | davinci_i2s_dai.private_data = dev; |
588 | davinci_i2s_dai.dma_data = dev->dma_params; | 589 | davinci_i2s_dai.capture.dma_data = dev->dma_params; |
590 | davinci_i2s_dai.playback.dma_data = dev->dma_params; | ||
589 | ret = snd_soc_register_dai(&davinci_i2s_dai); | 591 | ret = snd_soc_register_dai(&davinci_i2s_dai); |
590 | if (ret != 0) | 592 | if (ret != 0) |
591 | goto err_free_mem; | 593 | goto err_free_mem; |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index ab6518d86f18..79f0f4ad242c 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
22 | #include <linux/io.h> | 23 | #include <linux/io.h> |
23 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
@@ -917,7 +918,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
917 | 918 | ||
918 | dma_data->channel = res->start; | 919 | dma_data->channel = res->start; |
919 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; | 920 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; |
920 | davinci_mcasp_dai[pdata->op_mode].dma_data = dev->dma_params; | 921 | davinci_mcasp_dai[pdata->op_mode].capture.dma_data = dev->dma_params; |
922 | davinci_mcasp_dai[pdata->op_mode].playback.dma_data = dev->dma_params; | ||
921 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; | 923 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; |
922 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); | 924 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); |
923 | 925 | ||
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 80c7fdf2f521..2dc406f42fe7 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -649,8 +649,10 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) | |||
649 | struct snd_pcm_hardware *ppcm; | 649 | struct snd_pcm_hardware *ppcm; |
650 | int ret = 0; | 650 | int ret = 0; |
651 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 651 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
652 | struct davinci_pcm_dma_params *pa = rtd->dai->cpu_dai->dma_data; | 652 | struct davinci_pcm_dma_params *pa; |
653 | struct davinci_pcm_dma_params *params; | 653 | struct davinci_pcm_dma_params *params; |
654 | |||
655 | pa = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
654 | if (!pa) | 656 | if (!pa) |
655 | return -ENODEV; | 657 | return -ENODEV; |
656 | params = &pa[substream->stream]; | 658 | params = &pa[substream->stream]; |
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index b1a3a278819f..410c7496a18d 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/gfp.h> | ||
22 | 23 | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 93f0f38a32c9..762c1b8e8e4e 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/slab.h> | ||
17 | 18 | ||
18 | #include <sound/core.h> | 19 | #include <sound/core.h> |
19 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 30ed568afb2e..d639e55c5124 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/of_device.h> | 10 | #include <linux/of_device.h> |
11 | #include <linux/slab.h> | ||
11 | 12 | ||
12 | #include <sound/soc.h> | 13 | #include <sound/soc.h> |
13 | 14 | ||
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index ef67d1cdffe7..83de1c81c8c4 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * express or implied. | 9 | * express or implied. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/slab.h> | ||
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
14 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
diff --git a/sound/soc/fsl/soc-of-simple.c b/sound/soc/fsl/soc-of-simple.c index 8bc5cd9e972f..3bc13fd89096 100644 --- a/sound/soc/fsl/soc-of-simple.c +++ b/sound/soc/fsl/soc-of-simple.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/of.h> | 14 | #include <linux/of.h> |
15 | #include <linux/slab.h> | ||
15 | #include <sound/core.h> | 16 | #include <sound/core.h> |
16 | #include <sound/pcm.h> | 17 | #include <sound/pcm.h> |
17 | #include <sound/pcm_params.h> | 18 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index c7d0fd9b7de8..7174b4c710de 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config SND_IMX_SOC | 1 | config SND_IMX_SOC |
2 | tristate "SoC Audio for Freescale i.MX CPUs" | 2 | tristate "SoC Audio for Freescale i.MX CPUs" |
3 | depends on ARCH_MXC && BROKEN | 3 | depends on ARCH_MXC |
4 | select SND_PCM | 4 | select SND_PCM |
5 | select FIQ | 5 | select FIQ |
6 | select SND_SOC_AC97_BUS | 6 | select SND_SOC_AC97_BUS |
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index 19452e44afdc..2b31ac673ea4 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/slab.h> | ||
22 | 23 | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/initval.h> | 25 | #include <sound/initval.h> |
@@ -70,7 +71,12 @@ static void imx_ssi_dma_callback(int channel, void *data) | |||
70 | 71 | ||
71 | static void snd_imx_dma_err_callback(int channel, void *data, int err) | 72 | static void snd_imx_dma_err_callback(int channel, void *data, int err) |
72 | { | 73 | { |
73 | pr_err("DMA error callback called\n"); | 74 | struct snd_pcm_substream *substream = data; |
75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
76 | struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; | ||
77 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
78 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
79 | int ret; | ||
74 | 80 | ||
75 | pr_err("DMA timeout on channel %d -%s%s%s%s\n", | 81 | pr_err("DMA timeout on channel %d -%s%s%s%s\n", |
76 | channel, | 82 | channel, |
@@ -78,16 +84,26 @@ static void snd_imx_dma_err_callback(int channel, void *data, int err) | |||
78 | err & IMX_DMA_ERR_REQUEST ? " request" : "", | 84 | err & IMX_DMA_ERR_REQUEST ? " request" : "", |
79 | err & IMX_DMA_ERR_TRANSFER ? " transfer" : "", | 85 | err & IMX_DMA_ERR_TRANSFER ? " transfer" : "", |
80 | err & IMX_DMA_ERR_BUFFER ? " buffer" : ""); | 86 | err & IMX_DMA_ERR_BUFFER ? " buffer" : ""); |
87 | |||
88 | imx_dma_disable(iprtd->dma); | ||
89 | ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
90 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
91 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
92 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
93 | if (!ret) | ||
94 | imx_dma_enable(iprtd->dma); | ||
81 | } | 95 | } |
82 | 96 | ||
83 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) | 97 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) |
84 | { | 98 | { |
85 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 99 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
86 | struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; | 100 | struct imx_pcm_dma_params *dma_params; |
87 | struct snd_pcm_runtime *runtime = substream->runtime; | 101 | struct snd_pcm_runtime *runtime = substream->runtime; |
88 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 102 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
89 | int ret; | 103 | int ret; |
90 | 104 | ||
105 | dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream); | ||
106 | |||
91 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); | 107 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); |
92 | if (iprtd->dma < 0) { | 108 | if (iprtd->dma < 0) { |
93 | pr_err("Failed to claim the audio DMA\n"); | 109 | pr_err("Failed to claim the audio DMA\n"); |
@@ -192,10 +208,12 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) | |||
192 | { | 208 | { |
193 | struct snd_pcm_runtime *runtime = substream->runtime; | 209 | struct snd_pcm_runtime *runtime = substream->runtime; |
194 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 210 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
195 | struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; | 211 | struct imx_pcm_dma_params *dma_params; |
196 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 212 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
197 | int err; | 213 | int err; |
198 | 214 | ||
215 | dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream); | ||
216 | |||
199 | iprtd->substream = substream; | 217 | iprtd->substream = substream; |
200 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; | 218 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; |
201 | iprtd->period_cnt = 0; | 219 | iprtd->period_cnt = 0; |
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index d9cb9849b033..6b518e07eea9 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/slab.h> | ||
22 | 23 | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/initval.h> | 25 | #include <sound/initval.h> |
@@ -38,23 +39,24 @@ struct imx_pcm_runtime_data { | |||
38 | unsigned long offset; | 39 | unsigned long offset; |
39 | unsigned long last_offset; | 40 | unsigned long last_offset; |
40 | unsigned long size; | 41 | unsigned long size; |
41 | struct timer_list timer; | 42 | struct hrtimer hrt; |
42 | int poll_time; | 43 | int poll_time_ns; |
44 | struct snd_pcm_substream *substream; | ||
45 | atomic_t running; | ||
43 | }; | 46 | }; |
44 | 47 | ||
45 | static inline void imx_ssi_set_next_poll(struct imx_pcm_runtime_data *iprtd) | 48 | static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) |
46 | { | 49 | { |
47 | iprtd->timer.expires = jiffies + iprtd->poll_time; | 50 | struct imx_pcm_runtime_data *iprtd = |
48 | } | 51 | container_of(hrt, struct imx_pcm_runtime_data, hrt); |
49 | 52 | struct snd_pcm_substream *substream = iprtd->substream; | |
50 | static void imx_ssi_timer_callback(unsigned long data) | ||
51 | { | ||
52 | struct snd_pcm_substream *substream = (void *)data; | ||
53 | struct snd_pcm_runtime *runtime = substream->runtime; | 53 | struct snd_pcm_runtime *runtime = substream->runtime; |
54 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
55 | struct pt_regs regs; | 54 | struct pt_regs regs; |
56 | unsigned long delta; | 55 | unsigned long delta; |
57 | 56 | ||
57 | if (!atomic_read(&iprtd->running)) | ||
58 | return HRTIMER_NORESTART; | ||
59 | |||
58 | get_fiq_regs(®s); | 60 | get_fiq_regs(®s); |
59 | 61 | ||
60 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 62 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -71,16 +73,14 @@ static void imx_ssi_timer_callback(unsigned long data) | |||
71 | 73 | ||
72 | /* If we've transferred at least a period then report it and | 74 | /* If we've transferred at least a period then report it and |
73 | * reset our poll time */ | 75 | * reset our poll time */ |
74 | if (delta >= runtime->period_size) { | 76 | if (delta >= iprtd->period) { |
75 | snd_pcm_period_elapsed(substream); | 77 | snd_pcm_period_elapsed(substream); |
76 | iprtd->last_offset = iprtd->offset; | 78 | iprtd->last_offset = iprtd->offset; |
77 | |||
78 | imx_ssi_set_next_poll(iprtd); | ||
79 | } | 79 | } |
80 | 80 | ||
81 | /* Restart the timer; if we didn't report we'll run on the next tick */ | 81 | hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns)); |
82 | add_timer(&iprtd->timer); | ||
83 | 82 | ||
83 | return HRTIMER_RESTART; | ||
84 | } | 84 | } |
85 | 85 | ||
86 | static struct fiq_handler fh = { | 86 | static struct fiq_handler fh = { |
@@ -98,8 +98,8 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
98 | iprtd->period = params_period_bytes(params) ; | 98 | iprtd->period = params_period_bytes(params) ; |
99 | iprtd->offset = 0; | 99 | iprtd->offset = 0; |
100 | iprtd->last_offset = 0; | 100 | iprtd->last_offset = 0; |
101 | iprtd->poll_time = HZ / (params_rate(params) / params_period_size(params)); | 101 | iprtd->poll_time_ns = 1000000000 / params_rate(params) * |
102 | 102 | params_period_size(params); | |
103 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 103 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
104 | 104 | ||
105 | return 0; | 105 | return 0; |
@@ -134,8 +134,9 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
134 | case SNDRV_PCM_TRIGGER_START: | 134 | case SNDRV_PCM_TRIGGER_START: |
135 | case SNDRV_PCM_TRIGGER_RESUME: | 135 | case SNDRV_PCM_TRIGGER_RESUME: |
136 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 136 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
137 | imx_ssi_set_next_poll(iprtd); | 137 | atomic_set(&iprtd->running, 1); |
138 | add_timer(&iprtd->timer); | 138 | hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns), |
139 | HRTIMER_MODE_REL); | ||
139 | if (++fiq_enable == 1) | 140 | if (++fiq_enable == 1) |
140 | enable_fiq(imx_pcm_fiq); | 141 | enable_fiq(imx_pcm_fiq); |
141 | 142 | ||
@@ -144,11 +145,11 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
144 | case SNDRV_PCM_TRIGGER_STOP: | 145 | case SNDRV_PCM_TRIGGER_STOP: |
145 | case SNDRV_PCM_TRIGGER_SUSPEND: | 146 | case SNDRV_PCM_TRIGGER_SUSPEND: |
146 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 147 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
147 | del_timer(&iprtd->timer); | 148 | atomic_set(&iprtd->running, 0); |
149 | |||
148 | if (--fiq_enable == 0) | 150 | if (--fiq_enable == 0) |
149 | disable_fiq(imx_pcm_fiq); | 151 | disable_fiq(imx_pcm_fiq); |
150 | 152 | ||
151 | |||
152 | break; | 153 | break; |
153 | default: | 154 | default: |
154 | return -EINVAL; | 155 | return -EINVAL; |
@@ -179,7 +180,7 @@ static struct snd_pcm_hardware snd_imx_hardware = { | |||
179 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, | 180 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, |
180 | .period_bytes_min = 128, | 181 | .period_bytes_min = 128, |
181 | .period_bytes_max = 16 * 1024, | 182 | .period_bytes_max = 16 * 1024, |
182 | .periods_min = 2, | 183 | .periods_min = 4, |
183 | .periods_max = 255, | 184 | .periods_max = 255, |
184 | .fifo_size = 0, | 185 | .fifo_size = 0, |
185 | }; | 186 | }; |
@@ -193,9 +194,11 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | |||
193 | iprtd = kzalloc(sizeof(*iprtd), GFP_KERNEL); | 194 | iprtd = kzalloc(sizeof(*iprtd), GFP_KERNEL); |
194 | runtime->private_data = iprtd; | 195 | runtime->private_data = iprtd; |
195 | 196 | ||
196 | init_timer(&iprtd->timer); | 197 | iprtd->substream = substream; |
197 | iprtd->timer.data = (unsigned long)substream; | 198 | |
198 | iprtd->timer.function = imx_ssi_timer_callback; | 199 | atomic_set(&iprtd->running, 0); |
200 | hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
201 | iprtd->hrt.function = snd_hrtimer_callback; | ||
199 | 202 | ||
200 | ret = snd_pcm_hw_constraint_integer(substream->runtime, | 203 | ret = snd_pcm_hw_constraint_integer(substream->runtime, |
201 | SNDRV_PCM_HW_PARAM_PERIODS); | 204 | SNDRV_PCM_HW_PARAM_PERIODS); |
@@ -211,7 +214,8 @@ static int snd_imx_close(struct snd_pcm_substream *substream) | |||
211 | struct snd_pcm_runtime *runtime = substream->runtime; | 214 | struct snd_pcm_runtime *runtime = substream->runtime; |
212 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 215 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
213 | 216 | ||
214 | del_timer_sync(&iprtd->timer); | 217 | hrtimer_cancel(&iprtd->hrt); |
218 | |||
215 | kfree(iprtd); | 219 | kfree(iprtd); |
216 | 220 | ||
217 | return 0; | 221 | return 0; |
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 56f46a75d297..80b4fee2442b 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/module.h> | 40 | #include <linux/module.h> |
41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
42 | #include <linux/slab.h> | ||
42 | 43 | ||
43 | #include <sound/core.h> | 44 | #include <sound/core.h> |
44 | #include <sound/initval.h> | 45 | #include <sound/initval.h> |
@@ -234,17 +235,20 @@ static int imx_ssi_hw_params(struct snd_pcm_substream *substream, | |||
234 | struct snd_soc_dai *cpu_dai) | 235 | struct snd_soc_dai *cpu_dai) |
235 | { | 236 | { |
236 | struct imx_ssi *ssi = cpu_dai->private_data; | 237 | struct imx_ssi *ssi = cpu_dai->private_data; |
238 | struct imx_pcm_dma_params *dma_data; | ||
237 | u32 reg, sccr; | 239 | u32 reg, sccr; |
238 | 240 | ||
239 | /* Tx/Rx config */ | 241 | /* Tx/Rx config */ |
240 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 242 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
241 | reg = SSI_STCCR; | 243 | reg = SSI_STCCR; |
242 | cpu_dai->dma_data = &ssi->dma_params_tx; | 244 | dma_data = &ssi->dma_params_tx; |
243 | } else { | 245 | } else { |
244 | reg = SSI_SRCCR; | 246 | reg = SSI_SRCCR; |
245 | cpu_dai->dma_data = &ssi->dma_params_rx; | 247 | dma_data = &ssi->dma_params_rx; |
246 | } | 248 | } |
247 | 249 | ||
250 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
251 | |||
248 | sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK; | 252 | sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK; |
249 | 253 | ||
250 | /* DAI data (word) size */ | 254 | /* DAI data (word) size */ |
@@ -652,7 +656,8 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
652 | dai->private_data = ssi; | 656 | dai->private_data = ssi; |
653 | 657 | ||
654 | if ((cpu_is_mx27() || cpu_is_mx21()) && | 658 | if ((cpu_is_mx27() || cpu_is_mx21()) && |
655 | !(ssi->flags & IMX_SSI_USE_AC97)) { | 659 | !(ssi->flags & IMX_SSI_USE_AC97) && |
660 | (ssi->flags & IMX_SSI_DMA)) { | ||
656 | ssi->flags |= IMX_SSI_DMA; | 661 | ssi->flags |= IMX_SSI_DMA; |
657 | platform = imx_ssi_dma_mx2_init(pdev, ssi); | 662 | platform = imx_ssi_dma_mx2_init(pdev, ssi); |
658 | } else | 663 | } else |
diff --git a/sound/soc/omap/mcpdm.c b/sound/soc/omap/mcpdm.c index ad8df6cfae88..1dab4c14874d 100644 --- a/sound/soc/omap/mcpdm.c +++ b/sound/soc/omap/mcpdm.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/device.h> | 25 | #include <linux/device.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
28 | #include <linux/slab.h> | ||
28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
29 | #include <linux/err.h> | 30 | #include <linux/err.h> |
30 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index d29725664185..8ad9dc901007 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -39,6 +39,14 @@ | |||
39 | 39 | ||
40 | #define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000) | 40 | #define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000) |
41 | 41 | ||
42 | #define OMAP_MCBSP_SOC_SINGLE_S16_EXT(xname, xmin, xmax, \ | ||
43 | xhandler_get, xhandler_put) \ | ||
44 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
45 | .info = omap_mcbsp_st_info_volsw, \ | ||
46 | .get = xhandler_get, .put = xhandler_put, \ | ||
47 | .private_value = (unsigned long) &(struct soc_mixer_control) \ | ||
48 | {.min = xmin, .max = xmax} } | ||
49 | |||
42 | struct omap_mcbsp_data { | 50 | struct omap_mcbsp_data { |
43 | unsigned int bus_id; | 51 | unsigned int bus_id; |
44 | struct omap_mcbsp_reg_cfg regs; | 52 | struct omap_mcbsp_reg_cfg regs; |
@@ -82,11 +90,11 @@ static const int omap1_dma_reqs[][2] = {}; | |||
82 | static const unsigned long omap1_mcbsp_port[][2] = {}; | 90 | static const unsigned long omap1_mcbsp_port[][2] = {}; |
83 | #endif | 91 | #endif |
84 | 92 | ||
85 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 93 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
86 | static const int omap24xx_dma_reqs[][2] = { | 94 | static const int omap24xx_dma_reqs[][2] = { |
87 | { OMAP24XX_DMA_MCBSP1_TX, OMAP24XX_DMA_MCBSP1_RX }, | 95 | { OMAP24XX_DMA_MCBSP1_TX, OMAP24XX_DMA_MCBSP1_RX }, |
88 | { OMAP24XX_DMA_MCBSP2_TX, OMAP24XX_DMA_MCBSP2_RX }, | 96 | { OMAP24XX_DMA_MCBSP2_TX, OMAP24XX_DMA_MCBSP2_RX }, |
89 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) | 97 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) |
90 | { OMAP24XX_DMA_MCBSP3_TX, OMAP24XX_DMA_MCBSP3_RX }, | 98 | { OMAP24XX_DMA_MCBSP3_TX, OMAP24XX_DMA_MCBSP3_RX }, |
91 | { OMAP24XX_DMA_MCBSP4_TX, OMAP24XX_DMA_MCBSP4_RX }, | 99 | { OMAP24XX_DMA_MCBSP4_TX, OMAP24XX_DMA_MCBSP4_RX }, |
92 | { OMAP24XX_DMA_MCBSP5_TX, OMAP24XX_DMA_MCBSP5_RX }, | 100 | { OMAP24XX_DMA_MCBSP5_TX, OMAP24XX_DMA_MCBSP5_RX }, |
@@ -124,7 +132,7 @@ static const unsigned long omap2430_mcbsp_port[][2] = { | |||
124 | static const unsigned long omap2430_mcbsp_port[][2] = {}; | 132 | static const unsigned long omap2430_mcbsp_port[][2] = {}; |
125 | #endif | 133 | #endif |
126 | 134 | ||
127 | #if defined(CONFIG_ARCH_OMAP34XX) | 135 | #if defined(CONFIG_ARCH_OMAP3) |
128 | static const unsigned long omap34xx_mcbsp_port[][2] = { | 136 | static const unsigned long omap34xx_mcbsp_port[][2] = { |
129 | { OMAP34XX_MCBSP1_BASE + OMAP_MCBSP_REG_DXR, | 137 | { OMAP34XX_MCBSP1_BASE + OMAP_MCBSP_REG_DXR, |
130 | OMAP34XX_MCBSP1_BASE + OMAP_MCBSP_REG_DRR }, | 138 | OMAP34XX_MCBSP1_BASE + OMAP_MCBSP_REG_DRR }, |
@@ -289,7 +297,9 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
289 | omap_mcbsp_dai_dma_params[id][substream->stream].sync_mode = sync_mode; | 297 | omap_mcbsp_dai_dma_params[id][substream->stream].sync_mode = sync_mode; |
290 | omap_mcbsp_dai_dma_params[id][substream->stream].data_type = | 298 | omap_mcbsp_dai_dma_params[id][substream->stream].data_type = |
291 | OMAP_DMA_DATA_TYPE_S16; | 299 | OMAP_DMA_DATA_TYPE_S16; |
292 | cpu_dai->dma_data = &omap_mcbsp_dai_dma_params[id][substream->stream]; | 300 | |
301 | snd_soc_dai_set_dma_data(cpu_dai, substream, | ||
302 | &omap_mcbsp_dai_dma_params[id][substream->stream]); | ||
293 | 303 | ||
294 | if (mcbsp_data->configured) { | 304 | if (mcbsp_data->configured) { |
295 | /* McBSP already configured by another stream */ | 305 | /* McBSP already configured by another stream */ |
@@ -639,6 +649,136 @@ struct snd_soc_dai omap_mcbsp_dai[] = { | |||
639 | 649 | ||
640 | EXPORT_SYMBOL_GPL(omap_mcbsp_dai); | 650 | EXPORT_SYMBOL_GPL(omap_mcbsp_dai); |
641 | 651 | ||
652 | int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, | ||
653 | struct snd_ctl_elem_info *uinfo) | ||
654 | { | ||
655 | struct soc_mixer_control *mc = | ||
656 | (struct soc_mixer_control *)kcontrol->private_value; | ||
657 | int max = mc->max; | ||
658 | int min = mc->min; | ||
659 | |||
660 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
661 | uinfo->count = 1; | ||
662 | uinfo->value.integer.min = min; | ||
663 | uinfo->value.integer.max = max; | ||
664 | return 0; | ||
665 | } | ||
666 | |||
667 | #define OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(id, channel) \ | ||
668 | static int \ | ||
669 | omap_mcbsp##id##_set_st_ch##channel##_volume(struct snd_kcontrol *kc, \ | ||
670 | struct snd_ctl_elem_value *uc) \ | ||
671 | { \ | ||
672 | struct soc_mixer_control *mc = \ | ||
673 | (struct soc_mixer_control *)kc->private_value; \ | ||
674 | int max = mc->max; \ | ||
675 | int min = mc->min; \ | ||
676 | int val = uc->value.integer.value[0]; \ | ||
677 | \ | ||
678 | if (val < min || val > max) \ | ||
679 | return -EINVAL; \ | ||
680 | \ | ||
681 | /* OMAP McBSP implementation uses index values 0..4 */ \ | ||
682 | return omap_st_set_chgain((id)-1, channel, val); \ | ||
683 | } | ||
684 | |||
685 | #define OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(id, channel) \ | ||
686 | static int \ | ||
687 | omap_mcbsp##id##_get_st_ch##channel##_volume(struct snd_kcontrol *kc, \ | ||
688 | struct snd_ctl_elem_value *uc) \ | ||
689 | { \ | ||
690 | s16 chgain; \ | ||
691 | \ | ||
692 | if (omap_st_get_chgain((id)-1, channel, &chgain)) \ | ||
693 | return -EAGAIN; \ | ||
694 | \ | ||
695 | uc->value.integer.value[0] = chgain; \ | ||
696 | return 0; \ | ||
697 | } | ||
698 | |||
699 | OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(2, 0) | ||
700 | OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(2, 1) | ||
701 | OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(3, 0) | ||
702 | OMAP_MCBSP_ST_SET_CHANNEL_VOLUME(3, 1) | ||
703 | OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(2, 0) | ||
704 | OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(2, 1) | ||
705 | OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(3, 0) | ||
706 | OMAP_MCBSP_ST_GET_CHANNEL_VOLUME(3, 1) | ||
707 | |||
708 | static int omap_mcbsp_st_put_mode(struct snd_kcontrol *kcontrol, | ||
709 | struct snd_ctl_elem_value *ucontrol) | ||
710 | { | ||
711 | struct soc_mixer_control *mc = | ||
712 | (struct soc_mixer_control *)kcontrol->private_value; | ||
713 | u8 value = ucontrol->value.integer.value[0]; | ||
714 | |||
715 | if (value == omap_st_is_enabled(mc->reg)) | ||
716 | return 0; | ||
717 | |||
718 | if (value) | ||
719 | omap_st_enable(mc->reg); | ||
720 | else | ||
721 | omap_st_disable(mc->reg); | ||
722 | |||
723 | return 1; | ||
724 | } | ||
725 | |||
726 | static int omap_mcbsp_st_get_mode(struct snd_kcontrol *kcontrol, | ||
727 | struct snd_ctl_elem_value *ucontrol) | ||
728 | { | ||
729 | struct soc_mixer_control *mc = | ||
730 | (struct soc_mixer_control *)kcontrol->private_value; | ||
731 | |||
732 | ucontrol->value.integer.value[0] = omap_st_is_enabled(mc->reg); | ||
733 | return 0; | ||
734 | } | ||
735 | |||
736 | static const struct snd_kcontrol_new omap_mcbsp2_st_controls[] = { | ||
737 | SOC_SINGLE_EXT("McBSP2 Sidetone Switch", 1, 0, 1, 0, | ||
738 | omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode), | ||
739 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 0 Volume", | ||
740 | -32768, 32767, | ||
741 | omap_mcbsp2_get_st_ch0_volume, | ||
742 | omap_mcbsp2_set_st_ch0_volume), | ||
743 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP2 Sidetone Channel 1 Volume", | ||
744 | -32768, 32767, | ||
745 | omap_mcbsp2_get_st_ch1_volume, | ||
746 | omap_mcbsp2_set_st_ch1_volume), | ||
747 | }; | ||
748 | |||
749 | static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = { | ||
750 | SOC_SINGLE_EXT("McBSP3 Sidetone Switch", 2, 0, 1, 0, | ||
751 | omap_mcbsp_st_get_mode, omap_mcbsp_st_put_mode), | ||
752 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 0 Volume", | ||
753 | -32768, 32767, | ||
754 | omap_mcbsp3_get_st_ch0_volume, | ||
755 | omap_mcbsp3_set_st_ch0_volume), | ||
756 | OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP3 Sidetone Channel 1 Volume", | ||
757 | -32768, 32767, | ||
758 | omap_mcbsp3_get_st_ch1_volume, | ||
759 | omap_mcbsp3_set_st_ch1_volume), | ||
760 | }; | ||
761 | |||
762 | int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id) | ||
763 | { | ||
764 | if (!cpu_is_omap34xx()) | ||
765 | return -ENODEV; | ||
766 | |||
767 | switch (mcbsp_id) { | ||
768 | case 1: /* McBSP 2 */ | ||
769 | return snd_soc_add_controls(codec, omap_mcbsp2_st_controls, | ||
770 | ARRAY_SIZE(omap_mcbsp2_st_controls)); | ||
771 | case 2: /* McBSP 3 */ | ||
772 | return snd_soc_add_controls(codec, omap_mcbsp3_st_controls, | ||
773 | ARRAY_SIZE(omap_mcbsp3_st_controls)); | ||
774 | default: | ||
775 | break; | ||
776 | } | ||
777 | |||
778 | return -EINVAL; | ||
779 | } | ||
780 | EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls); | ||
781 | |||
642 | static int __init snd_omap_mcbsp_init(void) | 782 | static int __init snd_omap_mcbsp_init(void) |
643 | { | 783 | { |
644 | return snd_soc_register_dais(omap_mcbsp_dai, | 784 | return snd_soc_register_dais(omap_mcbsp_dai, |
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h index 647d2f981ab0..6c363e5f4387 100644 --- a/sound/soc/omap/omap-mcbsp.h +++ b/sound/soc/omap/omap-mcbsp.h | |||
@@ -50,11 +50,13 @@ enum omap_mcbsp_div { | |||
50 | #undef NUM_LINKS | 50 | #undef NUM_LINKS |
51 | #define NUM_LINKS 3 | 51 | #define NUM_LINKS 3 |
52 | #endif | 52 | #endif |
53 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) | 53 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) |
54 | #undef NUM_LINKS | 54 | #undef NUM_LINKS |
55 | #define NUM_LINKS 5 | 55 | #define NUM_LINKS 5 |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | extern struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS]; | 58 | extern struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS]; |
59 | 59 | ||
60 | int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id); | ||
61 | |||
60 | #endif | 62 | #endif |
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 25f19e4728bf..b7f4f7e015f3 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c | |||
@@ -150,7 +150,8 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, | |||
150 | int stream = substream->stream; | 150 | int stream = substream->stream; |
151 | int channels, err, link_mask = 0; | 151 | int channels, err, link_mask = 0; |
152 | 152 | ||
153 | cpu_dai->dma_data = &omap_mcpdm_dai_dma_params[stream]; | 153 | snd_soc_dai_set_dma_data(cpu_dai, substream, |
154 | &omap_mcpdm_dai_dma_params[stream]); | ||
154 | 155 | ||
155 | channels = params_channels(params); | 156 | channels = params_channels(params); |
156 | switch (channels) { | 157 | switch (channels) { |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 825db385f01f..1e521904ea64 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/slab.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
28 | #include <sound/pcm_params.h> | 29 | #include <sound/pcm_params.h> |
@@ -60,12 +61,11 @@ static void omap_pcm_dma_irq(int ch, u16 stat, void *data) | |||
60 | struct omap_runtime_data *prtd = runtime->private_data; | 61 | struct omap_runtime_data *prtd = runtime->private_data; |
61 | unsigned long flags; | 62 | unsigned long flags; |
62 | 63 | ||
63 | if ((cpu_is_omap1510()) && | 64 | if ((cpu_is_omap1510())) { |
64 | (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)) { | ||
65 | /* | 65 | /* |
66 | * OMAP1510 doesn't fully support DMA progress counter | 66 | * OMAP1510 doesn't fully support DMA progress counter |
67 | * and there is no software emulation implemented yet, | 67 | * and there is no software emulation implemented yet, |
68 | * so have to maintain our own playback progress counter | 68 | * so have to maintain our own progress counters |
69 | * that can be used by omap_pcm_pointer() instead. | 69 | * that can be used by omap_pcm_pointer() instead. |
70 | */ | 70 | */ |
71 | spin_lock_irqsave(&prtd->lock, flags); | 71 | spin_lock_irqsave(&prtd->lock, flags); |
@@ -100,9 +100,11 @@ static int omap_pcm_hw_params(struct snd_pcm_substream *substream, | |||
100 | struct snd_pcm_runtime *runtime = substream->runtime; | 100 | struct snd_pcm_runtime *runtime = substream->runtime; |
101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
102 | struct omap_runtime_data *prtd = runtime->private_data; | 102 | struct omap_runtime_data *prtd = runtime->private_data; |
103 | struct omap_pcm_dma_data *dma_data = rtd->dai->cpu_dai->dma_data; | 103 | struct omap_pcm_dma_data *dma_data; |
104 | int err = 0; | 104 | int err = 0; |
105 | 105 | ||
106 | dma_data = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
107 | |||
106 | /* return if this is a bufferless transfer e.g. | 108 | /* return if this is a bufferless transfer e.g. |
107 | * codec <--> BT codec or GSM modem -- lg FIXME */ | 109 | * codec <--> BT codec or GSM modem -- lg FIXME */ |
108 | if (!dma_data) | 110 | if (!dma_data) |
@@ -189,8 +191,7 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream) | |||
189 | dma_params.frame_count = runtime->periods; | 191 | dma_params.frame_count = runtime->periods; |
190 | omap_set_dma_params(prtd->dma_ch, &dma_params); | 192 | omap_set_dma_params(prtd->dma_ch, &dma_params); |
191 | 193 | ||
192 | if ((cpu_is_omap1510()) && | 194 | if ((cpu_is_omap1510())) |
193 | (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)) | ||
194 | omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ | | 195 | omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ | |
195 | OMAP_DMA_LAST_IRQ | OMAP_DMA_BLOCK_IRQ); | 196 | OMAP_DMA_LAST_IRQ | OMAP_DMA_BLOCK_IRQ); |
196 | else | 197 | else |
@@ -248,14 +249,15 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream) | |||
248 | dma_addr_t ptr; | 249 | dma_addr_t ptr; |
249 | snd_pcm_uframes_t offset; | 250 | snd_pcm_uframes_t offset; |
250 | 251 | ||
251 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 252 | if (cpu_is_omap1510()) { |
253 | offset = prtd->period_index * runtime->period_size; | ||
254 | } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | ||
252 | ptr = omap_get_dma_dst_pos(prtd->dma_ch); | 255 | ptr = omap_get_dma_dst_pos(prtd->dma_ch); |
253 | offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); | 256 | offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); |
254 | } else if (!(cpu_is_omap1510())) { | 257 | } else { |
255 | ptr = omap_get_dma_src_pos(prtd->dma_ch); | 258 | ptr = omap_get_dma_src_pos(prtd->dma_ch); |
256 | offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); | 259 | offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); |
257 | } else | 260 | } |
258 | offset = prtd->period_index * runtime->period_size; | ||
259 | 261 | ||
260 | if (offset >= runtime->buffer_size) | 262 | if (offset >= runtime->buffer_size) |
261 | offset = 0; | 263 | offset = 0; |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index e69397f40f72..544fd9566f4d 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/slab.h> | ||
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
20 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
@@ -42,11 +43,14 @@ | |||
42 | * SSP audio private data | 43 | * SSP audio private data |
43 | */ | 44 | */ |
44 | struct ssp_priv { | 45 | struct ssp_priv { |
45 | struct ssp_dev dev; | 46 | struct ssp_device *ssp; |
46 | unsigned int sysclk; | 47 | unsigned int sysclk; |
47 | int dai_fmt; | 48 | int dai_fmt; |
48 | #ifdef CONFIG_PM | 49 | #ifdef CONFIG_PM |
49 | struct ssp_state state; | 50 | uint32_t cr0; |
51 | uint32_t cr1; | ||
52 | uint32_t to; | ||
53 | uint32_t psp; | ||
50 | #endif | 54 | #endif |
51 | }; | 55 | }; |
52 | 56 | ||
@@ -61,6 +65,22 @@ static void dump_registers(struct ssp_device *ssp) | |||
61 | ssp_read_reg(ssp, SSACD)); | 65 | ssp_read_reg(ssp, SSACD)); |
62 | } | 66 | } |
63 | 67 | ||
68 | static void ssp_enable(struct ssp_device *ssp) | ||
69 | { | ||
70 | uint32_t sscr0; | ||
71 | |||
72 | sscr0 = __raw_readl(ssp->mmio_base + SSCR0) | SSCR0_SSE; | ||
73 | __raw_writel(sscr0, ssp->mmio_base + SSCR0); | ||
74 | } | ||
75 | |||
76 | static void ssp_disable(struct ssp_device *ssp) | ||
77 | { | ||
78 | uint32_t sscr0; | ||
79 | |||
80 | sscr0 = __raw_readl(ssp->mmio_base + SSCR0) & ~SSCR0_SSE; | ||
81 | __raw_writel(sscr0, ssp->mmio_base + SSCR0); | ||
82 | } | ||
83 | |||
64 | struct pxa2xx_pcm_dma_data { | 84 | struct pxa2xx_pcm_dma_data { |
65 | struct pxa2xx_pcm_dma_params params; | 85 | struct pxa2xx_pcm_dma_params params; |
66 | char name[20]; | 86 | char name[20]; |
@@ -94,19 +114,17 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream, | |||
94 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 114 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
95 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 115 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
96 | struct ssp_priv *priv = cpu_dai->private_data; | 116 | struct ssp_priv *priv = cpu_dai->private_data; |
117 | struct ssp_device *ssp = priv->ssp; | ||
97 | int ret = 0; | 118 | int ret = 0; |
98 | 119 | ||
99 | if (!cpu_dai->active) { | 120 | if (!cpu_dai->active) { |
100 | priv->dev.port = cpu_dai->id + 1; | 121 | clk_enable(ssp->clk); |
101 | priv->dev.irq = NO_IRQ; | 122 | ssp_disable(ssp); |
102 | clk_enable(priv->dev.ssp->clk); | ||
103 | ssp_disable(&priv->dev); | ||
104 | } | 123 | } |
105 | 124 | ||
106 | if (cpu_dai->dma_data) { | 125 | kfree(snd_soc_dai_get_dma_data(cpu_dai, substream)); |
107 | kfree(cpu_dai->dma_data); | 126 | snd_soc_dai_set_dma_data(cpu_dai, substream, NULL); |
108 | cpu_dai->dma_data = NULL; | 127 | |
109 | } | ||
110 | return ret; | 128 | return ret; |
111 | } | 129 | } |
112 | 130 | ||
@@ -116,16 +134,15 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream, | |||
116 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 134 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
117 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 135 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
118 | struct ssp_priv *priv = cpu_dai->private_data; | 136 | struct ssp_priv *priv = cpu_dai->private_data; |
137 | struct ssp_device *ssp = priv->ssp; | ||
119 | 138 | ||
120 | if (!cpu_dai->active) { | 139 | if (!cpu_dai->active) { |
121 | ssp_disable(&priv->dev); | 140 | ssp_disable(ssp); |
122 | clk_disable(priv->dev.ssp->clk); | 141 | clk_disable(ssp->clk); |
123 | } | 142 | } |
124 | 143 | ||
125 | if (cpu_dai->dma_data) { | 144 | kfree(snd_soc_dai_get_dma_data(cpu_dai, substream)); |
126 | kfree(cpu_dai->dma_data); | 145 | snd_soc_dai_set_dma_data(cpu_dai, substream, NULL); |
127 | cpu_dai->dma_data = NULL; | ||
128 | } | ||
129 | } | 146 | } |
130 | 147 | ||
131 | #ifdef CONFIG_PM | 148 | #ifdef CONFIG_PM |
@@ -133,27 +150,39 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream, | |||
133 | static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai) | 150 | static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai) |
134 | { | 151 | { |
135 | struct ssp_priv *priv = cpu_dai->private_data; | 152 | struct ssp_priv *priv = cpu_dai->private_data; |
153 | struct ssp_device *ssp = priv->ssp; | ||
136 | 154 | ||
137 | if (!cpu_dai->active) | 155 | if (!cpu_dai->active) |
138 | clk_enable(priv->dev.ssp->clk); | 156 | clk_enable(ssp->clk); |
139 | 157 | ||
140 | ssp_save_state(&priv->dev, &priv->state); | 158 | priv->cr0 = __raw_readl(ssp->mmio_base + SSCR0); |
141 | clk_disable(priv->dev.ssp->clk); | 159 | priv->cr1 = __raw_readl(ssp->mmio_base + SSCR1); |
160 | priv->to = __raw_readl(ssp->mmio_base + SSTO); | ||
161 | priv->psp = __raw_readl(ssp->mmio_base + SSPSP); | ||
142 | 162 | ||
163 | ssp_disable(ssp); | ||
164 | clk_disable(ssp->clk); | ||
143 | return 0; | 165 | return 0; |
144 | } | 166 | } |
145 | 167 | ||
146 | static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai) | 168 | static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai) |
147 | { | 169 | { |
148 | struct ssp_priv *priv = cpu_dai->private_data; | 170 | struct ssp_priv *priv = cpu_dai->private_data; |
171 | struct ssp_device *ssp = priv->ssp; | ||
172 | uint32_t sssr = SSSR_ROR | SSSR_TUR | SSSR_BCE; | ||
149 | 173 | ||
150 | clk_enable(priv->dev.ssp->clk); | 174 | clk_enable(ssp->clk); |
151 | ssp_restore_state(&priv->dev, &priv->state); | 175 | |
176 | __raw_writel(sssr, ssp->mmio_base + SSSR); | ||
177 | __raw_writel(priv->cr0 & ~SSCR0_SSE, ssp->mmio_base + SSCR0); | ||
178 | __raw_writel(priv->cr1, ssp->mmio_base + SSCR1); | ||
179 | __raw_writel(priv->to, ssp->mmio_base + SSTO); | ||
180 | __raw_writel(priv->psp, ssp->mmio_base + SSPSP); | ||
152 | 181 | ||
153 | if (cpu_dai->active) | 182 | if (cpu_dai->active) |
154 | ssp_enable(&priv->dev); | 183 | ssp_enable(ssp); |
155 | else | 184 | else |
156 | clk_disable(priv->dev.ssp->clk); | 185 | clk_disable(ssp->clk); |
157 | 186 | ||
158 | return 0; | 187 | return 0; |
159 | } | 188 | } |
@@ -203,7 +232,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
203 | int clk_id, unsigned int freq, int dir) | 232 | int clk_id, unsigned int freq, int dir) |
204 | { | 233 | { |
205 | struct ssp_priv *priv = cpu_dai->private_data; | 234 | struct ssp_priv *priv = cpu_dai->private_data; |
206 | struct ssp_device *ssp = priv->dev.ssp; | 235 | struct ssp_device *ssp = priv->ssp; |
207 | int val; | 236 | int val; |
208 | 237 | ||
209 | u32 sscr0 = ssp_read_reg(ssp, SSCR0) & | 238 | u32 sscr0 = ssp_read_reg(ssp, SSCR0) & |
@@ -244,11 +273,11 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
244 | /* The SSP clock must be disabled when changing SSP clock mode | 273 | /* The SSP clock must be disabled when changing SSP clock mode |
245 | * on PXA2xx. On PXA3xx it must be enabled when doing so. */ | 274 | * on PXA2xx. On PXA3xx it must be enabled when doing so. */ |
246 | if (!cpu_is_pxa3xx()) | 275 | if (!cpu_is_pxa3xx()) |
247 | clk_disable(priv->dev.ssp->clk); | 276 | clk_disable(ssp->clk); |
248 | val = ssp_read_reg(ssp, SSCR0) | sscr0; | 277 | val = ssp_read_reg(ssp, SSCR0) | sscr0; |
249 | ssp_write_reg(ssp, SSCR0, val); | 278 | ssp_write_reg(ssp, SSCR0, val); |
250 | if (!cpu_is_pxa3xx()) | 279 | if (!cpu_is_pxa3xx()) |
251 | clk_enable(priv->dev.ssp->clk); | 280 | clk_enable(ssp->clk); |
252 | 281 | ||
253 | return 0; | 282 | return 0; |
254 | } | 283 | } |
@@ -260,7 +289,7 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, | |||
260 | int div_id, int div) | 289 | int div_id, int div) |
261 | { | 290 | { |
262 | struct ssp_priv *priv = cpu_dai->private_data; | 291 | struct ssp_priv *priv = cpu_dai->private_data; |
263 | struct ssp_device *ssp = priv->dev.ssp; | 292 | struct ssp_device *ssp = priv->ssp; |
264 | int val; | 293 | int val; |
265 | 294 | ||
266 | switch (div_id) { | 295 | switch (div_id) { |
@@ -311,7 +340,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id, | |||
311 | int source, unsigned int freq_in, unsigned int freq_out) | 340 | int source, unsigned int freq_in, unsigned int freq_out) |
312 | { | 341 | { |
313 | struct ssp_priv *priv = cpu_dai->private_data; | 342 | struct ssp_priv *priv = cpu_dai->private_data; |
314 | struct ssp_device *ssp = priv->dev.ssp; | 343 | struct ssp_device *ssp = priv->ssp; |
315 | u32 ssacd = ssp_read_reg(ssp, SSACD) & ~0x70; | 344 | u32 ssacd = ssp_read_reg(ssp, SSACD) & ~0x70; |
316 | 345 | ||
317 | #if defined(CONFIG_PXA3xx) | 346 | #if defined(CONFIG_PXA3xx) |
@@ -380,7 +409,7 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | |||
380 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) | 409 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) |
381 | { | 410 | { |
382 | struct ssp_priv *priv = cpu_dai->private_data; | 411 | struct ssp_priv *priv = cpu_dai->private_data; |
383 | struct ssp_device *ssp = priv->dev.ssp; | 412 | struct ssp_device *ssp = priv->ssp; |
384 | u32 sscr0; | 413 | u32 sscr0; |
385 | 414 | ||
386 | sscr0 = ssp_read_reg(ssp, SSCR0); | 415 | sscr0 = ssp_read_reg(ssp, SSCR0); |
@@ -415,7 +444,7 @@ static int pxa_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai, | |||
415 | int tristate) | 444 | int tristate) |
416 | { | 445 | { |
417 | struct ssp_priv *priv = cpu_dai->private_data; | 446 | struct ssp_priv *priv = cpu_dai->private_data; |
418 | struct ssp_device *ssp = priv->dev.ssp; | 447 | struct ssp_device *ssp = priv->ssp; |
419 | u32 sscr1; | 448 | u32 sscr1; |
420 | 449 | ||
421 | sscr1 = ssp_read_reg(ssp, SSCR1); | 450 | sscr1 = ssp_read_reg(ssp, SSCR1); |
@@ -437,7 +466,7 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
437 | unsigned int fmt) | 466 | unsigned int fmt) |
438 | { | 467 | { |
439 | struct ssp_priv *priv = cpu_dai->private_data; | 468 | struct ssp_priv *priv = cpu_dai->private_data; |
440 | struct ssp_device *ssp = priv->dev.ssp; | 469 | struct ssp_device *ssp = priv->ssp; |
441 | u32 sscr0; | 470 | u32 sscr0; |
442 | u32 sscr1; | 471 | u32 sscr1; |
443 | u32 sspsp; | 472 | u32 sspsp; |
@@ -532,25 +561,29 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
532 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 561 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
533 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 562 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
534 | struct ssp_priv *priv = cpu_dai->private_data; | 563 | struct ssp_priv *priv = cpu_dai->private_data; |
535 | struct ssp_device *ssp = priv->dev.ssp; | 564 | struct ssp_device *ssp = priv->ssp; |
536 | int chn = params_channels(params); | 565 | int chn = params_channels(params); |
537 | u32 sscr0; | 566 | u32 sscr0; |
538 | u32 sspsp; | 567 | u32 sspsp; |
539 | int width = snd_pcm_format_physical_width(params_format(params)); | 568 | int width = snd_pcm_format_physical_width(params_format(params)); |
540 | int ttsa = ssp_read_reg(ssp, SSTSA) & 0xf; | 569 | int ttsa = ssp_read_reg(ssp, SSTSA) & 0xf; |
570 | struct pxa2xx_pcm_dma_params *dma_data; | ||
571 | |||
572 | dma_data = snd_soc_dai_get_dma_data(dai, substream); | ||
541 | 573 | ||
542 | /* generate correct DMA params */ | 574 | /* generate correct DMA params */ |
543 | if (cpu_dai->dma_data) | 575 | kfree(dma_data); |
544 | kfree(cpu_dai->dma_data); | ||
545 | 576 | ||
546 | /* Network mode with one active slot (ttsa == 1) can be used | 577 | /* Network mode with one active slot (ttsa == 1) can be used |
547 | * to force 16-bit frame width on the wire (for S16_LE), even | 578 | * to force 16-bit frame width on the wire (for S16_LE), even |
548 | * with two channels. Use 16-bit DMA transfers for this case. | 579 | * with two channels. Use 16-bit DMA transfers for this case. |
549 | */ | 580 | */ |
550 | cpu_dai->dma_data = ssp_get_dma_params(ssp, | 581 | dma_data = ssp_get_dma_params(ssp, |
551 | ((chn == 2) && (ttsa != 1)) || (width == 32), | 582 | ((chn == 2) && (ttsa != 1)) || (width == 32), |
552 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 583 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
553 | 584 | ||
585 | snd_soc_dai_set_dma_data(dai, substream, dma_data); | ||
586 | |||
554 | /* we can only change the settings if the port is not in use */ | 587 | /* we can only change the settings if the port is not in use */ |
555 | if (ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) | 588 | if (ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) |
556 | return 0; | 589 | return 0; |
@@ -642,12 +675,12 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | |||
642 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 675 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
643 | int ret = 0; | 676 | int ret = 0; |
644 | struct ssp_priv *priv = cpu_dai->private_data; | 677 | struct ssp_priv *priv = cpu_dai->private_data; |
645 | struct ssp_device *ssp = priv->dev.ssp; | 678 | struct ssp_device *ssp = priv->ssp; |
646 | int val; | 679 | int val; |
647 | 680 | ||
648 | switch (cmd) { | 681 | switch (cmd) { |
649 | case SNDRV_PCM_TRIGGER_RESUME: | 682 | case SNDRV_PCM_TRIGGER_RESUME: |
650 | ssp_enable(&priv->dev); | 683 | ssp_enable(ssp); |
651 | break; | 684 | break; |
652 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 685 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
653 | val = ssp_read_reg(ssp, SSCR1); | 686 | val = ssp_read_reg(ssp, SSCR1); |
@@ -666,7 +699,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | |||
666 | else | 699 | else |
667 | val |= SSCR1_RSRE; | 700 | val |= SSCR1_RSRE; |
668 | ssp_write_reg(ssp, SSCR1, val); | 701 | ssp_write_reg(ssp, SSCR1, val); |
669 | ssp_enable(&priv->dev); | 702 | ssp_enable(ssp); |
670 | break; | 703 | break; |
671 | case SNDRV_PCM_TRIGGER_STOP: | 704 | case SNDRV_PCM_TRIGGER_STOP: |
672 | val = ssp_read_reg(ssp, SSCR1); | 705 | val = ssp_read_reg(ssp, SSCR1); |
@@ -677,7 +710,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, | |||
677 | ssp_write_reg(ssp, SSCR1, val); | 710 | ssp_write_reg(ssp, SSCR1, val); |
678 | break; | 711 | break; |
679 | case SNDRV_PCM_TRIGGER_SUSPEND: | 712 | case SNDRV_PCM_TRIGGER_SUSPEND: |
680 | ssp_disable(&priv->dev); | 713 | ssp_disable(ssp); |
681 | break; | 714 | break; |
682 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 715 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
683 | val = ssp_read_reg(ssp, SSCR1); | 716 | val = ssp_read_reg(ssp, SSCR1); |
@@ -707,8 +740,8 @@ static int pxa_ssp_probe(struct platform_device *pdev, | |||
707 | if (!priv) | 740 | if (!priv) |
708 | return -ENOMEM; | 741 | return -ENOMEM; |
709 | 742 | ||
710 | priv->dev.ssp = ssp_request(dai->id + 1, "SoC audio"); | 743 | priv->ssp = ssp_request(dai->id + 1, "SoC audio"); |
711 | if (priv->dev.ssp == NULL) { | 744 | if (priv->ssp == NULL) { |
712 | ret = -ENODEV; | 745 | ret = -ENODEV; |
713 | goto err_priv; | 746 | goto err_priv; |
714 | } | 747 | } |
@@ -727,7 +760,7 @@ static void pxa_ssp_remove(struct platform_device *pdev, | |||
727 | struct snd_soc_dai *dai) | 760 | struct snd_soc_dai *dai) |
728 | { | 761 | { |
729 | struct ssp_priv *priv = dai->private_data; | 762 | struct ssp_priv *priv = dai->private_data; |
730 | ssp_free(priv->dev.ssp); | 763 | ssp_free(priv->ssp); |
731 | } | 764 | } |
732 | 765 | ||
733 | #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ | 766 | #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ |
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index e9ae7b3a7e00..d314115e3dd7 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -122,11 +122,14 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | |||
122 | { | 122 | { |
123 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 123 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
124 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 124 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
125 | struct pxa2xx_pcm_dma_params *dma_data; | ||
125 | 126 | ||
126 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 127 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
127 | cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_out; | 128 | dma_data = &pxa2xx_ac97_pcm_stereo_out; |
128 | else | 129 | else |
129 | cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in; | 130 | dma_data = &pxa2xx_ac97_pcm_stereo_in; |
131 | |||
132 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
130 | 133 | ||
131 | return 0; | 134 | return 0; |
132 | } | 135 | } |
@@ -137,11 +140,14 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, | |||
137 | { | 140 | { |
138 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 141 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
139 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 142 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
143 | struct pxa2xx_pcm_dma_params *dma_data; | ||
140 | 144 | ||
141 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 145 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
142 | cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_out; | 146 | dma_data = &pxa2xx_ac97_pcm_aux_mono_out; |
143 | else | 147 | else |
144 | cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in; | 148 | dma_data = &pxa2xx_ac97_pcm_aux_mono_in; |
149 | |||
150 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
145 | 151 | ||
146 | return 0; | 152 | return 0; |
147 | } | 153 | } |
@@ -156,7 +162,8 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, | |||
156 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 162 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
157 | return -ENODEV; | 163 | return -ENODEV; |
158 | else | 164 | else |
159 | cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in; | 165 | snd_soc_dai_set_dma_data(cpu_dai, substream, |
166 | &pxa2xx_ac97_pcm_mic_mono_in); | ||
160 | 167 | ||
161 | return 0; | 168 | return 0; |
162 | } | 169 | } |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 6b8f655d1ad8..c1a5275721e4 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -164,6 +164,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
164 | { | 164 | { |
165 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 165 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
166 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 166 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
167 | struct pxa2xx_pcm_dma_params *dma_data; | ||
167 | 168 | ||
168 | BUG_ON(IS_ERR(clk_i2s)); | 169 | BUG_ON(IS_ERR(clk_i2s)); |
169 | clk_enable(clk_i2s); | 170 | clk_enable(clk_i2s); |
@@ -171,9 +172,11 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
171 | pxa_i2s_wait(); | 172 | pxa_i2s_wait(); |
172 | 173 | ||
173 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 174 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
174 | cpu_dai->dma_data = &pxa2xx_i2s_pcm_stereo_out; | 175 | dma_data = &pxa2xx_i2s_pcm_stereo_out; |
175 | else | 176 | else |
176 | cpu_dai->dma_data = &pxa2xx_i2s_pcm_stereo_in; | 177 | dma_data = &pxa2xx_i2s_pcm_stereo_in; |
178 | |||
179 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
177 | 180 | ||
178 | /* is port used by another stream */ | 181 | /* is port used by another stream */ |
179 | if (!(SACR0 & SACR0_ENB)) { | 182 | if (!(SACR0 & SACR0_ENB)) { |
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index d38e39575f51..adc7e6f15f93 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c | |||
@@ -25,9 +25,11 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
25 | struct snd_pcm_runtime *runtime = substream->runtime; | 25 | struct snd_pcm_runtime *runtime = substream->runtime; |
26 | struct pxa2xx_runtime_data *prtd = runtime->private_data; | 26 | struct pxa2xx_runtime_data *prtd = runtime->private_data; |
27 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 27 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
28 | struct pxa2xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data; | 28 | struct pxa2xx_pcm_dma_params *dma; |
29 | int ret; | 29 | int ret; |
30 | 30 | ||
31 | dma = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
32 | |||
31 | /* return if this is a bufferless transfer e.g. | 33 | /* return if this is a bufferless transfer e.g. |
32 | * codec <--> BT codec or GSM modem -- lg FIXME */ | 34 | * codec <--> BT codec or GSM modem -- lg FIXME */ |
33 | if (!dma) | 35 | if (!dma) |
diff --git a/sound/soc/s3c24xx/s3c-ac97.c b/sound/soc/s3c24xx/s3c-ac97.c index ee8ed9d7e703..ecf4fd04ae96 100644 --- a/sound/soc/s3c24xx/s3c-ac97.c +++ b/sound/soc/s3c24xx/s3c-ac97.c | |||
@@ -224,11 +224,14 @@ static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, | |||
224 | { | 224 | { |
225 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 225 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
226 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 226 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
227 | struct s3c_dma_params *dma_data; | ||
227 | 228 | ||
228 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 229 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
229 | cpu_dai->dma_data = &s3c_ac97_pcm_out; | 230 | dma_data = &s3c_ac97_pcm_out; |
230 | else | 231 | else |
231 | cpu_dai->dma_data = &s3c_ac97_pcm_in; | 232 | dma_data = &s3c_ac97_pcm_in; |
233 | |||
234 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
232 | 235 | ||
233 | return 0; | 236 | return 0; |
234 | } | 237 | } |
@@ -238,8 +241,8 @@ static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | |||
238 | { | 241 | { |
239 | u32 ac_glbctrl; | 242 | u32 ac_glbctrl; |
240 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 243 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
241 | int channel = ((struct s3c_dma_params *) | 244 | struct s3c_dma_params *dma_data = |
242 | rtd->dai->cpu_dai->dma_data)->channel; | 245 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); |
243 | 246 | ||
244 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); | 247 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); |
245 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) | 248 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) |
@@ -265,7 +268,7 @@ static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | |||
265 | 268 | ||
266 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); | 269 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); |
267 | 270 | ||
268 | s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STARTED); | 271 | s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED); |
269 | 272 | ||
270 | return 0; | 273 | return 0; |
271 | } | 274 | } |
@@ -280,7 +283,7 @@ static int s3c_ac97_hw_mic_params(struct snd_pcm_substream *substream, | |||
280 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 283 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
281 | return -ENODEV; | 284 | return -ENODEV; |
282 | else | 285 | else |
283 | cpu_dai->dma_data = &s3c_ac97_mic_in; | 286 | snd_soc_dai_set_dma_data(cpu_dai, substream, &s3c_ac97_mic_in); |
284 | 287 | ||
285 | return 0; | 288 | return 0; |
286 | } | 289 | } |
@@ -290,8 +293,8 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream, | |||
290 | { | 293 | { |
291 | u32 ac_glbctrl; | 294 | u32 ac_glbctrl; |
292 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 295 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
293 | int channel = ((struct s3c_dma_params *) | 296 | struct s3c_dma_params *dma_data = |
294 | rtd->dai->cpu_dai->dma_data)->channel; | 297 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); |
295 | 298 | ||
296 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); | 299 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); |
297 | ac_glbctrl &= ~S3C_AC97_GLBCTRL_MICINTM_MASK; | 300 | ac_glbctrl &= ~S3C_AC97_GLBCTRL_MICINTM_MASK; |
@@ -311,7 +314,7 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream, | |||
311 | 314 | ||
312 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); | 315 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); |
313 | 316 | ||
314 | s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STARTED); | 317 | s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED); |
315 | 318 | ||
316 | return 0; | 319 | return 0; |
317 | } | 320 | } |
diff --git a/sound/soc/s3c24xx/s3c-dma.c b/sound/soc/s3c24xx/s3c-dma.c index 7725e26d6c91..1b61c23ff300 100644 --- a/sound/soc/s3c24xx/s3c-dma.c +++ b/sound/soc/s3c24xx/s3c-dma.c | |||
@@ -145,10 +145,12 @@ static int s3c_dma_hw_params(struct snd_pcm_substream *substream, | |||
145 | struct snd_pcm_runtime *runtime = substream->runtime; | 145 | struct snd_pcm_runtime *runtime = substream->runtime; |
146 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 146 | struct s3c24xx_runtime_data *prtd = runtime->private_data; |
147 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 147 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
148 | struct s3c_dma_params *dma = rtd->dai->cpu_dai->dma_data; | ||
149 | unsigned long totbytes = params_buffer_bytes(params); | 148 | unsigned long totbytes = params_buffer_bytes(params); |
149 | struct s3c_dma_params *dma = | ||
150 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
150 | int ret = 0; | 151 | int ret = 0; |
151 | 152 | ||
153 | |||
152 | pr_debug("Entered %s\n", __func__); | 154 | pr_debug("Entered %s\n", __func__); |
153 | 155 | ||
154 | /* return if this is a bufferless transfer e.g. | 156 | /* return if this is a bufferless transfer e.g. |
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index e994d8374fe6..88515946b6c0 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -339,14 +339,17 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | |||
339 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 339 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
340 | struct snd_soc_dai_link *dai = rtd->dai; | 340 | struct snd_soc_dai_link *dai = rtd->dai; |
341 | struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai); | 341 | struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai); |
342 | struct s3c_dma_params *dma_data; | ||
342 | u32 iismod; | 343 | u32 iismod; |
343 | 344 | ||
344 | pr_debug("Entered %s\n", __func__); | 345 | pr_debug("Entered %s\n", __func__); |
345 | 346 | ||
346 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 347 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
347 | dai->cpu_dai->dma_data = i2s->dma_playback; | 348 | dma_data = i2s->dma_playback; |
348 | else | 349 | else |
349 | dai->cpu_dai->dma_data = i2s->dma_capture; | 350 | dma_data = i2s->dma_capture; |
351 | |||
352 | snd_soc_dai_set_dma_data(dai->cpu_dai, substream, dma_data); | ||
350 | 353 | ||
351 | /* Working copies of register */ | 354 | /* Working copies of register */ |
352 | iismod = readl(i2s->regs + S3C2412_IISMOD); | 355 | iismod = readl(i2s->regs + S3C2412_IISMOD); |
@@ -394,8 +397,8 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
394 | int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); | 397 | int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); |
395 | unsigned long irqs; | 398 | unsigned long irqs; |
396 | int ret = 0; | 399 | int ret = 0; |
397 | int channel = ((struct s3c_dma_params *) | 400 | struct s3c_dma_params *dma_data = |
398 | rtd->dai->cpu_dai->dma_data)->channel; | 401 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); |
399 | 402 | ||
400 | pr_debug("Entered %s\n", __func__); | 403 | pr_debug("Entered %s\n", __func__); |
401 | 404 | ||
@@ -431,7 +434,7 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
431 | * of the auto reload mechanism of S3C24XX. | 434 | * of the auto reload mechanism of S3C24XX. |
432 | * This call won't bother S3C64XX. | 435 | * This call won't bother S3C64XX. |
433 | */ | 436 | */ |
434 | s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STARTED); | 437 | s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED); |
435 | 438 | ||
436 | break; | 439 | break; |
437 | 440 | ||
diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index a98f40c3cd29..326f0a9e7e30 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c | |||
@@ -178,6 +178,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, | |||
178 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 178 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
179 | struct snd_soc_dai_link *dai = rtd->dai; | 179 | struct snd_soc_dai_link *dai = rtd->dai; |
180 | struct s3c_pcm_info *pcm = to_info(dai->cpu_dai); | 180 | struct s3c_pcm_info *pcm = to_info(dai->cpu_dai); |
181 | struct s3c_dma_params *dma_data; | ||
181 | void __iomem *regs = pcm->regs; | 182 | void __iomem *regs = pcm->regs; |
182 | struct clk *clk; | 183 | struct clk *clk; |
183 | int sclk_div, sync_div; | 184 | int sclk_div, sync_div; |
@@ -187,9 +188,11 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, | |||
187 | dev_dbg(pcm->dev, "Entered %s\n", __func__); | 188 | dev_dbg(pcm->dev, "Entered %s\n", __func__); |
188 | 189 | ||
189 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 190 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
190 | dai->cpu_dai->dma_data = pcm->dma_playback; | 191 | dma_data = pcm->dma_playback; |
191 | else | 192 | else |
192 | dai->cpu_dai->dma_data = pcm->dma_capture; | 193 | dma_data = pcm->dma_capture; |
194 | |||
195 | snd_soc_dai_set_dma_data(dai->cpu_dai, substream, dma_data); | ||
193 | 196 | ||
194 | /* Strictly check for sample size */ | 197 | /* Strictly check for sample size */ |
195 | switch (params_format(params)) { | 198 | switch (params_format(params)) { |
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index 0bc5950b9f02..c3ac890a3986 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c | |||
@@ -242,14 +242,17 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
242 | struct snd_soc_dai *dai) | 242 | struct snd_soc_dai *dai) |
243 | { | 243 | { |
244 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 244 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
245 | struct s3c_dma_params *dma_data; | ||
245 | u32 iismod; | 246 | u32 iismod; |
246 | 247 | ||
247 | pr_debug("Entered %s\n", __func__); | 248 | pr_debug("Entered %s\n", __func__); |
248 | 249 | ||
249 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 250 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
250 | rtd->dai->cpu_dai->dma_data = &s3c24xx_i2s_pcm_stereo_out; | 251 | dma_data = &s3c24xx_i2s_pcm_stereo_out; |
251 | else | 252 | else |
252 | rtd->dai->cpu_dai->dma_data = &s3c24xx_i2s_pcm_stereo_in; | 253 | dma_data = &s3c24xx_i2s_pcm_stereo_in; |
254 | |||
255 | snd_soc_dai_set_dma_data(rtd->dai->cpu_dai, substream, dma_data); | ||
253 | 256 | ||
254 | /* Working copies of register */ | 257 | /* Working copies of register */ |
255 | iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); | 258 | iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); |
@@ -258,13 +261,11 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
258 | switch (params_format(params)) { | 261 | switch (params_format(params)) { |
259 | case SNDRV_PCM_FORMAT_S8: | 262 | case SNDRV_PCM_FORMAT_S8: |
260 | iismod &= ~S3C2410_IISMOD_16BIT; | 263 | iismod &= ~S3C2410_IISMOD_16BIT; |
261 | ((struct s3c_dma_params *) | 264 | dma_data->dma_size = 1; |
262 | rtd->dai->cpu_dai->dma_data)->dma_size = 1; | ||
263 | break; | 265 | break; |
264 | case SNDRV_PCM_FORMAT_S16_LE: | 266 | case SNDRV_PCM_FORMAT_S16_LE: |
265 | iismod |= S3C2410_IISMOD_16BIT; | 267 | iismod |= S3C2410_IISMOD_16BIT; |
266 | ((struct s3c_dma_params *) | 268 | dma_data->dma_size = 2; |
267 | rtd->dai->cpu_dai->dma_data)->dma_size = 2; | ||
268 | break; | 269 | break; |
269 | default: | 270 | default: |
270 | return -EINVAL; | 271 | return -EINVAL; |
@@ -280,8 +281,8 @@ static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
280 | { | 281 | { |
281 | int ret = 0; | 282 | int ret = 0; |
282 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 283 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
283 | int channel = ((struct s3c_dma_params *) | 284 | struct s3c_dma_params *dma_data = |
284 | rtd->dai->cpu_dai->dma_data)->channel; | 285 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); |
285 | 286 | ||
286 | pr_debug("Entered %s\n", __func__); | 287 | pr_debug("Entered %s\n", __func__); |
287 | 288 | ||
@@ -300,7 +301,7 @@ static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
300 | else | 301 | else |
301 | s3c24xx_snd_txctrl(1); | 302 | s3c24xx_snd_txctrl(1); |
302 | 303 | ||
303 | s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STARTED); | 304 | s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED); |
304 | break; | 305 | break; |
305 | case SNDRV_PCM_TRIGGER_STOP: | 306 | case SNDRV_PCM_TRIGGER_STOP: |
306 | case SNDRV_PCM_TRIGGER_SUSPEND: | 307 | case SNDRV_PCM_TRIGGER_SUSPEND: |
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index 93ed3aad1631..a72c251401ac 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <sound/soc.h> | 22 | #include <sound/soc.h> |
23 | 23 | ||
24 | #include <plat/regs-s3c2412-iis.h> | 24 | #include <plat/regs-s3c2412-iis.h> |
25 | #include <plat/gpio-bank-d.h> | 25 | #include <mach/gpio-bank-d.h> |
26 | #include <plat/gpio-bank-e.h> | 26 | #include <mach/gpio-bank-e.h> |
27 | #include <plat/gpio-cfg.h> | 27 | #include <plat/gpio-cfg.h> |
28 | 28 | ||
29 | #include <mach/map.h> | 29 | #include <mach/map.h> |
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c index c5cda187ecab..5b9ac1759bd2 100644 --- a/sound/soc/s6000/s6000-i2s.c +++ b/sound/soc/s6000/s6000-i2s.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #include <sound/core.h> | 21 | #include <sound/core.h> |
21 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
@@ -518,7 +519,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev) | |||
518 | 519 | ||
519 | s6000_i2s_dai.dev = &pdev->dev; | 520 | s6000_i2s_dai.dev = &pdev->dev; |
520 | s6000_i2s_dai.private_data = dev; | 521 | s6000_i2s_dai.private_data = dev; |
521 | s6000_i2s_dai.dma_data = &dev->dma_params; | 522 | s6000_i2s_dai.capture.dma_data = &dev->dma_params; |
523 | s6000_i2s_dai.playback.dma_data = &dev->dma_params; | ||
522 | 524 | ||
523 | dev->sifbase = sifmem->start; | 525 | dev->sifbase = sifmem->start; |
524 | dev->scbbase = mmio; | 526 | dev->scbbase = mmio; |
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c index 1d61109e09fa..9c7f7f00cebb 100644 --- a/sound/soc/s6000/s6000-pcm.c +++ b/sound/soc/s6000/s6000-pcm.c | |||
@@ -58,13 +58,15 @@ static void s6000_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
58 | struct snd_pcm_runtime *runtime = substream->runtime; | 58 | struct snd_pcm_runtime *runtime = substream->runtime; |
59 | struct s6000_runtime_data *prtd = runtime->private_data; | 59 | struct s6000_runtime_data *prtd = runtime->private_data; |
60 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 60 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
61 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 61 | struct s6000_pcm_dma_params *par; |
62 | int channel; | 62 | int channel; |
63 | unsigned int period_size; | 63 | unsigned int period_size; |
64 | unsigned int dma_offset; | 64 | unsigned int dma_offset; |
65 | dma_addr_t dma_pos; | 65 | dma_addr_t dma_pos; |
66 | dma_addr_t src, dst; | 66 | dma_addr_t src, dst; |
67 | 67 | ||
68 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
69 | |||
68 | period_size = snd_pcm_lib_period_bytes(substream); | 70 | period_size = snd_pcm_lib_period_bytes(substream); |
69 | dma_offset = prtd->period * period_size; | 71 | dma_offset = prtd->period * period_size; |
70 | dma_pos = runtime->dma_addr + dma_offset; | 72 | dma_pos = runtime->dma_addr + dma_offset; |
@@ -101,7 +103,8 @@ static irqreturn_t s6000_pcm_irq(int irq, void *data) | |||
101 | { | 103 | { |
102 | struct snd_pcm *pcm = data; | 104 | struct snd_pcm *pcm = data; |
103 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | 105 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; |
104 | struct s6000_pcm_dma_params *params = runtime->dai->cpu_dai->dma_data; | 106 | struct s6000_pcm_dma_params *params = |
107 | snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
105 | struct s6000_runtime_data *prtd; | 108 | struct s6000_runtime_data *prtd; |
106 | unsigned int has_xrun; | 109 | unsigned int has_xrun; |
107 | int i, ret = IRQ_NONE; | 110 | int i, ret = IRQ_NONE; |
@@ -172,11 +175,13 @@ static int s6000_pcm_start(struct snd_pcm_substream *substream) | |||
172 | { | 175 | { |
173 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | 176 | struct s6000_runtime_data *prtd = substream->runtime->private_data; |
174 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 177 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
175 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 178 | struct s6000_pcm_dma_params *par; |
176 | unsigned long flags; | 179 | unsigned long flags; |
177 | int srcinc; | 180 | int srcinc; |
178 | u32 dma; | 181 | u32 dma; |
179 | 182 | ||
183 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
184 | |||
180 | spin_lock_irqsave(&prtd->lock, flags); | 185 | spin_lock_irqsave(&prtd->lock, flags); |
181 | 186 | ||
182 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 187 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
@@ -212,10 +217,12 @@ static int s6000_pcm_stop(struct snd_pcm_substream *substream) | |||
212 | { | 217 | { |
213 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | 218 | struct s6000_runtime_data *prtd = substream->runtime->private_data; |
214 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 219 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
215 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 220 | struct s6000_pcm_dma_params *par; |
216 | unsigned long flags; | 221 | unsigned long flags; |
217 | u32 channel; | 222 | u32 channel; |
218 | 223 | ||
224 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
225 | |||
219 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 226 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
220 | channel = par->dma_out; | 227 | channel = par->dma_out; |
221 | else | 228 | else |
@@ -236,9 +243,11 @@ static int s6000_pcm_stop(struct snd_pcm_substream *substream) | |||
236 | static int s6000_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 243 | static int s6000_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
237 | { | 244 | { |
238 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 245 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
239 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 246 | struct s6000_pcm_dma_params *par; |
240 | int ret; | 247 | int ret; |
241 | 248 | ||
249 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
250 | |||
242 | ret = par->trigger(substream, cmd, 0); | 251 | ret = par->trigger(substream, cmd, 0); |
243 | if (ret < 0) | 252 | if (ret < 0) |
244 | return ret; | 253 | return ret; |
@@ -275,13 +284,15 @@ static int s6000_pcm_prepare(struct snd_pcm_substream *substream) | |||
275 | static snd_pcm_uframes_t s6000_pcm_pointer(struct snd_pcm_substream *substream) | 284 | static snd_pcm_uframes_t s6000_pcm_pointer(struct snd_pcm_substream *substream) |
276 | { | 285 | { |
277 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 286 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
278 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 287 | struct s6000_pcm_dma_params *par; |
279 | struct snd_pcm_runtime *runtime = substream->runtime; | 288 | struct snd_pcm_runtime *runtime = substream->runtime; |
280 | struct s6000_runtime_data *prtd = runtime->private_data; | 289 | struct s6000_runtime_data *prtd = runtime->private_data; |
281 | unsigned long flags; | 290 | unsigned long flags; |
282 | unsigned int offset; | 291 | unsigned int offset; |
283 | dma_addr_t count; | 292 | dma_addr_t count; |
284 | 293 | ||
294 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
295 | |||
285 | spin_lock_irqsave(&prtd->lock, flags); | 296 | spin_lock_irqsave(&prtd->lock, flags); |
286 | 297 | ||
287 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 298 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -305,11 +316,12 @@ static snd_pcm_uframes_t s6000_pcm_pointer(struct snd_pcm_substream *substream) | |||
305 | static int s6000_pcm_open(struct snd_pcm_substream *substream) | 316 | static int s6000_pcm_open(struct snd_pcm_substream *substream) |
306 | { | 317 | { |
307 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 318 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
308 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 319 | struct s6000_pcm_dma_params *par; |
309 | struct snd_pcm_runtime *runtime = substream->runtime; | 320 | struct snd_pcm_runtime *runtime = substream->runtime; |
310 | struct s6000_runtime_data *prtd; | 321 | struct s6000_runtime_data *prtd; |
311 | int ret; | 322 | int ret; |
312 | 323 | ||
324 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
313 | snd_soc_set_runtime_hwparams(substream, &s6000_pcm_hardware); | 325 | snd_soc_set_runtime_hwparams(substream, &s6000_pcm_hardware); |
314 | 326 | ||
315 | ret = snd_pcm_hw_constraint_step(runtime, 0, | 327 | ret = snd_pcm_hw_constraint_step(runtime, 0, |
@@ -364,7 +376,7 @@ static int s6000_pcm_hw_params(struct snd_pcm_substream *substream, | |||
364 | struct snd_pcm_hw_params *hw_params) | 376 | struct snd_pcm_hw_params *hw_params) |
365 | { | 377 | { |
366 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 378 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
367 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 379 | struct s6000_pcm_dma_params *par; |
368 | int ret; | 380 | int ret; |
369 | ret = snd_pcm_lib_malloc_pages(substream, | 381 | ret = snd_pcm_lib_malloc_pages(substream, |
370 | params_buffer_bytes(hw_params)); | 382 | params_buffer_bytes(hw_params)); |
@@ -373,6 +385,8 @@ static int s6000_pcm_hw_params(struct snd_pcm_substream *substream, | |||
373 | return ret; | 385 | return ret; |
374 | } | 386 | } |
375 | 387 | ||
388 | par = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
389 | |||
376 | if (par->same_rate) { | 390 | if (par->same_rate) { |
377 | spin_lock(&par->lock); | 391 | spin_lock(&par->lock); |
378 | if (par->rate == -1 || | 392 | if (par->rate == -1 || |
@@ -392,7 +406,8 @@ static int s6000_pcm_hw_params(struct snd_pcm_substream *substream, | |||
392 | static int s6000_pcm_hw_free(struct snd_pcm_substream *substream) | 406 | static int s6000_pcm_hw_free(struct snd_pcm_substream *substream) |
393 | { | 407 | { |
394 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 408 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
395 | struct s6000_pcm_dma_params *par = soc_runtime->dai->cpu_dai->dma_data; | 409 | struct s6000_pcm_dma_params *par = |
410 | snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
396 | 411 | ||
397 | spin_lock(&par->lock); | 412 | spin_lock(&par->lock); |
398 | par->in_use &= ~(1 << substream->stream); | 413 | par->in_use &= ~(1 << substream->stream); |
@@ -417,7 +432,8 @@ static struct snd_pcm_ops s6000_pcm_ops = { | |||
417 | static void s6000_pcm_free(struct snd_pcm *pcm) | 432 | static void s6000_pcm_free(struct snd_pcm *pcm) |
418 | { | 433 | { |
419 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | 434 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; |
420 | struct s6000_pcm_dma_params *params = runtime->dai->cpu_dai->dma_data; | 435 | struct s6000_pcm_dma_params *params = |
436 | snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
421 | 437 | ||
422 | free_irq(params->irq, pcm); | 438 | free_irq(params->irq, pcm); |
423 | snd_pcm_lib_preallocate_free_for_all(pcm); | 439 | snd_pcm_lib_preallocate_free_for_all(pcm); |
@@ -429,9 +445,11 @@ static int s6000_pcm_new(struct snd_card *card, | |||
429 | struct snd_soc_dai *dai, struct snd_pcm *pcm) | 445 | struct snd_soc_dai *dai, struct snd_pcm *pcm) |
430 | { | 446 | { |
431 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | 447 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; |
432 | struct s6000_pcm_dma_params *params = runtime->dai->cpu_dai->dma_data; | 448 | struct s6000_pcm_dma_params *params; |
433 | int res; | 449 | int res; |
434 | 450 | ||
451 | params = snd_soc_dai_get_dma_data(soc_runtime->dai->cpu_dai, substream); | ||
452 | |||
435 | if (!card->dev->dma_mask) | 453 | if (!card->dev->dma_mask) |
436 | card->dev->dma_mask = &s6000_pcm_dmamask; | 454 | card->dev->dma_mask = &s6000_pcm_dmamask; |
437 | if (!card->dev->coherent_dma_mask) | 455 | if (!card->dev->coherent_dma_mask) |
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 106674979b53..f07f6d8b93e1 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig | |||
@@ -32,6 +32,7 @@ config SND_SOC_SH4_SIU | |||
32 | select DMA_ENGINE | 32 | select DMA_ENGINE |
33 | select DMADEVICES | 33 | select DMADEVICES |
34 | select SH_DMAE | 34 | select SH_DMAE |
35 | select FW_LOADER | ||
35 | 36 | ||
36 | ## | 37 | ## |
37 | ## Boards | 38 | ## Boards |
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index baddb1242c71..0d8bdf07729c 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/gfp.h> | ||
16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
18 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 993abb730dfa..8dc966f45c36 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/pm_runtime.h> | 20 | #include <linux/pm_runtime.h> |
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/slab.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/initval.h> | 25 | #include <sound/initval.h> |
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h index 9cc04ab2bce7..c0bfab8fed3d 100644 --- a/sound/soc/sh/siu.h +++ b/sound/soc/sh/siu.h | |||
@@ -72,7 +72,7 @@ struct siu_firmware { | |||
72 | #include <linux/interrupt.h> | 72 | #include <linux/interrupt.h> |
73 | #include <linux/io.h> | 73 | #include <linux/io.h> |
74 | 74 | ||
75 | #include <asm/dma-sh.h> | 75 | #include <asm/dmaengine.h> |
76 | 76 | ||
77 | #include <sound/core.h> | 77 | #include <sound/core.h> |
78 | #include <sound/pcm.h> | 78 | #include <sound/pcm.h> |
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 5452d19607e1..d86ee1bfc03a 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/firmware.h> | 23 | #include <linux/firmware.h> |
24 | #include <linux/pm_runtime.h> | 24 | #include <linux/pm_runtime.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include <asm/clock.h> | 27 | #include <asm/clock.h> |
27 | #include <asm/siu.h> | 28 | #include <asm/siu.h> |
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index c5efc30f0136..8f85719212f9 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/slab.h> | ||
28 | 27 | ||
29 | #include <sound/control.h> | 28 | #include <sound/control.h> |
30 | #include <sound/core.h> | 29 | #include <sound/core.h> |
@@ -32,7 +31,7 @@ | |||
32 | #include <sound/pcm_params.h> | 31 | #include <sound/pcm_params.h> |
33 | #include <sound/soc-dai.h> | 32 | #include <sound/soc-dai.h> |
34 | 33 | ||
35 | #include <asm/dma-sh.h> | 34 | #include <asm/dmaengine.h> |
36 | #include <asm/siu.h> | 35 | #include <asm/siu.h> |
37 | 36 | ||
38 | #include "siu.h" | 37 | #include "siu.h" |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a03bac943aaf..ad7f9528d751 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/debugfs.h> | 29 | #include <linux/debugfs.h> |
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/slab.h> | ||
31 | #include <sound/ac97_codec.h> | 32 | #include <sound/ac97_codec.h> |
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/pcm.h> | 34 | #include <sound/pcm.h> |
@@ -427,24 +428,24 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
427 | if (!runtime->hw.rates) { | 428 | if (!runtime->hw.rates) { |
428 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", | 429 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", |
429 | codec_dai->name, cpu_dai->name); | 430 | codec_dai->name, cpu_dai->name); |
430 | goto machine_err; | 431 | goto config_err; |
431 | } | 432 | } |
432 | if (!runtime->hw.formats) { | 433 | if (!runtime->hw.formats) { |
433 | printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", | 434 | printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", |
434 | codec_dai->name, cpu_dai->name); | 435 | codec_dai->name, cpu_dai->name); |
435 | goto machine_err; | 436 | goto config_err; |
436 | } | 437 | } |
437 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { | 438 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { |
438 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", | 439 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", |
439 | codec_dai->name, cpu_dai->name); | 440 | codec_dai->name, cpu_dai->name); |
440 | goto machine_err; | 441 | goto config_err; |
441 | } | 442 | } |
442 | 443 | ||
443 | /* Symmetry only applies if we've already got an active stream. */ | 444 | /* Symmetry only applies if we've already got an active stream. */ |
444 | if (cpu_dai->active || codec_dai->active) { | 445 | if (cpu_dai->active || codec_dai->active) { |
445 | ret = soc_pcm_apply_symmetry(substream); | 446 | ret = soc_pcm_apply_symmetry(substream); |
446 | if (ret != 0) | 447 | if (ret != 0) |
447 | goto machine_err; | 448 | goto config_err; |
448 | } | 449 | } |
449 | 450 | ||
450 | pr_debug("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); | 451 | pr_debug("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); |
@@ -464,10 +465,14 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
464 | mutex_unlock(&pcm_mutex); | 465 | mutex_unlock(&pcm_mutex); |
465 | return 0; | 466 | return 0; |
466 | 467 | ||
467 | machine_err: | 468 | config_err: |
468 | if (machine->ops && machine->ops->shutdown) | 469 | if (machine->ops && machine->ops->shutdown) |
469 | machine->ops->shutdown(substream); | 470 | machine->ops->shutdown(substream); |
470 | 471 | ||
472 | machine_err: | ||
473 | if (codec_dai->ops->shutdown) | ||
474 | codec_dai->ops->shutdown(substream, codec_dai); | ||
475 | |||
471 | codec_dai_err: | 476 | codec_dai_err: |
472 | if (platform->pcm_ops->close) | 477 | if (platform->pcm_ops->close) |
473 | platform->pcm_ops->close(substream); | 478 | platform->pcm_ops->close(substream); |
@@ -1544,7 +1549,8 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid) | |||
1544 | mutex_unlock(&codec->mutex); | 1549 | mutex_unlock(&codec->mutex); |
1545 | return ret; | 1550 | return ret; |
1546 | } | 1551 | } |
1547 | if (card->dai_link[i].codec_dai->ac97_control) { | 1552 | /* Check for codec->ac97 to handle the ac97.c fun */ |
1553 | if (card->dai_link[i].codec_dai->ac97_control && codec->ac97) { | ||
1548 | snd_ac97_dev_add_pdata(codec->ac97, | 1554 | snd_ac97_dev_add_pdata(codec->ac97, |
1549 | card->dai_link[i].cpu_dai->ac97_pdata); | 1555 | card->dai_link[i].cpu_dai->ac97_pdata); |
1550 | } | 1556 | } |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6c3351095786..7c28f401f436 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/jiffies.h> | 39 | #include <linux/jiffies.h> |
40 | #include <linux/debugfs.h> | 40 | #include <linux/debugfs.h> |
41 | #include <linux/slab.h> | ||
41 | #include <sound/core.h> | 42 | #include <sound/core.h> |
42 | #include <sound/pcm.h> | 43 | #include <sound/pcm.h> |
43 | #include <sound/pcm_params.h> | 44 | #include <sound/pcm_params.h> |
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c index 0f83bdb9b16f..612e18b4bf4e 100644 --- a/sound/soc/txx9/txx9aclc-ac97.c +++ b/sound/soc/txx9/txx9aclc-ac97.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/gfp.h> | ||
19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
20 | #include <sound/pcm.h> | 21 | #include <sound/pcm.h> |
21 | #include <sound/soc.h> | 22 | #include <sound/soc.h> |
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index efed64b8b026..49cc7ea9a518 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/scatterlist.h> | 17 | #include <linux/scatterlist.h> |
18 | #include <linux/slab.h> | ||
18 | #include <sound/core.h> | 19 | #include <sound/core.h> |
19 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
20 | #include <sound/pcm_params.h> | 21 | #include <sound/pcm_params.h> |
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c index 96deaefaa897..340a0bc5303e 100644 --- a/sound/sound_firmware.c +++ b/sound/sound_firmware.c | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/fs.h> | 3 | #include <linux/fs.h> |
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <linux/slab.h> | ||
6 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
7 | #include <asm/uaccess.h> | 6 | #include <asm/uaccess.h> |
8 | #include "oss/sound_firmware.h" | 7 | #include "oss/sound_firmware.h" |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 8d13d933087d..7dcc06512e86 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
15 | #include <linux/init.h> | 14 | #include <linux/init.h> |
16 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 1d2e51b3f918..2eab6ce48852 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/irq.h> | 58 | #include <linux/irq.h> |
59 | #include <linux/io.h> | 59 | #include <linux/io.h> |
60 | #include <linux/dma-mapping.h> | 60 | #include <linux/dma-mapping.h> |
61 | #include <linux/gfp.h> | ||
61 | 62 | ||
62 | #include <sound/core.h> | 63 | #include <sound/core.h> |
63 | #include <sound/pcm.h> | 64 | #include <sound/pcm.h> |
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c index 687e6a13689e..58a32a10d115 100644 --- a/sound/synth/emux/emux_proc.c +++ b/sound/synth/emux/emux_proc.c | |||
@@ -19,7 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/wait.h> | 21 | #include <linux/wait.h> |
22 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | 22 | #include <sound/core.h> |
24 | #include <sound/emux_synth.h> | 23 | #include <sound/emux_synth.h> |
25 | #include <sound/info.h> | 24 | #include <sound/info.h> |
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 8c2925814ce4..c570ae3e6d55 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig | |||
@@ -22,13 +22,13 @@ config SND_USB_AUDIO | |||
22 | will be called snd-usb-audio. | 22 | will be called snd-usb-audio. |
23 | 23 | ||
24 | config SND_USB_UA101 | 24 | config SND_USB_UA101 |
25 | tristate "Edirol UA-101 driver (EXPERIMENTAL)" | 25 | tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)" |
26 | depends on EXPERIMENTAL | 26 | depends on EXPERIMENTAL |
27 | select SND_PCM | 27 | select SND_PCM |
28 | select SND_RAWMIDI | 28 | select SND_RAWMIDI |
29 | help | 29 | help |
30 | Say Y here to include support for the Edirol UA-101 audio/MIDI | 30 | Say Y here to include support for the Edirol UA-101 and UA-1000 |
31 | interface. | 31 | audio/MIDI interfaces. |
32 | 32 | ||
33 | To compile this driver as a module, choose M here: the module | 33 | To compile this driver as a module, choose M here: the module |
34 | will be called snd-ua101. | 34 | will be called snd-ua101. |
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 86b2c3b92df5..4328cad6c3a2 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index a3f02dd97440..afc5aeb68005 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/gfp.h> | ||
26 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
27 | #include <sound/initval.h> | 28 | #include <sound/initval.h> |
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c index 538e8c00d31a..2f218c77fff2 100644 --- a/sound/usb/caiaq/midi.c +++ b/sound/usb/caiaq/midi.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include <linux/gfp.h> | ||
20 | #include <sound/rawmidi.h> | 21 | #include <sound/rawmidi.h> |
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
diff --git a/sound/usb/caiaq/midi.h b/sound/usb/caiaq/midi.h index 9d16db027fc3..380f984babc9 100644 --- a/sound/usb/caiaq/midi.h +++ b/sound/usb/caiaq/midi.h | |||
@@ -3,6 +3,6 @@ | |||
3 | 3 | ||
4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); | 4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); |
5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); | 5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); |
6 | void snd_usb_caiaq_midi_output_done(struct urb* urb); | 6 | void snd_usb_caiaq_midi_output_done(struct urb *urb); |
7 | 7 | ||
8 | #endif /* CAIAQ_MIDI_H */ | 8 | #endif /* CAIAQ_MIDI_H */ |
diff --git a/sound/usb/ua101.c b/sound/usb/ua101.c index 4f4ccdf70dd0..3d458d3b9962 100644 --- a/sound/usb/ua101.c +++ b/sound/usb/ua101.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Edirol UA-101 driver | 2 | * Edirol UA-101/UA-1000 driver |
3 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> | 3 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
4 | * | 4 | * |
5 | * This driver is free software: you can redistribute it and/or modify | 5 | * This driver is free software: you can redistribute it and/or modify |
@@ -25,13 +25,10 @@ | |||
25 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
26 | #include "usbaudio.h" | 26 | #include "usbaudio.h" |
27 | 27 | ||
28 | MODULE_DESCRIPTION("Edirol UA-101 driver"); | 28 | MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); |
29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
30 | MODULE_LICENSE("GPL v2"); | 30 | MODULE_LICENSE("GPL v2"); |
31 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); | 31 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); |
32 | |||
33 | /* I use my UA-1A for testing because I don't have a UA-101 ... */ | ||
34 | #define UA1A_HACK | ||
35 | 32 | ||
36 | /* | 33 | /* |
37 | * Should not be lower than the minimum scheduling delay of the host | 34 | * Should not be lower than the minimum scheduling delay of the host |
@@ -132,9 +129,6 @@ struct ua101 { | |||
132 | dma_addr_t dma; | 129 | dma_addr_t dma; |
133 | } buffers[MAX_MEMORY_BUFFERS]; | 130 | } buffers[MAX_MEMORY_BUFFERS]; |
134 | } capture, playback; | 131 | } capture, playback; |
135 | |||
136 | unsigned int fps[10]; | ||
137 | unsigned int frame_counter; | ||
138 | }; | 132 | }; |
139 | 133 | ||
140 | static DEFINE_MUTEX(devices_mutex); | 134 | static DEFINE_MUTEX(devices_mutex); |
@@ -424,16 +418,6 @@ static void capture_urb_complete(struct urb *urb) | |||
424 | if (do_period_elapsed) | 418 | if (do_period_elapsed) |
425 | snd_pcm_period_elapsed(stream->substream); | 419 | snd_pcm_period_elapsed(stream->substream); |
426 | 420 | ||
427 | /* for debugging: measure the sample rate relative to the USB clock */ | ||
428 | ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames; | ||
429 | if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) { | ||
430 | printk(KERN_DEBUG "capture rate:"); | ||
431 | for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames) | ||
432 | printk(KERN_CONT " %u", ua->fps[frames]); | ||
433 | printk(KERN_CONT "\n"); | ||
434 | memset(ua->fps, 0, sizeof(ua->fps)); | ||
435 | ua->frame_counter = 0; | ||
436 | } | ||
437 | return; | 421 | return; |
438 | 422 | ||
439 | stream_stopped: | 423 | stream_stopped: |
@@ -1200,13 +1184,30 @@ static int ua101_probe(struct usb_interface *interface, | |||
1200 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 1184 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
1201 | .data = &midi_ep | 1185 | .data = &midi_ep |
1202 | }; | 1186 | }; |
1187 | static const int intf_numbers[2][3] = { | ||
1188 | { /* UA-101 */ | ||
1189 | [INTF_PLAYBACK] = 0, | ||
1190 | [INTF_CAPTURE] = 1, | ||
1191 | [INTF_MIDI] = 2, | ||
1192 | }, | ||
1193 | { /* UA-1000 */ | ||
1194 | [INTF_CAPTURE] = 1, | ||
1195 | [INTF_PLAYBACK] = 2, | ||
1196 | [INTF_MIDI] = 3, | ||
1197 | }, | ||
1198 | }; | ||
1203 | struct snd_card *card; | 1199 | struct snd_card *card; |
1204 | struct ua101 *ua; | 1200 | struct ua101 *ua; |
1205 | unsigned int card_index, i; | 1201 | unsigned int card_index, i; |
1202 | int is_ua1000; | ||
1203 | const char *name; | ||
1206 | char usb_path[32]; | 1204 | char usb_path[32]; |
1207 | int err; | 1205 | int err; |
1208 | 1206 | ||
1209 | if (interface->altsetting->desc.bInterfaceNumber != 0) | 1207 | is_ua1000 = usb_id->idProduct == 0x0044; |
1208 | |||
1209 | if (interface->altsetting->desc.bInterfaceNumber != | ||
1210 | intf_numbers[is_ua1000][0]) | ||
1210 | return -ENODEV; | 1211 | return -ENODEV; |
1211 | 1212 | ||
1212 | mutex_lock(&devices_mutex); | 1213 | mutex_lock(&devices_mutex); |
@@ -1239,20 +1240,13 @@ static int ua101_probe(struct usb_interface *interface, | |||
1239 | init_waitqueue_head(&ua->rate_feedback_wait); | 1240 | init_waitqueue_head(&ua->rate_feedback_wait); |
1240 | init_waitqueue_head(&ua->alsa_playback_wait); | 1241 | init_waitqueue_head(&ua->alsa_playback_wait); |
1241 | 1242 | ||
1242 | #ifdef UA1A_HACK | ||
1243 | if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { | ||
1244 | ua->intf[2] = interface; | ||
1245 | ua->intf[0] = usb_ifnum_to_if(ua->dev, 1); | ||
1246 | ua->intf[1] = usb_ifnum_to_if(ua->dev, 2); | ||
1247 | usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua); | ||
1248 | usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua); | ||
1249 | } else { | ||
1250 | #endif | ||
1251 | ua->intf[0] = interface; | 1243 | ua->intf[0] = interface; |
1252 | for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { | 1244 | for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { |
1253 | ua->intf[i] = usb_ifnum_to_if(ua->dev, i); | 1245 | ua->intf[i] = usb_ifnum_to_if(ua->dev, |
1246 | intf_numbers[is_ua1000][i]); | ||
1254 | if (!ua->intf[i]) { | 1247 | if (!ua->intf[i]) { |
1255 | dev_err(&ua->dev->dev, "interface %u not found\n", i); | 1248 | dev_err(&ua->dev->dev, "interface %u not found\n", |
1249 | intf_numbers[is_ua1000][i]); | ||
1256 | err = -ENXIO; | 1250 | err = -ENXIO; |
1257 | goto probe_error; | 1251 | goto probe_error; |
1258 | } | 1252 | } |
@@ -1264,39 +1258,19 @@ static int ua101_probe(struct usb_interface *interface, | |||
1264 | goto probe_error; | 1258 | goto probe_error; |
1265 | } | 1259 | } |
1266 | } | 1260 | } |
1267 | #ifdef UA1A_HACK | ||
1268 | } | ||
1269 | #endif | ||
1270 | 1261 | ||
1271 | snd_card_set_dev(card, &interface->dev); | 1262 | snd_card_set_dev(card, &interface->dev); |
1272 | 1263 | ||
1273 | #ifdef UA1A_HACK | ||
1274 | if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { | ||
1275 | ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE; | ||
1276 | ua->rate = 44100; | ||
1277 | ua->packets_per_second = 1000; | ||
1278 | ua->capture.channels = 2; | ||
1279 | ua->playback.channels = 2; | ||
1280 | ua->capture.frame_bytes = 4; | ||
1281 | ua->playback.frame_bytes = 4; | ||
1282 | ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2); | ||
1283 | ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1); | ||
1284 | ua->capture.max_packet_bytes = 192; | ||
1285 | ua->playback.max_packet_bytes = 192; | ||
1286 | } else { | ||
1287 | #endif | ||
1288 | err = detect_usb_format(ua); | 1264 | err = detect_usb_format(ua); |
1289 | if (err < 0) | 1265 | if (err < 0) |
1290 | goto probe_error; | 1266 | goto probe_error; |
1291 | #ifdef UA1A_HACK | ||
1292 | } | ||
1293 | #endif | ||
1294 | 1267 | ||
1268 | name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101"; | ||
1295 | strcpy(card->driver, "UA-101"); | 1269 | strcpy(card->driver, "UA-101"); |
1296 | strcpy(card->shortname, "UA-101"); | 1270 | strcpy(card->shortname, name); |
1297 | usb_make_path(ua->dev, usb_path, sizeof(usb_path)); | 1271 | usb_make_path(ua->dev, usb_path, sizeof(usb_path)); |
1298 | snprintf(ua->card->longname, sizeof(ua->card->longname), | 1272 | snprintf(ua->card->longname, sizeof(ua->card->longname), |
1299 | "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", | 1273 | "EDIROL %s (serial %s), %u Hz at %s, %s speed", name, |
1300 | ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, | 1274 | ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, |
1301 | ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); | 1275 | ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); |
1302 | 1276 | ||
@@ -1314,24 +1288,18 @@ static int ua101_probe(struct usb_interface *interface, | |||
1314 | if (err < 0) | 1288 | if (err < 0) |
1315 | goto probe_error; | 1289 | goto probe_error; |
1316 | 1290 | ||
1317 | err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); | 1291 | err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm); |
1318 | if (err < 0) | 1292 | if (err < 0) |
1319 | goto probe_error; | 1293 | goto probe_error; |
1320 | ua->pcm->private_data = ua; | 1294 | ua->pcm->private_data = ua; |
1321 | strcpy(ua->pcm->name, "UA-101"); | 1295 | strcpy(ua->pcm->name, name); |
1322 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); | 1296 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); |
1323 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); | 1297 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); |
1324 | 1298 | ||
1325 | #ifdef UA1A_HACK | ||
1326 | if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) { | ||
1327 | #endif | ||
1328 | err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], | 1299 | err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], |
1329 | &ua->midi_list, &midi_quirk); | 1300 | &ua->midi_list, &midi_quirk); |
1330 | if (err < 0) | 1301 | if (err < 0) |
1331 | goto probe_error; | 1302 | goto probe_error; |
1332 | #ifdef UA1A_HACK | ||
1333 | } | ||
1334 | #endif | ||
1335 | 1303 | ||
1336 | err = snd_card_register(card); | 1304 | err = snd_card_register(card); |
1337 | if (err < 0) | 1305 | if (err < 0) |
@@ -1386,11 +1354,9 @@ static void ua101_disconnect(struct usb_interface *interface) | |||
1386 | } | 1354 | } |
1387 | 1355 | ||
1388 | static struct usb_device_id ua101_ids[] = { | 1356 | static struct usb_device_id ua101_ids[] = { |
1389 | #ifdef UA1A_HACK | 1357 | { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */ |
1390 | { USB_DEVICE(0x0582, 0x0018) }, | 1358 | { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */ |
1391 | #endif | 1359 | { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */ |
1392 | { USB_DEVICE(0x0582, 0x007d) }, | ||
1393 | { USB_DEVICE(0x0582, 0x008d) }, | ||
1394 | { } | 1360 | { } |
1395 | }; | 1361 | }; |
1396 | MODULE_DEVICE_TABLE(usb, ua101_ids); | 1362 | MODULE_DEVICE_TABLE(usb, ua101_ids); |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c539f7fe292f..11b0826b8fe6 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2483,7 +2483,6 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
2483 | sample_width, sample_bytes); | 2483 | sample_width, sample_bytes); |
2484 | } | 2484 | } |
2485 | /* check the format byte size */ | 2485 | /* check the format byte size */ |
2486 | printk(" XXXXX SAMPLE BYTES %d\n", sample_bytes); | ||
2487 | switch (sample_bytes) { | 2486 | switch (sample_bytes) { |
2488 | case 1: | 2487 | case 1: |
2489 | pcm_format = SNDRV_PCM_FORMAT_S8; | 2488 | pcm_format = SNDRV_PCM_FORMAT_S8; |
@@ -2581,6 +2580,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
2581 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | 2580 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && |
2582 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2581 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2583 | rate = 96000; | 2582 | rate = 96000; |
2583 | /* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */ | ||
2584 | if (rate == 16000 && chip->usb_id == USB_ID(0x041e, 0x4068)) | ||
2585 | rate = 8000; | ||
2584 | fp->rate_table[fp->nr_rates] = rate; | 2586 | fp->rate_table[fp->nr_rates] = rate; |
2585 | if (!fp->rate_min || rate < fp->rate_min) | 2587 | if (!fp->rate_min || rate < fp->rate_min) |
2586 | fp->rate_min = rate; | 2588 | fp->rate_min = rate; |
@@ -3386,58 +3388,6 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
3386 | return 0; | 3388 | return 0; |
3387 | } | 3389 | } |
3388 | 3390 | ||
3389 | /* | ||
3390 | * Create a stream for an Edirol UA-1000 interface. | ||
3391 | */ | ||
3392 | static int create_ua1000_quirk(struct snd_usb_audio *chip, | ||
3393 | struct usb_interface *iface, | ||
3394 | const struct snd_usb_audio_quirk *quirk) | ||
3395 | { | ||
3396 | static const struct audioformat ua1000_format = { | ||
3397 | .format = SNDRV_PCM_FORMAT_S32_LE, | ||
3398 | .fmt_type = UAC_FORMAT_TYPE_I, | ||
3399 | .altsetting = 1, | ||
3400 | .altset_idx = 1, | ||
3401 | .attributes = 0, | ||
3402 | .rates = SNDRV_PCM_RATE_CONTINUOUS, | ||
3403 | }; | ||
3404 | struct usb_host_interface *alts; | ||
3405 | struct usb_interface_descriptor *altsd; | ||
3406 | struct audioformat *fp; | ||
3407 | int stream, err; | ||
3408 | |||
3409 | if (iface->num_altsetting != 2) | ||
3410 | return -ENXIO; | ||
3411 | alts = &iface->altsetting[1]; | ||
3412 | altsd = get_iface_desc(alts); | ||
3413 | if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE || | ||
3414 | altsd->bNumEndpoints != 1) | ||
3415 | return -ENXIO; | ||
3416 | |||
3417 | fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL); | ||
3418 | if (!fp) | ||
3419 | return -ENOMEM; | ||
3420 | |||
3421 | fp->channels = alts->extra[4]; | ||
3422 | fp->iface = altsd->bInterfaceNumber; | ||
3423 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; | ||
3424 | fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; | ||
3425 | fp->datainterval = parse_datainterval(chip, alts); | ||
3426 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | ||
3427 | fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]); | ||
3428 | |||
3429 | stream = (fp->endpoint & USB_DIR_IN) | ||
3430 | ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; | ||
3431 | err = add_audio_endpoint(chip, stream, fp); | ||
3432 | if (err < 0) { | ||
3433 | kfree(fp); | ||
3434 | return err; | ||
3435 | } | ||
3436 | /* FIXME: playback must be synchronized to capture */ | ||
3437 | usb_set_interface(chip->dev, fp->iface, 0); | ||
3438 | return 0; | ||
3439 | } | ||
3440 | |||
3441 | static int snd_usb_create_quirk(struct snd_usb_audio *chip, | 3391 | static int snd_usb_create_quirk(struct snd_usb_audio *chip, |
3442 | struct usb_interface *iface, | 3392 | struct usb_interface *iface, |
3443 | const struct snd_usb_audio_quirk *quirk); | 3393 | const struct snd_usb_audio_quirk *quirk); |
@@ -3686,7 +3636,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
3686 | [QUIRK_MIDI_CME] = create_any_midi_quirk, | 3636 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
3687 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, | 3637 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3688 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3638 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3689 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | ||
3690 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, | 3639 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, |
3691 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk | 3640 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk |
3692 | }; | 3641 | }; |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 6b016d4aac6b..42c299cbf63a 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -75,7 +75,6 @@ enum quirk_type { | |||
75 | QUIRK_MIDI_US122L, | 75 | QUIRK_MIDI_US122L, |
76 | QUIRK_AUDIO_STANDARD_INTERFACE, | 76 | QUIRK_AUDIO_STANDARD_INTERFACE, |
77 | QUIRK_AUDIO_FIXED_ENDPOINT, | 77 | QUIRK_AUDIO_FIXED_ENDPOINT, |
78 | QUIRK_AUDIO_EDIROL_UA1000, | ||
79 | QUIRK_AUDIO_EDIROL_UAXX, | 78 | QUIRK_AUDIO_EDIROL_UAXX, |
80 | QUIRK_AUDIO_ALIGN_TRANSFER, | 79 | QUIRK_AUDIO_ALIGN_TRANSFER, |
81 | 80 | ||
@@ -112,7 +111,7 @@ struct snd_usb_midi_endpoint_info { | |||
112 | 111 | ||
113 | /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ | 112 | /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ |
114 | 113 | ||
115 | /* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */ | 114 | /* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */ |
116 | 115 | ||
117 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ | 116 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ |
118 | 117 | ||
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 2c59afd99611..9e28b20cb2ce 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -986,6 +986,8 @@ static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream) | |||
986 | DEFINE_WAIT(wait); | 986 | DEFINE_WAIT(wait); |
987 | long timeout = msecs_to_jiffies(50); | 987 | long timeout = msecs_to_jiffies(50); |
988 | 988 | ||
989 | if (ep->umidi->disconnected) | ||
990 | return; | ||
989 | /* | 991 | /* |
990 | * The substream buffer is empty, but some data might still be in the | 992 | * The substream buffer is empty, but some data might still be in the |
991 | * currently active URBs, so we have to wait for those to complete. | 993 | * currently active URBs, so we have to wait for those to complete. |
@@ -1123,14 +1125,21 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | |||
1123 | * Frees an output endpoint. | 1125 | * Frees an output endpoint. |
1124 | * May be called when ep hasn't been initialized completely. | 1126 | * May be called when ep hasn't been initialized completely. |
1125 | */ | 1127 | */ |
1126 | static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint* ep) | 1128 | static void snd_usbmidi_out_endpoint_clear(struct snd_usb_midi_out_endpoint *ep) |
1127 | { | 1129 | { |
1128 | unsigned int i; | 1130 | unsigned int i; |
1129 | 1131 | ||
1130 | for (i = 0; i < OUTPUT_URBS; ++i) | 1132 | for (i = 0; i < OUTPUT_URBS; ++i) |
1131 | if (ep->urbs[i].urb) | 1133 | if (ep->urbs[i].urb) { |
1132 | free_urb_and_buffer(ep->umidi, ep->urbs[i].urb, | 1134 | free_urb_and_buffer(ep->umidi, ep->urbs[i].urb, |
1133 | ep->max_transfer); | 1135 | ep->max_transfer); |
1136 | ep->urbs[i].urb = NULL; | ||
1137 | } | ||
1138 | } | ||
1139 | |||
1140 | static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint *ep) | ||
1141 | { | ||
1142 | snd_usbmidi_out_endpoint_clear(ep); | ||
1134 | kfree(ep); | 1143 | kfree(ep); |
1135 | } | 1144 | } |
1136 | 1145 | ||
@@ -1262,15 +1271,18 @@ void snd_usbmidi_disconnect(struct list_head* p) | |||
1262 | usb_kill_urb(ep->out->urbs[j].urb); | 1271 | usb_kill_urb(ep->out->urbs[j].urb); |
1263 | if (umidi->usb_protocol_ops->finish_out_endpoint) | 1272 | if (umidi->usb_protocol_ops->finish_out_endpoint) |
1264 | umidi->usb_protocol_ops->finish_out_endpoint(ep->out); | 1273 | umidi->usb_protocol_ops->finish_out_endpoint(ep->out); |
1274 | ep->out->active_urbs = 0; | ||
1275 | if (ep->out->drain_urbs) { | ||
1276 | ep->out->drain_urbs = 0; | ||
1277 | wake_up(&ep->out->drain_wait); | ||
1278 | } | ||
1265 | } | 1279 | } |
1266 | if (ep->in) | 1280 | if (ep->in) |
1267 | for (j = 0; j < INPUT_URBS; ++j) | 1281 | for (j = 0; j < INPUT_URBS; ++j) |
1268 | usb_kill_urb(ep->in->urbs[j]); | 1282 | usb_kill_urb(ep->in->urbs[j]); |
1269 | /* free endpoints here; later call can result in Oops */ | 1283 | /* free endpoints here; later call can result in Oops */ |
1270 | if (ep->out) { | 1284 | if (ep->out) |
1271 | snd_usbmidi_out_endpoint_delete(ep->out); | 1285 | snd_usbmidi_out_endpoint_clear(ep->out); |
1272 | ep->out = NULL; | ||
1273 | } | ||
1274 | if (ep->in) { | 1286 | if (ep->in) { |
1275 | snd_usbmidi_in_endpoint_delete(ep->in); | 1287 | snd_usbmidi_in_endpoint_delete(ep->in); |
1276 | ep->in = NULL; | 1288 | ep->in = NULL; |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index f06faf7917b9..2b426c1fd0e8 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -1016,36 +1016,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1016 | } | 1016 | } |
1017 | }, | 1017 | }, |
1018 | { | 1018 | { |
1019 | USB_DEVICE(0x0582, 0x0044), | ||
1020 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1021 | .vendor_name = "Roland", | ||
1022 | .product_name = "UA-1000", | ||
1023 | .ifnum = QUIRK_ANY_INTERFACE, | ||
1024 | .type = QUIRK_COMPOSITE, | ||
1025 | .data = (const struct snd_usb_audio_quirk[]) { | ||
1026 | { | ||
1027 | .ifnum = 1, | ||
1028 | .type = QUIRK_AUDIO_EDIROL_UA1000 | ||
1029 | }, | ||
1030 | { | ||
1031 | .ifnum = 2, | ||
1032 | .type = QUIRK_AUDIO_EDIROL_UA1000 | ||
1033 | }, | ||
1034 | { | ||
1035 | .ifnum = 3, | ||
1036 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1037 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1038 | .out_cables = 0x0003, | ||
1039 | .in_cables = 0x0003 | ||
1040 | } | ||
1041 | }, | ||
1042 | { | ||
1043 | .ifnum = -1 | ||
1044 | } | ||
1045 | } | ||
1046 | } | ||
1047 | }, | ||
1048 | { | ||
1049 | /* has ID 0x0049 when not in "Advanced Driver" mode */ | 1019 | /* has ID 0x0049 when not in "Advanced Driver" mode */ |
1050 | USB_DEVICE(0x0582, 0x0047), | 1020 | USB_DEVICE(0x0582, 0x0047), |
1051 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1021 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 44deb21b1777..9ca9a13a78da 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -16,6 +16,7 @@ | |||
16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/slab.h> | ||
19 | #include <linux/usb.h> | 20 | #include <linux/usb.h> |
20 | #include <linux/usb/audio.h> | 21 | #include <linux/usb/audio.h> |
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 1879b72c40f8..04aafb43a13c 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -21,6 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include <sound/memalloc.h> | 27 | #include <sound/memalloc.h> |
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 12ae0340adc0..c400ade3ff08 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include <linux/gfp.h> | ||
20 | 21 | ||
21 | #include "usb_stream.h" | 22 | #include "usb_stream.h" |
22 | 23 | ||
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index c42350eed2eb..cbd37f2c76d0 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -133,6 +133,7 @@ | |||
133 | #include <linux/init.h> | 133 | #include <linux/init.h> |
134 | #include <linux/module.h> | 134 | #include <linux/module.h> |
135 | #include <linux/moduleparam.h> | 135 | #include <linux/moduleparam.h> |
136 | #include <linux/slab.h> | ||
136 | #include <linux/interrupt.h> | 137 | #include <linux/interrupt.h> |
137 | #include <linux/usb.h> | 138 | #include <linux/usb.h> |
138 | #include <sound/core.h> | 139 | #include <sound/core.h> |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 74a67a85aa81..5d37d1ccf813 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | 33 | ||
34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
35 | #include <linux/slab.h> | ||
35 | #include <linux/usb.h> | 36 | #include <linux/usb.h> |
36 | #include <sound/core.h> | 37 | #include <sound/core.h> |
37 | #include <sound/info.h> | 38 | #include <sound/info.h> |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 9ed6c3956ca7..2a528e56afd5 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -51,6 +51,7 @@ | |||
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/delay.h> | 53 | #include <linux/delay.h> |
54 | #include <linux/gfp.h> | ||
54 | #include "usbusx2yaudio.c" | 55 | #include "usbusx2yaudio.c" |
55 | 56 | ||
56 | #if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) | 57 | #if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) |