aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c374
1 files changed, 186 insertions, 188 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 22f8bb612bff..a1bd8040dea4 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -102,10 +102,6 @@ MODULE_PARM_DESC(async_unlink, "Use async unlink mode.");
102#define SYNC_URBS 4 /* always four urbs for sync */ 102#define SYNC_URBS 4 /* always four urbs for sync */
103#define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ 103#define MIN_PACKS_URB 1 /* minimum 1 packet per urb */
104 104
105typedef struct snd_usb_substream snd_usb_substream_t;
106typedef struct snd_usb_stream snd_usb_stream_t;
107typedef struct snd_urb_ctx snd_urb_ctx_t;
108
109struct audioformat { 105struct audioformat {
110 struct list_head list; 106 struct list_head list;
111 snd_pcm_format_t format; /* format type */ 107 snd_pcm_format_t format; /* format type */
@@ -125,25 +121,27 @@ struct audioformat {
125 unsigned int *rate_table; /* rate table */ 121 unsigned int *rate_table; /* rate table */
126}; 122};
127 123
124struct snd_usb_substream;
125
128struct snd_urb_ctx { 126struct snd_urb_ctx {
129 struct urb *urb; 127 struct urb *urb;
130 unsigned int buffer_size; /* size of data buffer, if data URB */ 128 unsigned int buffer_size; /* size of data buffer, if data URB */
131 snd_usb_substream_t *subs; 129 struct snd_usb_substream *subs;
132 int index; /* index for urb array */ 130 int index; /* index for urb array */
133 int packets; /* number of packets per urb */ 131 int packets; /* number of packets per urb */
134}; 132};
135 133
136struct snd_urb_ops { 134struct snd_urb_ops {
137 int (*prepare)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 135 int (*prepare)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
138 int (*retire)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 136 int (*retire)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
139 int (*prepare_sync)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 137 int (*prepare_sync)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
140 int (*retire_sync)(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime, struct urb *u); 138 int (*retire_sync)(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *u);
141}; 139};
142 140
143struct snd_usb_substream { 141struct snd_usb_substream {
144 snd_usb_stream_t *stream; 142 struct snd_usb_stream *stream;
145 struct usb_device *dev; 143 struct usb_device *dev;
146 snd_pcm_substream_t *pcm_substream; 144 struct snd_pcm_substream *pcm_substream;
147 int direction; /* playback or capture */ 145 int direction; /* playback or capture */
148 int interface; /* current interface */ 146 int interface; /* current interface */
149 int endpoint; /* assigned endpoint */ 147 int endpoint; /* assigned endpoint */
@@ -175,8 +173,8 @@ struct snd_usb_substream {
175 unsigned long unlink_mask; /* bitmask of unlinked urbs */ 173 unsigned long unlink_mask; /* bitmask of unlinked urbs */
176 174
177 unsigned int nurbs; /* # urbs */ 175 unsigned int nurbs; /* # urbs */
178 snd_urb_ctx_t dataurb[MAX_URBS]; /* data urb table */ 176 struct snd_urb_ctx dataurb[MAX_URBS]; /* data urb table */
179 snd_urb_ctx_t syncurb[SYNC_URBS]; /* sync urb table */ 177 struct snd_urb_ctx syncurb[SYNC_URBS]; /* sync urb table */
180 char *syncbuf; /* sync buffer for all sync URBs */ 178 char *syncbuf; /* sync buffer for all sync URBs */
181 dma_addr_t sync_dma; /* DMA address of syncbuf */ 179 dma_addr_t sync_dma; /* DMA address of syncbuf */
182 180
@@ -190,11 +188,11 @@ struct snd_usb_substream {
190 188
191 189
192struct snd_usb_stream { 190struct snd_usb_stream {
193 snd_usb_audio_t *chip; 191 struct snd_usb_audio *chip;
194 snd_pcm_t *pcm; 192 struct snd_pcm *pcm;
195 int pcm_index; 193 int pcm_index;
196 unsigned int fmt_type; /* USB audio format type (1-3) */ 194 unsigned int fmt_type; /* USB audio format type (1-3) */
197 snd_usb_substream_t substream[2]; 195 struct snd_usb_substream substream[2];
198 struct list_head list; 196 struct list_head list;
199}; 197};
200 198
@@ -205,7 +203,7 @@ struct snd_usb_stream {
205 */ 203 */
206 204
207static DECLARE_MUTEX(register_mutex); 205static DECLARE_MUTEX(register_mutex);
208static snd_usb_audio_t *usb_chip[SNDRV_CARDS]; 206static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
209 207
210 208
211/* 209/*
@@ -245,12 +243,12 @@ static inline unsigned get_high_speed_hz(unsigned int usb_rate)
245 * fill the length and offset of each urb descriptor. 243 * fill the length and offset of each urb descriptor.
246 * the fixed 10.14 frequency is passed through the pipe. 244 * the fixed 10.14 frequency is passed through the pipe.
247 */ 245 */
248static int prepare_capture_sync_urb(snd_usb_substream_t *subs, 246static int prepare_capture_sync_urb(struct snd_usb_substream *subs,
249 snd_pcm_runtime_t *runtime, 247 struct snd_pcm_runtime *runtime,
250 struct urb *urb) 248 struct urb *urb)
251{ 249{
252 unsigned char *cp = urb->transfer_buffer; 250 unsigned char *cp = urb->transfer_buffer;
253 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 251 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
254 252
255 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 253 urb->dev = ctx->subs->dev; /* we need to set this at each time */
256 urb->iso_frame_desc[0].length = 3; 254 urb->iso_frame_desc[0].length = 3;
@@ -267,12 +265,12 @@ static int prepare_capture_sync_urb(snd_usb_substream_t *subs,
267 * fill the length and offset of each urb descriptor. 265 * fill the length and offset of each urb descriptor.
268 * the fixed 12.13 frequency is passed as 16.16 through the pipe. 266 * the fixed 12.13 frequency is passed as 16.16 through the pipe.
269 */ 267 */
270static int prepare_capture_sync_urb_hs(snd_usb_substream_t *subs, 268static int prepare_capture_sync_urb_hs(struct snd_usb_substream *subs,
271 snd_pcm_runtime_t *runtime, 269 struct snd_pcm_runtime *runtime,
272 struct urb *urb) 270 struct urb *urb)
273{ 271{
274 unsigned char *cp = urb->transfer_buffer; 272 unsigned char *cp = urb->transfer_buffer;
275 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 273 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
276 274
277 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 275 urb->dev = ctx->subs->dev; /* we need to set this at each time */
278 urb->iso_frame_desc[0].length = 4; 276 urb->iso_frame_desc[0].length = 4;
@@ -288,8 +286,8 @@ static int prepare_capture_sync_urb_hs(snd_usb_substream_t *subs,
288 * process after capture sync complete 286 * process after capture sync complete
289 * - nothing to do 287 * - nothing to do
290 */ 288 */
291static int retire_capture_sync_urb(snd_usb_substream_t *subs, 289static int retire_capture_sync_urb(struct snd_usb_substream *subs,
292 snd_pcm_runtime_t *runtime, 290 struct snd_pcm_runtime *runtime,
293 struct urb *urb) 291 struct urb *urb)
294{ 292{
295 return 0; 293 return 0;
@@ -305,12 +303,12 @@ static int retire_capture_sync_urb(snd_usb_substream_t *subs,
305 * write onto the pcm buffer directly... the data is thus copied 303 * write onto the pcm buffer directly... the data is thus copied
306 * later at complete callback to the global buffer. 304 * later at complete callback to the global buffer.
307 */ 305 */
308static int prepare_capture_urb(snd_usb_substream_t *subs, 306static int prepare_capture_urb(struct snd_usb_substream *subs,
309 snd_pcm_runtime_t *runtime, 307 struct snd_pcm_runtime *runtime,
310 struct urb *urb) 308 struct urb *urb)
311{ 309{
312 int i, offs; 310 int i, offs;
313 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 311 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
314 312
315 offs = 0; 313 offs = 0;
316 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 314 urb->dev = ctx->subs->dev; /* we need to set this at each time */
@@ -340,8 +338,8 @@ static int prepare_capture_urb(snd_usb_substream_t *subs,
340 * copy the data from each desctiptor to the pcm buffer, and 338 * copy the data from each desctiptor to the pcm buffer, and
341 * update the current position. 339 * update the current position.
342 */ 340 */
343static int retire_capture_urb(snd_usb_substream_t *subs, 341static int retire_capture_urb(struct snd_usb_substream *subs,
344 snd_pcm_runtime_t *runtime, 342 struct snd_pcm_runtime *runtime,
345 struct urb *urb) 343 struct urb *urb)
346{ 344{
347 unsigned long flags; 345 unsigned long flags;
@@ -395,11 +393,11 @@ static int retire_capture_urb(snd_usb_substream_t *subs,
395 * set up the offset and length to receive the current frequency. 393 * set up the offset and length to receive the current frequency.
396 */ 394 */
397 395
398static int prepare_playback_sync_urb(snd_usb_substream_t *subs, 396static int prepare_playback_sync_urb(struct snd_usb_substream *subs,
399 snd_pcm_runtime_t *runtime, 397 struct snd_pcm_runtime *runtime,
400 struct urb *urb) 398 struct urb *urb)
401{ 399{
402 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 400 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
403 401
404 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 402 urb->dev = ctx->subs->dev; /* we need to set this at each time */
405 urb->iso_frame_desc[0].length = 3; 403 urb->iso_frame_desc[0].length = 3;
@@ -413,11 +411,11 @@ static int prepare_playback_sync_urb(snd_usb_substream_t *subs,
413 * set up the offset and length to receive the current frequency. 411 * set up the offset and length to receive the current frequency.
414 */ 412 */
415 413
416static int prepare_playback_sync_urb_hs(snd_usb_substream_t *subs, 414static int prepare_playback_sync_urb_hs(struct snd_usb_substream *subs,
417 snd_pcm_runtime_t *runtime, 415 struct snd_pcm_runtime *runtime,
418 struct urb *urb) 416 struct urb *urb)
419{ 417{
420 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 418 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
421 419
422 urb->dev = ctx->subs->dev; /* we need to set this at each time */ 420 urb->dev = ctx->subs->dev; /* we need to set this at each time */
423 urb->iso_frame_desc[0].length = 4; 421 urb->iso_frame_desc[0].length = 4;
@@ -431,8 +429,8 @@ static int prepare_playback_sync_urb_hs(snd_usb_substream_t *subs,
431 * retrieve the current 10.14 frequency from pipe, and set it. 429 * retrieve the current 10.14 frequency from pipe, and set it.
432 * the value is referred in prepare_playback_urb(). 430 * the value is referred in prepare_playback_urb().
433 */ 431 */
434static int retire_playback_sync_urb(snd_usb_substream_t *subs, 432static int retire_playback_sync_urb(struct snd_usb_substream *subs,
435 snd_pcm_runtime_t *runtime, 433 struct snd_pcm_runtime *runtime,
436 struct urb *urb) 434 struct urb *urb)
437{ 435{
438 unsigned int f; 436 unsigned int f;
@@ -457,8 +455,8 @@ static int retire_playback_sync_urb(snd_usb_substream_t *subs,
457 * retrieve the current 12.13 frequency from pipe, and set it. 455 * retrieve the current 12.13 frequency from pipe, and set it.
458 * the value is referred in prepare_playback_urb(). 456 * the value is referred in prepare_playback_urb().
459 */ 457 */
460static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, 458static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs,
461 snd_pcm_runtime_t *runtime, 459 struct snd_pcm_runtime *runtime,
462 struct urb *urb) 460 struct urb *urb)
463{ 461{
464 unsigned int f; 462 unsigned int f;
@@ -482,12 +480,12 @@ static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs,
482 * 480 *
483 * We don't care about (or have) any data, so we just send a transfer delimiter. 481 * We don't care about (or have) any data, so we just send a transfer delimiter.
484 */ 482 */
485static int prepare_startup_playback_urb(snd_usb_substream_t *subs, 483static int prepare_startup_playback_urb(struct snd_usb_substream *subs,
486 snd_pcm_runtime_t *runtime, 484 struct snd_pcm_runtime *runtime,
487 struct urb *urb) 485 struct urb *urb)
488{ 486{
489 unsigned int i; 487 unsigned int i;
490 snd_urb_ctx_t *ctx = urb->context; 488 struct snd_urb_ctx *ctx = urb->context;
491 489
492 urb->dev = ctx->subs->dev; 490 urb->dev = ctx->subs->dev;
493 urb->number_of_packets = subs->packs_per_ms; 491 urb->number_of_packets = subs->packs_per_ms;
@@ -507,15 +505,15 @@ static int prepare_startup_playback_urb(snd_usb_substream_t *subs,
507 * To avoid inconsistencies when updating hwptr_done, we use double buffering 505 * To avoid inconsistencies when updating hwptr_done, we use double buffering
508 * for all URBs. 506 * for all URBs.
509 */ 507 */
510static int prepare_playback_urb(snd_usb_substream_t *subs, 508static int prepare_playback_urb(struct snd_usb_substream *subs,
511 snd_pcm_runtime_t *runtime, 509 struct snd_pcm_runtime *runtime,
512 struct urb *urb) 510 struct urb *urb)
513{ 511{
514 int i, stride, offs; 512 int i, stride, offs;
515 unsigned int counts; 513 unsigned int counts;
516 unsigned long flags; 514 unsigned long flags;
517 int period_elapsed = 0; 515 int period_elapsed = 0;
518 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 516 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
519 517
520 stride = runtime->frame_bits >> 3; 518 stride = runtime->frame_bits >> 3;
521 519
@@ -597,8 +595,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs,
597 * process after playback data complete 595 * process after playback data complete
598 * - nothing to do 596 * - nothing to do
599 */ 597 */
600static int retire_playback_urb(snd_usb_substream_t *subs, 598static int retire_playback_urb(struct snd_usb_substream *subs,
601 snd_pcm_runtime_t *runtime, 599 struct snd_pcm_runtime *runtime,
602 struct urb *urb) 600 struct urb *urb)
603{ 601{
604 return 0; 602 return 0;
@@ -642,9 +640,9 @@ static struct snd_urb_ops audio_urb_ops_high_speed[2] = {
642 */ 640 */
643static void snd_complete_urb(struct urb *urb, struct pt_regs *regs) 641static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
644{ 642{
645 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 643 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
646 snd_usb_substream_t *subs = ctx->subs; 644 struct snd_usb_substream *subs = ctx->subs;
647 snd_pcm_substream_t *substream = ctx->subs->pcm_substream; 645 struct snd_pcm_substream *substream = ctx->subs->pcm_substream;
648 int err = 0; 646 int err = 0;
649 647
650 if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) || 648 if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) ||
@@ -665,9 +663,9 @@ static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
665 */ 663 */
666static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs) 664static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
667{ 665{
668 snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; 666 struct snd_urb_ctx *ctx = (struct snd_urb_ctx *)urb->context;
669 snd_usb_substream_t *subs = ctx->subs; 667 struct snd_usb_substream *subs = ctx->subs;
670 snd_pcm_substream_t *substream = ctx->subs->pcm_substream; 668 struct snd_pcm_substream *substream = ctx->subs->pcm_substream;
671 int err = 0; 669 int err = 0;
672 670
673 if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) || 671 if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) ||
@@ -684,7 +682,7 @@ static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
684 682
685 683
686/* get the physical page pointer at the given offset */ 684/* get the physical page pointer at the given offset */
687static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, 685static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
688 unsigned long offset) 686 unsigned long offset)
689{ 687{
690 void *pageptr = subs->runtime->dma_area + offset; 688 void *pageptr = subs->runtime->dma_area + offset;
@@ -692,9 +690,9 @@ static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs,
692} 690}
693 691
694/* allocate virtual buffer; may be called more than once */ 692/* allocate virtual buffer; may be called more than once */
695static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) 693static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
696{ 694{
697 snd_pcm_runtime_t *runtime = subs->runtime; 695 struct snd_pcm_runtime *runtime = subs->runtime;
698 if (runtime->dma_area) { 696 if (runtime->dma_area) {
699 if (runtime->dma_bytes >= size) 697 if (runtime->dma_bytes >= size)
700 return 0; /* already large enough */ 698 return 0; /* already large enough */
@@ -708,9 +706,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size)
708} 706}
709 707
710/* free virtual buffer; may be called more than once */ 708/* free virtual buffer; may be called more than once */
711static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) 709static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)
712{ 710{
713 snd_pcm_runtime_t *runtime = subs->runtime; 711 struct snd_pcm_runtime *runtime = subs->runtime;
714 if (runtime->dma_area) { 712 if (runtime->dma_area) {
715 vfree(runtime->dma_area); 713 vfree(runtime->dma_area);
716 runtime->dma_area = NULL; 714 runtime->dma_area = NULL;
@@ -722,7 +720,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs)
722/* 720/*
723 * unlink active urbs. 721 * unlink active urbs.
724 */ 722 */
725static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) 723static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sleep)
726{ 724{
727 unsigned int i; 725 unsigned int i;
728 int async; 726 int async;
@@ -768,7 +766,7 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep)
768/* 766/*
769 * set up and start data/sync urbs 767 * set up and start data/sync urbs
770 */ 768 */
771static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime) 769static int start_urbs(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime)
772{ 770{
773 unsigned int i; 771 unsigned int i;
774 int err; 772 int err;
@@ -824,7 +822,7 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
824/* 822/*
825 * wait until all urbs are processed. 823 * wait until all urbs are processed.
826 */ 824 */
827static int wait_clear_urbs(snd_usb_substream_t *subs) 825static int wait_clear_urbs(struct snd_usb_substream *subs)
828{ 826{
829 unsigned long end_time = jiffies + msecs_to_jiffies(1000); 827 unsigned long end_time = jiffies + msecs_to_jiffies(1000);
830 unsigned int i; 828 unsigned int i;
@@ -855,12 +853,12 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
855/* 853/*
856 * return the current pcm pointer. just return the hwptr_done value. 854 * return the current pcm pointer. just return the hwptr_done value.
857 */ 855 */
858static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) 856static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream)
859{ 857{
860 snd_usb_substream_t *subs; 858 struct snd_usb_substream *subs;
861 snd_pcm_uframes_t hwptr_done; 859 snd_pcm_uframes_t hwptr_done;
862 860
863 subs = (snd_usb_substream_t *)substream->runtime->private_data; 861 subs = (struct snd_usb_substream *)substream->runtime->private_data;
864 spin_lock(&subs->lock); 862 spin_lock(&subs->lock);
865 hwptr_done = subs->hwptr_done; 863 hwptr_done = subs->hwptr_done;
866 spin_unlock(&subs->lock); 864 spin_unlock(&subs->lock);
@@ -871,10 +869,10 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream)
871/* 869/*
872 * start/stop playback substream 870 * start/stop playback substream
873 */ 871 */
874static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream, 872static int snd_usb_pcm_playback_trigger(struct snd_pcm_substream *substream,
875 int cmd) 873 int cmd)
876{ 874{
877 snd_usb_substream_t *subs = substream->runtime->private_data; 875 struct snd_usb_substream *subs = substream->runtime->private_data;
878 876
879 switch (cmd) { 877 switch (cmd) {
880 case SNDRV_PCM_TRIGGER_START: 878 case SNDRV_PCM_TRIGGER_START:
@@ -890,10 +888,10 @@ static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream,
890/* 888/*
891 * start/stop capture substream 889 * start/stop capture substream
892 */ 890 */
893static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream, 891static int snd_usb_pcm_capture_trigger(struct snd_pcm_substream *substream,
894 int cmd) 892 int cmd)
895{ 893{
896 snd_usb_substream_t *subs = substream->runtime->private_data; 894 struct snd_usb_substream *subs = substream->runtime->private_data;
897 895
898 switch (cmd) { 896 switch (cmd) {
899 case SNDRV_PCM_TRIGGER_START: 897 case SNDRV_PCM_TRIGGER_START:
@@ -909,7 +907,7 @@ static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream,
909/* 907/*
910 * release a urb data 908 * release a urb data
911 */ 909 */
912static void release_urb_ctx(snd_urb_ctx_t *u) 910static void release_urb_ctx(struct snd_urb_ctx *u)
913{ 911{
914 if (u->urb) { 912 if (u->urb) {
915 if (u->buffer_size) 913 if (u->buffer_size)
@@ -924,7 +922,7 @@ static void release_urb_ctx(snd_urb_ctx_t *u)
924/* 922/*
925 * release a substream 923 * release a substream
926 */ 924 */
927static void release_substream_urbs(snd_usb_substream_t *subs, int force) 925static void release_substream_urbs(struct snd_usb_substream *subs, int force)
928{ 926{
929 int i; 927 int i;
930 928
@@ -945,7 +943,7 @@ static void release_substream_urbs(snd_usb_substream_t *subs, int force)
945/* 943/*
946 * initialize a substream for plaback/capture 944 * initialize a substream for plaback/capture
947 */ 945 */
948static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_bytes, 946static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int period_bytes,
949 unsigned int rate, unsigned int frame_bits) 947 unsigned int rate, unsigned int frame_bits)
950{ 948{
951 unsigned int maxsize, n, i; 949 unsigned int maxsize, n, i;
@@ -1045,7 +1043,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
1045 1043
1046 /* allocate and initialize data urbs */ 1044 /* allocate and initialize data urbs */
1047 for (i = 0; i < subs->nurbs; i++) { 1045 for (i = 0; i < subs->nurbs; i++) {
1048 snd_urb_ctx_t *u = &subs->dataurb[i]; 1046 struct snd_urb_ctx *u = &subs->dataurb[i];
1049 u->index = i; 1047 u->index = i;
1050 u->subs = subs; 1048 u->subs = subs;
1051 u->packets = npacks[i]; 1049 u->packets = npacks[i];
@@ -1074,7 +1072,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
1074 if (! subs->syncbuf) 1072 if (! subs->syncbuf)
1075 goto out_of_memory; 1073 goto out_of_memory;
1076 for (i = 0; i < SYNC_URBS; i++) { 1074 for (i = 0; i < SYNC_URBS; i++) {
1077 snd_urb_ctx_t *u = &subs->syncurb[i]; 1075 struct snd_urb_ctx *u = &subs->syncurb[i];
1078 u->index = i; 1076 u->index = i;
1079 u->subs = subs; 1077 u->subs = subs;
1080 u->packets = 1; 1078 u->packets = 1;
@@ -1104,7 +1102,7 @@ out_of_memory:
1104/* 1102/*
1105 * find a matching audio format 1103 * find a matching audio format
1106 */ 1104 */
1107static struct audioformat *find_format(snd_usb_substream_t *subs, unsigned int format, 1105static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned int format,
1108 unsigned int rate, unsigned int channels) 1106 unsigned int rate, unsigned int channels)
1109{ 1107{
1110 struct list_head *p; 1108 struct list_head *p;
@@ -1229,7 +1227,7 @@ static int init_usb_sample_rate(struct usb_device *dev, int iface,
1229/* 1227/*
1230 * find a matching format and set up the interface 1228 * find a matching format and set up the interface
1231 */ 1229 */
1232static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) 1230static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
1233{ 1231{
1234 struct usb_device *dev = subs->dev; 1232 struct usb_device *dev = subs->dev;
1235 struct usb_host_interface *alts; 1233 struct usb_host_interface *alts;
@@ -1358,10 +1356,10 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt)
1358 * if sg buffer is supported on the later version of alsa, we'll follow 1356 * if sg buffer is supported on the later version of alsa, we'll follow
1359 * that. 1357 * that.
1360 */ 1358 */
1361static int snd_usb_hw_params(snd_pcm_substream_t *substream, 1359static int snd_usb_hw_params(struct snd_pcm_substream *substream,
1362 snd_pcm_hw_params_t *hw_params) 1360 struct snd_pcm_hw_params *hw_params)
1363{ 1361{
1364 snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; 1362 struct snd_usb_substream *subs = (struct snd_usb_substream *)substream->runtime->private_data;
1365 struct audioformat *fmt; 1363 struct audioformat *fmt;
1366 unsigned int channels, rate, format; 1364 unsigned int channels, rate, format;
1367 int ret, changed; 1365 int ret, changed;
@@ -1415,9 +1413,9 @@ static int snd_usb_hw_params(snd_pcm_substream_t *substream,
1415 * 1413 *
1416 * reset the audio format and release the buffer 1414 * reset the audio format and release the buffer
1417 */ 1415 */
1418static int snd_usb_hw_free(snd_pcm_substream_t *substream) 1416static int snd_usb_hw_free(struct snd_pcm_substream *substream)
1419{ 1417{
1420 snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; 1418 struct snd_usb_substream *subs = (struct snd_usb_substream *)substream->runtime->private_data;
1421 1419
1422 subs->cur_audiofmt = NULL; 1420 subs->cur_audiofmt = NULL;
1423 subs->cur_rate = 0; 1421 subs->cur_rate = 0;
@@ -1431,10 +1429,10 @@ static int snd_usb_hw_free(snd_pcm_substream_t *substream)
1431 * 1429 *
1432 * only a few subtle things... 1430 * only a few subtle things...
1433 */ 1431 */
1434static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) 1432static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
1435{ 1433{
1436 snd_pcm_runtime_t *runtime = substream->runtime; 1434 struct snd_pcm_runtime *runtime = substream->runtime;
1437 snd_usb_substream_t *subs = runtime->private_data; 1435 struct snd_usb_substream *subs = runtime->private_data;
1438 1436
1439 if (! subs->cur_audiofmt) { 1437 if (! subs->cur_audiofmt) {
1440 snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); 1438 snd_printk(KERN_ERR "usbaudio: no format is specified!\n");
@@ -1463,7 +1461,7 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream)
1463 return 0; 1461 return 0;
1464} 1462}
1465 1463
1466static snd_pcm_hardware_t snd_usb_playback = 1464static struct snd_pcm_hardware snd_usb_playback =
1467{ 1465{
1468 .info = SNDRV_PCM_INFO_MMAP | 1466 .info = SNDRV_PCM_INFO_MMAP |
1469 SNDRV_PCM_INFO_MMAP_VALID | 1467 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1477,7 +1475,7 @@ static snd_pcm_hardware_t snd_usb_playback =
1477 .periods_max = 1024, 1475 .periods_max = 1024,
1478}; 1476};
1479 1477
1480static snd_pcm_hardware_t snd_usb_capture = 1478static struct snd_pcm_hardware snd_usb_capture =
1481{ 1479{
1482 .info = SNDRV_PCM_INFO_MMAP | 1480 .info = SNDRV_PCM_INFO_MMAP |
1483 SNDRV_PCM_INFO_MMAP_VALID | 1481 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1501,11 +1499,11 @@ static snd_pcm_hardware_t snd_usb_capture =
1501#define hwc_debug(fmt, args...) /**/ 1499#define hwc_debug(fmt, args...) /**/
1502#endif 1500#endif
1503 1501
1504static int hw_check_valid_format(snd_pcm_hw_params_t *params, struct audioformat *fp) 1502static int hw_check_valid_format(struct snd_pcm_hw_params *params, struct audioformat *fp)
1505{ 1503{
1506 snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 1504 struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
1507 snd_interval_t *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 1505 struct snd_interval *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
1508 snd_mask_t *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1506 struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
1509 1507
1510 /* check the format */ 1508 /* check the format */
1511 if (! snd_mask_test(fmts, fp->format)) { 1509 if (! snd_mask_test(fmts, fp->format)) {
@@ -1529,12 +1527,12 @@ static int hw_check_valid_format(snd_pcm_hw_params_t *params, struct audioformat
1529 return 1; 1527 return 1;
1530} 1528}
1531 1529
1532static int hw_rule_rate(snd_pcm_hw_params_t *params, 1530static int hw_rule_rate(struct snd_pcm_hw_params *params,
1533 snd_pcm_hw_rule_t *rule) 1531 struct snd_pcm_hw_rule *rule)
1534{ 1532{
1535 snd_usb_substream_t *subs = rule->private; 1533 struct snd_usb_substream *subs = rule->private;
1536 struct list_head *p; 1534 struct list_head *p;
1537 snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 1535 struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
1538 unsigned int rmin, rmax; 1536 unsigned int rmin, rmax;
1539 int changed; 1537 int changed;
1540 1538
@@ -1583,12 +1581,12 @@ static int hw_rule_rate(snd_pcm_hw_params_t *params,
1583} 1581}
1584 1582
1585 1583
1586static int hw_rule_channels(snd_pcm_hw_params_t *params, 1584static int hw_rule_channels(struct snd_pcm_hw_params *params,
1587 snd_pcm_hw_rule_t *rule) 1585 struct snd_pcm_hw_rule *rule)
1588{ 1586{
1589 snd_usb_substream_t *subs = rule->private; 1587 struct snd_usb_substream *subs = rule->private;
1590 struct list_head *p; 1588 struct list_head *p;
1591 snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 1589 struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
1592 unsigned int rmin, rmax; 1590 unsigned int rmin, rmax;
1593 int changed; 1591 int changed;
1594 1592
@@ -1636,12 +1634,12 @@ static int hw_rule_channels(snd_pcm_hw_params_t *params,
1636 return changed; 1634 return changed;
1637} 1635}
1638 1636
1639static int hw_rule_format(snd_pcm_hw_params_t *params, 1637static int hw_rule_format(struct snd_pcm_hw_params *params,
1640 snd_pcm_hw_rule_t *rule) 1638 struct snd_pcm_hw_rule *rule)
1641{ 1639{
1642 snd_usb_substream_t *subs = rule->private; 1640 struct snd_usb_substream *subs = rule->private;
1643 struct list_head *p; 1641 struct list_head *p;
1644 snd_mask_t *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1642 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
1645 u64 fbits; 1643 u64 fbits;
1646 u32 oldbits[2]; 1644 u32 oldbits[2];
1647 int changed; 1645 int changed;
@@ -1674,7 +1672,7 @@ static int hw_rule_format(snd_pcm_hw_params_t *params,
1674/* 1672/*
1675 * check whether the registered audio formats need special hw-constraints 1673 * check whether the registered audio formats need special hw-constraints
1676 */ 1674 */
1677static int check_hw_params_convention(snd_usb_substream_t *subs) 1675static int check_hw_params_convention(struct snd_usb_substream *subs)
1678{ 1676{
1679 int i; 1677 int i;
1680 u32 *channels; 1678 u32 *channels;
@@ -1758,7 +1756,7 @@ static int check_hw_params_convention(snd_usb_substream_t *subs)
1758 * set up the runtime hardware information. 1756 * set up the runtime hardware information.
1759 */ 1757 */
1760 1758
1761static int setup_hw_info(snd_pcm_runtime_t *runtime, snd_usb_substream_t *subs) 1759static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs)
1762{ 1760{
1763 struct list_head *p; 1761 struct list_head *p;
1764 int err; 1762 int err;
@@ -1819,12 +1817,12 @@ static int setup_hw_info(snd_pcm_runtime_t *runtime, snd_usb_substream_t *subs)
1819 return 0; 1817 return 0;
1820} 1818}
1821 1819
1822static int snd_usb_pcm_open(snd_pcm_substream_t *substream, int direction, 1820static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction,
1823 snd_pcm_hardware_t *hw) 1821 struct snd_pcm_hardware *hw)
1824{ 1822{
1825 snd_usb_stream_t *as = snd_pcm_substream_chip(substream); 1823 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1826 snd_pcm_runtime_t *runtime = substream->runtime; 1824 struct snd_pcm_runtime *runtime = substream->runtime;
1827 snd_usb_substream_t *subs = &as->substream[direction]; 1825 struct snd_usb_substream *subs = &as->substream[direction];
1828 1826
1829 subs->interface = -1; 1827 subs->interface = -1;
1830 subs->format = 0; 1828 subs->format = 0;
@@ -1834,10 +1832,10 @@ static int snd_usb_pcm_open(snd_pcm_substream_t *substream, int direction,
1834 return setup_hw_info(runtime, subs); 1832 return setup_hw_info(runtime, subs);
1835} 1833}
1836 1834
1837static int snd_usb_pcm_close(snd_pcm_substream_t *substream, int direction) 1835static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
1838{ 1836{
1839 snd_usb_stream_t *as = snd_pcm_substream_chip(substream); 1837 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1840 snd_usb_substream_t *subs = &as->substream[direction]; 1838 struct snd_usb_substream *subs = &as->substream[direction];
1841 1839
1842 if (subs->interface >= 0) { 1840 if (subs->interface >= 0) {
1843 usb_set_interface(subs->dev, subs->interface, 0); 1841 usb_set_interface(subs->dev, subs->interface, 0);
@@ -1847,27 +1845,27 @@ static int snd_usb_pcm_close(snd_pcm_substream_t *substream, int direction)
1847 return 0; 1845 return 0;
1848} 1846}
1849 1847
1850static int snd_usb_playback_open(snd_pcm_substream_t *substream) 1848static int snd_usb_playback_open(struct snd_pcm_substream *substream)
1851{ 1849{
1852 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_PLAYBACK, &snd_usb_playback); 1850 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_PLAYBACK, &snd_usb_playback);
1853} 1851}
1854 1852
1855static int snd_usb_playback_close(snd_pcm_substream_t *substream) 1853static int snd_usb_playback_close(struct snd_pcm_substream *substream)
1856{ 1854{
1857 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_PLAYBACK); 1855 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_PLAYBACK);
1858} 1856}
1859 1857
1860static int snd_usb_capture_open(snd_pcm_substream_t *substream) 1858static int snd_usb_capture_open(struct snd_pcm_substream *substream)
1861{ 1859{
1862 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_CAPTURE, &snd_usb_capture); 1860 return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_CAPTURE, &snd_usb_capture);
1863} 1861}
1864 1862
1865static int snd_usb_capture_close(snd_pcm_substream_t *substream) 1863static int snd_usb_capture_close(struct snd_pcm_substream *substream)
1866{ 1864{
1867 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_CAPTURE); 1865 return snd_usb_pcm_close(substream, SNDRV_PCM_STREAM_CAPTURE);
1868} 1866}
1869 1867
1870static snd_pcm_ops_t snd_usb_playback_ops = { 1868static struct snd_pcm_ops snd_usb_playback_ops = {
1871 .open = snd_usb_playback_open, 1869 .open = snd_usb_playback_open,
1872 .close = snd_usb_playback_close, 1870 .close = snd_usb_playback_close,
1873 .ioctl = snd_pcm_lib_ioctl, 1871 .ioctl = snd_pcm_lib_ioctl,
@@ -1879,7 +1877,7 @@ static snd_pcm_ops_t snd_usb_playback_ops = {
1879 .page = snd_pcm_get_vmalloc_page, 1877 .page = snd_pcm_get_vmalloc_page,
1880}; 1878};
1881 1879
1882static snd_pcm_ops_t snd_usb_capture_ops = { 1880static struct snd_pcm_ops snd_usb_capture_ops = {
1883 .open = snd_usb_capture_open, 1881 .open = snd_usb_capture_open,
1884 .close = snd_usb_capture_close, 1882 .close = snd_usb_capture_close,
1885 .ioctl = snd_pcm_lib_ioctl, 1883 .ioctl = snd_pcm_lib_ioctl,
@@ -2006,7 +2004,7 @@ static struct usb_driver usb_audio_driver = {
2006/* 2004/*
2007 * proc interface for list the supported pcm formats 2005 * proc interface for list the supported pcm formats
2008 */ 2006 */
2009static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buffer_t *buffer) 2007static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
2010{ 2008{
2011 struct list_head *p; 2009 struct list_head *p;
2012 static char *sync_types[4] = { 2010 static char *sync_types[4] = {
@@ -2042,7 +2040,7 @@ static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buff
2042 } 2040 }
2043} 2041}
2044 2042
2045static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffer_t *buffer) 2043static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
2046{ 2044{
2047 if (subs->running) { 2045 if (subs->running) {
2048 unsigned int i; 2046 unsigned int i;
@@ -2064,9 +2062,9 @@ static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffe
2064 } 2062 }
2065} 2063}
2066 2064
2067static void proc_pcm_format_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 2065static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
2068{ 2066{
2069 snd_usb_stream_t *stream = entry->private_data; 2067 struct snd_usb_stream *stream = entry->private_data;
2070 2068
2071 snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name); 2069 snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name);
2072 2070
@@ -2082,11 +2080,11 @@ static void proc_pcm_format_read(snd_info_entry_t *entry, snd_info_buffer_t *buf
2082 } 2080 }
2083} 2081}
2084 2082
2085static void proc_pcm_format_add(snd_usb_stream_t *stream) 2083static void proc_pcm_format_add(struct snd_usb_stream *stream)
2086{ 2084{
2087 snd_info_entry_t *entry; 2085 struct snd_info_entry *entry;
2088 char name[32]; 2086 char name[32];
2089 snd_card_t *card = stream->chip->card; 2087 struct snd_card *card = stream->chip->card;
2090 2088
2091 sprintf(name, "stream%d", stream->pcm_index); 2089 sprintf(name, "stream%d", stream->pcm_index);
2092 if (! snd_card_proc_new(card, name, &entry)) 2090 if (! snd_card_proc_new(card, name, &entry))
@@ -2098,9 +2096,9 @@ static void proc_pcm_format_add(snd_usb_stream_t *stream)
2098 * initialize the substream instance. 2096 * initialize the substream instance.
2099 */ 2097 */
2100 2098
2101static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat *fp) 2099static void init_substream(struct snd_usb_stream *as, int stream, struct audioformat *fp)
2102{ 2100{
2103 snd_usb_substream_t *subs = &as->substream[stream]; 2101 struct snd_usb_substream *subs = &as->substream[stream];
2104 2102
2105 INIT_LIST_HEAD(&subs->fmt_list); 2103 INIT_LIST_HEAD(&subs->fmt_list);
2106 spin_lock_init(&subs->lock); 2104 spin_lock_init(&subs->lock);
@@ -2127,7 +2125,7 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat
2127/* 2125/*
2128 * free a substream 2126 * free a substream
2129 */ 2127 */
2130static void free_substream(snd_usb_substream_t *subs) 2128static void free_substream(struct snd_usb_substream *subs)
2131{ 2129{
2132 struct list_head *p, *n; 2130 struct list_head *p, *n;
2133 2131
@@ -2144,7 +2142,7 @@ static void free_substream(snd_usb_substream_t *subs)
2144/* 2142/*
2145 * free a usb stream instance 2143 * free a usb stream instance
2146 */ 2144 */
2147static void snd_usb_audio_stream_free(snd_usb_stream_t *stream) 2145static void snd_usb_audio_stream_free(struct snd_usb_stream *stream)
2148{ 2146{
2149 free_substream(&stream->substream[0]); 2147 free_substream(&stream->substream[0]);
2150 free_substream(&stream->substream[1]); 2148 free_substream(&stream->substream[1]);
@@ -2152,9 +2150,9 @@ static void snd_usb_audio_stream_free(snd_usb_stream_t *stream)
2152 kfree(stream); 2150 kfree(stream);
2153} 2151}
2154 2152
2155static void snd_usb_audio_pcm_free(snd_pcm_t *pcm) 2153static void snd_usb_audio_pcm_free(struct snd_pcm *pcm)
2156{ 2154{
2157 snd_usb_stream_t *stream = pcm->private_data; 2155 struct snd_usb_stream *stream = pcm->private_data;
2158 if (stream) { 2156 if (stream) {
2159 stream->pcm = NULL; 2157 stream->pcm = NULL;
2160 snd_usb_audio_stream_free(stream); 2158 snd_usb_audio_stream_free(stream);
@@ -2167,16 +2165,16 @@ static void snd_usb_audio_pcm_free(snd_pcm_t *pcm)
2167 * if a stream with the same endpoint already exists, append to it. 2165 * if a stream with the same endpoint already exists, append to it.
2168 * if not, create a new pcm stream. 2166 * if not, create a new pcm stream.
2169 */ 2167 */
2170static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audioformat *fp) 2168static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct audioformat *fp)
2171{ 2169{
2172 struct list_head *p; 2170 struct list_head *p;
2173 snd_usb_stream_t *as; 2171 struct snd_usb_stream *as;
2174 snd_usb_substream_t *subs; 2172 struct snd_usb_substream *subs;
2175 snd_pcm_t *pcm; 2173 struct snd_pcm *pcm;
2176 int err; 2174 int err;
2177 2175
2178 list_for_each(p, &chip->pcm_list) { 2176 list_for_each(p, &chip->pcm_list) {
2179 as = list_entry(p, snd_usb_stream_t, list); 2177 as = list_entry(p, struct snd_usb_stream, list);
2180 if (as->fmt_type != fp->fmt_type) 2178 if (as->fmt_type != fp->fmt_type)
2181 continue; 2179 continue;
2182 subs = &as->substream[stream]; 2180 subs = &as->substream[stream];
@@ -2191,7 +2189,7 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor
2191 } 2189 }
2192 /* look for an empty stream */ 2190 /* look for an empty stream */
2193 list_for_each(p, &chip->pcm_list) { 2191 list_for_each(p, &chip->pcm_list) {
2194 as = list_entry(p, snd_usb_stream_t, list); 2192 as = list_entry(p, struct snd_usb_stream, list);
2195 if (as->fmt_type != fp->fmt_type) 2193 if (as->fmt_type != fp->fmt_type)
2196 continue; 2194 continue;
2197 subs = &as->substream[stream]; 2195 subs = &as->substream[stream];
@@ -2243,7 +2241,7 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor
2243/* 2241/*
2244 * check if the device uses big-endian samples 2242 * check if the device uses big-endian samples
2245 */ 2243 */
2246static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp) 2244static int is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp)
2247{ 2245{
2248 switch (chip->usb_id) { 2246 switch (chip->usb_id) {
2249 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */ 2247 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */
@@ -2265,7 +2263,7 @@ static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp)
2265 * @format: the format tag (wFormatTag) 2263 * @format: the format tag (wFormatTag)
2266 * @fmt: the format type descriptor 2264 * @fmt: the format type descriptor
2267 */ 2265 */
2268static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat *fp, 2266static int parse_audio_format_i_type(struct snd_usb_audio *chip, struct audioformat *fp,
2269 int format, unsigned char *fmt) 2267 int format, unsigned char *fmt)
2270{ 2268{
2271 int pcm_format; 2269 int pcm_format;
@@ -2348,7 +2346,7 @@ static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat *
2348 * @offset: the start offset of descriptor pointing the rate type 2346 * @offset: the start offset of descriptor pointing the rate type
2349 * (7 for type I and II, 8 for type II) 2347 * (7 for type I and II, 8 for type II)
2350 */ 2348 */
2351static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *fp, 2349static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioformat *fp,
2352 unsigned char *fmt, int offset) 2350 unsigned char *fmt, int offset)
2353{ 2351{
2354 int nr_rates = fmt[offset]; 2352 int nr_rates = fmt[offset];
@@ -2401,7 +2399,7 @@ static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *f
2401/* 2399/*
2402 * parse the format type I and III descriptors 2400 * parse the format type I and III descriptors
2403 */ 2401 */
2404static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp, 2402static int parse_audio_format_i(struct snd_usb_audio *chip, struct audioformat *fp,
2405 int format, unsigned char *fmt) 2403 int format, unsigned char *fmt)
2406{ 2404{
2407 int pcm_format; 2405 int pcm_format;
@@ -2430,7 +2428,7 @@ static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp,
2430/* 2428/*
2431 * prase the format type II descriptor 2429 * prase the format type II descriptor
2432 */ 2430 */
2433static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp, 2431static int parse_audio_format_ii(struct snd_usb_audio *chip, struct audioformat *fp,
2434 int format, unsigned char *fmt) 2432 int format, unsigned char *fmt)
2435{ 2433{
2436 int brate, framesize; 2434 int brate, framesize;
@@ -2457,7 +2455,7 @@ static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp,
2457 return parse_audio_format_rates(chip, fp, fmt, 8); /* fmt[8..] sample rates */ 2455 return parse_audio_format_rates(chip, fp, fmt, 8); /* fmt[8..] sample rates */
2458} 2456}
2459 2457
2460static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp, 2458static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp,
2461 int format, unsigned char *fmt, int stream) 2459 int format, unsigned char *fmt, int stream)
2462{ 2460{
2463 int err; 2461 int err;
@@ -2494,7 +2492,7 @@ static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp,
2494 return 0; 2492 return 0;
2495} 2493}
2496 2494
2497static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no) 2495static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
2498{ 2496{
2499 struct usb_device *dev; 2497 struct usb_device *dev;
2500 struct usb_interface *iface; 2498 struct usb_interface *iface;
@@ -2645,10 +2643,10 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2645static void snd_usb_stream_disconnect(struct list_head *head) 2643static void snd_usb_stream_disconnect(struct list_head *head)
2646{ 2644{
2647 int idx; 2645 int idx;
2648 snd_usb_stream_t *as; 2646 struct snd_usb_stream *as;
2649 snd_usb_substream_t *subs; 2647 struct snd_usb_substream *subs;
2650 2648
2651 as = list_entry(head, snd_usb_stream_t, list); 2649 as = list_entry(head, struct snd_usb_stream, list);
2652 for (idx = 0; idx < 2; idx++) { 2650 for (idx = 0; idx < 2; idx++) {
2653 subs = &as->substream[idx]; 2651 subs = &as->substream[idx];
2654 if (!subs->num_formats) 2652 if (!subs->num_formats)
@@ -2661,7 +2659,7 @@ static void snd_usb_stream_disconnect(struct list_head *head)
2661/* 2659/*
2662 * parse audio control descriptor and create pcm/midi streams 2660 * parse audio control descriptor and create pcm/midi streams
2663 */ 2661 */
2664static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif) 2662static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
2665{ 2663{
2666 struct usb_device *dev = chip->dev; 2664 struct usb_device *dev = chip->dev;
2667 struct usb_host_interface *host_iface; 2665 struct usb_host_interface *host_iface;
@@ -2728,9 +2726,9 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif)
2728/* 2726/*
2729 * create a stream for an endpoint/altsetting without proper descriptors 2727 * create a stream for an endpoint/altsetting without proper descriptors
2730 */ 2728 */
2731static int create_fixed_stream_quirk(snd_usb_audio_t *chip, 2729static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
2732 struct usb_interface *iface, 2730 struct usb_interface *iface,
2733 const snd_usb_audio_quirk_t *quirk) 2731 const struct snd_usb_audio_quirk *quirk)
2734{ 2732{
2735 struct audioformat *fp; 2733 struct audioformat *fp;
2736 struct usb_host_interface *alts; 2734 struct usb_host_interface *alts;
@@ -2777,9 +2775,9 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip,
2777/* 2775/*
2778 * create a stream for an interface with proper descriptors 2776 * create a stream for an interface with proper descriptors
2779 */ 2777 */
2780static int create_standard_audio_quirk(snd_usb_audio_t *chip, 2778static int create_standard_audio_quirk(struct snd_usb_audio *chip,
2781 struct usb_interface *iface, 2779 struct usb_interface *iface,
2782 const snd_usb_audio_quirk_t *quirk) 2780 const struct snd_usb_audio_quirk *quirk)
2783{ 2781{
2784 struct usb_host_interface *alts; 2782 struct usb_host_interface *alts;
2785 struct usb_interface_descriptor *altsd; 2783 struct usb_interface_descriptor *altsd;
@@ -2802,9 +2800,9 @@ static int create_standard_audio_quirk(snd_usb_audio_t *chip,
2802 * Create a stream for an Edirol UA-700/UA-25 interface. The only way 2800 * Create a stream for an Edirol UA-700/UA-25 interface. The only way
2803 * to detect the sample rate is by looking at wMaxPacketSize. 2801 * to detect the sample rate is by looking at wMaxPacketSize.
2804 */ 2802 */
2805static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, 2803static int create_ua700_ua25_quirk(struct snd_usb_audio *chip,
2806 struct usb_interface *iface, 2804 struct usb_interface *iface,
2807 const snd_usb_audio_quirk_t *quirk) 2805 const struct snd_usb_audio_quirk *quirk)
2808{ 2806{
2809 static const struct audioformat ua_format = { 2807 static const struct audioformat ua_format = {
2810 .format = SNDRV_PCM_FORMAT_S24_3LE, 2808 .format = SNDRV_PCM_FORMAT_S24_3LE,
@@ -2826,19 +2824,19 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2826 altsd = get_iface_desc(alts); 2824 altsd = get_iface_desc(alts);
2827 2825
2828 if (altsd->bNumEndpoints == 2) { 2826 if (altsd->bNumEndpoints == 2) {
2829 static const snd_usb_midi_endpoint_info_t ua700_ep = { 2827 static const struct snd_usb_midi_endpoint_info ua700_ep = {
2830 .out_cables = 0x0003, 2828 .out_cables = 0x0003,
2831 .in_cables = 0x0003 2829 .in_cables = 0x0003
2832 }; 2830 };
2833 static const snd_usb_audio_quirk_t ua700_quirk = { 2831 static const struct snd_usb_audio_quirk ua700_quirk = {
2834 .type = QUIRK_MIDI_FIXED_ENDPOINT, 2832 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2835 .data = &ua700_ep 2833 .data = &ua700_ep
2836 }; 2834 };
2837 static const snd_usb_midi_endpoint_info_t ua25_ep = { 2835 static const struct snd_usb_midi_endpoint_info ua25_ep = {
2838 .out_cables = 0x0001, 2836 .out_cables = 0x0001,
2839 .in_cables = 0x0001 2837 .in_cables = 0x0001
2840 }; 2838 };
2841 static const snd_usb_audio_quirk_t ua25_quirk = { 2839 static const struct snd_usb_audio_quirk ua25_quirk = {
2842 .type = QUIRK_MIDI_FIXED_ENDPOINT, 2840 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2843 .data = &ua25_ep 2841 .data = &ua25_ep
2844 }; 2842 };
@@ -2895,9 +2893,9 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2895/* 2893/*
2896 * Create a stream for an Edirol UA-1000 interface. 2894 * Create a stream for an Edirol UA-1000 interface.
2897 */ 2895 */
2898static int create_ua1000_quirk(snd_usb_audio_t *chip, 2896static int create_ua1000_quirk(struct snd_usb_audio *chip,
2899 struct usb_interface *iface, 2897 struct usb_interface *iface,
2900 const snd_usb_audio_quirk_t *quirk) 2898 const struct snd_usb_audio_quirk *quirk)
2901{ 2899{
2902 static const struct audioformat ua1000_format = { 2900 static const struct audioformat ua1000_format = {
2903 .format = SNDRV_PCM_FORMAT_S32_LE, 2901 .format = SNDRV_PCM_FORMAT_S32_LE,
@@ -2944,16 +2942,16 @@ static int create_ua1000_quirk(snd_usb_audio_t *chip,
2944 return 0; 2942 return 0;
2945} 2943}
2946 2944
2947static int snd_usb_create_quirk(snd_usb_audio_t *chip, 2945static int snd_usb_create_quirk(struct snd_usb_audio *chip,
2948 struct usb_interface *iface, 2946 struct usb_interface *iface,
2949 const snd_usb_audio_quirk_t *quirk); 2947 const struct snd_usb_audio_quirk *quirk);
2950 2948
2951/* 2949/*
2952 * handle the quirks for the contained interfaces 2950 * handle the quirks for the contained interfaces
2953 */ 2951 */
2954static int create_composite_quirk(snd_usb_audio_t *chip, 2952static int create_composite_quirk(struct snd_usb_audio *chip,
2955 struct usb_interface *iface, 2953 struct usb_interface *iface,
2956 const snd_usb_audio_quirk_t *quirk) 2954 const struct snd_usb_audio_quirk *quirk)
2957{ 2955{
2958 int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber; 2956 int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber;
2959 int err; 2957 int err;
@@ -2974,9 +2972,9 @@ static int create_composite_quirk(snd_usb_audio_t *chip,
2974 return 0; 2972 return 0;
2975} 2973}
2976 2974
2977static int ignore_interface_quirk(snd_usb_audio_t *chip, 2975static int ignore_interface_quirk(struct snd_usb_audio *chip,
2978 struct usb_interface *iface, 2976 struct usb_interface *iface,
2979 const snd_usb_audio_quirk_t *quirk) 2977 const struct snd_usb_audio_quirk *quirk)
2980{ 2978{
2981 return 0; 2979 return 0;
2982} 2980}
@@ -3039,12 +3037,12 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev)
3039 * after this. 3037 * after this.
3040 * returns a negative value at error. 3038 * returns a negative value at error.
3041 */ 3039 */
3042static int snd_usb_create_quirk(snd_usb_audio_t *chip, 3040static int snd_usb_create_quirk(struct snd_usb_audio *chip,
3043 struct usb_interface *iface, 3041 struct usb_interface *iface,
3044 const snd_usb_audio_quirk_t *quirk) 3042 const struct snd_usb_audio_quirk *quirk)
3045{ 3043{
3046 typedef int (*quirk_func_t)(snd_usb_audio_t *, struct usb_interface *, 3044 typedef int (*quirk_func_t)(struct snd_usb_audio *, struct usb_interface *,
3047 const snd_usb_audio_quirk_t *); 3045 const struct snd_usb_audio_quirk *);
3048 static const quirk_func_t quirk_funcs[] = { 3046 static const quirk_func_t quirk_funcs[] = {
3049 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, 3047 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
3050 [QUIRK_COMPOSITE] = create_composite_quirk, 3048 [QUIRK_COMPOSITE] = create_composite_quirk,
@@ -3074,25 +3072,25 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip,
3074/* 3072/*
3075 * common proc files to show the usb device info 3073 * common proc files to show the usb device info
3076 */ 3074 */
3077static void proc_audio_usbbus_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 3075static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3078{ 3076{
3079 snd_usb_audio_t *chip = entry->private_data; 3077 struct snd_usb_audio *chip = entry->private_data;
3080 if (! chip->shutdown) 3078 if (! chip->shutdown)
3081 snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum); 3079 snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum);
3082} 3080}
3083 3081
3084static void proc_audio_usbid_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 3082static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3085{ 3083{
3086 snd_usb_audio_t *chip = entry->private_data; 3084 struct snd_usb_audio *chip = entry->private_data;
3087 if (! chip->shutdown) 3085 if (! chip->shutdown)
3088 snd_iprintf(buffer, "%04x:%04x\n", 3086 snd_iprintf(buffer, "%04x:%04x\n",
3089 USB_ID_VENDOR(chip->usb_id), 3087 USB_ID_VENDOR(chip->usb_id),
3090 USB_ID_PRODUCT(chip->usb_id)); 3088 USB_ID_PRODUCT(chip->usb_id));
3091} 3089}
3092 3090
3093static void snd_usb_audio_create_proc(snd_usb_audio_t *chip) 3091static void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
3094{ 3092{
3095 snd_info_entry_t *entry; 3093 struct snd_info_entry *entry;
3096 if (! snd_card_proc_new(chip->card, "usbbus", &entry)) 3094 if (! snd_card_proc_new(chip->card, "usbbus", &entry))
3097 snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbbus_read); 3095 snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbbus_read);
3098 if (! snd_card_proc_new(chip->card, "usbid", &entry)) 3096 if (! snd_card_proc_new(chip->card, "usbid", &entry))
@@ -3106,15 +3104,15 @@ static void snd_usb_audio_create_proc(snd_usb_audio_t *chip)
3106 * 3104 *
3107 */ 3105 */
3108 3106
3109static int snd_usb_audio_free(snd_usb_audio_t *chip) 3107static int snd_usb_audio_free(struct snd_usb_audio *chip)
3110{ 3108{
3111 kfree(chip); 3109 kfree(chip);
3112 return 0; 3110 return 0;
3113} 3111}
3114 3112
3115static int snd_usb_audio_dev_free(snd_device_t *device) 3113static int snd_usb_audio_dev_free(struct snd_device *device)
3116{ 3114{
3117 snd_usb_audio_t *chip = device->device_data; 3115 struct snd_usb_audio *chip = device->device_data;
3118 return snd_usb_audio_free(chip); 3116 return snd_usb_audio_free(chip);
3119} 3117}
3120 3118
@@ -3123,14 +3121,14 @@ static int snd_usb_audio_dev_free(snd_device_t *device)
3123 * create a chip instance and set its names. 3121 * create a chip instance and set its names.
3124 */ 3122 */
3125static int snd_usb_audio_create(struct usb_device *dev, int idx, 3123static int snd_usb_audio_create(struct usb_device *dev, int idx,
3126 const snd_usb_audio_quirk_t *quirk, 3124 const struct snd_usb_audio_quirk *quirk,
3127 snd_usb_audio_t **rchip) 3125 struct snd_usb_audio **rchip)
3128{ 3126{
3129 snd_card_t *card; 3127 struct snd_card *card;
3130 snd_usb_audio_t *chip; 3128 struct snd_usb_audio *chip;
3131 int err, len; 3129 int err, len;
3132 char component[14]; 3130 char component[14];
3133 static snd_device_ops_t ops = { 3131 static struct snd_device_ops ops = {
3134 .dev_free = snd_usb_audio_dev_free, 3132 .dev_free = snd_usb_audio_dev_free,
3135 }; 3133 };
3136 3134
@@ -3234,9 +3232,9 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3234 struct usb_interface *intf, 3232 struct usb_interface *intf,
3235 const struct usb_device_id *usb_id) 3233 const struct usb_device_id *usb_id)
3236{ 3234{
3237 const snd_usb_audio_quirk_t *quirk = (const snd_usb_audio_quirk_t *)usb_id->driver_info; 3235 const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info;
3238 int i, err; 3236 int i, err;
3239 snd_usb_audio_t *chip; 3237 struct snd_usb_audio *chip;
3240 struct usb_host_interface *alts; 3238 struct usb_host_interface *alts;
3241 int ifnum; 3239 int ifnum;
3242 u32 id; 3240 u32 id;
@@ -3337,8 +3335,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3337 */ 3335 */
3338static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) 3336static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
3339{ 3337{
3340 snd_usb_audio_t *chip; 3338 struct snd_usb_audio *chip;
3341 snd_card_t *card; 3339 struct snd_card *card;
3342 struct list_head *p; 3340 struct list_head *p;
3343 3341
3344 if (ptr == (void *)-1L) 3342 if (ptr == (void *)-1L)