Lines Matching full:voice

68 struct voice {  struct
82 struct voice *timing; argument
112 /* voice_lock protects allocation/freeing of the voice descriptions
116 struct voice voices[64];
117 struct voice capture_voice;
187 static void sis_update_sso(struct voice *voice, u16 period) in sis_update_sso() argument
189 void __iomem *base = voice->ctrl_base; in sis_update_sso()
191 voice->sso += period; in sis_update_sso()
192 if (voice->sso >= voice->buffer_size) in sis_update_sso()
193 voice->sso -= voice->buffer_size; in sis_update_sso()
196 if (voice->sso < 8) in sis_update_sso()
197 voice->sso = 8; in sis_update_sso()
200 writew(voice->sso & 0xffff, base + SIS_PLAY_DMA_SSO_ESO + 2); in sis_update_sso()
203 static void sis_update_voice(struct voice *voice) in sis_update_voice() argument
205 if (voice->flags & VOICE_SSO_TIMING) { in sis_update_voice()
206 sis_update_sso(voice, voice->period_size); in sis_update_voice()
207 } else if (voice->flags & VOICE_SYNC_TIMING) { in sis_update_voice()
213 if (voice->vperiod > voice->period_size) { in sis_update_voice()
214 voice->vperiod -= voice->period_size; in sis_update_voice()
215 if (voice->vperiod < voice->period_size) in sis_update_voice()
216 sis_update_sso(voice, voice->vperiod); in sis_update_voice()
218 sis_update_sso(voice, voice->period_size); in sis_update_voice()
227 sync = voice->sync_cso; in sis_update_voice()
228 sync -= readw(voice->sync_base + SIS_CAPTURE_DMA_FORMAT_CSO); in sis_update_voice()
229 if (sync > (voice->sync_buffer_size / 2)) in sis_update_voice()
230 sync -= voice->sync_buffer_size; in sis_update_voice()
240 sis_update_sso(voice, sync); in sis_update_voice()
260 voice->vperiod = voice->sync_period_size + 1; in sis_update_voice()
262 voice->vperiod = voice->sync_period_size + sync + 10; in sis_update_voice()
264 if (voice->vperiod < voice->buffer_size) { in sis_update_voice()
265 sis_update_sso(voice, voice->vperiod); in sis_update_voice()
266 voice->vperiod = 0; in sis_update_voice()
268 sis_update_sso(voice, voice->period_size); in sis_update_voice()
270 sync = voice->sync_cso + voice->sync_period_size; in sis_update_voice()
271 if (sync >= voice->sync_buffer_size) in sis_update_voice()
272 sync -= voice->sync_buffer_size; in sis_update_voice()
273 voice->sync_cso = sync; in sis_update_voice()
276 snd_pcm_period_elapsed(voice->substream); in sis_update_voice()
279 static void sis_voice_irq(u32 status, struct voice *voice) in sis_voice_irq() argument
286 voice += bit; in sis_voice_irq()
287 sis_update_voice(voice); in sis_voice_irq()
288 voice++; in sis_voice_irq()
296 struct voice *voice; in sis_interrupt() local
326 voice = &sis->capture_voice; in sis_interrupt()
327 if (!voice->timing) in sis_interrupt()
328 snd_pcm_period_elapsed(voice->substream); in sis_interrupt()
384 static void sis_free_voice(struct sis7019 *sis, struct voice *voice) in sis_free_voice() argument
389 if (voice->timing) { in sis_free_voice()
391 voice->timing->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING | in sis_free_voice()
393 voice->timing = NULL; in sis_free_voice()
395 voice->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING | VOICE_SYNC_TIMING); in sis_free_voice()
399 static struct voice *__sis_alloc_playback_voice(struct sis7019 *sis) in __sis_alloc_playback_voice()
402 struct voice *voice; in __sis_alloc_playback_voice() local
406 voice = &sis->voices[i]; in __sis_alloc_playback_voice()
407 if (voice->flags & VOICE_IN_USE) in __sis_alloc_playback_voice()
409 voice->flags |= VOICE_IN_USE; in __sis_alloc_playback_voice()
412 voice = NULL; in __sis_alloc_playback_voice()
415 return voice; in __sis_alloc_playback_voice()
418 static struct voice *sis_alloc_playback_voice(struct sis7019 *sis) in sis_alloc_playback_voice()
420 struct voice *voice; in sis_alloc_playback_voice() local
424 voice = __sis_alloc_playback_voice(sis); in sis_alloc_playback_voice()
427 return voice; in sis_alloc_playback_voice()
435 struct voice *voice = runtime->private_data; in sis_alloc_timing_voice() local
441 * timing voice, as we can use the capture channel's interrupts in sis_alloc_timing_voice()
449 if (needed && !voice->timing) { in sis_alloc_timing_voice()
451 voice->timing = __sis_alloc_playback_voice(sis); in sis_alloc_timing_voice()
452 if (voice->timing) in sis_alloc_timing_voice()
455 if (!voice->timing) in sis_alloc_timing_voice()
457 voice->timing->substream = substream; in sis_alloc_timing_voice()
458 } else if (!needed && voice->timing) { in sis_alloc_timing_voice()
459 sis_free_voice(sis, voice); in sis_alloc_timing_voice()
460 voice->timing = NULL; in sis_alloc_timing_voice()
470 struct voice *voice; in sis_playback_open() local
472 voice = sis_alloc_playback_voice(sis); in sis_playback_open()
473 if (!voice) in sis_playback_open()
476 voice->substream = substream; in sis_playback_open()
477 runtime->private_data = voice; in sis_playback_open()
491 struct voice *voice = runtime->private_data; in sis_substream_close() local
493 sis_free_voice(sis, voice); in sis_substream_close()
500 struct voice *voice = runtime->private_data; in sis_pcm_playback_prepare() local
501 void __iomem *ctrl_base = voice->ctrl_base; in sis_pcm_playback_prepare()
502 void __iomem *wave_base = voice->wave_base; in sis_pcm_playback_prepare()
528 voice->flags |= VOICE_SSO_TIMING; in sis_pcm_playback_prepare()
529 voice->sso = runtime->period_size - 1; in sis_pcm_playback_prepare()
530 voice->period_size = runtime->period_size; in sis_pcm_playback_prepare()
531 voice->buffer_size = runtime->buffer_size; in sis_pcm_playback_prepare()
568 struct voice *voice; in sis_pcm_trigger() local
599 voice = s->runtime->private_data; in sis_pcm_trigger()
600 if (voice->flags & VOICE_CAPTURE) { in sis_pcm_trigger()
601 record |= 1 << voice->num; in sis_pcm_trigger()
602 voice = voice->timing; in sis_pcm_trigger()
605 /* voice could be NULL if this a recording stream, and it in sis_pcm_trigger()
608 if (voice) in sis_pcm_trigger()
609 play[voice->num / 32] |= 1 << (voice->num & 0x1f); in sis_pcm_trigger()
635 struct voice *voice = runtime->private_data; in sis_pcm_pointer() local
638 cso = readl(voice->ctrl_base + SIS_PLAY_DMA_FORMAT_CSO); in sis_pcm_pointer()
647 struct voice *voice = &sis->capture_voice; in sis_capture_open() local
654 if (voice->flags & VOICE_IN_USE) in sis_capture_open()
655 voice = NULL; in sis_capture_open()
657 voice->flags |= VOICE_IN_USE; in sis_capture_open()
660 if (!voice) in sis_capture_open()
663 voice->substream = substream; in sis_capture_open()
664 runtime->private_data = voice; in sis_capture_open()
693 static void sis_prepare_timing_voice(struct voice *voice, in sis_prepare_timing_voice() argument
698 struct voice *timing = voice->timing; in sis_prepare_timing_voice()
752 timing->sync_base = voice->ctrl_base; in sis_prepare_timing_voice()
799 struct voice *voice = runtime->private_data; in sis_pcm_capture_prepare() local
800 void __iomem *rec_base = voice->ctrl_base; in sis_pcm_capture_prepare()
820 * use a timing voice to clock out the periods. Otherwise, we can in sis_pcm_capture_prepare()
823 if (voice->timing) { in sis_pcm_capture_prepare()
824 sis_prepare_timing_voice(voice, substream); in sis_pcm_capture_prepare()
1255 struct voice *voice; in sis_chip_create() local
1311 voice = &sis->voices[i]; in sis_chip_create()
1312 voice->num = i; in sis_chip_create()
1313 voice->ctrl_base = SIS_PLAY_DMA_ADDR(sis->ioaddr, i); in sis_chip_create()
1314 voice->wave_base = SIS_WAVE_ADDR(sis->ioaddr, i); in sis_chip_create()
1317 voice = &sis->capture_voice; in sis_chip_create()
1318 voice->flags = VOICE_CAPTURE; in sis_chip_create()
1319 voice->num = SIS_CAPTURE_CHAN_AC97_PCM_IN; in sis_chip_create()
1320 voice->ctrl_base = SIS_CAPTURE_DMA_ADDR(sis->ioaddr, voice->num); in sis_chip_create()