Lines Matching refs:runtime
248 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) in hw_support_mmap()
275 &substream->runtime->hw_constraints; in constrain_mask_params()
311 &substream->runtime->hw_constraints; in constrain_interval_params()
347 &substream->runtime->hw_constraints; in constrain_params_by_rules()
498 params->info = substream->runtime->hw.info; in fixup_unreferenced_params()
566 static int period_to_usecs(struct snd_pcm_runtime *runtime) in period_to_usecs() argument
570 if (! runtime->rate) in period_to_usecs()
574 usecs = (750000 / runtime->rate) * runtime->period_size; in period_to_usecs()
575 usecs += ((750000 % runtime->rate) * runtime->period_size) / in period_to_usecs()
576 runtime->rate; in period_to_usecs()
585 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_set_state()
586 substream->runtime->status->state = state; in snd_pcm_set_state()
596 &substream->runtime->trigger_tstamp); in snd_pcm_timer_notify()
602 if (substream->runtime && substream->runtime->stop_operating) { in snd_pcm_sync_stop()
603 substream->runtime->stop_operating = false; in snd_pcm_sync_stop()
678 struct snd_pcm_runtime *runtime; in snd_pcm_hw_params() local
685 runtime = substream->runtime; in snd_pcm_hw_params()
687 switch (runtime->status->state) { in snd_pcm_hw_params()
723 runtime->buffer_changed = err > 0; in snd_pcm_hw_params()
732 runtime->access = params_access(params); in snd_pcm_hw_params()
733 runtime->format = params_format(params); in snd_pcm_hw_params()
734 runtime->subformat = params_subformat(params); in snd_pcm_hw_params()
735 runtime->channels = params_channels(params); in snd_pcm_hw_params()
736 runtime->rate = params_rate(params); in snd_pcm_hw_params()
737 runtime->period_size = params_period_size(params); in snd_pcm_hw_params()
738 runtime->periods = params_periods(params); in snd_pcm_hw_params()
739 runtime->buffer_size = params_buffer_size(params); in snd_pcm_hw_params()
740 runtime->info = params->info; in snd_pcm_hw_params()
741 runtime->rate_num = params->rate_num; in snd_pcm_hw_params()
742 runtime->rate_den = params->rate_den; in snd_pcm_hw_params()
743 runtime->no_period_wakeup = in snd_pcm_hw_params()
747 bits = snd_pcm_format_physical_width(runtime->format); in snd_pcm_hw_params()
748 runtime->sample_bits = bits; in snd_pcm_hw_params()
749 bits *= runtime->channels; in snd_pcm_hw_params()
750 runtime->frame_bits = bits; in snd_pcm_hw_params()
756 runtime->byte_align = bits / 8; in snd_pcm_hw_params()
757 runtime->min_align = frames; in snd_pcm_hw_params()
760 runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; in snd_pcm_hw_params()
761 runtime->period_step = 1; in snd_pcm_hw_params()
762 runtime->control->avail_min = runtime->period_size; in snd_pcm_hw_params()
763 runtime->start_threshold = 1; in snd_pcm_hw_params()
764 runtime->stop_threshold = runtime->buffer_size; in snd_pcm_hw_params()
765 runtime->silence_threshold = 0; in snd_pcm_hw_params()
766 runtime->silence_size = 0; in snd_pcm_hw_params()
767 runtime->boundary = runtime->buffer_size; in snd_pcm_hw_params()
768 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) in snd_pcm_hw_params()
769 runtime->boundary *= 2; in snd_pcm_hw_params()
772 if (runtime->dma_area && !substream->ops->copy_user) { in snd_pcm_hw_params()
773 size_t size = runtime->dma_bytes; in snd_pcm_hw_params()
775 if (runtime->info & SNDRV_PCM_INFO_MMAP) in snd_pcm_hw_params()
777 memset(runtime->dma_area, 0, size); in snd_pcm_hw_params()
785 usecs = period_to_usecs(runtime); in snd_pcm_hw_params()
837 struct snd_pcm_runtime *runtime; in snd_pcm_hw_free() local
842 runtime = substream->runtime; in snd_pcm_hw_free()
844 switch (runtime->status->state) { in snd_pcm_hw_free()
864 struct snd_pcm_runtime *runtime; in snd_pcm_sw_params() local
869 runtime = substream->runtime; in snd_pcm_sw_params()
871 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_sw_params()
885 if (params->silence_size >= runtime->boundary) { in snd_pcm_sw_params()
891 if (params->silence_threshold > runtime->buffer_size) in snd_pcm_sw_params()
896 runtime->tstamp_mode = params->tstamp_mode; in snd_pcm_sw_params()
898 runtime->tstamp_type = params->tstamp_type; in snd_pcm_sw_params()
899 runtime->period_step = params->period_step; in snd_pcm_sw_params()
900 runtime->control->avail_min = params->avail_min; in snd_pcm_sw_params()
901 runtime->start_threshold = params->start_threshold; in snd_pcm_sw_params()
902 runtime->stop_threshold = params->stop_threshold; in snd_pcm_sw_params()
903 runtime->silence_threshold = params->silence_threshold; in snd_pcm_sw_params()
904 runtime->silence_size = params->silence_size; in snd_pcm_sw_params()
905 params->boundary = runtime->boundary; in snd_pcm_sw_params()
908 runtime->silence_size > 0) in snd_pcm_sw_params()
910 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
935 delay = snd_pcm_playback_hw_avail(substream->runtime); in snd_pcm_calc_delay()
937 delay = snd_pcm_capture_avail(substream->runtime); in snd_pcm_calc_delay()
938 return delay + substream->runtime->delay; in snd_pcm_calc_delay()
944 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status64() local
949 &runtime->audio_tstamp_config); in snd_pcm_status64()
952 if (runtime->audio_tstamp_config.type_requested == in snd_pcm_status64()
954 if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) in snd_pcm_status64()
955 runtime->audio_tstamp_config.type_requested = in snd_pcm_status64()
958 runtime->audio_tstamp_config.type_requested = in snd_pcm_status64()
960 runtime->audio_tstamp_report.valid = 0; in snd_pcm_status64()
962 runtime->audio_tstamp_report.valid = 1; in snd_pcm_status64()
964 status->state = runtime->status->state; in snd_pcm_status64()
965 status->suspended_state = runtime->status->suspended_state; in snd_pcm_status64()
968 status->trigger_tstamp_sec = runtime->trigger_tstamp.tv_sec; in snd_pcm_status64()
969 status->trigger_tstamp_nsec = runtime->trigger_tstamp.tv_nsec; in snd_pcm_status64()
972 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status64()
973 status->tstamp_sec = runtime->status->tstamp.tv_sec; in snd_pcm_status64()
975 runtime->status->tstamp.tv_nsec; in snd_pcm_status64()
977 runtime->driver_tstamp.tv_sec; in snd_pcm_status64()
979 runtime->driver_tstamp.tv_nsec; in snd_pcm_status64()
981 runtime->status->audio_tstamp.tv_sec; in snd_pcm_status64()
983 runtime->status->audio_tstamp.tv_nsec; in snd_pcm_status64()
984 if (runtime->audio_tstamp_report.valid == 1) in snd_pcm_status64()
988 &runtime->audio_tstamp_report); in snd_pcm_status64()
994 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status64()
997 snd_pcm_gettime(runtime, &tstamp); in snd_pcm_status64()
1003 status->appl_ptr = runtime->control->appl_ptr; in snd_pcm_status64()
1004 status->hw_ptr = runtime->status->hw_ptr; in snd_pcm_status64()
1008 status->avail_max = runtime->avail_max; in snd_pcm_status64()
1009 status->overrange = runtime->overrange; in snd_pcm_status64()
1010 runtime->avail_max = 0; in snd_pcm_status64()
1011 runtime->overrange = 0; in snd_pcm_status64()
1093 struct snd_pcm_runtime *runtime; in snd_pcm_channel_info() local
1097 runtime = substream->runtime; in snd_pcm_channel_info()
1099 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_channel_info()
1104 if (channel >= runtime->channels) in snd_pcm_channel_info()
1129 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp() local
1130 if (runtime->trigger_master == NULL) in snd_pcm_trigger_tstamp()
1132 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
1133 if (!runtime->trigger_tstamp_latched) in snd_pcm_trigger_tstamp()
1134 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); in snd_pcm_trigger_tstamp()
1136 snd_pcm_trigger_tstamp(runtime->trigger_master); in snd_pcm_trigger_tstamp()
1137 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; in snd_pcm_trigger_tstamp()
1139 runtime->trigger_master = NULL; in snd_pcm_trigger_tstamp()
1354 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start() local
1355 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) in snd_pcm_pre_start()
1360 runtime->trigger_tstamp_latched = false; in snd_pcm_pre_start()
1361 runtime->trigger_master = substream; in snd_pcm_pre_start()
1368 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1376 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1383 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start() local
1385 runtime->hw_ptr_jiffies = jiffies; in snd_pcm_post_start()
1386 runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / in snd_pcm_post_start()
1387 runtime->rate; in snd_pcm_post_start()
1388 runtime->status->state = state; in snd_pcm_post_start()
1390 runtime->silence_size > 0) in snd_pcm_post_start()
1428 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop() local
1429 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_pre_stop()
1431 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1438 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1441 substream->runtime->stop_operating = true; in snd_pcm_do_stop()
1449 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop() local
1450 if (runtime->status->state != state) { in snd_pcm_post_stop()
1452 runtime->status->state = state; in snd_pcm_post_stop()
1455 wake_up(&runtime->sleep); in snd_pcm_post_stop()
1456 wake_up(&runtime->tsleep); in snd_pcm_post_stop()
1509 if (substream->runtime && snd_pcm_running(substream)) in snd_pcm_stop_xrun()
1524 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause() local
1525 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) in snd_pcm_pre_pause()
1528 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) in snd_pcm_pre_pause()
1530 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) in snd_pcm_pre_pause()
1532 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1539 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1549 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1559 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1569 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause() local
1572 runtime->status->state = SNDRV_PCM_STATE_PAUSED; in snd_pcm_post_pause()
1574 wake_up(&runtime->sleep); in snd_pcm_post_pause()
1575 wake_up(&runtime->tsleep); in snd_pcm_post_pause()
1577 runtime->status->state = SNDRV_PCM_STATE_RUNNING; in snd_pcm_post_pause()
1611 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend() local
1612 switch (runtime->status->state) { in snd_pcm_pre_suspend()
1621 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1628 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend() local
1629 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1634 runtime->stop_operating = true; in snd_pcm_do_suspend()
1641 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend() local
1643 runtime->status->suspended_state = runtime->status->state; in snd_pcm_post_suspend()
1644 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; in snd_pcm_post_suspend()
1646 wake_up(&runtime->sleep); in snd_pcm_post_suspend()
1647 wake_up(&runtime->tsleep); in snd_pcm_post_suspend()
1694 if (!substream->runtime) in snd_pcm_suspend_all()
1721 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume() local
1722 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) in snd_pcm_pre_resume()
1724 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1731 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume() local
1732 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1735 if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && in snd_pcm_do_resume()
1736 (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || in snd_pcm_do_resume()
1745 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1753 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume() local
1755 runtime->status->state = runtime->status->suspended_state; in snd_pcm_post_resume()
1788 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun() local
1792 switch (runtime->status->state) { in snd_pcm_xrun()
1814 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset() local
1815 switch (runtime->status->state) { in snd_pcm_pre_reset()
1829 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset() local
1833 runtime->hw_ptr_base = 0; in snd_pcm_do_reset()
1834 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - in snd_pcm_do_reset()
1835 runtime->status->hw_ptr % runtime->period_size; in snd_pcm_do_reset()
1836 runtime->silence_start = runtime->status->hw_ptr; in snd_pcm_do_reset()
1837 runtime->silence_filled = 0; in snd_pcm_do_reset()
1844 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset() local
1845 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_reset()
1847 runtime->silence_size > 0) in snd_pcm_post_reset()
1870 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare() local
1873 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_pre_prepare()
1874 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_pre_prepare()
1896 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare() local
1897 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_prepare()
1925 switch (substream->runtime->status->state) { in snd_pcm_prepare()
1948 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init() local
1949 switch (runtime->status->state) { in snd_pcm_pre_drain_init()
1955 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1962 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init() local
1964 switch (runtime->status->state) { in snd_pcm_do_drain_init()
1971 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1975 runtime->status->state = SNDRV_PCM_STATE_DRAINING; in snd_pcm_do_drain_init()
1978 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1985 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { in snd_pcm_do_drain_init()
1988 new_state = snd_pcm_capture_avail(runtime) > 0 ? in snd_pcm_do_drain_init()
1995 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && in snd_pcm_do_drain_init()
1996 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1997 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) in snd_pcm_do_drain_init()
2026 struct snd_pcm_runtime *runtime; in snd_pcm_drain() local
2034 runtime = substream->runtime; in snd_pcm_drain()
2036 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_drain()
2047 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drain()
2074 runtime = s->runtime; in snd_pcm_drain()
2075 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_drain()
2076 to_check = runtime; in snd_pcm_drain()
2087 if (runtime->no_period_wakeup) in snd_pcm_drain()
2091 if (runtime->rate) { in snd_pcm_drain()
2092 long t = runtime->period_size * 2 / runtime->rate; in snd_pcm_drain()
2102 if (s->runtime == to_check) { in snd_pcm_drain()
2114 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
2139 struct snd_pcm_runtime *runtime; in snd_pcm_drop() local
2144 runtime = substream->runtime; in snd_pcm_drop()
2146 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_drop()
2147 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_drop()
2152 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drop()
2215 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
2216 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
2420 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init() local
2421 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; in snd_pcm_hw_constraints_init()
2438 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, in snd_pcm_hw_constraints_init()
2443 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2449 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2454 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2459 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2464 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2469 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_init()
2474 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2479 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2484 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_init()
2489 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2494 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2499 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2504 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2509 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2514 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2519 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_init()
2524 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_init()
2529 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, in snd_pcm_hw_constraints_init()
2534 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, in snd_pcm_hw_constraints_init()
2544 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete() local
2545 struct snd_pcm_hardware *hw = &runtime->hw; in snd_pcm_hw_constraints_complete()
2561 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); in snd_pcm_hw_constraints_complete()
2565 err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); in snd_pcm_hw_constraints_complete()
2569 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, in snd_pcm_hw_constraints_complete()
2574 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_complete()
2579 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2584 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_complete()
2589 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_complete()
2594 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2599 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2606 if (runtime->dma_bytes) { in snd_pcm_hw_constraints_complete()
2607 …err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes… in snd_pcm_hw_constraints_complete()
2613 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2621 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); in snd_pcm_hw_constraints_complete()
2640 if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) in snd_pcm_release_substream()
2693 substream->runtime->hw.info |= SNDRV_PCM_INFO_EXPLICIT_SYNC; in snd_pcm_open_substream()
2844 switch (substream->runtime->status->state) { in do_pcm_hwsync()
2868 struct snd_pcm_runtime *runtime = substream->runtime; in forward_appl_ptr() local
2876 appl_ptr = runtime->control->appl_ptr + frames; in forward_appl_ptr()
2877 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in forward_appl_ptr()
2878 appl_ptr -= runtime->boundary; in forward_appl_ptr()
2888 struct snd_pcm_runtime *runtime = substream->runtime; in rewind_appl_ptr() local
2896 appl_ptr = runtime->control->appl_ptr - frames; in rewind_appl_ptr()
2898 appl_ptr += runtime->boundary; in rewind_appl_ptr()
2969 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr() local
2980 status = runtime->status; in snd_pcm_sync_ptr()
2981 control = runtime->control; in snd_pcm_sync_ptr()
3044 static snd_pcm_uframes_t recalculate_boundary(struct snd_pcm_runtime *runtime) in recalculate_boundary() argument
3048 if (! runtime->buffer_size) in recalculate_boundary()
3050 boundary = runtime->buffer_size; in recalculate_boundary()
3051 while (boundary * 2 <= 0x7fffffffUL - runtime->buffer_size) in recalculate_boundary()
3059 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_ioctl_sync_ptr_compat() local
3068 if (snd_BUG_ON(!runtime)) in snd_pcm_ioctl_sync_ptr_compat()
3080 status = runtime->status; in snd_pcm_ioctl_sync_ptr_compat()
3081 control = runtime->control; in snd_pcm_ioctl_sync_ptr_compat()
3082 boundary = recalculate_boundary(runtime); in snd_pcm_ioctl_sync_ptr_compat()
3125 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp() local
3132 runtime->tstamp_type = arg; in snd_pcm_tstamp()
3140 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xferi_frames_ioctl() local
3143 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xferi_frames_ioctl()
3162 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xfern_frames_ioctl() local
3166 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xfern_frames_ioctl()
3168 if (runtime->channels > 128) in snd_pcm_xfern_frames_ioctl()
3175 bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels); in snd_pcm_xfern_frames_ioctl()
3230 if (substream->runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_common_ioctl()
3359 if (substream->runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_kernel_ioctl()
3396 struct snd_pcm_runtime *runtime; in snd_pcm_read() local
3403 runtime = substream->runtime; in snd_pcm_read()
3404 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_read()
3405 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_read()
3407 if (!frame_aligned(runtime, count)) in snd_pcm_read()
3409 count = bytes_to_frames(runtime, count); in snd_pcm_read()
3412 result = frames_to_bytes(runtime, result); in snd_pcm_read()
3421 struct snd_pcm_runtime *runtime; in snd_pcm_write() local
3428 runtime = substream->runtime; in snd_pcm_write()
3429 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_write()
3430 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_write()
3432 if (!frame_aligned(runtime, count)) in snd_pcm_write()
3434 count = bytes_to_frames(runtime, count); in snd_pcm_write()
3437 result = frames_to_bytes(runtime, result); in snd_pcm_write()
3445 struct snd_pcm_runtime *runtime; in snd_pcm_readv() local
3455 runtime = substream->runtime; in snd_pcm_readv()
3456 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_readv()
3457 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_readv()
3461 if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) in snd_pcm_readv()
3463 if (!frame_aligned(runtime, to->iov->iov_len)) in snd_pcm_readv()
3465 frames = bytes_to_samples(runtime, to->iov->iov_len); in snd_pcm_readv()
3473 result = frames_to_bytes(runtime, result); in snd_pcm_readv()
3482 struct snd_pcm_runtime *runtime; in snd_pcm_writev() local
3492 runtime = substream->runtime; in snd_pcm_writev()
3493 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_writev()
3494 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_writev()
3498 if (from->nr_segs > 128 || from->nr_segs != runtime->channels || in snd_pcm_writev()
3499 !frame_aligned(runtime, from->iov->iov_len)) in snd_pcm_writev()
3501 frames = bytes_to_samples(runtime, from->iov->iov_len); in snd_pcm_writev()
3509 result = frames_to_bytes(runtime, result); in snd_pcm_writev()
3518 struct snd_pcm_runtime *runtime; in snd_pcm_poll() local
3532 runtime = substream->runtime; in snd_pcm_poll()
3533 if (runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_poll()
3536 poll_wait(file, &runtime->sleep, wait); in snd_pcm_poll()
3541 switch (runtime->status->state) { in snd_pcm_poll()
3545 if (avail >= runtime->control->avail_min) in snd_pcm_poll()
3578 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_status_fault() local
3582 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3583 vmf->page = virt_to_page(runtime->status); in snd_pcm_mmap_status_fault()
3614 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_control_fault() local
3618 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3619 vmf->page = virt_to_page(runtime->control); in snd_pcm_mmap_control_fault()
3650 if (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_EXPLICIT_SYNC) in pcm_status_mmap_allowed()
3657 (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR)) in pcm_status_mmap_allowed()
3667 if (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_EXPLICIT_SYNC) in pcm_control_mmap_allowed()
3673 if (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR) in pcm_control_mmap_allowed()
3703 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data_fault() local
3710 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3712 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data_fault()
3718 page = virt_to_page(runtime->dma_area + offset); in snd_pcm_mmap_data_fault()
3780 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_lib_mmap_iomem() local
3783 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); in snd_pcm_lib_mmap_iomem()
3794 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data() local
3807 runtime = substream->runtime; in snd_pcm_mmap_data()
3808 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_mmap_data()
3810 if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) in snd_pcm_mmap_data()
3812 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in snd_pcm_mmap_data()
3813 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_mmap_data()
3817 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data()
3845 if (substream->runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_mmap()
3876 struct snd_pcm_runtime *runtime; in snd_pcm_fasync() local
3882 runtime = substream->runtime; in snd_pcm_fasync()
3883 if (runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_fasync()
3885 return fasync_helper(fd, file, on, &runtime->fasync); in snd_pcm_fasync()
4020 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area() local
4025 return (unsigned long)runtime->status; in snd_pcm_get_unmapped_area()
4027 return (unsigned long)runtime->control; in snd_pcm_get_unmapped_area()
4029 return (unsigned long)runtime->dma_area + offset; in snd_pcm_get_unmapped_area()