Lines Matching full:runtime
246 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) in hw_support_mmap()
261 &substream->runtime->hw_constraints; in constrain_mask_params()
297 &substream->runtime->hw_constraints; in constrain_interval_params()
333 &substream->runtime->hw_constraints; in constrain_params_by_rules()
484 params->info = substream->runtime->hw.info; in fixup_unreferenced_params()
552 static int period_to_usecs(struct snd_pcm_runtime *runtime) in period_to_usecs() argument
556 if (! runtime->rate) in period_to_usecs()
560 usecs = (750000 / runtime->rate) * runtime->period_size; in period_to_usecs()
561 usecs += ((750000 % runtime->rate) * runtime->period_size) / in period_to_usecs()
562 runtime->rate; in period_to_usecs()
571 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_set_state()
572 substream->runtime->status->state = state; in snd_pcm_set_state()
582 &substream->runtime->trigger_tstamp); in snd_pcm_timer_notify()
588 if (substream->runtime->stop_operating) { in snd_pcm_sync_stop()
589 substream->runtime->stop_operating = false; in snd_pcm_sync_stop()
664 struct snd_pcm_runtime *runtime; in snd_pcm_hw_params() local
671 runtime = substream->runtime; in snd_pcm_hw_params()
673 switch (runtime->status->state) { in snd_pcm_hw_params()
709 runtime->buffer_changed = err > 0; in snd_pcm_hw_params()
718 runtime->access = params_access(params); in snd_pcm_hw_params()
719 runtime->format = params_format(params); in snd_pcm_hw_params()
720 runtime->subformat = params_subformat(params); in snd_pcm_hw_params()
721 runtime->channels = params_channels(params); in snd_pcm_hw_params()
722 runtime->rate = params_rate(params); in snd_pcm_hw_params()
723 runtime->period_size = params_period_size(params); in snd_pcm_hw_params()
724 runtime->periods = params_periods(params); in snd_pcm_hw_params()
725 runtime->buffer_size = params_buffer_size(params); in snd_pcm_hw_params()
726 runtime->info = params->info; in snd_pcm_hw_params()
727 runtime->rate_num = params->rate_num; in snd_pcm_hw_params()
728 runtime->rate_den = params->rate_den; in snd_pcm_hw_params()
729 runtime->no_period_wakeup = in snd_pcm_hw_params()
733 bits = snd_pcm_format_physical_width(runtime->format); in snd_pcm_hw_params()
734 runtime->sample_bits = bits; in snd_pcm_hw_params()
735 bits *= runtime->channels; in snd_pcm_hw_params()
736 runtime->frame_bits = bits; in snd_pcm_hw_params()
742 runtime->byte_align = bits / 8; in snd_pcm_hw_params()
743 runtime->min_align = frames; in snd_pcm_hw_params()
746 runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; in snd_pcm_hw_params()
747 runtime->period_step = 1; in snd_pcm_hw_params()
748 runtime->control->avail_min = runtime->period_size; in snd_pcm_hw_params()
749 runtime->start_threshold = 1; in snd_pcm_hw_params()
750 runtime->stop_threshold = runtime->buffer_size; in snd_pcm_hw_params()
751 runtime->silence_threshold = 0; in snd_pcm_hw_params()
752 runtime->silence_size = 0; in snd_pcm_hw_params()
753 runtime->boundary = runtime->buffer_size; in snd_pcm_hw_params()
754 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) in snd_pcm_hw_params()
755 runtime->boundary *= 2; in snd_pcm_hw_params()
758 if (runtime->dma_area && !substream->ops->copy_user) in snd_pcm_hw_params()
759 memset(runtime->dma_area, 0, runtime->dma_bytes); in snd_pcm_hw_params()
766 if ((usecs = period_to_usecs(runtime)) >= 0) in snd_pcm_hw_params()
817 struct snd_pcm_runtime *runtime; in snd_pcm_hw_free() local
822 runtime = substream->runtime; in snd_pcm_hw_free()
824 switch (runtime->status->state) { in snd_pcm_hw_free()
844 struct snd_pcm_runtime *runtime; in snd_pcm_sw_params() local
849 runtime = substream->runtime; in snd_pcm_sw_params()
851 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_sw_params()
865 if (params->silence_size >= runtime->boundary) { in snd_pcm_sw_params()
871 if (params->silence_threshold > runtime->buffer_size) in snd_pcm_sw_params()
876 runtime->tstamp_mode = params->tstamp_mode; in snd_pcm_sw_params()
878 runtime->tstamp_type = params->tstamp_type; in snd_pcm_sw_params()
879 runtime->period_step = params->period_step; in snd_pcm_sw_params()
880 runtime->control->avail_min = params->avail_min; in snd_pcm_sw_params()
881 runtime->start_threshold = params->start_threshold; in snd_pcm_sw_params()
882 runtime->stop_threshold = params->stop_threshold; in snd_pcm_sw_params()
883 runtime->silence_threshold = params->silence_threshold; in snd_pcm_sw_params()
884 runtime->silence_size = params->silence_size; in snd_pcm_sw_params()
885 params->boundary = runtime->boundary; in snd_pcm_sw_params()
888 runtime->silence_size > 0) in snd_pcm_sw_params()
890 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
915 delay = snd_pcm_playback_hw_avail(substream->runtime); in snd_pcm_calc_delay()
917 delay = snd_pcm_capture_avail(substream->runtime); in snd_pcm_calc_delay()
918 return delay + substream->runtime->delay; in snd_pcm_calc_delay()
924 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status64() local
929 &runtime->audio_tstamp_config); in snd_pcm_status64()
932 if (runtime->audio_tstamp_config.type_requested == in snd_pcm_status64()
934 if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) in snd_pcm_status64()
935 runtime->audio_tstamp_config.type_requested = in snd_pcm_status64()
938 runtime->audio_tstamp_config.type_requested = in snd_pcm_status64()
940 runtime->audio_tstamp_report.valid = 0; in snd_pcm_status64()
942 runtime->audio_tstamp_report.valid = 1; in snd_pcm_status64()
944 status->state = runtime->status->state; in snd_pcm_status64()
945 status->suspended_state = runtime->status->suspended_state; in snd_pcm_status64()
948 status->trigger_tstamp_sec = runtime->trigger_tstamp.tv_sec; in snd_pcm_status64()
949 status->trigger_tstamp_nsec = runtime->trigger_tstamp.tv_nsec; in snd_pcm_status64()
952 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status64()
953 status->tstamp_sec = runtime->status->tstamp.tv_sec; in snd_pcm_status64()
955 runtime->status->tstamp.tv_nsec; in snd_pcm_status64()
957 runtime->driver_tstamp.tv_sec; in snd_pcm_status64()
959 runtime->driver_tstamp.tv_nsec; in snd_pcm_status64()
961 runtime->status->audio_tstamp.tv_sec; in snd_pcm_status64()
963 runtime->status->audio_tstamp.tv_nsec; in snd_pcm_status64()
964 if (runtime->audio_tstamp_report.valid == 1) in snd_pcm_status64()
968 &runtime->audio_tstamp_report); in snd_pcm_status64()
974 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status64()
977 snd_pcm_gettime(runtime, &tstamp); in snd_pcm_status64()
983 status->appl_ptr = runtime->control->appl_ptr; in snd_pcm_status64()
984 status->hw_ptr = runtime->status->hw_ptr; in snd_pcm_status64()
988 status->avail_max = runtime->avail_max; in snd_pcm_status64()
989 status->overrange = runtime->overrange; in snd_pcm_status64()
990 runtime->avail_max = 0; in snd_pcm_status64()
991 runtime->overrange = 0; in snd_pcm_status64()
1073 struct snd_pcm_runtime *runtime; in snd_pcm_channel_info() local
1077 runtime = substream->runtime; in snd_pcm_channel_info()
1079 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_channel_info()
1084 if (channel >= runtime->channels) in snd_pcm_channel_info()
1109 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp() local
1110 if (runtime->trigger_master == NULL) in snd_pcm_trigger_tstamp()
1112 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
1113 if (!runtime->trigger_tstamp_latched) in snd_pcm_trigger_tstamp()
1114 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); in snd_pcm_trigger_tstamp()
1116 snd_pcm_trigger_tstamp(runtime->trigger_master); in snd_pcm_trigger_tstamp()
1117 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; in snd_pcm_trigger_tstamp()
1119 runtime->trigger_master = NULL; in snd_pcm_trigger_tstamp()
1334 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start() local
1335 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) in snd_pcm_pre_start()
1340 runtime->trigger_tstamp_latched = false; in snd_pcm_pre_start()
1341 runtime->trigger_master = substream; in snd_pcm_pre_start()
1348 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1356 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1363 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start() local
1365 runtime->hw_ptr_jiffies = jiffies; in snd_pcm_post_start()
1366 runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / in snd_pcm_post_start()
1367 runtime->rate; in snd_pcm_post_start()
1368 runtime->status->state = state; in snd_pcm_post_start()
1370 runtime->silence_size > 0) in snd_pcm_post_start()
1408 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop() local
1409 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_pre_stop()
1411 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1418 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1427 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop() local
1428 if (runtime->status->state != state) { in snd_pcm_post_stop()
1430 runtime->status->state = state; in snd_pcm_post_stop()
1433 runtime->stop_operating = true; in snd_pcm_post_stop()
1434 wake_up(&runtime->sleep); in snd_pcm_post_stop()
1435 wake_up(&runtime->tsleep); in snd_pcm_post_stop()
1488 if (substream->runtime && snd_pcm_running(substream)) in snd_pcm_stop_xrun()
1503 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause() local
1504 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) in snd_pcm_pre_pause()
1507 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) in snd_pcm_pre_pause()
1509 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) in snd_pcm_pre_pause()
1511 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1518 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1528 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1538 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1548 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause() local
1551 runtime->status->state = SNDRV_PCM_STATE_PAUSED; in snd_pcm_post_pause()
1553 wake_up(&runtime->sleep); in snd_pcm_post_pause()
1554 wake_up(&runtime->tsleep); in snd_pcm_post_pause()
1556 runtime->status->state = SNDRV_PCM_STATE_RUNNING; in snd_pcm_post_pause()
1590 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend() local
1591 switch (runtime->status->state) { in snd_pcm_pre_suspend()
1600 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1607 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend() local
1608 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1619 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend() local
1621 runtime->status->suspended_state = runtime->status->state; in snd_pcm_post_suspend()
1622 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; in snd_pcm_post_suspend()
1624 wake_up(&runtime->sleep); in snd_pcm_post_suspend()
1625 wake_up(&runtime->tsleep); in snd_pcm_post_suspend()
1674 if (substream->runtime == NULL) in snd_pcm_suspend_all()
1698 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume() local
1699 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) in snd_pcm_pre_resume()
1701 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1708 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume() local
1709 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1712 if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && in snd_pcm_do_resume()
1713 (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || in snd_pcm_do_resume()
1722 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1730 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume() local
1732 runtime->status->state = runtime->status->suspended_state; in snd_pcm_post_resume()
1766 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun() local
1770 switch (runtime->status->state) { in snd_pcm_xrun()
1792 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset() local
1793 switch (runtime->status->state) { in snd_pcm_pre_reset()
1807 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset() local
1811 runtime->hw_ptr_base = 0; in snd_pcm_do_reset()
1812 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - in snd_pcm_do_reset()
1813 runtime->status->hw_ptr % runtime->period_size; in snd_pcm_do_reset()
1814 runtime->silence_start = runtime->status->hw_ptr; in snd_pcm_do_reset()
1815 runtime->silence_filled = 0; in snd_pcm_do_reset()
1822 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset() local
1823 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_reset()
1825 runtime->silence_size > 0) in snd_pcm_post_reset()
1848 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare() local
1851 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_pre_prepare()
1852 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_pre_prepare()
1874 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare() local
1875 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_prepare()
1903 switch (substream->runtime->status->state) { in snd_pcm_prepare()
1926 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init() local
1927 switch (runtime->status->state) { in snd_pcm_pre_drain_init()
1933 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1940 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init() local
1942 switch (runtime->status->state) { in snd_pcm_do_drain_init()
1949 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1953 runtime->status->state = SNDRV_PCM_STATE_DRAINING; in snd_pcm_do_drain_init()
1956 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1963 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { in snd_pcm_do_drain_init()
1966 new_state = snd_pcm_capture_avail(runtime) > 0 ? in snd_pcm_do_drain_init()
1973 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && in snd_pcm_do_drain_init()
1974 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1975 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) in snd_pcm_do_drain_init()
2004 struct snd_pcm_runtime *runtime; in snd_pcm_drain() local
2012 runtime = substream->runtime; in snd_pcm_drain()
2014 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_drain()
2025 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drain()
2052 runtime = s->runtime; in snd_pcm_drain()
2053 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_drain()
2054 to_check = runtime; in snd_pcm_drain()
2065 if (runtime->no_period_wakeup) in snd_pcm_drain()
2069 if (runtime->rate) { in snd_pcm_drain()
2070 long t = runtime->period_size * 2 / runtime->rate; in snd_pcm_drain()
2080 if (s->runtime == to_check) { in snd_pcm_drain()
2092 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
2117 struct snd_pcm_runtime *runtime; in snd_pcm_drop() local
2122 runtime = substream->runtime; in snd_pcm_drop()
2124 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_drop()
2125 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_drop()
2130 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drop()
2134 /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ in snd_pcm_drop()
2193 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
2194 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
2398 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init() local
2399 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; in snd_pcm_hw_constraints_init()
2416 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, in snd_pcm_hw_constraints_init()
2421 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2427 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2432 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2437 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2442 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2447 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_init()
2452 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2457 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2462 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_init()
2467 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2472 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2477 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2482 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2487 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2492 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2497 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_init()
2502 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_init()
2507 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, in snd_pcm_hw_constraints_init()
2512 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, in snd_pcm_hw_constraints_init()
2522 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete() local
2523 struct snd_pcm_hardware *hw = &runtime->hw; in snd_pcm_hw_constraints_complete()
2539 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); in snd_pcm_hw_constraints_complete()
2543 err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); in snd_pcm_hw_constraints_complete()
2547 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, in snd_pcm_hw_constraints_complete()
2552 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_complete()
2557 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2562 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_complete()
2567 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_complete()
2572 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2577 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2584 if (runtime->dma_bytes) { in snd_pcm_hw_constraints_complete()
2585 …err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes… in snd_pcm_hw_constraints_complete()
2591 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2599 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); in snd_pcm_hw_constraints_complete()
2618 if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) in snd_pcm_release_substream()
2810 switch (substream->runtime->status->state) { in do_pcm_hwsync()
2834 struct snd_pcm_runtime *runtime = substream->runtime; in forward_appl_ptr() local
2842 appl_ptr = runtime->control->appl_ptr + frames; in forward_appl_ptr()
2843 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in forward_appl_ptr()
2844 appl_ptr -= runtime->boundary; in forward_appl_ptr()
2854 struct snd_pcm_runtime *runtime = substream->runtime; in rewind_appl_ptr() local
2862 appl_ptr = runtime->control->appl_ptr - frames; in rewind_appl_ptr()
2864 appl_ptr += runtime->boundary; in rewind_appl_ptr()
2937 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr() local
2948 status = runtime->status; in snd_pcm_sync_ptr()
2949 control = runtime->control; in snd_pcm_sync_ptr()
3010 static snd_pcm_uframes_t recalculate_boundary(struct snd_pcm_runtime *runtime) in recalculate_boundary() argument
3014 if (! runtime->buffer_size) in recalculate_boundary()
3016 boundary = runtime->buffer_size; in recalculate_boundary()
3017 while (boundary * 2 <= 0x7fffffffUL - runtime->buffer_size) in recalculate_boundary()
3025 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_ioctl_sync_ptr_compat() local
3034 if (snd_BUG_ON(!runtime)) in snd_pcm_ioctl_sync_ptr_compat()
3046 status = runtime->status; in snd_pcm_ioctl_sync_ptr_compat()
3047 control = runtime->control; in snd_pcm_ioctl_sync_ptr_compat()
3048 boundary = recalculate_boundary(runtime); in snd_pcm_ioctl_sync_ptr_compat()
3084 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp() local
3091 runtime->tstamp_type = arg; in snd_pcm_tstamp()
3099 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xferi_frames_ioctl() local
3102 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xferi_frames_ioctl()
3121 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xfern_frames_ioctl() local
3125 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xfern_frames_ioctl()
3127 if (runtime->channels > 128) in snd_pcm_xfern_frames_ioctl()
3134 bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels); in snd_pcm_xfern_frames_ioctl()
3349 struct snd_pcm_runtime *runtime; in snd_pcm_read() local
3356 runtime = substream->runtime; in snd_pcm_read()
3357 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_read()
3359 if (!frame_aligned(runtime, count)) in snd_pcm_read()
3361 count = bytes_to_frames(runtime, count); in snd_pcm_read()
3364 result = frames_to_bytes(runtime, result); in snd_pcm_read()
3373 struct snd_pcm_runtime *runtime; in snd_pcm_write() local
3380 runtime = substream->runtime; in snd_pcm_write()
3381 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_write()
3383 if (!frame_aligned(runtime, count)) in snd_pcm_write()
3385 count = bytes_to_frames(runtime, count); in snd_pcm_write()
3388 result = frames_to_bytes(runtime, result); in snd_pcm_write()
3396 struct snd_pcm_runtime *runtime; in snd_pcm_readv() local
3406 runtime = substream->runtime; in snd_pcm_readv()
3407 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_readv()
3411 if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) in snd_pcm_readv()
3413 if (!frame_aligned(runtime, to->iov->iov_len)) in snd_pcm_readv()
3415 frames = bytes_to_samples(runtime, to->iov->iov_len); in snd_pcm_readv()
3423 result = frames_to_bytes(runtime, result); in snd_pcm_readv()
3432 struct snd_pcm_runtime *runtime; in snd_pcm_writev() local
3442 runtime = substream->runtime; in snd_pcm_writev()
3443 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_writev()
3447 if (from->nr_segs > 128 || from->nr_segs != runtime->channels || in snd_pcm_writev()
3448 !frame_aligned(runtime, from->iov->iov_len)) in snd_pcm_writev()
3450 frames = bytes_to_samples(runtime, from->iov->iov_len); in snd_pcm_writev()
3458 result = frames_to_bytes(runtime, result); in snd_pcm_writev()
3467 struct snd_pcm_runtime *runtime; in snd_pcm_poll() local
3481 runtime = substream->runtime; in snd_pcm_poll()
3482 poll_wait(file, &runtime->sleep, wait); in snd_pcm_poll()
3487 switch (runtime->status->state) { in snd_pcm_poll()
3491 if (avail >= runtime->control->avail_min) in snd_pcm_poll()
3524 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_status_fault() local
3528 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3529 vmf->page = virt_to_page(runtime->status); in snd_pcm_mmap_status_fault()
3560 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_control_fault() local
3564 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3565 vmf->page = virt_to_page(runtime->control); in snd_pcm_mmap_control_fault()
3597 (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR)) in pcm_status_mmap_allowed()
3610 if (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR) in pcm_control_mmap_allowed()
3637 void *vaddr = substream->runtime->dma_area + ofs; in snd_pcm_default_page_ops()
3658 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data_fault() local
3665 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3667 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data_fault()
3721 substream->runtime->dma_area, in snd_pcm_lib_default_mmap()
3722 substream->runtime->dma_addr, in snd_pcm_lib_default_mmap()
3723 substream->runtime->dma_bytes); in snd_pcm_lib_default_mmap()
3746 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_lib_mmap_iomem() local
3749 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); in snd_pcm_lib_mmap_iomem()
3760 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data() local
3773 runtime = substream->runtime; in snd_pcm_mmap_data()
3774 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_mmap_data()
3776 if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) in snd_pcm_mmap_data()
3778 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in snd_pcm_mmap_data()
3779 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_mmap_data()
3783 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data()
3840 struct snd_pcm_runtime *runtime; in snd_pcm_fasync() local
3846 runtime = substream->runtime; in snd_pcm_fasync()
3847 return fasync_helper(fd, file, on, &runtime->fasync); in snd_pcm_fasync()
3982 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area() local
3987 return (unsigned long)runtime->status; in snd_pcm_get_unmapped_area()
3989 return (unsigned long)runtime->control; in snd_pcm_get_unmapped_area()
3991 return (unsigned long)runtime->dma_area + offset; in snd_pcm_get_unmapped_area()