• Home
  • Raw
  • Download

Lines Matching refs:substream

564 static int snd_pcm_oss_plugin_clear(struct snd_pcm_substream *substream)  in snd_pcm_oss_plugin_clear()  argument
566 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_plugin_clear()
610 static long snd_pcm_oss_bytes(struct snd_pcm_substream *substream, long frames) in snd_pcm_oss_bytes() argument
612 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_bytes()
613 long buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_pcm_oss_bytes()
627 static long snd_pcm_alsa_frames(struct snd_pcm_substream *substream, long bytes) in snd_pcm_alsa_frames() argument
629 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_alsa_frames()
630 long buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_pcm_alsa_frames()
706 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()
725 oss_buffer_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
730 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_period_size()
735 if (substream->oss.setup.period_size > 16) in snd_pcm_oss_period_size()
736 oss_period_size = substream->oss.setup.period_size; in snd_pcm_oss_period_size()
762 min_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
771 max_period_size = snd_pcm_plug_client_size(substream, in snd_pcm_oss_period_size()
782 if (substream->oss.setup.periods > 1) in snd_pcm_oss_period_size()
783 oss_periods = substream->oss.setup.periods; in snd_pcm_oss_period_size()
808 static int choose_rate(struct snd_pcm_substream *substream, in choose_rate() argument
828 ret = snd_pcm_hw_param_set(substream, params, in choose_rate()
845 return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); in choose_rate()
866 static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_change_params_locked() argument
868 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked()
890 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
893 direct = substream->oss.setup.direct; in snd_pcm_oss_change_params_locked()
899 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_change_params_locked()
906 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); in snd_pcm_oss_change_params_locked()
908 pcm_dbg(substream->pcm, "No usable accesses\n"); in snd_pcm_oss_change_params_locked()
913 err = choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
916 err = snd_pcm_hw_param_near(substream, sparams, in snd_pcm_oss_change_params_locked()
940 pcm_dbg(substream->pcm, "Cannot find a format!!!\n"); in snd_pcm_oss_change_params_locked()
972 err = snd_pcm_oss_period_size(substream, params, sparams); in snd_pcm_oss_change_params_locked()
976 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
977 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL); in snd_pcm_oss_change_params_locked()
981 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS, in snd_pcm_oss_change_params_locked()
986 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_change_params_locked()
988 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams); in snd_pcm_oss_change_params_locked()
990 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
995 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
998 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
999 if ((err = snd_pcm_plug_format_plugins(substream, in snd_pcm_oss_change_params_locked()
1002 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
1004 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
1009 if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) { in snd_pcm_oss_change_params_locked()
1010 pcm_dbg(substream->pcm, in snd_pcm_oss_change_params_locked()
1012 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
1015 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_oss_change_params_locked()
1021 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_change_params_locked()
1033 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1034 substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_oss_change_params_locked()
1040 sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in snd_pcm_oss_change_params_locked()
1042 if (atomic_read(&substream->mmap_count) || in snd_pcm_oss_change_params_locked()
1043 substream->oss.setup.nosilence) { in snd_pcm_oss_change_params_locked()
1055 if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) { in snd_pcm_oss_change_params_locked()
1056 pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err); in snd_pcm_oss_change_params_locked()
1061 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); in snd_pcm_oss_change_params_locked()
1068 err = snd_pcm_plug_alloc(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1108 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1119 static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, in snd_pcm_oss_change_params() argument
1122 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params()
1131 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_change_params()
1139 struct snd_pcm_substream *asubstream = NULL, *substream; in snd_pcm_oss_get_active_substream() local
1142 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_active_substream()
1143 if (substream == NULL) in snd_pcm_oss_get_active_substream()
1146 asubstream = substream; in snd_pcm_oss_get_active_substream()
1147 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1148 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_get_active_substream()
1164 static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) in snd_pcm_oss_prepare() argument
1167 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare()
1169 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); in snd_pcm_oss_prepare()
1171 pcm_dbg(substream->pcm, in snd_pcm_oss_prepare()
1183 static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready() argument
1188 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1190 err = snd_pcm_oss_change_params(substream, false); in snd_pcm_oss_make_ready()
1197 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready()
1206 static int snd_pcm_oss_make_ready_locked(struct snd_pcm_substream *substream) in snd_pcm_oss_make_ready_locked() argument
1211 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1213 err = snd_pcm_oss_change_params_locked(substream); in snd_pcm_oss_make_ready_locked()
1218 err = snd_pcm_oss_prepare(substream); in snd_pcm_oss_make_ready_locked()
1225 static int snd_pcm_oss_capture_position_fixup(struct snd_pcm_substream *substream, snd_pcm_sframes_… in snd_pcm_oss_capture_position_fixup() argument
1232 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, delay); in snd_pcm_oss_capture_position_fixup()
1235 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1243 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_FORWARD, &frames); in snd_pcm_oss_capture_position_fixup()
1250 snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_… in snd_pcm_oss_write3() argument
1252 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3()
1258 pcm_dbg(substream->pcm, in snd_pcm_oss_write3()
1263 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_write3()
1270 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_write3()
1273 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_write3()
1285 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *ptr, snd_pcm_uframes… in snd_pcm_oss_read3() argument
1287 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3()
1294 pcm_dbg(substream->pcm, in snd_pcm_oss_read3()
1299 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_read3()
1303 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_read3()
1307 ret = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_read3()
1313 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_read3()
1316 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames); in snd_pcm_oss_read3()
1320 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_read3()
1332 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufr… in snd_pcm_oss_writev3() argument
1334 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3()
1340 pcm_dbg(substream->pcm, in snd_pcm_oss_writev3()
1345 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_writev3()
1352 ret = snd_pcm_lib_writev(substream, (void __user **)bufs, frames); in snd_pcm_oss_writev3()
1355 ret = snd_pcm_lib_writev(substream, (void __user **)bufs, frames); in snd_pcm_oss_writev3()
1368 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_ufra… in snd_pcm_oss_readv3() argument
1370 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3()
1376 pcm_dbg(substream->pcm, in snd_pcm_oss_readv3()
1381 ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_readv3()
1385 ret = snd_pcm_oss_prepare(substream); in snd_pcm_oss_readv3()
1392 ret = snd_pcm_lib_readv(substream, (void __user **)bufs, frames); in snd_pcm_oss_readv3()
1395 ret = snd_pcm_lib_readv(substream, (void __user **)bufs, frames); in snd_pcm_oss_readv3()
1403 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t byte… in snd_pcm_oss_write2() argument
1405 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2()
1417 frames1 = snd_pcm_plug_client_channels_buf(substream, (char *)buf, frames, &channels); in snd_pcm_oss_write2()
1420 frames1 = snd_pcm_plug_write_transfer(substream, channels, frames1); in snd_pcm_oss_write2()
1428 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); in snd_pcm_oss_write2()
1436 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size… in snd_pcm_oss_write1() argument
1440 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1()
1442 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_write1()
1451 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_write1()
1468 if (substream->oss.setup.partialfrag || in snd_pcm_oss_write1()
1470 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1480 else if ((substream->f_flags & O_NONBLOCK) != 0) { in snd_pcm_oss_write1()
1486 tmp = snd_pcm_oss_write2(substream, in snd_pcm_oss_write1()
1495 if ((substream->f_flags & O_NONBLOCK) != 0 && in snd_pcm_oss_write1()
1513 static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int … in snd_pcm_oss_read2() argument
1515 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2()
1525 frames1 = snd_pcm_plug_client_channels_buf(substream, buf, frames, &channels); in snd_pcm_oss_read2()
1528 frames1 = snd_pcm_plug_read_transfer(substream, channels, frames1); in snd_pcm_oss_read2()
1538 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); in snd_pcm_oss_read2()
1546 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t byte… in snd_pcm_oss_read1() argument
1550 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1()
1552 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_read1()
1561 tmp = snd_pcm_oss_make_ready_locked(substream); in snd_pcm_oss_read1()
1566 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1585 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, in snd_pcm_oss_read1()
1610 struct snd_pcm_substream *substream; in snd_pcm_oss_reset() local
1615 substream = pcm_oss_file->streams[i]; in snd_pcm_oss_reset()
1616 if (!substream) in snd_pcm_oss_reset()
1618 runtime = substream->runtime; in snd_pcm_oss_reset()
1619 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_reset()
1632 struct snd_pcm_substream *substream; in snd_pcm_oss_post() local
1635 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_post()
1636 if (substream != NULL) { in snd_pcm_oss_post()
1637 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_post()
1639 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); in snd_pcm_oss_post()
1646 static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) in snd_pcm_oss_sync1() argument
1654 runtime = substream->runtime; in snd_pcm_oss_sync1()
1658 pcm_dbg(substream->pcm, "sync1: size = %li\n", size); in snd_pcm_oss_sync1()
1661 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1671 snd_pcm_stream_lock_irq(substream); in snd_pcm_oss_sync1()
1673 snd_pcm_stream_unlock_irq(substream); in snd_pcm_oss_sync1()
1684 pcm_err(substream->pcm, in snd_pcm_oss_sync1()
1698 struct snd_pcm_substream *substream; in snd_pcm_oss_sync() local
1704 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_sync()
1705 if (substream != NULL) { in snd_pcm_oss_sync()
1706 runtime = substream->runtime; in snd_pcm_oss_sync()
1707 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_sync()
1709 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_sync()
1720 pcm_dbg(substream->pcm, "sync: buffer_used\n"); in snd_pcm_oss_sync()
1726 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1731 pcm_dbg(substream->pcm, "sync: period_ptr\n"); in snd_pcm_oss_sync()
1737 err = snd_pcm_oss_sync1(substream, size); in snd_pcm_oss_sync()
1761 snd_pcm_lib_write(substream, (void __force __user *)runtime->oss.buffer, size1); in snd_pcm_oss_sync()
1767 snd_pcm_lib_writev(substream, buffers, size); in snd_pcm_oss_sync()
1779 saved_f_flags = substream->f_flags; in snd_pcm_oss_sync()
1780 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_sync()
1781 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); in snd_pcm_oss_sync()
1782 substream->f_flags = saved_f_flags; in snd_pcm_oss_sync()
1790 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_sync()
1791 if (substream != NULL) { in snd_pcm_oss_sync()
1792 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_sync()
1794 runtime = substream->runtime; in snd_pcm_oss_sync()
1795 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); in snd_pcm_oss_sync()
1811 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_rate() local
1815 if (substream == NULL) in snd_pcm_oss_set_rate()
1817 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1836 struct snd_pcm_substream *substream; in snd_pcm_oss_get_rate() local
1839 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_rate()
1841 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1852 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_channels() local
1856 if (substream == NULL) in snd_pcm_oss_set_channels()
1858 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1873 struct snd_pcm_substream *substream; in snd_pcm_oss_get_channels() local
1876 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_channels()
1878 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1883 struct snd_pcm_substream *substream; in snd_pcm_oss_get_block_size() local
1886 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_block_size()
1888 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1893 struct snd_pcm_substream *substream; in snd_pcm_oss_get_formats() local
1901 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_formats()
1903 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_get_formats()
1906 direct = substream->oss.setup.direct; in snd_pcm_oss_get_formats()
1919 err = snd_pcm_hw_refine(substream, params); in snd_pcm_oss_get_formats()
1948 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_format() local
1950 if (substream == NULL) in snd_pcm_oss_set_format()
1952 runtime = substream->runtime; in snd_pcm_oss_set_format()
1968 struct snd_pcm_substream *substream; in snd_pcm_oss_get_format() local
1971 if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream)) < 0) in snd_pcm_oss_get_format()
1973 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1976 static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int subdivide) in snd_pcm_oss_set_subdivide1() argument
1980 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
2002 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_subdivide() local
2005 if (substream == NULL) in snd_pcm_oss_set_subdivide()
2007 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
2011 err = snd_pcm_oss_set_subdivide1(substream, subdivide); in snd_pcm_oss_set_subdivide()
2019 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) in snd_pcm_oss_set_fragment1() argument
2024 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
2045 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_set_fragment() local
2048 if (substream == NULL) in snd_pcm_oss_set_fragment()
2050 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
2054 err = snd_pcm_oss_set_fragment1(substream, val); in snd_pcm_oss_set_fragment()
2070 static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) in snd_pcm_oss_get_caps1() argument
2073 if (substream == NULL) { in snd_pcm_oss_get_caps1()
2078 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_caps1()
2079 if (substream->pstr->substream_count > 1) in snd_pcm_oss_get_caps1()
2086 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1()
2100 struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_get_caps() local
2101 result = snd_pcm_oss_get_caps1(substream, result); in snd_pcm_oss_get_caps()
2107 static void snd_pcm_oss_simulate_fill(struct snd_pcm_substream *substream, in snd_pcm_oss_simulate_fill() argument
2110 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill()
2214 struct snd_pcm_substream *substream; in snd_pcm_oss_get_odelay() local
2219 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_get_odelay()
2220 if (substream == NULL) in snd_pcm_oss_get_odelay()
2222 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_get_odelay()
2224 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2227 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_odelay()
2232 return snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_odelay()
2237 struct snd_pcm_substream *substream; in snd_pcm_oss_get_ptr() local
2246 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_ptr()
2247 if (substream == NULL) in snd_pcm_oss_get_ptr()
2249 if ((err = snd_pcm_oss_make_ready(substream)) < 0) in snd_pcm_oss_get_ptr()
2251 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2259 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); in snd_pcm_oss_get_ptr()
2268 err = snd_pcm_oss_capture_position_fixup(substream, &delay); in snd_pcm_oss_get_ptr()
2273 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2274 if (atomic_read(&substream->mmap_count)) { in snd_pcm_oss_get_ptr()
2282 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_oss_get_ptr()
2283 snd_pcm_oss_simulate_fill(substream, delay); in snd_pcm_oss_get_ptr()
2284 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2286 delay = snd_pcm_oss_bytes(substream, delay); in snd_pcm_oss_get_ptr()
2288 if (substream->oss.setup.buggyptr) in snd_pcm_oss_get_ptr()
2306 struct snd_pcm_substream *substream; in snd_pcm_oss_get_space() local
2315 substream = pcm_oss_file->streams[stream]; in snd_pcm_oss_get_space()
2316 if (substream == NULL) in snd_pcm_oss_get_space()
2318 runtime = substream->runtime; in snd_pcm_oss_get_space()
2321 (err = snd_pcm_oss_change_params(substream, false)) < 0) in snd_pcm_oss_get_space()
2336 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); in snd_pcm_oss_get_space()
2346 err = snd_pcm_oss_capture_position_fixup(substream, &avail); in snd_pcm_oss_get_space()
2351 info.bytes = snd_pcm_oss_bytes(substream, avail) + fixup; in snd_pcm_oss_get_space()
2356 pcm_dbg(substream->pcm, in snd_pcm_oss_get_space()
2402 static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) in snd_pcm_oss_release_substream() argument
2405 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2409 snd_pcm_oss_plugin_clear(substream); in snd_pcm_oss_release_substream()
2411 substream->oss.oss = 0; in snd_pcm_oss_release_substream()
2414 static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, in snd_pcm_oss_init_substream() argument
2420 substream->oss.oss = 1; in snd_pcm_oss_init_substream()
2421 substream->oss.setup = *setup; in snd_pcm_oss_init_substream()
2423 substream->f_flags |= O_NONBLOCK; in snd_pcm_oss_init_substream()
2425 substream->f_flags &= ~O_NONBLOCK; in snd_pcm_oss_init_substream()
2426 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2445 substream->pcm_release = snd_pcm_oss_release_substream; in snd_pcm_oss_init_substream()
2455 struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx]; in snd_pcm_oss_release_file() local
2456 if (substream) in snd_pcm_oss_release_file()
2457 snd_pcm_release_substream(substream); in snd_pcm_oss_release_file()
2471 struct snd_pcm_substream *substream; in snd_pcm_oss_open_file() local
2498 err = snd_pcm_open_substream(pcm, idx, file, &substream); in snd_pcm_oss_open_file()
2504 pcm_oss_file->streams[idx] = substream; in snd_pcm_oss_open_file()
2505 substream->file = pcm_oss_file; in snd_pcm_oss_open_file()
2506 snd_pcm_oss_init_substream(substream, &setup[idx], minor); in snd_pcm_oss_open_file()
2624 struct snd_pcm_substream *substream; in snd_pcm_oss_release() local
2628 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_release()
2629 if (substream == NULL) in snd_pcm_oss_release()
2630 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_release()
2631 if (snd_BUG_ON(!substream)) in snd_pcm_oss_release()
2633 pcm = substream->pcm; in snd_pcm_oss_release()
2658 struct snd_pcm_substream *substream; in snd_pcm_oss_ioctl() local
2661 substream = pcm_oss_file->streams[idx]; in snd_pcm_oss_ioctl()
2662 if (substream != NULL) in snd_pcm_oss_ioctl()
2667 return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg); in snd_pcm_oss_ioctl()
2815 struct snd_pcm_substream *substream; in snd_pcm_oss_read() local
2818 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_read()
2819 if (substream == NULL) in snd_pcm_oss_read()
2821 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_read()
2823 return snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2826 ssize_t res = snd_pcm_oss_read1(substream, buf, count); in snd_pcm_oss_read()
2827 pcm_dbg(substream->pcm, in snd_pcm_oss_read()
2838 struct snd_pcm_substream *substream; in snd_pcm_oss_write() local
2842 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_write()
2843 if (substream == NULL) in snd_pcm_oss_write()
2845 substream->f_flags = file->f_flags & O_NONBLOCK; in snd_pcm_oss_write()
2846 result = snd_pcm_oss_write1(substream, buf, count); in snd_pcm_oss_write()
2848 pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n", in snd_pcm_oss_write()
2854 static int snd_pcm_oss_playback_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_playback_ready() argument
2856 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready()
2857 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_playback_ready()
2865 static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream) in snd_pcm_oss_capture_ready() argument
2867 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready()
2868 if (atomic_read(&substream->mmap_count)) in snd_pcm_oss_capture_ready()
2922 struct snd_pcm_substream *substream = NULL; in snd_pcm_oss_mmap() local
2932 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2933 if (substream) in snd_pcm_oss_mmap()
2937 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; in snd_pcm_oss_mmap()
2940 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; in snd_pcm_oss_mmap()
2948 if (substream == NULL) in snd_pcm_oss_mmap()
2950 runtime = substream->runtime; in snd_pcm_oss_mmap()
2963 err = snd_pcm_oss_change_params(substream, true); in snd_pcm_oss_mmap()
2975 err = snd_pcm_mmap_data(substream, file, area); in snd_pcm_oss_mmap()