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
839 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params()
862 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params()
865 direct = substream->oss.setup.direct; in snd_pcm_oss_change_params()
871 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params()
878 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); in snd_pcm_oss_change_params()
884 choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params()
885 …snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL… in snd_pcm_oss_change_params()
938 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
941 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
942 if ((err = snd_pcm_plug_format_plugins(substream, in snd_pcm_oss_change_params()
946 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
951 if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) { in snd_pcm_oss_change_params()
953 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
956 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_oss_change_params()
962 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params()
969 err = snd_pcm_oss_period_size(substream, params, sparams); in snd_pcm_oss_change_params()
973 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params()
974 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL); in snd_pcm_oss_change_params()
978 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_oss_change_params()
983 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_change_params()
985 if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) { in snd_pcm_oss_change_params()
996 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params()
997 substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_oss_change_params()
1003 sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in snd_pcm_oss_change_params()
1005 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params()
1006 substream->oss.setup.nosilence) { in snd_pcm_oss_change_params()
1018 if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) { in snd_pcm_oss_change_params()
1024 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); in snd_pcm_oss_change_params()
1031 err = snd_pcm_plug_alloc(substream, oss_period_size); in snd_pcm_oss_change_params()
1071 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params()
1085 struct snd_pcm_substream *asubstream = NULL, *substream; in snd_pcm_oss_get_active_substream() local
1088 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_active_substream()
1089 if (substream == NULL) in snd_pcm_oss_get_active_substream()
1092 asubstream = substream; in snd_pcm_oss_get_active_substream()
1093 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1094 err = snd_pcm_oss_change_params(substream); in snd_pcm_oss_get_active_substream()
1106 static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) in snd_pcm_oss_prepare() argument
1109 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare()
1111 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); in snd_pcm_oss_prepare()
1124 static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready() argument
1129 if (substream == NULL) in snd_pcm_oss_make_ready()
1131 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1133 err = snd_pcm_oss_change_params(substream); in snd_pcm_oss_make_ready()
1138 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready()
1145 static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_… in snd_pcm_oss_capture_position_fixup() argument
1152 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, delay); in snd_pcm_oss_capture_position_fixup()
1155 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1163 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_FORWARD, &frames); in snd_pcm_oss_capture_position_fixup()
1170 snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_… in snd_pcm_oss_write3() argument
1172 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3()
1185 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_write3()
1192 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_write3()
1195 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_write3()
1207 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes… in snd_pcm_oss_read3() argument
1209 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3()
1223 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_read3()
1227 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_read3()
1231 ret = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_read3()
1237 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_read3()
1240 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_read3()
1244 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_read3()
1256 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufr… in snd_pcm_oss_writev3() argument
1258 struct snd_pcm_runtime *runtime = substream->runtime; 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()
1309 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_readv3()
1313 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_readv3()
1320 ret = snd_pcm_lib_readv(substream, (void __user **)bufs, frames); in snd_pcm_oss_readv3()
1323 ret = snd_pcm_lib_readv(substream, (void __user **)bufs, frames); in snd_pcm_oss_readv3()
1331 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t byte… in snd_pcm_oss_write2() argument
1333 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2()
1345 frames1 = snd_pcm_plug_client_channels_buf(substream, (char *)buf, frames, &channels); in snd_pcm_oss_write2()
1348 frames1 = snd_pcm_plug_write_transfer(substream, channels, frames1); in snd_pcm_oss_write2()
1356 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); in snd_pcm_oss_write2()
1364 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size… in snd_pcm_oss_write1() argument
1368 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1()
1370 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_write1()
1373 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_write1()
1391 if (substream->oss.setup.partialfrag || in snd_pcm_oss_write1()
1393 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1403 else if ((substream->f_flags & O_NONBLOCK) != 0) { in snd_pcm_oss_write1()
1409 tmp = snd_pcm_oss_write2(substream, in snd_pcm_oss_write1()
1418 if ((substream->f_flags & O_NONBLOCK) != 0 && in snd_pcm_oss_write1()
1431 static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int … in snd_pcm_oss_read2() argument
1433 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2()
1443 frames1 = snd_pcm_plug_client_channels_buf(substream, buf, frames, &channels); in snd_pcm_oss_read2()
1446 frames1 = snd_pcm_plug_read_transfer(substream, channels, frames1); in snd_pcm_oss_read2()
1456 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); in snd_pcm_oss_read2()
1464 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t byte… in snd_pcm_oss_read1() argument
1468 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1()
1470 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_read1()
1473 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_read1()
1479 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1498 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, in snd_pcm_oss_read1()
1518 struct snd_pcm_substream *substream; in snd_pcm_oss_reset() local
1523 substream = pcm_oss_file->streams[i]; in snd_pcm_oss_reset()
1524 if (!substream) in snd_pcm_oss_reset()
1526 runtime = substream->runtime; in snd_pcm_oss_reset()
1527 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_reset()
1538 struct snd_pcm_substream *substream; in snd_pcm_oss_post() local
1541 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_post()
1542 if (substream != NULL) { in snd_pcm_oss_post()
1543 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_post()
1545 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); in snd_pcm_oss_post()
1552 static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) in snd_pcm_oss_sync1() argument
1560 runtime = substream->runtime; in snd_pcm_oss_sync1()
1567 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1577 snd_pcm_stream_lock_irq(substream); in snd_pcm_oss_sync1()
1579 snd_pcm_stream_unlock_irq(substream); in snd_pcm_oss_sync1()
1603 struct snd_pcm_substream *substream; in snd_pcm_oss_sync() local
1609 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_sync()
1610 if (substream != NULL) { in snd_pcm_oss_sync()
1611 runtime = substream->runtime; in snd_pcm_oss_sync()
1612 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_sync()
1614 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_sync()
1627 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1640 err = snd_pcm_oss_sync1(substream, size); in snd_pcm_oss_sync()
1666 snd_pcm_lib_write(substream, (void __force __user *)runtime->oss.buffer, size1); in snd_pcm_oss_sync()
1672 snd_pcm_lib_writev(substream, buffers, size); in snd_pcm_oss_sync()
1680 saved_f_flags = substream->f_flags; in snd_pcm_oss_sync()
1681 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_sync()
1682 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_sync()
1683 substream->f_flags = saved_f_flags; in snd_pcm_oss_sync()
1689 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_sync()
1690 if (substream != NULL) { in snd_pcm_oss_sync()
1691 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_sync()
1693 runtime = substream->runtime; in snd_pcm_oss_sync()
1694 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_sync()
1708 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_rate() local
1710 if (substream == NULL) in snd_pcm_oss_set_rate()
1712 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1727 struct snd_pcm_substream *substream; in snd_pcm_oss_get_rate() local
1730 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_rate()
1732 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1743 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_channels() local
1745 if (substream == NULL) in snd_pcm_oss_set_channels()
1747 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1758 struct snd_pcm_substream *substream; in snd_pcm_oss_get_channels() local
1761 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_channels()
1763 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1768 struct snd_pcm_substream *substream; in snd_pcm_oss_get_block_size() local
1771 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_block_size()
1773 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1778 struct snd_pcm_substream *substream; in snd_pcm_oss_get_formats() local
1786 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_formats()
1788 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_get_formats()
1791 direct = substream->oss.setup.direct; in snd_pcm_oss_get_formats()
1804 err = snd_pcm_hw_refine(substream, params); in snd_pcm_oss_get_formats()
1830 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_format() local
1832 if (substream == NULL) in snd_pcm_oss_set_format()
1834 runtime = substream->runtime; in snd_pcm_oss_set_format()
1846 struct snd_pcm_substream *substream; in snd_pcm_oss_get_format() local
1849 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_format()
1851 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1854 static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide) in snd_pcm_oss_set_subdivide1() argument
1858 if (substream == NULL) in snd_pcm_oss_set_subdivide1()
1860 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1882 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_subdivide() local
1883 if (substream == NULL) in snd_pcm_oss_set_subdivide()
1885 if ((err = snd_pcm_oss_set_subdivide1(substream, subdivide)) < 0) in snd_pcm_oss_set_subdivide()
1891 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) in snd_pcm_oss_set_fragment1() argument
1895 if (substream == NULL) in snd_pcm_oss_set_fragment1()
1897 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1915 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_fragment() local
1916 if (substream == NULL) in snd_pcm_oss_set_fragment()
1918 if ((err = snd_pcm_oss_set_fragment1(substream, val)) < 0) in snd_pcm_oss_set_fragment()
1932 static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) in snd_pcm_oss_get_caps1() argument
1935 if (substream == NULL) { in snd_pcm_oss_get_caps1()
1940 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_caps1()
1941 if (substream->pstr->substream_count > 1) in snd_pcm_oss_get_caps1()
1948 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1()
1962 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_caps() local
1963 result = snd_pcm_oss_get_caps1(substream, result); in snd_pcm_oss_get_caps()
1969 static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, in snd_pcm_oss_simulate_fill() argument
1972 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill()
2064 struct snd_pcm_substream *substream; in snd_pcm_oss_get_odelay() local
2069 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_get_odelay()
2070 if (substream == NULL) in snd_pcm_oss_get_odelay()
2072 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_get_odelay()
2074 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2077 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_odelay()
2082 return snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_odelay()
2087 struct snd_pcm_substream *substream; in snd_pcm_oss_get_ptr() local
2096 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_ptr()
2097 if (substream == NULL) in snd_pcm_oss_get_ptr()
2099 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_get_ptr()
2101 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2109 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_ptr()
2118 err = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_get_ptr()
2123 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2124 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_get_ptr()
2132 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_ptr()
2133 snd_pcm_oss_simulate_fill(substream, delay); in snd_pcm_oss_get_ptr()
2134 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2136 delay = snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_ptr()
2138 if (substream->oss.setup.buggyptr) in snd_pcm_oss_get_ptr()
2156 struct snd_pcm_substream *substream; in snd_pcm_oss_get_space() local
2165 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_space()
2166 if (substream == NULL) in snd_pcm_oss_get_space()
2168 runtime = substream->runtime; in snd_pcm_oss_get_space()
2171 (err = snd_pcm_oss_change_params(substream)) < 0) in snd_pcm_oss_get_space()
2186 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); in snd_pcm_oss_get_space()
2196 err = snd_pcm_oss_capture_position_fixup(substream, &avail); in snd_pcm_oss_get_space()
2201 info.bytes = snd_pcm_oss_bytes(substream, avail) + fixup; in snd_pcm_oss_get_space()
2252 static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) in snd_pcm_oss_release_substream() argument
2255 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2259 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_release_substream()
2261 substream->oss.oss = 0; in snd_pcm_oss_release_substream()
2264 static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, in snd_pcm_oss_init_substream() argument
2270 substream->oss.oss = 1; in snd_pcm_oss_init_substream()
2271 substream->oss.setup = *setup; in snd_pcm_oss_init_substream()
2273 substream->f_flags |= O_NONBLOCK; in snd_pcm_oss_init_substream()
2275 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_init_substream()
2276 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2295 substream->pcm_release = snd_pcm_oss_release_substream; in snd_pcm_oss_init_substream()
2304 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx]; in snd_pcm_oss_release_file() local
2305 if (substream) in snd_pcm_oss_release_file()
2306 snd_pcm_release_substream(substream); in snd_pcm_oss_release_file()
2320 struct snd_pcm_substream *substream; in snd_pcm_oss_open_file() local
2347 err = snd_pcm_open_substream(pcm, idx, file, &substream); in snd_pcm_oss_open_file()
2353 pcm_oss_file->streams[idx] = substream; in snd_pcm_oss_open_file()
2354 substream->file = pcm_oss_file; in snd_pcm_oss_open_file()
2355 snd_pcm_oss_init_substream(substream, &setup[idx], minor); in snd_pcm_oss_open_file()
2473 struct snd_pcm_substream *substream; in snd_pcm_oss_release() local
2477 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_release()
2478 if (substream == NULL) in snd_pcm_oss_release()
2479 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_release()
2480 if (snd_BUG_ON(!substream)) in snd_pcm_oss_release()
2482 pcm = substream->pcm; in snd_pcm_oss_release()
2507 struct snd_pcm_substream *substream; in snd_pcm_oss_ioctl() local
2510 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_ioctl()
2511 if (substream != NULL) in snd_pcm_oss_ioctl()
2516 return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg); in snd_pcm_oss_ioctl()
2664 struct snd_pcm_substream *substream; in snd_pcm_oss_read() local
2667 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_read()
2668 if (substream == NULL) in snd_pcm_oss_read()
2670 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_read()
2672 return snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2675 ssize_t res = snd_pcm_oss_read1(substream, buf, count); 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()
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()
2807 if ((err = snd_pcm_oss_change_params(substream)) < 0) in snd_pcm_oss_mmap()
2818 err = snd_pcm_mmap_data(substream, file, area); in snd_pcm_oss_mmap()