diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-02-22 17:49:13 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-02-23 02:51:56 -0500 |
commit | de48c7bc6f93c6c8e0be8612c9d72a2dc92eaa01 (patch) | |
tree | f27b2849a4f78959f7c448eaaafd7bca8cb8f8ac /sound/usb/usbaudio.c | |
parent | 7b8a043f2686af9f41e313a78ed5e98233e5fded (diff) |
ALSA: usbaudio: consolidate header files
Use the definitions from linux/usb/audio.h all over the ALSA USB audio
driver and add some missing definitions there as well.
Use the endpoint attribute macros from linux/usb/ch9 and remove the own
things from sound/usb/usbaudio.h.
Now things are also nicely prefixed which makes understanding the code
easier.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r-- | sound/usb/usbaudio.c | 125 |
1 files changed, 63 insertions, 62 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 411a6cf43c21..c539f7fe292f 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/moduleparam.h> | 47 | #include <linux/moduleparam.h> |
48 | #include <linux/mutex.h> | 48 | #include <linux/mutex.h> |
49 | #include <linux/usb/audio.h> | 49 | #include <linux/usb/audio.h> |
50 | #include <linux/usb/ch9.h> | ||
50 | 51 | ||
51 | #include <sound/core.h> | 52 | #include <sound/core.h> |
52 | #include <sound/info.h> | 53 | #include <sound/info.h> |
@@ -598,7 +599,7 @@ static int prepare_playback_urb(struct snd_usb_substream *subs, | |||
598 | if (subs->transfer_done >= runtime->period_size) { | 599 | if (subs->transfer_done >= runtime->period_size) { |
599 | subs->transfer_done -= runtime->period_size; | 600 | subs->transfer_done -= runtime->period_size; |
600 | period_elapsed = 1; | 601 | period_elapsed = 1; |
601 | if (subs->fmt_type == USB_FORMAT_TYPE_II) { | 602 | if (subs->fmt_type == UAC_FORMAT_TYPE_II) { |
602 | if (subs->transfer_done > 0) { | 603 | if (subs->transfer_done > 0) { |
603 | /* FIXME: fill-max mode is not | 604 | /* FIXME: fill-max mode is not |
604 | * supported yet */ | 605 | * supported yet */ |
@@ -1106,7 +1107,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1106 | u->packets = (i + 1) * total_packs / subs->nurbs | 1107 | u->packets = (i + 1) * total_packs / subs->nurbs |
1107 | - i * total_packs / subs->nurbs; | 1108 | - i * total_packs / subs->nurbs; |
1108 | u->buffer_size = maxsize * u->packets; | 1109 | u->buffer_size = maxsize * u->packets; |
1109 | if (subs->fmt_type == USB_FORMAT_TYPE_II) | 1110 | if (subs->fmt_type == UAC_FORMAT_TYPE_II) |
1110 | u->packets++; /* for transfer delimiter */ | 1111 | u->packets++; /* for transfer delimiter */ |
1111 | u->urb = usb_alloc_urb(u->packets, GFP_KERNEL); | 1112 | u->urb = usb_alloc_urb(u->packets, GFP_KERNEL); |
1112 | if (!u->urb) | 1113 | if (!u->urb) |
@@ -1182,7 +1183,7 @@ static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned | |||
1182 | if (i >= fp->nr_rates) | 1183 | if (i >= fp->nr_rates) |
1183 | continue; | 1184 | continue; |
1184 | } | 1185 | } |
1185 | attr = fp->ep_attr & EP_ATTR_MASK; | 1186 | attr = fp->ep_attr & USB_ENDPOINT_SYNCTYPE; |
1186 | if (! found) { | 1187 | if (! found) { |
1187 | found = fp; | 1188 | found = fp; |
1188 | cur_attr = attr; | 1189 | cur_attr = attr; |
@@ -1194,14 +1195,14 @@ static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned | |||
1194 | * M-audio audiophile USB. | 1195 | * M-audio audiophile USB. |
1195 | */ | 1196 | */ |
1196 | if (attr != cur_attr) { | 1197 | if (attr != cur_attr) { |
1197 | if ((attr == EP_ATTR_ASYNC && | 1198 | if ((attr == USB_ENDPOINT_SYNC_ASYNC && |
1198 | subs->direction == SNDRV_PCM_STREAM_PLAYBACK) || | 1199 | subs->direction == SNDRV_PCM_STREAM_PLAYBACK) || |
1199 | (attr == EP_ATTR_ADAPTIVE && | 1200 | (attr == USB_ENDPOINT_SYNC_ADAPTIVE && |
1200 | subs->direction == SNDRV_PCM_STREAM_CAPTURE)) | 1201 | subs->direction == SNDRV_PCM_STREAM_CAPTURE)) |
1201 | continue; | 1202 | continue; |
1202 | if ((cur_attr == EP_ATTR_ASYNC && | 1203 | if ((cur_attr == USB_ENDPOINT_SYNC_ASYNC && |
1203 | subs->direction == SNDRV_PCM_STREAM_PLAYBACK) || | 1204 | subs->direction == SNDRV_PCM_STREAM_PLAYBACK) || |
1204 | (cur_attr == EP_ATTR_ADAPTIVE && | 1205 | (cur_attr == USB_ENDPOINT_SYNC_ADAPTIVE && |
1205 | subs->direction == SNDRV_PCM_STREAM_CAPTURE)) { | 1206 | subs->direction == SNDRV_PCM_STREAM_CAPTURE)) { |
1206 | found = fp; | 1207 | found = fp; |
1207 | cur_attr = attr; | 1208 | cur_attr = attr; |
@@ -1231,11 +1232,11 @@ static int init_usb_pitch(struct usb_device *dev, int iface, | |||
1231 | 1232 | ||
1232 | ep = get_endpoint(alts, 0)->bEndpointAddress; | 1233 | ep = get_endpoint(alts, 0)->bEndpointAddress; |
1233 | /* if endpoint has pitch control, enable it */ | 1234 | /* if endpoint has pitch control, enable it */ |
1234 | if (fmt->attributes & EP_CS_ATTR_PITCH_CONTROL) { | 1235 | if (fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL) { |
1235 | data[0] = 1; | 1236 | data[0] = 1; |
1236 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, | 1237 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, |
1237 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, | 1238 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, |
1238 | PITCH_CONTROL << 8, ep, data, 1, 1000)) < 0) { | 1239 | UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, data, 1, 1000)) < 0) { |
1239 | snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n", | 1240 | snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n", |
1240 | dev->devnum, iface, ep); | 1241 | dev->devnum, iface, ep); |
1241 | return err; | 1242 | return err; |
@@ -1254,21 +1255,21 @@ static int init_usb_sample_rate(struct usb_device *dev, int iface, | |||
1254 | 1255 | ||
1255 | ep = get_endpoint(alts, 0)->bEndpointAddress; | 1256 | ep = get_endpoint(alts, 0)->bEndpointAddress; |
1256 | /* if endpoint has sampling rate control, set it */ | 1257 | /* if endpoint has sampling rate control, set it */ |
1257 | if (fmt->attributes & EP_CS_ATTR_SAMPLE_RATE) { | 1258 | if (fmt->attributes & UAC_EP_CS_ATTR_SAMPLE_RATE) { |
1258 | int crate; | 1259 | int crate; |
1259 | data[0] = rate; | 1260 | data[0] = rate; |
1260 | data[1] = rate >> 8; | 1261 | data[1] = rate >> 8; |
1261 | data[2] = rate >> 16; | 1262 | data[2] = rate >> 16; |
1262 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, | 1263 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, |
1263 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, | 1264 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, |
1264 | SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0) { | 1265 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3, 1000)) < 0) { |
1265 | snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n", | 1266 | snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n", |
1266 | dev->devnum, iface, fmt->altsetting, rate, ep); | 1267 | dev->devnum, iface, fmt->altsetting, rate, ep); |
1267 | return err; | 1268 | return err; |
1268 | } | 1269 | } |
1269 | if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, | 1270 | if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR, |
1270 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN, | 1271 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN, |
1271 | SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0) { | 1272 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3, 1000)) < 0) { |
1272 | snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n", | 1273 | snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n", |
1273 | dev->devnum, iface, fmt->altsetting, ep); | 1274 | dev->devnum, iface, fmt->altsetting, ep); |
1274 | return 0; /* some devices don't support reading */ | 1275 | return 0; /* some devices don't support reading */ |
@@ -1386,9 +1387,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) | |||
1386 | * descriptors which fool us. if it has only one EP, | 1387 | * descriptors which fool us. if it has only one EP, |
1387 | * assume it as adaptive-out or sync-in. | 1388 | * assume it as adaptive-out or sync-in. |
1388 | */ | 1389 | */ |
1389 | attr = fmt->ep_attr & EP_ATTR_MASK; | 1390 | attr = fmt->ep_attr & USB_ENDPOINT_SYNCTYPE; |
1390 | if (((is_playback && attr == EP_ATTR_ASYNC) || | 1391 | if (((is_playback && attr == USB_ENDPOINT_SYNC_ASYNC) || |
1391 | (! is_playback && attr == EP_ATTR_ADAPTIVE)) && | 1392 | (! is_playback && attr == USB_ENDPOINT_SYNC_ADAPTIVE)) && |
1392 | altsd->bNumEndpoints >= 2) { | 1393 | altsd->bNumEndpoints >= 2) { |
1393 | /* check sync-pipe endpoint */ | 1394 | /* check sync-pipe endpoint */ |
1394 | /* ... and check descriptor size before accessing bSynchAddress | 1395 | /* ... and check descriptor size before accessing bSynchAddress |
@@ -1428,7 +1429,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) | |||
1428 | } | 1429 | } |
1429 | 1430 | ||
1430 | /* always fill max packet size */ | 1431 | /* always fill max packet size */ |
1431 | if (fmt->attributes & EP_CS_ATTR_FILL_MAX) | 1432 | if (fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX) |
1432 | subs->fill_max = 1; | 1433 | subs->fill_max = 1; |
1433 | 1434 | ||
1434 | if ((err = init_usb_pitch(dev, subs->interface, alts, fmt)) < 0) | 1435 | if ((err = init_usb_pitch(dev, subs->interface, alts, fmt)) < 0) |
@@ -1886,7 +1887,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre | |||
1886 | runtime->hw.channels_min = fp->channels; | 1887 | runtime->hw.channels_min = fp->channels; |
1887 | if (runtime->hw.channels_max < fp->channels) | 1888 | if (runtime->hw.channels_max < fp->channels) |
1888 | runtime->hw.channels_max = fp->channels; | 1889 | runtime->hw.channels_max = fp->channels; |
1889 | if (fp->fmt_type == USB_FORMAT_TYPE_II && fp->frame_size > 0) { | 1890 | if (fp->fmt_type == UAC_FORMAT_TYPE_II && fp->frame_size > 0) { |
1890 | /* FIXME: there might be more than one audio formats... */ | 1891 | /* FIXME: there might be more than one audio formats... */ |
1891 | runtime->hw.period_bytes_min = runtime->hw.period_bytes_max = | 1892 | runtime->hw.period_bytes_min = runtime->hw.period_bytes_max = |
1892 | fp->frame_size; | 1893 | fp->frame_size; |
@@ -2120,7 +2121,7 @@ static struct usb_device_id usb_audio_ids [] = { | |||
2120 | #include "usbquirks.h" | 2121 | #include "usbquirks.h" |
2121 | { .match_flags = (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS), | 2122 | { .match_flags = (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS), |
2122 | .bInterfaceClass = USB_CLASS_AUDIO, | 2123 | .bInterfaceClass = USB_CLASS_AUDIO, |
2123 | .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL }, | 2124 | .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL }, |
2124 | { } /* Terminating entry */ | 2125 | { } /* Terminating entry */ |
2125 | }; | 2126 | }; |
2126 | 2127 | ||
@@ -2159,7 +2160,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s | |||
2159 | snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", | 2160 | snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", |
2160 | fp->endpoint & USB_ENDPOINT_NUMBER_MASK, | 2161 | fp->endpoint & USB_ENDPOINT_NUMBER_MASK, |
2161 | fp->endpoint & USB_DIR_IN ? "IN" : "OUT", | 2162 | fp->endpoint & USB_DIR_IN ? "IN" : "OUT", |
2162 | sync_types[(fp->ep_attr & EP_ATTR_MASK) >> 2]); | 2163 | sync_types[(fp->ep_attr & USB_ENDPOINT_SYNCTYPE) >> 2]); |
2163 | if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) { | 2164 | if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) { |
2164 | snd_iprintf(buffer, " Rates: %d - %d (continuous)\n", | 2165 | snd_iprintf(buffer, " Rates: %d - %d (continuous)\n", |
2165 | fp->rate_min, fp->rate_max); | 2166 | fp->rate_min, fp->rate_max); |
@@ -2471,11 +2472,11 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
2471 | pcm_format = -1; | 2472 | pcm_format = -1; |
2472 | 2473 | ||
2473 | switch (format) { | 2474 | switch (format) { |
2474 | case 0: /* some devices don't define this correctly... */ | 2475 | case UAC_FORMAT_TYPE_I_UNDEFINED: /* some devices don't define this correctly... */ |
2475 | snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", | 2476 | snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", |
2476 | chip->dev->devnum, fp->iface, fp->altsetting); | 2477 | chip->dev->devnum, fp->iface, fp->altsetting); |
2477 | /* fall-through */ | 2478 | /* fall-through */ |
2478 | case USB_AUDIO_FORMAT_PCM: | 2479 | case UAC_FORMAT_TYPE_I_PCM: |
2479 | if (sample_width > sample_bytes * 8) { | 2480 | if (sample_width > sample_bytes * 8) { |
2480 | snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", | 2481 | snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", |
2481 | chip->dev->devnum, fp->iface, fp->altsetting, | 2482 | chip->dev->devnum, fp->iface, fp->altsetting, |
@@ -2509,7 +2510,7 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
2509 | break; | 2510 | break; |
2510 | } | 2511 | } |
2511 | break; | 2512 | break; |
2512 | case USB_AUDIO_FORMAT_PCM8: | 2513 | case UAC_FORMAT_TYPE_I_PCM8: |
2513 | pcm_format = SNDRV_PCM_FORMAT_U8; | 2514 | pcm_format = SNDRV_PCM_FORMAT_U8; |
2514 | 2515 | ||
2515 | /* Dallas DS4201 workaround: it advertises U8 format, but really | 2516 | /* Dallas DS4201 workaround: it advertises U8 format, but really |
@@ -2517,13 +2518,13 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
2517 | if (chip->usb_id == USB_ID(0x04fa, 0x4201)) | 2518 | if (chip->usb_id == USB_ID(0x04fa, 0x4201)) |
2518 | pcm_format = SNDRV_PCM_FORMAT_S8; | 2519 | pcm_format = SNDRV_PCM_FORMAT_S8; |
2519 | break; | 2520 | break; |
2520 | case USB_AUDIO_FORMAT_IEEE_FLOAT: | 2521 | case UAC_FORMAT_TYPE_I_IEEE_FLOAT: |
2521 | pcm_format = SNDRV_PCM_FORMAT_FLOAT_LE; | 2522 | pcm_format = SNDRV_PCM_FORMAT_FLOAT_LE; |
2522 | break; | 2523 | break; |
2523 | case USB_AUDIO_FORMAT_ALAW: | 2524 | case UAC_FORMAT_TYPE_I_ALAW: |
2524 | pcm_format = SNDRV_PCM_FORMAT_A_LAW; | 2525 | pcm_format = SNDRV_PCM_FORMAT_A_LAW; |
2525 | break; | 2526 | break; |
2526 | case USB_AUDIO_FORMAT_MU_LAW: | 2527 | case UAC_FORMAT_TYPE_I_MULAW: |
2527 | pcm_format = SNDRV_PCM_FORMAT_MU_LAW; | 2528 | pcm_format = SNDRV_PCM_FORMAT_MU_LAW; |
2528 | break; | 2529 | break; |
2529 | default: | 2530 | default: |
@@ -2551,7 +2552,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
2551 | int nr_rates = fmt[offset]; | 2552 | int nr_rates = fmt[offset]; |
2552 | 2553 | ||
2553 | if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { | 2554 | if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { |
2554 | snd_printk(KERN_ERR "%d:%u:%d : invalid FORMAT_TYPE desc\n", | 2555 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", |
2555 | chip->dev->devnum, fp->iface, fp->altsetting); | 2556 | chip->dev->devnum, fp->iface, fp->altsetting); |
2556 | return -1; | 2557 | return -1; |
2557 | } | 2558 | } |
@@ -2614,7 +2615,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, | |||
2614 | int i, nr_rates, data_size, ret = 0; | 2615 | int i, nr_rates, data_size, ret = 0; |
2615 | 2616 | ||
2616 | /* get the number of sample rates first by only fetching 2 bytes */ | 2617 | /* get the number of sample rates first by only fetching 2 bytes */ |
2617 | ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), CS_RANGE, | 2618 | ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE, |
2618 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | 2619 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, |
2619 | 0x0100, chip->clock_id << 8, tmp, sizeof(tmp), 1000); | 2620 | 0x0100, chip->clock_id << 8, tmp, sizeof(tmp), 1000); |
2620 | 2621 | ||
@@ -2632,7 +2633,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, | |||
2632 | } | 2633 | } |
2633 | 2634 | ||
2634 | /* now get the full information */ | 2635 | /* now get the full information */ |
2635 | ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), CS_RANGE, | 2636 | ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE, |
2636 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | 2637 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, |
2637 | 0x0100, chip->clock_id << 8, data, data_size, 1000); | 2638 | 0x0100, chip->clock_id << 8, data, data_size, 1000); |
2638 | 2639 | ||
@@ -2682,7 +2683,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, | |||
2682 | int protocol = altsd->bInterfaceProtocol; | 2683 | int protocol = altsd->bInterfaceProtocol; |
2683 | int pcm_format, ret; | 2684 | int pcm_format, ret; |
2684 | 2685 | ||
2685 | if (fmt->bFormatType == USB_FORMAT_TYPE_III) { | 2686 | if (fmt->bFormatType == UAC_FORMAT_TYPE_III) { |
2686 | /* FIXME: the format type is really IECxxx | 2687 | /* FIXME: the format type is really IECxxx |
2687 | * but we give normal PCM format to get the existing | 2688 | * but we give normal PCM format to get the existing |
2688 | * apps working... | 2689 | * apps working... |
@@ -2745,12 +2746,12 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, | |||
2745 | int protocol = altsd->bInterfaceProtocol; | 2746 | int protocol = altsd->bInterfaceProtocol; |
2746 | 2747 | ||
2747 | switch (format) { | 2748 | switch (format) { |
2748 | case USB_AUDIO_FORMAT_AC3: | 2749 | case UAC_FORMAT_TYPE_II_AC3: |
2749 | /* FIXME: there is no AC3 format defined yet */ | 2750 | /* FIXME: there is no AC3 format defined yet */ |
2750 | // fp->format = SNDRV_PCM_FORMAT_AC3; | 2751 | // fp->format = SNDRV_PCM_FORMAT_AC3; |
2751 | fp->format = SNDRV_PCM_FORMAT_U8; /* temporarily hack to receive byte streams */ | 2752 | fp->format = SNDRV_PCM_FORMAT_U8; /* temporarily hack to receive byte streams */ |
2752 | break; | 2753 | break; |
2753 | case USB_AUDIO_FORMAT_MPEG: | 2754 | case UAC_FORMAT_TYPE_II_MPEG: |
2754 | fp->format = SNDRV_PCM_FORMAT_MPEG; | 2755 | fp->format = SNDRV_PCM_FORMAT_MPEG; |
2755 | break; | 2756 | break; |
2756 | default: | 2757 | default: |
@@ -2793,11 +2794,11 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp | |||
2793 | int err; | 2794 | int err; |
2794 | 2795 | ||
2795 | switch (fmt[3]) { | 2796 | switch (fmt[3]) { |
2796 | case USB_FORMAT_TYPE_I: | 2797 | case UAC_FORMAT_TYPE_I: |
2797 | case USB_FORMAT_TYPE_III: | 2798 | case UAC_FORMAT_TYPE_III: |
2798 | err = parse_audio_format_i(chip, fp, format, fmt, iface); | 2799 | err = parse_audio_format_i(chip, fp, format, fmt, iface); |
2799 | break; | 2800 | break; |
2800 | case USB_FORMAT_TYPE_II: | 2801 | case UAC_FORMAT_TYPE_II: |
2801 | err = parse_audio_format_ii(chip, fp, format, fmt, iface); | 2802 | err = parse_audio_format_ii(chip, fp, format, fmt, iface); |
2802 | break; | 2803 | break; |
2803 | default: | 2804 | default: |
@@ -2816,7 +2817,7 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp | |||
2816 | if (chip->usb_id == USB_ID(0x041e, 0x3000) || | 2817 | if (chip->usb_id == USB_ID(0x041e, 0x3000) || |
2817 | chip->usb_id == USB_ID(0x041e, 0x3020) || | 2818 | chip->usb_id == USB_ID(0x041e, 0x3020) || |
2818 | chip->usb_id == USB_ID(0x041e, 0x3061)) { | 2819 | chip->usb_id == USB_ID(0x041e, 0x3061)) { |
2819 | if (fmt[3] == USB_FORMAT_TYPE_I && | 2820 | if (fmt[3] == UAC_FORMAT_TYPE_I && |
2820 | fp->rates != SNDRV_PCM_RATE_48000 && | 2821 | fp->rates != SNDRV_PCM_RATE_48000 && |
2821 | fp->rates != SNDRV_PCM_RATE_96000) | 2822 | fp->rates != SNDRV_PCM_RATE_96000) |
2822 | return -1; | 2823 | return -1; |
@@ -2871,7 +2872,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2871 | /* skip invalid one */ | 2872 | /* skip invalid one */ |
2872 | if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && | 2873 | if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && |
2873 | altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || | 2874 | altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || |
2874 | (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIO_STREAMING && | 2875 | (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING && |
2875 | altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) || | 2876 | altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) || |
2876 | altsd->bNumEndpoints < 1 || | 2877 | altsd->bNumEndpoints < 1 || |
2877 | le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0) | 2878 | le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0) |
@@ -2895,16 +2896,16 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2895 | switch (protocol) { | 2896 | switch (protocol) { |
2896 | case UAC_VERSION_1: { | 2897 | case UAC_VERSION_1: { |
2897 | struct uac_as_header_descriptor_v1 *as = | 2898 | struct uac_as_header_descriptor_v1 *as = |
2898 | snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, AS_GENERAL); | 2899 | snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); |
2899 | 2900 | ||
2900 | if (!as) { | 2901 | if (!as) { |
2901 | snd_printk(KERN_ERR "%d:%u:%d : AS_GENERAL descriptor not found\n", | 2902 | snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", |
2902 | dev->devnum, iface_no, altno); | 2903 | dev->devnum, iface_no, altno); |
2903 | continue; | 2904 | continue; |
2904 | } | 2905 | } |
2905 | 2906 | ||
2906 | if (as->bLength < sizeof(*as)) { | 2907 | if (as->bLength < sizeof(*as)) { |
2907 | snd_printk(KERN_ERR "%d:%u:%d : invalid AS_GENERAL desc\n", | 2908 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", |
2908 | dev->devnum, iface_no, altno); | 2909 | dev->devnum, iface_no, altno); |
2909 | continue; | 2910 | continue; |
2910 | } | 2911 | } |
@@ -2915,16 +2916,16 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2915 | 2916 | ||
2916 | case UAC_VERSION_2: { | 2917 | case UAC_VERSION_2: { |
2917 | struct uac_as_header_descriptor_v2 *as = | 2918 | struct uac_as_header_descriptor_v2 *as = |
2918 | snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, AS_GENERAL); | 2919 | snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); |
2919 | 2920 | ||
2920 | if (!as) { | 2921 | if (!as) { |
2921 | snd_printk(KERN_ERR "%d:%u:%d : AS_GENERAL descriptor not found\n", | 2922 | snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", |
2922 | dev->devnum, iface_no, altno); | 2923 | dev->devnum, iface_no, altno); |
2923 | continue; | 2924 | continue; |
2924 | } | 2925 | } |
2925 | 2926 | ||
2926 | if (as->bLength < sizeof(*as)) { | 2927 | if (as->bLength < sizeof(*as)) { |
2927 | snd_printk(KERN_ERR "%d:%u:%d : invalid AS_GENERAL desc\n", | 2928 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", |
2928 | dev->devnum, iface_no, altno); | 2929 | dev->devnum, iface_no, altno); |
2929 | continue; | 2930 | continue; |
2930 | } | 2931 | } |
@@ -2942,15 +2943,15 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2942 | } | 2943 | } |
2943 | 2944 | ||
2944 | /* get format type */ | 2945 | /* get format type */ |
2945 | fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, FORMAT_TYPE); | 2946 | fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE); |
2946 | if (!fmt) { | 2947 | if (!fmt) { |
2947 | snd_printk(KERN_ERR "%d:%u:%d : no FORMAT_TYPE desc\n", | 2948 | snd_printk(KERN_ERR "%d:%u:%d : no UAC_FORMAT_TYPE desc\n", |
2948 | dev->devnum, iface_no, altno); | 2949 | dev->devnum, iface_no, altno); |
2949 | continue; | 2950 | continue; |
2950 | } | 2951 | } |
2951 | if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || | 2952 | if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || |
2952 | ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { | 2953 | ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { |
2953 | snd_printk(KERN_ERR "%d:%u:%d : invalid FORMAT_TYPE desc\n", | 2954 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", |
2954 | dev->devnum, iface_no, altno); | 2955 | dev->devnum, iface_no, altno); |
2955 | continue; | 2956 | continue; |
2956 | } | 2957 | } |
@@ -2972,7 +2973,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2972 | /* Creamware Noah has this descriptor after the 2nd endpoint */ | 2973 | /* Creamware Noah has this descriptor after the 2nd endpoint */ |
2973 | if (!csep && altsd->bNumEndpoints >= 2) | 2974 | if (!csep && altsd->bNumEndpoints >= 2) |
2974 | csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); | 2975 | csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); |
2975 | if (!csep || csep[0] < 7 || csep[2] != EP_GENERAL) { | 2976 | if (!csep || csep[0] < 7 || csep[2] != UAC_EP_GENERAL) { |
2976 | snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" | 2977 | snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" |
2977 | " class specific endpoint descriptor\n", | 2978 | " class specific endpoint descriptor\n", |
2978 | dev->devnum, iface_no, altno); | 2979 | dev->devnum, iface_no, altno); |
@@ -3006,12 +3007,12 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
3006 | /* Optoplay sets the sample rate attribute although | 3007 | /* Optoplay sets the sample rate attribute although |
3007 | * it seems not supporting it in fact. | 3008 | * it seems not supporting it in fact. |
3008 | */ | 3009 | */ |
3009 | fp->attributes &= ~EP_CS_ATTR_SAMPLE_RATE; | 3010 | fp->attributes &= ~UAC_EP_CS_ATTR_SAMPLE_RATE; |
3010 | break; | 3011 | break; |
3011 | case USB_ID(0x041e, 0x3020): /* Creative SB Audigy 2 NX */ | 3012 | case USB_ID(0x041e, 0x3020): /* Creative SB Audigy 2 NX */ |
3012 | case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */ | 3013 | case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */ |
3013 | /* doesn't set the sample rate attribute, but supports it */ | 3014 | /* doesn't set the sample rate attribute, but supports it */ |
3014 | fp->attributes |= EP_CS_ATTR_SAMPLE_RATE; | 3015 | fp->attributes |= UAC_EP_CS_ATTR_SAMPLE_RATE; |
3015 | break; | 3016 | break; |
3016 | case USB_ID(0x047f, 0x0ca1): /* plantronics headset */ | 3017 | case USB_ID(0x047f, 0x0ca1): /* plantronics headset */ |
3017 | case USB_ID(0x077d, 0x07af): /* Griffin iMic (note that there is | 3018 | case USB_ID(0x077d, 0x07af): /* Griffin iMic (note that there is |
@@ -3020,11 +3021,11 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
3020 | * plantronics headset and Griffin iMic have set adaptive-in | 3021 | * plantronics headset and Griffin iMic have set adaptive-in |
3021 | * although it's really not... | 3022 | * although it's really not... |
3022 | */ | 3023 | */ |
3023 | fp->ep_attr &= ~EP_ATTR_MASK; | 3024 | fp->ep_attr &= ~USB_ENDPOINT_SYNCTYPE; |
3024 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | 3025 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) |
3025 | fp->ep_attr |= EP_ATTR_ADAPTIVE; | 3026 | fp->ep_attr |= USB_ENDPOINT_SYNC_ADAPTIVE; |
3026 | else | 3027 | else |
3027 | fp->ep_attr |= EP_ATTR_SYNC; | 3028 | fp->ep_attr |= USB_ENDPOINT_SYNC_SYNC; |
3028 | break; | 3029 | break; |
3029 | } | 3030 | } |
3030 | 3031 | ||
@@ -3094,7 +3095,7 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int | |||
3094 | altsd = get_iface_desc(alts); | 3095 | altsd = get_iface_desc(alts); |
3095 | if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || | 3096 | if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || |
3096 | altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && | 3097 | altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && |
3097 | altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) { | 3098 | altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) { |
3098 | int err = snd_usbmidi_create(chip->card, iface, | 3099 | int err = snd_usbmidi_create(chip->card, iface, |
3099 | &chip->midi_list, NULL); | 3100 | &chip->midi_list, NULL); |
3100 | if (err < 0) { | 3101 | if (err < 0) { |
@@ -3109,7 +3110,7 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int | |||
3109 | 3110 | ||
3110 | if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && | 3111 | if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && |
3111 | altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || | 3112 | altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || |
3112 | altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIO_STREAMING) { | 3113 | altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) { |
3113 | snd_printdd(KERN_ERR "%d:%u:%d: skipping non-supported interface %d\n", | 3114 | snd_printdd(KERN_ERR "%d:%u:%d: skipping non-supported interface %d\n", |
3114 | dev->devnum, ctrlif, interface, altsd->bInterfaceClass); | 3115 | dev->devnum, ctrlif, interface, altsd->bInterfaceClass); |
3115 | /* skip non-supported classes */ | 3116 | /* skip non-supported classes */ |
@@ -3145,12 +3146,12 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
3145 | host_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0]; | 3146 | host_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0]; |
3146 | control_header = snd_usb_find_csint_desc(host_iface->extra, | 3147 | control_header = snd_usb_find_csint_desc(host_iface->extra, |
3147 | host_iface->extralen, | 3148 | host_iface->extralen, |
3148 | NULL, HEADER); | 3149 | NULL, UAC_HEADER); |
3149 | altsd = get_iface_desc(host_iface); | 3150 | altsd = get_iface_desc(host_iface); |
3150 | protocol = altsd->bInterfaceProtocol; | 3151 | protocol = altsd->bInterfaceProtocol; |
3151 | 3152 | ||
3152 | if (!control_header) { | 3153 | if (!control_header) { |
3153 | snd_printk(KERN_ERR "cannot find HEADER\n"); | 3154 | snd_printk(KERN_ERR "cannot find UAC_HEADER\n"); |
3154 | return -EINVAL; | 3155 | return -EINVAL; |
3155 | } | 3156 | } |
3156 | 3157 | ||
@@ -3164,7 +3165,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
3164 | } | 3165 | } |
3165 | 3166 | ||
3166 | if (h1->bLength < sizeof(*h1) + h1->bInCollection) { | 3167 | if (h1->bLength < sizeof(*h1) + h1->bInCollection) { |
3167 | snd_printk(KERN_ERR "invalid HEADER (v1)\n"); | 3168 | snd_printk(KERN_ERR "invalid UAC_HEADER (v1)\n"); |
3168 | return -EINVAL; | 3169 | return -EINVAL; |
3169 | } | 3170 | } |
3170 | 3171 | ||
@@ -3190,7 +3191,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
3190 | * clock selectors and sample rate conversion units. */ | 3191 | * clock selectors and sample rate conversion units. */ |
3191 | 3192 | ||
3192 | cs = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen, | 3193 | cs = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen, |
3193 | NULL, CLOCK_SOURCE); | 3194 | NULL, UAC_CLOCK_SOURCE); |
3194 | 3195 | ||
3195 | if (!cs) { | 3196 | if (!cs) { |
3196 | snd_printk(KERN_ERR "CLOCK_SOURCE descriptor not found\n"); | 3197 | snd_printk(KERN_ERR "CLOCK_SOURCE descriptor not found\n"); |
@@ -3302,7 +3303,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
3302 | static const struct audioformat ua_format = { | 3303 | static const struct audioformat ua_format = { |
3303 | .format = SNDRV_PCM_FORMAT_S24_3LE, | 3304 | .format = SNDRV_PCM_FORMAT_S24_3LE, |
3304 | .channels = 2, | 3305 | .channels = 2, |
3305 | .fmt_type = USB_FORMAT_TYPE_I, | 3306 | .fmt_type = UAC_FORMAT_TYPE_I, |
3306 | .altsetting = 1, | 3307 | .altsetting = 1, |
3307 | .altset_idx = 1, | 3308 | .altset_idx = 1, |
3308 | .rates = SNDRV_PCM_RATE_CONTINUOUS, | 3309 | .rates = SNDRV_PCM_RATE_CONTINUOUS, |
@@ -3394,7 +3395,7 @@ static int create_ua1000_quirk(struct snd_usb_audio *chip, | |||
3394 | { | 3395 | { |
3395 | static const struct audioformat ua1000_format = { | 3396 | static const struct audioformat ua1000_format = { |
3396 | .format = SNDRV_PCM_FORMAT_S32_LE, | 3397 | .format = SNDRV_PCM_FORMAT_S32_LE, |
3397 | .fmt_type = USB_FORMAT_TYPE_I, | 3398 | .fmt_type = UAC_FORMAT_TYPE_I, |
3398 | .altsetting = 1, | 3399 | .altsetting = 1, |
3399 | .altset_idx = 1, | 3400 | .altset_idx = 1, |
3400 | .attributes = 0, | 3401 | .attributes = 0, |