aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt45
-rw-r--r--include/sound/core.h2
-rw-r--r--include/sound/pcm.h5
-rw-r--r--sound/arm/aaci.c2
-rw-r--r--sound/arm/pxa2xx-ac97.c1
-rw-r--r--sound/core/Kconfig9
-rw-r--r--sound/core/init.c55
-rw-r--r--sound/core/pcm_lib.c3
-rw-r--r--sound/drivers/aloop.c1
-rw-r--r--sound/drivers/dummy.c1
-rw-r--r--sound/drivers/ml403-ac97cr.c1
-rw-r--r--sound/drivers/mpu401/mpu401.c1
-rw-r--r--sound/drivers/mtpav.c1
-rw-r--r--sound/drivers/pcsp/pcsp.c1
-rw-r--r--sound/drivers/serial-u16550.c1
-rw-r--r--sound/drivers/virmidi.c1
-rw-r--r--sound/drivers/vx/vx_core.c2
-rw-r--r--sound/firewire/scs1x.c4
-rw-r--r--sound/isa/ad1848/ad1848.c1
-rw-r--r--sound/isa/adlib.c1
-rw-r--r--sound/isa/cmi8328.c1
-rw-r--r--sound/isa/cmi8330.c1
-rw-r--r--sound/isa/cs423x/cs4231.c1
-rw-r--r--sound/isa/cs423x/cs4236.c2
-rw-r--r--sound/isa/es1688/es1688.c1
-rw-r--r--sound/isa/es18xx.c2
-rw-r--r--sound/isa/galaxy/galaxy.c1
-rw-r--r--sound/isa/gus/gusclassic.c1
-rw-r--r--sound/isa/gus/gusextreme.c1
-rw-r--r--sound/isa/gus/gusmax.c1
-rw-r--r--sound/isa/gus/interwave.c1
-rw-r--r--sound/isa/msnd/msnd_pinnacle.c1
-rw-r--r--sound/isa/opl3sa2.c2
-rw-r--r--sound/isa/opti9xx/miro.c1
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c1
-rw-r--r--sound/isa/sb/jazz16.c1
-rw-r--r--sound/isa/sb/sb16.c1
-rw-r--r--sound/isa/sb/sb8.c1
-rw-r--r--sound/isa/sc6000.c1
-rw-r--r--sound/isa/sscape.c1
-rw-r--r--sound/isa/wavefront/wavefront.c1
-rw-r--r--sound/oss/kahlua.c2
-rw-r--r--sound/parisc/harmony.c3
-rw-r--r--sound/pci/ad1889.c1
-rw-r--r--sound/pci/ali5451/ali5451.c1
-rw-r--r--sound/pci/als300.c1
-rw-r--r--sound/pci/als4000.c1
-rw-r--r--sound/pci/asihpi/hpioctl.c1
-rw-r--r--sound/pci/atiixp.c1
-rw-r--r--sound/pci/atiixp_modem.c1
-rw-r--r--sound/pci/au88x0/au88x0.c1
-rw-r--r--sound/pci/aw2/aw2-alsa.c1
-rw-r--r--sound/pci/azt3328.c1
-rw-r--r--sound/pci/bt87x.c1
-rw-r--r--sound/pci/ca0106/ca0106_main.c1
-rw-r--r--sound/pci/cmipci.c1
-rw-r--r--sound/pci/cs4281.c1
-rw-r--r--sound/pci/cs46xx/cs46xx.c1
-rw-r--r--sound/pci/cs5530.c1
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c1
-rw-r--r--sound/pci/ctxfi/xfi.c1
-rw-r--r--sound/pci/echoaudio/echoaudio.c1
-rw-r--r--sound/pci/emu10k1/emu10k1.c1
-rw-r--r--sound/pci/emu10k1/emu10k1x.c1
-rw-r--r--sound/pci/ens1370.c1
-rw-r--r--sound/pci/es1938.c1
-rw-r--r--sound/pci/es1968.c74
-rw-r--r--sound/pci/fm801.c1
-rw-r--r--sound/pci/hda/Kconfig1
-rw-r--r--sound/pci/hda/hda_codec.c67
-rw-r--r--sound/pci/hda/hda_codec.h11
-rw-r--r--sound/pci/hda/hda_intel.c8
-rw-r--r--sound/pci/hda/hda_local.h10
-rw-r--r--sound/pci/hda/patch_cirrus.c23
-rw-r--r--sound/pci/hda/patch_conexant.c2
-rw-r--r--sound/pci/hda/patch_hdmi.c106
-rw-r--r--sound/pci/hda/patch_realtek.c17
-rw-r--r--sound/pci/hda/patch_sigmatel.c4
-rw-r--r--sound/pci/hda/patch_via.c13
-rw-r--r--sound/pci/ice1712/ice1712.c1
-rw-r--r--sound/pci/ice1712/ice1724.c1
-rw-r--r--sound/pci/intel8x0.c1
-rw-r--r--sound/pci/intel8x0m.c1
-rw-r--r--sound/pci/korg1212/korg1212.c1
-rw-r--r--sound/pci/lola/lola.c1
-rw-r--r--sound/pci/lx6464es/lx6464es.c1
-rw-r--r--sound/pci/maestro3.c1
-rw-r--r--sound/pci/mixart/mixart.c1
-rw-r--r--sound/pci/nm256/nm256.c1
-rw-r--r--sound/pci/oxygen/oxygen_lib.c1
-rw-r--r--sound/pci/pcxhr/pcxhr.c1
-rw-r--r--sound/pci/riptide/riptide.c2
-rw-r--r--sound/pci/rme32.c1
-rw-r--r--sound/pci/rme96.c1
-rw-r--r--sound/pci/rme9652/hdsp.c1
-rw-r--r--sound/pci/rme9652/hdspm.c59
-rw-r--r--sound/pci/rme9652/rme9652.c1
-rw-r--r--sound/pci/sis7019.c1
-rw-r--r--sound/pci/sonicvibes.c1
-rw-r--r--sound/pci/trident/trident.c1
-rw-r--r--sound/pci/via82xx.c1
-rw-r--r--sound/pci/via82xx_modem.c1
-rw-r--r--sound/pci/vx222/vx222.c1
-rw-r--r--sound/pci/ymfpci/ymfpci.c1
-rw-r--r--sound/ppc/powermac.c1
-rw-r--r--sound/sh/aica.c1
-rw-r--r--sound/sh/sh_dac_audio.c2
-rw-r--r--sound/sparc/dbri.c2
-rw-r--r--sound/spi/at73c213.c1
-rw-r--r--sound/usb/6fire/chip.c2
-rw-r--r--sound/usb/6fire/pcm.c12
-rw-r--r--sound/usb/caiaq/audio.c14
-rw-r--r--sound/usb/caiaq/device.c31
-rw-r--r--sound/usb/card.c22
-rw-r--r--sound/usb/misc/ua101.c2
-rw-r--r--sound/usb/mixer.c1
-rw-r--r--sound/usb/usx2y/usbusx2y.c2
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c3
118 files changed, 410 insertions, 297 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index bb8b0dc532b8..809d72b8eff1 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -21,38 +21,41 @@ ALC267/268
21========== 21==========
22 inv-dmic Inverted internal mic workaround 22 inv-dmic Inverted internal mic workaround
23 23
24ALC269/270/275/276/280/282 24ALC269/270/275/276/28x/29x
25====== 25======
26 laptop-amic Laptops with analog-mic input 26 laptop-amic Laptops with analog-mic input
27 laptop-dmic Laptops with digital-mic input 27 laptop-dmic Laptops with digital-mic input
28 alc269-dmic Enable ALC269(VA) digital mic workaround 28 alc269-dmic Enable ALC269(VA) digital mic workaround
29 alc271-dmic Enable ALC271X digital mic workaround 29 alc271-dmic Enable ALC271X digital mic workaround
30 inv-dmic Inverted internal mic workaround 30 inv-dmic Inverted internal mic workaround
31 lenovo-dock Enables docking station I/O for some Lenovos 31 lenovo-dock Enables docking station I/O for some Lenovos
32 32 dell-headset-multi Headset jack, which can also be used as mic-in
33ALC662/663/272 33 dell-headset-dock Headset jack (without mic-in), and also dock I/O
34
35ALC66x/67x/892
34============== 36==============
35 mario Chromebook mario model fixup 37 mario Chromebook mario model fixup
36 asus-mode1 ASUS 38 asus-mode1 ASUS
37 asus-mode2 ASUS 39 asus-mode2 ASUS
38 asus-mode3 ASUS 40 asus-mode3 ASUS
39 asus-mode4 ASUS 41 asus-mode4 ASUS
40 asus-mode5 ASUS 42 asus-mode5 ASUS
41 asus-mode6 ASUS 43 asus-mode6 ASUS
42 asus-mode7 ASUS 44 asus-mode7 ASUS
43 asus-mode8 ASUS 45 asus-mode8 ASUS
44 inv-dmic Inverted internal mic workaround 46 inv-dmic Inverted internal mic workaround
47 dell-headset-multi Headset jack, which can also be used as mic-in
45 48
46ALC680 49ALC680
47====== 50======
48 N/A 51 N/A
49 52
50ALC882/883/885/888/889 53ALC88x/898/1150
51====================== 54======================
52 acer-aspire-4930g Acer Aspire 4930G/5930G/6530G/6930G/7730G 55 acer-aspire-4930g Acer Aspire 4930G/5930G/6530G/6930G/7730G
53 acer-aspire-8930g Acer Aspire 8330G/6935G 56 acer-aspire-8930g Acer Aspire 8330G/6935G
54 acer-aspire Acer Aspire others 57 acer-aspire Acer Aspire others
55 inv-dmic Inverted internal mic workaround 58 inv-dmic Inverted internal mic workaround
56 no-primary-hp VAIO Z/VGC-LN51JGB workaround (for fixed speaker DAC) 59 no-primary-hp VAIO Z/VGC-LN51JGB workaround (for fixed speaker DAC)
57 60
58ALC861/660 61ALC861/660
diff --git a/include/sound/core.h b/include/sound/core.h
index 5bfe5136441c..c586617cfa0d 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -30,7 +30,7 @@
30 30
31/* number of supported soundcards */ 31/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS 32#ifdef CONFIG_SND_DYNAMIC_MINORS
33#define SNDRV_CARDS 32 33#define SNDRV_CARDS CONFIG_SND_MAX_CARDS
34#else 34#else
35#define SNDRV_CARDS 8 /* don't change - minor numbers */ 35#define SNDRV_CARDS 8 /* don't change - minor numbers */
36#endif 36#endif
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index b48792fe386b..84b10f9a2832 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -384,7 +384,7 @@ struct snd_pcm_substream {
384 unsigned int dma_buf_id; 384 unsigned int dma_buf_id;
385 size_t dma_max; 385 size_t dma_max;
386 /* -- hardware operations -- */ 386 /* -- hardware operations -- */
387 struct snd_pcm_ops *ops; 387 const struct snd_pcm_ops *ops;
388 /* -- runtime information -- */ 388 /* -- runtime information -- */
389 struct snd_pcm_runtime *runtime; 389 struct snd_pcm_runtime *runtime;
390 /* -- timer section -- */ 390 /* -- timer section -- */
@@ -871,7 +871,8 @@ const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);
871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames);
872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian); 872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian);
873 873
874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); 874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
875 const struct snd_pcm_ops *ops);
875void snd_pcm_set_sync(struct snd_pcm_substream *substream); 876void snd_pcm_set_sync(struct snd_pcm_substream *substream);
876int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); 877int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
877int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 878int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index aa5d8034890b..1ca8dc2ccb89 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -1076,8 +1076,6 @@ static int aaci_remove(struct amba_device *dev)
1076{ 1076{
1077 struct snd_card *card = amba_get_drvdata(dev); 1077 struct snd_card *card = amba_get_drvdata(dev);
1078 1078
1079 amba_set_drvdata(dev, NULL);
1080
1081 if (card) { 1079 if (card) {
1082 struct aaci *aaci = card->private_data; 1080 struct aaci *aaci = card->private_data;
1083 writel(0, aaci->base + AACI_MAINCR); 1081 writel(0, aaci->base + AACI_MAINCR);
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index ec54be4efff0..ce431e6e07cf 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -230,7 +230,6 @@ static int pxa2xx_ac97_remove(struct platform_device *dev)
230 230
231 if (card) { 231 if (card) {
232 snd_card_free(card); 232 snd_card_free(card);
233 platform_set_drvdata(dev, NULL);
234 pxa2xx_ac97_hw_remove(dev); 233 pxa2xx_ac97_hw_remove(dev);
235 } 234 }
236 235
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index b413ed05e74d..c0c2f57a0d6f 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -157,6 +157,15 @@ config SND_DYNAMIC_MINORS
157 157
158 If you are unsure about this, say N here. 158 If you are unsure about this, say N here.
159 159
160config SND_MAX_CARDS
161 int "Max number of sound cards"
162 range 4 256
163 default 32
164 depends on SND_DYNAMIC_MINORS
165 help
166 Specify the max number of sound cards that can be assigned
167 on a single machine.
168
160config SND_SUPPORT_OLD_API 169config SND_SUPPORT_OLD_API
161 bool "Support old ALSA API" 170 bool "Support old ALSA API"
162 default y 171 default y
diff --git a/sound/core/init.c b/sound/core/init.c
index 6ef06400dfc8..6b9087115da2 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -46,7 +46,8 @@ static LIST_HEAD(shutdown_files);
46 46
47static const struct file_operations snd_shutdown_f_ops; 47static const struct file_operations snd_shutdown_f_ops;
48 48
49static unsigned int snd_cards_lock; /* locked for registering/using */ 49/* locked for registering/using */
50static DECLARE_BITMAP(snd_cards_lock, SNDRV_CARDS);
50struct snd_card *snd_cards[SNDRV_CARDS]; 51struct snd_card *snd_cards[SNDRV_CARDS];
51EXPORT_SYMBOL(snd_cards); 52EXPORT_SYMBOL(snd_cards);
52 53
@@ -167,29 +168,35 @@ int snd_card_create(int idx, const char *xid,
167 err = 0; 168 err = 0;
168 mutex_lock(&snd_card_mutex); 169 mutex_lock(&snd_card_mutex);
169 if (idx < 0) { 170 if (idx < 0) {
170 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) 171 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) {
171 /* idx == -1 == 0xffff means: take any free slot */ 172 /* idx == -1 == 0xffff means: take any free slot */
172 if (~snd_cards_lock & idx & 1<<idx2) { 173 if (idx2 < sizeof(int) && !(idx & (1U << idx2)))
174 continue;
175 if (!test_bit(idx2, snd_cards_lock)) {
173 if (module_slot_match(module, idx2)) { 176 if (module_slot_match(module, idx2)) {
174 idx = idx2; 177 idx = idx2;
175 break; 178 break;
176 } 179 }
177 } 180 }
181 }
178 } 182 }
179 if (idx < 0) { 183 if (idx < 0) {
180 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) 184 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) {
181 /* idx == -1 == 0xffff means: take any free slot */ 185 /* idx == -1 == 0xffff means: take any free slot */
182 if (~snd_cards_lock & idx & 1<<idx2) { 186 if (idx2 < sizeof(int) && !(idx & (1U << idx2)))
187 continue;
188 if (!test_bit(idx2, snd_cards_lock)) {
183 if (!slots[idx2] || !*slots[idx2]) { 189 if (!slots[idx2] || !*slots[idx2]) {
184 idx = idx2; 190 idx = idx2;
185 break; 191 break;
186 } 192 }
187 } 193 }
194 }
188 } 195 }
189 if (idx < 0) 196 if (idx < 0)
190 err = -ENODEV; 197 err = -ENODEV;
191 else if (idx < snd_ecards_limit) { 198 else if (idx < snd_ecards_limit) {
192 if (snd_cards_lock & (1 << idx)) 199 if (test_bit(idx, snd_cards_lock))
193 err = -EBUSY; /* invalid */ 200 err = -EBUSY; /* invalid */
194 } else if (idx >= SNDRV_CARDS) 201 } else if (idx >= SNDRV_CARDS)
195 err = -ENODEV; 202 err = -ENODEV;
@@ -199,7 +206,7 @@ int snd_card_create(int idx, const char *xid,
199 idx, snd_ecards_limit - 1, err); 206 idx, snd_ecards_limit - 1, err);
200 goto __error; 207 goto __error;
201 } 208 }
202 snd_cards_lock |= 1 << idx; /* lock it */ 209 set_bit(idx, snd_cards_lock); /* lock it */
203 if (idx >= snd_ecards_limit) 210 if (idx >= snd_ecards_limit)
204 snd_ecards_limit = idx + 1; /* increase the limit */ 211 snd_ecards_limit = idx + 1; /* increase the limit */
205 mutex_unlock(&snd_card_mutex); 212 mutex_unlock(&snd_card_mutex);
@@ -249,7 +256,7 @@ int snd_card_locked(int card)
249 int locked; 256 int locked;
250 257
251 mutex_lock(&snd_card_mutex); 258 mutex_lock(&snd_card_mutex);
252 locked = snd_cards_lock & (1 << card); 259 locked = test_bit(card, snd_cards_lock);
253 mutex_unlock(&snd_card_mutex); 260 mutex_unlock(&snd_card_mutex);
254 return locked; 261 return locked;
255} 262}
@@ -361,7 +368,7 @@ int snd_card_disconnect(struct snd_card *card)
361 /* phase 1: disable fops (user space) operations for ALSA API */ 368 /* phase 1: disable fops (user space) operations for ALSA API */
362 mutex_lock(&snd_card_mutex); 369 mutex_lock(&snd_card_mutex);
363 snd_cards[card->number] = NULL; 370 snd_cards[card->number] = NULL;
364 snd_cards_lock &= ~(1 << card->number); 371 clear_bit(card->number, snd_cards_lock);
365 mutex_unlock(&snd_card_mutex); 372 mutex_unlock(&snd_card_mutex);
366 373
367 /* phase 2: replace file->f_op with special dummy operations */ 374 /* phase 2: replace file->f_op with special dummy operations */
@@ -549,7 +556,6 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
549 const char *nid) 556 const char *nid)
550{ 557{
551 int len, loops; 558 int len, loops;
552 bool with_suffix;
553 bool is_default = false; 559 bool is_default = false;
554 char *id; 560 char *id;
555 561
@@ -565,26 +571,23 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
565 is_default = true; 571 is_default = true;
566 } 572 }
567 573
568 with_suffix = false; 574 len = strlen(id);
569 for (loops = 0; loops < SNDRV_CARDS; loops++) { 575 for (loops = 0; loops < SNDRV_CARDS; loops++) {
576 char *spos;
577 char sfxstr[5]; /* "_012" */
578 int sfxlen;
579
570 if (card_id_ok(card, id)) 580 if (card_id_ok(card, id))
571 return; /* OK */ 581 return; /* OK */
572 582
573 len = strlen(id); 583 /* Add _XYZ suffix */
574 if (!with_suffix) { 584 sprintf(sfxstr, "_%X", loops + 1);
575 /* add the "_X" suffix */ 585 sfxlen = strlen(sfxstr);
576 char *spos = id + len; 586 if (len + sfxlen >= sizeof(card->id))
577 if (len > sizeof(card->id) - 3) 587 spos = id + sizeof(card->id) - sfxlen - 1;
578 spos = id + sizeof(card->id) - 3; 588 else
579 strcpy(spos, "_1"); 589 spos = id + len;
580 with_suffix = true; 590 strcpy(spos, sfxstr);
581 } else {
582 /* modify the existing suffix */
583 if (id[len - 1] != '9')
584 id[len - 1]++;
585 else
586 id[len - 1] = 'A';
587 }
588 } 591 }
589 /* fallback to the default id */ 592 /* fallback to the default id */
590 if (!is_default) { 593 if (!is_default) {
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 41b3dfe68698..82bb029d4414 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -568,7 +568,8 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
568 * 568 *
569 * Sets the given PCM operators to the pcm instance. 569 * Sets the given PCM operators to the pcm instance.
570 */ 570 */
571void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops) 571void snd_pcm_set_ops(struct snd_pcm *pcm, int direction,
572 const struct snd_pcm_ops *ops)
572{ 573{
573 struct snd_pcm_str *stream = &pcm->streams[direction]; 574 struct snd_pcm_str *stream = &pcm->streams[direction];
574 struct snd_pcm_substream *substream; 575 struct snd_pcm_substream *substream;
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 6f78de9c6fb6..f7589923effa 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -1183,7 +1183,6 @@ static int loopback_probe(struct platform_device *devptr)
1183static int loopback_remove(struct platform_device *devptr) 1183static int loopback_remove(struct platform_device *devptr)
1184{ 1184{
1185 snd_card_free(platform_get_drvdata(devptr)); 1185 snd_card_free(platform_get_drvdata(devptr));
1186 platform_set_drvdata(devptr, NULL);
1187 return 0; 1186 return 0;
1188} 1187}
1189 1188
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index fd798f753609..11048cc744d0 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -1129,7 +1129,6 @@ static int snd_dummy_probe(struct platform_device *devptr)
1129static int snd_dummy_remove(struct platform_device *devptr) 1129static int snd_dummy_remove(struct platform_device *devptr)
1130{ 1130{
1131 snd_card_free(platform_get_drvdata(devptr)); 1131 snd_card_free(platform_get_drvdata(devptr));
1132 platform_set_drvdata(devptr, NULL);
1133 return 0; 1132 return 0;
1134} 1133}
1135 1134
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index 8125a7e95ee4..95ea4a153ea4 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -1325,7 +1325,6 @@ static int snd_ml403_ac97cr_probe(struct platform_device *pfdev)
1325static int snd_ml403_ac97cr_remove(struct platform_device *pfdev) 1325static int snd_ml403_ac97cr_remove(struct platform_device *pfdev)
1326{ 1326{
1327 snd_card_free(platform_get_drvdata(pfdev)); 1327 snd_card_free(platform_get_drvdata(pfdev));
1328 platform_set_drvdata(pfdev, NULL);
1329 return 0; 1328 return 0;
1330} 1329}
1331 1330
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index da1a29bfc85d..90a3a7b38a2a 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -129,7 +129,6 @@ static int snd_mpu401_probe(struct platform_device *devptr)
129static int snd_mpu401_remove(struct platform_device *devptr) 129static int snd_mpu401_remove(struct platform_device *devptr)
130{ 130{
131 snd_card_free(platform_get_drvdata(devptr)); 131 snd_card_free(platform_get_drvdata(devptr));
132 platform_set_drvdata(devptr, NULL);
133 return 0; 132 return 0;
134} 133}
135 134
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index 9f1815b99a15..e5ec7eb27dec 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -749,7 +749,6 @@ static int snd_mtpav_probe(struct platform_device *dev)
749static int snd_mtpav_remove(struct platform_device *devptr) 749static int snd_mtpav_remove(struct platform_device *devptr)
750{ 750{
751 snd_card_free(platform_get_drvdata(devptr)); 751 snd_card_free(platform_get_drvdata(devptr));
752 platform_set_drvdata(devptr, NULL);
753 return 0; 752 return 0;
754} 753}
755 754
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index 7a5fdb9b0afc..1c19cd7ad26e 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -189,7 +189,6 @@ static int pcsp_remove(struct platform_device *dev)
189 struct snd_pcsp *chip = platform_get_drvdata(dev); 189 struct snd_pcsp *chip = platform_get_drvdata(dev);
190 alsa_card_pcsp_exit(chip); 190 alsa_card_pcsp_exit(chip);
191 pcspkr_input_remove(chip->input_dev); 191 pcspkr_input_remove(chip->input_dev);
192 platform_set_drvdata(dev, NULL);
193 return 0; 192 return 0;
194} 193}
195 194
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 7425dd8c1f09..e0bf5e77b43a 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -985,7 +985,6 @@ static int snd_serial_probe(struct platform_device *devptr)
985static int snd_serial_remove(struct platform_device *devptr) 985static int snd_serial_remove(struct platform_device *devptr)
986{ 986{
987 snd_card_free(platform_get_drvdata(devptr)); 987 snd_card_free(platform_get_drvdata(devptr));
988 platform_set_drvdata(devptr, NULL);
989 return 0; 988 return 0;
990} 989}
991 990
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index cc4be88d7318..ace3879e8d96 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -132,7 +132,6 @@ static int snd_virmidi_probe(struct platform_device *devptr)
132static int snd_virmidi_remove(struct platform_device *devptr) 132static int snd_virmidi_remove(struct platform_device *devptr)
133{ 133{
134 snd_card_free(platform_get_drvdata(devptr)); 134 snd_card_free(platform_get_drvdata(devptr));
135 platform_set_drvdata(devptr, NULL);
136 return 0; 135 return 0;
137} 136}
138 137
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index c39961c11401..83596891cde4 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
205 205
206 if (size < 1) 206 if (size < 1)
207 return 0; 207 return 0;
208 if (snd_BUG_ON(size > SIZE_MAX_STATUS)) 208 if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
209 return -EINVAL; 209 return -EINVAL;
210 210
211 for (i = 1; i <= size; i++) { 211 for (i = 1; i <= size; i++) {
diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c
index 844a555c3b1e..b252c21b6d13 100644
--- a/sound/firewire/scs1x.c
+++ b/sound/firewire/scs1x.c
@@ -405,8 +405,10 @@ static int scs_probe(struct device *unit_dev)
405 scs->output_idle = true; 405 scs->output_idle = true;
406 406
407 scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL); 407 scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL);
408 if (!scs->buffer) 408 if (!scs->buffer) {
409 err = -ENOMEM;
409 goto err_card; 410 goto err_card;
411 }
410 412
411 scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE; 413 scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE;
412 scs->hss_handler.address_callback = handle_hss; 414 scs->hss_handler.address_callback = handle_hss;
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index c214ecf45400..e3f455bd85cd 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -135,7 +135,6 @@ out: snd_card_free(card);
135static int snd_ad1848_remove(struct device *dev, unsigned int n) 135static int snd_ad1848_remove(struct device *dev, unsigned int n)
136{ 136{
137 snd_card_free(dev_get_drvdata(dev)); 137 snd_card_free(dev_get_drvdata(dev));
138 dev_set_drvdata(dev, NULL);
139 return 0; 138 return 0;
140} 139}
141 140
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index d26545543732..35659218710f 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -101,7 +101,6 @@ out: snd_card_free(card);
101static int snd_adlib_remove(struct device *dev, unsigned int n) 101static int snd_adlib_remove(struct device *dev, unsigned int n)
102{ 102{
103 snd_card_free(dev_get_drvdata(dev)); 103 snd_card_free(dev_get_drvdata(dev));
104 dev_set_drvdata(dev, NULL);
105 return 0; 104 return 0;
106} 105}
107 106
diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c
index a7369fe19a6f..f84f073fc1e8 100644
--- a/sound/isa/cmi8328.c
+++ b/sound/isa/cmi8328.c
@@ -418,7 +418,6 @@ static int snd_cmi8328_remove(struct device *pdev, unsigned int dev)
418 snd_cmi8328_cfg_write(cmi->port, CFG2, 0); 418 snd_cmi8328_cfg_write(cmi->port, CFG2, 0);
419 snd_cmi8328_cfg_write(cmi->port, CFG3, 0); 419 snd_cmi8328_cfg_write(cmi->port, CFG3, 0);
420 snd_card_free(card); 420 snd_card_free(card);
421 dev_set_drvdata(pdev, NULL);
422 return 0; 421 return 0;
423} 422}
424 423
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index c707c52268ab..270b9659ef7f 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -651,7 +651,6 @@ static int snd_cmi8330_isa_remove(struct device *devptr,
651 unsigned int dev) 651 unsigned int dev)
652{ 652{
653 snd_card_free(dev_get_drvdata(devptr)); 653 snd_card_free(dev_get_drvdata(devptr));
654 dev_set_drvdata(devptr, NULL);
655 return 0; 654 return 0;
656} 655}
657 656
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index aa7a5d86e480..ba9a74eff3e0 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -151,7 +151,6 @@ out: snd_card_free(card);
151static int snd_cs4231_remove(struct device *dev, unsigned int n) 151static int snd_cs4231_remove(struct device *dev, unsigned int n)
152{ 152{
153 snd_card_free(dev_get_drvdata(dev)); 153 snd_card_free(dev_get_drvdata(dev));
154 dev_set_drvdata(dev, NULL);
155 return 0; 154 return 0;
156} 155}
157 156
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 252e9fb37db3..69614acb2052 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -504,7 +504,6 @@ static int snd_cs423x_isa_remove(struct device *pdev,
504 unsigned int dev) 504 unsigned int dev)
505{ 505{
506 snd_card_free(dev_get_drvdata(pdev)); 506 snd_card_free(dev_get_drvdata(pdev));
507 dev_set_drvdata(pdev, NULL);
508 return 0; 507 return 0;
509} 508}
510 509
@@ -600,7 +599,6 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
600static void snd_cs423x_pnp_remove(struct pnp_dev *pdev) 599static void snd_cs423x_pnp_remove(struct pnp_dev *pdev)
601{ 600{
602 snd_card_free(pnp_get_drvdata(pdev)); 601 snd_card_free(pnp_get_drvdata(pdev));
603 pnp_set_drvdata(pdev, NULL);
604} 602}
605 603
606#ifdef CONFIG_PM 604#ifdef CONFIG_PM
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 102874a703d4..cdcfb57f1f0a 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -213,7 +213,6 @@ out:
213static int snd_es1688_isa_remove(struct device *dev, unsigned int n) 213static int snd_es1688_isa_remove(struct device *dev, unsigned int n)
214{ 214{
215 snd_card_free(dev_get_drvdata(dev)); 215 snd_card_free(dev_get_drvdata(dev));
216 dev_set_drvdata(dev, NULL);
217 return 0; 216 return 0;
218} 217}
219 218
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 24380efe31a1..12978b864c3a 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2235,7 +2235,6 @@ static int snd_es18xx_isa_remove(struct device *devptr,
2235 unsigned int dev) 2235 unsigned int dev)
2236{ 2236{
2237 snd_card_free(dev_get_drvdata(devptr)); 2237 snd_card_free(dev_get_drvdata(devptr));
2238 dev_set_drvdata(devptr, NULL);
2239 return 0; 2238 return 0;
2240} 2239}
2241 2240
@@ -2305,7 +2304,6 @@ static int snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
2305static void snd_audiodrive_pnp_remove(struct pnp_dev *pdev) 2304static void snd_audiodrive_pnp_remove(struct pnp_dev *pdev)
2306{ 2305{
2307 snd_card_free(pnp_get_drvdata(pdev)); 2306 snd_card_free(pnp_get_drvdata(pdev));
2308 pnp_set_drvdata(pdev, NULL);
2309} 2307}
2310 2308
2311#ifdef CONFIG_PM 2309#ifdef CONFIG_PM
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
index 672184e3221a..81244e7cea5b 100644
--- a/sound/isa/galaxy/galaxy.c
+++ b/sound/isa/galaxy/galaxy.c
@@ -623,7 +623,6 @@ error:
623static int snd_galaxy_remove(struct device *dev, unsigned int n) 623static int snd_galaxy_remove(struct device *dev, unsigned int n)
624{ 624{
625 snd_card_free(dev_get_drvdata(dev)); 625 snd_card_free(dev_get_drvdata(dev));
626 dev_set_drvdata(dev, NULL);
627 return 0; 626 return 0;
628} 627}
629 628
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 16bca4e96c08..1adc1b924f39 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -215,7 +215,6 @@ out: snd_card_free(card);
215static int snd_gusclassic_remove(struct device *dev, unsigned int n) 215static int snd_gusclassic_remove(struct device *dev, unsigned int n)
216{ 216{
217 snd_card_free(dev_get_drvdata(dev)); 217 snd_card_free(dev_get_drvdata(dev));
218 dev_set_drvdata(dev, NULL);
219 return 0; 218 return 0;
220} 219}
221 220
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 0b9c2426b49f..38e1e3260c24 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -344,7 +344,6 @@ out: snd_card_free(card);
344static int snd_gusextreme_remove(struct device *dev, unsigned int n) 344static int snd_gusextreme_remove(struct device *dev, unsigned int n)
345{ 345{
346 snd_card_free(dev_get_drvdata(dev)); 346 snd_card_free(dev_get_drvdata(dev));
347 dev_set_drvdata(dev, NULL);
348 return 0; 347 return 0;
349} 348}
350 349
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index c309a5d0e7e1..652d5d834620 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -357,7 +357,6 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
357static int snd_gusmax_remove(struct device *devptr, unsigned int dev) 357static int snd_gusmax_remove(struct device *devptr, unsigned int dev)
358{ 358{
359 snd_card_free(dev_get_drvdata(devptr)); 359 snd_card_free(dev_get_drvdata(devptr));
360 dev_set_drvdata(devptr, NULL);
361 return 0; 360 return 0;
362} 361}
363 362
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 78bc5744e89a..9942691cc0ca 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -849,7 +849,6 @@ static int snd_interwave_isa_probe(struct device *pdev,
849static int snd_interwave_isa_remove(struct device *devptr, unsigned int dev) 849static int snd_interwave_isa_remove(struct device *devptr, unsigned int dev)
850{ 850{
851 snd_card_free(dev_get_drvdata(devptr)); 851 snd_card_free(dev_get_drvdata(devptr));
852 dev_set_drvdata(devptr, NULL);
853 return 0; 852 return 0;
854} 853}
855 854
diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
index ddabb406b14c..81aeb934261a 100644
--- a/sound/isa/msnd/msnd_pinnacle.c
+++ b/sound/isa/msnd/msnd_pinnacle.c
@@ -1064,7 +1064,6 @@ cfg_error:
1064static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev) 1064static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev)
1065{ 1065{
1066 snd_msnd_unload(dev_get_drvdata(pdev)); 1066 snd_msnd_unload(dev_get_drvdata(pdev));
1067 dev_set_drvdata(pdev, NULL);
1068 return 0; 1067 return 0;
1069} 1068}
1070 1069
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 075777a6cf0b..cc01c419b7e9 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -757,7 +757,6 @@ static int snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
757static void snd_opl3sa2_pnp_remove(struct pnp_dev *pdev) 757static void snd_opl3sa2_pnp_remove(struct pnp_dev *pdev)
758{ 758{
759 snd_card_free(pnp_get_drvdata(pdev)); 759 snd_card_free(pnp_get_drvdata(pdev));
760 pnp_set_drvdata(pdev, NULL);
761} 760}
762 761
763#ifdef CONFIG_PM 762#ifdef CONFIG_PM
@@ -900,7 +899,6 @@ static int snd_opl3sa2_isa_remove(struct device *devptr,
900 unsigned int dev) 899 unsigned int dev)
901{ 900{
902 snd_card_free(dev_get_drvdata(devptr)); 901 snd_card_free(dev_get_drvdata(devptr));
903 dev_set_drvdata(devptr, NULL);
904 return 0; 902 return 0;
905} 903}
906 904
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index c3da1df9371d..619753d96ca5 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -1495,7 +1495,6 @@ static int snd_miro_isa_remove(struct device *devptr,
1495 unsigned int dev) 1495 unsigned int dev)
1496{ 1496{
1497 snd_card_free(dev_get_drvdata(devptr)); 1497 snd_card_free(dev_get_drvdata(devptr));
1498 dev_set_drvdata(devptr, NULL);
1499 return 0; 1498 return 0;
1500} 1499}
1501 1500
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index b41ed8661b23..103b33373fd4 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -1035,7 +1035,6 @@ static int snd_opti9xx_isa_remove(struct device *devptr,
1035 unsigned int dev) 1035 unsigned int dev)
1036{ 1036{
1037 snd_card_free(dev_get_drvdata(devptr)); 1037 snd_card_free(dev_get_drvdata(devptr));
1038 dev_set_drvdata(devptr, NULL);
1039 return 0; 1038 return 0;
1040} 1039}
1041 1040
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c
index 4961da4e627c..356a6308392f 100644
--- a/sound/isa/sb/jazz16.c
+++ b/sound/isa/sb/jazz16.c
@@ -345,7 +345,6 @@ static int snd_jazz16_remove(struct device *devptr, unsigned int dev)
345{ 345{
346 struct snd_card *card = dev_get_drvdata(devptr); 346 struct snd_card *card = dev_get_drvdata(devptr);
347 347
348 dev_set_drvdata(devptr, NULL);
349 snd_card_free(card); 348 snd_card_free(card);
350 return 0; 349 return 0;
351} 350}
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 50dbec454f98..a4130993955f 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -566,7 +566,6 @@ static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev)
566static int snd_sb16_isa_remove(struct device *pdev, unsigned int dev) 566static int snd_sb16_isa_remove(struct device *pdev, unsigned int dev)
567{ 567{
568 snd_card_free(dev_get_drvdata(pdev)); 568 snd_card_free(dev_get_drvdata(pdev));
569 dev_set_drvdata(pdev, NULL);
570 return 0; 569 return 0;
571} 570}
572 571
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index 237d964ff8a6..a806ae90a944 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -208,7 +208,6 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
208static int snd_sb8_remove(struct device *pdev, unsigned int dev) 208static int snd_sb8_remove(struct device *pdev, unsigned int dev)
209{ 209{
210 snd_card_free(dev_get_drvdata(pdev)); 210 snd_card_free(dev_get_drvdata(pdev));
211 dev_set_drvdata(pdev, NULL);
212 return 0; 211 return 0;
213} 212}
214 213
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 5376ebff845e..09d481b3ba7f 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -698,7 +698,6 @@ static int snd_sc6000_remove(struct device *devptr, unsigned int dev)
698 release_region(port[dev], 0x10); 698 release_region(port[dev], 0x10);
699 release_region(mss_port[dev], 4); 699 release_region(mss_port[dev], 4);
700 700
701 dev_set_drvdata(devptr, NULL);
702 snd_card_free(card); 701 snd_card_free(card);
703 return 0; 702 return 0;
704} 703}
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 42a009720b29..57b338973ede 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1200,7 +1200,6 @@ _release_card:
1200static int snd_sscape_remove(struct device *devptr, unsigned int dev) 1200static int snd_sscape_remove(struct device *devptr, unsigned int dev)
1201{ 1201{
1202 snd_card_free(dev_get_drvdata(devptr)); 1202 snd_card_free(dev_get_drvdata(devptr));
1203 dev_set_drvdata(devptr, NULL);
1204 return 0; 1203 return 0;
1205} 1204}
1206 1205
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index fe5dd982bd23..82dd76939fa0 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -581,7 +581,6 @@ static int snd_wavefront_isa_remove(struct device *devptr,
581 unsigned int dev) 581 unsigned int dev)
582{ 582{
583 snd_card_free(dev_get_drvdata(devptr)); 583 snd_card_free(dev_get_drvdata(devptr));
584 dev_set_drvdata(devptr, NULL);
585 return 0; 584 return 0;
586} 585}
587 586
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c
index 2a44cc106459..12be1fb512dd 100644
--- a/sound/oss/kahlua.c
+++ b/sound/oss/kahlua.c
@@ -178,7 +178,6 @@ static int probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
178 return 0; 178 return 0;
179 179
180err_out_free: 180err_out_free:
181 pci_set_drvdata(pdev, NULL);
182 kfree(hw_config); 181 kfree(hw_config);
183 return 1; 182 return 1;
184} 183}
@@ -187,7 +186,6 @@ static void remove_one(struct pci_dev *pdev)
187{ 186{
188 struct address_info *hw_config = pci_get_drvdata(pdev); 187 struct address_info *hw_config = pci_get_drvdata(pdev);
189 sb_dsp_unload(hw_config, 0); 188 sb_dsp_unload(hw_config, 0);
190 pci_set_drvdata(pdev, NULL);
191 kfree(hw_config); 189 kfree(hw_config);
192} 190}
193 191
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index 0e66ba48d453..67f56a2cee6a 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -902,8 +902,6 @@ snd_harmony_free(struct snd_harmony *h)
902 if (h->iobase) 902 if (h->iobase)
903 iounmap(h->iobase); 903 iounmap(h->iobase);
904 904
905 parisc_set_drvdata(h->dev, NULL);
906
907 kfree(h); 905 kfree(h);
908 return 0; 906 return 0;
909} 907}
@@ -1016,7 +1014,6 @@ static int
1016snd_harmony_remove(struct parisc_device *padev) 1014snd_harmony_remove(struct parisc_device *padev)
1017{ 1015{
1018 snd_card_free(parisc_get_drvdata(padev)); 1016 snd_card_free(parisc_get_drvdata(padev));
1019 parisc_set_drvdata(padev, NULL);
1020 return 0; 1017 return 0;
1021} 1018}
1022 1019
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index ad8a31173939..d2b9d617aee5 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -1046,7 +1046,6 @@ static void
1046snd_ad1889_remove(struct pci_dev *pci) 1046snd_ad1889_remove(struct pci_dev *pci)
1047{ 1047{
1048 snd_card_free(pci_get_drvdata(pci)); 1048 snd_card_free(pci_get_drvdata(pci));
1049 pci_set_drvdata(pci, NULL);
1050} 1049}
1051 1050
1052static DEFINE_PCI_DEVICE_TABLE(snd_ad1889_ids) = { 1051static DEFINE_PCI_DEVICE_TABLE(snd_ad1889_ids) = {
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 53754f5edeb1..3dfa12b670eb 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2298,7 +2298,6 @@ static int snd_ali_probe(struct pci_dev *pci,
2298static void snd_ali_remove(struct pci_dev *pci) 2298static void snd_ali_remove(struct pci_dev *pci)
2299{ 2299{
2300 snd_card_free(pci_get_drvdata(pci)); 2300 snd_card_free(pci_get_drvdata(pci));
2301 pci_set_drvdata(pci, NULL);
2302} 2301}
2303 2302
2304static struct pci_driver ali5451_driver = { 2303static struct pci_driver ali5451_driver = {
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 864c4310366b..591efb6eef05 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -282,7 +282,6 @@ static void snd_als300_remove(struct pci_dev *pci)
282{ 282{
283 snd_als300_dbgcallenter(); 283 snd_als300_dbgcallenter();
284 snd_card_free(pci_get_drvdata(pci)); 284 snd_card_free(pci_get_drvdata(pci));
285 pci_set_drvdata(pci, NULL);
286 snd_als300_dbgcallleave(); 285 snd_als300_dbgcallleave();
287} 286}
288 287
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 61efda2a4d94..ffc821b0139e 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -984,7 +984,6 @@ out:
984static void snd_card_als4000_remove(struct pci_dev *pci) 984static void snd_card_als4000_remove(struct pci_dev *pci)
985{ 985{
986 snd_card_free(pci_get_drvdata(pci)); 986 snd_card_free(pci_get_drvdata(pci));
987 pci_set_drvdata(pci, NULL);
988} 987}
989 988
990#ifdef CONFIG_PM_SLEEP 989#ifdef CONFIG_PM_SLEEP
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index ef5019fe5193..7f0272032fbb 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -445,7 +445,6 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev)
445 if (pa->p_buffer) 445 if (pa->p_buffer)
446 vfree(pa->p_buffer); 446 vfree(pa->p_buffer);
447 447
448 pci_set_drvdata(pci_dev, NULL);
449 if (1) 448 if (1)
450 dev_info(&pci_dev->dev, 449 dev_info(&pci_dev->dev,
451 "remove %04x:%04x,%04x:%04x,%04x, HPI index %d\n", 450 "remove %04x:%04x,%04x:%04x,%04x, HPI index %d\n",
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 6e78c6789858..fe4c61bdb8ba 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1714,7 +1714,6 @@ static int snd_atiixp_probe(struct pci_dev *pci,
1714static void snd_atiixp_remove(struct pci_dev *pci) 1714static void snd_atiixp_remove(struct pci_dev *pci)
1715{ 1715{
1716 snd_card_free(pci_get_drvdata(pci)); 1716 snd_card_free(pci_get_drvdata(pci));
1717 pci_set_drvdata(pci, NULL);
1718} 1717}
1719 1718
1720static struct pci_driver atiixp_driver = { 1719static struct pci_driver atiixp_driver = {
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index d0bec7ba3b0d..cf29b9a1d65d 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1334,7 +1334,6 @@ static int snd_atiixp_probe(struct pci_dev *pci,
1334static void snd_atiixp_remove(struct pci_dev *pci) 1334static void snd_atiixp_remove(struct pci_dev *pci)
1335{ 1335{
1336 snd_card_free(pci_get_drvdata(pci)); 1336 snd_card_free(pci_get_drvdata(pci));
1337 pci_set_drvdata(pci, NULL);
1338} 1337}
1339 1338
1340static struct pci_driver atiixp_modem_driver = { 1339static struct pci_driver atiixp_modem_driver = {
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index b157e1fadd8f..7059dd69e5e6 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -371,7 +371,6 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
371static void snd_vortex_remove(struct pci_dev *pci) 371static void snd_vortex_remove(struct pci_dev *pci)
372{ 372{
373 snd_card_free(pci_get_drvdata(pci)); 373 snd_card_free(pci_get_drvdata(pci));
374 pci_set_drvdata(pci, NULL);
375} 374}
376 375
377// pci_driver definition 376// pci_driver definition
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 08e9a4702cbc..2925220d3fcf 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -392,7 +392,6 @@ static int snd_aw2_probe(struct pci_dev *pci,
392static void snd_aw2_remove(struct pci_dev *pci) 392static void snd_aw2_remove(struct pci_dev *pci)
393{ 393{
394 snd_card_free(pci_get_drvdata(pci)); 394 snd_card_free(pci_get_drvdata(pci));
395 pci_set_drvdata(pci, NULL);
396} 395}
397 396
398/* open callback */ 397/* open callback */
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 1204a0fa3368..c8e121611593 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2725,7 +2725,6 @@ snd_azf3328_remove(struct pci_dev *pci)
2725{ 2725{
2726 snd_azf3328_dbgcallenter(); 2726 snd_azf3328_dbgcallenter();
2727 snd_card_free(pci_get_drvdata(pci)); 2727 snd_card_free(pci_get_drvdata(pci));
2728 pci_set_drvdata(pci, NULL);
2729 snd_azf3328_dbgcallleave(); 2728 snd_azf3328_dbgcallleave();
2730} 2729}
2731 2730
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 9febe5509748..18802039497a 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -953,7 +953,6 @@ _error:
953static void snd_bt87x_remove(struct pci_dev *pci) 953static void snd_bt87x_remove(struct pci_dev *pci)
954{ 954{
955 snd_card_free(pci_get_drvdata(pci)); 955 snd_card_free(pci_get_drvdata(pci));
956 pci_set_drvdata(pci, NULL);
957} 956}
958 957
959/* default entries for all Bt87x cards - it's not exported */ 958/* default entries for all Bt87x cards - it's not exported */
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 1610a5705970..f4db5587e86e 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1896,7 +1896,6 @@ static int snd_ca0106_probe(struct pci_dev *pci,
1896static void snd_ca0106_remove(struct pci_dev *pci) 1896static void snd_ca0106_remove(struct pci_dev *pci)
1897{ 1897{
1898 snd_card_free(pci_get_drvdata(pci)); 1898 snd_card_free(pci_get_drvdata(pci));
1899 pci_set_drvdata(pci, NULL);
1900} 1899}
1901 1900
1902#ifdef CONFIG_PM_SLEEP 1901#ifdef CONFIG_PM_SLEEP
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index c617435db6e6..2755ec5bcc25 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3317,7 +3317,6 @@ static int snd_cmipci_probe(struct pci_dev *pci,
3317static void snd_cmipci_remove(struct pci_dev *pci) 3317static void snd_cmipci_remove(struct pci_dev *pci)
3318{ 3318{
3319 snd_card_free(pci_get_drvdata(pci)); 3319 snd_card_free(pci_get_drvdata(pci));
3320 pci_set_drvdata(pci, NULL);
3321} 3320}
3322 3321
3323 3322
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 6a8695069941..64659facd155 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1971,7 +1971,6 @@ static int snd_cs4281_probe(struct pci_dev *pci,
1971static void snd_cs4281_remove(struct pci_dev *pci) 1971static void snd_cs4281_remove(struct pci_dev *pci)
1972{ 1972{
1973 snd_card_free(pci_get_drvdata(pci)); 1973 snd_card_free(pci_get_drvdata(pci));
1974 pci_set_drvdata(pci, NULL);
1975} 1974}
1976 1975
1977/* 1976/*
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index 6b0d8b50a305..b03498325d66 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -158,7 +158,6 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci,
158static void snd_card_cs46xx_remove(struct pci_dev *pci) 158static void snd_card_cs46xx_remove(struct pci_dev *pci)
159{ 159{
160 snd_card_free(pci_get_drvdata(pci)); 160 snd_card_free(pci_get_drvdata(pci));
161 pci_set_drvdata(pci, NULL);
162} 161}
163 162
164static struct pci_driver cs46xx_driver = { 163static struct pci_driver cs46xx_driver = {
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index dace827b45d1..c6b82c85e044 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -91,7 +91,6 @@ static int snd_cs5530_dev_free(struct snd_device *device)
91static void snd_cs5530_remove(struct pci_dev *pci) 91static void snd_cs5530_remove(struct pci_dev *pci)
92{ 92{
93 snd_card_free(pci_get_drvdata(pci)); 93 snd_card_free(pci_get_drvdata(pci));
94 pci_set_drvdata(pci, NULL);
95} 94}
96 95
97static u8 snd_cs5530_mixer_read(unsigned long io, u8 reg) 96static u8 snd_cs5530_mixer_read(unsigned long io, u8 reg)
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 7e4b13e2d12a..902bebd3b3fb 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -391,7 +391,6 @@ static void snd_cs5535audio_remove(struct pci_dev *pci)
391{ 391{
392 olpc_quirks_cleanup(); 392 olpc_quirks_cleanup();
393 snd_card_free(pci_get_drvdata(pci)); 393 snd_card_free(pci_get_drvdata(pci));
394 pci_set_drvdata(pci, NULL);
395} 394}
396 395
397static struct pci_driver cs5535audio_driver = { 396static struct pci_driver cs5535audio_driver = {
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c
index d01ffcb2b2f5..d464ad2fc7b7 100644
--- a/sound/pci/ctxfi/xfi.c
+++ b/sound/pci/ctxfi/xfi.c
@@ -122,7 +122,6 @@ error:
122static void ct_card_remove(struct pci_dev *pci) 122static void ct_card_remove(struct pci_dev *pci)
123{ 123{
124 snd_card_free(pci_get_drvdata(pci)); 124 snd_card_free(pci_get_drvdata(pci));
125 pci_set_drvdata(pci, NULL);
126} 125}
127 126
128#ifdef CONFIG_PM_SLEEP 127#ifdef CONFIG_PM_SLEEP
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 760cbff53210..05cfe551ce42 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2323,7 +2323,6 @@ static void snd_echo_remove(struct pci_dev *pci)
2323 chip = pci_get_drvdata(pci); 2323 chip = pci_get_drvdata(pci);
2324 if (chip) 2324 if (chip)
2325 snd_card_free(chip->card); 2325 snd_card_free(chip->card);
2326 pci_set_drvdata(pci, NULL);
2327} 2326}
2328 2327
2329 2328
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 8c5010f7889c..9e1bd0c39a8c 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -202,7 +202,6 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
202static void snd_card_emu10k1_remove(struct pci_dev *pci) 202static void snd_card_emu10k1_remove(struct pci_dev *pci)
203{ 203{
204 snd_card_free(pci_get_drvdata(pci)); 204 snd_card_free(pci_get_drvdata(pci));
205 pci_set_drvdata(pci, NULL);
206} 205}
207 206
208 207
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index cdff11d48ebd..56ad9d6f200d 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -1623,7 +1623,6 @@ static int snd_emu10k1x_probe(struct pci_dev *pci,
1623static void snd_emu10k1x_remove(struct pci_dev *pci) 1623static void snd_emu10k1x_remove(struct pci_dev *pci)
1624{ 1624{
1625 snd_card_free(pci_get_drvdata(pci)); 1625 snd_card_free(pci_get_drvdata(pci));
1626 pci_set_drvdata(pci, NULL);
1627} 1626}
1628 1627
1629// PCI IDs 1628// PCI IDs
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index db2dc835171d..372f8ea91fca 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2497,7 +2497,6 @@ static int snd_audiopci_probe(struct pci_dev *pci,
2497static void snd_audiopci_remove(struct pci_dev *pci) 2497static void snd_audiopci_remove(struct pci_dev *pci)
2498{ 2498{
2499 snd_card_free(pci_get_drvdata(pci)); 2499 snd_card_free(pci_get_drvdata(pci));
2500 pci_set_drvdata(pci, NULL);
2501} 2500}
2502 2501
2503static struct pci_driver ens137x_driver = { 2502static struct pci_driver ens137x_driver = {
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 8423403954ab..9213fb38921c 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1881,7 +1881,6 @@ static int snd_es1938_probe(struct pci_dev *pci,
1881static void snd_es1938_remove(struct pci_dev *pci) 1881static void snd_es1938_remove(struct pci_dev *pci)
1882{ 1882{
1883 snd_card_free(pci_get_drvdata(pci)); 1883 snd_card_free(pci_get_drvdata(pci));
1884 pci_set_drvdata(pci, NULL);
1885} 1884}
1886 1885
1887static struct pci_driver es1938_driver = { 1886static struct pci_driver es1938_driver = {
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index a1f32b5ae0d1..5e2ec9687731 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -564,6 +564,7 @@ struct es1968 {
564#ifdef CONFIG_SND_ES1968_RADIO 564#ifdef CONFIG_SND_ES1968_RADIO
565 struct v4l2_device v4l2_dev; 565 struct v4l2_device v4l2_dev;
566 struct snd_tea575x tea; 566 struct snd_tea575x tea;
567 unsigned int tea575x_tuner;
567#endif 568#endif
568}; 569};
569 570
@@ -2557,37 +2558,47 @@ static int snd_es1968_input_register(struct es1968 *chip)
2557 bits 1=unmask write to given bit */ 2558 bits 1=unmask write to given bit */
2558#define IO_DIR 8 /* direction register offset from GPIO_DATA 2559#define IO_DIR 8 /* direction register offset from GPIO_DATA
2559 bits 0/1=read/write direction */ 2560 bits 0/1=read/write direction */
2560/* mask bits for GPIO lines */ 2561
2561#define STR_DATA 0x0040 /* GPIO6 */ 2562/* GPIO to TEA575x maps */
2562#define STR_CLK 0x0080 /* GPIO7 */ 2563struct snd_es1968_tea575x_gpio {
2563#define STR_WREN 0x0100 /* GPIO8 */ 2564 u8 data, clk, wren, most;
2564#define STR_MOST 0x0200 /* GPIO9 */ 2565 char *name;
2566};
2567
2568static struct snd_es1968_tea575x_gpio snd_es1968_tea575x_gpios[] = {
2569 { .data = 6, .clk = 7, .wren = 8, .most = 9, .name = "SF64-PCE2" },
2570 { .data = 7, .clk = 8, .wren = 6, .most = 10, .name = "M56VAP" },
2571};
2572
2573#define get_tea575x_gpio(chip) \
2574 (&snd_es1968_tea575x_gpios[(chip)->tea575x_tuner])
2575
2565 2576
2566static void snd_es1968_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) 2577static void snd_es1968_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
2567{ 2578{
2568 struct es1968 *chip = tea->private_data; 2579 struct es1968 *chip = tea->private_data;
2569 unsigned long io = chip->io_port + GPIO_DATA; 2580 struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip);
2570 u16 val = 0; 2581 u16 val = 0;
2571 2582
2572 val |= (pins & TEA575X_DATA) ? STR_DATA : 0; 2583 val |= (pins & TEA575X_DATA) ? (1 << gpio.data) : 0;
2573 val |= (pins & TEA575X_CLK) ? STR_CLK : 0; 2584 val |= (pins & TEA575X_CLK) ? (1 << gpio.clk) : 0;
2574 val |= (pins & TEA575X_WREN) ? STR_WREN : 0; 2585 val |= (pins & TEA575X_WREN) ? (1 << gpio.wren) : 0;
2575 2586
2576 outw(val, io); 2587 outw(val, chip->io_port + GPIO_DATA);
2577} 2588}
2578 2589
2579static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea) 2590static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea)
2580{ 2591{
2581 struct es1968 *chip = tea->private_data; 2592 struct es1968 *chip = tea->private_data;
2582 unsigned long io = chip->io_port + GPIO_DATA; 2593 struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip);
2583 u16 val = inw(io); 2594 u16 val = inw(chip->io_port + GPIO_DATA);
2584 u8 ret; 2595 u8 ret = 0;
2585 2596
2586 ret = 0; 2597 if (val & (1 << gpio.data))
2587 if (val & STR_DATA)
2588 ret |= TEA575X_DATA; 2598 ret |= TEA575X_DATA;
2589 if (val & STR_MOST) 2599 if (val & (1 << gpio.most))
2590 ret |= TEA575X_MOST; 2600 ret |= TEA575X_MOST;
2601
2591 return ret; 2602 return ret;
2592} 2603}
2593 2604
@@ -2596,13 +2607,18 @@ static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool outpu
2596 struct es1968 *chip = tea->private_data; 2607 struct es1968 *chip = tea->private_data;
2597 unsigned long io = chip->io_port + GPIO_DATA; 2608 unsigned long io = chip->io_port + GPIO_DATA;
2598 u16 odir = inw(io + IO_DIR); 2609 u16 odir = inw(io + IO_DIR);
2610 struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip);
2599 2611
2600 if (output) { 2612 if (output) {
2601 outw(~(STR_DATA | STR_CLK | STR_WREN), io + IO_MASK); 2613 outw(~((1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren)),
2602 outw(odir | STR_DATA | STR_CLK | STR_WREN, io + IO_DIR); 2614 io + IO_MASK);
2615 outw(odir | (1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren),
2616 io + IO_DIR);
2603 } else { 2617 } else {
2604 outw(~(STR_CLK | STR_WREN | STR_DATA | STR_MOST), io + IO_MASK); 2618 outw(~((1 << gpio.clk) | (1 << gpio.wren) | (1 << gpio.data) | (1 << gpio.most)),
2605 outw((odir & ~(STR_DATA | STR_MOST)) | STR_CLK | STR_WREN, io + IO_DIR); 2619 io + IO_MASK);
2620 outw((odir & ~((1 << gpio.data) | (1 << gpio.most)))
2621 | (1 << gpio.clk) | (1 << gpio.wren), io + IO_DIR);
2606 } 2622 }
2607} 2623}
2608 2624
@@ -2772,6 +2788,9 @@ static int snd_es1968_create(struct snd_card *card,
2772 snd_card_set_dev(card, &pci->dev); 2788 snd_card_set_dev(card, &pci->dev);
2773 2789
2774#ifdef CONFIG_SND_ES1968_RADIO 2790#ifdef CONFIG_SND_ES1968_RADIO
2791 /* don't play with GPIOs on laptops */
2792 if (chip->pci->subsystem_vendor != 0x125d)
2793 goto no_radio;
2775 err = v4l2_device_register(&pci->dev, &chip->v4l2_dev); 2794 err = v4l2_device_register(&pci->dev, &chip->v4l2_dev);
2776 if (err < 0) { 2795 if (err < 0) {
2777 snd_es1968_free(chip); 2796 snd_es1968_free(chip);
@@ -2781,10 +2800,18 @@ static int snd_es1968_create(struct snd_card *card,
2781 chip->tea.private_data = chip; 2800 chip->tea.private_data = chip;
2782 chip->tea.radio_nr = radio_nr; 2801 chip->tea.radio_nr = radio_nr;
2783 chip->tea.ops = &snd_es1968_tea_ops; 2802 chip->tea.ops = &snd_es1968_tea_ops;
2784 strlcpy(chip->tea.card, "SF64-PCE2", sizeof(chip->tea.card));
2785 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); 2803 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
2786 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) 2804 for (i = 0; i < ARRAY_SIZE(snd_es1968_tea575x_gpios); i++) {
2787 printk(KERN_INFO "es1968: detected TEA575x radio\n"); 2805 chip->tea575x_tuner = i;
2806 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) {
2807 snd_printk(KERN_INFO "es1968: detected TEA575x radio type %s\n",
2808 get_tea575x_gpio(chip)->name);
2809 strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name,
2810 sizeof(chip->tea.card));
2811 break;
2812 }
2813 }
2814no_radio:
2788#endif 2815#endif
2789 2816
2790 *chip_ret = chip; 2817 *chip_ret = chip;
@@ -2909,7 +2936,6 @@ static int snd_es1968_probe(struct pci_dev *pci,
2909static void snd_es1968_remove(struct pci_dev *pci) 2936static void snd_es1968_remove(struct pci_dev *pci)
2910{ 2937{
2911 snd_card_free(pci_get_drvdata(pci)); 2938 snd_card_free(pci_get_drvdata(pci));
2912 pci_set_drvdata(pci, NULL);
2913} 2939}
2914 2940
2915static struct pci_driver es1968_driver = { 2941static struct pci_driver es1968_driver = {
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 4f07fda5adf2..706c5b67b708 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1370,7 +1370,6 @@ static int snd_card_fm801_probe(struct pci_dev *pci,
1370static void snd_card_fm801_remove(struct pci_dev *pci) 1370static void snd_card_fm801_remove(struct pci_dev *pci)
1371{ 1371{
1372 snd_card_free(pci_get_drvdata(pci)); 1372 snd_card_free(pci_get_drvdata(pci));
1373 pci_set_drvdata(pci, NULL);
1374} 1373}
1375 1374
1376#ifdef CONFIG_PM_SLEEP 1375#ifdef CONFIG_PM_SLEEP
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 80a7d44bcf81..0c5371abecd2 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -140,7 +140,6 @@ config SND_HDA_CODEC_VIA
140 140
141config SND_HDA_CODEC_HDMI 141config SND_HDA_CODEC_HDMI
142 bool "Build HDMI/DisplayPort HD-audio codec support" 142 bool "Build HDMI/DisplayPort HD-audio codec support"
143 select SND_DYNAMIC_MINORS
144 default y 143 default y
145 help 144 help
146 Say Y here to include HDMI and DisplayPort HD-audio codec 145 Say Y here to include HDMI and DisplayPort HD-audio codec
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 55108b5fb291..35090b3acbac 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -185,20 +185,19 @@ EXPORT_SYMBOL_HDA(snd_hda_get_jack_type);
185 * Compose a 32bit command word to be sent to the HD-audio controller 185 * Compose a 32bit command word to be sent to the HD-audio controller
186 */ 186 */
187static inline unsigned int 187static inline unsigned int
188make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, 188make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int flags,
189 unsigned int verb, unsigned int parm) 189 unsigned int verb, unsigned int parm)
190{ 190{
191 u32 val; 191 u32 val;
192 192
193 if ((codec->addr & ~0xf) || (direct & ~1) || (nid & ~0x7f) || 193 if ((codec->addr & ~0xf) || (nid & ~0x7f) ||
194 (verb & ~0xfff) || (parm & ~0xffff)) { 194 (verb & ~0xfff) || (parm & ~0xffff)) {
195 printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x:%x\n", 195 printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x\n",
196 codec->addr, direct, nid, verb, parm); 196 codec->addr, nid, verb, parm);
197 return ~0; 197 return ~0;
198 } 198 }
199 199
200 val = (u32)codec->addr << 28; 200 val = (u32)codec->addr << 28;
201 val |= (u32)direct << 27;
202 val |= (u32)nid << 20; 201 val |= (u32)nid << 20;
203 val |= verb << 8; 202 val |= verb << 8;
204 val |= parm; 203 val |= parm;
@@ -209,7 +208,7 @@ make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct,
209 * Send and receive a verb 208 * Send and receive a verb
210 */ 209 */
211static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, 210static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
212 unsigned int *res) 211 int flags, unsigned int *res)
213{ 212{
214 struct hda_bus *bus = codec->bus; 213 struct hda_bus *bus = codec->bus;
215 int err; 214 int err;
@@ -222,6 +221,8 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
222 again: 221 again:
223 snd_hda_power_up(codec); 222 snd_hda_power_up(codec);
224 mutex_lock(&bus->cmd_mutex); 223 mutex_lock(&bus->cmd_mutex);
224 if (flags & HDA_RW_NO_RESPONSE_FALLBACK)
225 bus->no_response_fallback = 1;
225 for (;;) { 226 for (;;) {
226 trace_hda_send_cmd(codec, cmd); 227 trace_hda_send_cmd(codec, cmd);
227 err = bus->ops.command(bus, cmd); 228 err = bus->ops.command(bus, cmd);
@@ -234,6 +235,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
234 *res = bus->ops.get_response(bus, codec->addr); 235 *res = bus->ops.get_response(bus, codec->addr);
235 trace_hda_get_response(codec, *res); 236 trace_hda_get_response(codec, *res);
236 } 237 }
238 bus->no_response_fallback = 0;
237 mutex_unlock(&bus->cmd_mutex); 239 mutex_unlock(&bus->cmd_mutex);
238 snd_hda_power_down(codec); 240 snd_hda_power_down(codec);
239 if (!codec_in_pm(codec) && res && *res == -1 && bus->rirb_error) { 241 if (!codec_in_pm(codec) && res && *res == -1 && bus->rirb_error) {
@@ -255,7 +257,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
255 * snd_hda_codec_read - send a command and get the response 257 * snd_hda_codec_read - send a command and get the response
256 * @codec: the HDA codec 258 * @codec: the HDA codec
257 * @nid: NID to send the command 259 * @nid: NID to send the command
258 * @direct: direct flag 260 * @flags: optional bit flags
259 * @verb: the verb to send 261 * @verb: the verb to send
260 * @parm: the parameter for the verb 262 * @parm: the parameter for the verb
261 * 263 *
@@ -264,12 +266,12 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
264 * Returns the obtained response value, or -1 for an error. 266 * Returns the obtained response value, or -1 for an error.
265 */ 267 */
266unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, 268unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
267 int direct, 269 int flags,
268 unsigned int verb, unsigned int parm) 270 unsigned int verb, unsigned int parm)
269{ 271{
270 unsigned cmd = make_codec_cmd(codec, nid, direct, verb, parm); 272 unsigned cmd = make_codec_cmd(codec, nid, flags, verb, parm);
271 unsigned int res; 273 unsigned int res;
272 if (codec_exec_verb(codec, cmd, &res)) 274 if (codec_exec_verb(codec, cmd, flags, &res))
273 return -1; 275 return -1;
274 return res; 276 return res;
275} 277}
@@ -279,7 +281,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_read);
279 * snd_hda_codec_write - send a single command without waiting for response 281 * snd_hda_codec_write - send a single command without waiting for response
280 * @codec: the HDA codec 282 * @codec: the HDA codec
281 * @nid: NID to send the command 283 * @nid: NID to send the command
282 * @direct: direct flag 284 * @flags: optional bit flags
283 * @verb: the verb to send 285 * @verb: the verb to send
284 * @parm: the parameter for the verb 286 * @parm: the parameter for the verb
285 * 287 *
@@ -287,12 +289,12 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_read);
287 * 289 *
288 * Returns 0 if successful, or a negative error code. 290 * Returns 0 if successful, or a negative error code.
289 */ 291 */
290int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct, 292int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
291 unsigned int verb, unsigned int parm) 293 unsigned int verb, unsigned int parm)
292{ 294{
293 unsigned int cmd = make_codec_cmd(codec, nid, direct, verb, parm); 295 unsigned int cmd = make_codec_cmd(codec, nid, flags, verb, parm);
294 unsigned int res; 296 unsigned int res;
295 return codec_exec_verb(codec, cmd, 297 return codec_exec_verb(codec, cmd, flags,
296 codec->bus->sync_write ? &res : NULL); 298 codec->bus->sync_write ? &res : NULL);
297} 299}
298EXPORT_SYMBOL_HDA(snd_hda_codec_write); 300EXPORT_SYMBOL_HDA(snd_hda_codec_write);
@@ -3582,7 +3584,7 @@ EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);
3582 * snd_hda_codec_write_cache - send a single command with caching 3584 * snd_hda_codec_write_cache - send a single command with caching
3583 * @codec: the HDA codec 3585 * @codec: the HDA codec
3584 * @nid: NID to send the command 3586 * @nid: NID to send the command
3585 * @direct: direct flag 3587 * @flags: optional bit flags
3586 * @verb: the verb to send 3588 * @verb: the verb to send
3587 * @parm: the parameter for the verb 3589 * @parm: the parameter for the verb
3588 * 3590 *
@@ -3591,7 +3593,7 @@ EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);
3591 * Returns 0 if successful, or a negative error code. 3593 * Returns 0 if successful, or a negative error code.
3592 */ 3594 */
3593int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, 3595int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
3594 int direct, unsigned int verb, unsigned int parm) 3596 int flags, unsigned int verb, unsigned int parm)
3595{ 3597{
3596 int err; 3598 int err;
3597 struct hda_cache_head *c; 3599 struct hda_cache_head *c;
@@ -3600,7 +3602,7 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
3600 3602
3601 cache_only = codec->cached_write; 3603 cache_only = codec->cached_write;
3602 if (!cache_only) { 3604 if (!cache_only) {
3603 err = snd_hda_codec_write(codec, nid, direct, verb, parm); 3605 err = snd_hda_codec_write(codec, nid, flags, verb, parm);
3604 if (err < 0) 3606 if (err < 0)
3605 return err; 3607 return err;
3606 } 3608 }
@@ -3624,7 +3626,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache);
3624 * snd_hda_codec_update_cache - check cache and write the cmd only when needed 3626 * snd_hda_codec_update_cache - check cache and write the cmd only when needed
3625 * @codec: the HDA codec 3627 * @codec: the HDA codec
3626 * @nid: NID to send the command 3628 * @nid: NID to send the command
3627 * @direct: direct flag 3629 * @flags: optional bit flags
3628 * @verb: the verb to send 3630 * @verb: the verb to send
3629 * @parm: the parameter for the verb 3631 * @parm: the parameter for the verb
3630 * 3632 *
@@ -3635,7 +3637,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache);
3635 * Returns 0 if successful, or a negative error code. 3637 * Returns 0 if successful, or a negative error code.
3636 */ 3638 */
3637int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, 3639int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid,
3638 int direct, unsigned int verb, unsigned int parm) 3640 int flags, unsigned int verb, unsigned int parm)
3639{ 3641{
3640 struct hda_cache_head *c; 3642 struct hda_cache_head *c;
3641 u32 key; 3643 u32 key;
@@ -3651,7 +3653,7 @@ int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid,
3651 return 0; 3653 return 0;
3652 } 3654 }
3653 mutex_unlock(&codec->bus->cmd_mutex); 3655 mutex_unlock(&codec->bus->cmd_mutex);
3654 return snd_hda_codec_write_cache(codec, nid, direct, verb, parm); 3656 return snd_hda_codec_write_cache(codec, nid, flags, verb, parm);
3655} 3657}
3656EXPORT_SYMBOL_HDA(snd_hda_codec_update_cache); 3658EXPORT_SYMBOL_HDA(snd_hda_codec_update_cache);
3657 3659
@@ -3806,11 +3808,13 @@ static unsigned int hda_set_power_state(struct hda_codec *codec,
3806 hda_nid_t fg = codec->afg ? codec->afg : codec->mfg; 3808 hda_nid_t fg = codec->afg ? codec->afg : codec->mfg;
3807 int count; 3809 int count;
3808 unsigned int state; 3810 unsigned int state;
3811 int flags = 0;
3809 3812
3810 /* this delay seems necessary to avoid click noise at power-down */ 3813 /* this delay seems necessary to avoid click noise at power-down */
3811 if (power_state == AC_PWRST_D3) { 3814 if (power_state == AC_PWRST_D3) {
3812 /* transition time less than 10ms for power down */ 3815 /* transition time less than 10ms for power down */
3813 msleep(codec->epss ? 10 : 100); 3816 msleep(codec->epss ? 10 : 100);
3817 flags = HDA_RW_NO_RESPONSE_FALLBACK;
3814 } 3818 }
3815 3819
3816 /* repeat power states setting at most 10 times*/ 3820 /* repeat power states setting at most 10 times*/
@@ -3819,7 +3823,7 @@ static unsigned int hda_set_power_state(struct hda_codec *codec,
3819 codec->patch_ops.set_power_state(codec, fg, 3823 codec->patch_ops.set_power_state(codec, fg,
3820 power_state); 3824 power_state);
3821 else { 3825 else {
3822 snd_hda_codec_read(codec, fg, 0, 3826 snd_hda_codec_read(codec, fg, flags,
3823 AC_VERB_SET_POWER_STATE, 3827 AC_VERB_SET_POWER_STATE,
3824 power_state); 3828 power_state);
3825 snd_hda_codec_set_power_to_all(codec, fg, power_state); 3829 snd_hda_codec_set_power_to_all(codec, fg, power_state);
@@ -4461,12 +4465,13 @@ const char *snd_hda_pcm_type_name[HDA_PCM_NTYPES] = {
4461 4465
4462/* 4466/*
4463 * get the empty PCM device number to assign 4467 * get the empty PCM device number to assign
4464 *
4465 * note the max device number is limited by HDA_MAX_PCMS, currently 10
4466 */ 4468 */
4467static int get_empty_pcm_device(struct hda_bus *bus, int type) 4469static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type)
4468{ 4470{
4469 /* audio device indices; not linear to keep compatibility */ 4471 /* audio device indices; not linear to keep compatibility */
4472 /* assigned to static slots up to dev#10; if more needed, assign
4473 * the later slot dynamically (when CONFIG_SND_DYNAMIC_MINORS=y)
4474 */
4470 static int audio_idx[HDA_PCM_NTYPES][5] = { 4475 static int audio_idx[HDA_PCM_NTYPES][5] = {
4471 [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 }, 4476 [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 },
4472 [HDA_PCM_TYPE_SPDIF] = { 1, -1 }, 4477 [HDA_PCM_TYPE_SPDIF] = { 1, -1 },
@@ -4480,18 +4485,28 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
4480 return -EINVAL; 4485 return -EINVAL;
4481 } 4486 }
4482 4487
4483 for (i = 0; audio_idx[type][i] >= 0 ; i++) 4488 for (i = 0; audio_idx[type][i] >= 0; i++) {
4489#ifndef CONFIG_SND_DYNAMIC_MINORS
4490 if (audio_idx[type][i] >= 8)
4491 break;
4492#endif
4484 if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) 4493 if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits))
4485 return audio_idx[type][i]; 4494 return audio_idx[type][i];
4495 }
4486 4496
4497#ifdef CONFIG_SND_DYNAMIC_MINORS
4487 /* non-fixed slots starting from 10 */ 4498 /* non-fixed slots starting from 10 */
4488 for (i = 10; i < 32; i++) { 4499 for (i = 10; i < 32; i++) {
4489 if (!test_and_set_bit(i, bus->pcm_dev_bits)) 4500 if (!test_and_set_bit(i, bus->pcm_dev_bits))
4490 return i; 4501 return i;
4491 } 4502 }
4503#endif
4492 4504
4493 snd_printk(KERN_WARNING "Too many %s devices\n", 4505 snd_printk(KERN_WARNING "Too many %s devices\n",
4494 snd_hda_pcm_type_name[type]); 4506 snd_hda_pcm_type_name[type]);
4507#ifndef CONFIG_SND_DYNAMIC_MINORS
4508 snd_printk(KERN_WARNING "Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y\n");
4509#endif
4495 return -EAGAIN; 4510 return -EAGAIN;
4496} 4511}
4497 4512
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index c93f9021f452..701c2e069b10 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -679,6 +679,7 @@ struct hda_bus {
679 unsigned int response_reset:1; /* controller was reset */ 679 unsigned int response_reset:1; /* controller was reset */
680 unsigned int in_reset:1; /* during reset operation */ 680 unsigned int in_reset:1; /* during reset operation */
681 unsigned int power_keep_link_on:1; /* don't power off HDA link */ 681 unsigned int power_keep_link_on:1; /* don't power off HDA link */
682 unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
682 683
683 int primary_dig_out_type; /* primary digital out PCM type */ 684 int primary_dig_out_type; /* primary digital out PCM type */
684}; 685};
@@ -930,6 +931,8 @@ enum {
930 HDA_INPUT, HDA_OUTPUT 931 HDA_INPUT, HDA_OUTPUT
931}; 932};
932 933
934/* snd_hda_codec_read/write optional flags */
935#define HDA_RW_NO_RESPONSE_FALLBACK (1 << 0)
933 936
934/* 937/*
935 * constructors 938 * constructors
@@ -945,9 +948,9 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec);
945 * low level functions 948 * low level functions
946 */ 949 */
947unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, 950unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
948 int direct, 951 int flags,
949 unsigned int verb, unsigned int parm); 952 unsigned int verb, unsigned int parm);
950int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct, 953int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
951 unsigned int verb, unsigned int parm); 954 unsigned int verb, unsigned int parm);
952#define snd_hda_param_read(codec, nid, param) \ 955#define snd_hda_param_read(codec, nid, param) \
953 snd_hda_codec_read(codec, nid, 0, AC_VERB_PARAMETERS, param) 956 snd_hda_codec_read(codec, nid, 0, AC_VERB_PARAMETERS, param)
@@ -986,11 +989,11 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex);
986 989
987/* cached write */ 990/* cached write */
988int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, 991int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
989 int direct, unsigned int verb, unsigned int parm); 992 int flags, unsigned int verb, unsigned int parm);
990void snd_hda_sequence_write_cache(struct hda_codec *codec, 993void snd_hda_sequence_write_cache(struct hda_codec *codec,
991 const struct hda_verb *seq); 994 const struct hda_verb *seq);
992int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, 995int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid,
993 int direct, unsigned int verb, unsigned int parm); 996 int flags, unsigned int verb, unsigned int parm);
994void snd_hda_codec_resume_cache(struct hda_codec *codec); 997void snd_hda_codec_resume_cache(struct hda_codec *codec);
995/* both for cmd & amp caches */ 998/* both for cmd & amp caches */
996void snd_hda_codec_flush_cache(struct hda_codec *codec); 999void snd_hda_codec_flush_cache(struct hda_codec *codec);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index de18722c4873..f089fa0aa03d 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -942,6 +942,9 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
942 } 942 }
943 } 943 }
944 944
945 if (!bus->no_response_fallback)
946 return -1;
947
945 if (!chip->polling_mode && chip->poll_count < 2) { 948 if (!chip->polling_mode && chip->poll_count < 2) {
946 snd_printdd(SFX "%s: azx_get_response timeout, " 949 snd_printdd(SFX "%s: azx_get_response timeout, "
947 "polling the codec once: last cmd=0x%08x\n", 950 "polling the codec once: last cmd=0x%08x\n",
@@ -3764,7 +3767,6 @@ static int azx_probe(struct pci_dev *pci,
3764 3767
3765out_free: 3768out_free:
3766 snd_card_free(card); 3769 snd_card_free(card);
3767 pci_set_drvdata(pci, NULL);
3768 return err; 3770 return err;
3769} 3771}
3770 3772
@@ -3834,7 +3836,6 @@ static void azx_remove(struct pci_dev *pci)
3834 3836
3835 if (card) 3837 if (card)
3836 snd_card_free(card); 3838 snd_card_free(card);
3837 pci_set_drvdata(pci, NULL);
3838} 3839}
3839 3840
3840/* PCI IDs */ 3841/* PCI IDs */
@@ -3878,6 +3879,9 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3878 /* Oaktrail */ 3879 /* Oaktrail */
3879 { PCI_DEVICE(0x8086, 0x080a), 3880 { PCI_DEVICE(0x8086, 0x080a),
3880 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, 3881 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3882 /* BayTrail */
3883 { PCI_DEVICE(0x8086, 0x0f04),
3884 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3881 /* ICH */ 3885 /* ICH */
3882 { PCI_DEVICE(0x8086, 0x2668), 3886 { PCI_DEVICE(0x8086, 0x2668),
3883 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | 3887 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index e0bf7534fa1f..2e7493ef8ee0 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -562,6 +562,14 @@ static inline unsigned int get_wcaps_channels(u32 wcaps)
562 return chans; 562 return chans;
563} 563}
564 564
565static inline void snd_hda_override_wcaps(struct hda_codec *codec,
566 hda_nid_t nid, u32 val)
567{
568 if (nid >= codec->start_nid &&
569 nid < codec->start_nid + codec->num_nodes)
570 codec->wcaps[nid - codec->start_nid] = val;
571}
572
565u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); 573u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
566int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 574int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
567 unsigned int caps); 575 unsigned int caps);
@@ -667,7 +675,7 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,
667 if (state & AC_PWRST_ERROR) 675 if (state & AC_PWRST_ERROR)
668 return true; 676 return true;
669 state = (state >> 4) & 0x0f; 677 state = (state >> 4) & 0x0f;
670 return (state != target_state); 678 return (state == target_state);
671} 679}
672 680
673unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec, 681unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index bd8d46cca2b3..cccaf9c7a7bb 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -58,6 +58,7 @@ enum {
58 CS420X_GPIO_23, 58 CS420X_GPIO_23,
59 CS420X_MBP101, 59 CS420X_MBP101,
60 CS420X_MBP81, 60 CS420X_MBP81,
61 CS420X_MBA42,
61 CS420X_AUTO, 62 CS420X_AUTO,
62 /* aliases */ 63 /* aliases */
63 CS420X_IMAC27_122 = CS420X_GPIO_23, 64 CS420X_IMAC27_122 = CS420X_GPIO_23,
@@ -346,6 +347,7 @@ static const struct hda_model_fixup cs420x_models[] = {
346 { .id = CS420X_APPLE, .name = "apple" }, 347 { .id = CS420X_APPLE, .name = "apple" },
347 { .id = CS420X_MBP101, .name = "mbp101" }, 348 { .id = CS420X_MBP101, .name = "mbp101" },
348 { .id = CS420X_MBP81, .name = "mbp81" }, 349 { .id = CS420X_MBP81, .name = "mbp81" },
350 { .id = CS420X_MBA42, .name = "mba42" },
349 {} 351 {}
350}; 352};
351 353
@@ -361,6 +363,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = {
361 SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), 363 SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81),
362 SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), 364 SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
363 SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), 365 SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
366 SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42),
364 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), 367 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
365 {} /* terminator */ 368 {} /* terminator */
366}; 369};
@@ -414,6 +417,20 @@ static const struct hda_pintbl mbp101_pincfgs[] = {
414 {} /* terminator */ 417 {} /* terminator */
415}; 418};
416 419
420static const struct hda_pintbl mba42_pincfgs[] = {
421 { 0x09, 0x012b4030 }, /* HP */
422 { 0x0a, 0x400000f0 },
423 { 0x0b, 0x90100120 }, /* speaker */
424 { 0x0c, 0x400000f0 },
425 { 0x0d, 0x90a00110 }, /* mic */
426 { 0x0e, 0x400000f0 },
427 { 0x0f, 0x400000f0 },
428 { 0x10, 0x400000f0 },
429 { 0x12, 0x400000f0 },
430 { 0x15, 0x400000f0 },
431 {} /* terminator */
432};
433
417static void cs420x_fixup_gpio_13(struct hda_codec *codec, 434static void cs420x_fixup_gpio_13(struct hda_codec *codec,
418 const struct hda_fixup *fix, int action) 435 const struct hda_fixup *fix, int action)
419{ 436{
@@ -482,6 +499,12 @@ static const struct hda_fixup cs420x_fixups[] = {
482 .chained = true, 499 .chained = true,
483 .chain_id = CS420X_GPIO_13, 500 .chain_id = CS420X_GPIO_13,
484 }, 501 },
502 [CS420X_MBA42] = {
503 .type = HDA_FIXUP_PINS,
504 .v.pins = mba42_pincfgs,
505 .chained = true,
506 .chain_id = CS420X_GPIO_13,
507 },
485}; 508};
486 509
487static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid) 510static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b314d3e6d7fa..de00ce166470 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -2947,7 +2947,6 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
2947 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), 2947 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD),
2948 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), 2948 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
2949 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), 2949 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
2950 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD),
2951 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo U350", CXT5066_ASUS), 2950 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo U350", CXT5066_ASUS),
2952 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), 2951 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS),
2953 {} 2952 {}
@@ -3318,6 +3317,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
3318 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), 3317 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
3319 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 3318 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
3320 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), 3319 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410),
3320 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
3321 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 3321 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
3322 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 3322 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
3323 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 3323 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index e12f7a030c58..49ef8f8eb5e9 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1018,13 +1018,18 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res)
1018 hdmi_non_intrinsic_event(codec, res); 1018 hdmi_non_intrinsic_event(codec, res);
1019} 1019}
1020 1020
1021static void haswell_verify_pin_D0(struct hda_codec *codec, hda_nid_t nid) 1021static void haswell_verify_pin_D0(struct hda_codec *codec,
1022 hda_nid_t cvt_nid, hda_nid_t nid)
1022{ 1023{
1023 int pwr, lamp, ramp; 1024 int pwr, lamp, ramp;
1024 1025
1025 pwr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); 1026 /* For Haswell, the converter 1/2 may keep in D3 state after bootup,
1026 pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT; 1027 * thus pins could only choose converter 0 for use. Make sure the
1027 if (pwr != AC_PWRST_D0) { 1028 * converters are in correct power state */
1029 if (!snd_hda_check_power_state(codec, cvt_nid, AC_PWRST_D0))
1030 snd_hda_codec_write(codec, cvt_nid, 0, AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
1031
1032 if (!snd_hda_check_power_state(codec, nid, AC_PWRST_D0)) {
1028 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, 1033 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE,
1029 AC_PWRST_D0); 1034 AC_PWRST_D0);
1030 msleep(40); 1035 msleep(40);
@@ -1068,7 +1073,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
1068 int new_pinctl = 0; 1073 int new_pinctl = 0;
1069 1074
1070 if (codec->vendor_id == 0x80862807) 1075 if (codec->vendor_id == 0x80862807)
1071 haswell_verify_pin_D0(codec, pin_nid); 1076 haswell_verify_pin_D0(codec, cvt_nid, pin_nid);
1072 1077
1073 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { 1078 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
1074 pinctl = snd_hda_codec_read(codec, pin_nid, 0, 1079 pinctl = snd_hda_codec_read(codec, pin_nid, 0,
@@ -1101,26 +1106,15 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
1101 return 0; 1106 return 0;
1102} 1107}
1103 1108
1104/* 1109static int hdmi_choose_cvt(struct hda_codec *codec,
1105 * HDA PCM callbacks 1110 int pin_idx, int *cvt_id, int *mux_id)
1106 */
1107static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1108 struct hda_codec *codec,
1109 struct snd_pcm_substream *substream)
1110{ 1111{
1111 struct hdmi_spec *spec = codec->spec; 1112 struct hdmi_spec *spec = codec->spec;
1112 struct snd_pcm_runtime *runtime = substream->runtime;
1113 int pin_idx, cvt_idx, mux_idx = 0;
1114 struct hdmi_spec_per_pin *per_pin; 1113 struct hdmi_spec_per_pin *per_pin;
1115 struct hdmi_eld *eld;
1116 struct hdmi_spec_per_cvt *per_cvt = NULL; 1114 struct hdmi_spec_per_cvt *per_cvt = NULL;
1115 int cvt_idx, mux_idx = 0;
1117 1116
1118 /* Validate hinfo */
1119 pin_idx = hinfo_to_pin_index(spec, hinfo);
1120 if (snd_BUG_ON(pin_idx < 0))
1121 return -EINVAL;
1122 per_pin = get_pin(spec, pin_idx); 1117 per_pin = get_pin(spec, pin_idx);
1123 eld = &per_pin->sink_eld;
1124 1118
1125 /* Dynamically assign converter to stream */ 1119 /* Dynamically assign converter to stream */
1126 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { 1120 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
@@ -1138,17 +1132,89 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1138 continue; 1132 continue;
1139 break; 1133 break;
1140 } 1134 }
1135
1141 /* No free converters */ 1136 /* No free converters */
1142 if (cvt_idx == spec->num_cvts) 1137 if (cvt_idx == spec->num_cvts)
1143 return -ENODEV; 1138 return -ENODEV;
1144 1139
1140 if (cvt_id)
1141 *cvt_id = cvt_idx;
1142 if (mux_id)
1143 *mux_id = mux_idx;
1144
1145 return 0;
1146}
1147
1148static void haswell_config_cvts(struct hda_codec *codec,
1149 int pin_id, int mux_id)
1150{
1151 struct hdmi_spec *spec = codec->spec;
1152 struct hdmi_spec_per_pin *per_pin;
1153 int pin_idx, mux_idx;
1154 int curr;
1155 int err;
1156
1157 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
1158 per_pin = get_pin(spec, pin_idx);
1159
1160 if (pin_idx == pin_id)
1161 continue;
1162
1163 curr = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
1164 AC_VERB_GET_CONNECT_SEL, 0);
1165
1166 /* Choose another unused converter */
1167 if (curr == mux_id) {
1168 err = hdmi_choose_cvt(codec, pin_idx, NULL, &mux_idx);
1169 if (err < 0)
1170 return;
1171 snd_printdd("HDMI: choose converter %d for pin %d\n", mux_idx, pin_idx);
1172 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
1173 AC_VERB_SET_CONNECT_SEL,
1174 mux_idx);
1175 }
1176 }
1177}
1178
1179/*
1180 * HDA PCM callbacks
1181 */
1182static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1183 struct hda_codec *codec,
1184 struct snd_pcm_substream *substream)
1185{
1186 struct hdmi_spec *spec = codec->spec;
1187 struct snd_pcm_runtime *runtime = substream->runtime;
1188 int pin_idx, cvt_idx, mux_idx = 0;
1189 struct hdmi_spec_per_pin *per_pin;
1190 struct hdmi_eld *eld;
1191 struct hdmi_spec_per_cvt *per_cvt = NULL;
1192 int err;
1193
1194 /* Validate hinfo */
1195 pin_idx = hinfo_to_pin_index(spec, hinfo);
1196 if (snd_BUG_ON(pin_idx < 0))
1197 return -EINVAL;
1198 per_pin = get_pin(spec, pin_idx);
1199 eld = &per_pin->sink_eld;
1200
1201 err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, &mux_idx);
1202 if (err < 0)
1203 return err;
1204
1205 per_cvt = get_cvt(spec, cvt_idx);
1145 /* Claim converter */ 1206 /* Claim converter */
1146 per_cvt->assigned = 1; 1207 per_cvt->assigned = 1;
1147 hinfo->nid = per_cvt->cvt_nid; 1208 hinfo->nid = per_cvt->cvt_nid;
1148 1209
1149 snd_hda_codec_write(codec, per_pin->pin_nid, 0, 1210 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
1150 AC_VERB_SET_CONNECT_SEL, 1211 AC_VERB_SET_CONNECT_SEL,
1151 mux_idx); 1212 mux_idx);
1213
1214 /* configure unused pins to choose other converters */
1215 if (codec->vendor_id == 0x80862807)
1216 haswell_config_cvts(codec, pin_idx, mux_idx);
1217
1152 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); 1218 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
1153 1219
1154 /* Initially set the converter's capabilities */ 1220 /* Initially set the converter's capabilities */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 02e22b4458d2..ad087ea32f3a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3225,6 +3225,7 @@ enum {
3225 ALC271_FIXUP_HP_GATE_MIC_JACK, 3225 ALC271_FIXUP_HP_GATE_MIC_JACK,
3226 ALC269_FIXUP_ACER_AC700, 3226 ALC269_FIXUP_ACER_AC700,
3227 ALC269_FIXUP_LIMIT_INT_MIC_BOOST, 3227 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
3228 ALC269VB_FIXUP_ORDISSIMO_EVE2,
3228}; 3229};
3229 3230
3230static const struct hda_fixup alc269_fixups[] = { 3231static const struct hda_fixup alc269_fixups[] = {
@@ -3467,6 +3468,15 @@ static const struct hda_fixup alc269_fixups[] = {
3467 .type = HDA_FIXUP_FUNC, 3468 .type = HDA_FIXUP_FUNC,
3468 .v.func = alc269_fixup_limit_int_mic_boost, 3469 .v.func = alc269_fixup_limit_int_mic_boost,
3469 }, 3470 },
3471 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
3472 .type = HDA_FIXUP_PINS,
3473 .v.pins = (const struct hda_pintbl[]) {
3474 { 0x12, 0x99a3092f }, /* int-mic */
3475 { 0x18, 0x03a11d20 }, /* mic */
3476 { 0x19, 0x411111f0 }, /* Unused bogus pin */
3477 { }
3478 },
3479 },
3470}; 3480};
3471 3481
3472static const struct snd_pci_quirk alc269_fixup_tbl[] = { 3482static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -3483,6 +3493,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3483 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 3493 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
3484 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 3494 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
3485 SND_PCI_QUIRK(0x1028, 0x05de, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 3495 SND_PCI_QUIRK(0x1028, 0x05de, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
3496 SND_PCI_QUIRK(0x1028, 0x05e0, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
3486 SND_PCI_QUIRK(0x1028, 0x05e9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3497 SND_PCI_QUIRK(0x1028, 0x05e9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3487 SND_PCI_QUIRK(0x1028, 0x05ea, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3498 SND_PCI_QUIRK(0x1028, 0x05ea, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3488 SND_PCI_QUIRK(0x1028, 0x05eb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3499 SND_PCI_QUIRK(0x1028, 0x05eb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -3494,6 +3505,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3494 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3505 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3495 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3506 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3496 SND_PCI_QUIRK(0x1028, 0x05f8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3507 SND_PCI_QUIRK(0x1028, 0x05f8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3508 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3509 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3497 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3510 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3498 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 3511 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
3499 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), 3512 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
@@ -3536,6 +3549,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3536 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), 3549 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
3537 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), 3550 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
3538 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 3551 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
3552 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
3539 3553
3540#if 0 3554#if 0
3541 /* Below is a quirk table taken from the old code. 3555 /* Below is a quirk table taken from the old code.
@@ -3596,6 +3610,8 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
3596 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"}, 3610 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
3597 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, 3611 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
3598 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, 3612 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
3613 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
3614 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
3599 {} 3615 {}
3600}; 3616};
3601 3617
@@ -4275,6 +4291,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = {
4275 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"}, 4291 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
4276 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"}, 4292 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
4277 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"}, 4293 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
4294 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
4278 {} 4295 {}
4279}; 4296};
4280 4297
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 1d9d6427e0bf..9b6cb270dbe5 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2233,6 +2233,10 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
2233 "HP Folio", STAC_92HD83XXX_HP_MIC_LED), 2233 "HP Folio", STAC_92HD83XXX_HP_MIC_LED),
2234 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900, 2234 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
2235 "HP", STAC_92HD83XXX_HP_MIC_LED), 2235 "HP", STAC_92HD83XXX_HP_MIC_LED),
2236 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000,
2237 "HP", STAC_92HD83XXX_HP_MIC_LED),
2238 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2100,
2239 "HP", STAC_92HD83XXX_HP_MIC_LED),
2236 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388, 2240 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
2237 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 2241 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2238 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389, 2242 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index e5245544eb52..dcebf3cb18de 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -480,14 +480,9 @@ static int via_suspend(struct hda_codec *codec)
480 struct via_spec *spec = codec->spec; 480 struct via_spec *spec = codec->spec;
481 vt1708_stop_hp_work(codec); 481 vt1708_stop_hp_work(codec);
482 482
483 if (spec->codec_type == VT1802) { 483 /* Fix pop noise on headphones */
484 /* Fix pop noise on headphones */ 484 if (spec->codec_type == VT1802)
485 int i; 485 snd_hda_shutup_pins(codec);
486 for (i = 0; i < spec->gen.autocfg.hp_outs; i++)
487 snd_hda_codec_write(codec, spec->gen.autocfg.hp_pins[i],
488 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
489 0x00);
490 }
491 486
492 return 0; 487 return 0;
493} 488}
@@ -910,6 +905,8 @@ static const struct hda_verb vt1708S_init_verbs[] = {
910static void override_mic_boost(struct hda_codec *codec, hda_nid_t pin, 905static void override_mic_boost(struct hda_codec *codec, hda_nid_t pin,
911 int offset, int num_steps, int step_size) 906 int offset, int num_steps, int step_size)
912{ 907{
908 snd_hda_override_wcaps(codec, pin,
909 get_wcaps(codec, pin) | AC_WCAP_IN_AMP);
913 snd_hda_override_amp_caps(codec, pin, HDA_INPUT, 910 snd_hda_override_amp_caps(codec, pin, HDA_INPUT,
914 (offset << AC_AMPCAP_OFFSET_SHIFT) | 911 (offset << AC_AMPCAP_OFFSET_SHIFT) |
915 (num_steps << AC_AMPCAP_NUM_STEPS_SHIFT) | 912 (num_steps << AC_AMPCAP_NUM_STEPS_SHIFT) |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 806407a3973e..28ec872e54c0 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2807,7 +2807,6 @@ static void snd_ice1712_remove(struct pci_dev *pci)
2807 if (ice->card_info && ice->card_info->chip_exit) 2807 if (ice->card_info && ice->card_info->chip_exit)
2808 ice->card_info->chip_exit(ice); 2808 ice->card_info->chip_exit(ice);
2809 snd_card_free(card); 2809 snd_card_free(card);
2810 pci_set_drvdata(pci, NULL);
2811} 2810}
2812 2811
2813static struct pci_driver ice1712_driver = { 2812static struct pci_driver ice1712_driver = {
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index ce70e7f113e0..500471778291 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2800,7 +2800,6 @@ static void snd_vt1724_remove(struct pci_dev *pci)
2800 if (ice->card_info && ice->card_info->chip_exit) 2800 if (ice->card_info && ice->card_info->chip_exit)
2801 ice->card_info->chip_exit(ice); 2801 ice->card_info->chip_exit(ice);
2802 snd_card_free(card); 2802 snd_card_free(card);
2803 pci_set_drvdata(pci, NULL);
2804} 2803}
2805 2804
2806#ifdef CONFIG_PM_SLEEP 2805#ifdef CONFIG_PM_SLEEP
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index b8fe40531b9c..59c8aaebb91e 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -3364,7 +3364,6 @@ static int snd_intel8x0_probe(struct pci_dev *pci,
3364static void snd_intel8x0_remove(struct pci_dev *pci) 3364static void snd_intel8x0_remove(struct pci_dev *pci)
3365{ 3365{
3366 snd_card_free(pci_get_drvdata(pci)); 3366 snd_card_free(pci_get_drvdata(pci));
3367 pci_set_drvdata(pci, NULL);
3368} 3367}
3369 3368
3370static struct pci_driver intel8x0_driver = { 3369static struct pci_driver intel8x0_driver = {
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index fea09e8ea608..3573c1193665 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1328,7 +1328,6 @@ static int snd_intel8x0m_probe(struct pci_dev *pci,
1328static void snd_intel8x0m_remove(struct pci_dev *pci) 1328static void snd_intel8x0m_remove(struct pci_dev *pci)
1329{ 1329{
1330 snd_card_free(pci_get_drvdata(pci)); 1330 snd_card_free(pci_get_drvdata(pci));
1331 pci_set_drvdata(pci, NULL);
1332} 1331}
1333 1332
1334static struct pci_driver intel8x0m_driver = { 1333static struct pci_driver intel8x0m_driver = {
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 43b4228d9afe..9cf9829555d4 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2473,7 +2473,6 @@ snd_korg1212_probe(struct pci_dev *pci,
2473static void snd_korg1212_remove(struct pci_dev *pci) 2473static void snd_korg1212_remove(struct pci_dev *pci)
2474{ 2474{
2475 snd_card_free(pci_get_drvdata(pci)); 2475 snd_card_free(pci_get_drvdata(pci));
2476 pci_set_drvdata(pci, NULL);
2477} 2476}
2478 2477
2479static struct pci_driver korg1212_driver = { 2478static struct pci_driver korg1212_driver = {
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index 322b638e8ec4..7307d97186cb 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -759,7 +759,6 @@ out_free:
759static void lola_remove(struct pci_dev *pci) 759static void lola_remove(struct pci_dev *pci)
760{ 760{
761 snd_card_free(pci_get_drvdata(pci)); 761 snd_card_free(pci_get_drvdata(pci));
762 pci_set_drvdata(pci, NULL);
763} 762}
764 763
765/* PCI IDs */ 764/* PCI IDs */
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index 298bc9b72991..3230e57f246c 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -1139,7 +1139,6 @@ out_free:
1139static void snd_lx6464es_remove(struct pci_dev *pci) 1139static void snd_lx6464es_remove(struct pci_dev *pci)
1140{ 1140{
1141 snd_card_free(pci_get_drvdata(pci)); 1141 snd_card_free(pci_get_drvdata(pci));
1142 pci_set_drvdata(pci, NULL);
1143} 1142}
1144 1143
1145 1144
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index c76ac1411210..d5417360f51f 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2775,7 +2775,6 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2775static void snd_m3_remove(struct pci_dev *pci) 2775static void snd_m3_remove(struct pci_dev *pci)
2776{ 2776{
2777 snd_card_free(pci_get_drvdata(pci)); 2777 snd_card_free(pci_get_drvdata(pci));
2778 pci_set_drvdata(pci, NULL);
2779} 2778}
2780 2779
2781static struct pci_driver m3_driver = { 2780static struct pci_driver m3_driver = {
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 934dec98e2ce..1e0f6ee193f0 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1377,7 +1377,6 @@ static int snd_mixart_probe(struct pci_dev *pci,
1377static void snd_mixart_remove(struct pci_dev *pci) 1377static void snd_mixart_remove(struct pci_dev *pci)
1378{ 1378{
1379 snd_mixart_free(pci_get_drvdata(pci)); 1379 snd_mixart_free(pci_get_drvdata(pci));
1380 pci_set_drvdata(pci, NULL);
1381} 1380}
1382 1381
1383static struct pci_driver mixart_driver = { 1382static struct pci_driver mixart_driver = {
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 6febedb05936..fe79fff4c6dc 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1746,7 +1746,6 @@ static int snd_nm256_probe(struct pci_dev *pci,
1746static void snd_nm256_remove(struct pci_dev *pci) 1746static void snd_nm256_remove(struct pci_dev *pci)
1747{ 1747{
1748 snd_card_free(pci_get_drvdata(pci)); 1748 snd_card_free(pci_get_drvdata(pci));
1749 pci_set_drvdata(pci, NULL);
1750} 1749}
1751 1750
1752 1751
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 9562dc63ba60..b0cb48adddc7 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -722,7 +722,6 @@ EXPORT_SYMBOL(oxygen_pci_probe);
722void oxygen_pci_remove(struct pci_dev *pci) 722void oxygen_pci_remove(struct pci_dev *pci)
723{ 723{
724 snd_card_free(pci_get_drvdata(pci)); 724 snd_card_free(pci_get_drvdata(pci));
725 pci_set_drvdata(pci, NULL);
726} 725}
727EXPORT_SYMBOL(oxygen_pci_remove); 726EXPORT_SYMBOL(oxygen_pci_remove);
728 727
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index b97384ad946d..d379b284955b 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1691,7 +1691,6 @@ static int pcxhr_probe(struct pci_dev *pci,
1691static void pcxhr_remove(struct pci_dev *pci) 1691static void pcxhr_remove(struct pci_dev *pci)
1692{ 1692{
1693 pcxhr_free(pci_get_drvdata(pci)); 1693 pcxhr_free(pci_get_drvdata(pci));
1694 pci_set_drvdata(pci, NULL);
1695} 1694}
1696 1695
1697static struct pci_driver pcxhr_driver = { 1696static struct pci_driver pcxhr_driver = {
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 63c1c8041554..56cc891e395e 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -2066,7 +2066,6 @@ static void snd_riptide_joystick_remove(struct pci_dev *pci)
2066 if (gameport) { 2066 if (gameport) {
2067 release_region(gameport->io, 8); 2067 release_region(gameport->io, 8);
2068 gameport_unregister_port(gameport); 2068 gameport_unregister_port(gameport);
2069 pci_set_drvdata(pci, NULL);
2070 } 2069 }
2071} 2070}
2072#endif 2071#endif
@@ -2179,7 +2178,6 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2179static void snd_card_riptide_remove(struct pci_dev *pci) 2178static void snd_card_riptide_remove(struct pci_dev *pci)
2180{ 2179{
2181 snd_card_free(pci_get_drvdata(pci)); 2180 snd_card_free(pci_get_drvdata(pci));
2182 pci_set_drvdata(pci, NULL);
2183} 2181}
2184 2182
2185static struct pci_driver driver = { 2183static struct pci_driver driver = {
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 0ecd4100713e..cc26346ae66b 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1981,7 +1981,6 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
1981static void snd_rme32_remove(struct pci_dev *pci) 1981static void snd_rme32_remove(struct pci_dev *pci)
1982{ 1982{
1983 snd_card_free(pci_get_drvdata(pci)); 1983 snd_card_free(pci_get_drvdata(pci));
1984 pci_set_drvdata(pci, NULL);
1985} 1984}
1986 1985
1987static struct pci_driver rme32_driver = { 1986static struct pci_driver rme32_driver = {
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 5fb88ac82aa9..2a8ad9d1a2ae 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -2390,7 +2390,6 @@ snd_rme96_probe(struct pci_dev *pci,
2390static void snd_rme96_remove(struct pci_dev *pci) 2390static void snd_rme96_remove(struct pci_dev *pci)
2391{ 2391{
2392 snd_card_free(pci_get_drvdata(pci)); 2392 snd_card_free(pci_get_drvdata(pci));
2393 pci_set_drvdata(pci, NULL);
2394} 2393}
2395 2394
2396static struct pci_driver rme96_driver = { 2395static struct pci_driver rme96_driver = {
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 94084cdb130c..4f255dfee450 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -5412,7 +5412,6 @@ static int snd_hdsp_probe(struct pci_dev *pci,
5412static void snd_hdsp_remove(struct pci_dev *pci) 5412static void snd_hdsp_remove(struct pci_dev *pci)
5413{ 5413{
5414 snd_card_free(pci_get_drvdata(pci)); 5414 snd_card_free(pci_get_drvdata(pci));
5415 pci_set_drvdata(pci, NULL);
5416} 5415}
5417 5416
5418static struct pci_driver hdsp_driver = { 5417static struct pci_driver hdsp_driver = {
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 9ea05e956474..bd501931ee23 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -400,8 +400,8 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
400 400
401#define HDSPM_wc_freq0 (1<<5) /* input freq detected via autosync */ 401#define HDSPM_wc_freq0 (1<<5) /* input freq detected via autosync */
402#define HDSPM_wc_freq1 (1<<6) /* 001=32, 010==44.1, 011=48, */ 402#define HDSPM_wc_freq1 (1<<6) /* 001=32, 010==44.1, 011=48, */
403#define HDSPM_wc_freq2 (1<<7) /* 100=64, 101=88.2, 110=96, */ 403#define HDSPM_wc_freq2 (1<<7) /* 100=64, 101=88.2, 110=96, 111=128 */
404/* missing Bit for 111=128, 1000=176.4, 1001=192 */ 404#define HDSPM_wc_freq3 0x800 /* 1000=176.4, 1001=192 */
405 405
406#define HDSPM_SyncRef0 0x10000 /* Sync Reference */ 406#define HDSPM_SyncRef0 0x10000 /* Sync Reference */
407#define HDSPM_SyncRef1 0x20000 407#define HDSPM_SyncRef1 0x20000
@@ -412,13 +412,17 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
412 412
413#define HDSPM_wc_valid (HDSPM_wcLock|HDSPM_wcSync) 413#define HDSPM_wc_valid (HDSPM_wcLock|HDSPM_wcSync)
414 414
415#define HDSPM_wcFreqMask (HDSPM_wc_freq0|HDSPM_wc_freq1|HDSPM_wc_freq2) 415#define HDSPM_wcFreqMask (HDSPM_wc_freq0|HDSPM_wc_freq1|HDSPM_wc_freq2|\
416 HDSPM_wc_freq3)
416#define HDSPM_wcFreq32 (HDSPM_wc_freq0) 417#define HDSPM_wcFreq32 (HDSPM_wc_freq0)
417#define HDSPM_wcFreq44_1 (HDSPM_wc_freq1) 418#define HDSPM_wcFreq44_1 (HDSPM_wc_freq1)
418#define HDSPM_wcFreq48 (HDSPM_wc_freq0|HDSPM_wc_freq1) 419#define HDSPM_wcFreq48 (HDSPM_wc_freq0|HDSPM_wc_freq1)
419#define HDSPM_wcFreq64 (HDSPM_wc_freq2) 420#define HDSPM_wcFreq64 (HDSPM_wc_freq2)
420#define HDSPM_wcFreq88_2 (HDSPM_wc_freq0|HDSPM_wc_freq2) 421#define HDSPM_wcFreq88_2 (HDSPM_wc_freq0|HDSPM_wc_freq2)
421#define HDSPM_wcFreq96 (HDSPM_wc_freq1|HDSPM_wc_freq2) 422#define HDSPM_wcFreq96 (HDSPM_wc_freq1|HDSPM_wc_freq2)
423#define HDSPM_wcFreq128 (HDSPM_wc_freq0|HDSPM_wc_freq1|HDSPM_wc_freq2)
424#define HDSPM_wcFreq176_4 (HDSPM_wc_freq3)
425#define HDSPM_wcFreq192 (HDSPM_wc_freq0|HDSPM_wc_freq3)
422 426
423#define HDSPM_status1_F_0 0x0400000 427#define HDSPM_status1_F_0 0x0400000
424#define HDSPM_status1_F_1 0x0800000 428#define HDSPM_status1_F_1 0x0800000
@@ -1087,6 +1091,26 @@ static int hdspm_round_frequency(int rate)
1087 return 48000; 1091 return 48000;
1088} 1092}
1089 1093
1094/* QS and DS rates normally can not be detected
1095 * automatically by the card. Only exception is MADI
1096 * in 96k frame mode.
1097 *
1098 * So if we read SS values (32 .. 48k), check for
1099 * user-provided DS/QS bits in the control register
1100 * and multiply the base frequency accordingly.
1101 */
1102static int hdspm_rate_multiplier(struct hdspm *hdspm, int rate)
1103{
1104 if (rate <= 48000) {
1105 if (hdspm->control_register & HDSPM_QuadSpeed)
1106 return rate * 4;
1107 else if (hdspm->control_register &
1108 HDSPM_DoubleSpeed)
1109 return rate * 2;
1110 };
1111 return rate;
1112}
1113
1090static int hdspm_tco_sync_check(struct hdspm *hdspm); 1114static int hdspm_tco_sync_check(struct hdspm *hdspm);
1091static int hdspm_sync_in_sync_check(struct hdspm *hdspm); 1115static int hdspm_sync_in_sync_check(struct hdspm *hdspm);
1092 1116
@@ -1181,6 +1205,15 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm)
1181 case HDSPM_wcFreq96: 1205 case HDSPM_wcFreq96:
1182 rate = 96000; 1206 rate = 96000;
1183 break; 1207 break;
1208 case HDSPM_wcFreq128:
1209 rate = 128000;
1210 break;
1211 case HDSPM_wcFreq176_4:
1212 rate = 176400;
1213 break;
1214 case HDSPM_wcFreq192:
1215 rate = 192000;
1216 break;
1184 default: 1217 default:
1185 rate = 0; 1218 rate = 0;
1186 break; 1219 break;
@@ -1192,7 +1225,7 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm)
1192 */ 1225 */
1193 if (rate != 0 && 1226 if (rate != 0 &&
1194 (status2 & HDSPM_SelSyncRefMask) == HDSPM_SelSyncRef_WORD) 1227 (status2 & HDSPM_SelSyncRefMask) == HDSPM_SelSyncRef_WORD)
1195 return rate; 1228 return hdspm_rate_multiplier(hdspm, rate);
1196 1229
1197 /* maybe a madi input (which is taken if sel sync is madi) */ 1230 /* maybe a madi input (which is taken if sel sync is madi) */
1198 if (status & HDSPM_madiLock) { 1231 if (status & HDSPM_madiLock) {
@@ -1255,21 +1288,8 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm)
1255 } 1288 }
1256 } 1289 }
1257 1290
1258 /* QS and DS rates normally can not be detected 1291 rate = hdspm_rate_multiplier(hdspm, rate);
1259 * automatically by the card. Only exception is MADI 1292
1260 * in 96k frame mode.
1261 *
1262 * So if we read SS values (32 .. 48k), check for
1263 * user-provided DS/QS bits in the control register
1264 * and multiply the base frequency accordingly.
1265 */
1266 if (rate <= 48000) {
1267 if (hdspm->control_register & HDSPM_QuadSpeed)
1268 rate *= 4;
1269 else if (hdspm->control_register &
1270 HDSPM_DoubleSpeed)
1271 rate *= 2;
1272 }
1273 break; 1293 break;
1274 } 1294 }
1275 1295
@@ -6737,7 +6757,6 @@ static int snd_hdspm_probe(struct pci_dev *pci,
6737static void snd_hdspm_remove(struct pci_dev *pci) 6757static void snd_hdspm_remove(struct pci_dev *pci)
6738{ 6758{
6739 snd_card_free(pci_get_drvdata(pci)); 6759 snd_card_free(pci_get_drvdata(pci));
6740 pci_set_drvdata(pci, NULL);
6741} 6760}
6742 6761
6743static struct pci_driver hdspm_driver = { 6762static struct pci_driver hdspm_driver = {
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 773a67fff4cd..b96d9e1adf6d 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -2628,7 +2628,6 @@ static int snd_rme9652_probe(struct pci_dev *pci,
2628static void snd_rme9652_remove(struct pci_dev *pci) 2628static void snd_rme9652_remove(struct pci_dev *pci)
2629{ 2629{
2630 snd_card_free(pci_get_drvdata(pci)); 2630 snd_card_free(pci_get_drvdata(pci));
2631 pci_set_drvdata(pci, NULL);
2632} 2631}
2633 2632
2634static struct pci_driver rme9652_driver = { 2633static struct pci_driver rme9652_driver = {
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 748e82d4d257..e413b4e2c819 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1482,7 +1482,6 @@ error_out:
1482static void snd_sis7019_remove(struct pci_dev *pci) 1482static void snd_sis7019_remove(struct pci_dev *pci)
1483{ 1483{
1484 snd_card_free(pci_get_drvdata(pci)); 1484 snd_card_free(pci_get_drvdata(pci));
1485 pci_set_drvdata(pci, NULL);
1486} 1485}
1487 1486
1488static struct pci_driver sis7019_driver = { 1487static struct pci_driver sis7019_driver = {
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index a2e7686e7ae3..2a46bf98af30 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1528,7 +1528,6 @@ static int snd_sonic_probe(struct pci_dev *pci,
1528static void snd_sonic_remove(struct pci_dev *pci) 1528static void snd_sonic_remove(struct pci_dev *pci)
1529{ 1529{
1530 snd_card_free(pci_get_drvdata(pci)); 1530 snd_card_free(pci_get_drvdata(pci));
1531 pci_set_drvdata(pci, NULL);
1532} 1531}
1533 1532
1534static struct pci_driver sonicvibes_driver = { 1533static struct pci_driver sonicvibes_driver = {
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 1aefd6204a63..b3b588bc94c3 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -169,7 +169,6 @@ static int snd_trident_probe(struct pci_dev *pci,
169static void snd_trident_remove(struct pci_dev *pci) 169static void snd_trident_remove(struct pci_dev *pci)
170{ 170{
171 snd_card_free(pci_get_drvdata(pci)); 171 snd_card_free(pci_get_drvdata(pci));
172 pci_set_drvdata(pci, NULL);
173} 172}
174 173
175static struct pci_driver trident_driver = { 174static struct pci_driver trident_driver = {
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index d756a3562706..3c511d0caf9e 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2646,7 +2646,6 @@ static int snd_via82xx_probe(struct pci_dev *pci,
2646static void snd_via82xx_remove(struct pci_dev *pci) 2646static void snd_via82xx_remove(struct pci_dev *pci)
2647{ 2647{
2648 snd_card_free(pci_get_drvdata(pci)); 2648 snd_card_free(pci_get_drvdata(pci));
2649 pci_set_drvdata(pci, NULL);
2650} 2649}
2651 2650
2652static struct pci_driver via82xx_driver = { 2651static struct pci_driver via82xx_driver = {
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 4f5fd80b7e56..ca190283cbd7 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1227,7 +1227,6 @@ static int snd_via82xx_probe(struct pci_dev *pci,
1227static void snd_via82xx_remove(struct pci_dev *pci) 1227static void snd_via82xx_remove(struct pci_dev *pci)
1228{ 1228{
1229 snd_card_free(pci_get_drvdata(pci)); 1229 snd_card_free(pci_get_drvdata(pci));
1230 pci_set_drvdata(pci, NULL);
1231} 1230}
1232 1231
1233static struct pci_driver via82xx_modem_driver = { 1232static struct pci_driver via82xx_modem_driver = {
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index e2f1ab37e154..ab8a9b1bfb8e 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -254,7 +254,6 @@ static int snd_vx222_probe(struct pci_dev *pci,
254static void snd_vx222_remove(struct pci_dev *pci) 254static void snd_vx222_remove(struct pci_dev *pci)
255{ 255{
256 snd_card_free(pci_get_drvdata(pci)); 256 snd_card_free(pci_get_drvdata(pci));
257 pci_set_drvdata(pci, NULL);
258} 257}
259 258
260#ifdef CONFIG_PM_SLEEP 259#ifdef CONFIG_PM_SLEEP
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 01c49655a3c1..e8932b2e4a5d 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -347,7 +347,6 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
347static void snd_card_ymfpci_remove(struct pci_dev *pci) 347static void snd_card_ymfpci_remove(struct pci_dev *pci)
348{ 348{
349 snd_card_free(pci_get_drvdata(pci)); 349 snd_card_free(pci_get_drvdata(pci));
350 pci_set_drvdata(pci, NULL);
351} 350}
352 351
353static struct pci_driver ymfpci_driver = { 352static struct pci_driver ymfpci_driver = {
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c
index 09fc848d32ec..8abb521b4814 100644
--- a/sound/ppc/powermac.c
+++ b/sound/ppc/powermac.c
@@ -139,7 +139,6 @@ __error:
139static int snd_pmac_remove(struct platform_device *devptr) 139static int snd_pmac_remove(struct platform_device *devptr)
140{ 140{
141 snd_card_free(platform_get_drvdata(devptr)); 141 snd_card_free(platform_get_drvdata(devptr));
142 platform_set_drvdata(devptr, NULL);
143 return 0; 142 return 0;
144} 143}
145 144
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index e59a73a9bc42..78a369785a9e 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -598,7 +598,6 @@ static int snd_aica_remove(struct platform_device *devptr)
598 return -ENODEV; 598 return -ENODEV;
599 snd_card_free(dreamcastcard->card); 599 snd_card_free(dreamcastcard->card);
600 kfree(dreamcastcard); 600 kfree(dreamcastcard);
601 platform_set_drvdata(devptr, NULL);
602 return 0; 601 return 0;
603} 602}
604 603
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index e68c4fc91a03..7c9422c4fc0f 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -290,8 +290,6 @@ static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
290static int snd_sh_dac_remove(struct platform_device *devptr) 290static int snd_sh_dac_remove(struct platform_device *devptr)
291{ 291{
292 snd_card_free(platform_get_drvdata(devptr)); 292 snd_card_free(platform_get_drvdata(devptr));
293 platform_set_drvdata(devptr, NULL);
294
295 return 0; 293 return 0;
296} 294}
297 295
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 75e6016d3efe..eee7afcae375 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2670,8 +2670,6 @@ static int dbri_remove(struct platform_device *op)
2670 snd_dbri_free(card->private_data); 2670 snd_dbri_free(card->private_data);
2671 snd_card_free(card); 2671 snd_card_free(card);
2672 2672
2673 dev_set_drvdata(&op->dev, NULL);
2674
2675 return 0; 2673 return 0;
2676} 2674}
2677 2675
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index a1a24b979ed2..8e3d9a6c7a3b 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -1070,7 +1070,6 @@ out:
1070 1070
1071 ssc_free(chip->ssc); 1071 ssc_free(chip->ssc);
1072 snd_card_free(card); 1072 snd_card_free(card);
1073 dev_set_drvdata(&spi->dev, NULL);
1074 1073
1075 return 0; 1074 return 0;
1076} 1075}
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index 4394ae796356..c39c77978468 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -30,7 +30,7 @@
30MODULE_AUTHOR("Torsten Schenk <torsten.schenk@zoho.com>"); 30MODULE_AUTHOR("Torsten Schenk <torsten.schenk@zoho.com>");
31MODULE_DESCRIPTION("TerraTec DMX 6Fire USB audio driver"); 31MODULE_DESCRIPTION("TerraTec DMX 6Fire USB audio driver");
32MODULE_LICENSE("GPL v2"); 32MODULE_LICENSE("GPL v2");
33MODULE_SUPPORTED_DEVICE("{{TerraTec, DMX 6Fire USB}}"); 33MODULE_SUPPORTED_DEVICE("{{TerraTec,DMX 6Fire USB}}");
34 34
35static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 35static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
36static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ 36static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 40dd50a80f55..c5b9cac37dc4 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -450,13 +450,13 @@ static int usb6fire_pcm_close(struct snd_pcm_substream *alsa_sub)
450static int usb6fire_pcm_hw_params(struct snd_pcm_substream *alsa_sub, 450static int usb6fire_pcm_hw_params(struct snd_pcm_substream *alsa_sub,
451 struct snd_pcm_hw_params *hw_params) 451 struct snd_pcm_hw_params *hw_params)
452{ 452{
453 return snd_pcm_lib_malloc_pages(alsa_sub, 453 return snd_pcm_lib_alloc_vmalloc_buffer(alsa_sub,
454 params_buffer_bytes(hw_params)); 454 params_buffer_bytes(hw_params));
455} 455}
456 456
457static int usb6fire_pcm_hw_free(struct snd_pcm_substream *alsa_sub) 457static int usb6fire_pcm_hw_free(struct snd_pcm_substream *alsa_sub)
458{ 458{
459 return snd_pcm_lib_free_pages(alsa_sub); 459 return snd_pcm_lib_free_vmalloc_buffer(alsa_sub);
460} 460}
461 461
462static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub) 462static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
@@ -560,6 +560,8 @@ static struct snd_pcm_ops pcm_ops = {
560 .prepare = usb6fire_pcm_prepare, 560 .prepare = usb6fire_pcm_prepare,
561 .trigger = usb6fire_pcm_trigger, 561 .trigger = usb6fire_pcm_trigger,
562 .pointer = usb6fire_pcm_pointer, 562 .pointer = usb6fire_pcm_pointer,
563 .page = snd_pcm_lib_get_vmalloc_page,
564 .mmap = snd_pcm_lib_mmap_vmalloc,
563}; 565};
564 566
565static void usb6fire_pcm_init_urb(struct pcm_urb *urb, 567static void usb6fire_pcm_init_urb(struct pcm_urb *urb,
@@ -622,10 +624,6 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
622 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops); 624 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops);
623 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops); 625 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops);
624 626
625 ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
626 SNDRV_DMA_TYPE_CONTINUOUS,
627 snd_dma_continuous_data(GFP_KERNEL),
628 MAX_BUFSIZE, MAX_BUFSIZE);
629 if (ret) { 627 if (ret) {
630 kfree(rt); 628 kfree(rt);
631 snd_printk(KERN_ERR PREFIX 629 snd_printk(KERN_ERR PREFIX
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index c1916184e2e1..7103b0908d13 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -183,14 +183,15 @@ static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream)
183static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub, 183static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub,
184 struct snd_pcm_hw_params *hw_params) 184 struct snd_pcm_hw_params *hw_params)
185{ 185{
186 return snd_pcm_lib_malloc_pages(sub, params_buffer_bytes(hw_params)); 186 return snd_pcm_lib_alloc_vmalloc_buffer(sub,
187 params_buffer_bytes(hw_params));
187} 188}
188 189
189static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) 190static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub)
190{ 191{
191 struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub); 192 struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub);
192 deactivate_substream(cdev, sub); 193 deactivate_substream(cdev, sub);
193 return snd_pcm_lib_free_pages(sub); 194 return snd_pcm_lib_free_vmalloc_buffer(sub);
194} 195}
195 196
196/* this should probably go upstream */ 197/* this should probably go upstream */
@@ -345,7 +346,9 @@ static struct snd_pcm_ops snd_usb_caiaq_ops = {
345 .hw_free = snd_usb_caiaq_pcm_hw_free, 346 .hw_free = snd_usb_caiaq_pcm_hw_free,
346 .prepare = snd_usb_caiaq_pcm_prepare, 347 .prepare = snd_usb_caiaq_pcm_prepare,
347 .trigger = snd_usb_caiaq_pcm_trigger, 348 .trigger = snd_usb_caiaq_pcm_trigger,
348 .pointer = snd_usb_caiaq_pcm_pointer 349 .pointer = snd_usb_caiaq_pcm_pointer,
350 .page = snd_pcm_lib_get_vmalloc_page,
351 .mmap = snd_pcm_lib_mmap_vmalloc,
349}; 352};
350 353
351static void check_for_elapsed_periods(struct snd_usb_caiaqdev *cdev, 354static void check_for_elapsed_periods(struct snd_usb_caiaqdev *cdev,
@@ -852,11 +855,6 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
852 snd_pcm_set_ops(cdev->pcm, SNDRV_PCM_STREAM_CAPTURE, 855 snd_pcm_set_ops(cdev->pcm, SNDRV_PCM_STREAM_CAPTURE,
853 &snd_usb_caiaq_ops); 856 &snd_usb_caiaq_ops);
854 857
855 snd_pcm_lib_preallocate_pages_for_all(cdev->pcm,
856 SNDRV_DMA_TYPE_CONTINUOUS,
857 snd_dma_continuous_data(GFP_KERNEL),
858 MAX_BUFFER_SIZE, MAX_BUFFER_SIZE);
859
860 cdev->data_cb_info = 858 cdev->data_cb_info =
861 kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS, 859 kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS,
862 GFP_KERNEL); 860 GFP_KERNEL);
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 48b63ccc78c7..1a61dd12fe38 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -39,25 +39,24 @@
39MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); 39MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
40MODULE_DESCRIPTION("caiaq USB audio"); 40MODULE_DESCRIPTION("caiaq USB audio");
41MODULE_LICENSE("GPL"); 41MODULE_LICENSE("GPL");
42MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," 42MODULE_SUPPORTED_DEVICE("{{Native Instruments,RigKontrol2},"
43 "{Native Instruments, RigKontrol3}," 43 "{Native Instruments,RigKontrol3},"
44 "{Native Instruments, Kore Controller}," 44 "{Native Instruments,Kore Controller},"
45 "{Native Instruments, Kore Controller 2}," 45 "{Native Instruments,Kore Controller 2},"
46 "{Native Instruments, Audio Kontrol 1}," 46 "{Native Instruments,Audio Kontrol 1},"
47 "{Native Instruments, Audio 2 DJ}," 47 "{Native Instruments,Audio 2 DJ},"
48 "{Native Instruments, Audio 4 DJ}," 48 "{Native Instruments,Audio 4 DJ},"
49 "{Native Instruments, Audio 8 DJ}," 49 "{Native Instruments,Audio 8 DJ},"
50 "{Native Instruments, Traktor Audio 2}," 50 "{Native Instruments,Traktor Audio 2},"
51 "{Native Instruments, Session I/O}," 51 "{Native Instruments,Session I/O},"
52 "{Native Instruments, GuitarRig mobile}," 52 "{Native Instruments,GuitarRig mobile},"
53 "{Native Instruments, Traktor Kontrol X1}," 53 "{Native Instruments,Traktor Kontrol X1},"
54 "{Native Instruments, Traktor Kontrol S4}," 54 "{Native Instruments,Traktor Kontrol S4},"
55 "{Native Instruments, Maschine Controller}}"); 55 "{Native Instruments,Maschine Controller}}");
56 56
57static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 57static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
58static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 58static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
59static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 59static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
60static int snd_card_used[SNDRV_CARDS];
61 60
62module_param_array(index, int, NULL, 0444); 61module_param_array(index, int, NULL, 0444);
63MODULE_PARM_DESC(index, "Index value for the caiaq sound device"); 62MODULE_PARM_DESC(index, "Index value for the caiaq sound device");
@@ -388,7 +387,7 @@ static int create_card(struct usb_device *usb_dev,
388 struct snd_usb_caiaqdev *cdev; 387 struct snd_usb_caiaqdev *cdev;
389 388
390 for (devnum = 0; devnum < SNDRV_CARDS; devnum++) 389 for (devnum = 0; devnum < SNDRV_CARDS; devnum++)
391 if (enable[devnum] && !snd_card_used[devnum]) 390 if (enable[devnum])
392 break; 391 break;
393 392
394 if (devnum >= SNDRV_CARDS) 393 if (devnum >= SNDRV_CARDS)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 1a033177b83f..64952e2d3ed1 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -147,14 +147,32 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
147 return -EINVAL; 147 return -EINVAL;
148 } 148 }
149 149
150 alts = &iface->altsetting[0];
151 altsd = get_iface_desc(alts);
152
153 /*
154 * Android with both accessory and audio interfaces enabled gets the
155 * interface numbers wrong.
156 */
157 if ((chip->usb_id == USB_ID(0x18d1, 0x2d04) ||
158 chip->usb_id == USB_ID(0x18d1, 0x2d05)) &&
159 interface == 0 &&
160 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
161 altsd->bInterfaceSubClass == USB_SUBCLASS_VENDOR_SPEC) {
162 interface = 2;
163 iface = usb_ifnum_to_if(dev, interface);
164 if (!iface)
165 return -EINVAL;
166 alts = &iface->altsetting[0];
167 altsd = get_iface_desc(alts);
168 }
169
150 if (usb_interface_claimed(iface)) { 170 if (usb_interface_claimed(iface)) {
151 snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", 171 snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n",
152 dev->devnum, ctrlif, interface); 172 dev->devnum, ctrlif, interface);
153 return -EINVAL; 173 return -EINVAL;
154 } 174 }
155 175
156 alts = &iface->altsetting[0];
157 altsd = get_iface_desc(alts);
158 if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || 176 if ((altsd->bInterfaceClass == USB_CLASS_AUDIO ||
159 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && 177 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) &&
160 altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) { 178 altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) {
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index 6ad617b94732..8b5d2c564e04 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -1349,7 +1349,7 @@ static void ua101_disconnect(struct usb_interface *interface)
1349 snd_card_disconnect(ua->card); 1349 snd_card_disconnect(ua->card);
1350 1350
1351 /* make sure that there are no pending USB requests */ 1351 /* make sure that there are no pending USB requests */
1352 __list_for_each(midi, &ua->midi_list) 1352 list_for_each(midi, &ua->midi_list)
1353 snd_usbmidi_disconnect(midi); 1353 snd_usbmidi_disconnect(midi);
1354 abort_alsa_playback(ua); 1354 abort_alsa_playback(ua);
1355 abort_alsa_capture(ua); 1355 abort_alsa_capture(ua);
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index e5c7f9f20fdd..d5438083fd6a 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -885,6 +885,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
885 885
886 case USB_ID(0x046d, 0x0808): 886 case USB_ID(0x046d, 0x0808):
887 case USB_ID(0x046d, 0x0809): 887 case USB_ID(0x046d, 0x0809):
888 case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
888 case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ 889 case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */
889 case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ 890 case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */
890 case USB_ID(0x046d, 0x0991): 891 case USB_ID(0x046d, 0x0991):
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index 9af7c1f17413..1f9bbd55553f 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -150,7 +150,7 @@
150MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>"); 150MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>");
151MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7.2"); 151MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7.2");
152MODULE_LICENSE("GPL"); 152MODULE_LICENSE("GPL");
153MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604), "NAME_ALLCAPS"(0x8001)(0x8005)(0x8007) }}"); 153MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604),"NAME_ALLCAPS"(0x8001)(0x8005)(0x8007)}}");
154 154
155static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 155static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
156static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 156static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index b37653247ef4..4967fe9c938d 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -695,9 +695,6 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
695 ((char*)(usbdata + i))[1] = ra[i].c2; 695 ((char*)(usbdata + i))[1] = ra[i].c2;
696 usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4), 696 usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4),
697 usbdata + i, 2, i_usX2Y_04Int, usX2Y); 697 usbdata + i, 2, i_usX2Y_04Int, usX2Y);
698#ifdef OLD_USB
699 us->urb[i]->transfer_flags = USB_QUEUE_BULK;
700#endif
701 } 698 }
702 us->submitted = 0; 699 us->submitted = 0;
703 us->len = NOOF_SETRATE_URBS; 700 us->len = NOOF_SETRATE_URBS;