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()
504 struct snd_pcm_runtime *runtime; in snd_pcm_hw_params() local
511 runtime = substream->runtime; in snd_pcm_hw_params()
513 switch (runtime->status->state) { in snd_pcm_hw_params()
544 runtime->access = params_access(params); in snd_pcm_hw_params()
545 runtime->format = params_format(params); in snd_pcm_hw_params()
546 runtime->subformat = params_subformat(params); in snd_pcm_hw_params()
547 runtime->channels = params_channels(params); in snd_pcm_hw_params()
548 runtime->rate = params_rate(params); in snd_pcm_hw_params()
549 runtime->period_size = params_period_size(params); in snd_pcm_hw_params()
550 runtime->periods = params_periods(params); in snd_pcm_hw_params()
551 runtime->buffer_size = params_buffer_size(params); in snd_pcm_hw_params()
552 runtime->info = params->info; in snd_pcm_hw_params()
553 runtime->rate_num = params->rate_num; in snd_pcm_hw_params()
554 runtime->rate_den = params->rate_den; in snd_pcm_hw_params()
555 runtime->no_period_wakeup = in snd_pcm_hw_params()
559 bits = snd_pcm_format_physical_width(runtime->format); in snd_pcm_hw_params()
560 runtime->sample_bits = bits; in snd_pcm_hw_params()
561 bits *= runtime->channels; in snd_pcm_hw_params()
562 runtime->frame_bits = bits; in snd_pcm_hw_params()
568 runtime->byte_align = bits / 8; in snd_pcm_hw_params()
569 runtime->min_align = frames; in snd_pcm_hw_params()
572 runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; in snd_pcm_hw_params()
573 runtime->period_step = 1; in snd_pcm_hw_params()
574 runtime->control->avail_min = runtime->period_size; in snd_pcm_hw_params()
575 runtime->start_threshold = 1; in snd_pcm_hw_params()
576 runtime->stop_threshold = runtime->buffer_size; in snd_pcm_hw_params()
577 runtime->silence_threshold = 0; in snd_pcm_hw_params()
578 runtime->silence_size = 0; in snd_pcm_hw_params()
579 runtime->boundary = runtime->buffer_size; in snd_pcm_hw_params()
580 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) in snd_pcm_hw_params()
581 runtime->boundary *= 2; in snd_pcm_hw_params()
588 if ((usecs = period_to_usecs(runtime)) >= 0) in snd_pcm_hw_params()
624 struct snd_pcm_runtime *runtime; in snd_pcm_hw_free() local
629 runtime = substream->runtime; in snd_pcm_hw_free()
631 switch (runtime->status->state) { in snd_pcm_hw_free()
652 struct snd_pcm_runtime *runtime; in snd_pcm_sw_params() local
657 runtime = substream->runtime; in snd_pcm_sw_params()
659 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_sw_params()
672 if (params->silence_size >= runtime->boundary) { in snd_pcm_sw_params()
678 if (params->silence_threshold > runtime->buffer_size) in snd_pcm_sw_params()
683 runtime->tstamp_mode = params->tstamp_mode; in snd_pcm_sw_params()
685 runtime->tstamp_type = params->tstamp_type; in snd_pcm_sw_params()
686 runtime->period_step = params->period_step; in snd_pcm_sw_params()
687 runtime->control->avail_min = params->avail_min; in snd_pcm_sw_params()
688 runtime->start_threshold = params->start_threshold; in snd_pcm_sw_params()
689 runtime->stop_threshold = params->stop_threshold; in snd_pcm_sw_params()
690 runtime->silence_threshold = params->silence_threshold; in snd_pcm_sw_params()
691 runtime->silence_size = params->silence_size; in snd_pcm_sw_params()
692 params->boundary = runtime->boundary; in snd_pcm_sw_params()
695 runtime->silence_size > 0) in snd_pcm_sw_params()
697 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
719 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status() local
724 &runtime->audio_tstamp_config); in snd_pcm_status()
727 if (runtime->audio_tstamp_config.type_requested == in snd_pcm_status()
729 if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) in snd_pcm_status()
730 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
733 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
735 runtime->audio_tstamp_report.valid = 0; in snd_pcm_status()
737 runtime->audio_tstamp_report.valid = 1; in snd_pcm_status()
739 status->state = runtime->status->state; in snd_pcm_status()
740 status->suspended_state = runtime->status->suspended_state; in snd_pcm_status()
743 status->trigger_tstamp = runtime->trigger_tstamp; in snd_pcm_status()
746 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status()
747 status->tstamp = runtime->status->tstamp; in snd_pcm_status()
748 status->driver_tstamp = runtime->driver_tstamp; in snd_pcm_status()
750 runtime->status->audio_tstamp; in snd_pcm_status()
751 if (runtime->audio_tstamp_report.valid == 1) in snd_pcm_status()
755 &runtime->audio_tstamp_report); in snd_pcm_status()
761 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) in snd_pcm_status()
762 snd_pcm_gettime(runtime, &status->tstamp); in snd_pcm_status()
765 status->appl_ptr = runtime->control->appl_ptr; in snd_pcm_status()
766 status->hw_ptr = runtime->status->hw_ptr; in snd_pcm_status()
768 status->avail = snd_pcm_playback_avail(runtime); in snd_pcm_status()
769 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING || in snd_pcm_status()
770 runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_status()
771 status->delay = runtime->buffer_size - status->avail; in snd_pcm_status()
772 status->delay += runtime->delay; in snd_pcm_status()
776 status->avail = snd_pcm_capture_avail(runtime); in snd_pcm_status()
777 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) in snd_pcm_status()
778 status->delay = status->avail + runtime->delay; in snd_pcm_status()
782 status->avail_max = runtime->avail_max; in snd_pcm_status()
783 status->overrange = runtime->overrange; in snd_pcm_status()
784 runtime->avail_max = 0; in snd_pcm_status()
785 runtime->overrange = 0; in snd_pcm_status()
818 struct snd_pcm_runtime *runtime; in snd_pcm_channel_info() local
822 runtime = substream->runtime; in snd_pcm_channel_info()
824 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_channel_info()
829 if (channel >= runtime->channels) in snd_pcm_channel_info()
854 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp() local
855 if (runtime->trigger_master == NULL) in snd_pcm_trigger_tstamp()
857 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
858 if (!runtime->trigger_tstamp_latched) in snd_pcm_trigger_tstamp()
859 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); in snd_pcm_trigger_tstamp()
861 snd_pcm_trigger_tstamp(runtime->trigger_master); in snd_pcm_trigger_tstamp()
862 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; in snd_pcm_trigger_tstamp()
864 runtime->trigger_master = NULL; in snd_pcm_trigger_tstamp()
1022 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start() local
1023 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) in snd_pcm_pre_start()
1028 runtime->trigger_tstamp_latched = false; in snd_pcm_pre_start()
1029 runtime->trigger_master = substream; in snd_pcm_pre_start()
1035 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1042 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1048 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start() local
1050 runtime->hw_ptr_jiffies = jiffies; in snd_pcm_post_start()
1051 runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / in snd_pcm_post_start()
1052 runtime->rate; in snd_pcm_post_start()
1053 runtime->status->state = state; in snd_pcm_post_start()
1055 runtime->silence_size > 0) in snd_pcm_post_start()
1059 &runtime->trigger_tstamp); in snd_pcm_post_start()
1086 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop() local
1087 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_pre_stop()
1089 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1095 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1103 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop() local
1104 if (runtime->status->state != state) { in snd_pcm_post_stop()
1106 runtime->status->state = state; in snd_pcm_post_stop()
1109 &runtime->trigger_tstamp); in snd_pcm_post_stop()
1111 wake_up(&runtime->sleep); in snd_pcm_post_stop()
1112 wake_up(&runtime->tsleep); in snd_pcm_post_stop()
1179 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause() local
1180 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) in snd_pcm_pre_pause()
1183 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) in snd_pcm_pre_pause()
1185 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) in snd_pcm_pre_pause()
1187 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1193 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1203 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1211 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1219 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause() local
1222 runtime->status->state = SNDRV_PCM_STATE_PAUSED; in snd_pcm_post_pause()
1226 &runtime->trigger_tstamp); in snd_pcm_post_pause()
1227 wake_up(&runtime->sleep); in snd_pcm_post_pause()
1228 wake_up(&runtime->tsleep); in snd_pcm_post_pause()
1230 runtime->status->state = SNDRV_PCM_STATE_RUNNING; in snd_pcm_post_pause()
1234 &runtime->trigger_tstamp); in snd_pcm_post_pause()
1258 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend() local
1259 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_pre_suspend()
1261 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1267 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend() local
1268 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1278 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend() local
1280 runtime->status->suspended_state = runtime->status->state; in snd_pcm_post_suspend()
1281 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; in snd_pcm_post_suspend()
1284 &runtime->trigger_tstamp); in snd_pcm_post_suspend()
1285 wake_up(&runtime->sleep); in snd_pcm_post_suspend()
1286 wake_up(&runtime->tsleep); in snd_pcm_post_suspend()
1340 if (substream->runtime == NULL) in snd_pcm_suspend_all()
1356 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume() local
1357 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) in snd_pcm_pre_resume()
1359 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1365 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume() local
1366 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1369 if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && in snd_pcm_do_resume()
1370 (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || in snd_pcm_do_resume()
1378 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1385 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume() local
1387 runtime->status->state = runtime->status->suspended_state; in snd_pcm_post_resume()
1390 &runtime->trigger_tstamp); in snd_pcm_post_resume()
1429 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun() local
1433 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_xrun()
1440 switch (runtime->status->state) { in snd_pcm_xrun()
1461 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset() local
1462 switch (runtime->status->state) { in snd_pcm_pre_reset()
1475 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset() local
1479 runtime->hw_ptr_base = 0; in snd_pcm_do_reset()
1480 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - in snd_pcm_do_reset()
1481 runtime->status->hw_ptr % runtime->period_size; in snd_pcm_do_reset()
1482 runtime->silence_start = runtime->status->hw_ptr; in snd_pcm_do_reset()
1483 runtime->silence_filled = 0; in snd_pcm_do_reset()
1489 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset() local
1490 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_reset()
1492 runtime->silence_size > 0) in snd_pcm_post_reset()
1514 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare() local
1515 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_pre_prepare()
1516 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_pre_prepare()
1535 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare() local
1536 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_prepare()
1579 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init() local
1580 switch (runtime->status->state) { in snd_pcm_pre_drain_init()
1586 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1592 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init() local
1594 switch (runtime->status->state) { in snd_pcm_do_drain_init()
1601 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1605 runtime->status->state = SNDRV_PCM_STATE_DRAINING; in snd_pcm_do_drain_init()
1608 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1615 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { in snd_pcm_do_drain_init()
1616 int new_state = snd_pcm_capture_avail(runtime) > 0 ? in snd_pcm_do_drain_init()
1623 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && in snd_pcm_do_drain_init()
1624 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1625 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) in snd_pcm_do_drain_init()
1655 struct snd_pcm_runtime *runtime; in snd_pcm_drain() local
1662 runtime = substream->runtime; in snd_pcm_drain()
1664 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_drain()
1668 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_drain()
1685 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drain()
1710 runtime = s->runtime; in snd_pcm_drain()
1711 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_drain()
1712 to_check = runtime; in snd_pcm_drain()
1723 if (runtime->no_period_wakeup) in snd_pcm_drain()
1727 if (runtime->rate) { in snd_pcm_drain()
1728 long t = runtime->period_size * 2 / runtime->rate; in snd_pcm_drain()
1743 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
1770 struct snd_pcm_runtime *runtime; in snd_pcm_drop() local
1775 runtime = substream->runtime; in snd_pcm_drop()
1777 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_drop()
1778 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED || in snd_pcm_drop()
1779 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drop()
1784 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drop()
1833 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
1834 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
2023 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init() local
2024 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; in snd_pcm_hw_constraints_init()
2041 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, in snd_pcm_hw_constraints_init()
2046 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2052 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2057 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2062 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2067 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2072 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_init()
2077 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2082 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2087 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_init()
2092 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2097 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2102 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2107 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2112 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2117 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2122 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_init()
2127 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_init()
2132 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, in snd_pcm_hw_constraints_init()
2137 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, in snd_pcm_hw_constraints_init()
2147 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete() local
2148 struct snd_pcm_hardware *hw = &runtime->hw; in snd_pcm_hw_constraints_complete()
2164 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); in snd_pcm_hw_constraints_complete()
2168 err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); in snd_pcm_hw_constraints_complete()
2172 …err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, 1 << SNDRV_PCM_SUBFORMAT_S… in snd_pcm_hw_constraints_complete()
2176 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_complete()
2181 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2186 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_complete()
2191 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_complete()
2196 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2201 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2208 if (runtime->dma_bytes) { in snd_pcm_hw_constraints_complete()
2209 …err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes… in snd_pcm_hw_constraints_complete()
2215 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2223 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); in snd_pcm_hw_constraints_complete()
2435 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_rewind() local
2444 switch (runtime->status->state) { in snd_pcm_playback_rewind()
2463 hw_avail = snd_pcm_playback_hw_avail(runtime); in snd_pcm_playback_rewind()
2470 appl_ptr = runtime->control->appl_ptr - frames; in snd_pcm_playback_rewind()
2472 appl_ptr += runtime->boundary; in snd_pcm_playback_rewind()
2473 runtime->control->appl_ptr = appl_ptr; in snd_pcm_playback_rewind()
2483 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_rewind() local
2492 switch (runtime->status->state) { in snd_pcm_capture_rewind()
2511 hw_avail = snd_pcm_capture_hw_avail(runtime); in snd_pcm_capture_rewind()
2518 appl_ptr = runtime->control->appl_ptr - frames; in snd_pcm_capture_rewind()
2520 appl_ptr += runtime->boundary; in snd_pcm_capture_rewind()
2521 runtime->control->appl_ptr = appl_ptr; in snd_pcm_capture_rewind()
2531 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_forward() local
2540 switch (runtime->status->state) { in snd_pcm_playback_forward()
2560 avail = snd_pcm_playback_avail(runtime); in snd_pcm_playback_forward()
2567 appl_ptr = runtime->control->appl_ptr + frames; in snd_pcm_playback_forward()
2568 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in snd_pcm_playback_forward()
2569 appl_ptr -= runtime->boundary; in snd_pcm_playback_forward()
2570 runtime->control->appl_ptr = appl_ptr; in snd_pcm_playback_forward()
2580 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_forward() local
2589 switch (runtime->status->state) { in snd_pcm_capture_forward()
2609 avail = snd_pcm_capture_avail(runtime); in snd_pcm_capture_forward()
2616 appl_ptr = runtime->control->appl_ptr + frames; in snd_pcm_capture_forward()
2617 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in snd_pcm_capture_forward()
2618 appl_ptr -= runtime->boundary; in snd_pcm_capture_forward()
2619 runtime->control->appl_ptr = appl_ptr; in snd_pcm_capture_forward()
2628 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hwsync() local
2632 switch (runtime->status->state) { in snd_pcm_hwsync()
2660 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_delay() local
2665 switch (runtime->status->state) { in snd_pcm_delay()
2678 n = snd_pcm_playback_hw_avail(runtime); in snd_pcm_delay()
2680 n = snd_pcm_capture_avail(runtime); in snd_pcm_delay()
2681 n += runtime->delay; in snd_pcm_delay()
2701 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr() local
2712 status = runtime->status; in snd_pcm_sync_ptr()
2713 control = runtime->control; in snd_pcm_sync_ptr()
2740 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp() local
2747 runtime->tstamp_type = arg; in snd_pcm_tstamp()
2834 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_ioctl1() local
2836 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_playback_ioctl1()
2850 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_ioctl1() local
2853 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_playback_ioctl1()
2855 if (runtime->channels > 128) in snd_pcm_playback_ioctl1()
2863 sizeof(void *) * runtime->channels); in snd_pcm_playback_ioctl1()
2914 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_ioctl1() local
2916 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_capture_ioctl1()
2930 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_ioctl1() local
2933 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_capture_ioctl1()
2935 if (runtime->channels > 128) in snd_pcm_capture_ioctl1()
2943 sizeof(void *) * runtime->channels); in snd_pcm_capture_ioctl1()
3040 struct snd_pcm_runtime *runtime; in snd_pcm_read() local
3047 runtime = substream->runtime; in snd_pcm_read()
3048 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_read()
3050 if (!frame_aligned(runtime, count)) in snd_pcm_read()
3052 count = bytes_to_frames(runtime, count); in snd_pcm_read()
3055 result = frames_to_bytes(runtime, result); in snd_pcm_read()
3064 struct snd_pcm_runtime *runtime; in snd_pcm_write() local
3071 runtime = substream->runtime; in snd_pcm_write()
3072 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_write()
3074 if (!frame_aligned(runtime, count)) in snd_pcm_write()
3076 count = bytes_to_frames(runtime, count); in snd_pcm_write()
3079 result = frames_to_bytes(runtime, result); in snd_pcm_write()
3087 struct snd_pcm_runtime *runtime; in snd_pcm_readv() local
3097 runtime = substream->runtime; in snd_pcm_readv()
3098 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_readv()
3102 if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) in snd_pcm_readv()
3104 if (!frame_aligned(runtime, to->iov->iov_len)) in snd_pcm_readv()
3106 frames = bytes_to_samples(runtime, to->iov->iov_len); in snd_pcm_readv()
3114 result = frames_to_bytes(runtime, result); in snd_pcm_readv()
3123 struct snd_pcm_runtime *runtime; in snd_pcm_writev() local
3133 runtime = substream->runtime; in snd_pcm_writev()
3134 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_writev()
3138 if (from->nr_segs > 128 || from->nr_segs != runtime->channels || in snd_pcm_writev()
3139 !frame_aligned(runtime, from->iov->iov_len)) in snd_pcm_writev()
3141 frames = bytes_to_samples(runtime, from->iov->iov_len); in snd_pcm_writev()
3149 result = frames_to_bytes(runtime, result); in snd_pcm_writev()
3158 struct snd_pcm_runtime *runtime; in snd_pcm_playback_poll() local
3167 runtime = substream->runtime; in snd_pcm_playback_poll()
3169 poll_wait(file, &runtime->sleep, wait); in snd_pcm_playback_poll()
3172 avail = snd_pcm_playback_avail(runtime); in snd_pcm_playback_poll()
3173 switch (runtime->status->state) { in snd_pcm_playback_poll()
3177 if (avail >= runtime->control->avail_min) { in snd_pcm_playback_poll()
3197 struct snd_pcm_runtime *runtime; in snd_pcm_capture_poll() local
3206 runtime = substream->runtime; in snd_pcm_capture_poll()
3208 poll_wait(file, &runtime->sleep, wait); in snd_pcm_capture_poll()
3211 avail = snd_pcm_capture_avail(runtime); in snd_pcm_capture_poll()
3212 switch (runtime->status->state) { in snd_pcm_capture_poll()
3216 if (avail >= runtime->control->avail_min) { in snd_pcm_capture_poll()
3252 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_status_fault() local
3256 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3257 vmf->page = virt_to_page(runtime->status); in snd_pcm_mmap_status_fault()
3289 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_control_fault() local
3293 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3294 vmf->page = virt_to_page(runtime->control); in snd_pcm_mmap_control_fault()
3337 void *vaddr = substream->runtime->dma_area + ofs; in snd_pcm_default_page_ops()
3348 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data_fault() local
3355 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3357 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data_fault()
3411 substream->runtime->dma_area, in snd_pcm_lib_default_mmap()
3412 substream->runtime->dma_addr, in snd_pcm_lib_default_mmap()
3437 struct snd_pcm_runtime *runtime = substream->runtime;; in snd_pcm_lib_mmap_iomem() local
3440 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); in snd_pcm_lib_mmap_iomem()
3452 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data() local
3465 runtime = substream->runtime; in snd_pcm_mmap_data()
3466 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_mmap_data()
3468 if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) in snd_pcm_mmap_data()
3470 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in snd_pcm_mmap_data()
3471 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_mmap_data()
3475 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data()
3525 struct snd_pcm_runtime *runtime; in snd_pcm_fasync() local
3531 runtime = substream->runtime; in snd_pcm_fasync()
3532 return fasync_helper(fd, file, on, &runtime->fasync); in snd_pcm_fasync()
3660 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area() local
3665 return (unsigned long)runtime->status; in snd_pcm_get_unmapped_area()
3667 return (unsigned long)runtime->control; in snd_pcm_get_unmapped_area()
3669 return (unsigned long)runtime->dma_area + offset; in snd_pcm_get_unmapped_area()