Lines Matching full:runtime
221 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) in hw_support_mmap()
235 &substream->runtime->hw_constraints; in constrain_mask_params()
271 &substream->runtime->hw_constraints; in constrain_interval_params()
307 &substream->runtime->hw_constraints; in constrain_params_by_rules()
457 params->info = substream->runtime->hw.info; in fixup_unreferenced_params()
525 static int period_to_usecs(struct snd_pcm_runtime *runtime) in period_to_usecs() argument
529 if (! runtime->rate) in period_to_usecs()
533 usecs = (750000 / runtime->rate) * runtime->period_size; in period_to_usecs()
534 usecs += ((750000 % runtime->rate) * runtime->period_size) / in period_to_usecs()
535 runtime->rate; in period_to_usecs()
543 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_set_state()
544 substream->runtime->status->state = state; in snd_pcm_set_state()
554 &substream->runtime->trigger_tstamp); in snd_pcm_timer_notify()
625 struct snd_pcm_runtime *runtime; in snd_pcm_hw_params() local
632 runtime = substream->runtime; in snd_pcm_hw_params()
634 switch (runtime->status->state) { in snd_pcm_hw_params()
669 runtime->access = params_access(params); in snd_pcm_hw_params()
670 runtime->format = params_format(params); in snd_pcm_hw_params()
671 runtime->subformat = params_subformat(params); in snd_pcm_hw_params()
672 runtime->channels = params_channels(params); in snd_pcm_hw_params()
673 runtime->rate = params_rate(params); in snd_pcm_hw_params()
674 runtime->period_size = params_period_size(params); in snd_pcm_hw_params()
675 runtime->periods = params_periods(params); in snd_pcm_hw_params()
676 runtime->buffer_size = params_buffer_size(params); in snd_pcm_hw_params()
677 runtime->info = params->info; in snd_pcm_hw_params()
678 runtime->rate_num = params->rate_num; in snd_pcm_hw_params()
679 runtime->rate_den = params->rate_den; in snd_pcm_hw_params()
680 runtime->no_period_wakeup = in snd_pcm_hw_params()
684 bits = snd_pcm_format_physical_width(runtime->format); in snd_pcm_hw_params()
685 runtime->sample_bits = bits; in snd_pcm_hw_params()
686 bits *= runtime->channels; in snd_pcm_hw_params()
687 runtime->frame_bits = bits; in snd_pcm_hw_params()
693 runtime->byte_align = bits / 8; in snd_pcm_hw_params()
694 runtime->min_align = frames; in snd_pcm_hw_params()
697 runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; in snd_pcm_hw_params()
698 runtime->period_step = 1; in snd_pcm_hw_params()
699 runtime->control->avail_min = runtime->period_size; in snd_pcm_hw_params()
700 runtime->start_threshold = 1; in snd_pcm_hw_params()
701 runtime->stop_threshold = runtime->buffer_size; in snd_pcm_hw_params()
702 runtime->silence_threshold = 0; in snd_pcm_hw_params()
703 runtime->silence_size = 0; in snd_pcm_hw_params()
704 runtime->boundary = runtime->buffer_size; in snd_pcm_hw_params()
705 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) in snd_pcm_hw_params()
706 runtime->boundary *= 2; in snd_pcm_hw_params()
713 if ((usecs = period_to_usecs(runtime)) >= 0) in snd_pcm_hw_params()
750 struct snd_pcm_runtime *runtime; in snd_pcm_hw_free() local
755 runtime = substream->runtime; in snd_pcm_hw_free()
757 switch (runtime->status->state) { in snd_pcm_hw_free()
778 struct snd_pcm_runtime *runtime; in snd_pcm_sw_params() local
783 runtime = substream->runtime; in snd_pcm_sw_params()
785 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_sw_params()
799 if (params->silence_size >= runtime->boundary) { in snd_pcm_sw_params()
805 if (params->silence_threshold > runtime->buffer_size) in snd_pcm_sw_params()
810 runtime->tstamp_mode = params->tstamp_mode; in snd_pcm_sw_params()
812 runtime->tstamp_type = params->tstamp_type; in snd_pcm_sw_params()
813 runtime->period_step = params->period_step; in snd_pcm_sw_params()
814 runtime->control->avail_min = params->avail_min; in snd_pcm_sw_params()
815 runtime->start_threshold = params->start_threshold; in snd_pcm_sw_params()
816 runtime->stop_threshold = params->stop_threshold; in snd_pcm_sw_params()
817 runtime->silence_threshold = params->silence_threshold; in snd_pcm_sw_params()
818 runtime->silence_size = params->silence_size; in snd_pcm_sw_params()
819 params->boundary = runtime->boundary; in snd_pcm_sw_params()
822 runtime->silence_size > 0) in snd_pcm_sw_params()
824 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
849 delay = snd_pcm_playback_hw_avail(substream->runtime); in snd_pcm_calc_delay()
851 delay = snd_pcm_capture_avail(substream->runtime); in snd_pcm_calc_delay()
852 return delay + substream->runtime->delay; in snd_pcm_calc_delay()
858 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status() local
863 &runtime->audio_tstamp_config); in snd_pcm_status()
866 if (runtime->audio_tstamp_config.type_requested == in snd_pcm_status()
868 if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) in snd_pcm_status()
869 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
872 runtime->audio_tstamp_config.type_requested = in snd_pcm_status()
874 runtime->audio_tstamp_report.valid = 0; in snd_pcm_status()
876 runtime->audio_tstamp_report.valid = 1; in snd_pcm_status()
878 status->state = runtime->status->state; in snd_pcm_status()
879 status->suspended_state = runtime->status->suspended_state; in snd_pcm_status()
882 status->trigger_tstamp = runtime->trigger_tstamp; in snd_pcm_status()
885 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { in snd_pcm_status()
886 status->tstamp = runtime->status->tstamp; in snd_pcm_status()
887 status->driver_tstamp = runtime->driver_tstamp; in snd_pcm_status()
889 runtime->status->audio_tstamp; in snd_pcm_status()
890 if (runtime->audio_tstamp_report.valid == 1) in snd_pcm_status()
894 &runtime->audio_tstamp_report); in snd_pcm_status()
900 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) in snd_pcm_status()
901 snd_pcm_gettime(runtime, &status->tstamp); in snd_pcm_status()
904 status->appl_ptr = runtime->control->appl_ptr; in snd_pcm_status()
905 status->hw_ptr = runtime->status->hw_ptr; in snd_pcm_status()
909 status->avail_max = runtime->avail_max; in snd_pcm_status()
910 status->overrange = runtime->overrange; in snd_pcm_status()
911 runtime->avail_max = 0; in snd_pcm_status()
912 runtime->overrange = 0; in snd_pcm_status()
945 struct snd_pcm_runtime *runtime; in snd_pcm_channel_info() local
949 runtime = substream->runtime; in snd_pcm_channel_info()
951 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { in snd_pcm_channel_info()
956 if (channel >= runtime->channels) in snd_pcm_channel_info()
981 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp() local
982 if (runtime->trigger_master == NULL) in snd_pcm_trigger_tstamp()
984 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
985 if (!runtime->trigger_tstamp_latched) in snd_pcm_trigger_tstamp()
986 snd_pcm_gettime(runtime, &runtime->trigger_tstamp); in snd_pcm_trigger_tstamp()
988 snd_pcm_trigger_tstamp(runtime->trigger_master); in snd_pcm_trigger_tstamp()
989 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; in snd_pcm_trigger_tstamp()
991 runtime->trigger_master = NULL; in snd_pcm_trigger_tstamp()
1198 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start() local
1199 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) in snd_pcm_pre_start()
1204 runtime->trigger_tstamp_latched = false; in snd_pcm_pre_start()
1205 runtime->trigger_master = substream; in snd_pcm_pre_start()
1211 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1218 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1224 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start() local
1226 runtime->hw_ptr_jiffies = jiffies; in snd_pcm_post_start()
1227 runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / in snd_pcm_post_start()
1228 runtime->rate; in snd_pcm_post_start()
1229 runtime->status->state = state; in snd_pcm_post_start()
1231 runtime->silence_size > 0) in snd_pcm_post_start()
1268 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop() local
1269 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_pre_stop()
1271 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1277 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1285 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop() local
1286 if (runtime->status->state != state) { in snd_pcm_post_stop()
1288 runtime->status->state = state; in snd_pcm_post_stop()
1291 wake_up(&runtime->sleep); in snd_pcm_post_stop()
1292 wake_up(&runtime->tsleep); in snd_pcm_post_stop()
1345 if (substream->runtime && snd_pcm_running(substream)) in snd_pcm_stop_xrun()
1357 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause() local
1358 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) in snd_pcm_pre_pause()
1361 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) in snd_pcm_pre_pause()
1363 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) in snd_pcm_pre_pause()
1365 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1371 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1381 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1389 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1397 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause() local
1400 runtime->status->state = SNDRV_PCM_STATE_PAUSED; in snd_pcm_post_pause()
1402 wake_up(&runtime->sleep); in snd_pcm_post_pause()
1403 wake_up(&runtime->tsleep); in snd_pcm_post_pause()
1405 runtime->status->state = SNDRV_PCM_STATE_RUNNING; in snd_pcm_post_pause()
1430 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend() local
1431 switch (runtime->status->state) { in snd_pcm_pre_suspend()
1440 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1446 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend() local
1447 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1457 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend() local
1459 runtime->status->suspended_state = runtime->status->state; in snd_pcm_post_suspend()
1460 runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; in snd_pcm_post_suspend()
1462 wake_up(&runtime->sleep); in snd_pcm_post_suspend()
1463 wake_up(&runtime->tsleep); in snd_pcm_post_suspend()
1511 if (substream->runtime == NULL) in snd_pcm_suspend_all()
1534 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume() local
1535 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) in snd_pcm_pre_resume()
1537 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1543 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume() local
1544 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1547 if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && in snd_pcm_do_resume()
1548 (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || in snd_pcm_do_resume()
1556 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1563 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume() local
1565 runtime->status->state = runtime->status->suspended_state; in snd_pcm_post_resume()
1597 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun() local
1601 switch (runtime->status->state) { in snd_pcm_xrun()
1621 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset() local
1622 switch (runtime->status->state) { in snd_pcm_pre_reset()
1635 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset() local
1639 runtime->hw_ptr_base = 0; in snd_pcm_do_reset()
1640 runtime->hw_ptr_interrupt = runtime->status->hw_ptr - in snd_pcm_do_reset()
1641 runtime->status->hw_ptr % runtime->period_size; in snd_pcm_do_reset()
1642 runtime->silence_start = runtime->status->hw_ptr; in snd_pcm_do_reset()
1643 runtime->silence_filled = 0; in snd_pcm_do_reset()
1649 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset() local
1650 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_reset()
1652 runtime->silence_size > 0) in snd_pcm_post_reset()
1674 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare() local
1675 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_pre_prepare()
1676 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_pre_prepare()
1695 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare() local
1696 runtime->control->appl_ptr = runtime->status->hw_ptr; in snd_pcm_post_prepare()
1724 switch (substream->runtime->status->state) { in snd_pcm_prepare()
1744 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init() local
1745 switch (runtime->status->state) { in snd_pcm_pre_drain_init()
1751 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1757 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init() local
1759 switch (runtime->status->state) { in snd_pcm_do_drain_init()
1766 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1770 runtime->status->state = SNDRV_PCM_STATE_DRAINING; in snd_pcm_do_drain_init()
1773 runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_pcm_do_drain_init()
1780 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { in snd_pcm_do_drain_init()
1781 int new_state = snd_pcm_capture_avail(runtime) > 0 ? in snd_pcm_do_drain_init()
1788 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING && in snd_pcm_do_drain_init()
1789 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1790 (runtime->hw.info & SNDRV_PCM_INFO_DRAIN_TRIGGER)) in snd_pcm_do_drain_init()
1818 struct snd_pcm_runtime *runtime; in snd_pcm_drain() local
1826 runtime = substream->runtime; in snd_pcm_drain()
1828 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_drain()
1839 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drain()
1865 runtime = s->runtime; in snd_pcm_drain()
1866 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_drain()
1867 to_check = runtime; in snd_pcm_drain()
1878 if (runtime->no_period_wakeup) in snd_pcm_drain()
1882 if (runtime->rate) { in snd_pcm_drain()
1883 long t = runtime->period_size * 2 / runtime->rate; in snd_pcm_drain()
1893 if (s->runtime == to_check) { in snd_pcm_drain()
1905 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
1930 struct snd_pcm_runtime *runtime; in snd_pcm_drop() local
1935 runtime = substream->runtime; in snd_pcm_drop()
1937 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_drop()
1938 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_drop()
1943 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) in snd_pcm_drop()
1947 /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ in snd_pcm_drop()
2000 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
2001 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
2204 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init() local
2205 struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; in snd_pcm_hw_constraints_init()
2222 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, in snd_pcm_hw_constraints_init()
2227 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2233 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, in snd_pcm_hw_constraints_init()
2238 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2243 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2248 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, in snd_pcm_hw_constraints_init()
2253 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_init()
2258 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2263 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_init()
2268 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_init()
2273 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2278 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2283 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, in snd_pcm_hw_constraints_init()
2288 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2293 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2298 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, in snd_pcm_hw_constraints_init()
2303 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_init()
2308 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_init()
2313 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, in snd_pcm_hw_constraints_init()
2318 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, in snd_pcm_hw_constraints_init()
2328 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete() local
2329 struct snd_pcm_hardware *hw = &runtime->hw; in snd_pcm_hw_constraints_complete()
2345 err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); in snd_pcm_hw_constraints_complete()
2349 err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); in snd_pcm_hw_constraints_complete()
2353 …err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, 1 << SNDRV_PCM_SUBFORMAT_S… in snd_pcm_hw_constraints_complete()
2357 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, in snd_pcm_hw_constraints_complete()
2362 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2367 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, in snd_pcm_hw_constraints_complete()
2372 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_hw_constraints_complete()
2377 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2382 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, in snd_pcm_hw_constraints_complete()
2389 if (runtime->dma_bytes) { in snd_pcm_hw_constraints_complete()
2390 …err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes… in snd_pcm_hw_constraints_complete()
2396 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, in snd_pcm_hw_constraints_complete()
2404 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); in snd_pcm_hw_constraints_complete()
2424 substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) in snd_pcm_release_substream()
2616 switch (substream->runtime->status->state) { in do_pcm_hwsync()
2640 struct snd_pcm_runtime *runtime = substream->runtime; in forward_appl_ptr() local
2648 appl_ptr = runtime->control->appl_ptr + frames; in forward_appl_ptr()
2649 if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) in forward_appl_ptr()
2650 appl_ptr -= runtime->boundary; in forward_appl_ptr()
2660 struct snd_pcm_runtime *runtime = substream->runtime; in rewind_appl_ptr() local
2668 appl_ptr = runtime->control->appl_ptr - frames; in rewind_appl_ptr()
2670 appl_ptr += runtime->boundary; in rewind_appl_ptr()
2743 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr() local
2754 status = runtime->status; in snd_pcm_sync_ptr()
2755 control = runtime->control; in snd_pcm_sync_ptr()
2789 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp() local
2796 runtime->tstamp_type = arg; in snd_pcm_tstamp()
2804 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xferi_frames_ioctl() local
2807 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xferi_frames_ioctl()
2825 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xfern_frames_ioctl() local
2829 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_xfern_frames_ioctl()
2831 if (runtime->channels > 128) in snd_pcm_xfern_frames_ioctl()
2838 bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels); in snd_pcm_xfern_frames_ioctl()
3046 struct snd_pcm_runtime *runtime; in snd_pcm_read() local
3053 runtime = substream->runtime; in snd_pcm_read()
3054 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_read()
3056 if (!frame_aligned(runtime, count)) in snd_pcm_read()
3058 count = bytes_to_frames(runtime, count); in snd_pcm_read()
3061 result = frames_to_bytes(runtime, result); in snd_pcm_read()
3070 struct snd_pcm_runtime *runtime; in snd_pcm_write() local
3077 runtime = substream->runtime; in snd_pcm_write()
3078 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_write()
3080 if (!frame_aligned(runtime, count)) in snd_pcm_write()
3082 count = bytes_to_frames(runtime, count); in snd_pcm_write()
3085 result = frames_to_bytes(runtime, result); in snd_pcm_write()
3093 struct snd_pcm_runtime *runtime; in snd_pcm_readv() local
3103 runtime = substream->runtime; in snd_pcm_readv()
3104 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_readv()
3108 if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) in snd_pcm_readv()
3110 if (!frame_aligned(runtime, to->iov->iov_len)) in snd_pcm_readv()
3112 frames = bytes_to_samples(runtime, to->iov->iov_len); in snd_pcm_readv()
3120 result = frames_to_bytes(runtime, result); in snd_pcm_readv()
3129 struct snd_pcm_runtime *runtime; in snd_pcm_writev() local
3139 runtime = substream->runtime; in snd_pcm_writev()
3140 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_writev()
3144 if (from->nr_segs > 128 || from->nr_segs != runtime->channels || in snd_pcm_writev()
3145 !frame_aligned(runtime, from->iov->iov_len)) in snd_pcm_writev()
3147 frames = bytes_to_samples(runtime, from->iov->iov_len); in snd_pcm_writev()
3155 result = frames_to_bytes(runtime, result); in snd_pcm_writev()
3164 struct snd_pcm_runtime *runtime; in snd_pcm_poll() local
3178 runtime = substream->runtime; in snd_pcm_poll()
3179 poll_wait(file, &runtime->sleep, wait); in snd_pcm_poll()
3184 switch (runtime->status->state) { in snd_pcm_poll()
3188 if (avail >= runtime->control->avail_min) in snd_pcm_poll()
3221 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_status_fault() local
3225 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3226 vmf->page = virt_to_page(runtime->status); in snd_pcm_mmap_status_fault()
3257 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_control_fault() local
3261 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3262 vmf->page = virt_to_page(runtime->control); in snd_pcm_mmap_control_fault()
3296 (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR)) in pcm_status_mmap_allowed()
3309 if (pcm_file->substream->runtime->hw.info & SNDRV_PCM_INFO_SYNC_APPLPTR) in pcm_control_mmap_allowed()
3336 void *vaddr = substream->runtime->dma_area + ofs; in snd_pcm_default_page_ops()
3346 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data_fault() local
3353 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3355 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data_fault()
3409 substream->runtime->dma_area, in snd_pcm_lib_default_mmap()
3410 substream->runtime->dma_addr, in snd_pcm_lib_default_mmap()
3411 substream->runtime->dma_bytes); in snd_pcm_lib_default_mmap()
3435 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_lib_mmap_iomem() local
3438 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); in snd_pcm_lib_mmap_iomem()
3449 struct snd_pcm_runtime *runtime; in snd_pcm_mmap_data() local
3462 runtime = substream->runtime; in snd_pcm_mmap_data()
3463 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) in snd_pcm_mmap_data()
3465 if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) in snd_pcm_mmap_data()
3467 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in snd_pcm_mmap_data()
3468 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_mmap_data()
3472 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); in snd_pcm_mmap_data()
3521 struct snd_pcm_runtime *runtime; in snd_pcm_fasync() local
3527 runtime = substream->runtime; in snd_pcm_fasync()
3528 return fasync_helper(fd, file, on, &runtime->fasync); in snd_pcm_fasync()
3663 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area() local
3668 return (unsigned long)runtime->status; in snd_pcm_get_unmapped_area()
3670 return (unsigned long)runtime->control; in snd_pcm_get_unmapped_area()
3672 return (unsigned long)runtime->dma_area + offset; in snd_pcm_get_unmapped_area()