Lines Matching refs:substream

565 static int snd_pcm_oss_plugin_clear(struct snd_pcm_substream *substream)  in snd_pcm_oss_plugin_clear()  argument
567 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_plugin_clear()
611 static long snd_pcm_oss_bytes(struct snd_pcm_substream *substream, long frames) in snd_pcm_oss_bytes() argument
613 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_bytes()
614 long buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_pcm_oss_bytes()
628 static long snd_pcm_alsa_frames(struct snd_pcm_substream *substream, long bytes) in snd_pcm_alsa_frames() argument
630 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_alsa_frames()
631 long buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_pcm_alsa_frames()
707 static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, in snd_pcm_oss_period_size() argument
714 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_period_size()
720 oss_buffer_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
723 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_period_size()
728 if (substream->oss.setup.period_size > 16) in snd_pcm_oss_period_size()
729 oss_period_size = substream->oss.setup.period_size; in snd_pcm_oss_period_size()
755 min_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
762 max_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
771 if (substream->oss.setup.periods > 1) in snd_pcm_oss_period_size()
772 oss_periods = substream->oss.setup.periods; in snd_pcm_oss_period_size()
797 static int choose_rate(struct snd_pcm_substream *substream, in choose_rate() argument
817 ret = snd_pcm_hw_param_set(substream, params, in choose_rate()
834 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); in choose_rate()
837 static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, in snd_pcm_oss_change_params() argument
840 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params()
865 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params()
868 direct = substream->oss.setup.direct; in snd_pcm_oss_change_params()
874 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params()
881 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); in snd_pcm_oss_change_params()
883 pcm_dbg(substream->pcm, "No usable accesses\n"); in snd_pcm_oss_change_params()
887 choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params()
888 …snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL… in snd_pcm_oss_change_params()
908 pcm_dbg(substream->pcm, "Cannot find a format!!!\n"); in snd_pcm_oss_change_params()
941 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
944 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
945 if ((err = snd_pcm_plug_format_plugins(substream, in snd_pcm_oss_change_params()
948 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params()
950 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
955 if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) { in snd_pcm_oss_change_params()
956 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params()
958 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
961 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_oss_change_params()
967 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
974 err = snd_pcm_oss_period_size(substream, params, sparams); in snd_pcm_oss_change_params()
978 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params()
979 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL); in snd_pcm_oss_change_params()
983 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_oss_change_params()
988 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_change_params()
990 if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) { in snd_pcm_oss_change_params()
991 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params()
1001 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params()
1002 substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_oss_change_params()
1008 sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in snd_pcm_oss_change_params()
1010 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params()
1011 substream->oss.setup.nosilence) { in snd_pcm_oss_change_params()
1023 if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) { in snd_pcm_oss_change_params()
1024 pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params()
1029 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); in snd_pcm_oss_change_params()
1036 err = snd_pcm_plug_alloc(substream, oss_period_size); in snd_pcm_oss_change_params()
1076 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params()
1090 struct snd_pcm_substream *asubstream = NULL, *substream; in snd_pcm_oss_get_active_substream() local
1093 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_active_substream()
1094 if (substream == NULL) in snd_pcm_oss_get_active_substream()
1097 asubstream = substream; in snd_pcm_oss_get_active_substream()
1098 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1099 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_active_substream()
1111 static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) in snd_pcm_oss_prepare() argument
1114 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare()
1116 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); in snd_pcm_oss_prepare()
1118 pcm_dbg(substream->pcm, in snd_pcm_oss_prepare()
1130 static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready() argument
1135 if (substream == NULL) in snd_pcm_oss_make_ready()
1137 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1139 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_make_ready()
1144 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready()
1151 static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_… in snd_pcm_oss_capture_position_fixup() argument
1158 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, delay); in snd_pcm_oss_capture_position_fixup()
1161 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1169 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_FORWARD, &frames); in snd_pcm_oss_capture_position_fixup()
1176 snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_… in snd_pcm_oss_write3() argument
1178 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3()
1184 pcm_dbg(substream->pcm, in snd_pcm_oss_write3()
1189 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_write3()
1196 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_write3()
1199 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_write3()
1211 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes… in snd_pcm_oss_read3() argument
1213 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3()
1220 pcm_dbg(substream->pcm, in snd_pcm_oss_read3()
1225 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_read3()
1229 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_read3()
1233 ret = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_read3()
1239 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_read3()
1242 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_read3()
1246 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_read3()
1258 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufr… in snd_pcm_oss_writev3() argument
1260 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3()
1266 pcm_dbg(substream->pcm, in snd_pcm_oss_writev3()
1271 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_writev3()
1278 ret = snd_pcm_lib_writev(substream, (void __user **)bufs, frames); in snd_pcm_oss_writev3()
1281 ret = snd_pcm_lib_writev(substream, (void __user **)bufs, frames); in snd_pcm_oss_writev3()
1294 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufra… in snd_pcm_oss_readv3() argument
1296 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3()
1302 pcm_dbg(substream->pcm, in snd_pcm_oss_readv3()
1307 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_readv3()
1311 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_readv3()
1318 ret = snd_pcm_lib_readv(substream, (void __user **)bufs, frames); in snd_pcm_oss_readv3()
1321 ret = snd_pcm_lib_readv(substream, (void __user **)bufs, frames); in snd_pcm_oss_readv3()
1329 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t byte… in snd_pcm_oss_write2() argument
1331 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2()
1343 frames1 = snd_pcm_plug_client_channels_buf(substream, (char *)buf, frames, &channels); in snd_pcm_oss_write2()
1346 frames1 = snd_pcm_plug_write_transfer(substream, channels, frames1); in snd_pcm_oss_write2()
1354 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); in snd_pcm_oss_write2()
1362 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size… in snd_pcm_oss_write1() argument
1366 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1()
1368 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_write1()
1371 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_write1()
1389 if (substream->oss.setup.partialfrag || in snd_pcm_oss_write1()
1391 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1401 else if ((substream->f_flags & O_NONBLOCK) != 0) { in snd_pcm_oss_write1()
1407 tmp = snd_pcm_oss_write2(substream, in snd_pcm_oss_write1()
1416 if ((substream->f_flags & O_NONBLOCK) != 0 && in snd_pcm_oss_write1()
1429 static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int … in snd_pcm_oss_read2() argument
1431 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2()
1441 frames1 = snd_pcm_plug_client_channels_buf(substream, buf, frames, &channels); in snd_pcm_oss_read2()
1444 frames1 = snd_pcm_plug_read_transfer(substream, channels, frames1); in snd_pcm_oss_read2()
1454 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); in snd_pcm_oss_read2()
1462 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t byte… in snd_pcm_oss_read1() argument
1466 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1()
1468 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_read1()
1471 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_read1()
1477 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1496 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, in snd_pcm_oss_read1()
1516 struct snd_pcm_substream *substream; in snd_pcm_oss_reset() local
1521 substream = pcm_oss_file->streams[i]; in snd_pcm_oss_reset()
1522 if (!substream) in snd_pcm_oss_reset()
1524 runtime = substream->runtime; in snd_pcm_oss_reset()
1525 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_reset()
1536 struct snd_pcm_substream *substream; in snd_pcm_oss_post() local
1539 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_post()
1540 if (substream != NULL) { in snd_pcm_oss_post()
1541 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_post()
1543 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); in snd_pcm_oss_post()
1550 static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) in snd_pcm_oss_sync1() argument
1558 runtime = substream->runtime; in snd_pcm_oss_sync1()
1562 pcm_dbg(substream->pcm, "sync1: size = %li\n", size); in snd_pcm_oss_sync1()
1565 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1575 snd_pcm_stream_lock_irq(substream); in snd_pcm_oss_sync1()
1577 snd_pcm_stream_unlock_irq(substream); in snd_pcm_oss_sync1()
1588 pcm_err(substream->pcm, in snd_pcm_oss_sync1()
1602 struct snd_pcm_substream *substream; in snd_pcm_oss_sync() local
1608 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_sync()
1609 if (substream != NULL) { in snd_pcm_oss_sync()
1610 runtime = substream->runtime; in snd_pcm_oss_sync()
1611 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_sync()
1613 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_sync()
1620 pcm_dbg(substream->pcm, "sync: buffer_used\n"); in snd_pcm_oss_sync()
1626 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1633 pcm_dbg(substream->pcm, "sync: period_ptr\n"); in snd_pcm_oss_sync()
1639 err = snd_pcm_oss_sync1(substream, size); in snd_pcm_oss_sync()
1665 snd_pcm_lib_write(substream, (void __force __user *)runtime->oss.buffer, size1); in snd_pcm_oss_sync()
1671 snd_pcm_lib_writev(substream, buffers, size); in snd_pcm_oss_sync()
1679 saved_f_flags = substream->f_flags; in snd_pcm_oss_sync()
1680 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_sync()
1681 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_sync()
1682 substream->f_flags = saved_f_flags; in snd_pcm_oss_sync()
1688 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_sync()
1689 if (substream != NULL) { in snd_pcm_oss_sync()
1690 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_sync()
1692 runtime = substream->runtime; in snd_pcm_oss_sync()
1693 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_sync()
1707 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_rate() local
1709 if (substream == NULL) in snd_pcm_oss_set_rate()
1711 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1726 struct snd_pcm_substream *substream; in snd_pcm_oss_get_rate() local
1729 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_rate()
1731 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1742 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_channels() local
1744 if (substream == NULL) in snd_pcm_oss_set_channels()
1746 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1757 struct snd_pcm_substream *substream; in snd_pcm_oss_get_channels() local
1760 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_channels()
1762 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1767 struct snd_pcm_substream *substream; in snd_pcm_oss_get_block_size() local
1770 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_block_size()
1772 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1777 struct snd_pcm_substream *substream; in snd_pcm_oss_get_formats() local
1785 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_formats()
1787 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_get_formats()
1790 direct = substream->oss.setup.direct; in snd_pcm_oss_get_formats()
1803 err = snd_pcm_hw_refine(substream, params); in snd_pcm_oss_get_formats()
1829 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_format() local
1831 if (substream == NULL) in snd_pcm_oss_set_format()
1833 runtime = substream->runtime; in snd_pcm_oss_set_format()
1845 struct snd_pcm_substream *substream; in snd_pcm_oss_get_format() local
1848 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_format()
1850 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1853 static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide) in snd_pcm_oss_set_subdivide1() argument
1857 if (substream == NULL) in snd_pcm_oss_set_subdivide1()
1859 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1881 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_subdivide() local
1882 if (substream == NULL) in snd_pcm_oss_set_subdivide()
1884 if ((err = snd_pcm_oss_set_subdivide1(substream, subdivide)) < 0) in snd_pcm_oss_set_subdivide()
1890 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) in snd_pcm_oss_set_fragment1() argument
1894 if (substream == NULL) in snd_pcm_oss_set_fragment1()
1896 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1914 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_fragment() local
1915 if (substream == NULL) in snd_pcm_oss_set_fragment()
1917 if ((err = snd_pcm_oss_set_fragment1(substream, val)) < 0) in snd_pcm_oss_set_fragment()
1931 static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) in snd_pcm_oss_get_caps1() argument
1934 if (substream == NULL) { in snd_pcm_oss_get_caps1()
1939 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_caps1()
1940 if (substream->pstr->substream_count > 1) in snd_pcm_oss_get_caps1()
1947 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1()
1961 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_caps() local
1962 result = snd_pcm_oss_get_caps1(substream, result); in snd_pcm_oss_get_caps()
1968 static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, in snd_pcm_oss_simulate_fill() argument
1971 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill()
1985 pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); in snd_pcm_oss_set_trigger()
2063 struct snd_pcm_substream *substream; in snd_pcm_oss_get_odelay() local
2068 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_get_odelay()
2069 if (substream == NULL) in snd_pcm_oss_get_odelay()
2071 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_get_odelay()
2073 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2076 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_odelay()
2081 return snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_odelay()
2086 struct snd_pcm_substream *substream; in snd_pcm_oss_get_ptr() local
2095 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_ptr()
2096 if (substream == NULL) in snd_pcm_oss_get_ptr()
2098 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_get_ptr()
2100 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2108 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_ptr()
2117 err = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_get_ptr()
2122 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2123 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_get_ptr()
2131 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_ptr()
2132 snd_pcm_oss_simulate_fill(substream, delay); in snd_pcm_oss_get_ptr()
2133 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2135 delay = snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_ptr()
2137 if (substream->oss.setup.buggyptr) in snd_pcm_oss_get_ptr()
2155 struct snd_pcm_substream *substream; in snd_pcm_oss_get_space() local
2164 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_space()
2165 if (substream == NULL) in snd_pcm_oss_get_space()
2167 runtime = substream->runtime; in snd_pcm_oss_get_space()
2170 (err = snd_pcm_oss_change_params(substream, false)) < 0) in snd_pcm_oss_get_space()
2185 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); in snd_pcm_oss_get_space()
2195 err = snd_pcm_oss_capture_position_fixup(substream, &avail); in snd_pcm_oss_get_space()
2200 info.bytes = snd_pcm_oss_bytes(substream, avail) + fixup; in snd_pcm_oss_get_space()
2205 pcm_dbg(substream->pcm, in snd_pcm_oss_get_space()
2251 static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) in snd_pcm_oss_release_substream() argument
2254 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2258 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_release_substream()
2260 substream->oss.oss = 0; in snd_pcm_oss_release_substream()
2263 static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, in snd_pcm_oss_init_substream() argument
2269 substream->oss.oss = 1; in snd_pcm_oss_init_substream()
2270 substream->oss.setup = *setup; in snd_pcm_oss_init_substream()
2272 substream->f_flags |= O_NONBLOCK; in snd_pcm_oss_init_substream()
2274 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_init_substream()
2275 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2294 substream->pcm_release = snd_pcm_oss_release_substream; in snd_pcm_oss_init_substream()
2303 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx]; in snd_pcm_oss_release_file() local
2304 if (substream) in snd_pcm_oss_release_file()
2305 snd_pcm_release_substream(substream); in snd_pcm_oss_release_file()
2319 struct snd_pcm_substream *substream; in snd_pcm_oss_open_file() local
2346 err = snd_pcm_open_substream(pcm, idx, file, &substream); in snd_pcm_oss_open_file()
2352 pcm_oss_file->streams[idx] = substream; in snd_pcm_oss_open_file()
2353 substream->file = pcm_oss_file; in snd_pcm_oss_open_file()
2354 snd_pcm_oss_init_substream(substream, &setup[idx], minor); in snd_pcm_oss_open_file()
2472 struct snd_pcm_substream *substream; in snd_pcm_oss_release() local
2476 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_release()
2477 if (substream == NULL) in snd_pcm_oss_release()
2478 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_release()
2479 if (snd_BUG_ON(!substream)) in snd_pcm_oss_release()
2481 pcm = substream->pcm; in snd_pcm_oss_release()
2506 struct snd_pcm_substream *substream; in snd_pcm_oss_ioctl() local
2509 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_ioctl()
2510 if (substream != NULL) in snd_pcm_oss_ioctl()
2515 return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg); in snd_pcm_oss_ioctl()
2663 struct snd_pcm_substream *substream; in snd_pcm_oss_read() local
2666 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_read()
2667 if (substream == NULL) in snd_pcm_oss_read()
2669 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_read()
2671 return snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2674 ssize_t res = snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2675 pcm_dbg(substream->pcm, in snd_pcm_oss_read()
2686 struct snd_pcm_substream *substream; in snd_pcm_oss_write() local
2690 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_write()
2691 if (substream == NULL) in snd_pcm_oss_write()
2693 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_write()
2694 result = snd_pcm_oss_write1(substream, buf, count); in snd_pcm_oss_write()
2696 pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n", in snd_pcm_oss_write()
2702 static int snd_pcm_oss_playback_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_playback_ready() argument
2704 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready()
2705 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_playback_ready()
2713 static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_capture_ready() argument
2715 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready()
2716 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_capture_ready()
2770 struct snd_pcm_substream *substream = NULL; in snd_pcm_oss_mmap() local
2780 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2781 if (substream) in snd_pcm_oss_mmap()
2785 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_mmap()
2788 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2796 if (substream == NULL) in snd_pcm_oss_mmap()
2798 runtime = substream->runtime; in snd_pcm_oss_mmap()
2811 err = snd_pcm_oss_change_params(substream, true); in snd_pcm_oss_mmap()
2823 err = snd_pcm_mmap_data(substream, file, area); in snd_pcm_oss_mmap()