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()
788 static int choose_rate(struct snd_pcm_substream *substream, in choose_rate() argument
808 ret = snd_pcm_hw_param_set(substream, params, in choose_rate()
825 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); in choose_rate()
845 static void snd_pcm_oss_release_buffers(struct snd_pcm_substream *substream) in snd_pcm_oss_release_buffers() argument
847 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_release_buffers()
852 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_release_buffers()
857 static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_change_params_locked() argument
859 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked()
881 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
884 direct = substream->oss.setup.direct; in snd_pcm_oss_change_params_locked()
890 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
897 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); in snd_pcm_oss_change_params_locked()
899 pcm_dbg(substream->pcm, "No usable accesses\n"); in snd_pcm_oss_change_params_locked()
904 err = choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
907 err = snd_pcm_hw_param_near(substream, sparams, in snd_pcm_oss_change_params_locked()
928 pcm_dbg(substream->pcm, "Cannot find a format!!!\n"); in snd_pcm_oss_change_params_locked()
960 err = snd_pcm_oss_period_size(substream, params, sparams); in snd_pcm_oss_change_params_locked()
964 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
965 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL); in snd_pcm_oss_change_params_locked()
969 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_oss_change_params_locked()
974 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_change_params_locked()
976 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams); in snd_pcm_oss_change_params_locked()
978 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
983 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
986 err = snd_pcm_plug_format_plugins(substream, params, sparams); in snd_pcm_oss_change_params_locked()
988 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
994 err = snd_pcm_plugin_build_io(substream, sparams, &plugin); in snd_pcm_oss_change_params_locked()
996 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
1000 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_oss_change_params_locked()
1016 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1017 substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_oss_change_params_locked()
1023 sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in snd_pcm_oss_change_params_locked()
1025 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1026 substream->oss.setup.nosilence) { in snd_pcm_oss_change_params_locked()
1038 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params); in snd_pcm_oss_change_params_locked()
1040 pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
1045 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); in snd_pcm_oss_change_params_locked()
1052 err = snd_pcm_plug_alloc(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1091 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1096 snd_pcm_oss_release_buffers(substream); in snd_pcm_oss_change_params_locked()
1104 static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, in snd_pcm_oss_change_params() argument
1107 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params()
1116 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_change_params()
1124 struct snd_pcm_substream *asubstream = NULL, *substream; in snd_pcm_oss_get_active_substream() local
1127 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_active_substream()
1128 if (substream == NULL) in snd_pcm_oss_get_active_substream()
1131 asubstream = substream; in snd_pcm_oss_get_active_substream()
1132 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1133 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_active_substream()
1149 static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) in snd_pcm_oss_prepare() argument
1152 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare()
1154 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); in snd_pcm_oss_prepare()
1156 pcm_dbg(substream->pcm, in snd_pcm_oss_prepare()
1168 static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready() argument
1173 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1175 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_make_ready()
1182 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready()
1191 static int snd_pcm_oss_make_ready_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready_locked() argument
1196 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1198 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_make_ready_locked()
1203 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready_locked()
1210 static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_… in snd_pcm_oss_capture_position_fixup() argument
1217 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, delay); in snd_pcm_oss_capture_position_fixup()
1220 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1228 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_FORWARD, &frames); in snd_pcm_oss_capture_position_fixup()
1235 snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_… in snd_pcm_oss_write3() argument
1237 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3()
1243 pcm_dbg(substream->pcm, in snd_pcm_oss_write3()
1248 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_write3()
1253 ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, in snd_pcm_oss_write3()
1266 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes… in snd_pcm_oss_read3() argument
1268 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3()
1275 pcm_dbg(substream->pcm, in snd_pcm_oss_read3()
1280 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_read3()
1284 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_read3()
1288 ret = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_read3()
1292 ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, in snd_pcm_oss_read3()
1297 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_read3()
1310 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufr… in snd_pcm_oss_writev3() argument
1312 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3()
1318 pcm_dbg(substream->pcm, in snd_pcm_oss_writev3()
1323 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_writev3()
1327 ret = snd_pcm_kernel_writev(substream, bufs, frames); in snd_pcm_oss_writev3()
1339 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufra… in snd_pcm_oss_readv3() argument
1341 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3()
1347 pcm_dbg(substream->pcm, in snd_pcm_oss_readv3()
1352 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_readv3()
1356 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_readv3()
1360 ret = snd_pcm_kernel_readv(substream, bufs, frames); in snd_pcm_oss_readv3()
1368 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t byte… in snd_pcm_oss_write2() argument
1370 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2()
1382 frames1 = snd_pcm_plug_client_channels_buf(substream, (char *)buf, frames, &channels); in snd_pcm_oss_write2()
1385 frames1 = snd_pcm_plug_write_transfer(substream, channels, frames1); in snd_pcm_oss_write2()
1393 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); in snd_pcm_oss_write2()
1401 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size… in snd_pcm_oss_write1() argument
1405 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1()
1407 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_write1()
1416 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_write1()
1433 if (substream->oss.setup.partialfrag || in snd_pcm_oss_write1()
1435 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1445 else if ((substream->f_flags & O_NONBLOCK) != 0) { in snd_pcm_oss_write1()
1451 tmp = snd_pcm_oss_write2(substream, in snd_pcm_oss_write1()
1460 if ((substream->f_flags & O_NONBLOCK) != 0 && in snd_pcm_oss_write1()
1478 static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int … in snd_pcm_oss_read2() argument
1480 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2()
1490 frames1 = snd_pcm_plug_client_channels_buf(substream, buf, frames, &channels); in snd_pcm_oss_read2()
1493 frames1 = snd_pcm_plug_read_transfer(substream, channels, frames1); in snd_pcm_oss_read2()
1503 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); in snd_pcm_oss_read2()
1511 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t byte… in snd_pcm_oss_read1() argument
1515 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1()
1517 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_read1()
1526 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_read1()
1531 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1550 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, in snd_pcm_oss_read1()
1575 struct snd_pcm_substream *substream; in snd_pcm_oss_reset() local
1580 substream = pcm_oss_file->streams[i]; in snd_pcm_oss_reset()
1581 if (!substream) in snd_pcm_oss_reset()
1583 runtime = substream->runtime; in snd_pcm_oss_reset()
1584 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_reset()
1597 struct snd_pcm_substream *substream; in snd_pcm_oss_post() local
1600 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_post()
1601 if (substream != NULL) { in snd_pcm_oss_post()
1602 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_post()
1605 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); in snd_pcm_oss_post()
1612 static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) in snd_pcm_oss_sync1() argument
1620 runtime = substream->runtime; in snd_pcm_oss_sync1()
1624 pcm_dbg(substream->pcm, "sync1: size = %li\n", size); in snd_pcm_oss_sync1()
1627 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1637 snd_pcm_stream_lock_irq(substream); in snd_pcm_oss_sync1()
1639 snd_pcm_stream_unlock_irq(substream); in snd_pcm_oss_sync1()
1650 pcm_err(substream->pcm, in snd_pcm_oss_sync1()
1664 struct snd_pcm_substream *substream; in snd_pcm_oss_sync() local
1670 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_sync()
1671 if (substream != NULL) { in snd_pcm_oss_sync()
1672 runtime = substream->runtime; in snd_pcm_oss_sync()
1673 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_sync()
1680 err = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_sync()
1687 pcm_dbg(substream->pcm, "sync: buffer_used\n"); in snd_pcm_oss_sync()
1693 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1698 pcm_dbg(substream->pcm, "sync: period_ptr\n"); in snd_pcm_oss_sync()
1704 err = snd_pcm_oss_sync1(substream, size); in snd_pcm_oss_sync()
1716 snd_pcm_lib_write(substream, NULL, size); in snd_pcm_oss_sync()
1718 snd_pcm_lib_writev(substream, NULL, size); in snd_pcm_oss_sync()
1729 saved_f_flags = substream->f_flags; in snd_pcm_oss_sync()
1730 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_sync()
1731 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_sync()
1732 substream->f_flags = saved_f_flags; in snd_pcm_oss_sync()
1740 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_sync()
1741 if (substream != NULL) { in snd_pcm_oss_sync()
1742 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_sync()
1745 runtime = substream->runtime; in snd_pcm_oss_sync()
1746 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_sync()
1762 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_rate() local
1766 if (substream == NULL) in snd_pcm_oss_set_rate()
1768 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1787 struct snd_pcm_substream *substream; in snd_pcm_oss_get_rate() local
1790 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_rate()
1793 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1804 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_channels() local
1808 if (substream == NULL) in snd_pcm_oss_set_channels()
1810 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1825 struct snd_pcm_substream *substream; in snd_pcm_oss_get_channels() local
1828 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_channels()
1831 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1836 struct snd_pcm_substream *substream; in snd_pcm_oss_get_block_size() local
1839 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_block_size()
1842 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1847 struct snd_pcm_substream *substream; in snd_pcm_oss_get_formats() local
1855 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_formats()
1858 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_get_formats()
1861 direct = substream->oss.setup.direct; in snd_pcm_oss_get_formats()
1874 err = snd_pcm_hw_refine(substream, params); in snd_pcm_oss_get_formats()
1903 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_format() local
1905 if (substream == NULL) in snd_pcm_oss_set_format()
1907 runtime = substream->runtime; in snd_pcm_oss_set_format()
1923 struct snd_pcm_substream *substream; in snd_pcm_oss_get_format() local
1926 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_format()
1929 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1932 static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide) in snd_pcm_oss_set_subdivide1() argument
1936 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1958 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_subdivide() local
1961 if (substream == NULL) in snd_pcm_oss_set_subdivide()
1963 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1967 err = snd_pcm_oss_set_subdivide1(substream, subdivide); in snd_pcm_oss_set_subdivide()
1975 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) in snd_pcm_oss_set_fragment1() argument
1980 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
2001 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_fragment() local
2004 if (substream == NULL) in snd_pcm_oss_set_fragment()
2006 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
2010 err = snd_pcm_oss_set_fragment1(substream, val); in snd_pcm_oss_set_fragment()
2026 static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) in snd_pcm_oss_get_caps1() argument
2029 if (substream == NULL) { in snd_pcm_oss_get_caps1()
2034 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_caps1()
2035 if (substream->pstr->substream_count > 1) in snd_pcm_oss_get_caps1()
2042 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1()
2056 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_caps() local
2057 result = snd_pcm_oss_get_caps1(substream, result); in snd_pcm_oss_get_caps()
2063 static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, in snd_pcm_oss_simulate_fill() argument
2066 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill()
2172 struct snd_pcm_substream *substream; in snd_pcm_oss_get_odelay() local
2177 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_get_odelay()
2178 if (substream == NULL) in snd_pcm_oss_get_odelay()
2180 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_get_odelay()
2183 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2186 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_odelay()
2191 return snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_odelay()
2196 struct snd_pcm_substream *substream; in snd_pcm_oss_get_ptr() local
2205 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_ptr()
2206 if (substream == NULL) in snd_pcm_oss_get_ptr()
2208 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_get_ptr()
2211 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2219 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_ptr()
2228 err = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_get_ptr()
2233 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2234 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_get_ptr()
2242 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_ptr()
2243 snd_pcm_oss_simulate_fill(substream, delay); in snd_pcm_oss_get_ptr()
2244 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2246 delay = snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_ptr()
2248 if (substream->oss.setup.buggyptr) in snd_pcm_oss_get_ptr()
2266 struct snd_pcm_substream *substream; in snd_pcm_oss_get_space() local
2275 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_space()
2276 if (substream == NULL) in snd_pcm_oss_get_space()
2278 runtime = substream->runtime; in snd_pcm_oss_get_space()
2281 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_space()
2298 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); in snd_pcm_oss_get_space()
2308 err = snd_pcm_oss_capture_position_fixup(substream, &avail); in snd_pcm_oss_get_space()
2313 info.bytes = snd_pcm_oss_bytes(substream, avail) + fixup; in snd_pcm_oss_get_space()
2318 pcm_dbg(substream->pcm, in snd_pcm_oss_get_space()
2364 static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) in snd_pcm_oss_release_substream() argument
2366 snd_pcm_oss_release_buffers(substream); in snd_pcm_oss_release_substream()
2367 substream->oss.oss = 0; in snd_pcm_oss_release_substream()
2370 static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, in snd_pcm_oss_init_substream() argument
2376 substream->oss.oss = 1; in snd_pcm_oss_init_substream()
2377 substream->oss.setup = *setup; in snd_pcm_oss_init_substream()
2379 substream->f_flags |= O_NONBLOCK; in snd_pcm_oss_init_substream()
2381 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_init_substream()
2382 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2401 substream->pcm_release = snd_pcm_oss_release_substream; in snd_pcm_oss_init_substream()
2411 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx]; in snd_pcm_oss_release_file() local
2412 if (substream) in snd_pcm_oss_release_file()
2413 snd_pcm_release_substream(substream); in snd_pcm_oss_release_file()
2427 struct snd_pcm_substream *substream; in snd_pcm_oss_open_file() local
2454 err = snd_pcm_open_substream(pcm, idx, file, &substream); in snd_pcm_oss_open_file()
2460 pcm_oss_file->streams[idx] = substream; in snd_pcm_oss_open_file()
2461 snd_pcm_oss_init_substream(substream, &setup[idx], minor); in snd_pcm_oss_open_file()
2579 struct snd_pcm_substream *substream; in snd_pcm_oss_release() local
2583 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_release()
2584 if (substream == NULL) in snd_pcm_oss_release()
2585 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_release()
2586 if (snd_BUG_ON(!substream)) in snd_pcm_oss_release()
2588 pcm = substream->pcm; in snd_pcm_oss_release()
2613 struct snd_pcm_substream *substream; in snd_pcm_oss_ioctl() local
2616 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_ioctl()
2617 if (substream != NULL) in snd_pcm_oss_ioctl()
2622 return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg); in snd_pcm_oss_ioctl()
2780 struct snd_pcm_substream *substream; in snd_pcm_oss_read() local
2783 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_read()
2784 if (substream == NULL) in snd_pcm_oss_read()
2786 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_read()
2788 return snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2791 ssize_t res = snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2792 pcm_dbg(substream->pcm, in snd_pcm_oss_read()
2803 struct snd_pcm_substream *substream; in snd_pcm_oss_write() local
2807 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_write()
2808 if (substream == NULL) in snd_pcm_oss_write()
2810 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_write()
2811 result = snd_pcm_oss_write1(substream, buf, count); in snd_pcm_oss_write()
2813 pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n", in snd_pcm_oss_write()
2819 static int snd_pcm_oss_playback_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_playback_ready() argument
2821 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready()
2822 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_playback_ready()
2830 static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_capture_ready() argument
2832 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready()
2833 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_capture_ready()
2888 struct snd_pcm_substream *substream = NULL; in snd_pcm_oss_mmap() local
2898 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2899 if (substream) in snd_pcm_oss_mmap()
2903 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_mmap()
2906 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2914 if (substream == NULL) in snd_pcm_oss_mmap()
2916 runtime = substream->runtime; in snd_pcm_oss_mmap()
2929 err = snd_pcm_oss_change_params(substream, true); in snd_pcm_oss_mmap()
2941 err = snd_pcm_mmap_data(substream, file, area); in snd_pcm_oss_mmap()