aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usx2y/usx2yhwdeppcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usx2y/usx2yhwdeppcm.c')
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c171
1 files changed, 92 insertions, 79 deletions
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index c5379280fab7..796a7dcef09d 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -58,12 +58,12 @@
58#include <sound/hwdep.h> 58#include <sound/hwdep.h>
59 59
60 60
61static int usX2Y_usbpcm_urb_capt_retire(snd_usX2Y_substream_t *subs) 61static int usX2Y_usbpcm_urb_capt_retire(struct snd_usX2Y_substream *subs)
62{ 62{
63 struct urb *urb = subs->completed_urb; 63 struct urb *urb = subs->completed_urb;
64 snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; 64 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
65 int i, lens = 0, hwptr_done = subs->hwptr_done; 65 int i, lens = 0, hwptr_done = subs->hwptr_done;
66 usX2Ydev_t *usX2Y = subs->usX2Y; 66 struct usX2Ydev *usX2Y = subs->usX2Y;
67 if (0 > usX2Y->hwdep_pcm_shm->capture_iso_start) { //FIXME 67 if (0 > usX2Y->hwdep_pcm_shm->capture_iso_start) { //FIXME
68 int head = usX2Y->hwdep_pcm_shm->captured_iso_head + 1; 68 int head = usX2Y->hwdep_pcm_shm->captured_iso_head + 1;
69 if (head >= ARRAY_SIZE(usX2Y->hwdep_pcm_shm->captured_iso)) 69 if (head >= ARRAY_SIZE(usX2Y->hwdep_pcm_shm->captured_iso))
@@ -90,7 +90,8 @@ static int usX2Y_usbpcm_urb_capt_retire(snd_usX2Y_substream_t *subs)
90 return 0; 90 return 0;
91} 91}
92 92
93static inline int usX2Y_iso_frames_per_buffer(snd_pcm_runtime_t *runtime, usX2Ydev_t * usX2Y) 93static inline int usX2Y_iso_frames_per_buffer(struct snd_pcm_runtime *runtime,
94 struct usX2Ydev * usX2Y)
94{ 95{
95 return (runtime->buffer_size * 1000) / usX2Y->rate + 1; //FIXME: so far only correct period_size == 2^x ? 96 return (runtime->buffer_size * 1000) / usX2Y->rate + 1; //FIXME: so far only correct period_size == 2^x ?
96} 97}
@@ -105,13 +106,13 @@ static inline int usX2Y_iso_frames_per_buffer(snd_pcm_runtime_t *runtime, usX2Yd
105 * it directly from the buffer. thus the data is once copied to 106 * it directly from the buffer. thus the data is once copied to
106 * a temporary buffer and urb points to that. 107 * a temporary buffer and urb points to that.
107 */ 108 */
108static int usX2Y_hwdep_urb_play_prepare(snd_usX2Y_substream_t *subs, 109static int usX2Y_hwdep_urb_play_prepare(struct snd_usX2Y_substream *subs,
109 struct urb *urb) 110 struct urb *urb)
110{ 111{
111 int count, counts, pack; 112 int count, counts, pack;
112 usX2Ydev_t *usX2Y = subs->usX2Y; 113 struct usX2Ydev *usX2Y = subs->usX2Y;
113 struct snd_usX2Y_hwdep_pcm_shm *shm = usX2Y->hwdep_pcm_shm; 114 struct snd_usX2Y_hwdep_pcm_shm *shm = usX2Y->hwdep_pcm_shm;
114 snd_pcm_runtime_t *runtime = subs->pcm_substream->runtime; 115 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
115 116
116 if (0 > shm->playback_iso_start) { 117 if (0 > shm->playback_iso_start) {
117 shm->playback_iso_start = shm->captured_iso_head - 118 shm->playback_iso_start = shm->captured_iso_head -
@@ -144,13 +145,14 @@ static int usX2Y_hwdep_urb_play_prepare(snd_usX2Y_substream_t *subs,
144} 145}
145 146
146 147
147static inline void usX2Y_usbpcm_urb_capt_iso_advance(snd_usX2Y_substream_t *subs, struct urb *urb) 148static inline void usX2Y_usbpcm_urb_capt_iso_advance(struct snd_usX2Y_substream *subs,
149 struct urb *urb)
148{ 150{
149 int pack; 151 int pack;
150 for (pack = 0; pack < nr_of_packs(); ++pack) { 152 for (pack = 0; pack < nr_of_packs(); ++pack) {
151 struct usb_iso_packet_descriptor *desc = urb->iso_frame_desc + pack; 153 struct usb_iso_packet_descriptor *desc = urb->iso_frame_desc + pack;
152 if (NULL != subs) { 154 if (NULL != subs) {
153 snd_usX2Y_hwdep_pcm_shm_t *shm = subs->usX2Y->hwdep_pcm_shm; 155 struct snd_usX2Y_hwdep_pcm_shm *shm = subs->usX2Y->hwdep_pcm_shm;
154 int head = shm->captured_iso_head + 1; 156 int head = shm->captured_iso_head + 1;
155 if (head >= ARRAY_SIZE(shm->captured_iso)) 157 if (head >= ARRAY_SIZE(shm->captured_iso))
156 head = 0; 158 head = 0;
@@ -166,9 +168,10 @@ static inline void usX2Y_usbpcm_urb_capt_iso_advance(snd_usX2Y_substream_t *subs
166 } 168 }
167} 169}
168 170
169static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, 171static inline int usX2Y_usbpcm_usbframe_complete(struct snd_usX2Y_substream *capsubs,
170 snd_usX2Y_substream_t *capsubs2, 172 struct snd_usX2Y_substream *capsubs2,
171 snd_usX2Y_substream_t *playbacksubs, int frame) 173 struct snd_usX2Y_substream *playbacksubs,
174 int frame)
172{ 175{
173 int err, state; 176 int err, state;
174 struct urb *urb = playbacksubs->completed_urb; 177 struct urb *urb = playbacksubs->completed_urb;
@@ -225,12 +228,15 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs,
225 228
226static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs) 229static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs)
227{ 230{
228 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; 231 struct snd_usX2Y_substream *subs = urb->context;
229 usX2Ydev_t *usX2Y = subs->usX2Y; 232 struct usX2Ydev *usX2Y = subs->usX2Y;
230 snd_usX2Y_substream_t *capsubs, *capsubs2, *playbacksubs; 233 struct snd_usX2Y_substream *capsubs, *capsubs2, *playbacksubs;
231 234
232 if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { 235 if (unlikely(atomic_read(&subs->state) < state_PREPARED)) {
233 snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", usb_get_current_frame_number(usX2Y->chip.dev), subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", urb->status, urb->start_frame); 236 snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
237 usb_get_current_frame_number(usX2Y->chip.dev),
238 subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
239 urb->status, urb->start_frame);
234 return; 240 return;
235 } 241 }
236 if (unlikely(urb->status)) { 242 if (unlikely(urb->status)) {
@@ -264,7 +270,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs)
264} 270}
265 271
266 272
267static void usX2Y_hwdep_urb_release(struct urb** urb) 273static void usX2Y_hwdep_urb_release(struct urb **urb)
268{ 274{
269 usb_kill_urb(*urb); 275 usb_kill_urb(*urb);
270 usb_free_urb(*urb); 276 usb_free_urb(*urb);
@@ -274,7 +280,7 @@ static void usX2Y_hwdep_urb_release(struct urb** urb)
274/* 280/*
275 * release a substream 281 * release a substream
276 */ 282 */
277static void usX2Y_usbpcm_urbs_release(snd_usX2Y_substream_t *subs) 283static void usX2Y_usbpcm_urbs_release(struct snd_usX2Y_substream *subs)
278{ 284{
279 int i; 285 int i;
280 snd_printdd("snd_usX2Y_urbs_release() %i\n", subs->endpoint); 286 snd_printdd("snd_usX2Y_urbs_release() %i\n", subs->endpoint);
@@ -282,7 +288,7 @@ static void usX2Y_usbpcm_urbs_release(snd_usX2Y_substream_t *subs)
282 usX2Y_hwdep_urb_release(subs->urb + i); 288 usX2Y_hwdep_urb_release(subs->urb + i);
283} 289}
284 290
285static void usX2Y_usbpcm_subs_startup_finish(usX2Ydev_t * usX2Y) 291static void usX2Y_usbpcm_subs_startup_finish(struct usX2Ydev * usX2Y)
286{ 292{
287 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_urb_complete); 293 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_urb_complete);
288 usX2Y->prepare_subs = NULL; 294 usX2Y->prepare_subs = NULL;
@@ -290,14 +296,14 @@ static void usX2Y_usbpcm_subs_startup_finish(usX2Ydev_t * usX2Y)
290 296
291static void i_usX2Y_usbpcm_subs_startup(struct urb *urb, struct pt_regs *regs) 297static void i_usX2Y_usbpcm_subs_startup(struct urb *urb, struct pt_regs *regs)
292{ 298{
293 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t*)urb->context; 299 struct snd_usX2Y_substream *subs = urb->context;
294 usX2Ydev_t *usX2Y = subs->usX2Y; 300 struct usX2Ydev *usX2Y = subs->usX2Y;
295 snd_usX2Y_substream_t *prepare_subs = usX2Y->prepare_subs; 301 struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs;
296 if (NULL != prepare_subs && 302 if (NULL != prepare_subs &&
297 urb->start_frame == prepare_subs->urb[0]->start_frame) { 303 urb->start_frame == prepare_subs->urb[0]->start_frame) {
298 atomic_inc(&prepare_subs->state); 304 atomic_inc(&prepare_subs->state);
299 if (prepare_subs == usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]) { 305 if (prepare_subs == usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]) {
300 snd_usX2Y_substream_t *cap_subs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; 306 struct snd_usX2Y_substream *cap_subs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2];
301 if (cap_subs2 != NULL) 307 if (cap_subs2 != NULL)
302 atomic_inc(&cap_subs2->state); 308 atomic_inc(&cap_subs2->state);
303 } 309 }
@@ -311,7 +317,7 @@ static void i_usX2Y_usbpcm_subs_startup(struct urb *urb, struct pt_regs *regs)
311/* 317/*
312 * initialize a substream's urbs 318 * initialize a substream's urbs
313 */ 319 */
314static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs) 320static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs)
315{ 321{
316 int i; 322 int i;
317 unsigned int pipe; 323 unsigned int pipe;
@@ -355,16 +361,16 @@ static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs)
355/* 361/*
356 * free the buffer 362 * free the buffer
357 */ 363 */
358static int snd_usX2Y_usbpcm_hw_free(snd_pcm_substream_t *substream) 364static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream)
359{ 365{
360 snd_pcm_runtime_t *runtime = substream->runtime; 366 struct snd_pcm_runtime *runtime = substream->runtime;
361 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data, 367 struct snd_usX2Y_substream *subs = runtime->private_data,
362 *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; 368 *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2];
363 down(&subs->usX2Y->prepare_mutex); 369 down(&subs->usX2Y->prepare_mutex);
364 snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream); 370 snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream);
365 371
366 if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { 372 if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
367 snd_usX2Y_substream_t *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; 373 struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE];
368 atomic_set(&subs->state, state_STOPPED); 374 atomic_set(&subs->state, state_STOPPED);
369 usX2Y_usbpcm_urbs_release(subs); 375 usX2Y_usbpcm_urbs_release(subs);
370 if (!cap_subs->pcm_substream || 376 if (!cap_subs->pcm_substream ||
@@ -379,7 +385,7 @@ static int snd_usX2Y_usbpcm_hw_free(snd_pcm_substream_t *substream)
379 usX2Y_usbpcm_urbs_release(cap_subs2); 385 usX2Y_usbpcm_urbs_release(cap_subs2);
380 } 386 }
381 } else { 387 } else {
382 snd_usX2Y_substream_t *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; 388 struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
383 if (atomic_read(&playback_subs->state) < state_PREPARED) { 389 if (atomic_read(&playback_subs->state) < state_PREPARED) {
384 atomic_set(&subs->state, state_STOPPED); 390 atomic_set(&subs->state, state_STOPPED);
385 if (NULL != cap_subs2) 391 if (NULL != cap_subs2)
@@ -393,20 +399,20 @@ static int snd_usX2Y_usbpcm_hw_free(snd_pcm_substream_t *substream)
393 return snd_pcm_lib_free_pages(substream); 399 return snd_pcm_lib_free_pages(substream);
394} 400}
395 401
396static void usX2Y_usbpcm_subs_startup(snd_usX2Y_substream_t *subs) 402static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs)
397{ 403{
398 usX2Ydev_t * usX2Y = subs->usX2Y; 404 struct usX2Ydev * usX2Y = subs->usX2Y;
399 usX2Y->prepare_subs = subs; 405 usX2Y->prepare_subs = subs;
400 subs->urb[0]->start_frame = -1; 406 subs->urb[0]->start_frame = -1;
401 smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup() 407 smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup()
402 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); 408 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup);
403} 409}
404 410
405static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs) 411static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
406{ 412{
407 int p, u, err, 413 int p, u, err,
408 stream = subs->pcm_substream->stream; 414 stream = subs->pcm_substream->stream;
409 usX2Ydev_t *usX2Y = subs->usX2Y; 415 struct usX2Ydev *usX2Y = subs->usX2Y;
410 416
411 if (SNDRV_PCM_STREAM_CAPTURE == stream) { 417 if (SNDRV_PCM_STREAM_CAPTURE == stream) {
412 usX2Y->hwdep_pcm_shm->captured_iso_head = -1; 418 usX2Y->hwdep_pcm_shm->captured_iso_head = -1;
@@ -414,7 +420,7 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs)
414 } 420 }
415 421
416 for (p = 0; 3 >= (stream + p); p += 2) { 422 for (p = 0; 3 >= (stream + p); p += 2) {
417 snd_usX2Y_substream_t *subs = usX2Y->subs[stream + p]; 423 struct snd_usX2Y_substream *subs = usX2Y->subs[stream + p];
418 if (subs != NULL) { 424 if (subs != NULL) {
419 if ((err = usX2Y_usbpcm_urbs_allocate(subs)) < 0) 425 if ((err = usX2Y_usbpcm_urbs_allocate(subs)) < 0)
420 return err; 426 return err;
@@ -423,7 +429,7 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs)
423 } 429 }
424 430
425 for (p = 0; p < 4; p++) { 431 for (p = 0; p < 4; p++) {
426 snd_usX2Y_substream_t *subs = usX2Y->subs[p]; 432 struct snd_usX2Y_substream *subs = usX2Y->subs[p];
427 if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) 433 if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
428 goto start; 434 goto start;
429 } 435 }
@@ -433,7 +439,7 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs)
433 usX2Y_usbpcm_subs_startup(subs); 439 usX2Y_usbpcm_subs_startup(subs);
434 for (u = 0; u < NRURBS; u++) { 440 for (u = 0; u < NRURBS; u++) {
435 for (p = 0; 3 >= (stream + p); p += 2) { 441 for (p = 0; 3 >= (stream + p); p += 2) {
436 snd_usX2Y_substream_t *subs = usX2Y->subs[stream + p]; 442 struct snd_usX2Y_substream *subs = usX2Y->subs[stream + p];
437 if (subs != NULL) { 443 if (subs != NULL) {
438 struct urb *urb = subs->urb[u]; 444 struct urb *urb = subs->urb[u];
439 if (usb_pipein(urb->pipe)) { 445 if (usb_pipein(urb->pipe)) {
@@ -482,19 +488,19 @@ static int usX2Y_usbpcm_urbs_start(snd_usX2Y_substream_t *subs)
482 * 488 *
483 * set format and initialize urbs 489 * set format and initialize urbs
484 */ 490 */
485static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) 491static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream)
486{ 492{
487 snd_pcm_runtime_t *runtime = substream->runtime; 493 struct snd_pcm_runtime *runtime = substream->runtime;
488 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; 494 struct snd_usX2Y_substream *subs = runtime->private_data;
489 usX2Ydev_t *usX2Y = subs->usX2Y; 495 struct usX2Ydev *usX2Y = subs->usX2Y;
490 snd_usX2Y_substream_t *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; 496 struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE];
491 int err = 0; 497 int err = 0;
492 snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); 498 snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream);
493 499
494 if (NULL == usX2Y->hwdep_pcm_shm) { 500 if (NULL == usX2Y->hwdep_pcm_shm) {
495 if (NULL == (usX2Y->hwdep_pcm_shm = snd_malloc_pages(sizeof(snd_usX2Y_hwdep_pcm_shm_t), GFP_KERNEL))) 501 if (NULL == (usX2Y->hwdep_pcm_shm = snd_malloc_pages(sizeof(struct snd_usX2Y_hwdep_pcm_shm), GFP_KERNEL)))
496 return -ENOMEM; 502 return -ENOMEM;
497 memset(usX2Y->hwdep_pcm_shm, 0, sizeof(snd_usX2Y_hwdep_pcm_shm_t)); 503 memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm));
498 } 504 }
499 505
500 down(&usX2Y->prepare_mutex); 506 down(&usX2Y->prepare_mutex);
@@ -508,7 +514,8 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream)
508 if (usX2Y->rate != runtime->rate) 514 if (usX2Y->rate != runtime->rate)
509 if ((err = usX2Y_rate_set(usX2Y, runtime->rate)) < 0) 515 if ((err = usX2Y_rate_set(usX2Y, runtime->rate)) < 0)
510 goto up_prepare_mutex; 516 goto up_prepare_mutex;
511 snd_printdd("starting capture pipe for %s\n", subs == capsubs ? "self" : "playpipe"); 517 snd_printdd("starting capture pipe for %s\n", subs == capsubs ?
518 "self" : "playpipe");
512 if (0 > (err = usX2Y_usbpcm_urbs_start(capsubs))) 519 if (0 > (err = usX2Y_usbpcm_urbs_start(capsubs)))
513 goto up_prepare_mutex; 520 goto up_prepare_mutex;
514 } 521 }
@@ -516,8 +523,12 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream)
516 if (subs != capsubs) { 523 if (subs != capsubs) {
517 usX2Y->hwdep_pcm_shm->playback_iso_start = -1; 524 usX2Y->hwdep_pcm_shm->playback_iso_start = -1;
518 if (atomic_read(&subs->state) < state_PREPARED) { 525 if (atomic_read(&subs->state) < state_PREPARED) {
519 while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { 526 while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) >
520 snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); 527 usX2Y->hwdep_pcm_shm->captured_iso_frames) {
528 snd_printdd("Wait: iso_frames_per_buffer=%i,"
529 "captured_iso_frames=%i\n",
530 usX2Y_iso_frames_per_buffer(runtime, usX2Y),
531 usX2Y->hwdep_pcm_shm->captured_iso_frames);
521 if (msleep_interruptible(10)) { 532 if (msleep_interruptible(10)) {
522 err = -ERESTARTSYS; 533 err = -ERESTARTSYS;
523 goto up_prepare_mutex; 534 goto up_prepare_mutex;
@@ -526,7 +537,9 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream)
526 if (0 > (err = usX2Y_usbpcm_urbs_start(subs))) 537 if (0 > (err = usX2Y_usbpcm_urbs_start(subs)))
527 goto up_prepare_mutex; 538 goto up_prepare_mutex;
528 } 539 }
529 snd_printd("Ready: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); 540 snd_printdd("Ready: iso_frames_per_buffer=%i,captured_iso_frames=%i\n",
541 usX2Y_iso_frames_per_buffer(runtime, usX2Y),
542 usX2Y->hwdep_pcm_shm->captured_iso_frames);
530 } else 543 } else
531 usX2Y->hwdep_pcm_shm->capture_iso_start = -1; 544 usX2Y->hwdep_pcm_shm->capture_iso_start = -1;
532 545
@@ -535,7 +548,7 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream)
535 return err; 548 return err;
536} 549}
537 550
538static snd_pcm_hardware_t snd_usX2Y_4c = 551static struct snd_pcm_hardware snd_usX2Y_4c =
539{ 552{
540 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 553 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
541 SNDRV_PCM_INFO_BLOCK_TRANSFER | 554 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -556,11 +569,11 @@ static snd_pcm_hardware_t snd_usX2Y_4c =
556 569
557 570
558 571
559static int snd_usX2Y_usbpcm_open(snd_pcm_substream_t *substream) 572static int snd_usX2Y_usbpcm_open(struct snd_pcm_substream *substream)
560{ 573{
561 snd_usX2Y_substream_t *subs = ((snd_usX2Y_substream_t **) 574 struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **)
562 snd_pcm_substream_chip(substream))[substream->stream]; 575 snd_pcm_substream_chip(substream))[substream->stream];
563 snd_pcm_runtime_t *runtime = substream->runtime; 576 struct snd_pcm_runtime *runtime = substream->runtime;
564 577
565 if (!(subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS)) 578 if (!(subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS))
566 return -EBUSY; 579 return -EBUSY;
@@ -574,17 +587,17 @@ static int snd_usX2Y_usbpcm_open(snd_pcm_substream_t *substream)
574} 587}
575 588
576 589
577static int snd_usX2Y_usbpcm_close(snd_pcm_substream_t *substream) 590static int snd_usX2Y_usbpcm_close(struct snd_pcm_substream *substream)
578{ 591{
579 snd_pcm_runtime_t *runtime = substream->runtime; 592 struct snd_pcm_runtime *runtime = substream->runtime;
580 snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; 593 struct snd_usX2Y_substream *subs = runtime->private_data;
581 594
582 subs->pcm_substream = NULL; 595 subs->pcm_substream = NULL;
583 return 0; 596 return 0;
584} 597}
585 598
586 599
587static snd_pcm_ops_t snd_usX2Y_usbpcm_ops = 600static struct snd_pcm_ops snd_usX2Y_usbpcm_ops =
588{ 601{
589 .open = snd_usX2Y_usbpcm_open, 602 .open = snd_usX2Y_usbpcm_open,
590 .close = snd_usX2Y_usbpcm_close, 603 .close = snd_usX2Y_usbpcm_close,
@@ -597,11 +610,11 @@ static snd_pcm_ops_t snd_usX2Y_usbpcm_ops =
597}; 610};
598 611
599 612
600static int usX2Y_pcms_lock_check(snd_card_t *card) 613static int usX2Y_pcms_lock_check(struct snd_card *card)
601{ 614{
602 struct list_head *list; 615 struct list_head *list;
603 snd_device_t *dev; 616 struct snd_device *dev;
604 snd_pcm_t *pcm; 617 struct snd_pcm *pcm;
605 int err = 0; 618 int err = 0;
606 list_for_each(list, &card->devices) { 619 list_for_each(list, &card->devices) {
607 dev = snd_device(list); 620 dev = snd_device(list);
@@ -617,7 +630,7 @@ static int usX2Y_pcms_lock_check(snd_card_t *card)
617 continue; 630 continue;
618 pcm = dev->device_data; 631 pcm = dev->device_data;
619 for (s = 0; s < 2; ++s) { 632 for (s = 0; s < 2; ++s) {
620 snd_pcm_substream_t *substream; 633 struct snd_pcm_substream *substream;
621 substream = pcm->streams[s].substream; 634 substream = pcm->streams[s].substream;
622 if (substream && substream->ffile != NULL) 635 if (substream && substream->ffile != NULL)
623 err = -EBUSY; 636 err = -EBUSY;
@@ -627,11 +640,11 @@ static int usX2Y_pcms_lock_check(snd_card_t *card)
627} 640}
628 641
629 642
630static void usX2Y_pcms_unlock(snd_card_t *card) 643static void usX2Y_pcms_unlock(struct snd_card *card)
631{ 644{
632 struct list_head *list; 645 struct list_head *list;
633 snd_device_t *dev; 646 struct snd_device *dev;
634 snd_pcm_t *pcm; 647 struct snd_pcm *pcm;
635 list_for_each(list, &card->devices) { 648 list_for_each(list, &card->devices) {
636 dev = snd_device(list); 649 dev = snd_device(list);
637 if (dev->type != SNDRV_DEV_PCM) 650 if (dev->type != SNDRV_DEV_PCM)
@@ -642,10 +655,10 @@ static void usX2Y_pcms_unlock(snd_card_t *card)
642} 655}
643 656
644 657
645static int snd_usX2Y_hwdep_pcm_open(snd_hwdep_t *hw, struct file *file) 658static int snd_usX2Y_hwdep_pcm_open(struct snd_hwdep *hw, struct file *file)
646{ 659{
647 // we need to be the first 660 // we need to be the first
648 snd_card_t *card = hw->card; 661 struct snd_card *card = hw->card;
649 int err = usX2Y_pcms_lock_check(card); 662 int err = usX2Y_pcms_lock_check(card);
650 if (0 == err) 663 if (0 == err)
651 usX2Y(card)->chip_status |= USX2Y_STAT_CHIP_MMAP_PCM_URBS; 664 usX2Y(card)->chip_status |= USX2Y_STAT_CHIP_MMAP_PCM_URBS;
@@ -654,9 +667,9 @@ static int snd_usX2Y_hwdep_pcm_open(snd_hwdep_t *hw, struct file *file)
654} 667}
655 668
656 669
657static int snd_usX2Y_hwdep_pcm_release(snd_hwdep_t *hw, struct file *file) 670static int snd_usX2Y_hwdep_pcm_release(struct snd_hwdep *hw, struct file *file)
658{ 671{
659 snd_card_t *card = hw->card; 672 struct snd_card *card = hw->card;
660 int err = usX2Y_pcms_lock_check(card); 673 int err = usX2Y_pcms_lock_check(card);
661 if (0 == err) 674 if (0 == err)
662 usX2Y(hw->card)->chip_status &= ~USX2Y_STAT_CHIP_MMAP_PCM_URBS; 675 usX2Y(hw->card)->chip_status &= ~USX2Y_STAT_CHIP_MMAP_PCM_URBS;
@@ -684,7 +697,7 @@ static struct page * snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area,
684 offset = area->vm_pgoff << PAGE_SHIFT; 697 offset = area->vm_pgoff << PAGE_SHIFT;
685 offset += address - area->vm_start; 698 offset += address - area->vm_start;
686 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); 699 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM);
687 vaddr = (char*)((usX2Ydev_t*)area->vm_private_data)->hwdep_pcm_shm + offset; 700 vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->hwdep_pcm_shm + offset;
688 page = virt_to_page(vaddr); 701 page = virt_to_page(vaddr);
689 get_page(page); 702 get_page(page);
690 703
@@ -702,17 +715,17 @@ static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = {
702}; 715};
703 716
704 717
705static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) 718static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area)
706{ 719{
707 unsigned long size = (unsigned long)(area->vm_end - area->vm_start); 720 unsigned long size = (unsigned long)(area->vm_end - area->vm_start);
708 usX2Ydev_t *usX2Y = hw->private_data; 721 struct usX2Ydev *usX2Y = hw->private_data;
709 722
710 if (!(usX2Y->chip_status & USX2Y_STAT_CHIP_INIT)) 723 if (!(usX2Y->chip_status & USX2Y_STAT_CHIP_INIT))
711 return -EBUSY; 724 return -EBUSY;
712 725
713 /* if userspace tries to mmap beyond end of our buffer, fail */ 726 /* if userspace tries to mmap beyond end of our buffer, fail */
714 if (size > PAGE_ALIGN(sizeof(snd_usX2Y_hwdep_pcm_shm_t))) { 727 if (size > PAGE_ALIGN(sizeof(struct snd_usX2Y_hwdep_pcm_shm))) {
715 snd_printd("%lu > %lu\n", size, (unsigned long)sizeof(snd_usX2Y_hwdep_pcm_shm_t)); 728 snd_printd("%lu > %lu\n", size, (unsigned long)sizeof(struct snd_usX2Y_hwdep_pcm_shm));
716 return -EINVAL; 729 return -EINVAL;
717 } 730 }
718 731
@@ -726,19 +739,19 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct
726} 739}
727 740
728 741
729static void snd_usX2Y_hwdep_pcm_private_free(snd_hwdep_t *hwdep) 742static void snd_usX2Y_hwdep_pcm_private_free(struct snd_hwdep *hwdep)
730{ 743{
731 usX2Ydev_t *usX2Y = hwdep->private_data; 744 struct usX2Ydev *usX2Y = hwdep->private_data;
732 if (NULL != usX2Y->hwdep_pcm_shm) 745 if (NULL != usX2Y->hwdep_pcm_shm)
733 snd_free_pages(usX2Y->hwdep_pcm_shm, sizeof(snd_usX2Y_hwdep_pcm_shm_t)); 746 snd_free_pages(usX2Y->hwdep_pcm_shm, sizeof(struct snd_usX2Y_hwdep_pcm_shm));
734} 747}
735 748
736 749
737int usX2Y_hwdep_pcm_new(snd_card_t* card) 750int usX2Y_hwdep_pcm_new(struct snd_card *card)
738{ 751{
739 int err; 752 int err;
740 snd_hwdep_t *hw; 753 struct snd_hwdep *hw;
741 snd_pcm_t *pcm; 754 struct snd_pcm *pcm;
742 struct usb_device *dev = usX2Y(card)->chip.dev; 755 struct usb_device *dev = usX2Y(card)->chip.dev;
743 if (1 != nr_of_packs()) 756 if (1 != nr_of_packs())
744 return 0; 757 return 0;
@@ -783,7 +796,7 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card)
783 796
784#else 797#else
785 798
786int usX2Y_hwdep_pcm_new(snd_card_t* card) 799int usX2Y_hwdep_pcm_new(struct snd_card *card)
787{ 800{
788 return 0; 801 return 0;
789} 802}