* [PATCH] ALSA: snd-usb-audio: support for Edirol UA-4FX device
@ 2008-10-04 14:27 pedro.lopez.cabanillas
2008-10-04 16:33 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: pedro.lopez.cabanillas @ 2008-10-04 14:27 UTC (permalink / raw)
To: patch; +Cc: Pedro Lopez-Cabanillas, alsa-devel
From: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Renamed the old quirk function for ua-700/ua-25 to become more
generic, moving the MIDI interfaces to the quirk data header.
Added a new quirk for the Edirol UA-4FX.
Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index c5cf682..05c7849 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2996,12 +2996,12 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip,
}
/*
- * Create a stream for an Edirol UA-700/UA-25 interface. The only way
- * to detect the sample rate is by looking at wMaxPacketSize.
+ * Create a stream for an Edirol UA-700/UA-25/UA-4FX interface.
+ * The only way to detect the sample rate is by looking at wMaxPacketSize.
*/
-static int create_ua700_ua25_quirk(struct snd_usb_audio *chip,
- struct usb_interface *iface,
- const struct snd_usb_audio_quirk *quirk)
+static int create_uaxx_quirk(struct snd_usb_audio *chip,
+ struct usb_interface *iface,
+ const struct snd_usb_audio_quirk *quirk)
{
static const struct audioformat ua_format = {
.format = SNDRV_PCM_FORMAT_S24_3LE,
@@ -3016,37 +3016,12 @@ static int create_ua700_ua25_quirk(struct snd_usb_audio *chip,
struct audioformat *fp;
int stream, err;
- /* both PCM and MIDI interfaces have 2 altsettings */
- if (iface->num_altsetting != 2)
+ /* both PCM and MIDI interfaces have 2 or more altsettings */
+ if (iface->num_altsetting < 2)
return -ENXIO;
alts = &iface->altsetting[1];
altsd = get_iface_desc(alts);
- if (altsd->bNumEndpoints == 2) {
- static const struct snd_usb_midi_endpoint_info ua700_ep = {
- .out_cables = 0x0003,
- .in_cables = 0x0003
- };
- static const struct snd_usb_audio_quirk ua700_quirk = {
- .type = QUIRK_MIDI_FIXED_ENDPOINT,
- .data = &ua700_ep
- };
- static const struct snd_usb_midi_endpoint_info ua25_ep = {
- .out_cables = 0x0001,
- .in_cables = 0x0001
- };
- static const struct snd_usb_audio_quirk ua25_quirk = {
- .type = QUIRK_MIDI_FIXED_ENDPOINT,
- .data = &ua25_ep
- };
- if (chip->usb_id == USB_ID(0x0582, 0x002b))
- return snd_usb_create_midi_interface(chip, iface,
- &ua700_quirk);
- else
- return snd_usb_create_midi_interface(chip, iface,
- &ua25_quirk);
- }
-
if (altsd->bNumEndpoints != 1)
return -ENXIO;
@@ -3376,9 +3351,9 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
[QUIRK_MIDI_CME] = snd_usb_create_midi_interface,
[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
- [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk,
[QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
[QUIRK_AUDIO_EDIROL_UA101] = create_ua101_quirk,
+ [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk
};
if (quirk->type < QUIRK_TYPE_COUNT) {
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index f3ca77f..36e4f7a 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -159,9 +159,9 @@ enum quirk_type {
QUIRK_MIDI_US122L,
QUIRK_AUDIO_STANDARD_INTERFACE,
QUIRK_AUDIO_FIXED_ENDPOINT,
- QUIRK_AUDIO_EDIROL_UA700_UA25,
QUIRK_AUDIO_EDIROL_UA1000,
QUIRK_AUDIO_EDIROL_UA101,
+ QUIRK_AUDIO_EDIROL_UAXX,
QUIRK_TYPE_COUNT
};
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 3f68359..ad7a318 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -855,15 +855,19 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 1,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 2,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 3,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_MIDI_FIXED_ENDPOINT,
+ .data = & (const struct snd_usb_midi_endpoint_info) {
+ .out_cables = 0x0003,
+ .in_cables = 0x0003
+ }
},
{
.ifnum = -1
@@ -1197,15 +1201,19 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 0,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 1,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 2,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_MIDI_FIXED_ENDPOINT,
+ .data = & (const struct snd_usb_midi_endpoint_info) {
+ .out_cables = 0x0001,
+ .in_cables = 0x0001
+ }
},
{
.ifnum = -1
@@ -1338,6 +1346,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
}
}
},
+{
+ /*
+ * This quirk is for the "Advanced Driver" mode. If off, the UA-4FX
+ * is standard compliant, but has only 16-bit PCM and no MIDI.
+ */
+ USB_DEVICE(0x0582, 0x00a3),
+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+ .vendor_name = "EDIROL",
+ .product_name = "UA-4FX",
+ .ifnum = QUIRK_ANY_INTERFACE,
+ .type = QUIRK_COMPOSITE,
+ .data = (const struct snd_usb_audio_quirk[]) {
+ {
+ .ifnum = 0,
+ .type = QUIRK_AUDIO_EDIROL_UAXX
+ },
+ {
+ .ifnum = 1,
+ .type = QUIRK_AUDIO_EDIROL_UAXX
+ },
+ {
+ .ifnum = 2,
+ .type = QUIRK_MIDI_FIXED_ENDPOINT,
+ .data = & (const struct snd_usb_midi_endpoint_info) {
+ .out_cables = 0x0001,
+ .in_cables = 0x0001
+ }
+ },
+ {
+ .ifnum = -1
+ }
+ }
+ }
+},
/* TODO: add Edirol MD-P1 support */
{
USB_DEVICE(0x582, 0x00a6),
--
1.5.2.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH] ALSA: snd-usb-audio: support for Edirol UA-4FX device
@ 2008-10-04 14:32 pedro.lopez.cabanillas
2008-10-06 6:53 ` Clemens Ladisch
0 siblings, 1 reply; 6+ messages in thread
From: pedro.lopez.cabanillas @ 2008-10-04 14:32 UTC (permalink / raw)
To: patch; +Cc: tiwai, Pedro Lopez-Cabanillas, alsa-devel, clemens
From: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Renamed the old quirk function for ua-700/ua-25 to become more
generic, moving the MIDI interfaces to the quirk data header.
Added a new quirk for the Edirol UA-4FX.
Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index c5cf682..05c7849 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2996,12 +2996,12 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip,
}
/*
- * Create a stream for an Edirol UA-700/UA-25 interface. The only way
- * to detect the sample rate is by looking at wMaxPacketSize.
+ * Create a stream for an Edirol UA-700/UA-25/UA-4FX interface.
+ * The only way to detect the sample rate is by looking at wMaxPacketSize.
*/
-static int create_ua700_ua25_quirk(struct snd_usb_audio *chip,
- struct usb_interface *iface,
- const struct snd_usb_audio_quirk *quirk)
+static int create_uaxx_quirk(struct snd_usb_audio *chip,
+ struct usb_interface *iface,
+ const struct snd_usb_audio_quirk *quirk)
{
static const struct audioformat ua_format = {
.format = SNDRV_PCM_FORMAT_S24_3LE,
@@ -3016,37 +3016,12 @@ static int create_ua700_ua25_quirk(struct snd_usb_audio *chip,
struct audioformat *fp;
int stream, err;
- /* both PCM and MIDI interfaces have 2 altsettings */
- if (iface->num_altsetting != 2)
+ /* both PCM and MIDI interfaces have 2 or more altsettings */
+ if (iface->num_altsetting < 2)
return -ENXIO;
alts = &iface->altsetting[1];
altsd = get_iface_desc(alts);
- if (altsd->bNumEndpoints == 2) {
- static const struct snd_usb_midi_endpoint_info ua700_ep = {
- .out_cables = 0x0003,
- .in_cables = 0x0003
- };
- static const struct snd_usb_audio_quirk ua700_quirk = {
- .type = QUIRK_MIDI_FIXED_ENDPOINT,
- .data = &ua700_ep
- };
- static const struct snd_usb_midi_endpoint_info ua25_ep = {
- .out_cables = 0x0001,
- .in_cables = 0x0001
- };
- static const struct snd_usb_audio_quirk ua25_quirk = {
- .type = QUIRK_MIDI_FIXED_ENDPOINT,
- .data = &ua25_ep
- };
- if (chip->usb_id == USB_ID(0x0582, 0x002b))
- return snd_usb_create_midi_interface(chip, iface,
- &ua700_quirk);
- else
- return snd_usb_create_midi_interface(chip, iface,
- &ua25_quirk);
- }
-
if (altsd->bNumEndpoints != 1)
return -ENXIO;
@@ -3376,9 +3351,9 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
[QUIRK_MIDI_CME] = snd_usb_create_midi_interface,
[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
- [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk,
[QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
[QUIRK_AUDIO_EDIROL_UA101] = create_ua101_quirk,
+ [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk
};
if (quirk->type < QUIRK_TYPE_COUNT) {
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index f3ca77f..36e4f7a 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -159,9 +159,9 @@ enum quirk_type {
QUIRK_MIDI_US122L,
QUIRK_AUDIO_STANDARD_INTERFACE,
QUIRK_AUDIO_FIXED_ENDPOINT,
- QUIRK_AUDIO_EDIROL_UA700_UA25,
QUIRK_AUDIO_EDIROL_UA1000,
QUIRK_AUDIO_EDIROL_UA101,
+ QUIRK_AUDIO_EDIROL_UAXX,
QUIRK_TYPE_COUNT
};
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 3f68359..ad7a318 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -855,15 +855,19 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 1,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 2,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 3,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_MIDI_FIXED_ENDPOINT,
+ .data = & (const struct snd_usb_midi_endpoint_info) {
+ .out_cables = 0x0003,
+ .in_cables = 0x0003
+ }
},
{
.ifnum = -1
@@ -1197,15 +1201,19 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 0,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 1,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_AUDIO_EDIROL_UAXX
},
{
.ifnum = 2,
- .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ .type = QUIRK_MIDI_FIXED_ENDPOINT,
+ .data = & (const struct snd_usb_midi_endpoint_info) {
+ .out_cables = 0x0001,
+ .in_cables = 0x0001
+ }
},
{
.ifnum = -1
@@ -1338,6 +1346,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
}
}
},
+{
+ /*
+ * This quirk is for the "Advanced Driver" mode. If off, the UA-4FX
+ * is standard compliant, but has only 16-bit PCM and no MIDI.
+ */
+ USB_DEVICE(0x0582, 0x00a3),
+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+ .vendor_name = "EDIROL",
+ .product_name = "UA-4FX",
+ .ifnum = QUIRK_ANY_INTERFACE,
+ .type = QUIRK_COMPOSITE,
+ .data = (const struct snd_usb_audio_quirk[]) {
+ {
+ .ifnum = 0,
+ .type = QUIRK_AUDIO_EDIROL_UAXX
+ },
+ {
+ .ifnum = 1,
+ .type = QUIRK_AUDIO_EDIROL_UAXX
+ },
+ {
+ .ifnum = 2,
+ .type = QUIRK_MIDI_FIXED_ENDPOINT,
+ .data = & (const struct snd_usb_midi_endpoint_info) {
+ .out_cables = 0x0001,
+ .in_cables = 0x0001
+ }
+ },
+ {
+ .ifnum = -1
+ }
+ }
+ }
+},
/* TODO: add Edirol MD-P1 support */
{
USB_DEVICE(0x582, 0x00a6),
--
1.5.2.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] ALSA: snd-usb-audio: support for Edirol UA-4FX device
2008-10-04 14:32 pedro.lopez.cabanillas
@ 2008-10-06 6:53 ` Clemens Ladisch
2008-10-06 9:50 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2008-10-06 6:53 UTC (permalink / raw)
To: Pedro Lopez-Cabanillas; +Cc: Takashi Iwai, alsa-devel
Pedro Lopez-Cabanillas wrote:
> Renamed the old quirk function for ua-700/ua-25 to become more
> generic, moving the MIDI interfaces to the quirk data header.
The MIDI interfaces have to be detected dynamically because in the half-
duplex 96 kHz modes, they have a different interface number.
Regards,
Clemens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: snd-usb-audio: support for Edirol UA-4FX device
2008-10-06 6:53 ` Clemens Ladisch
@ 2008-10-06 9:50 ` Takashi Iwai
2008-10-06 19:50 ` Pedro Lopez-Cabanillas
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2008-10-06 9:50 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Pedro Lopez-Cabanillas, alsa-devel
At Mon, 06 Oct 2008 08:53:09 +0200,
Clemens Ladisch wrote:
>
> Pedro Lopez-Cabanillas wrote:
> > Renamed the old quirk function for ua-700/ua-25 to become more
> > generic, moving the MIDI interfaces to the quirk data header.
>
> The MIDI interfaces have to be detected dynamically because in the half-
> duplex 96 kHz modes, they have a different interface number.
OK, then the MIDI check must be again in uaxx_quirk.
I like the style Pedro did, putting the numbers in quirk list rather
than hard-coding in quirk routine. But if it can't be done
statically, it has to be reversed in the old way...
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: snd-usb-audio: support for Edirol UA-4FX device
2008-10-06 9:50 ` Takashi Iwai
@ 2008-10-06 19:50 ` Pedro Lopez-Cabanillas
0 siblings, 0 replies; 6+ messages in thread
From: Pedro Lopez-Cabanillas @ 2008-10-06 19:50 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Clemens Ladisch
Takashi Iwai wrote:
> Clemens Ladisch wrote:
> > Pedro Lopez-Cabanillas wrote:
> > > Renamed the old quirk function for ua-700/ua-25 to become more
> > > generic, moving the MIDI interfaces to the quirk data header.
> >
> > The MIDI interfaces have to be detected dynamically because in the half-
> > duplex 96 kHz modes, they have a different interface number.
>
> OK, then the MIDI check must be again in uaxx_quirk.
> I like the style Pedro did, putting the numbers in quirk list rather
> than hard-coding in quirk routine. But if it can't be done
> statically, it has to be reversed in the old way...
Yes, sorry. I will send in a minute a new patch for ua-4fx, using the old way
to detect the MIDI interfaces.
Regards,
Pedro
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-06 19:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-04 14:27 [PATCH] ALSA: snd-usb-audio: support for Edirol UA-4FX device pedro.lopez.cabanillas
2008-10-04 16:33 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2008-10-04 14:32 pedro.lopez.cabanillas
2008-10-06 6:53 ` Clemens Ladisch
2008-10-06 9:50 ` Takashi Iwai
2008-10-06 19:50 ` Pedro Lopez-Cabanillas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.