Commit a3087ae9 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/misc' into for-linus

parents f0f20a16 2b9ddcb8
...@@ -1812,7 +1812,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ...@@ -1812,7 +1812,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
Module snd-ua101 Module snd-ua101
---------------- ----------------
Module for the Edirol UA-101 audio/MIDI interface. Module for the Edirol UA-101/UA-1000 audio/MIDI interfaces.
This module supports multiple devices, autoprobe and hotplugging. This module supports multiple devices, autoprobe and hotplugging.
......
...@@ -269,8 +269,8 @@ struct uac_format_type_i_ext_descriptor { ...@@ -269,8 +269,8 @@ struct uac_format_type_i_ext_descriptor {
__u8 bLength; __u8 bLength;
__u8 bDescriptorType; __u8 bDescriptorType;
__u8 bDescriptorSubtype; __u8 bDescriptorSubtype;
__u8 bSubslotSize;
__u8 bFormatType; __u8 bFormatType;
__u8 bSubslotSize;
__u8 bBitResolution; __u8 bBitResolution;
__u8 bHeaderLength; __u8 bHeaderLength;
__u8 bControlSize; __u8 bControlSize;
......
...@@ -544,7 +544,7 @@ struct snd_rawmidi_status { ...@@ -544,7 +544,7 @@ struct snd_rawmidi_status {
* Timer section - /dev/snd/timer * Timer section - /dev/snd/timer
*/ */
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
enum { enum {
SNDRV_TIMER_CLASS_NONE = -1, SNDRV_TIMER_CLASS_NONE = -1,
......
...@@ -393,7 +393,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) ...@@ -393,7 +393,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
event == SNDRV_TIMER_EVENT_CONTINUE) event == SNDRV_TIMER_EVENT_CONTINUE)
resolution = snd_timer_resolution(ti); resolution = snd_timer_resolution(ti);
if (ti->ccallback) if (ti->ccallback)
ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); ti->ccallback(ti, event, &tstamp, resolution);
if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) if (ti->flags & SNDRV_TIMER_IFLG_SLAVE)
return; return;
timer = ti->timer; timer = ti->timer;
......
...@@ -1558,7 +1558,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip, ...@@ -1558,7 +1558,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip,
err = pnp_activate_dev(devmc); err = pnp_activate_dev(devmc);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", snd_printk(KERN_ERR "MC pnp configure failure: %d\n",
err); err);
return err; return err;
} }
......
...@@ -144,12 +144,8 @@ struct snd_opti9xx { ...@@ -144,12 +144,8 @@ struct snd_opti9xx {
spinlock_t lock; spinlock_t lock;
long wss_base;
int irq; int irq;
#ifdef CONFIG_PNP
struct pnp_dev *dev;
struct pnp_dev *devmpu;
#endif /* CONFIG_PNP */
}; };
static int snd_opti9xx_pnp_is_probed; static int snd_opti9xx_pnp_is_probed;
...@@ -159,12 +155,17 @@ static int snd_opti9xx_pnp_is_probed; ...@@ -159,12 +155,17 @@ static int snd_opti9xx_pnp_is_probed;
static struct pnp_card_device_id snd_opti9xx_pnpids[] = { static struct pnp_card_device_id snd_opti9xx_pnpids[] = {
#ifndef OPTi93X #ifndef OPTi93X
/* OPTi 82C924 */ /* OPTi 82C924 */
{ .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, { .id = "OPT0924",
.devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } },
.driver_data = 0x0924 },
/* OPTi 82C925 */ /* OPTi 82C925 */
{ .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, { .id = "OPT0925",
.devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } },
.driver_data = 0x0925 },
#else #else
/* OPTi 82C931/3 */ /* OPTi 82C931/3 */
{ .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } },
.driver_data = 0x0931 },
#endif /* OPTi93X */ #endif /* OPTi93X */
{ .id = "" } { .id = "" }
}; };
...@@ -207,24 +208,34 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, ...@@ -207,24 +208,34 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
chip->hardware = hardware; chip->hardware = hardware;
strcpy(chip->name, snd_opti9xx_names[hardware]); strcpy(chip->name, snd_opti9xx_names[hardware]);
chip->mc_base_size = opti9xx_mc_size[hardware];
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
chip->irq = -1; chip->irq = -1;
#ifndef OPTi93X
#ifdef CONFIG_PNP
if (isapnp && chip->mc_base)
/* PnP resource gives the least 10 bits */
chip->mc_base |= 0xc00;
#endif /* CONFIG_PNP */
else {
chip->mc_base = 0xf8c;
chip->mc_base_size = opti9xx_mc_size[hardware];
}
#else
chip->mc_base_size = opti9xx_mc_size[hardware];
#endif
switch (hardware) { switch (hardware) {
#ifndef OPTi93X #ifndef OPTi93X
case OPTi9XX_HW_82C928: case OPTi9XX_HW_82C928:
case OPTi9XX_HW_82C929: case OPTi9XX_HW_82C929:
chip->mc_base = 0xf8c;
chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3;
chip->pwd_reg = 3; chip->pwd_reg = 3;
break; break;
case OPTi9XX_HW_82C924: case OPTi9XX_HW_82C924:
case OPTi9XX_HW_82C925: case OPTi9XX_HW_82C925:
chip->mc_base = 0xf8c;
chip->password = 0xe5; chip->password = 0xe5;
chip->pwd_reg = 3; chip->pwd_reg = 3;
break; break;
...@@ -292,7 +303,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, ...@@ -292,7 +303,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip,
spin_unlock_irqrestore(&chip->lock, flags); spin_unlock_irqrestore(&chip->lock, flags);
return retval; return retval;
} }
static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
unsigned char value) unsigned char value)
{ {
...@@ -341,7 +352,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, ...@@ -341,7 +352,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
long wss_base, long port,
int irq, int dma1, int dma2, int irq, int dma1, int dma2,
long mpu_port, int mpu_irq) long mpu_port, int mpu_irq)
{ {
...@@ -354,16 +365,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, ...@@ -354,16 +365,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
switch (chip->hardware) { switch (chip->hardware) {
#ifndef OPTi93X #ifndef OPTi93X
case OPTi9XX_HW_82C924: case OPTi9XX_HW_82C924:
/* opti 929 mode (?), OPL3 clock output, audio enable */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc);
/* enable wave audio */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02);
case OPTi9XX_HW_82C925: case OPTi9XX_HW_82C925:
/* enable WSS mode */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80);
/* OPL3 FM synthesis */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20);
/* disable Sound Blaster IRQ and DMA */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
#ifdef CS4231 #ifdef CS4231
/* cs4231/4248 fix enabled */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02);
#else #else
/* cs4231/4248 fix disabled */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02);
#endif /* CS4231 */ #endif /* CS4231 */
break; break;
...@@ -411,21 +429,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, ...@@ -411,21 +429,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
return -EINVAL; return -EINVAL;
} }
switch (wss_base) { /* PnP resource says it decodes only 10 bits of address */
case 0x530: switch (port & 0x3ff) {
case 0x130:
chip->wss_base = 0x530;
wss_base_bits = 0x00; wss_base_bits = 0x00;
break; break;
case 0x604: case 0x204:
chip->wss_base = 0x604;
wss_base_bits = 0x03; wss_base_bits = 0x03;
break; break;
case 0xe80: case 0x280:
chip->wss_base = 0xe80;
wss_base_bits = 0x01; wss_base_bits = 0x01;
break; break;
case 0xf40: case 0x340:
chip->wss_base = 0xf40;
wss_base_bits = 0x02; wss_base_bits = 0x02;
break; break;
default: default:
snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port);
goto __skip_base; goto __skip_base;
} }
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30);
...@@ -487,7 +510,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, ...@@ -487,7 +510,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
#endif /* CS4231 || OPTi93X */ #endif /* CS4231 || OPTi93X */
#ifndef OPTi93X #ifndef OPTi93X
outb(irq_bits << 3 | dma_bits, wss_base); outb(irq_bits << 3 | dma_bits, chip->wss_base);
#else /* OPTi93X */ #else /* OPTi93X */
snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
#endif /* OPTi93X */ #endif /* OPTi93X */
...@@ -729,15 +752,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, ...@@ -729,15 +752,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
{ {
struct pnp_dev *pdev; struct pnp_dev *pdev;
int err; int err;
struct pnp_dev *devmpu;
#ifndef OPTi93X
struct pnp_dev *devmc;
#endif
chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); pdev = pnp_request_card_device(card, pid->devs[0].id, NULL);
if (chip->dev == NULL) if (pdev == NULL)
return -EBUSY; return -EBUSY;
chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
pdev = chip->dev;
err = pnp_activate_dev(pdev); err = pnp_activate_dev(pdev);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); 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,9 +773,24 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; chip->mc_indir_index = pnp_port_start(pdev, 3) + 2;
chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; chip->mc_indir_size = pnp_port_len(pdev, 3) - 2;
#else #else
if (pid->driver_data != 0x0924) devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
port = pnp_port_start(pdev, 1); if (devmc == NULL)
return -EBUSY;
err = pnp_activate_dev(devmc);
if (err < 0) {
snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err);
return err;
}
port = pnp_port_start(pdev, 1);
fm_port = pnp_port_start(pdev, 2) + 8; fm_port = pnp_port_start(pdev, 2) + 8;
/*
* The MC(0) is never accessed and card does not
* include it in the PnP resource range. OPTI93x include it.
*/
chip->mc_base = pnp_port_start(devmc, 0) - 1;
chip->mc_base_size = pnp_port_len(devmc, 0) + 1;
#endif /* OPTi93X */ #endif /* OPTi93X */
irq = pnp_irq(pdev, 0); irq = pnp_irq(pdev, 0);
dma1 = pnp_dma(pdev, 0); dma1 = pnp_dma(pdev, 0);
...@@ -760,16 +798,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, ...@@ -760,16 +798,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
dma2 = pnp_dma(pdev, 1); dma2 = pnp_dma(pdev, 1);
#endif /* CS4231 || OPTi93X */ #endif /* CS4231 || OPTi93X */
pdev = chip->devmpu; devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
if (pdev && mpu_port > 0) {
err = pnp_activate_dev(pdev); if (devmpu && mpu_port > 0) {
err = pnp_activate_dev(devmpu);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); snd_printk(KERN_ERR "MPU401 pnp configure failure\n");
mpu_port = -1; mpu_port = -1;
chip->devmpu = NULL;
} else { } else {
mpu_port = pnp_port_start(pdev, 0); mpu_port = pnp_port_start(devmpu, 0);
mpu_irq = pnp_irq(pdev, 0); mpu_irq = pnp_irq(devmpu, 0);
} }
} }
return pid->driver_data; return pid->driver_data;
...@@ -824,7 +862,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -824,7 +862,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
if (error) if (error)
return error; return error;
error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2,
#ifdef OPTi93X #ifdef OPTi93X
WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
#else #else
...@@ -865,10 +903,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -865,10 +903,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
sprintf(card->shortname, "OPTi %s", card->driver); sprintf(card->shortname, "OPTi %s", card->driver);
#if defined(CS4231) || defined(OPTi93X) #if defined(CS4231) || defined(OPTi93X)
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d",
card->shortname, pcm->name, port + 4, irq, dma1, xdma2); card->shortname, pcm->name,
chip->wss_base + 4, irq, dma1, xdma2);
#else #else
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
card->shortname, pcm->name, port + 4, irq, dma1); card->shortname, pcm->name, chip->wss_base + 4, irq, dma1);
#endif /* CS4231 || OPTi93X */ #endif /* CS4231 || OPTi93X */
if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) 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,9 +1101,6 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
snd_card_free(card); snd_card_free(card);
return error; return error;
} }
if (hw <= OPTi9XX_HW_82C930)
chip->mc_base -= 0x80;
error = snd_opti9xx_read_check(chip); error = snd_opti9xx_read_check(chip);
if (error) { if (error) {
snd_printk(KERN_ERR "OPTI chip not found\n"); snd_printk(KERN_ERR "OPTI chip not found\n");
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/delay.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <linux/isa.h> #include <linux/isa.h>
#include <sound/core.h> #include <sound/core.h>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*/ */
/* /*
* Coprocessor access types * Coprocessor access types
*/ */
#define COPR_CUSTOM 0x0001 /* Custom applications */ #define COPR_CUSTOM 0x0001 /* Custom applications */
#define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */
......
...@@ -2,9 +2,9 @@ typedef struct vmidi_devc { ...@@ -2,9 +2,9 @@ typedef struct vmidi_devc {
int dev; int dev;
/* State variables */ /* State variables */
int opened; int opened;
spinlock_t lock; spinlock_t lock;
/* MIDI fields */ /* MIDI fields */
int my_mididev; int my_mididev;
int pair_mididev; int pair_mididev;
...@@ -12,4 +12,3 @@ typedef struct vmidi_devc { ...@@ -12,4 +12,3 @@ typedef struct vmidi_devc {
int intr_active; int intr_active;
void (*midi_input_intr) (int dev, unsigned char data); void (*midi_input_intr) (int dev, unsigned char data);
} vmidi_devc; } vmidi_devc;
...@@ -68,7 +68,7 @@ static void wm8776_write(struct oxygen *chip, ...@@ -68,7 +68,7 @@ static void wm8776_write(struct oxygen *chip,
OXYGEN_SPI_CEN_LATCH_CLOCK_LO, OXYGEN_SPI_CEN_LATCH_CLOCK_LO,
(reg << 9) | value); (reg << 9) | value);
if (reg < ARRAY_SIZE(data->wm8776_regs)) { if (reg < ARRAY_SIZE(data->wm8776_regs)) {
if (reg >= WM8776_HPLVOL || reg <= WM8776_DACMASTER) if (reg >= WM8776_HPLVOL && reg <= WM8776_DACMASTER)
value &= ~WM8776_UPDATE; value &= ~WM8776_UPDATE;
data->wm8776_regs[reg] = value; data->wm8776_regs[reg] = value;
} }
......
...@@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry, ...@@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry,
} }
snd_iprintf(buffer, "Paths:\n"); snd_iprintf(buffer, "Paths:\n");
i = getpaths(cif, p); i = getpaths(cif, p);
while (i--) { while (i >= 2) {
snd_iprintf(buffer, "%x->%x ", p[i - 1], p[i]); i -= 2;
i--; snd_iprintf(buffer, "%x->%x ", p[i], p[i + 1]);
} }
snd_iprintf(buffer, "\n"); snd_iprintf(buffer, "\n");
} }
......
...@@ -22,13 +22,13 @@ config SND_USB_AUDIO ...@@ -22,13 +22,13 @@ config SND_USB_AUDIO
will be called snd-usb-audio. will be called snd-usb-audio.
config SND_USB_UA101 config SND_USB_UA101
tristate "Edirol UA-101 driver (EXPERIMENTAL)" tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)"
depends on EXPERIMENTAL depends on EXPERIMENTAL
select SND_PCM select SND_PCM
select SND_RAWMIDI select SND_RAWMIDI
help help
Say Y here to include support for the Edirol UA-101 audio/MIDI Say Y here to include support for the Edirol UA-101 and UA-1000
interface. audio/MIDI interfaces.
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called snd-ua101. will be called snd-ua101.
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev);
void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len);
void snd_usb_caiaq_midi_output_done(struct urb* urb); void snd_usb_caiaq_midi_output_done(struct urb *urb);
#endif /* CAIAQ_MIDI_H */ #endif /* CAIAQ_MIDI_H */
/* /*
* Edirol UA-101 driver * Edirol UA-101/UA-1000 driver
* Copyright (c) Clemens Ladisch <clemens@ladisch.de> * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
* *
* This driver is free software: you can redistribute it and/or modify * This driver is free software: you can redistribute it and/or modify
...@@ -25,13 +25,10 @@ ...@@ -25,13 +25,10 @@
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include "usbaudio.h" #include "usbaudio.h"
MODULE_DESCRIPTION("Edirol UA-101 driver"); MODULE_DESCRIPTION("Edirol UA-101/1000 driver");
MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}");
/* I use my UA-1A for testing because I don't have a UA-101 ... */
#define UA1A_HACK
/* /*
* Should not be lower than the minimum scheduling delay of the host * Should not be lower than the minimum scheduling delay of the host
...@@ -132,9 +129,6 @@ struct ua101 { ...@@ -132,9 +129,6 @@ struct ua101 {
dma_addr_t dma; dma_addr_t dma;
} buffers[MAX_MEMORY_BUFFERS]; } buffers[MAX_MEMORY_BUFFERS];
} capture, playback; } capture, playback;
unsigned int fps[10];
unsigned int frame_counter;
}; };
static DEFINE_MUTEX(devices_mutex); static DEFINE_MUTEX(devices_mutex);
...@@ -424,16 +418,6 @@ static void capture_urb_complete(struct urb *urb) ...@@ -424,16 +418,6 @@ static void capture_urb_complete(struct urb *urb)
if (do_period_elapsed) if (do_period_elapsed)
snd_pcm_period_elapsed(stream->substream); snd_pcm_period_elapsed(stream->substream);
/* for debugging: measure the sample rate relative to the USB clock */
ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames;
if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) {
printk(KERN_DEBUG "capture rate:");
for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames)
printk(KERN_CONT " %u", ua->fps[frames]);
printk(KERN_CONT "\n");
memset(ua->fps, 0, sizeof(ua->fps));
ua->frame_counter = 0;
}
return; return;
stream_stopped: stream_stopped:
...@@ -1200,13 +1184,30 @@ static int ua101_probe(struct usb_interface *interface, ...@@ -1200,13 +1184,30 @@ static int ua101_probe(struct usb_interface *interface,
.type = QUIRK_MIDI_FIXED_ENDPOINT, .type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = &midi_ep .data = &midi_ep
}; };
static const int intf_numbers[2][3] = {
{ /* UA-101 */
[INTF_PLAYBACK] = 0,
[INTF_CAPTURE] = 1,
[INTF_MIDI] = 2,
},
{ /* UA-1000 */
[INTF_CAPTURE] = 1,
[INTF_PLAYBACK] = 2,
[INTF_MIDI] = 3,
},
};
struct snd_card *card; struct snd_card *card;
struct ua101 *ua; struct ua101 *ua;
unsigned int card_index, i; unsigned int card_index, i;
int is_ua1000;
const char *name;
char usb_path[32]; char usb_path[32];
int err; int err;
if (interface->altsetting->desc.bInterfaceNumber != 0) is_ua1000 = usb_id->idProduct == 0x0044;
if (interface->altsetting->desc.bInterfaceNumber !=
intf_numbers[is_ua1000][0])
return -ENODEV; return -ENODEV;
mutex_lock(&devices_mutex); mutex_lock(&devices_mutex);
...@@ -1239,20 +1240,13 @@ static int ua101_probe(struct usb_interface *interface, ...@@ -1239,20 +1240,13 @@ static int ua101_probe(struct usb_interface *interface,
init_waitqueue_head(&ua->rate_feedback_wait); init_waitqueue_head(&ua->rate_feedback_wait);
init_waitqueue_head(&ua->alsa_playback_wait); init_waitqueue_head(&ua->alsa_playback_wait);
#ifdef UA1A_HACK
if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) {
ua->intf[2] = interface;
ua->intf[0] = usb_ifnum_to_if(ua->dev, 1);
ua->intf[1] = usb_ifnum_to_if(ua->dev, 2);
usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua);
usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua);
} else {
#endif
ua->intf[0] = interface; ua->intf[0] = interface;
for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) {
ua->intf[i] = usb_ifnum_to_if(ua->dev, i); ua->intf[i] = usb_ifnum_to_if(ua->dev,
intf_numbers[is_ua1000][i]);
if (!ua->intf[i]) { if (!ua->intf[i]) {
dev_err(&ua->dev->dev, "interface %u not found\n", i); dev_err(&ua->dev->dev, "interface %u not found\n",
intf_numbers[is_ua1000][i]);
err = -ENXIO; err = -ENXIO;
goto probe_error; goto probe_error;
} }
...@@ -1264,39 +1258,19 @@ static int ua101_probe(struct usb_interface *interface, ...@@ -1264,39 +1258,19 @@ static int ua101_probe(struct usb_interface *interface,
goto probe_error; goto probe_error;
} }
} }
#ifdef UA1A_HACK
}
#endif
snd_card_set_dev(card, &interface->dev); snd_card_set_dev(card, &interface->dev);
#ifdef UA1A_HACK
if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) {
ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE;
ua->rate = 44100;
ua->packets_per_second = 1000;
ua->capture.channels = 2;
ua->playback.channels = 2;
ua->capture.frame_bytes = 4;
ua->playback.frame_bytes = 4;
ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2);
ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1);
ua->capture.max_packet_bytes = 192;
ua->playback.max_packet_bytes = 192;
} else {
#endif
err = detect_usb_format(ua); err = detect_usb_format(ua);
if (err < 0) if (err < 0)
goto probe_error; goto probe_error;
#ifdef UA1A_HACK
}
#endif
name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101";
strcpy(card->driver, "UA-101"); strcpy(card->driver, "UA-101");
strcpy(card->shortname, "UA-101"); strcpy(card->shortname, name);
usb_make_path(ua->dev, usb_path, sizeof(usb_path)); usb_make_path(ua->dev, usb_path, sizeof(usb_path));
snprintf(ua->card->longname, sizeof(ua->card->longname), snprintf(ua->card->longname, sizeof(ua->card->longname),
"EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", "EDIROL %s (serial %s), %u Hz at %s, %s speed", name,
ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path,
ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); ua->dev->speed == USB_SPEED_HIGH ? "high" : "full");
...@@ -1314,24 +1288,18 @@ static int ua101_probe(struct usb_interface *interface, ...@@ -1314,24 +1288,18 @@ static int ua101_probe(struct usb_interface *interface,
if (err < 0) if (err < 0)
goto probe_error; goto probe_error;
err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm);
if (err < 0) if (err < 0)
goto probe_error; goto probe_error;
ua->pcm->private_data = ua; ua->pcm->private_data = ua;
strcpy(ua->pcm->name, "UA-101"); strcpy(ua->pcm->name, name);
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);
#ifdef UA1A_HACK
if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) {
#endif
err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],
&ua->midi_list, &midi_quirk); &ua->midi_list, &midi_quirk);
if (err < 0) if (err < 0)
goto probe_error; goto probe_error;
#ifdef UA1A_HACK
}
#endif
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) if (err < 0)
...@@ -1386,11 +1354,9 @@ static void ua101_disconnect(struct usb_interface *interface) ...@@ -1386,11 +1354,9 @@ static void ua101_disconnect(struct usb_interface *interface)
} }
static struct usb_device_id ua101_ids[] = { static struct usb_device_id ua101_ids[] = {
#ifdef UA1A_HACK { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */
{ USB_DEVICE(0x0582, 0x0018) }, { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */
#endif { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */
{ USB_DEVICE(0x0582, 0x007d) },
{ USB_DEVICE(0x0582, 0x008d) },
{ } { }
}; };
MODULE_DEVICE_TABLE(usb, ua101_ids); MODULE_DEVICE_TABLE(usb, ua101_ids);
......
...@@ -2483,7 +2483,6 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, ...@@ -2483,7 +2483,6 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip,
sample_width, sample_bytes); sample_width, sample_bytes);
} }
/* check the format byte size */ /* check the format byte size */
printk(" XXXXX SAMPLE BYTES %d\n", sample_bytes);
switch (sample_bytes) { switch (sample_bytes) {
case 1: case 1:
pcm_format = SNDRV_PCM_FORMAT_S8; 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,6 +2580,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
chip->usb_id == USB_ID(0x0d8c, 0x0102)) && chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
fp->altsetting == 5 && fp->maxpacksize == 392) fp->altsetting == 5 && fp->maxpacksize == 392)
rate = 96000; rate = 96000;
/* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */
if (rate == 16000 && chip->usb_id == USB_ID(0x041e, 0x4068))
rate = 8000;
fp->rate_table[fp->nr_rates] = rate; fp->rate_table[fp->nr_rates] = rate;
if (!fp->rate_min || rate < fp->rate_min) if (!fp->rate_min || rate < fp->rate_min)
fp->rate_min = rate; fp->rate_min = rate;
...@@ -3386,58 +3388,6 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, ...@@ -3386,58 +3388,6 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
return 0; return 0;
} }
/*
* Create a stream for an Edirol UA-1000 interface.
*/
static int create_ua1000_quirk(struct snd_usb_audio *chip,
struct usb_interface *iface,
const struct snd_usb_audio_quirk *quirk)
{
static const struct audioformat ua1000_format = {
.format = SNDRV_PCM_FORMAT_S32_LE,
.fmt_type = UAC_FORMAT_TYPE_I,
.altsetting = 1,
.altset_idx = 1,
.attributes = 0,
.rates = SNDRV_PCM_RATE_CONTINUOUS,
};
struct usb_host_interface *alts;
struct usb_interface_descriptor *altsd;
struct audioformat *fp;
int stream, err;
if (iface->num_altsetting != 2)
return -ENXIO;
alts = &iface->altsetting[1];
altsd = get_iface_desc(alts);
if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE ||
altsd->bNumEndpoints != 1)
return -ENXIO;
fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL);
if (!fp)
return -ENOMEM;
fp->channels = alts->extra[4];
fp->iface = altsd->bInterfaceNumber;
fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
fp->datainterval = parse_datainterval(chip, alts);
fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]);
stream = (fp->endpoint & USB_DIR_IN)
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
err = add_audio_endpoint(chip, stream, fp);
if (err < 0) {
kfree(fp);
return err;
}
/* FIXME: playback must be synchronized to capture */
usb_set_interface(chip->dev, fp->iface, 0);
return 0;
}
static int snd_usb_create_quirk(struct snd_usb_audio *chip, static int snd_usb_create_quirk(struct snd_usb_audio *chip,
struct usb_interface *iface, struct usb_interface *iface,
const struct snd_usb_audio_quirk *quirk); const struct snd_usb_audio_quirk *quirk);
...@@ -3686,7 +3636,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, ...@@ -3686,7 +3636,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
[QUIRK_MIDI_CME] = create_any_midi_quirk, [QUIRK_MIDI_CME] = create_any_midi_quirk,
[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
[QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk
}; };
......
...@@ -75,7 +75,6 @@ enum quirk_type { ...@@ -75,7 +75,6 @@ enum quirk_type {
QUIRK_MIDI_US122L, QUIRK_MIDI_US122L,
QUIRK_AUDIO_STANDARD_INTERFACE, QUIRK_AUDIO_STANDARD_INTERFACE,
QUIRK_AUDIO_FIXED_ENDPOINT, QUIRK_AUDIO_FIXED_ENDPOINT,
QUIRK_AUDIO_EDIROL_UA1000,
QUIRK_AUDIO_EDIROL_UAXX, QUIRK_AUDIO_EDIROL_UAXX,
QUIRK_AUDIO_ALIGN_TRANSFER, QUIRK_AUDIO_ALIGN_TRANSFER,
...@@ -112,7 +111,7 @@ struct snd_usb_midi_endpoint_info { ...@@ -112,7 +111,7 @@ struct snd_usb_midi_endpoint_info {
/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */
/* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */ /* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */
/* for QUIRK_IGNORE_INTERFACE, data is NULL */ /* for QUIRK_IGNORE_INTERFACE, data is NULL */
......
...@@ -1015,36 +1015,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -1015,36 +1015,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
} }
} }
}, },
{
USB_DEVICE(0x0582, 0x0044),
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
.vendor_name = "Roland",
.product_name = "UA-1000",
.ifnum = QUIRK_ANY_INTERFACE,
.type = QUIRK_COMPOSITE,
.data = (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 1,
.type = QUIRK_AUDIO_EDIROL_UA1000
},
{
.ifnum = 2,
.type = QUIRK_AUDIO_EDIROL_UA1000
},
{
.ifnum = 3,
.type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = & (const struct snd_usb_midi_endpoint_info) {
.out_cables = 0x0003,
.in_cables = 0x0003
}
},
{
.ifnum = -1
}
}
}
},
{ {
/* has ID 0x0049 when not in "Advanced Driver" mode */ /* has ID 0x0049 when not in "Advanced Driver" mode */
USB_DEVICE(0x0582, 0x0047), USB_DEVICE(0x0582, 0x0047),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment