Lines Matching refs:dpcm

236 static void dummy_systimer_rearm(struct dummy_systimer_pcm *dpcm)
238 mod_timer(&dpcm->timer, jiffies +
239 (dpcm->frac_period_rest + dpcm->rate - 1) / dpcm->rate);
242 static void dummy_systimer_update(struct dummy_systimer_pcm *dpcm)
246 delta = jiffies - dpcm->base_time;
249 dpcm->base_time += delta;
250 delta *= dpcm->rate;
251 dpcm->frac_pos += delta;
252 while (dpcm->frac_pos >= dpcm->frac_buffer_size)
253 dpcm->frac_pos -= dpcm->frac_buffer_size;
254 while (dpcm->frac_period_rest <= delta) {
255 dpcm->elapsed++;
256 dpcm->frac_period_rest += dpcm->frac_period_size;
258 dpcm->frac_period_rest -= delta;
263 struct dummy_systimer_pcm *dpcm = substream->runtime->private_data;
264 spin_lock(&dpcm->lock);
265 dpcm->base_time = jiffies;
266 dummy_systimer_rearm(dpcm);
267 spin_unlock(&dpcm->lock);
273 struct dummy_systimer_pcm *dpcm = substream->runtime->private_data;
274 spin_lock(&dpcm->lock);
275 del_timer(&dpcm->timer);
276 spin_unlock(&dpcm->lock);
283 struct dummy_systimer_pcm *dpcm = runtime->private_data;
285 dpcm->frac_pos = 0;
286 dpcm->rate = runtime->rate;
287 dpcm->frac_buffer_size = runtime->buffer_size * HZ;
288 dpcm->frac_period_size = runtime->period_size * HZ;
289 dpcm->frac_period_rest = dpcm->frac_period_size;
290 dpcm->elapsed = 0;
297 struct dummy_systimer_pcm *dpcm = from_timer(dpcm, t, timer);
301 spin_lock_irqsave(&dpcm->lock, flags);
302 dummy_systimer_update(dpcm);
303 dummy_systimer_rearm(dpcm);
304 elapsed = dpcm->elapsed;
305 dpcm->elapsed = 0;
306 spin_unlock_irqrestore(&dpcm->lock, flags);
308 snd_pcm_period_elapsed(dpcm->substream);
314 struct dummy_systimer_pcm *dpcm = substream->runtime->private_data;
317 spin_lock(&dpcm->lock);
318 dummy_systimer_update(dpcm);
319 pos = dpcm->frac_pos / HZ;
320 spin_unlock(&dpcm->lock);
326 struct dummy_systimer_pcm *dpcm;
328 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
329 if (!dpcm)
331 substream->runtime->private_data = dpcm;
332 timer_setup(&dpcm->timer, dummy_systimer_callback, 0);
333 spin_lock_init(&dpcm->lock);
334 dpcm->substream = substream;
369 struct dummy_hrtimer_pcm *dpcm;
371 dpcm = container_of(timer, struct dummy_hrtimer_pcm, timer);
372 if (!atomic_read(&dpcm->running))
378 snd_pcm_period_elapsed(dpcm->substream);
379 if (!atomic_read(&dpcm->running))
382 hrtimer_forward_now(timer, dpcm->period_time);
388 struct dummy_hrtimer_pcm *dpcm = substream->runtime->private_data;
390 dpcm->base_time = hrtimer_cb_get_time(&dpcm->timer);
391 hrtimer_start(&dpcm->timer, dpcm->period_time, HRTIMER_MODE_REL_SOFT);
392 atomic_set(&dpcm->running, 1);
398 struct dummy_hrtimer_pcm *dpcm = substream->runtime->private_data;
400 atomic_set(&dpcm->running, 0);
401 if (!hrtimer_callback_running(&dpcm->timer))
402 hrtimer_cancel(&dpcm->timer);
406 static inline void dummy_hrtimer_sync(struct dummy_hrtimer_pcm *dpcm)
408 hrtimer_cancel(&dpcm->timer);
415 struct dummy_hrtimer_pcm *dpcm = runtime->private_data;
419 delta = ktime_us_delta(hrtimer_cb_get_time(&dpcm->timer),
420 dpcm->base_time);
429 struct dummy_hrtimer_pcm *dpcm = runtime->private_data;
434 dummy_hrtimer_sync(dpcm);
440 dpcm->period_time = ktime_set(sec, nsecs);
447 struct dummy_hrtimer_pcm *dpcm;
449 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
450 if (!dpcm)
452 substream->runtime->private_data = dpcm;
453 hrtimer_init(&dpcm->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
454 dpcm->timer.function = dummy_hrtimer_callback;
455 dpcm->substream = substream;
456 atomic_set(&dpcm->running, 0);
462 struct dummy_hrtimer_pcm *dpcm = substream->runtime->private_data;
463 dummy_hrtimer_sync(dpcm);
464 kfree(dpcm);