Lines Matching refs:substream
539 static int snd_pcm_oss_plugin_clear(struct snd_pcm_substream *substream) in snd_pcm_oss_plugin_clear() argument
541 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_plugin_clear()
585 static long snd_pcm_oss_bytes(struct snd_pcm_substream *substream, long frames) in snd_pcm_oss_bytes() argument
587 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_bytes()
588 long buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_pcm_oss_bytes()
602 static long snd_pcm_alsa_frames(struct snd_pcm_substream *substream, long bytes) in snd_pcm_alsa_frames() argument
604 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_alsa_frames()
605 long buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_pcm_alsa_frames()
681 static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, in snd_pcm_oss_period_size() argument
689 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_period_size()
700 oss_buffer_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
705 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_period_size()
710 if (substream->oss.setup.period_size > 16) in snd_pcm_oss_period_size()
711 oss_period_size = substream->oss.setup.period_size; in snd_pcm_oss_period_size()
737 min_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
746 max_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
757 if (substream->oss.setup.periods > 1) in snd_pcm_oss_period_size()
758 oss_periods = substream->oss.setup.periods; in snd_pcm_oss_period_size()
783 static int choose_rate(struct snd_pcm_substream *substream, in choose_rate() argument
803 ret = snd_pcm_hw_param_set(substream, params, in choose_rate()
820 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); in choose_rate()
841 static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_change_params_locked() argument
843 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked()
865 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
868 direct = substream->oss.setup.direct; in snd_pcm_oss_change_params_locked()
874 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
881 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); in snd_pcm_oss_change_params_locked()
883 pcm_dbg(substream->pcm, "No usable accesses\n"); in snd_pcm_oss_change_params_locked()
888 err = choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
891 err = snd_pcm_hw_param_near(substream, sparams, in snd_pcm_oss_change_params_locked()
912 pcm_dbg(substream->pcm, "Cannot find a format!!!\n"); in snd_pcm_oss_change_params_locked()
944 err = snd_pcm_oss_period_size(substream, params, sparams); in snd_pcm_oss_change_params_locked()
948 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
949 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL); in snd_pcm_oss_change_params_locked()
953 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_oss_change_params_locked()
958 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_change_params_locked()
960 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams); in snd_pcm_oss_change_params_locked()
962 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
967 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
970 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
971 err = snd_pcm_plug_format_plugins(substream, params, sparams); in snd_pcm_oss_change_params_locked()
973 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
975 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
980 err = snd_pcm_plugin_build_io(substream, sparams, &plugin); in snd_pcm_oss_change_params_locked()
982 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
984 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
987 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_oss_change_params_locked()
993 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
1005 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1006 substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_oss_change_params_locked()
1012 sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in snd_pcm_oss_change_params_locked()
1014 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1015 substream->oss.setup.nosilence) { in snd_pcm_oss_change_params_locked()
1027 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params); in snd_pcm_oss_change_params_locked()
1029 pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
1034 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); in snd_pcm_oss_change_params_locked()
1041 err = snd_pcm_plug_alloc(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1081 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1092 static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, in snd_pcm_oss_change_params() argument
1095 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params()
1104 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_change_params()
1112 struct snd_pcm_substream *asubstream = NULL, *substream; in snd_pcm_oss_get_active_substream() local
1115 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_active_substream()
1116 if (substream == NULL) in snd_pcm_oss_get_active_substream()
1119 asubstream = substream; in snd_pcm_oss_get_active_substream()
1120 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1121 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_active_substream()
1137 static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) in snd_pcm_oss_prepare() argument
1140 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare()
1142 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); in snd_pcm_oss_prepare()
1144 pcm_dbg(substream->pcm, in snd_pcm_oss_prepare()
1156 static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready() argument
1161 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1163 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_make_ready()
1170 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready()
1179 static int snd_pcm_oss_make_ready_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready_locked() argument
1184 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1186 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_make_ready_locked()
1191 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready_locked()
1198 static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_… in snd_pcm_oss_capture_position_fixup() argument
1205 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, delay); in snd_pcm_oss_capture_position_fixup()
1208 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1216 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_FORWARD, &frames); in snd_pcm_oss_capture_position_fixup()
1223 snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_… in snd_pcm_oss_write3() argument
1225 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3()
1231 pcm_dbg(substream->pcm, in snd_pcm_oss_write3()
1236 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_write3()
1241 ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, in snd_pcm_oss_write3()
1254 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes… in snd_pcm_oss_read3() argument
1256 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3()
1263 pcm_dbg(substream->pcm, in snd_pcm_oss_read3()
1268 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_read3()
1272 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_read3()
1276 ret = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_read3()
1280 ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, in snd_pcm_oss_read3()
1285 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_read3()
1298 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufr… in snd_pcm_oss_writev3() argument
1300 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3()
1306 pcm_dbg(substream->pcm, in snd_pcm_oss_writev3()
1311 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_writev3()
1315 ret = snd_pcm_kernel_writev(substream, bufs, frames); in snd_pcm_oss_writev3()
1327 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufra… in snd_pcm_oss_readv3() argument
1329 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3()
1335 pcm_dbg(substream->pcm, in snd_pcm_oss_readv3()
1340 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_readv3()
1344 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_readv3()
1348 ret = snd_pcm_kernel_readv(substream, bufs, frames); in snd_pcm_oss_readv3()
1356 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t byte… in snd_pcm_oss_write2() argument
1358 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2()
1370 frames1 = snd_pcm_plug_client_channels_buf(substream, (char *)buf, frames, &channels); in snd_pcm_oss_write2()
1373 frames1 = snd_pcm_plug_write_transfer(substream, channels, frames1); in snd_pcm_oss_write2()
1381 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); in snd_pcm_oss_write2()
1389 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size… in snd_pcm_oss_write1() argument
1393 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1()
1395 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_write1()
1404 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_write1()
1421 if (substream->oss.setup.partialfrag || in snd_pcm_oss_write1()
1423 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1433 else if ((substream->f_flags & O_NONBLOCK) != 0) { in snd_pcm_oss_write1()
1439 tmp = snd_pcm_oss_write2(substream, in snd_pcm_oss_write1()
1448 if ((substream->f_flags & O_NONBLOCK) != 0 && in snd_pcm_oss_write1()
1466 static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int … in snd_pcm_oss_read2() argument
1468 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2()
1478 frames1 = snd_pcm_plug_client_channels_buf(substream, buf, frames, &channels); in snd_pcm_oss_read2()
1481 frames1 = snd_pcm_plug_read_transfer(substream, channels, frames1); in snd_pcm_oss_read2()
1491 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); in snd_pcm_oss_read2()
1499 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t byte… in snd_pcm_oss_read1() argument
1503 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1()
1505 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_read1()
1514 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_read1()
1519 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1538 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, in snd_pcm_oss_read1()
1563 struct snd_pcm_substream *substream; in snd_pcm_oss_reset() local
1568 substream = pcm_oss_file->streams[i]; in snd_pcm_oss_reset()
1569 if (!substream) in snd_pcm_oss_reset()
1571 runtime = substream->runtime; in snd_pcm_oss_reset()
1572 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_reset()
1585 struct snd_pcm_substream *substream; in snd_pcm_oss_post() local
1588 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_post()
1589 if (substream != NULL) { in snd_pcm_oss_post()
1590 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_post()
1593 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); in snd_pcm_oss_post()
1600 static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) in snd_pcm_oss_sync1() argument
1608 runtime = substream->runtime; in snd_pcm_oss_sync1()
1612 pcm_dbg(substream->pcm, "sync1: size = %li\n", size); in snd_pcm_oss_sync1()
1615 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1625 snd_pcm_stream_lock_irq(substream); in snd_pcm_oss_sync1()
1627 snd_pcm_stream_unlock_irq(substream); in snd_pcm_oss_sync1()
1638 pcm_err(substream->pcm, in snd_pcm_oss_sync1()
1652 struct snd_pcm_substream *substream; in snd_pcm_oss_sync() local
1658 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_sync()
1659 if (substream != NULL) { in snd_pcm_oss_sync()
1660 runtime = substream->runtime; in snd_pcm_oss_sync()
1661 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_sync()
1663 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_sync()
1675 pcm_dbg(substream->pcm, "sync: buffer_used\n"); in snd_pcm_oss_sync()
1681 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1686 pcm_dbg(substream->pcm, "sync: period_ptr\n"); in snd_pcm_oss_sync()
1692 err = snd_pcm_oss_sync1(substream, size); in snd_pcm_oss_sync()
1704 snd_pcm_lib_write(substream, NULL, size); in snd_pcm_oss_sync()
1706 snd_pcm_lib_writev(substream, NULL, size); in snd_pcm_oss_sync()
1717 saved_f_flags = substream->f_flags; in snd_pcm_oss_sync()
1718 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_sync()
1719 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_sync()
1720 substream->f_flags = saved_f_flags; in snd_pcm_oss_sync()
1728 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_sync()
1729 if (substream != NULL) { in snd_pcm_oss_sync()
1730 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_sync()
1733 runtime = substream->runtime; in snd_pcm_oss_sync()
1734 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_sync()
1750 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_rate() local
1754 if (substream == NULL) in snd_pcm_oss_set_rate()
1756 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1775 struct snd_pcm_substream *substream; in snd_pcm_oss_get_rate() local
1778 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_rate()
1781 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1792 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_channels() local
1796 if (substream == NULL) in snd_pcm_oss_set_channels()
1798 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1813 struct snd_pcm_substream *substream; in snd_pcm_oss_get_channels() local
1816 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_channels()
1819 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1824 struct snd_pcm_substream *substream; in snd_pcm_oss_get_block_size() local
1827 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_block_size()
1830 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1835 struct snd_pcm_substream *substream; in snd_pcm_oss_get_formats() local
1843 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_formats()
1846 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_get_formats()
1849 direct = substream->oss.setup.direct; in snd_pcm_oss_get_formats()
1862 err = snd_pcm_hw_refine(substream, params); in snd_pcm_oss_get_formats()
1891 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_format() local
1893 if (substream == NULL) in snd_pcm_oss_set_format()
1895 runtime = substream->runtime; in snd_pcm_oss_set_format()
1911 struct snd_pcm_substream *substream; in snd_pcm_oss_get_format() local
1914 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_format()
1917 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1920 static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide) in snd_pcm_oss_set_subdivide1() argument
1924 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1946 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_subdivide() local
1949 if (substream == NULL) in snd_pcm_oss_set_subdivide()
1951 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1955 err = snd_pcm_oss_set_subdivide1(substream, subdivide); in snd_pcm_oss_set_subdivide()
1963 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) in snd_pcm_oss_set_fragment1() argument
1968 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1989 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_fragment() local
1992 if (substream == NULL) in snd_pcm_oss_set_fragment()
1994 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1998 err = snd_pcm_oss_set_fragment1(substream, val); in snd_pcm_oss_set_fragment()
2014 static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) in snd_pcm_oss_get_caps1() argument
2017 if (substream == NULL) { in snd_pcm_oss_get_caps1()
2022 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_caps1()
2023 if (substream->pstr->substream_count > 1) in snd_pcm_oss_get_caps1()
2030 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1()
2044 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_caps() local
2045 result = snd_pcm_oss_get_caps1(substream, result); in snd_pcm_oss_get_caps()
2051 static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, in snd_pcm_oss_simulate_fill() argument
2054 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill()
2068 pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); in snd_pcm_oss_set_trigger()
2160 struct snd_pcm_substream *substream; in snd_pcm_oss_get_odelay() local
2165 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_get_odelay()
2166 if (substream == NULL) in snd_pcm_oss_get_odelay()
2168 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_get_odelay()
2171 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2174 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_odelay()
2179 return snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_odelay()
2184 struct snd_pcm_substream *substream; in snd_pcm_oss_get_ptr() local
2193 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_ptr()
2194 if (substream == NULL) in snd_pcm_oss_get_ptr()
2196 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_get_ptr()
2199 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2207 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_ptr()
2216 err = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_get_ptr()
2221 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2222 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_get_ptr()
2230 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_ptr()
2231 snd_pcm_oss_simulate_fill(substream, delay); in snd_pcm_oss_get_ptr()
2232 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2234 delay = snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_ptr()
2236 if (substream->oss.setup.buggyptr) in snd_pcm_oss_get_ptr()
2254 struct snd_pcm_substream *substream; in snd_pcm_oss_get_space() local
2263 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_space()
2264 if (substream == NULL) in snd_pcm_oss_get_space()
2266 runtime = substream->runtime; in snd_pcm_oss_get_space()
2269 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_space()
2286 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); in snd_pcm_oss_get_space()
2296 err = snd_pcm_oss_capture_position_fixup(substream, &avail); in snd_pcm_oss_get_space()
2301 info.bytes = snd_pcm_oss_bytes(substream, avail) + fixup; in snd_pcm_oss_get_space()
2306 pcm_dbg(substream->pcm, in snd_pcm_oss_get_space()
2352 static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) in snd_pcm_oss_release_substream() argument
2355 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2359 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_release_substream()
2361 substream->oss.oss = 0; in snd_pcm_oss_release_substream()
2364 static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, in snd_pcm_oss_init_substream() argument
2370 substream->oss.oss = 1; in snd_pcm_oss_init_substream()
2371 substream->oss.setup = *setup; in snd_pcm_oss_init_substream()
2373 substream->f_flags |= O_NONBLOCK; in snd_pcm_oss_init_substream()
2375 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_init_substream()
2376 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2395 substream->pcm_release = snd_pcm_oss_release_substream; in snd_pcm_oss_init_substream()
2405 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx]; in snd_pcm_oss_release_file() local
2406 if (substream) in snd_pcm_oss_release_file()
2407 snd_pcm_release_substream(substream); in snd_pcm_oss_release_file()
2421 struct snd_pcm_substream *substream; in snd_pcm_oss_open_file() local
2448 err = snd_pcm_open_substream(pcm, idx, file, &substream); in snd_pcm_oss_open_file()
2454 pcm_oss_file->streams[idx] = substream; in snd_pcm_oss_open_file()
2455 snd_pcm_oss_init_substream(substream, &setup[idx], minor); in snd_pcm_oss_open_file()
2573 struct snd_pcm_substream *substream; in snd_pcm_oss_release() local
2577 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_release()
2578 if (substream == NULL) in snd_pcm_oss_release()
2579 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_release()
2580 if (snd_BUG_ON(!substream)) in snd_pcm_oss_release()
2582 pcm = substream->pcm; in snd_pcm_oss_release()
2607 struct snd_pcm_substream *substream; in snd_pcm_oss_ioctl() local
2610 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_ioctl()
2611 if (substream != NULL) in snd_pcm_oss_ioctl()
2616 return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg); in snd_pcm_oss_ioctl()
2774 struct snd_pcm_substream *substream; in snd_pcm_oss_read() local
2777 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_read()
2778 if (substream == NULL) in snd_pcm_oss_read()
2780 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_read()
2782 return snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2785 ssize_t res = snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2786 pcm_dbg(substream->pcm, in snd_pcm_oss_read()
2797 struct snd_pcm_substream *substream; in snd_pcm_oss_write() local
2801 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_write()
2802 if (substream == NULL) in snd_pcm_oss_write()
2804 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_write()
2805 result = snd_pcm_oss_write1(substream, buf, count); in snd_pcm_oss_write()
2807 pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n", in snd_pcm_oss_write()
2813 static int snd_pcm_oss_playback_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_playback_ready() argument
2815 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready()
2816 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_playback_ready()
2824 static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_capture_ready() argument
2826 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready()
2827 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_capture_ready()
2882 struct snd_pcm_substream *substream = NULL; in snd_pcm_oss_mmap() local
2892 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2893 if (substream) in snd_pcm_oss_mmap()
2897 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_mmap()
2900 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2908 if (substream == NULL) in snd_pcm_oss_mmap()
2910 runtime = substream->runtime; in snd_pcm_oss_mmap()
2923 err = snd_pcm_oss_change_params(substream, true); in snd_pcm_oss_mmap()
2935 err = snd_pcm_mmap_data(substream, file, area); in snd_pcm_oss_mmap()