Lines Matching refs:woinst
53 static void calculate_ofrag(struct woinst *);
147 struct woinst *woinst = wave_dev->woinst; in emu10k1_audio_write() local
159 spin_lock_irqsave(&woinst->lock, flags); in emu10k1_audio_write()
161 if (woinst->mmapped) { in emu10k1_audio_write()
162 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_audio_write()
166 if (woinst->format.passthrough) { in emu10k1_audio_write()
169 woinst->buffer.ossfragshift = PT_BLOCKSIZE_LOG2; in emu10k1_audio_write()
170 woinst->buffer.numfrags = PT_BLOCKCOUNT; in emu10k1_audio_write()
171 calculate_ofrag(woinst); in emu10k1_audio_write()
174 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_audio_write()
178 if (woinst->state == WAVE_STATE_CLOSED) { in emu10k1_audio_write()
179 calculate_ofrag(woinst); in emu10k1_audio_write()
182 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_audio_write()
192 spin_lock_irqsave(&woinst->lock, flags); in emu10k1_audio_write()
196 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_audio_write()
199 if (count % woinst->format.bytespersample) in emu10k1_audio_write()
202 count /= woinst->num_voices; in emu10k1_audio_write()
207 spin_lock_irqsave(&woinst->lock, flags); in emu10k1_audio_write()
208 emu10k1_waveout_update(woinst); in emu10k1_audio_write()
209 emu10k1_waveout_getxfersize(woinst, &bytestocopy); in emu10k1_audio_write()
210 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_audio_write()
214 if ((bytestocopy >= woinst->buffer.fragment_size) in emu10k1_audio_write()
219 emu10k1_waveout_xferdata(woinst, (u8 *) buffer, &bytestocopy); in emu10k1_audio_write()
222 buffer += bytestocopy * woinst->num_voices; in emu10k1_audio_write()
223 ret += bytestocopy * woinst->num_voices; in emu10k1_audio_write()
225 spin_lock_irqsave(&woinst->lock, flags); in emu10k1_audio_write()
226 woinst->total_copied += bytestocopy; in emu10k1_audio_write()
228 if (!(woinst->state & WAVE_STATE_STARTED) in emu10k1_audio_write()
230 && (woinst->total_copied >= woinst->buffer.fragment_size)) in emu10k1_audio_write()
233 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_audio_write()
241 interruptible_sleep_on(&woinst->wait_queue); in emu10k1_audio_write()
256 struct woinst *woinst = NULL; local
265 woinst = wave_dev->woinst;
280 spin_lock_irqsave(&woinst->lock, flags);
282 if (woinst->state & WAVE_STATE_OPEN) {
286 woinst->mmapped = 0;
287 woinst->total_copied = 0;
288 woinst->total_played = 0;
289 woinst->blocks = 0;
291 spin_unlock_irqrestore(&woinst->lock, flags);
314 spin_lock_irqsave(&woinst->lock, flags);
316 if (woinst->state & WAVE_STATE_OPEN) {
318 if (woinst->state & WAVE_STATE_STARTED)
319 while ((woinst->total_played < woinst->total_copied)
321 spin_unlock_irqrestore(&woinst->lock, flags);
322 interruptible_sleep_on(&woinst->wait_queue);
323 spin_lock_irqsave(&woinst->lock, flags);
328 woinst->mmapped = 0;
329 woinst->total_copied = 0;
330 woinst->total_played = 0;
331 woinst->blocks = 0;
333 spin_unlock_irqrestore(&woinst->lock, flags);
391 spin_lock_irqsave(&woinst->lock, flags);
393 format = woinst->format;
397 spin_unlock_irqrestore(&woinst->lock, flags);
401 val = woinst->format.samplingrate;
403 spin_unlock_irqrestore(&woinst->lock, flags);
413 val = woinst->format.samplingrate;
449 spin_lock_irqsave(&woinst->lock, flags);
451 format = woinst->format;
455 spin_unlock_irqrestore(&woinst->lock, flags);
459 val = woinst->format.channels - 1;
461 spin_unlock_irqrestore(&woinst->lock, flags);
500 spin_lock_irqsave(&woinst->lock, flags);
502 format = woinst->format;
506 spin_unlock_irqrestore(&woinst->lock, flags);
510 val = woinst->format.channels;
512 spin_unlock_irqrestore(&woinst->lock, flags);
521 val = woinst->format.channels;
572 spin_lock_irqsave(&woinst->lock, flags);
574 format = woinst->format;
578 spin_unlock_irqrestore(&woinst->lock, flags);
582 val = woinst->format.id;
584 spin_unlock_irqrestore(&woinst->lock, flags);
593 val = woinst->format.id;
604 val = woinst->format.bitsperchannel;
613 val = woinst->format.samplingrate;
622 val = woinst->format.channels;
656 spin_lock_irqsave(&woinst->lock, flags);
660 if (woinst->state & WAVE_STATE_OPEN)
664 if (woinst->state & WAVE_STATE_STARTED)
668 spin_unlock_irqrestore(&woinst->lock, flags);
697 spin_lock_irqsave(&woinst->lock, flags);
699 if (woinst->state & WAVE_STATE_OPEN) {
700 emu10k1_waveout_update(woinst);
701 emu10k1_waveout_getxfersize(woinst, &bytestocopy);
704 calculate_ofrag(woinst);
705 info.bytes = woinst->buffer.size;
707 spin_unlock_irqrestore(&woinst->lock, flags);
709 info.bytes *= woinst->num_voices;
710 info.fragsize = woinst->buffer.fragment_size * woinst->num_voices;
711 info.fragstotal = woinst->buffer.numfrags * woinst->num_voices;
760 spin_lock_irqsave(&woinst->lock, flags);
761 if (woinst->state & WAVE_STATE_OPEN) {
762 emu10k1_waveout_update(woinst);
763 emu10k1_waveout_getxfersize(woinst, &bytestocopy);
764 val = woinst->buffer.size - bytestocopy;
768 val *= woinst->num_voices;
769 spin_unlock_irqrestore(&woinst->lock, flags);
815 spin_lock_irqsave(&woinst->lock, flags);
817 if (woinst->state & WAVE_STATE_OPEN ||
818 (woinst->format.passthrough && wave_dev->card->pt.state)) {
820 if (woinst->format.passthrough) {
822 cinfo.bytes = woinst->total_played;
824 emu10k1_waveout_update(woinst);
825 cinfo.bytes = woinst->total_played;
827 cinfo.ptr = woinst->buffer.hw_pos;
828 num_fragments = cinfo.bytes / woinst->buffer.fragment_size;
829 cinfo.blocks = num_fragments - woinst->blocks;
830 woinst->blocks = num_fragments;
832 cinfo.bytes *= woinst->num_voices;
833 cinfo.ptr *= woinst->num_voices;
840 if (woinst->mmapped)
841 woinst->buffer.free_bytes %= woinst->buffer.fragment_size;
843 spin_unlock_irqrestore(&woinst->lock, flags);
854 spin_lock_irqsave(&woinst->lock, flags);
856 calculate_ofrag(woinst);
857 val = woinst->buffer.fragment_size * woinst->num_voices;
859 spin_unlock_irqrestore(&woinst->lock, flags);
877 spin_lock_irqsave(&woinst->lock, flags);
879 if (!(woinst->state & WAVE_STATE_STARTED)
881 && (woinst->total_copied > 0))
884 spin_unlock_irqrestore(&woinst->lock, flags);
906 if (woinst->state & WAVE_STATE_OPEN || woinst->format.passthrough)
909 woinst->buffer.ossfragshift = val & 0xffff;
910 woinst->buffer.numfrags = (val >> 16) & 0xffff;
980 struct woinst *woinst = wave_dev->woinst; local
995 if (woinst != NULL)
996 wr = woinst->mmapped;
1008 if (pgoff >= woinst->buffer.pages) {
1009 pgoff -= woinst->buffer.pages;
1012 dmapage = virt_to_page (woinst->voice[0].mem.addr[pgoff]);
1031 struct woinst *woinst = NULL; local
1039 woinst = wave_dev->woinst;
1041 spin_lock_irqsave(&woinst->lock, flags);
1044 if (woinst->num_voices > 1) {
1045 spin_unlock_irqrestore(&woinst->lock, flags);
1049 if (woinst->state == WAVE_STATE_CLOSED) {
1050 calculate_ofrag(woinst);
1053 spin_unlock_irqrestore(&woinst->lock, flags);
1059 woinst->mmapped = 1;
1060 max_pages += woinst->buffer.pages;
1061 spin_unlock_irqrestore(&woinst->lock, flags);
1129 wave_dev->woinst = NULL;
1189 struct woinst *woinst; local
1192 if ((woinst = (struct woinst *) kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) {
1198 woinst->format = wave_dev->wiinst->format;
1200 woinst->format.id = AFMT_U8;
1201 woinst->format.samplingrate = 8000;
1202 woinst->format.bitsperchannel = 8;
1203 woinst->format.channels = 1;
1206 woinst->state = WAVE_STATE_CLOSED;
1208 woinst->buffer.fragment_size = 0;
1209 woinst->buffer.ossfragshift = 0;
1210 woinst->buffer.numfrags = 0;
1211 woinst->device = (card->audio_dev1 == minor);
1212 woinst->timer.state = TIMER_STATE_UNINSTALLED;
1213 woinst->num_voices = 1;
1215 woinst->voice[i].usage = VOICE_USAGE_FREE;
1216 woinst->voice[i].mem.emupageindex = -1;
1219 init_waitqueue_head(&woinst->wait_queue);
1221 woinst->mmapped = 0;
1222 woinst->total_copied = 0;
1223 woinst->total_played = 0;
1224 woinst->blocks = 0;
1225 woinst->lock = SPIN_LOCK_UNLOCKED;
1226 tasklet_init(&woinst->timer.tasklet, emu10k1_waveout_bh, (unsigned long) wave_dev);
1227 wave_dev->woinst = woinst;
1228 emu10k1_waveout_setformat(wave_dev, &woinst->format);
1247 struct woinst *woinst = wave_dev->woinst; local
1249 spin_lock_irqsave(&woinst->lock, flags);
1251 if (woinst->format.passthrough && card->pt.state != PT_STATE_INACTIVE) {
1256 if (woinst->state & WAVE_STATE_OPEN) {
1257 if (woinst->state & WAVE_STATE_STARTED) {
1260 && (woinst->total_played < woinst->total_copied)) {
1262 spin_unlock_irqrestore(&woinst->lock, flags);
1263 interruptible_sleep_on(&woinst->wait_queue);
1264 spin_lock_irqsave(&woinst->lock, flags);
1271 spin_unlock_irqrestore(&woinst->lock, flags);
1273 tasklet_kill(&woinst->timer.tasklet);
1274 kfree(wave_dev->woinst);
1303 struct woinst *woinst = wave_dev->woinst; local
1312 poll_wait(file, &woinst->wait_queue, wait);
1318 spin_lock_irqsave(&woinst->lock, flags);
1320 if (woinst->state & WAVE_STATE_OPEN) {
1321 emu10k1_waveout_update(woinst);
1322 emu10k1_waveout_getxfersize(woinst, &bytestocopy);
1324 if (bytestocopy >= woinst->buffer.fragment_size)
1329 spin_unlock_irqrestore(&woinst->lock, flags);
1349 static void calculate_ofrag(struct woinst *woinst) argument
1351 struct waveout_buffer *buffer = &woinst->buffer;
1358 …fragsize = (woinst->format.bytespervoicesample * woinst->format.samplingrate * WAVEOUT_DEFAULTFRAG…
1381 …numfrags = (woinst->format.bytespervoicesample * woinst->format.samplingrate * WAVEOUT_DEFAULTBUFL…
1529 struct woinst *woinst = wave_dev->woinst; local
1533 if (!woinst)
1536 spin_lock_irqsave(&woinst->lock, flags);
1538 if (!(woinst->state & WAVE_STATE_STARTED)) {
1539 spin_unlock_irqrestore(&woinst->lock, flags);
1543 emu10k1_waveout_update(woinst);
1544 emu10k1_waveout_getxfersize(woinst, &bytestocopy);
1546 if (woinst->buffer.fill_silence) {
1547 spin_unlock_irqrestore(&woinst->lock, flags);
1548 emu10k1_waveout_fillsilence(woinst);
1550 spin_unlock_irqrestore(&woinst->lock, flags);
1552 if (bytestocopy >= woinst->buffer.fragment_size) {
1553 if (waitqueue_active(&woinst->wait_queue))
1554 wake_up_interruptible(&woinst->wait_queue);