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
688 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_period_size()
694 oss_buffer_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
699 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_period_size()
704 if (substream->oss.setup.period_size > 16) in snd_pcm_oss_period_size()
705 oss_period_size = substream->oss.setup.period_size; in snd_pcm_oss_period_size()
731 min_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
740 max_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
751 if (substream->oss.setup.periods > 1) in snd_pcm_oss_period_size()
752 oss_periods = substream->oss.setup.periods; in snd_pcm_oss_period_size()
777 static int choose_rate(struct snd_pcm_substream *substream, in choose_rate() argument
797 ret = snd_pcm_hw_param_set(substream, params, in choose_rate()
814 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); in choose_rate()
835 static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_change_params_locked() argument
837 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked()
859 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
862 direct = substream->oss.setup.direct; in snd_pcm_oss_change_params_locked()
868 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
875 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); in snd_pcm_oss_change_params_locked()
877 pcm_dbg(substream->pcm, "No usable accesses\n"); in snd_pcm_oss_change_params_locked()
881 choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
882 …snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL… in snd_pcm_oss_change_params_locked()
899 pcm_dbg(substream->pcm, "Cannot find a format!!!\n"); in snd_pcm_oss_change_params_locked()
931 err = snd_pcm_oss_period_size(substream, params, sparams); in snd_pcm_oss_change_params_locked()
935 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
936 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL); in snd_pcm_oss_change_params_locked()
940 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_oss_change_params_locked()
945 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_change_params_locked()
947 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams); in snd_pcm_oss_change_params_locked()
949 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
954 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
957 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
958 err = snd_pcm_plug_format_plugins(substream, params, sparams); in snd_pcm_oss_change_params_locked()
960 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
962 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
967 err = snd_pcm_plugin_build_io(substream, sparams, &plugin); in snd_pcm_oss_change_params_locked()
969 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
971 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
974 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_oss_change_params_locked()
980 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
992 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
993 substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_oss_change_params_locked()
999 sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in snd_pcm_oss_change_params_locked()
1001 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1002 substream->oss.setup.nosilence) { in snd_pcm_oss_change_params_locked()
1014 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params); in snd_pcm_oss_change_params_locked()
1016 pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
1021 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); in snd_pcm_oss_change_params_locked()
1028 err = snd_pcm_plug_alloc(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1068 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1079 static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, in snd_pcm_oss_change_params() argument
1082 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params()
1091 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_change_params()
1099 struct snd_pcm_substream *asubstream = NULL, *substream; in snd_pcm_oss_get_active_substream() local
1102 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_active_substream()
1103 if (substream == NULL) in snd_pcm_oss_get_active_substream()
1106 asubstream = substream; in snd_pcm_oss_get_active_substream()
1107 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1108 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_active_substream()
1124 static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) in snd_pcm_oss_prepare() argument
1127 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare()
1129 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); in snd_pcm_oss_prepare()
1131 pcm_dbg(substream->pcm, in snd_pcm_oss_prepare()
1143 static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready() argument
1148 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1150 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_make_ready()
1157 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready()
1166 static int snd_pcm_oss_make_ready_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready_locked() argument
1171 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1173 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_make_ready_locked()
1178 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready_locked()
1185 static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_… in snd_pcm_oss_capture_position_fixup() argument
1192 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, delay); in snd_pcm_oss_capture_position_fixup()
1195 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1203 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_FORWARD, &frames); in snd_pcm_oss_capture_position_fixup()
1210 snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_… in snd_pcm_oss_write3() argument
1212 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3()
1218 pcm_dbg(substream->pcm, in snd_pcm_oss_write3()
1223 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_write3()
1228 ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, in snd_pcm_oss_write3()
1241 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes… in snd_pcm_oss_read3() argument
1243 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3()
1250 pcm_dbg(substream->pcm, in snd_pcm_oss_read3()
1255 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_read3()
1259 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_read3()
1263 ret = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_read3()
1267 ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, in snd_pcm_oss_read3()
1272 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_read3()
1285 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufr… in snd_pcm_oss_writev3() argument
1287 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3()
1293 pcm_dbg(substream->pcm, in snd_pcm_oss_writev3()
1298 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_writev3()
1302 ret = snd_pcm_kernel_writev(substream, bufs, frames); in snd_pcm_oss_writev3()
1314 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufra… in snd_pcm_oss_readv3() argument
1316 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3()
1322 pcm_dbg(substream->pcm, in snd_pcm_oss_readv3()
1327 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_readv3()
1331 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_readv3()
1335 ret = snd_pcm_kernel_readv(substream, bufs, frames); in snd_pcm_oss_readv3()
1343 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t byte… in snd_pcm_oss_write2() argument
1345 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2()
1357 frames1 = snd_pcm_plug_client_channels_buf(substream, (char *)buf, frames, &channels); in snd_pcm_oss_write2()
1360 frames1 = snd_pcm_plug_write_transfer(substream, channels, frames1); in snd_pcm_oss_write2()
1368 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); in snd_pcm_oss_write2()
1376 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size… in snd_pcm_oss_write1() argument
1380 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1()
1382 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_write1()
1391 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_write1()
1408 if (substream->oss.setup.partialfrag || in snd_pcm_oss_write1()
1410 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1420 else if ((substream->f_flags & O_NONBLOCK) != 0) { in snd_pcm_oss_write1()
1426 tmp = snd_pcm_oss_write2(substream, in snd_pcm_oss_write1()
1435 if ((substream->f_flags & O_NONBLOCK) != 0 && in snd_pcm_oss_write1()
1453 static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int … in snd_pcm_oss_read2() argument
1455 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2()
1465 frames1 = snd_pcm_plug_client_channels_buf(substream, buf, frames, &channels); in snd_pcm_oss_read2()
1468 frames1 = snd_pcm_plug_read_transfer(substream, channels, frames1); in snd_pcm_oss_read2()
1478 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); in snd_pcm_oss_read2()
1486 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t byte… in snd_pcm_oss_read1() argument
1490 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1()
1492 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_read1()
1501 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_read1()
1506 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1525 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, in snd_pcm_oss_read1()
1550 struct snd_pcm_substream *substream; in snd_pcm_oss_reset() local
1555 substream = pcm_oss_file->streams[i]; in snd_pcm_oss_reset()
1556 if (!substream) in snd_pcm_oss_reset()
1558 runtime = substream->runtime; in snd_pcm_oss_reset()
1559 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_reset()
1572 struct snd_pcm_substream *substream; in snd_pcm_oss_post() local
1575 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_post()
1576 if (substream != NULL) { in snd_pcm_oss_post()
1577 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_post()
1580 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); in snd_pcm_oss_post()
1587 static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) in snd_pcm_oss_sync1() argument
1595 runtime = substream->runtime; in snd_pcm_oss_sync1()
1599 pcm_dbg(substream->pcm, "sync1: size = %li\n", size); in snd_pcm_oss_sync1()
1602 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1612 snd_pcm_stream_lock_irq(substream); in snd_pcm_oss_sync1()
1614 snd_pcm_stream_unlock_irq(substream); in snd_pcm_oss_sync1()
1625 pcm_err(substream->pcm, in snd_pcm_oss_sync1()
1639 struct snd_pcm_substream *substream; in snd_pcm_oss_sync() local
1645 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_sync()
1646 if (substream != NULL) { in snd_pcm_oss_sync()
1647 runtime = substream->runtime; in snd_pcm_oss_sync()
1648 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_sync()
1650 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_sync()
1662 pcm_dbg(substream->pcm, "sync: buffer_used\n"); in snd_pcm_oss_sync()
1668 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1673 pcm_dbg(substream->pcm, "sync: period_ptr\n"); in snd_pcm_oss_sync()
1679 err = snd_pcm_oss_sync1(substream, size); in snd_pcm_oss_sync()
1691 snd_pcm_lib_write(substream, NULL, size); in snd_pcm_oss_sync()
1693 snd_pcm_lib_writev(substream, NULL, size); in snd_pcm_oss_sync()
1704 saved_f_flags = substream->f_flags; in snd_pcm_oss_sync()
1705 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_sync()
1706 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_sync()
1707 substream->f_flags = saved_f_flags; in snd_pcm_oss_sync()
1715 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_sync()
1716 if (substream != NULL) { in snd_pcm_oss_sync()
1717 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_sync()
1720 runtime = substream->runtime; in snd_pcm_oss_sync()
1721 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_sync()
1737 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_rate() local
1741 if (substream == NULL) in snd_pcm_oss_set_rate()
1743 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1762 struct snd_pcm_substream *substream; in snd_pcm_oss_get_rate() local
1765 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_rate()
1768 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1779 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_channels() local
1783 if (substream == NULL) in snd_pcm_oss_set_channels()
1785 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1800 struct snd_pcm_substream *substream; in snd_pcm_oss_get_channels() local
1803 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_channels()
1806 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1811 struct snd_pcm_substream *substream; in snd_pcm_oss_get_block_size() local
1814 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_block_size()
1817 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1822 struct snd_pcm_substream *substream; in snd_pcm_oss_get_formats() local
1830 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_formats()
1833 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_get_formats()
1836 direct = substream->oss.setup.direct; in snd_pcm_oss_get_formats()
1849 err = snd_pcm_hw_refine(substream, params); in snd_pcm_oss_get_formats()
1878 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_format() local
1880 if (substream == NULL) in snd_pcm_oss_set_format()
1882 runtime = substream->runtime; in snd_pcm_oss_set_format()
1898 struct snd_pcm_substream *substream; in snd_pcm_oss_get_format() local
1901 err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); in snd_pcm_oss_get_format()
1904 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1907 static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide) in snd_pcm_oss_set_subdivide1() argument
1911 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1933 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_subdivide() local
1936 if (substream == NULL) in snd_pcm_oss_set_subdivide()
1938 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1942 err = snd_pcm_oss_set_subdivide1(substream, subdivide); in snd_pcm_oss_set_subdivide()
1950 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) in snd_pcm_oss_set_fragment1() argument
1955 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1976 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_fragment() local
1979 if (substream == NULL) in snd_pcm_oss_set_fragment()
1981 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1985 err = snd_pcm_oss_set_fragment1(substream, val); in snd_pcm_oss_set_fragment()
2001 static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) in snd_pcm_oss_get_caps1() argument
2004 if (substream == NULL) { in snd_pcm_oss_get_caps1()
2009 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_caps1()
2010 if (substream->pstr->substream_count > 1) in snd_pcm_oss_get_caps1()
2017 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1()
2031 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_caps() local
2032 result = snd_pcm_oss_get_caps1(substream, result); in snd_pcm_oss_get_caps()
2038 static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, in snd_pcm_oss_simulate_fill() argument
2041 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill()
2055 pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); in snd_pcm_oss_set_trigger()
2147 struct snd_pcm_substream *substream; in snd_pcm_oss_get_odelay() local
2152 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_get_odelay()
2153 if (substream == NULL) in snd_pcm_oss_get_odelay()
2155 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_get_odelay()
2158 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2161 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_odelay()
2166 return snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_odelay()
2171 struct snd_pcm_substream *substream; in snd_pcm_oss_get_ptr() local
2180 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_ptr()
2181 if (substream == NULL) in snd_pcm_oss_get_ptr()
2183 err = snd_pcm_oss_make_ready(substream); in snd_pcm_oss_get_ptr()
2186 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2194 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_ptr()
2203 err = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_get_ptr()
2208 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2209 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_get_ptr()
2217 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_ptr()
2218 snd_pcm_oss_simulate_fill(substream, delay); in snd_pcm_oss_get_ptr()
2219 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2221 delay = snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_ptr()
2223 if (substream->oss.setup.buggyptr) in snd_pcm_oss_get_ptr()
2241 struct snd_pcm_substream *substream; in snd_pcm_oss_get_space() local
2250 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_space()
2251 if (substream == NULL) in snd_pcm_oss_get_space()
2253 runtime = substream->runtime; in snd_pcm_oss_get_space()
2256 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_space()
2273 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); in snd_pcm_oss_get_space()
2283 err = snd_pcm_oss_capture_position_fixup(substream, &avail); in snd_pcm_oss_get_space()
2288 info.bytes = snd_pcm_oss_bytes(substream, avail) + fixup; in snd_pcm_oss_get_space()
2293 pcm_dbg(substream->pcm, in snd_pcm_oss_get_space()
2339 static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) in snd_pcm_oss_release_substream() argument
2342 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2346 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_release_substream()
2348 substream->oss.oss = 0; in snd_pcm_oss_release_substream()
2351 static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, in snd_pcm_oss_init_substream() argument
2357 substream->oss.oss = 1; in snd_pcm_oss_init_substream()
2358 substream->oss.setup = *setup; in snd_pcm_oss_init_substream()
2360 substream->f_flags |= O_NONBLOCK; in snd_pcm_oss_init_substream()
2362 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_init_substream()
2363 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2382 substream->pcm_release = snd_pcm_oss_release_substream; in snd_pcm_oss_init_substream()
2392 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx]; in snd_pcm_oss_release_file() local
2393 if (substream) in snd_pcm_oss_release_file()
2394 snd_pcm_release_substream(substream); in snd_pcm_oss_release_file()
2408 struct snd_pcm_substream *substream; in snd_pcm_oss_open_file() local
2435 err = snd_pcm_open_substream(pcm, idx, file, &substream); in snd_pcm_oss_open_file()
2441 pcm_oss_file->streams[idx] = substream; in snd_pcm_oss_open_file()
2442 snd_pcm_oss_init_substream(substream, &setup[idx], minor); in snd_pcm_oss_open_file()
2560 struct snd_pcm_substream *substream; in snd_pcm_oss_release() local
2564 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_release()
2565 if (substream == NULL) in snd_pcm_oss_release()
2566 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_release()
2567 if (snd_BUG_ON(!substream)) in snd_pcm_oss_release()
2569 pcm = substream->pcm; in snd_pcm_oss_release()
2594 struct snd_pcm_substream *substream; in snd_pcm_oss_ioctl() local
2597 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_ioctl()
2598 if (substream != NULL) in snd_pcm_oss_ioctl()
2603 return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg); in snd_pcm_oss_ioctl()
2761 struct snd_pcm_substream *substream; in snd_pcm_oss_read() local
2764 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_read()
2765 if (substream == NULL) in snd_pcm_oss_read()
2767 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_read()
2769 return snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2772 ssize_t res = snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2773 pcm_dbg(substream->pcm, in snd_pcm_oss_read()
2784 struct snd_pcm_substream *substream; in snd_pcm_oss_write() local
2788 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_write()
2789 if (substream == NULL) in snd_pcm_oss_write()
2791 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_write()
2792 result = snd_pcm_oss_write1(substream, buf, count); in snd_pcm_oss_write()
2794 pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n", in snd_pcm_oss_write()
2800 static int snd_pcm_oss_playback_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_playback_ready() argument
2802 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready()
2803 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_playback_ready()
2811 static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_capture_ready() argument
2813 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready()
2814 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_capture_ready()
2869 struct snd_pcm_substream *substream = NULL; in snd_pcm_oss_mmap() local
2879 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2880 if (substream) in snd_pcm_oss_mmap()
2884 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_mmap()
2887 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2895 if (substream == NULL) in snd_pcm_oss_mmap()
2897 runtime = substream->runtime; in snd_pcm_oss_mmap()
2910 err = snd_pcm_oss_change_params(substream, true); in snd_pcm_oss_mmap()
2922 err = snd_pcm_mmap_data(substream, file, area); in snd_pcm_oss_mmap()