aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-03-08 03:35:50 -0500
committerTakashi Iwai <tiwai@suse.de>2010-03-08 03:35:50 -0500
commita3087ae970e5c8984fab2306b1f4dbe5ef132ff7 (patch)
tree5d9ecc2dd903ed506c58a31f1076b2df500a6fe0 /sound
parentf0f20a16983f7d3713ab695e19bd15eca4e7533f (diff)
parent2b9ddcb8b2ce6a44f0f969000f16b016caa64294 (diff)
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound')
-rw-r--r--sound/core/timer.c2
-rw-r--r--sound/isa/opti9xx/miro.c2
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c120
-rw-r--r--sound/isa/sb/jazz16.c1
-rw-r--r--sound/oss/coproc.h2
-rw-r--r--sound/oss/v_midi.h5
-rw-r--r--sound/pci/oxygen/xonar_wm87x6.c2
-rw-r--r--sound/pci/riptide/riptide.c6
-rw-r--r--sound/usb/Kconfig6
-rw-r--r--sound/usb/caiaq/midi.h2
-rw-r--r--sound/usb/ua101.c100
-rw-r--r--sound/usb/usbaudio.c57
-rw-r--r--sound/usb/usbaudio.h3
-rw-r--r--sound/usb/usbquirks.h30
14 files changed, 129 insertions, 209 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 8f8b17ac074d..73943651caed 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -393,7 +393,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
393 event == SNDRV_TIMER_EVENT_CONTINUE) 393 event == SNDRV_TIMER_EVENT_CONTINUE)
394 resolution = snd_timer_resolution(ti); 394 resolution = snd_timer_resolution(ti);
395 if (ti->ccallback) 395 if (ti->ccallback)
396 ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); 396 ti->ccallback(ti, event, &tstamp, resolution);
397 if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) 397 if (ti->flags & SNDRV_TIMER_IFLG_SLAVE)
398 return; 398 return;
399 timer = ti->timer; 399 timer = ti->timer;
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index b865e45a8f9b..5913717c1be6 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -1558,7 +1558,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip,
1558 1558
1559 err = pnp_activate_dev(devmc); 1559 err = pnp_activate_dev(devmc);
1560 if (err < 0) { 1560 if (err < 0) {
1561 snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", 1561 snd_printk(KERN_ERR "MC pnp configure failure: %d\n",
1562 err); 1562 err);
1563 return err; 1563 return err;
1564 } 1564 }
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index a4af53b5c1cf..becd90d7536d 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -144,12 +144,8 @@ struct snd_opti9xx {
144 144
145 spinlock_t lock; 145 spinlock_t lock;
146 146
147 long wss_base;
147 int irq; 148 int irq;
148
149#ifdef CONFIG_PNP
150 struct pnp_dev *dev;
151 struct pnp_dev *devmpu;
152#endif /* CONFIG_PNP */
153}; 149};
154 150
155static int snd_opti9xx_pnp_is_probed; 151static int snd_opti9xx_pnp_is_probed;
@@ -159,12 +155,17 @@ static int snd_opti9xx_pnp_is_probed;
159static struct pnp_card_device_id snd_opti9xx_pnpids[] = { 155static struct pnp_card_device_id snd_opti9xx_pnpids[] = {
160#ifndef OPTi93X 156#ifndef OPTi93X
161 /* OPTi 82C924 */ 157 /* OPTi 82C924 */
162 { .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, 158 { .id = "OPT0924",
159 .devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } },
160 .driver_data = 0x0924 },
163 /* OPTi 82C925 */ 161 /* OPTi 82C925 */
164 { .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, 162 { .id = "OPT0925",
163 .devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } },
164 .driver_data = 0x0925 },
165#else 165#else
166 /* OPTi 82C931/3 */ 166 /* OPTi 82C931/3 */
167 { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, 167 { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } },
168 .driver_data = 0x0931 },
168#endif /* OPTi93X */ 169#endif /* OPTi93X */
169 { .id = "" } 170 { .id = "" }
170}; 171};
@@ -207,24 +208,34 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
207 chip->hardware = hardware; 208 chip->hardware = hardware;
208 strcpy(chip->name, snd_opti9xx_names[hardware]); 209 strcpy(chip->name, snd_opti9xx_names[hardware]);
209 210
210 chip->mc_base_size = opti9xx_mc_size[hardware];
211
212 spin_lock_init(&chip->lock); 211 spin_lock_init(&chip->lock);
213 212
214 chip->irq = -1; 213 chip->irq = -1;
215 214
215#ifndef OPTi93X
216#ifdef CONFIG_PNP
217 if (isapnp && chip->mc_base)
218 /* PnP resource gives the least 10 bits */
219 chip->mc_base |= 0xc00;
220#endif /* CONFIG_PNP */
221 else {
222 chip->mc_base = 0xf8c;
223 chip->mc_base_size = opti9xx_mc_size[hardware];
224 }
225#else
226 chip->mc_base_size = opti9xx_mc_size[hardware];
227#endif
228
216 switch (hardware) { 229 switch (hardware) {
217#ifndef OPTi93X 230#ifndef OPTi93X
218 case OPTi9XX_HW_82C928: 231 case OPTi9XX_HW_82C928:
219 case OPTi9XX_HW_82C929: 232 case OPTi9XX_HW_82C929:
220 chip->mc_base = 0xf8c;
221 chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; 233 chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3;
222 chip->pwd_reg = 3; 234 chip->pwd_reg = 3;
223 break; 235 break;
224 236
225 case OPTi9XX_HW_82C924: 237 case OPTi9XX_HW_82C924:
226 case OPTi9XX_HW_82C925: 238 case OPTi9XX_HW_82C925:
227 chip->mc_base = 0xf8c;
228 chip->password = 0xe5; 239 chip->password = 0xe5;
229 chip->pwd_reg = 3; 240 chip->pwd_reg = 3;
230 break; 241 break;
@@ -292,7 +303,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip,
292 spin_unlock_irqrestore(&chip->lock, flags); 303 spin_unlock_irqrestore(&chip->lock, flags);
293 return retval; 304 return retval;
294} 305}
295 306
296static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, 307static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
297 unsigned char value) 308 unsigned char value)
298{ 309{
@@ -341,7 +352,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
341 352
342 353
343static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, 354static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
344 long wss_base, 355 long port,
345 int irq, int dma1, int dma2, 356 int irq, int dma1, int dma2,
346 long mpu_port, int mpu_irq) 357 long mpu_port, int mpu_irq)
347{ 358{
@@ -354,16 +365,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
354 switch (chip->hardware) { 365 switch (chip->hardware) {
355#ifndef OPTi93X 366#ifndef OPTi93X
356 case OPTi9XX_HW_82C924: 367 case OPTi9XX_HW_82C924:
368 /* opti 929 mode (?), OPL3 clock output, audio enable */
357 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); 369 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc);
370 /* enable wave audio */
358 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); 371 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02);
359 372
360 case OPTi9XX_HW_82C925: 373 case OPTi9XX_HW_82C925:
374 /* enable WSS mode */
361 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); 375 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80);
376 /* OPL3 FM synthesis */
362 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); 377 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20);
378 /* disable Sound Blaster IRQ and DMA */
363 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); 379 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
364#ifdef CS4231 380#ifdef CS4231
381 /* cs4231/4248 fix enabled */
365 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); 382 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02);
366#else 383#else
384 /* cs4231/4248 fix disabled */
367 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); 385 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02);
368#endif /* CS4231 */ 386#endif /* CS4231 */
369 break; 387 break;
@@ -411,21 +429,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
411 return -EINVAL; 429 return -EINVAL;
412 } 430 }
413 431
414 switch (wss_base) { 432 /* PnP resource says it decodes only 10 bits of address */
415 case 0x530: 433 switch (port & 0x3ff) {
434 case 0x130:
435 chip->wss_base = 0x530;
416 wss_base_bits = 0x00; 436 wss_base_bits = 0x00;
417 break; 437 break;
418 case 0x604: 438 case 0x204:
439 chip->wss_base = 0x604;
419 wss_base_bits = 0x03; 440 wss_base_bits = 0x03;
420 break; 441 break;
421 case 0xe80: 442 case 0x280:
443 chip->wss_base = 0xe80;
422 wss_base_bits = 0x01; 444 wss_base_bits = 0x01;
423 break; 445 break;
424 case 0xf40: 446 case 0x340:
447 chip->wss_base = 0xf40;
425 wss_base_bits = 0x02; 448 wss_base_bits = 0x02;
426 break; 449 break;
427 default: 450 default:
428 snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); 451 snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port);
429 goto __skip_base; 452 goto __skip_base;
430 } 453 }
431 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); 454 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30);
@@ -487,7 +510,7 @@ __skip_base:
487#endif /* CS4231 || OPTi93X */ 510#endif /* CS4231 || OPTi93X */
488 511
489#ifndef OPTi93X 512#ifndef OPTi93X
490 outb(irq_bits << 3 | dma_bits, wss_base); 513 outb(irq_bits << 3 | dma_bits, chip->wss_base);
491#else /* OPTi93X */ 514#else /* OPTi93X */
492 snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); 515 snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
493#endif /* OPTi93X */ 516#endif /* OPTi93X */
@@ -729,15 +752,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
729{ 752{
730 struct pnp_dev *pdev; 753 struct pnp_dev *pdev;
731 int err; 754 int err;
755 struct pnp_dev *devmpu;
756#ifndef OPTi93X
757 struct pnp_dev *devmc;
758#endif
732 759
733 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 760 pdev = pnp_request_card_device(card, pid->devs[0].id, NULL);
734 if (chip->dev == NULL) 761 if (pdev == NULL)
735 return -EBUSY; 762 return -EBUSY;
736 763
737 chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
738
739 pdev = chip->dev;
740
741 err = pnp_activate_dev(pdev); 764 err = pnp_activate_dev(pdev);
742 if (err < 0) { 765 if (err < 0) {
743 snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); 766 snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err);
@@ -750,9 +773,24 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
750 chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; 773 chip->mc_indir_index = pnp_port_start(pdev, 3) + 2;
751 chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; 774 chip->mc_indir_size = pnp_port_len(pdev, 3) - 2;
752#else 775#else
753 if (pid->driver_data != 0x0924) 776 devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
754 port = pnp_port_start(pdev, 1); 777 if (devmc == NULL)
778 return -EBUSY;
779
780 err = pnp_activate_dev(devmc);
781 if (err < 0) {
782 snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err);
783 return err;
784 }
785
786 port = pnp_port_start(pdev, 1);
755 fm_port = pnp_port_start(pdev, 2) + 8; 787 fm_port = pnp_port_start(pdev, 2) + 8;
788 /*
789 * The MC(0) is never accessed and card does not
790 * include it in the PnP resource range. OPTI93x include it.
791 */
792 chip->mc_base = pnp_port_start(devmc, 0) - 1;
793 chip->mc_base_size = pnp_port_len(devmc, 0) + 1;
756#endif /* OPTi93X */ 794#endif /* OPTi93X */
757 irq = pnp_irq(pdev, 0); 795 irq = pnp_irq(pdev, 0);
758 dma1 = pnp_dma(pdev, 0); 796 dma1 = pnp_dma(pdev, 0);
@@ -760,16 +798,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
760 dma2 = pnp_dma(pdev, 1); 798 dma2 = pnp_dma(pdev, 1);
761#endif /* CS4231 || OPTi93X */ 799#endif /* CS4231 || OPTi93X */
762 800
763 pdev = chip->devmpu; 801 devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
764 if (pdev && mpu_port > 0) { 802
765 err = pnp_activate_dev(pdev); 803 if (devmpu && mpu_port > 0) {
804 err = pnp_activate_dev(devmpu);
766 if (err < 0) { 805 if (err < 0) {
767 snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); 806 snd_printk(KERN_ERR "MPU401 pnp configure failure\n");
768 mpu_port = -1; 807 mpu_port = -1;
769 chip->devmpu = NULL;
770 } else { 808 } else {
771 mpu_port = pnp_port_start(pdev, 0); 809 mpu_port = pnp_port_start(devmpu, 0);
772 mpu_irq = pnp_irq(pdev, 0); 810 mpu_irq = pnp_irq(devmpu, 0);
773 } 811 }
774 } 812 }
775 return pid->driver_data; 813 return pid->driver_data;
@@ -824,7 +862,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
824 if (error) 862 if (error)
825 return error; 863 return error;
826 864
827 error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, 865 error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2,
828#ifdef OPTi93X 866#ifdef OPTi93X
829 WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, 867 WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
830#else 868#else
@@ -865,10 +903,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
865 sprintf(card->shortname, "OPTi %s", card->driver); 903 sprintf(card->shortname, "OPTi %s", card->driver);
866#if defined(CS4231) || defined(OPTi93X) 904#if defined(CS4231) || defined(OPTi93X)
867 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 905 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d",
868 card->shortname, pcm->name, port + 4, irq, dma1, xdma2); 906 card->shortname, pcm->name,
907 chip->wss_base + 4, irq, dma1, xdma2);
869#else 908#else
870 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", 909 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
871 card->shortname, pcm->name, port + 4, irq, dma1); 910 card->shortname, pcm->name, chip->wss_base + 4, irq, dma1);
872#endif /* CS4231 || OPTi93X */ 911#endif /* CS4231 || OPTi93X */
873 912
874 if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) 913 if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
@@ -1062,9 +1101,6 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
1062 snd_card_free(card); 1101 snd_card_free(card);
1063 return error; 1102 return error;
1064 } 1103 }
1065 if (hw <= OPTi9XX_HW_82C930)
1066 chip->mc_base -= 0x80;
1067
1068 error = snd_opti9xx_read_check(chip); 1104 error = snd_opti9xx_read_check(chip);
1069 if (error) { 1105 if (error) {
1070 snd_printk(KERN_ERR "OPTI chip not found\n"); 1106 snd_printk(KERN_ERR "OPTI chip not found\n");
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c
index 8d21a3feda3a..8ccbcddf08e1 100644
--- a/sound/isa/sb/jazz16.c
+++ b/sound/isa/sb/jazz16.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/delay.h>
17#include <asm/dma.h> 18#include <asm/dma.h>
18#include <linux/isa.h> 19#include <linux/isa.h>
19#include <sound/core.h> 20#include <sound/core.h>
diff --git a/sound/oss/coproc.h b/sound/oss/coproc.h
index 7306346e9ac4..7bec21bbdd88 100644
--- a/sound/oss/coproc.h
+++ b/sound/oss/coproc.h
@@ -4,7 +4,7 @@
4 */ 4 */
5 5
6/* 6/*
7 * Coprocessor access types 7 * Coprocessor access types
8 */ 8 */
9#define COPR_CUSTOM 0x0001 /* Custom applications */ 9#define COPR_CUSTOM 0x0001 /* Custom applications */
10#define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ 10#define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */
diff --git a/sound/oss/v_midi.h b/sound/oss/v_midi.h
index 1b86cb45c607..08e2185ee816 100644
--- a/sound/oss/v_midi.h
+++ b/sound/oss/v_midi.h
@@ -2,9 +2,9 @@ typedef struct vmidi_devc {
2 int dev; 2 int dev;
3 3
4 /* State variables */ 4 /* State variables */
5 int opened; 5 int opened;
6 spinlock_t lock; 6 spinlock_t lock;
7 7
8 /* MIDI fields */ 8 /* MIDI fields */
9 int my_mididev; 9 int my_mididev;
10 int pair_mididev; 10 int pair_mididev;
@@ -12,4 +12,3 @@ typedef struct vmidi_devc {
12 int intr_active; 12 int intr_active;
13 void (*midi_input_intr) (int dev, unsigned char data); 13 void (*midi_input_intr) (int dev, unsigned char data);
14 } vmidi_devc; 14 } vmidi_devc;
15
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
index 7754db166d9e..dbc4b89d74e4 100644
--- a/sound/pci/oxygen/xonar_wm87x6.c
+++ b/sound/pci/oxygen/xonar_wm87x6.c
@@ -68,7 +68,7 @@ static void wm8776_write(struct oxygen *chip,
68 OXYGEN_SPI_CEN_LATCH_CLOCK_LO, 68 OXYGEN_SPI_CEN_LATCH_CLOCK_LO,
69 (reg << 9) | value); 69 (reg << 9) | value);
70 if (reg < ARRAY_SIZE(data->wm8776_regs)) { 70 if (reg < ARRAY_SIZE(data->wm8776_regs)) {
71 if (reg >= WM8776_HPLVOL || reg <= WM8776_DACMASTER) 71 if (reg >= WM8776_HPLVOL && reg <= WM8776_DACMASTER)
72 value &= ~WM8776_UPDATE; 72 value &= ~WM8776_UPDATE;
73 data->wm8776_regs[reg] = value; 73 data->wm8776_regs[reg] = value;
74 } 74 }
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 960a227eb653..ad4462677615 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry,
1974 } 1974 }
1975 snd_iprintf(buffer, "Paths:\n"); 1975 snd_iprintf(buffer, "Paths:\n");
1976 i = getpaths(cif, p); 1976 i = getpaths(cif, p);
1977 while (i--) { 1977 while (i >= 2) {
1978 snd_iprintf(buffer, "%x->%x ", p[i - 1], p[i]); 1978 i -= 2;
1979 i--; 1979 snd_iprintf(buffer, "%x->%x ", p[i], p[i + 1]);
1980 } 1980 }
1981 snd_iprintf(buffer, "\n"); 1981 snd_iprintf(buffer, "\n");
1982} 1982}
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig
index 8c2925814ce4..c570ae3e6d55 100644
--- a/sound/usb/Kconfig
+++ b/sound/usb/Kconfig
@@ -22,13 +22,13 @@ config SND_USB_AUDIO
22 will be called snd-usb-audio. 22 will be called snd-usb-audio.
23 23
24config SND_USB_UA101 24config SND_USB_UA101
25 tristate "Edirol UA-101 driver (EXPERIMENTAL)" 25 tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)"
26 depends on EXPERIMENTAL 26 depends on EXPERIMENTAL
27 select SND_PCM 27 select SND_PCM
28 select SND_RAWMIDI 28 select SND_RAWMIDI
29 help 29 help
30 Say Y here to include support for the Edirol UA-101 audio/MIDI 30 Say Y here to include support for the Edirol UA-101 and UA-1000
31 interface. 31 audio/MIDI interfaces.
32 32
33 To compile this driver as a module, choose M here: the module 33 To compile this driver as a module, choose M here: the module
34 will be called snd-ua101. 34 will be called snd-ua101.
diff --git a/sound/usb/caiaq/midi.h b/sound/usb/caiaq/midi.h
index 9d16db027fc3..380f984babc9 100644
--- a/sound/usb/caiaq/midi.h
+++ b/sound/usb/caiaq/midi.h
@@ -3,6 +3,6 @@
3 3
4int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); 4int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev);
5void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); 5void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len);
6void snd_usb_caiaq_midi_output_done(struct urb* urb); 6void snd_usb_caiaq_midi_output_done(struct urb *urb);
7 7
8#endif /* CAIAQ_MIDI_H */ 8#endif /* CAIAQ_MIDI_H */
diff --git a/sound/usb/ua101.c b/sound/usb/ua101.c
index 4f4ccdf70dd0..3d458d3b9962 100644
--- a/sound/usb/ua101.c
+++ b/sound/usb/ua101.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Edirol UA-101 driver 2 * Edirol UA-101/UA-1000 driver
3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
4 * 4 *
5 * This driver is free software: you can redistribute it and/or modify 5 * This driver is free software: you can redistribute it and/or modify
@@ -25,13 +25,10 @@
25#include <sound/pcm_params.h> 25#include <sound/pcm_params.h>
26#include "usbaudio.h" 26#include "usbaudio.h"
27 27
28MODULE_DESCRIPTION("Edirol UA-101 driver"); 28MODULE_DESCRIPTION("Edirol UA-101/1000 driver");
29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); 29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
30MODULE_LICENSE("GPL v2"); 30MODULE_LICENSE("GPL v2");
31MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); 31MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}");
32
33/* I use my UA-1A for testing because I don't have a UA-101 ... */
34#define UA1A_HACK
35 32
36/* 33/*
37 * Should not be lower than the minimum scheduling delay of the host 34 * Should not be lower than the minimum scheduling delay of the host
@@ -132,9 +129,6 @@ struct ua101 {
132 dma_addr_t dma; 129 dma_addr_t dma;
133 } buffers[MAX_MEMORY_BUFFERS]; 130 } buffers[MAX_MEMORY_BUFFERS];
134 } capture, playback; 131 } capture, playback;
135
136 unsigned int fps[10];
137 unsigned int frame_counter;
138}; 132};
139 133
140static DEFINE_MUTEX(devices_mutex); 134static DEFINE_MUTEX(devices_mutex);
@@ -424,16 +418,6 @@ static void capture_urb_complete(struct urb *urb)
424 if (do_period_elapsed) 418 if (do_period_elapsed)
425 snd_pcm_period_elapsed(stream->substream); 419 snd_pcm_period_elapsed(stream->substream);
426 420
427 /* for debugging: measure the sample rate relative to the USB clock */
428 ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames;
429 if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) {
430 printk(KERN_DEBUG "capture rate:");
431 for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames)
432 printk(KERN_CONT " %u", ua->fps[frames]);
433 printk(KERN_CONT "\n");
434 memset(ua->fps, 0, sizeof(ua->fps));
435 ua->frame_counter = 0;
436 }
437 return; 421 return;
438 422
439stream_stopped: 423stream_stopped:
@@ -1200,13 +1184,30 @@ static int ua101_probe(struct usb_interface *interface,
1200 .type = QUIRK_MIDI_FIXED_ENDPOINT, 1184 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1201 .data = &midi_ep 1185 .data = &midi_ep
1202 }; 1186 };
1187 static const int intf_numbers[2][3] = {
1188 { /* UA-101 */
1189 [INTF_PLAYBACK] = 0,
1190 [INTF_CAPTURE] = 1,
1191 [INTF_MIDI] = 2,
1192 },
1193 { /* UA-1000 */
1194 [INTF_CAPTURE] = 1,
1195 [INTF_PLAYBACK] = 2,
1196 [INTF_MIDI] = 3,
1197 },
1198 };
1203 struct snd_card *card; 1199 struct snd_card *card;
1204 struct ua101 *ua; 1200 struct ua101 *ua;
1205 unsigned int card_index, i; 1201 unsigned int card_index, i;
1202 int is_ua1000;
1203 const char *name;
1206 char usb_path[32]; 1204 char usb_path[32];
1207 int err; 1205 int err;
1208 1206
1209 if (interface->altsetting->desc.bInterfaceNumber != 0) 1207 is_ua1000 = usb_id->idProduct == 0x0044;
1208
1209 if (interface->altsetting->desc.bInterfaceNumber !=
1210 intf_numbers[is_ua1000][0])
1210 return -ENODEV; 1211 return -ENODEV;
1211 1212
1212 mutex_lock(&devices_mutex); 1213 mutex_lock(&devices_mutex);
@@ -1239,20 +1240,13 @@ static int ua101_probe(struct usb_interface *interface,
1239 init_waitqueue_head(&ua->rate_feedback_wait); 1240 init_waitqueue_head(&ua->rate_feedback_wait);
1240 init_waitqueue_head(&ua->alsa_playback_wait); 1241 init_waitqueue_head(&ua->alsa_playback_wait);
1241 1242
1242#ifdef UA1A_HACK
1243 if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) {
1244 ua->intf[2] = interface;
1245 ua->intf[0] = usb_ifnum_to_if(ua->dev, 1);
1246 ua->intf[1] = usb_ifnum_to_if(ua->dev, 2);
1247 usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua);
1248 usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua);
1249 } else {
1250#endif
1251 ua->intf[0] = interface; 1243 ua->intf[0] = interface;
1252 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { 1244 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) {
1253 ua->intf[i] = usb_ifnum_to_if(ua->dev, i); 1245 ua->intf[i] = usb_ifnum_to_if(ua->dev,
1246 intf_numbers[is_ua1000][i]);
1254 if (!ua->intf[i]) { 1247 if (!ua->intf[i]) {
1255 dev_err(&ua->dev->dev, "interface %u not found\n", i); 1248 dev_err(&ua->dev->dev, "interface %u not found\n",
1249 intf_numbers[is_ua1000][i]);
1256 err = -ENXIO; 1250 err = -ENXIO;
1257 goto probe_error; 1251 goto probe_error;
1258 } 1252 }
@@ -1264,39 +1258,19 @@ static int ua101_probe(struct usb_interface *interface,
1264 goto probe_error; 1258 goto probe_error;
1265 } 1259 }
1266 } 1260 }
1267#ifdef UA1A_HACK
1268 }
1269#endif
1270 1261
1271 snd_card_set_dev(card, &interface->dev); 1262 snd_card_set_dev(card, &interface->dev);
1272 1263
1273#ifdef UA1A_HACK
1274 if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) {
1275 ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE;
1276 ua->rate = 44100;
1277 ua->packets_per_second = 1000;
1278 ua->capture.channels = 2;
1279 ua->playback.channels = 2;
1280 ua->capture.frame_bytes = 4;
1281 ua->playback.frame_bytes = 4;
1282 ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2);
1283 ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1);
1284 ua->capture.max_packet_bytes = 192;
1285 ua->playback.max_packet_bytes = 192;
1286 } else {
1287#endif
1288 err = detect_usb_format(ua); 1264 err = detect_usb_format(ua);
1289 if (err < 0) 1265 if (err < 0)
1290 goto probe_error; 1266 goto probe_error;
1291#ifdef UA1A_HACK
1292 }
1293#endif
1294 1267
1268 name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101";
1295 strcpy(card->driver, "UA-101"); 1269 strcpy(card->driver, "UA-101");
1296 strcpy(card->shortname, "UA-101"); 1270 strcpy(card->shortname, name);
1297 usb_make_path(ua->dev, usb_path, sizeof(usb_path)); 1271 usb_make_path(ua->dev, usb_path, sizeof(usb_path));
1298 snprintf(ua->card->longname, sizeof(ua->card->longname), 1272 snprintf(ua->card->longname, sizeof(ua->card->longname),
1299 "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", 1273 "EDIROL %s (serial %s), %u Hz at %s, %s speed", name,
1300 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, 1274 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path,
1301 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); 1275 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full");
1302 1276
@@ -1314,24 +1288,18 @@ static int ua101_probe(struct usb_interface *interface,
1314 if (err < 0) 1288 if (err < 0)
1315 goto probe_error; 1289 goto probe_error;
1316 1290
1317 err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); 1291 err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm);
1318 if (err < 0) 1292 if (err < 0)
1319 goto probe_error; 1293 goto probe_error;
1320 ua->pcm->private_data = ua; 1294 ua->pcm->private_data = ua;
1321 strcpy(ua->pcm->name, "UA-101"); 1295 strcpy(ua->pcm->name, name);
1322 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); 1296 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);
1323 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); 1297 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);
1324 1298
1325#ifdef UA1A_HACK
1326 if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) {
1327#endif
1328 err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], 1299 err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],
1329 &ua->midi_list, &midi_quirk); 1300 &ua->midi_list, &midi_quirk);
1330 if (err < 0) 1301 if (err < 0)
1331 goto probe_error; 1302 goto probe_error;
1332#ifdef UA1A_HACK
1333 }
1334#endif
1335 1303
1336 err = snd_card_register(card); 1304 err = snd_card_register(card);
1337 if (err < 0) 1305 if (err < 0)
@@ -1386,11 +1354,9 @@ static void ua101_disconnect(struct usb_interface *interface)
1386} 1354}
1387 1355
1388static struct usb_device_id ua101_ids[] = { 1356static struct usb_device_id ua101_ids[] = {
1389#ifdef UA1A_HACK 1357 { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */
1390 { USB_DEVICE(0x0582, 0x0018) }, 1358 { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */
1391#endif 1359 { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */
1392 { USB_DEVICE(0x0582, 0x007d) },
1393 { USB_DEVICE(0x0582, 0x008d) },
1394 { } 1360 { }
1395}; 1361};
1396MODULE_DEVICE_TABLE(usb, ua101_ids); 1362MODULE_DEVICE_TABLE(usb, ua101_ids);
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index c539f7fe292f..11b0826b8fe6 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2483,7 +2483,6 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip,
2483 sample_width, sample_bytes); 2483 sample_width, sample_bytes);
2484 } 2484 }
2485 /* check the format byte size */ 2485 /* check the format byte size */
2486 printk(" XXXXX SAMPLE BYTES %d\n", sample_bytes);
2487 switch (sample_bytes) { 2486 switch (sample_bytes) {
2488 case 1: 2487 case 1:
2489 pcm_format = SNDRV_PCM_FORMAT_S8; 2488 pcm_format = SNDRV_PCM_FORMAT_S8;
@@ -2581,6 +2580,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
2581 chip->usb_id == USB_ID(0x0d8c, 0x0102)) && 2580 chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
2582 fp->altsetting == 5 && fp->maxpacksize == 392) 2581 fp->altsetting == 5 && fp->maxpacksize == 392)
2583 rate = 96000; 2582 rate = 96000;
2583 /* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */
2584 if (rate == 16000 && chip->usb_id == USB_ID(0x041e, 0x4068))
2585 rate = 8000;
2584 fp->rate_table[fp->nr_rates] = rate; 2586 fp->rate_table[fp->nr_rates] = rate;
2585 if (!fp->rate_min || rate < fp->rate_min) 2587 if (!fp->rate_min || rate < fp->rate_min)
2586 fp->rate_min = rate; 2588 fp->rate_min = rate;
@@ -3386,58 +3388,6 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
3386 return 0; 3388 return 0;
3387} 3389}
3388 3390
3389/*
3390 * Create a stream for an Edirol UA-1000 interface.
3391 */
3392static int create_ua1000_quirk(struct snd_usb_audio *chip,
3393 struct usb_interface *iface,
3394 const struct snd_usb_audio_quirk *quirk)
3395{
3396 static const struct audioformat ua1000_format = {
3397 .format = SNDRV_PCM_FORMAT_S32_LE,
3398 .fmt_type = UAC_FORMAT_TYPE_I,
3399 .altsetting = 1,
3400 .altset_idx = 1,
3401 .attributes = 0,
3402 .rates = SNDRV_PCM_RATE_CONTINUOUS,
3403 };
3404 struct usb_host_interface *alts;
3405 struct usb_interface_descriptor *altsd;
3406 struct audioformat *fp;
3407 int stream, err;
3408
3409 if (iface->num_altsetting != 2)
3410 return -ENXIO;
3411 alts = &iface->altsetting[1];
3412 altsd = get_iface_desc(alts);
3413 if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE ||
3414 altsd->bNumEndpoints != 1)
3415 return -ENXIO;
3416
3417 fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL);
3418 if (!fp)
3419 return -ENOMEM;
3420
3421 fp->channels = alts->extra[4];
3422 fp->iface = altsd->bInterfaceNumber;
3423 fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
3424 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
3425 fp->datainterval = parse_datainterval(chip, alts);
3426 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
3427 fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]);
3428
3429 stream = (fp->endpoint & USB_DIR_IN)
3430 ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
3431 err = add_audio_endpoint(chip, stream, fp);
3432 if (err < 0) {
3433 kfree(fp);
3434 return err;
3435 }
3436 /* FIXME: playback must be synchronized to capture */
3437 usb_set_interface(chip->dev, fp->iface, 0);
3438 return 0;
3439}
3440
3441static int snd_usb_create_quirk(struct snd_usb_audio *chip, 3391static int snd_usb_create_quirk(struct snd_usb_audio *chip,
3442 struct usb_interface *iface, 3392 struct usb_interface *iface,
3443 const struct snd_usb_audio_quirk *quirk); 3393 const struct snd_usb_audio_quirk *quirk);
@@ -3686,7 +3636,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
3686 [QUIRK_MIDI_CME] = create_any_midi_quirk, 3636 [QUIRK_MIDI_CME] = create_any_midi_quirk,
3687 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, 3637 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
3688 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, 3638 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
3689 [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
3690 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, 3639 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
3691 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk 3640 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk
3692 }; 3641 };
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 6b016d4aac6b..42c299cbf63a 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -75,7 +75,6 @@ enum quirk_type {
75 QUIRK_MIDI_US122L, 75 QUIRK_MIDI_US122L,
76 QUIRK_AUDIO_STANDARD_INTERFACE, 76 QUIRK_AUDIO_STANDARD_INTERFACE,
77 QUIRK_AUDIO_FIXED_ENDPOINT, 77 QUIRK_AUDIO_FIXED_ENDPOINT,
78 QUIRK_AUDIO_EDIROL_UA1000,
79 QUIRK_AUDIO_EDIROL_UAXX, 78 QUIRK_AUDIO_EDIROL_UAXX,
80 QUIRK_AUDIO_ALIGN_TRANSFER, 79 QUIRK_AUDIO_ALIGN_TRANSFER,
81 80
@@ -112,7 +111,7 @@ struct snd_usb_midi_endpoint_info {
112 111
113/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ 112/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */
114 113
115/* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */ 114/* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */
116 115
117/* for QUIRK_IGNORE_INTERFACE, data is NULL */ 116/* for QUIRK_IGNORE_INTERFACE, data is NULL */
118 117
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index f06faf7917b9..2b426c1fd0e8 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -1016,36 +1016,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1016 } 1016 }
1017}, 1017},
1018{ 1018{
1019 USB_DEVICE(0x0582, 0x0044),
1020 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1021 .vendor_name = "Roland",
1022 .product_name = "UA-1000",
1023 .ifnum = QUIRK_ANY_INTERFACE,
1024 .type = QUIRK_COMPOSITE,
1025 .data = (const struct snd_usb_audio_quirk[]) {
1026 {
1027 .ifnum = 1,
1028 .type = QUIRK_AUDIO_EDIROL_UA1000
1029 },
1030 {
1031 .ifnum = 2,
1032 .type = QUIRK_AUDIO_EDIROL_UA1000
1033 },
1034 {
1035 .ifnum = 3,
1036 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1037 .data = & (const struct snd_usb_midi_endpoint_info) {
1038 .out_cables = 0x0003,
1039 .in_cables = 0x0003
1040 }
1041 },
1042 {
1043 .ifnum = -1
1044 }
1045 }
1046 }
1047},
1048{
1049 /* has ID 0x0049 when not in "Advanced Driver" mode */ 1019 /* has ID 0x0049 when not in "Advanced Driver" mode */
1050 USB_DEVICE(0x0582, 0x0047), 1020 USB_DEVICE(0x0582, 0x0047),
1051 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1021 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {