Lines Matching defs:voice
68 struct voice {
82 struct voice *timing;
116 /* voice_lock protects allocation/freeing of the voice descriptions
120 struct voice voices[64];
121 struct voice capture_voice;
191 static void sis_update_sso(struct voice *voice, u16 period)
193 void __iomem *base = voice->ctrl_base;
195 voice->sso += period;
196 if (voice->sso >= voice->buffer_size)
197 voice->sso -= voice->buffer_size;
200 if (voice->sso < 8)
201 voice->sso = 8;
204 writew(voice->sso & 0xffff, base + SIS_PLAY_DMA_SSO_ESO + 2);
207 static void sis_update_voice(struct voice *voice)
209 if (voice->flags & VOICE_SSO_TIMING) {
210 sis_update_sso(voice, voice->period_size);
211 } else if (voice->flags & VOICE_SYNC_TIMING) {
217 if (voice->vperiod > voice->period_size) {
218 voice->vperiod -= voice->period_size;
219 if (voice->vperiod < voice->period_size)
220 sis_update_sso(voice, voice->vperiod);
222 sis_update_sso(voice, voice->period_size);
231 sync = voice->sync_cso;
232 sync -= readw(voice->sync_base + SIS_CAPTURE_DMA_FORMAT_CSO);
233 if (sync > (voice->sync_buffer_size / 2))
234 sync -= voice->sync_buffer_size;
244 sis_update_sso(voice, sync);
264 voice->vperiod = voice->sync_period_size + 1;
266 voice->vperiod = voice->sync_period_size + sync + 10;
268 if (voice->vperiod < voice->buffer_size) {
269 sis_update_sso(voice, voice->vperiod);
270 voice->vperiod = 0;
272 sis_update_sso(voice, voice->period_size);
274 sync = voice->sync_cso + voice->sync_period_size;
275 if (sync >= voice->sync_buffer_size)
276 sync -= voice->sync_buffer_size;
277 voice->sync_cso = sync;
280 snd_pcm_period_elapsed(voice->substream);
283 static void sis_voice_irq(u32 status, struct voice *voice)
290 voice += bit;
291 sis_update_voice(voice);
292 voice++;
300 struct voice *voice;
330 voice = &sis->capture_voice;
331 if (!voice->timing)
332 snd_pcm_period_elapsed(voice->substream);
388 static void sis_free_voice(struct sis7019 *sis, struct voice *voice)
393 if (voice->timing) {
395 voice->timing->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING |
397 voice->timing = NULL;
399 voice->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING | VOICE_SYNC_TIMING);
403 static struct voice *__sis_alloc_playback_voice(struct sis7019 *sis)
406 struct voice *voice;
410 voice = &sis->voices[i];
411 if (voice->flags & VOICE_IN_USE)
413 voice->flags |= VOICE_IN_USE;
416 voice = NULL;
419 return voice;
422 static struct voice *sis_alloc_playback_voice(struct sis7019 *sis)
424 struct voice *voice;
428 voice = __sis_alloc_playback_voice(sis);
431 return voice;
439 struct voice *voice = runtime->private_data;
445 * timing voice, as we can use the capture channel's interrupts
453 if (needed && !voice->timing) {
455 voice->timing = __sis_alloc_playback_voice(sis);
456 if (voice->timing)
459 if (!voice->timing)
461 voice->timing->substream = substream;
462 } else if (!needed && voice->timing) {
463 sis_free_voice(sis, voice);
464 voice->timing = NULL;
474 struct voice *voice;
476 voice = sis_alloc_playback_voice(sis);
477 if (!voice)
480 voice->substream = substream;
481 runtime->private_data = voice;
495 struct voice *voice = runtime->private_data;
497 sis_free_voice(sis, voice);
504 struct voice *voice = runtime->private_data;
505 void __iomem *ctrl_base = voice->ctrl_base;
506 void __iomem *wave_base = voice->wave_base;
532 voice->flags |= VOICE_SSO_TIMING;
533 voice->sso = runtime->period_size - 1;
534 voice->period_size = runtime->period_size;
535 voice->buffer_size = runtime->buffer_size;
572 struct voice *voice;
603 voice = s->runtime->private_data;
604 if (voice->flags & VOICE_CAPTURE) {
605 record |= 1 << voice->num;
606 voice = voice->timing;
609 /* voice could be NULL if this a recording stream, and it
612 if (voice)
613 play[voice->num / 32] |= 1 << (voice->num & 0x1f);
639 struct voice *voice = runtime->private_data;
642 cso = readl(voice->ctrl_base + SIS_PLAY_DMA_FORMAT_CSO);
651 struct voice *voice = &sis->capture_voice;
658 if (voice->flags & VOICE_IN_USE)
659 voice = NULL;
661 voice->flags |= VOICE_IN_USE;
664 if (!voice)
667 voice->substream = substream;
668 runtime->private_data = voice;
697 static void sis_prepare_timing_voice(struct voice *voice,
702 struct voice *timing = voice->timing;
756 timing->sync_base = voice->ctrl_base;
803 struct voice *voice = runtime->private_data;
804 void __iomem *rec_base = voice->ctrl_base;
824 * use a timing voice to clock out the periods. Otherwise, we can
827 if (voice->timing) {
828 sis_prepare_timing_voice(voice, substream);
1264 struct voice *voice;
1320 voice = &sis->voices[i];
1321 voice->num = i;
1322 voice->ctrl_base = SIS_PLAY_DMA_ADDR(sis->ioaddr, i);
1323 voice->wave_base = SIS_WAVE_ADDR(sis->ioaddr, i);
1326 voice = &sis->capture_voice;
1327 voice->flags = VOICE_CAPTURE;
1328 voice->num = SIS_CAPTURE_CHAN_AC97_PCM_IN;
1329 voice->ctrl_base = SIS_CAPTURE_DMA_ADDR(sis->ioaddr, voice->num);