Lines Matching refs:wiinst
122 struct wiinst *wiinst = wave_dev->wiinst; in emu10k1_wavein_open() local
123 struct wiinst **wiinst_tmp = NULL; in emu10k1_wavein_open()
129 switch (wiinst->recsrc) { in emu10k1_wavein_open()
150 *wiinst_tmp = wiinst; in emu10k1_wavein_open()
154 if (wiinst->format.bytesperchannel == 1) { in emu10k1_wavein_open()
155 if (wiinst->buffer.size > 0x8000) { in emu10k1_wavein_open()
156 wiinst->buffer.size = 0x8000; in emu10k1_wavein_open()
157 wiinst->buffer.sizeregval = 0x1f; in emu10k1_wavein_open()
159 wiinst->buffer.sizeregval += 4; in emu10k1_wavein_open()
161 wiinst->buffer.cov = 2; in emu10k1_wavein_open()
163 wiinst->buffer.cov = 1; in emu10k1_wavein_open()
165 if (alloc_buffer(card, &wiinst->buffer) < 0) { in emu10k1_wavein_open()
171 emu10k1_set_record_src(card, wiinst); in emu10k1_wavein_open()
173 emu10k1_reset_record(card, &wiinst->buffer); in emu10k1_wavein_open()
175 wiinst->buffer.hw_pos = 0; in emu10k1_wavein_open()
176 wiinst->buffer.pos = 0; in emu10k1_wavein_open()
177 wiinst->buffer.bytestocopy = 0; in emu10k1_wavein_open()
179 delay = (48000 * wiinst->buffer.fragment_size) / wiinst->format.bytespersec; in emu10k1_wavein_open()
181 emu10k1_timer_install(card, &wiinst->timer, delay / 2); in emu10k1_wavein_open()
183 wiinst->state = WAVE_STATE_OPEN; in emu10k1_wavein_open()
191 struct wiinst *wiinst = wave_dev->wiinst; in emu10k1_wavein_close() local
198 emu10k1_timer_uninstall(card, &wiinst->timer); in emu10k1_wavein_close()
200 free_buffer(card, &wiinst->buffer); in emu10k1_wavein_close()
203 switch (wave_dev->wiinst->recsrc) { in emu10k1_wavein_close()
219 wiinst->state = WAVE_STATE_CLOSED; in emu10k1_wavein_close()
225 struct wiinst *wiinst = wave_dev->wiinst; in emu10k1_wavein_start() local
229 emu10k1_start_record(card, &wiinst->buffer); in emu10k1_wavein_start()
230 emu10k1_timer_enable(wave_dev->card, &wiinst->timer); in emu10k1_wavein_start()
232 wiinst->state |= WAVE_STATE_STARTED; in emu10k1_wavein_start()
238 struct wiinst *wiinst = wave_dev->wiinst; in emu10k1_wavein_stop() local
242 if (!(wiinst->state & WAVE_STATE_STARTED)) in emu10k1_wavein_stop()
245 emu10k1_timer_disable(card, &wiinst->timer); in emu10k1_wavein_stop()
246 emu10k1_stop_record(card, &wiinst->buffer); in emu10k1_wavein_stop()
248 wiinst->state &= ~WAVE_STATE_STARTED; in emu10k1_wavein_stop()
254 struct wiinst *wiinst = wave_dev->wiinst; in emu10k1_wavein_setformat() local
259 if (wiinst->state & WAVE_STATE_STARTED) in emu10k1_wavein_setformat()
262 query_format(wiinst->recsrc, format); in emu10k1_wavein_setformat()
264 if ((wiinst->format.samplingrate != format->samplingrate) in emu10k1_wavein_setformat()
265 || (wiinst->format.bitsperchannel != format->bitsperchannel) in emu10k1_wavein_setformat()
266 || (wiinst->format.channels != format->channels)) { in emu10k1_wavein_setformat()
268 wiinst->format = *format; in emu10k1_wavein_setformat()
270 if (wiinst->state == WAVE_STATE_CLOSED) in emu10k1_wavein_setformat()
273 wiinst->buffer.size *= wiinst->buffer.cov; in emu10k1_wavein_setformat()
275 if (wiinst->format.bytesperchannel == 1) { in emu10k1_wavein_setformat()
276 wiinst->buffer.cov = 2; in emu10k1_wavein_setformat()
277 wiinst->buffer.size /= wiinst->buffer.cov; in emu10k1_wavein_setformat()
279 wiinst->buffer.cov = 1; in emu10k1_wavein_setformat()
281 emu10k1_timer_uninstall(card, &wiinst->timer); in emu10k1_wavein_setformat()
283 delay = (48000 * wiinst->buffer.fragment_size) / wiinst->format.bytespersec; in emu10k1_wavein_setformat()
285 emu10k1_timer_install(card, &wiinst->timer, delay / 2); in emu10k1_wavein_setformat()
291 void emu10k1_wavein_getxfersize(struct wiinst *wiinst, u32 * size) in emu10k1_wavein_getxfersize() argument
293 struct wavein_buffer *buffer = &wiinst->buffer; in emu10k1_wavein_getxfersize()
297 if (wiinst->mmapped) in emu10k1_wavein_getxfersize()
325 void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 * data, u32 * size) in emu10k1_wavein_xferdata() argument
327 struct wavein_buffer *buffer = &wiinst->buffer; in emu10k1_wavein_xferdata()
337 spin_lock_irqsave(&wiinst->lock, flags); in emu10k1_wavein_xferdata()
344 spin_unlock_irqrestore(&wiinst->lock, flags); in emu10k1_wavein_xferdata()
356 void emu10k1_wavein_update(struct emu10k1_card *card, struct wiinst *wiinst) in emu10k1_wavein_update() argument
362 if (!(wiinst->state & WAVE_STATE_STARTED)) { in emu10k1_wavein_update()
363 hw_pos = wiinst->buffer.hw_pos; in emu10k1_wavein_update()
366 hw_pos = sblive_readptr(card, wiinst->buffer.idxreg, 0) / wiinst->buffer.cov; in emu10k1_wavein_update()
369 diff = (wiinst->buffer.size + hw_pos - wiinst->buffer.hw_pos) % wiinst->buffer.size; in emu10k1_wavein_update()
370 wiinst->total_recorded += diff; in emu10k1_wavein_update()
371 wiinst->buffer.bytestocopy += diff; in emu10k1_wavein_update()
373 wiinst->buffer.hw_pos = hw_pos; in emu10k1_wavein_update()