Lines Matching refs:wiinst

54 static void calculate_ifrag(struct wiinst *);
60 struct wiinst *wiinst = wave_dev->wiinst; in emu10k1_audio_read() local
72 spin_lock_irqsave(&wiinst->lock, flags); in emu10k1_audio_read()
74 if (wiinst->mmapped) { in emu10k1_audio_read()
75 spin_unlock_irqrestore(&wiinst->lock, flags); in emu10k1_audio_read()
79 if (wiinst->state == WAVE_STATE_CLOSED) { in emu10k1_audio_read()
80 calculate_ifrag(wiinst); in emu10k1_audio_read()
83 spin_unlock_irqrestore(&wiinst->lock, flags); in emu10k1_audio_read()
93 spin_lock_irqsave(&wiinst->lock, flags); in emu10k1_audio_read()
97 spin_unlock_irqrestore(&wiinst->lock, flags); in emu10k1_audio_read()
102 spin_lock_irqsave(&wiinst->lock, flags); in emu10k1_audio_read()
104 if (!(wiinst->state & WAVE_STATE_STARTED) in emu10k1_audio_read()
108 emu10k1_wavein_update(wave_dev->card, wiinst); in emu10k1_audio_read()
109 emu10k1_wavein_getxfersize(wiinst, &bytestocopy); in emu10k1_audio_read()
111 spin_unlock_irqrestore(&wiinst->lock, flags); in emu10k1_audio_read()
115 if ((bytestocopy >= wiinst->buffer.fragment_size) in emu10k1_audio_read()
119 emu10k1_wavein_xferdata(wiinst, (u8 *) buffer, &bytestocopy); in emu10k1_audio_read()
131 interruptible_sleep_on(&wiinst->wait_queue); in emu10k1_audio_read()
257 struct wiinst *wiinst = NULL; local
268 wiinst = wave_dev->wiinst;
295 spin_lock_irqsave(&wiinst->lock, flags);
297 if (wiinst->state & WAVE_STATE_OPEN) {
301 wiinst->mmapped = 0;
302 wiinst->total_recorded = 0;
303 wiinst->blocks = 0;
304 spin_unlock_irqrestore(&wiinst->lock, flags);
337 spin_lock_irqsave(&wiinst->lock, flags);
339 if (wiinst->state & WAVE_STATE_OPEN) {
343 wiinst->mmapped = 0;
344 wiinst->total_recorded = 0;
345 wiinst->blocks = 0;
346 spin_unlock_irqrestore(&wiinst->lock, flags);
371 spin_lock_irqsave(&wiinst->lock, flags);
373 format = wiinst->format;
377 spin_unlock_irqrestore(&wiinst->lock, flags);
381 val = wiinst->format.samplingrate;
383 spin_unlock_irqrestore(&wiinst->lock, flags);
411 val = wiinst->format.samplingrate;
430 spin_lock_irqsave(&wiinst->lock, flags);
432 format = wiinst->format;
436 spin_unlock_irqrestore(&wiinst->lock, flags);
440 val = wiinst->format.channels - 1;
442 spin_unlock_irqrestore(&wiinst->lock, flags);
482 spin_lock_irqsave(&wiinst->lock, flags);
484 format = wiinst->format;
488 spin_unlock_irqrestore(&wiinst->lock, flags);
491 val = wiinst->format.channels;
493 spin_unlock_irqrestore(&wiinst->lock, flags);
519 val = wiinst->format.channels;
553 spin_lock_irqsave(&wiinst->lock, flags);
555 format = wiinst->format;
559 spin_unlock_irqrestore(&wiinst->lock, flags);
563 val = wiinst->format.id;
565 spin_unlock_irqrestore(&wiinst->lock, flags);
591 val = wiinst->format.id;
602 val = wiinst->format.bitsperchannel;
611 val = wiinst->format.samplingrate;
620 val = wiinst->format.channels;
672 spin_lock_irqsave(&wiinst->lock, flags);
676 if (wiinst->state & WAVE_STATE_OPEN)
680 if (wiinst->state & WAVE_STATE_STARTED)
684 spin_unlock_irqrestore(&wiinst->lock, flags);
728 spin_lock_irqsave(&wiinst->lock, flags);
729 if (wiinst->state & WAVE_STATE_OPEN) {
730 emu10k1_wavein_update(wave_dev->card, wiinst);
731 emu10k1_wavein_getxfersize(wiinst, &bytestocopy);
734 calculate_ifrag(wiinst);
737 spin_unlock_irqrestore(&wiinst->lock, flags);
739 info.fragstotal = wiinst->buffer.numfrags;
740 info.fragments = info.bytes / wiinst->buffer.fragment_size;
741 info.fragsize = wiinst->buffer.fragment_size;
782 spin_lock_irqsave(&wiinst->lock, flags);
784 if (wiinst->state & WAVE_STATE_OPEN) {
785 emu10k1_wavein_update(wave_dev->card, wiinst);
786 cinfo.ptr = wiinst->buffer.hw_pos;
787 cinfo.bytes = cinfo.ptr + wiinst->total_recorded - wiinst->total_recorded % wiinst->buffer.size;
788 cinfo.blocks = cinfo.bytes / wiinst->buffer.fragment_size - wiinst->blocks;
789 wiinst->blocks = cinfo.bytes / wiinst->buffer.fragment_size;
796 if(wiinst->mmapped)
797 wiinst->buffer.bytestocopy %= wiinst->buffer.fragment_size;
799 spin_unlock_irqrestore(&wiinst->lock, flags);
863 spin_lock_irqsave(&wiinst->lock, flags);
865 calculate_ifrag(wiinst);
866 val = wiinst->buffer.fragment_size;
868 spin_unlock_irqrestore(&wiinst->lock, flags);
914 if (wiinst->state & WAVE_STATE_OPEN)
917 wiinst->buffer.ossfragshift = val & 0xffff;
918 wiinst->buffer.numfrags = (val >> 16) & 0xffff;
981 struct wiinst *wiinst = wave_dev->wiinst; local
1000 if (wiinst != NULL)
1001 rd = wiinst->mmapped;
1010 dmapage = virt_to_page ((u8 *) wiinst->buffer.addr + pgoff * PAGE_SIZE);
1014 dmapage = virt_to_page ((u8 *) wiinst->buffer.addr + pgoff * PAGE_SIZE);
1032 struct wiinst *wiinst = NULL; local
1065 wiinst = wave_dev->wiinst;
1067 spin_lock_irqsave(&wiinst->lock, flags);
1068 if (wiinst->state == WAVE_STATE_CLOSED) {
1069 calculate_ifrag(wiinst);
1072 spin_unlock_irqrestore(&wiinst->lock, flags);
1078 wiinst->mmapped = 1;
1079 max_pages += wiinst->buffer.pages;
1080 spin_unlock_irqrestore(&wiinst->lock, flags);
1128 wave_dev->wiinst = NULL;
1134 struct wiinst *wiinst; local
1136 if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
1142 wiinst->recsrc = card->wavein.recsrc;
1143 wiinst->fxwc = card->wavein.fxwc;
1145 switch (wiinst->recsrc) {
1147 wiinst->format.id = AFMT_S16_LE;
1148 wiinst->format.samplingrate = 8000;
1149 wiinst->format.bitsperchannel = 16;
1150 wiinst->format.channels = 1;
1153 wiinst->format.id = AFMT_S16_LE;
1154 wiinst->format.samplingrate = 8000;
1155 wiinst->format.bitsperchannel = 16;
1156 wiinst->format.channels = 1;
1159 wiinst->format.id = AFMT_S16_LE;
1160 wiinst->format.samplingrate = 48000;
1161 wiinst->format.bitsperchannel = 16;
1162 wiinst->format.channels = hweight32(wiinst->fxwc);
1166 kfree(wiinst);
1171 wiinst->state = WAVE_STATE_CLOSED;
1173 wiinst->buffer.ossfragshift = 0;
1174 wiinst->buffer.fragment_size = 0;
1175 wiinst->buffer.numfrags = 0;
1177 init_waitqueue_head(&wiinst->wait_queue);
1179 wiinst->mmapped = 0;
1180 wiinst->total_recorded = 0;
1181 wiinst->blocks = 0;
1182 wiinst->lock = SPIN_LOCK_UNLOCKED;
1183 tasklet_init(&wiinst->timer.tasklet, emu10k1_wavein_bh, (unsigned long) wave_dev);
1184 wave_dev->wiinst = wiinst;
1185 emu10k1_wavein_setformat(wave_dev, &wiinst->format);
1197 if (wave_dev->wiinst != NULL) {
1198 woinst->format = wave_dev->wiinst->format;
1278 struct wiinst *wiinst = wave_dev->wiinst; local
1280 spin_lock_irqsave(&wiinst->lock, flags);
1282 if (wiinst->state & WAVE_STATE_OPEN) {
1286 spin_unlock_irqrestore(&wiinst->lock, flags);
1287 tasklet_kill(&wiinst->timer.tasklet);
1288 kfree(wave_dev->wiinst);
1304 struct wiinst *wiinst = wave_dev->wiinst; local
1315 poll_wait(file, &wiinst->wait_queue, wait);
1333 spin_lock_irqsave(&wiinst->lock, flags);
1335 if (wiinst->state & WAVE_STATE_OPEN) {
1336 emu10k1_wavein_update(wave_dev->card, wiinst);
1337 emu10k1_wavein_getxfersize(wiinst, &bytestocopy);
1339 if (bytestocopy >= wiinst->buffer.fragment_size)
1343 spin_unlock_irqrestore(&wiinst->lock, flags);
1410 static void calculate_ifrag(struct wiinst *wiinst) argument
1412 struct wavein_buffer *buffer = &wiinst->buffer;
1420 fragsize = (wiinst->format.bytespersec * WAVEIN_DEFAULTFRAGLEN) / 1000 - 1;
1442 …buffer->numfrags = (wiinst->format.bytespersec * WAVEIN_DEFAULTBUFLEN) / (buffer->fragment_size * …
1498 struct wiinst *wiinst = wave_dev->wiinst; local
1502 if (!wiinst)
1505 spin_lock_irqsave(&wiinst->lock, flags);
1507 if (!(wiinst->state & WAVE_STATE_STARTED)) {
1508 spin_unlock_irqrestore(&wiinst->lock, flags);
1512 emu10k1_wavein_update(wave_dev->card, wiinst);
1513 emu10k1_wavein_getxfersize(wiinst, &bytestocopy);
1515 spin_unlock_irqrestore(&wiinst->lock, flags);
1517 if (bytestocopy >= wiinst->buffer.fragment_size) {
1518 if (waitqueue_active(&wiinst->wait_queue))
1519 wake_up_interruptible(&wiinst->wait_queue);