Lines Matching refs:runtime
199 struct snd_pcm_runtime *runtime; in snd_pcm_info() local
215 runtime = substream->runtime; in snd_pcm_info()
217 if (runtime) { in snd_pcm_info()
218 info->sync = runtime->sync; in snd_pcm_info()
244 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) in hw_support_mmap()
287 struct snd_pcm_hw_constraints *constrs = &substream->runtime->hw_constraints; in snd_pcm_hw_refine()
433 hw = &substream->runtime->hw; in snd_pcm_hw_refine()
478 static int period_to_usecs(struct snd_pcm_runtime *runtime) in period_to_usecs() argument
482 if (! runtime->rate) in period_to_usecs()
486 usecs = (750000 / runtime->rate) * runtime->period_size; in period_to_usecs()
487 usecs += ((750000 % runtime->rate) * runtime->period_size) / in period_to_usecs()
488 runtime->rate; in period_to_usecs()
496 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_set_state()
497 substream->runtime->status->state = state; in snd_pcm_set_state()
507 &substream->runtime->trigger_tstamp); in snd_pcm_timer_notify()
514 struct snd_pcm_runtime *runtime; in snd_pcm_hw_params() local
521 runtime = substream->runtime; in snd_pcm_hw_params()
523 switch (runtime->status->state) { in snd_pcm_hw_params()
554 runtime->access = params_access(params); in snd_pcm_hw_params()
555 runtime->format = params_format(params); in snd_pcm_hw_params()
556 runtime->subformat = params_subformat(params); in snd_pcm_hw_params()
557 runtime->channels = params_channels(params); in snd_pcm_hw_params()
558 runtime->rate = params_rate(params); in snd_pcm_hw_params()
559 runtime->period_size = params_period_size(params); in snd_pcm_hw_params()
560 runtime->periods = params_periods(params); in snd_pcm_hw_params()
561 runtime->buffer_size = params_buffer_size(params); in snd_pcm_hw_params()
562 runtime->info = params->info; in snd_pcm_hw_params()
563 runtime->rate_num = params->rate_num; in snd_pcm_hw_params()
564 runtime->rate_den = params->rate_den; in snd_pcm_hw_params()
565 runtime->no_period_wakeup = in snd_pcm_hw_params()
569 bits = snd_pcm_format_physical_width(runtime->format); in snd_pcm_hw_params()
570 runtime->sample_bits = bits; in snd_pcm_hw_params()
571 bits *= runtime->channels; in snd_pcm_hw_params()
572 runtime->frame_bits = bits; in snd_pcm_hw_params()
578 runtime->byte_align = bits / 8; in snd_pcm_hw_params()
579 runtime->min_align = frames; in snd_pcm_hw_params()
582 runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; in snd_pcm_hw_params()
583 runtime->period_step = 1; in snd_pcm_hw_params()
584 runtime->control->avail_min = runtime->period_size; in snd_pcm_hw_params()
585 runtime->start_threshold = 1; in snd_pcm_hw_params()
586 runtime->stop_threshold = runtime->buffer_size; in snd_pcm_hw_params()
587 runtime->silence_threshold = 0; in snd_pcm_hw_params()
588 runtime->silence_size = 0; in snd_pcm_hw_params()
589 runtime->boundary = runtime->buffer_size; in snd_pcm_hw_params()
590 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) in snd_pcm_hw_params()
591 runtime->boundary *= 2; in snd_pcm_hw_params()
598 if ((usecs = period_to_usecs(runtime)) >= 0) in snd_pcm_hw_params()
634 struct snd_pcm_runtime *runtime; in snd_pcm_hw_free() local
639 runtime = substream->runtime; in snd_pcm_hw_free()
641 switch (runtime->status->state) { in snd_pcm_hw_free()
662 struct snd_pcm_runtime *runtime; in snd_pcm_sw_params() local
667 runtime = substream->runtime; in snd_pcm_sw_params()
669 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_sw_params()
683 if (params->silence_size >= runtime->boundary) { in snd_pcm_sw_params()
689 if (params->silence_threshold > runtime->buffer_size) in snd_pcm_sw_params()
694 runtime->tstamp_mode = params->tstamp_mode; in snd_pcm_sw_params()
696 runtime->tstamp_type = params->tstamp_type; in snd_pcm_sw_params()
697 runtime->period_step = params->period_step; in snd_pcm_sw_params()
698 runtime->control->avail_min = params->avail_min; in snd_pcm_sw_params()
699 runtime->start_threshold = params->start_threshold; in snd_pcm_sw_params()
700 runtime->stop_threshold = params->stop_threshold; in snd_pcm_sw_params()
701 runtime->silence_threshold = params->silence_threshold; in snd_pcm_sw_params()
702 runtime->silence_size = params->silence_size; in snd_pcm_sw_params()
703 params->boundary = runtime->boundary; in snd_pcm_sw_params()
706 runtime->silence_size > 0) in snd_pcm_sw_params()
708 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
730 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status() local
735 &runtime->audio_tstamp_config); in snd_pcm_status()
738 if (runtime->audio_tstamp_config.type_requested == in snd_pcm_status()
740 if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) in snd_pcm_status()
741 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
744 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
746 runtime->audio_tstamp_report.valid = 0; in snd_pcm_status()
748 runtime->audio_tstamp_report.valid = 1; in snd_pcm_status()
750 status->state = runtime->status->state; in snd_pcm_status()
751 status->suspended_state = runtime->status->suspended_state; in snd_pcm_status()
754 status->trigger_tstamp = runtime->trigger_tstamp; in snd_pcm_status()
757 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status()
758 status->tstamp = runtime->status->tstamp; in snd_pcm_status()
759 status->driver_tstamp = runtime->driver_tstamp; in snd_pcm_status()
761 runtime->status->audio_tstamp; in snd_pcm_status()
762 if (runtime->audio_tstamp_report.valid == 1) in snd_pcm_status()
766 &runtime->audio_tstamp_report); in snd_pcm_status()
772 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) in snd_pcm_status()
773 snd_pcm_gettime(runtime, &status->tstamp); in snd_pcm_status()
776 status->appl_ptr = runtime->control->appl_ptr; in snd_pcm_status()
777 status->hw_ptr = runtime->status->hw_ptr; in snd_pcm_status()
779 status->avail = snd_pcm_playback_avail(runtime); in snd_pcm_status()
780 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING || in snd_pcm_status()
781 runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_status()
782 status->delay = runtime->buffer_size - status->avail; in snd_pcm_status()
783 status->delay += runtime->delay; in snd_pcm_status()
787 status->avail = snd_pcm_capture_avail(runtime); in snd_pcm_status()
788 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) in snd_pcm_status()
789 status->delay = status->avail + runtime->delay; in snd_pcm_status()
793 status->avail_max = runtime->avail_max; in snd_pcm_status()
794 status->overrange = runtime->overrange; in snd_pcm_status()
795 runtime->avail_max = 0; in snd_pcm_status()
796 runtime->overrange = 0; in snd_pcm_status()
829 struct snd_pcm_runtime *runtime; in snd_pcm_channel_info() local
833 runtime = substream->runtime; in snd_pcm_channel_info()
835 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_channel_info()
840 if (channel >= runtime->channels) in snd_pcm_channel_info()
865 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp() local
866 if (runtime->trigger_master == NULL) in snd_pcm_trigger_tstamp()
868 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
869 if (!runtime->trigger_tstamp_latched) in snd_pcm_trigger_tstamp()
870 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); in snd_pcm_trigger_tstamp()
872 snd_pcm_trigger_tstamp(runtime->trigger_master); in snd_pcm_trigger_tstamp()
873 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; in snd_pcm_trigger_tstamp()
875 runtime->trigger_master = NULL; in snd_pcm_trigger_tstamp()
1033 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start() local
1034 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) in snd_pcm_pre_start()
1039 runtime->trigger_tstamp_latched = false; in snd_pcm_pre_start()
1040 runtime->trigger_master = substream; in snd_pcm_pre_start()
1046 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1053 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1059 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start() local
1061 runtime->hw_ptr_jiffies = jiffies; in snd_pcm_post_start()
1062 runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / in snd_pcm_post_start()
1063 runtime->rate; in snd_pcm_post_start()
1064 runtime->status->state = state; in snd_pcm_post_start()
1066 runtime->silence_size > 0) in snd_pcm_post_start()
1095 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop() local
1096 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_pre_stop()
1098 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1104 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1112 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop() local
1113 if (runtime->status->state != state) { in snd_pcm_post_stop()
1115 runtime->status->state = state; in snd_pcm_post_stop()
1118 wake_up(&runtime->sleep); in snd_pcm_post_stop()
1119 wake_up(&runtime->tsleep); in snd_pcm_post_stop()
1186 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause() local
1187 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) in snd_pcm_pre_pause()
1190 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) in snd_pcm_pre_pause()
1192 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) in snd_pcm_pre_pause()
1194 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1200 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1210 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1218 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1226 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause() local
1229 runtime->status->state = SNDRV_PCM_STATE_PAUSED; in snd_pcm_post_pause()
1231 wake_up(&runtime->sleep); in snd_pcm_post_pause()
1232 wake_up(&runtime->tsleep); in snd_pcm_post_pause()
1234 runtime->status->state = SNDRV_PCM_STATE_RUNNING; in snd_pcm_post_pause()
1259 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend() local
1260 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_pre_suspend()
1262 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1268 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend() local
1269 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1279 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend() local
1281 runtime->status->suspended_state = runtime->status->state; in snd_pcm_post_suspend()
1282 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; in snd_pcm_post_suspend()
1284 wake_up(&runtime->sleep); in snd_pcm_post_suspend()
1285 wake_up(&runtime->tsleep); in snd_pcm_post_suspend()
1339 if (substream->runtime == NULL) in snd_pcm_suspend_all()
1355 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume() local
1356 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) in snd_pcm_pre_resume()
1358 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1364 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume() local
1365 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1368 if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && in snd_pcm_do_resume()
1369 (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || in snd_pcm_do_resume()
1377 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1384 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume() local
1386 runtime->status->state = runtime->status->suspended_state; in snd_pcm_post_resume()
1426 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun() local
1430 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_xrun()
1437 switch (runtime->status->state) { in snd_pcm_xrun()
1458 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset() local
1459 switch (runtime->status->state) { in snd_pcm_pre_reset()
1472 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset() local
1476 runtime->hw_ptr_base = 0; in snd_pcm_do_reset()
1477 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - in snd_pcm_do_reset()
1478 runtime->status->hw_ptr % runtime->period_size; in snd_pcm_do_reset()
1479 runtime->silence_start = runtime->status->hw_ptr; in snd_pcm_do_reset()
1480 runtime->silence_filled = 0; in snd_pcm_do_reset()
1486 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset() local
1487 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_reset()
1489 runtime->silence_size > 0) in snd_pcm_post_reset()
1511 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare() local
1512 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_pre_prepare()
1513 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_pre_prepare()
1532 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare() local
1533 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_prepare()
1576 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init() local
1577 switch (runtime->status->state) { in snd_pcm_pre_drain_init()
1583 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1589 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init() local
1591 switch (runtime->status->state) { in snd_pcm_do_drain_init()
1598 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1602 runtime->status->state = SNDRV_PCM_STATE_DRAINING; in snd_pcm_do_drain_init()
1605 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1612 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { in snd_pcm_do_drain_init()
1613 int new_state = snd_pcm_capture_avail(runtime) > 0 ? in snd_pcm_do_drain_init()
1620 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && in snd_pcm_do_drain_init()
1621 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1622 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) in snd_pcm_do_drain_init()
1652 struct snd_pcm_runtime *runtime; in snd_pcm_drain() local
1659 runtime = substream->runtime; in snd_pcm_drain()
1661 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_drain()
1665 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_drain()
1682 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drain()
1707 runtime = s->runtime; in snd_pcm_drain()
1708 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_drain()
1709 to_check = runtime; in snd_pcm_drain()
1720 if (runtime->no_period_wakeup) in snd_pcm_drain()
1724 if (runtime->rate) { in snd_pcm_drain()
1725 long t = runtime->period_size * 2 / runtime->rate; in snd_pcm_drain()
1740 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
1767 struct snd_pcm_runtime *runtime; in snd_pcm_drop() local
1772 runtime = substream->runtime; in snd_pcm_drop()
1774 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_drop()
1775 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED || in snd_pcm_drop()
1776 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drop()
1781 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drop()
1830 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
1831 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
2020 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init() local
2021 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; in snd_pcm_hw_constraints_init()
2038 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, in snd_pcm_hw_constraints_init()
2043 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2049 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2054 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2059 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2064 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2069 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_init()
2074 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2079 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2084 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_init()
2089 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2094 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2099 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2104 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2109 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2114 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2119 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_init()
2124 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_init()
2129 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, in snd_pcm_hw_constraints_init()
2134 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, in snd_pcm_hw_constraints_init()
2144 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete() local
2145 struct snd_pcm_hardware *hw = &runtime->hw; in snd_pcm_hw_constraints_complete()
2161 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); in snd_pcm_hw_constraints_complete()
2165 err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); in snd_pcm_hw_constraints_complete()
2169 …err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, 1 << SNDRV_PCM_SUBFORMAT_S… in snd_pcm_hw_constraints_complete()
2173 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_complete()
2178 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2183 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_complete()
2188 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_complete()
2193 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2198 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2205 if (runtime->dma_bytes) { in snd_pcm_hw_constraints_complete()
2206 …err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes… in snd_pcm_hw_constraints_complete()
2212 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2220 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); in snd_pcm_hw_constraints_complete()
2239 substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) in snd_pcm_release_substream()
2433 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_rewind() local
2442 switch (runtime->status->state) { in snd_pcm_playback_rewind()
2461 hw_avail = snd_pcm_playback_hw_avail(runtime); in snd_pcm_playback_rewind()
2468 appl_ptr = runtime->control->appl_ptr - frames; in snd_pcm_playback_rewind()
2470 appl_ptr += runtime->boundary; in snd_pcm_playback_rewind()
2471 runtime->control->appl_ptr = appl_ptr; in snd_pcm_playback_rewind()
2481 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_rewind() local
2490 switch (runtime->status->state) { in snd_pcm_capture_rewind()
2509 hw_avail = snd_pcm_capture_hw_avail(runtime); in snd_pcm_capture_rewind()
2516 appl_ptr = runtime->control->appl_ptr - frames; in snd_pcm_capture_rewind()
2518 appl_ptr += runtime->boundary; in snd_pcm_capture_rewind()
2519 runtime->control->appl_ptr = appl_ptr; in snd_pcm_capture_rewind()
2529 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_forward() local
2538 switch (runtime->status->state) { in snd_pcm_playback_forward()
2558 avail = snd_pcm_playback_avail(runtime); in snd_pcm_playback_forward()
2565 appl_ptr = runtime->control->appl_ptr + frames; in snd_pcm_playback_forward()
2566 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in snd_pcm_playback_forward()
2567 appl_ptr -= runtime->boundary; in snd_pcm_playback_forward()
2568 runtime->control->appl_ptr = appl_ptr; in snd_pcm_playback_forward()
2578 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_forward() local
2587 switch (runtime->status->state) { in snd_pcm_capture_forward()
2607 avail = snd_pcm_capture_avail(runtime); in snd_pcm_capture_forward()
2614 appl_ptr = runtime->control->appl_ptr + frames; in snd_pcm_capture_forward()
2615 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in snd_pcm_capture_forward()
2616 appl_ptr -= runtime->boundary; in snd_pcm_capture_forward()
2617 runtime->control->appl_ptr = appl_ptr; in snd_pcm_capture_forward()
2626 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hwsync() local
2630 switch (runtime->status->state) { in snd_pcm_hwsync()
2658 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_delay() local
2663 switch (runtime->status->state) { in snd_pcm_delay()
2676 n = snd_pcm_playback_hw_avail(runtime); in snd_pcm_delay()
2678 n = snd_pcm_capture_avail(runtime); in snd_pcm_delay()
2679 n += runtime->delay; in snd_pcm_delay()
2699 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr() local
2710 status = runtime->status; in snd_pcm_sync_ptr()
2711 control = runtime->control; in snd_pcm_sync_ptr()
2738 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp() local
2745 runtime->tstamp_type = arg; in snd_pcm_tstamp()
2832 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_ioctl1() local
2834 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_playback_ioctl1()
2848 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_ioctl1() local
2851 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_playback_ioctl1()
2853 if (runtime->channels > 128) in snd_pcm_playback_ioctl1()
2861 sizeof(void *) * runtime->channels); in snd_pcm_playback_ioctl1()
2912 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_ioctl1() local
2914 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_capture_ioctl1()
2928 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_ioctl1() local
2931 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_capture_ioctl1()
2933 if (runtime->channels > 128) in snd_pcm_capture_ioctl1()
2941 sizeof(void *) * runtime->channels); in snd_pcm_capture_ioctl1()
3038 struct snd_pcm_runtime *runtime; in snd_pcm_read() local
3045 runtime = substream->runtime; in snd_pcm_read()
3046 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_read()
3048 if (!frame_aligned(runtime, count)) in snd_pcm_read()
3050 count = bytes_to_frames(runtime, count); in snd_pcm_read()
3053 result = frames_to_bytes(runtime, result); in snd_pcm_read()
3062 struct snd_pcm_runtime *runtime; in snd_pcm_write() local
3069 runtime = substream->runtime; in snd_pcm_write()
3070 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_write()
3072 if (!frame_aligned(runtime, count)) in snd_pcm_write()
3074 count = bytes_to_frames(runtime, count); in snd_pcm_write()
3077 result = frames_to_bytes(runtime, result); in snd_pcm_write()
3085 struct snd_pcm_runtime *runtime; in snd_pcm_readv() local
3095 runtime = substream->runtime; in snd_pcm_readv()
3096 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_readv()
3100 if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) in snd_pcm_readv()
3102 if (!frame_aligned(runtime, to->iov->iov_len)) in snd_pcm_readv()
3104 frames = bytes_to_samples(runtime, to->iov->iov_len); in snd_pcm_readv()
3112 result = frames_to_bytes(runtime, result); in snd_pcm_readv()
3121 struct snd_pcm_runtime *runtime; in snd_pcm_writev() local
3131 runtime = substream->runtime; in snd_pcm_writev()
3132 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_writev()
3136 if (from->nr_segs > 128 || from->nr_segs != runtime->channels || in snd_pcm_writev()
3137 !frame_aligned(runtime, from->iov->iov_len)) in snd_pcm_writev()
3139 frames = bytes_to_samples(runtime, from->iov->iov_len); in snd_pcm_writev()
3147 result = frames_to_bytes(runtime, result); in snd_pcm_writev()
3156 struct snd_pcm_runtime *runtime; in snd_pcm_playback_poll() local
3165 runtime = substream->runtime; in snd_pcm_playback_poll()
3167 poll_wait(file, &runtime->sleep, wait); in snd_pcm_playback_poll()
3170 avail = snd_pcm_playback_avail(runtime); in snd_pcm_playback_poll()
3171 switch (runtime->status->state) { in snd_pcm_playback_poll()
3175 if (avail >= runtime->control->avail_min) { in snd_pcm_playback_poll()
3195 struct snd_pcm_runtime *runtime; in snd_pcm_capture_poll() local
3204 runtime = substream->runtime; in snd_pcm_capture_poll()
3206 poll_wait(file, &runtime->sleep, wait); in snd_pcm_capture_poll()
3209 avail = snd_pcm_capture_avail(runtime); in snd_pcm_capture_poll()
3210 switch (runtime->status->state) { in snd_pcm_capture_poll()
3214 if (avail >= runtime->control->avail_min) { in snd_pcm_capture_poll()
3250 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_status_fault() local
3254 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3255 vmf->page = virt_to_page(runtime->status); in snd_pcm_mmap_status_fault()
3287 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_control_fault() local
3291 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3292 vmf->page = virt_to_page(runtime->control); in snd_pcm_mmap_control_fault()
3335 void *vaddr = substream->runtime->dma_area + ofs; in snd_pcm_default_page_ops()
3346 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data_fault() local
3353 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3355 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data_fault()
3409 substream->runtime->dma_area, in snd_pcm_lib_default_mmap()
3410 substream->runtime->dma_addr, in snd_pcm_lib_default_mmap()
3435 struct snd_pcm_runtime *runtime = substream->runtime;; in snd_pcm_lib_mmap_iomem() local
3438 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); in snd_pcm_lib_mmap_iomem()
3450 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data() local
3463 runtime = substream->runtime; in snd_pcm_mmap_data()
3464 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_mmap_data()
3466 if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) in snd_pcm_mmap_data()
3468 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in snd_pcm_mmap_data()
3469 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_mmap_data()
3473 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data()
3523 struct snd_pcm_runtime *runtime; in snd_pcm_fasync() local
3529 runtime = substream->runtime; in snd_pcm_fasync()
3530 return fasync_helper(fd, file, on, &runtime->fasync); in snd_pcm_fasync()
3658 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area() local
3663 return (unsigned long)runtime->status; in snd_pcm_get_unmapped_area()
3665 return (unsigned long)runtime->control; in snd_pcm_get_unmapped_area()
3667 return (unsigned long)runtime->dma_area + offset; in snd_pcm_get_unmapped_area()