Lines Matching refs:sub

255 static bool hiface_pcm_playback(struct pcm_substream *sub, struct pcm_urb *urb)
257 struct snd_pcm_runtime *alsa_rt = sub->instance->runtime;
264 pcm_buffer_size = snd_pcm_lib_buffer_bytes(sub->instance);
266 if (sub->dma_off + PCM_PACKET_SIZE <= pcm_buffer_size) {
269 (unsigned int) sub->dma_off);
271 source = alsa_rt->dma_area + sub->dma_off;
279 (unsigned int) sub->dma_off);
281 len = pcm_buffer_size - sub->dma_off;
283 source = alsa_rt->dma_area + sub->dma_off;
290 sub->dma_off += PCM_PACKET_SIZE;
291 if (sub->dma_off >= pcm_buffer_size)
292 sub->dma_off -= pcm_buffer_size;
294 sub->period_off += PCM_PACKET_SIZE;
295 if (sub->period_off >= alsa_rt->period_size) {
296 sub->period_off %= alsa_rt->period_size;
306 struct pcm_substream *sub;
327 sub = &rt->playback;
328 spin_lock_irqsave(&sub->lock, flags);
329 if (sub->active)
330 do_period_elapsed = hiface_pcm_playback(sub, out_urb);
334 spin_unlock_irqrestore(&sub->lock, flags);
337 snd_pcm_period_elapsed(sub->instance);
352 struct pcm_substream *sub = NULL;
363 sub = &rt->playback;
365 if (!sub) {
386 sub->instance = alsa_sub;
387 sub->active = false;
395 struct pcm_substream *sub = hiface_pcm_get_substream(alsa_sub);
402 if (sub) {
406 spin_lock_irqsave(&sub->lock, flags);
407 sub->instance = NULL;
408 sub->active = false;
409 spin_unlock_irqrestore(&sub->lock, flags);
419 struct pcm_substream *sub = hiface_pcm_get_substream(alsa_sub);
425 if (!sub)
432 sub->dma_off = 0;
433 sub->period_off = 0;
454 struct pcm_substream *sub = hiface_pcm_get_substream(alsa_sub);
459 if (!sub)
465 spin_lock_irq(&sub->lock);
466 sub->active = true;
467 spin_unlock_irq(&sub->lock);
472 spin_lock_irq(&sub->lock);
473 sub->active = false;
474 spin_unlock_irq(&sub->lock);
484 struct pcm_substream *sub = hiface_pcm_get_substream(alsa_sub);
489 if (rt->panic || !sub)
492 spin_lock_irqsave(&sub->lock, flags);
493 dma_offset = sub->dma_off;
494 spin_unlock_irqrestore(&sub->lock, flags);