Lines Matching refs:runtime
266 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) in hw_support_mmap()
281 &substream->runtime->hw_constraints; in constrain_mask_params()
317 &substream->runtime->hw_constraints; in constrain_interval_params()
353 &substream->runtime->hw_constraints; in constrain_params_by_rules()
503 params->info = substream->runtime->hw.info; in fixup_unreferenced_params()
571 static int period_to_usecs(struct snd_pcm_runtime *runtime) in period_to_usecs() argument
575 if (! runtime->rate) in period_to_usecs()
579 usecs = (750000 / runtime->rate) * runtime->period_size; in period_to_usecs()
580 usecs += ((750000 % runtime->rate) * runtime->period_size) / in period_to_usecs()
581 runtime->rate; in period_to_usecs()
589 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_set_state()
590 substream->runtime->status->state = state; in snd_pcm_set_state()
600 &substream->runtime->trigger_tstamp); in snd_pcm_timer_notify()
671 struct snd_pcm_runtime *runtime; in snd_pcm_hw_params() local
678 runtime = substream->runtime; in snd_pcm_hw_params()
680 switch (runtime->status->state) { in snd_pcm_hw_params()
715 runtime->access = params_access(params); in snd_pcm_hw_params()
716 runtime->format = params_format(params); in snd_pcm_hw_params()
717 runtime->subformat = params_subformat(params); in snd_pcm_hw_params()
718 runtime->channels = params_channels(params); in snd_pcm_hw_params()
719 runtime->rate = params_rate(params); in snd_pcm_hw_params()
720 runtime->period_size = params_period_size(params); in snd_pcm_hw_params()
721 runtime->periods = params_periods(params); in snd_pcm_hw_params()
722 runtime->buffer_size = params_buffer_size(params); in snd_pcm_hw_params()
723 runtime->info = params->info; in snd_pcm_hw_params()
724 runtime->rate_num = params->rate_num; in snd_pcm_hw_params()
725 runtime->rate_den = params->rate_den; in snd_pcm_hw_params()
726 runtime->no_period_wakeup = in snd_pcm_hw_params()
730 bits = snd_pcm_format_physical_width(runtime->format); in snd_pcm_hw_params()
731 runtime->sample_bits = bits; in snd_pcm_hw_params()
732 bits *= runtime->channels; in snd_pcm_hw_params()
733 runtime->frame_bits = bits; in snd_pcm_hw_params()
739 runtime->byte_align = bits / 8; in snd_pcm_hw_params()
740 runtime->min_align = frames; in snd_pcm_hw_params()
743 runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; in snd_pcm_hw_params()
744 runtime->period_step = 1; in snd_pcm_hw_params()
745 runtime->control->avail_min = runtime->period_size; in snd_pcm_hw_params()
746 runtime->start_threshold = 1; in snd_pcm_hw_params()
747 runtime->stop_threshold = runtime->buffer_size; in snd_pcm_hw_params()
748 runtime->silence_threshold = 0; in snd_pcm_hw_params()
749 runtime->silence_size = 0; in snd_pcm_hw_params()
750 runtime->boundary = runtime->buffer_size; in snd_pcm_hw_params()
751 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) in snd_pcm_hw_params()
752 runtime->boundary *= 2; in snd_pcm_hw_params()
759 if ((usecs = period_to_usecs(runtime)) >= 0) in snd_pcm_hw_params()
796 struct snd_pcm_runtime *runtime; in snd_pcm_hw_free() local
801 runtime = substream->runtime; in snd_pcm_hw_free()
803 switch (runtime->status->state) { in snd_pcm_hw_free()
824 struct snd_pcm_runtime *runtime; in snd_pcm_sw_params() local
829 runtime = substream->runtime; in snd_pcm_sw_params()
831 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_sw_params()
845 if (params->silence_size >= runtime->boundary) { in snd_pcm_sw_params()
851 if (params->silence_threshold > runtime->buffer_size) in snd_pcm_sw_params()
856 runtime->tstamp_mode = params->tstamp_mode; in snd_pcm_sw_params()
858 runtime->tstamp_type = params->tstamp_type; in snd_pcm_sw_params()
859 runtime->period_step = params->period_step; in snd_pcm_sw_params()
860 runtime->control->avail_min = params->avail_min; in snd_pcm_sw_params()
861 runtime->start_threshold = params->start_threshold; in snd_pcm_sw_params()
862 runtime->stop_threshold = params->stop_threshold; in snd_pcm_sw_params()
863 runtime->silence_threshold = params->silence_threshold; in snd_pcm_sw_params()
864 runtime->silence_size = params->silence_size; in snd_pcm_sw_params()
865 params->boundary = runtime->boundary; in snd_pcm_sw_params()
868 runtime->silence_size > 0) in snd_pcm_sw_params()
870 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
895 delay = snd_pcm_playback_hw_avail(substream->runtime); in snd_pcm_calc_delay()
897 delay = snd_pcm_capture_avail(substream->runtime); in snd_pcm_calc_delay()
898 return delay + substream->runtime->delay; in snd_pcm_calc_delay()
904 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status() local
909 &runtime->audio_tstamp_config); in snd_pcm_status()
912 if (runtime->audio_tstamp_config.type_requested == in snd_pcm_status()
914 if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) in snd_pcm_status()
915 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
918 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
920 runtime->audio_tstamp_report.valid = 0; in snd_pcm_status()
922 runtime->audio_tstamp_report.valid = 1; in snd_pcm_status()
924 status->state = runtime->status->state; in snd_pcm_status()
925 status->suspended_state = runtime->status->suspended_state; in snd_pcm_status()
928 status->trigger_tstamp = runtime->trigger_tstamp; in snd_pcm_status()
931 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status()
932 status->tstamp = runtime->status->tstamp; in snd_pcm_status()
933 status->driver_tstamp = runtime->driver_tstamp; in snd_pcm_status()
935 runtime->status->audio_tstamp; in snd_pcm_status()
936 if (runtime->audio_tstamp_report.valid == 1) in snd_pcm_status()
940 &runtime->audio_tstamp_report); in snd_pcm_status()
946 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) in snd_pcm_status()
947 snd_pcm_gettime(runtime, &status->tstamp); in snd_pcm_status()
950 status->appl_ptr = runtime->control->appl_ptr; in snd_pcm_status()
951 status->hw_ptr = runtime->status->hw_ptr; in snd_pcm_status()
955 status->avail_max = runtime->avail_max; in snd_pcm_status()
956 status->overrange = runtime->overrange; in snd_pcm_status()
957 runtime->avail_max = 0; in snd_pcm_status()
958 runtime->overrange = 0; in snd_pcm_status()
991 struct snd_pcm_runtime *runtime; in snd_pcm_channel_info() local
995 runtime = substream->runtime; in snd_pcm_channel_info()
997 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_channel_info()
1002 if (channel >= runtime->channels) in snd_pcm_channel_info()
1027 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp() local
1028 if (runtime->trigger_master == NULL) in snd_pcm_trigger_tstamp()
1030 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
1031 if (!runtime->trigger_tstamp_latched) in snd_pcm_trigger_tstamp()
1032 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); in snd_pcm_trigger_tstamp()
1034 snd_pcm_trigger_tstamp(runtime->trigger_master); in snd_pcm_trigger_tstamp()
1035 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; in snd_pcm_trigger_tstamp()
1037 runtime->trigger_master = NULL; in snd_pcm_trigger_tstamp()
1195 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start() local
1196 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) in snd_pcm_pre_start()
1201 runtime->trigger_tstamp_latched = false; in snd_pcm_pre_start()
1202 runtime->trigger_master = substream; in snd_pcm_pre_start()
1208 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1215 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1221 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start() local
1223 runtime->hw_ptr_jiffies = jiffies; in snd_pcm_post_start()
1224 runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / in snd_pcm_post_start()
1225 runtime->rate; in snd_pcm_post_start()
1226 runtime->status->state = state; in snd_pcm_post_start()
1228 runtime->silence_size > 0) in snd_pcm_post_start()
1265 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop() local
1266 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_pre_stop()
1268 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1274 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1282 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop() local
1283 if (runtime->status->state != state) { in snd_pcm_post_stop()
1285 runtime->status->state = state; in snd_pcm_post_stop()
1288 wake_up(&runtime->sleep); in snd_pcm_post_stop()
1289 wake_up(&runtime->tsleep); in snd_pcm_post_stop()
1342 if (substream->runtime && snd_pcm_running(substream)) in snd_pcm_stop_xrun()
1354 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause() local
1355 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) in snd_pcm_pre_pause()
1358 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) in snd_pcm_pre_pause()
1360 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) in snd_pcm_pre_pause()
1362 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1368 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1378 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1386 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1394 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause() local
1397 runtime->status->state = SNDRV_PCM_STATE_PAUSED; in snd_pcm_post_pause()
1399 wake_up(&runtime->sleep); in snd_pcm_post_pause()
1400 wake_up(&runtime->tsleep); in snd_pcm_post_pause()
1402 runtime->status->state = SNDRV_PCM_STATE_RUNNING; in snd_pcm_post_pause()
1427 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend() local
1428 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_pre_suspend()
1430 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1436 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend() local
1437 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1447 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend() local
1449 runtime->status->suspended_state = runtime->status->state; in snd_pcm_post_suspend()
1450 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; in snd_pcm_post_suspend()
1452 wake_up(&runtime->sleep); in snd_pcm_post_suspend()
1453 wake_up(&runtime->tsleep); in snd_pcm_post_suspend()
1506 if (substream->runtime == NULL) in snd_pcm_suspend_all()
1521 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume() local
1522 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) in snd_pcm_pre_resume()
1524 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1530 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume() local
1531 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1534 if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && in snd_pcm_do_resume()
1535 (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || in snd_pcm_do_resume()
1543 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1550 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume() local
1552 runtime->status->state = runtime->status->suspended_state; in snd_pcm_post_resume()
1584 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun() local
1588 switch (runtime->status->state) { in snd_pcm_xrun()
1608 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset() local
1609 switch (runtime->status->state) { in snd_pcm_pre_reset()
1622 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset() local
1626 runtime->hw_ptr_base = 0; in snd_pcm_do_reset()
1627 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - in snd_pcm_do_reset()
1628 runtime->status->hw_ptr % runtime->period_size; in snd_pcm_do_reset()
1629 runtime->silence_start = runtime->status->hw_ptr; in snd_pcm_do_reset()
1630 runtime->silence_filled = 0; in snd_pcm_do_reset()
1636 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset() local
1637 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_reset()
1639 runtime->silence_size > 0) in snd_pcm_post_reset()
1661 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare() local
1662 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_pre_prepare()
1663 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_pre_prepare()
1682 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare() local
1683 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_prepare()
1711 switch (substream->runtime->status->state) { in snd_pcm_prepare()
1731 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init() local
1732 switch (runtime->status->state) { in snd_pcm_pre_drain_init()
1738 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1744 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init() local
1746 switch (runtime->status->state) { in snd_pcm_do_drain_init()
1753 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1757 runtime->status->state = SNDRV_PCM_STATE_DRAINING; in snd_pcm_do_drain_init()
1760 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1767 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { in snd_pcm_do_drain_init()
1768 int new_state = snd_pcm_capture_avail(runtime) > 0 ? in snd_pcm_do_drain_init()
1775 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && in snd_pcm_do_drain_init()
1776 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1777 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) in snd_pcm_do_drain_init()
1807 struct snd_pcm_runtime *runtime; in snd_pcm_drain() local
1814 runtime = substream->runtime; in snd_pcm_drain()
1816 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_drain()
1828 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drain()
1853 runtime = s->runtime; in snd_pcm_drain()
1854 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_drain()
1855 to_check = runtime; in snd_pcm_drain()
1865 if (runtime->no_period_wakeup) in snd_pcm_drain()
1869 if (runtime->rate) { in snd_pcm_drain()
1870 long t = runtime->period_size * 2 / runtime->rate; in snd_pcm_drain()
1884 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
1910 struct snd_pcm_runtime *runtime; in snd_pcm_drop() local
1915 runtime = substream->runtime; in snd_pcm_drop()
1917 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_drop()
1918 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_drop()
1923 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drop()
1972 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
1973 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
2165 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init() local
2166 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; in snd_pcm_hw_constraints_init()
2183 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, in snd_pcm_hw_constraints_init()
2188 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2194 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2199 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2204 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2209 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2214 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_init()
2219 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2224 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2229 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_init()
2234 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2239 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2244 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2249 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2254 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2259 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2264 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_init()
2269 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_init()
2274 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, in snd_pcm_hw_constraints_init()
2279 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, in snd_pcm_hw_constraints_init()
2289 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete() local
2290 struct snd_pcm_hardware *hw = &runtime->hw; in snd_pcm_hw_constraints_complete()
2306 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); in snd_pcm_hw_constraints_complete()
2310 err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); in snd_pcm_hw_constraints_complete()
2314 …err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, 1 << SNDRV_PCM_SUBFORMAT_S… in snd_pcm_hw_constraints_complete()
2318 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_complete()
2323 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2328 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_complete()
2333 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_complete()
2338 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2343 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2350 if (runtime->dma_bytes) { in snd_pcm_hw_constraints_complete()
2351 …err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes… in snd_pcm_hw_constraints_complete()
2357 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2365 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); in snd_pcm_hw_constraints_complete()
2384 substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) in snd_pcm_release_substream()
2578 switch (substream->runtime->status->state) { in do_pcm_hwsync()
2602 struct snd_pcm_runtime *runtime = substream->runtime; in forward_appl_ptr() local
2610 appl_ptr = runtime->control->appl_ptr + frames; in forward_appl_ptr()
2611 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in forward_appl_ptr()
2612 appl_ptr -= runtime->boundary; in forward_appl_ptr()
2622 struct snd_pcm_runtime *runtime = substream->runtime; in rewind_appl_ptr() local
2630 appl_ptr = runtime->control->appl_ptr - frames; in rewind_appl_ptr()
2632 appl_ptr += runtime->boundary; in rewind_appl_ptr()
2705 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr() local
2716 status = runtime->status; in snd_pcm_sync_ptr()
2717 control = runtime->control; in snd_pcm_sync_ptr()
2751 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp() local
2758 runtime->tstamp_type = arg; in snd_pcm_tstamp()
2766 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xferi_frames_ioctl() local
2769 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xferi_frames_ioctl()
2787 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xfern_frames_ioctl() local
2791 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xfern_frames_ioctl()
2793 if (runtime->channels > 128) in snd_pcm_xfern_frames_ioctl()
2800 bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels); in snd_pcm_xfern_frames_ioctl()
3008 struct snd_pcm_runtime *runtime; in snd_pcm_read() local
3015 runtime = substream->runtime; in snd_pcm_read()
3016 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_read()
3018 if (!frame_aligned(runtime, count)) in snd_pcm_read()
3020 count = bytes_to_frames(runtime, count); in snd_pcm_read()
3023 result = frames_to_bytes(runtime, result); in snd_pcm_read()
3032 struct snd_pcm_runtime *runtime; in snd_pcm_write() local
3039 runtime = substream->runtime; in snd_pcm_write()
3040 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_write()
3042 if (!frame_aligned(runtime, count)) in snd_pcm_write()
3044 count = bytes_to_frames(runtime, count); in snd_pcm_write()
3047 result = frames_to_bytes(runtime, result); in snd_pcm_write()
3055 struct snd_pcm_runtime *runtime; in snd_pcm_readv() local
3065 runtime = substream->runtime; in snd_pcm_readv()
3066 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_readv()
3070 if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) in snd_pcm_readv()
3072 if (!frame_aligned(runtime, to->iov->iov_len)) in snd_pcm_readv()
3074 frames = bytes_to_samples(runtime, to->iov->iov_len); in snd_pcm_readv()
3082 result = frames_to_bytes(runtime, result); in snd_pcm_readv()
3091 struct snd_pcm_runtime *runtime; in snd_pcm_writev() local
3101 runtime = substream->runtime; in snd_pcm_writev()
3102 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_writev()
3106 if (from->nr_segs > 128 || from->nr_segs != runtime->channels || in snd_pcm_writev()
3107 !frame_aligned(runtime, from->iov->iov_len)) in snd_pcm_writev()
3109 frames = bytes_to_samples(runtime, from->iov->iov_len); in snd_pcm_writev()
3117 result = frames_to_bytes(runtime, result); in snd_pcm_writev()
3126 struct snd_pcm_runtime *runtime; in snd_pcm_poll() local
3140 runtime = substream->runtime; in snd_pcm_poll()
3141 poll_wait(file, &runtime->sleep, wait); in snd_pcm_poll()
3146 switch (runtime->status->state) { in snd_pcm_poll()
3150 if (avail >= runtime->control->avail_min) in snd_pcm_poll()
3183 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_status_fault() local
3187 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3188 vmf->page = virt_to_page(runtime->status); in snd_pcm_mmap_status_fault()
3219 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_control_fault() local
3223 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3224 vmf->page = virt_to_page(runtime->control); in snd_pcm_mmap_control_fault()
3258 (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR)) in pcm_status_mmap_allowed()
3271 if (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR) in pcm_control_mmap_allowed()
3298 void *vaddr = substream->runtime->dma_area + ofs; in snd_pcm_default_page_ops()
3308 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data_fault() local
3315 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3317 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data_fault()
3371 substream->runtime->dma_area, in snd_pcm_lib_default_mmap()
3372 substream->runtime->dma_addr, in snd_pcm_lib_default_mmap()
3373 substream->runtime->dma_bytes); in snd_pcm_lib_default_mmap()
3397 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_lib_mmap_iomem() local
3400 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); in snd_pcm_lib_mmap_iomem()
3411 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data() local
3424 runtime = substream->runtime; in snd_pcm_mmap_data()
3425 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_mmap_data()
3427 if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) in snd_pcm_mmap_data()
3429 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in snd_pcm_mmap_data()
3430 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_mmap_data()
3434 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data()
3483 struct snd_pcm_runtime *runtime; in snd_pcm_fasync() local
3489 runtime = substream->runtime; in snd_pcm_fasync()
3490 return fasync_helper(fd, file, on, &runtime->fasync); in snd_pcm_fasync()
3625 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area() local
3630 return (unsigned long)runtime->status; in snd_pcm_get_unmapped_area()
3632 return (unsigned long)runtime->control; in snd_pcm_get_unmapped_area()
3634 return (unsigned long)runtime->dma_area + offset; in snd_pcm_get_unmapped_area()