• Home
  • Raw
  • Download

Lines Matching refs:sq

411 static int sq_allocate_buffers(struct sound_queue *sq, int num, int size)  in sq_allocate_buffers()  argument
415 if (sq->buffers) in sq_allocate_buffers()
417 sq->numBufs = num; in sq_allocate_buffers()
418 sq->bufSize = size; in sq_allocate_buffers()
419 sq->buffers = kmalloc_array (num, sizeof(char *), GFP_KERNEL); in sq_allocate_buffers()
420 if (!sq->buffers) in sq_allocate_buffers()
423 sq->buffers[i] = dmasound.mach.dma_alloc(size, GFP_KERNEL); in sq_allocate_buffers()
424 if (!sq->buffers[i]) { in sq_allocate_buffers()
426 dmasound.mach.dma_free(sq->buffers[i], size); in sq_allocate_buffers()
427 kfree(sq->buffers); in sq_allocate_buffers()
428 sq->buffers = NULL; in sq_allocate_buffers()
435 static void sq_release_buffers(struct sound_queue *sq) in sq_release_buffers() argument
439 if (sq->buffers) { in sq_release_buffers()
440 for (i = 0; i < sq->numBufs; i++) in sq_release_buffers()
441 dmasound.mach.dma_free(sq->buffers[i], sq->bufSize); in sq_release_buffers()
442 kfree(sq->buffers); in sq_release_buffers()
443 sq->buffers = NULL; in sq_release_buffers()
448 static int sq_setup(struct sound_queue *sq) in sq_setup() argument
453 if (sq->locked) { /* are we already set? - and not changeable */ in sq_setup()
459 sq->locked = 1 ; /* don't think we have a race prob. here _check_ */ in sq_setup()
479 if (sq->user_frags <= 0) { in sq_setup()
480 sq->max_count = sq->numBufs ; in sq_setup()
481 sq->max_active = sq->numBufs ; in sq_setup()
482 sq->block_size = sq->bufSize; in sq_setup()
484 sq->user_frags = sq->numBufs ; in sq_setup()
485 sq->user_frag_size = sq->bufSize ; in sq_setup()
486 sq->user_frag_size *= in sq_setup()
488 sq->user_frag_size /= in sq_setup()
492 sq->block_size = sq->user_frag_size ; in sq_setup()
493 sq->block_size *= in sq_setup()
495 sq->block_size /= in sq_setup()
498 sq->block_size *= dmasound.hard.speed ; in sq_setup()
499 sq->block_size /= dmasound.soft.speed ; in sq_setup()
503 sq->block_size += (hard_frame - 1) ; in sq_setup()
504 sq->block_size &= ~(hard_frame - 1) ; /* make sure we are aligned */ in sq_setup()
506 if ( sq->block_size <= 0 || sq->block_size > sq->bufSize) { in sq_setup()
508 printk("dmasound_core: invalid frag size (user set %d)\n", sq->user_frag_size) ; in sq_setup()
510 sq->block_size = sq->bufSize ; in sq_setup()
512 if ( sq->user_frags <= sq->numBufs ) { in sq_setup()
513 sq->max_count = sq->user_frags ; in sq_setup()
515 sq->max_active = (sq->max_active <= sq->max_count) ? in sq_setup()
516 sq->max_active : sq->max_count ; in sq_setup()
519 printk("dmasound_core: invalid frag count (user set %d)\n", sq->user_frags) ; in sq_setup()
521 sq->max_count = in sq_setup()
522 sq->max_active = sq->numBufs ; in sq_setup()
525 sq->front = sq->count = sq->rear_size = 0; in sq_setup()
526 sq->syncing = 0; in sq_setup()
527 sq->active = 0; in sq_setup()
529 if (sq == &write_sq) { in sq_setup()
530 sq->rear = -1; in sq_setup()
688 static inline void sq_init_waitqueue(struct sound_queue *sq) in sq_init_waitqueue() argument
690 init_waitqueue_head(&sq->action_queue); in sq_init_waitqueue()
691 init_waitqueue_head(&sq->open_queue); in sq_init_waitqueue()
692 init_waitqueue_head(&sq->sync_queue); in sq_init_waitqueue()
693 sq->busy = 0; in sq_init_waitqueue()
697 static inline void sq_wake_up(struct sound_queue *sq, struct file *file,
701 sq->busy = 0; /* CHECK: IS THIS OK??? */
702 WAKE_UP(sq->open_queue);
707 static int sq_open2(struct sound_queue *sq, struct file *file, fmode_t mode, in sq_open2() argument
713 if (sq->busy) { in sq_open2()
719 if (wait_event_interruptible(sq->open_queue, !sq->busy)) in sq_open2()
729 sq->busy = 1; /* Let's play spot-the-race-condition */ in sq_open2()
736 if (( rc = sq_allocate_buffers(sq, numbufs, bufsize))) { in sq_open2()
738 sq_wake_up(sq, file, mode); in sq_open2()
740 sq->busy = 0 ; in sq_open2()
745 sq->non_blocking = file->f_flags & O_NONBLOCK; in sq_open2()
953 static int set_queue_frags(struct sound_queue *sq, int bufs, int size) in set_queue_frags() argument
955 if (sq->locked) { in set_queue_frags()
965 if (size > sq->bufSize) in set_queue_frags()
970 if (bufs > sq->numBufs) /* the user is allowed say "don't care" with 0x7fff */ in set_queue_frags()
971 bufs = sq->numBufs ; in set_queue_frags()
978 sq->user_frags = in set_queue_frags()
979 sq->max_active = bufs ; in set_queue_frags()
980 sq->user_frag_size = size ; in set_queue_frags()