Lines Matching defs:voice
69 struct voice {
83 struct voice *timing;
117 /* voice_lock protects allocation/freeing of the voice descriptions
121 struct voice voices[64];
122 struct voice capture_voice;
192 static void sis_update_sso(struct voice *voice, u16 period)
194 void __iomem *base = voice->ctrl_base;
196 voice->sso += period;
197 if (voice->sso >= voice->buffer_size)
198 voice->sso -= voice->buffer_size;
201 if (voice->sso < 8)
202 voice->sso = 8;
205 writew(voice->sso & 0xffff, base + SIS_PLAY_DMA_SSO_ESO + 2);
208 static void sis_update_voice(struct voice *voice)
210 if (voice->flags & VOICE_SSO_TIMING) {
211 sis_update_sso(voice, voice->period_size);
212 } else if (voice->flags & VOICE_SYNC_TIMING) {
218 if (voice->vperiod > voice->period_size) {
219 voice->vperiod -= voice->period_size;
220 if (voice->vperiod < voice->period_size)
221 sis_update_sso(voice, voice->vperiod);
223 sis_update_sso(voice, voice->period_size);
232 sync = voice->sync_cso;
233 sync -= readw(voice->sync_base + SIS_CAPTURE_DMA_FORMAT_CSO);
234 if (sync > (voice->sync_buffer_size / 2))
235 sync -= voice->sync_buffer_size;
245 sis_update_sso(voice, sync);
265 voice->vperiod = voice->sync_period_size + 1;
267 voice->vperiod = voice->sync_period_size + sync + 10;
269 if (voice->vperiod < voice->buffer_size) {
270 sis_update_sso(voice, voice->vperiod);
271 voice->vperiod = 0;
273 sis_update_sso(voice, voice->period_size);
275 sync = voice->sync_cso + voice->sync_period_size;
276 if (sync >= voice->sync_buffer_size)
277 sync -= voice->sync_buffer_size;
278 voice->sync_cso = sync;
281 snd_pcm_period_elapsed(voice->substream);
284 static void sis_voice_irq(u32 status, struct voice *voice)
291 voice += bit;
292 sis_update_voice(voice);
293 voice++;
301 struct voice *voice;
331 voice = &sis->capture_voice;
332 if (!voice->timing)
333 snd_pcm_period_elapsed(voice->substream);
389 static void sis_free_voice(struct sis7019 *sis, struct voice *voice)
394 if (voice->timing) {
396 voice->timing->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING |
398 voice->timing = NULL;
400 voice->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING | VOICE_SYNC_TIMING);
404 static struct voice *__sis_alloc_playback_voice(struct sis7019 *sis)
407 struct voice *voice;
411 voice = &sis->voices[i];
412 if (voice->flags & VOICE_IN_USE)
414 voice->flags |= VOICE_IN_USE;
417 voice = NULL;
420 return voice;
423 static struct voice *sis_alloc_playback_voice(struct sis7019 *sis)
425 struct voice *voice;
429 voice = __sis_alloc_playback_voice(sis);
432 return voice;
440 struct voice *voice = runtime->private_data;
446 * timing voice, as we can use the capture channel's interrupts
454 if (needed && !voice->timing) {
456 voice->timing = __sis_alloc_playback_voice(sis);
457 if (voice->timing)
460 if (!voice->timing)
462 voice->timing->substream = substream;
463 } else if (!needed && voice->timing) {
464 sis_free_voice(sis, voice);
465 voice->timing = NULL;
475 struct voice *voice;
477 voice = sis_alloc_playback_voice(sis);
478 if (!voice)
481 voice->substream = substream;
482 runtime->private_data = voice;
496 struct voice *voice = runtime->private_data;
498 sis_free_voice(sis, voice);
505 struct voice *voice = runtime->private_data;
506 void __iomem *ctrl_base = voice->ctrl_base;
507 void __iomem *wave_base = voice->wave_base;
533 voice->flags |= VOICE_SSO_TIMING;
534 voice->sso = runtime->period_size - 1;
535 voice->period_size = runtime->period_size;
536 voice->buffer_size = runtime->buffer_size;
573 struct voice *voice;
604 voice = s->runtime->private_data;
605 if (voice->flags & VOICE_CAPTURE) {
606 record |= 1 << voice->num;
607 voice = voice->timing;
610 /* voice could be NULL if this a recording stream, and it
613 if (voice)
614 play[voice->num / 32] |= 1 << (voice->num & 0x1f);
640 struct voice *voice = runtime->private_data;
643 cso = readl(voice->ctrl_base + SIS_PLAY_DMA_FORMAT_CSO);
652 struct voice *voice = &sis->capture_voice;
659 if (voice->flags & VOICE_IN_USE)
660 voice = NULL;
662 voice->flags |= VOICE_IN_USE;
665 if (!voice)
668 voice->substream = substream;
669 runtime->private_data = voice;
698 static void sis_prepare_timing_voice(struct voice *voice,
703 struct voice *timing = voice->timing;
757 timing->sync_base = voice->ctrl_base;
804 struct voice *voice = runtime->private_data;
805 void __iomem *rec_base = voice->ctrl_base;
825 * use a timing voice to clock out the periods. Otherwise, we can
828 if (voice->timing) {
829 sis_prepare_timing_voice(voice, substream);
1282 struct voice *voice;
1342 voice = &sis->voices[i];
1343 voice->num = i;
1344 voice->ctrl_base = SIS_PLAY_DMA_ADDR(sis->ioaddr, i);
1345 voice->wave_base = SIS_WAVE_ADDR(sis->ioaddr, i);
1348 voice = &sis->capture_voice;
1349 voice->flags = VOICE_CAPTURE;
1350 voice->num = SIS_CAPTURE_CHAN_AC97_PCM_IN;
1351 voice->ctrl_base = SIS_CAPTURE_DMA_ADDR(sis->ioaddr, voice->num);