Lines Matching refs:runtime
556 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_plugin_clear() local
559 plugin = runtime->oss.plugin_first; in snd_pcm_oss_plugin_clear()
565 runtime->oss.plugin_first = runtime->oss.plugin_last = NULL; in snd_pcm_oss_plugin_clear()
571 struct snd_pcm_runtime *runtime = plugin->plug->runtime; in snd_pcm_plugin_insert() local
572 plugin->next = runtime->oss.plugin_first; in snd_pcm_plugin_insert()
574 if (runtime->oss.plugin_first) { in snd_pcm_plugin_insert()
575 runtime->oss.plugin_first->prev = plugin; in snd_pcm_plugin_insert()
576 runtime->oss.plugin_first = plugin; in snd_pcm_plugin_insert()
578 runtime->oss.plugin_last = in snd_pcm_plugin_insert()
579 runtime->oss.plugin_first = plugin; in snd_pcm_plugin_insert()
586 struct snd_pcm_runtime *runtime = plugin->plug->runtime; in snd_pcm_plugin_append() local
588 plugin->prev = runtime->oss.plugin_last; in snd_pcm_plugin_append()
589 if (runtime->oss.plugin_last) { in snd_pcm_plugin_append()
590 runtime->oss.plugin_last->next = plugin; in snd_pcm_plugin_append()
591 runtime->oss.plugin_last = plugin; in snd_pcm_plugin_append()
593 runtime->oss.plugin_last = in snd_pcm_plugin_append()
594 runtime->oss.plugin_first = plugin; in snd_pcm_plugin_append()
602 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_bytes() local
604 long bytes = frames_to_bytes(runtime, frames); in snd_pcm_oss_bytes()
605 if (buffer_size == runtime->oss.buffer_bytes) in snd_pcm_oss_bytes()
608 return runtime->oss.buffer_bytes * bytes / buffer_size; in snd_pcm_oss_bytes()
611 u64 bsize = (u64)runtime->oss.buffer_bytes * (u64)bytes; in snd_pcm_oss_bytes()
619 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_alsa_frames() local
621 if (buffer_size == runtime->oss.buffer_bytes) in snd_pcm_alsa_frames()
622 return bytes_to_frames(runtime, bytes); in snd_pcm_alsa_frames()
623 return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes); in snd_pcm_alsa_frames()
627 snd_pcm_uframes_t get_hw_ptr_period(struct snd_pcm_runtime *runtime) in get_hw_ptr_period() argument
629 return runtime->hw_ptr_interrupt; in get_hw_ptr_period()
703 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_period_size() local
713 if (oss_buffer_size > runtime->oss.mmap_bytes) in snd_pcm_oss_period_size()
714 oss_buffer_size = runtime->oss.mmap_bytes; in snd_pcm_oss_period_size()
719 else if (runtime->oss.fragshift) { in snd_pcm_oss_period_size()
720 oss_period_size = 1 << runtime->oss.fragshift; in snd_pcm_oss_period_size()
731 if (runtime->oss.subdivision == 0) { in snd_pcm_oss_period_size()
738 sd = runtime->oss.subdivision; in snd_pcm_oss_period_size()
764 if (runtime->oss.maxfrags && s > runtime->oss.maxfrags) in snd_pcm_oss_period_size()
765 s = runtime->oss.maxfrags; in snd_pcm_oss_period_size()
780 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_period_size()
781 runtime->oss.period_frames = 1; in snd_pcm_oss_period_size()
782 runtime->oss.periods = oss_periods; in snd_pcm_oss_period_size()
827 static int lock_params(struct snd_pcm_runtime *runtime) in lock_params() argument
829 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in lock_params()
831 if (atomic_read(&runtime->oss.rw_ref)) { in lock_params()
832 mutex_unlock(&runtime->oss.params_lock); in lock_params()
838 static void unlock_params(struct snd_pcm_runtime *runtime) in unlock_params() argument
840 mutex_unlock(&runtime->oss.params_lock); in unlock_params()
846 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked() local
858 if (!runtime->oss.params) in snd_pcm_oss_change_params_locked()
890 choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
891 …snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL… in snd_pcm_oss_change_params_locked()
893 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_change_params_locked()
927 (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0); in snd_pcm_oss_change_params_locked()
929 runtime->oss.channels, 0); in snd_pcm_oss_change_params_locked()
931 runtime->oss.rate, 0); in snd_pcm_oss_change_params_locked()
956 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
981 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
987 runtime->oss.periods, NULL); in snd_pcm_oss_change_params_locked()
998 if (runtime->oss.trigger) { in snd_pcm_oss_change_params_locked()
1001 sw_params->start_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
1005 sw_params->stop_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
1007 sw_params->stop_threshold = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1011 1 : runtime->period_size; in snd_pcm_oss_change_params_locked()
1018 frames = runtime->period_size + 16; in snd_pcm_oss_change_params_locked()
1019 if (frames > runtime->buffer_size) in snd_pcm_oss_change_params_locked()
1020 frames = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1030 runtime->oss.periods = params_periods(sparams); in snd_pcm_oss_change_params_locked()
1037 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1045 oss_buffer_size = oss_period_size * runtime->oss.periods; in snd_pcm_oss_change_params_locked()
1051 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_change_params_locked()
1052 runtime->oss.buffer_bytes = oss_buffer_size; in snd_pcm_oss_change_params_locked()
1055 runtime->oss.period_bytes, in snd_pcm_oss_change_params_locked()
1056 runtime->oss.buffer_bytes); in snd_pcm_oss_change_params_locked()
1061 runtime->oss.format = snd_pcm_oss_format_to(params_format(params)); in snd_pcm_oss_change_params_locked()
1062 runtime->oss.channels = params_channels(params); in snd_pcm_oss_change_params_locked()
1063 runtime->oss.rate = params_rate(params); in snd_pcm_oss_change_params_locked()
1065 vfree(runtime->oss.buffer); in snd_pcm_oss_change_params_locked()
1066 runtime->oss.buffer = vmalloc(runtime->oss.period_bytes); in snd_pcm_oss_change_params_locked()
1067 if (!runtime->oss.buffer) { in snd_pcm_oss_change_params_locked()
1072 runtime->oss.params = 0; in snd_pcm_oss_change_params_locked()
1073 runtime->oss.prepare = 1; in snd_pcm_oss_change_params_locked()
1074 runtime->oss.buffer_used = 0; in snd_pcm_oss_change_params_locked()
1075 if (runtime->dma_area) in snd_pcm_oss_change_params_locked()
1076 …snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->… in snd_pcm_oss_change_params_locked()
1078 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1092 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params() local
1096 if (!(mutex_trylock(&runtime->oss.params_lock))) in snd_pcm_oss_change_params()
1098 } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_change_params()
1102 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_change_params()
1117 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1137 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare() local
1145 runtime->oss.prepare = 0; in snd_pcm_oss_prepare()
1146 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_prepare()
1147 runtime->oss.period_ptr = 0; in snd_pcm_oss_prepare()
1148 runtime->oss.buffer_used = 0; in snd_pcm_oss_prepare()
1155 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready() local
1158 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1159 if (runtime->oss.params) { in snd_pcm_oss_make_ready()
1164 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready()
1165 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_make_ready()
1168 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_make_ready()
1178 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready_locked() local
1181 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1182 if (runtime->oss.params) { in snd_pcm_oss_make_ready_locked()
1187 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready_locked()
1197 struct snd_pcm_runtime *runtime; in snd_pcm_oss_capture_position_fixup() local
1205 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1206 if (*delay <= (snd_pcm_sframes_t)runtime->buffer_size) in snd_pcm_oss_capture_position_fixup()
1210 frames = (*delay - runtime->buffer_size) + runtime->period_size - 1; in snd_pcm_oss_capture_position_fixup()
1211 frames /= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1212 frames *= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1222 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3() local
1225 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_write3()
1226 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_write3()
1230 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_write3()
1243 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_write3()
1251 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3() local
1255 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_read3()
1256 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_read3()
1260 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_read3()
1266 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_read3()
1277 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_oss_read3()
1293 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3() local
1296 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_writev3()
1297 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_writev3()
1301 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_writev3()
1314 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_writev3()
1322 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3() local
1325 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_readv3()
1326 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_readv3()
1330 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_readv3()
1336 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_readv3()
1351 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2() local
1354 if (runtime->oss.plugin_first) { in snd_pcm_oss_write2()
1356 …size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_fo… in snd_pcm_oss_write2()
1358 if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes)) in snd_pcm_oss_write2()
1360 buf = runtime->oss.buffer; in snd_pcm_oss_write2()
1373 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_write2()
1377 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_write2()
1386 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1() local
1391 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1393 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_write1()
1400 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_write1()
1402 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) in snd_pcm_oss_write1()
1403 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; in snd_pcm_oss_write1()
1405 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) { in snd_pcm_oss_write1()
1410 runtime->oss.buffer_used += tmp; in snd_pcm_oss_write1()
1415 runtime->oss.buffer_used == runtime->oss.period_bytes) { in snd_pcm_oss_write1()
1416 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1417 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); in snd_pcm_oss_write1()
1420 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1421 runtime->oss.period_ptr += tmp; in snd_pcm_oss_write1()
1422 runtime->oss.period_ptr %= runtime->oss.period_bytes; in snd_pcm_oss_write1()
1423 if (runtime->oss.period_ptr == 0 || in snd_pcm_oss_write1()
1424 runtime->oss.period_ptr == runtime->oss.buffer_used) in snd_pcm_oss_write1()
1425 runtime->oss.buffer_used = 0; in snd_pcm_oss_write1()
1434 runtime->oss.period_bytes, 0); in snd_pcm_oss_write1()
1437 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1442 tmp != runtime->oss.period_bytes) in snd_pcm_oss_write1()
1446 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write1()
1455 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1461 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2() local
1465 if (runtime->oss.plugin_first) { in snd_pcm_oss_read2()
1467 …size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_form… in snd_pcm_oss_read2()
1469 buf = runtime->oss.buffer; in snd_pcm_oss_read2()
1483 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_read2()
1487 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_read2()
1496 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1() local
1501 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1503 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_read1()
1510 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_read1()
1511 if (runtime->oss.buffer_used == 0) { in snd_pcm_oss_read1()
1512 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1515 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1516 runtime->oss.period_ptr = tmp; in snd_pcm_oss_read1()
1517 runtime->oss.buffer_used = tmp; in snd_pcm_oss_read1()
1520 if ((size_t) tmp > runtime->oss.buffer_used) in snd_pcm_oss_read1()
1521 tmp = runtime->oss.buffer_used; in snd_pcm_oss_read1()
1522 …if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), … in snd_pcm_oss_read1()
1529 runtime->oss.buffer_used -= tmp; in snd_pcm_oss_read1()
1532 runtime->oss.period_bytes, 0); in snd_pcm_oss_read1()
1535 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1541 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read1()
1550 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1557 struct snd_pcm_runtime *runtime; in snd_pcm_oss_reset() local
1564 runtime = substream->runtime; in snd_pcm_oss_reset()
1566 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1567 runtime->oss.prepare = 1; in snd_pcm_oss_reset()
1568 runtime->oss.buffer_used = 0; in snd_pcm_oss_reset()
1569 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_reset()
1570 runtime->oss.period_ptr = 0; in snd_pcm_oss_reset()
1571 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1594 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync1() local
1600 runtime = substream->runtime; in snd_pcm_oss_sync1()
1602 add_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1607 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1609 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync1()
1618 state = runtime->status->state; in snd_pcm_oss_sync1()
1636 remove_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1645 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync() local
1652 runtime = substream->runtime; in snd_pcm_oss_sync()
1657 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1658 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_sync()
1659 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1662 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_sync()
1664 if (runtime->oss.buffer_used > 0) { in snd_pcm_oss_sync()
1668 size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; in snd_pcm_oss_sync()
1670 runtime->oss.buffer + runtime->oss.buffer_used, in snd_pcm_oss_sync()
1672 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1675 } else if (runtime->oss.period_ptr > 0) { in snd_pcm_oss_sync()
1679 size = runtime->oss.period_bytes - runtime->oss.period_ptr; in snd_pcm_oss_sync()
1681 runtime->oss.buffer, in snd_pcm_oss_sync()
1691 size = runtime->control->appl_ptr % runtime->period_size; in snd_pcm_oss_sync()
1693 size = runtime->period_size - size; in snd_pcm_oss_sync()
1694 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) in snd_pcm_oss_sync()
1696 else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_oss_sync()
1700 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1701 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1714 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1715 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1716 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1723 runtime = substream->runtime; in snd_pcm_oss_sync()
1727 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1728 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync()
1729 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1730 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1741 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_rate() local
1746 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1751 err = lock_params(runtime); in snd_pcm_oss_set_rate()
1754 if (runtime->oss.rate != rate) { in snd_pcm_oss_set_rate()
1755 runtime->oss.params = 1; in snd_pcm_oss_set_rate()
1756 runtime->oss.rate = rate; in snd_pcm_oss_set_rate()
1758 unlock_params(runtime); in snd_pcm_oss_set_rate()
1770 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1782 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_channels() local
1787 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1788 err = lock_params(runtime); in snd_pcm_oss_set_channels()
1791 if (runtime->oss.channels != channels) { in snd_pcm_oss_set_channels()
1792 runtime->oss.params = 1; in snd_pcm_oss_set_channels()
1793 runtime->oss.channels = channels; in snd_pcm_oss_set_channels()
1795 unlock_params(runtime); in snd_pcm_oss_set_channels()
1807 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1817 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1878 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_format() local
1881 runtime = substream->runtime; in snd_pcm_oss_set_format()
1882 err = lock_params(runtime); in snd_pcm_oss_set_format()
1885 if (runtime->oss.format != format) { in snd_pcm_oss_set_format()
1886 runtime->oss.params = 1; in snd_pcm_oss_set_format()
1887 runtime->oss.format = format; in snd_pcm_oss_set_format()
1889 unlock_params(runtime); in snd_pcm_oss_set_format()
1902 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1907 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide1() local
1909 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1911 subdivide = runtime->oss.subdivision; in snd_pcm_oss_set_subdivide1()
1916 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_subdivide1()
1921 runtime->oss.subdivision = subdivide; in snd_pcm_oss_set_subdivide1()
1922 runtime->oss.params = 1; in snd_pcm_oss_set_subdivide1()
1932 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide() local
1936 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1937 err = lock_params(runtime); in snd_pcm_oss_set_subdivide()
1941 unlock_params(runtime); in snd_pcm_oss_set_subdivide()
1950 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment1() local
1952 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1953 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_fragment1()
1955 runtime->oss.fragshift = val & 0xffff; in snd_pcm_oss_set_fragment1()
1956 runtime->oss.maxfrags = (val >> 16) & 0xffff; in snd_pcm_oss_set_fragment1()
1957 if (runtime->oss.fragshift < 4) /* < 16 */ in snd_pcm_oss_set_fragment1()
1958 runtime->oss.fragshift = 4; in snd_pcm_oss_set_fragment1()
1959 if (runtime->oss.maxfrags < 2) in snd_pcm_oss_set_fragment1()
1960 runtime->oss.maxfrags = 2; in snd_pcm_oss_set_fragment1()
1961 runtime->oss.params = 1; in snd_pcm_oss_set_fragment1()
1971 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment() local
1975 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1976 err = lock_params(runtime); in snd_pcm_oss_set_fragment()
1980 unlock_params(runtime); in snd_pcm_oss_set_fragment()
2011 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1() local
2012 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) in snd_pcm_oss_get_caps1()
2035 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill() local
2037 appl_ptr = hw_ptr + runtime->buffer_size; in snd_pcm_oss_simulate_fill()
2038 appl_ptr %= runtime->boundary; in snd_pcm_oss_simulate_fill()
2039 runtime->control->appl_ptr = appl_ptr; in snd_pcm_oss_simulate_fill()
2044 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_trigger() local
2064 runtime = psubstream->runtime; in snd_pcm_oss_set_trigger()
2066 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2069 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2073 get_hw_ptr_period(runtime)); in snd_pcm_oss_set_trigger()
2074 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2075 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2078 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2080 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2081 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2083 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2086 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2094 runtime = csubstream->runtime; in snd_pcm_oss_set_trigger()
2096 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2099 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2101 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2102 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2105 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2107 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2108 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2110 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2113 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2130 if (psubstream && psubstream->runtime && psubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2132 if (csubstream && csubstream->runtime && csubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2140 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_odelay() local
2149 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2150 if (runtime->oss.params || runtime->oss.prepare) in snd_pcm_oss_get_odelay()
2163 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_ptr() local
2176 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2177 if (runtime->oss.params || runtime->oss.prepare) { in snd_pcm_oss_get_ptr()
2190 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2194 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2198 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2201 delay = get_hw_ptr_period(runtime); in snd_pcm_oss_get_ptr()
2202 n = delay - runtime->oss.prev_hw_ptr_period; in snd_pcm_oss_get_ptr()
2204 n += runtime->boundary; in snd_pcm_oss_get_ptr()
2205 info.blocks = n / runtime->period_size; in snd_pcm_oss_get_ptr()
2206 runtime->oss.prev_hw_ptr_period = delay; in snd_pcm_oss_get_ptr()
2209 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2214 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2216 info.blocks = (delay + fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2217 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2220 info.blocks = delay / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2221 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2232 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_space() local
2243 runtime = substream->runtime; in snd_pcm_oss_get_space()
2245 if (runtime->oss.params && in snd_pcm_oss_get_space()
2249 info.fragsize = runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2250 info.fragstotal = runtime->periods; in snd_pcm_oss_get_space()
2251 if (runtime->oss.prepare) { in snd_pcm_oss_get_space()
2253 info.bytes = runtime->oss.period_bytes * runtime->oss.periods; in snd_pcm_oss_get_space()
2254 info.fragments = runtime->oss.periods; in snd_pcm_oss_get_space()
2263 avail = runtime->buffer_size; in snd_pcm_oss_get_space()
2267 avail = runtime->buffer_size - avail; in snd_pcm_oss_get_space()
2268 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2272 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2277 info.fragments = info.bytes / runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2329 struct snd_pcm_runtime *runtime; in snd_pcm_oss_release_substream() local
2330 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2331 vfree(runtime->oss.buffer); in snd_pcm_oss_release_substream()
2332 runtime->oss.buffer = NULL; in snd_pcm_oss_release_substream()
2343 struct snd_pcm_runtime *runtime; in snd_pcm_oss_init_substream() local
2351 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2352 runtime->oss.params = 1; in snd_pcm_oss_init_substream()
2353 runtime->oss.trigger = 1; in snd_pcm_oss_init_substream()
2354 runtime->oss.rate = 8000; in snd_pcm_oss_init_substream()
2355 mutex_init(&runtime->oss.params_lock); in snd_pcm_oss_init_substream()
2358 runtime->oss.format = AFMT_U8; in snd_pcm_oss_init_substream()
2361 runtime->oss.format = AFMT_S16_LE; in snd_pcm_oss_init_substream()
2364 runtime->oss.format = AFMT_MU_LAW; in snd_pcm_oss_init_substream()
2366 runtime->oss.channels = 1; in snd_pcm_oss_init_substream()
2367 runtime->oss.fragshift = 0; in snd_pcm_oss_init_substream()
2368 runtime->oss.maxfrags = 0; in snd_pcm_oss_init_substream()
2369 runtime->oss.subdivision = 0; in snd_pcm_oss_init_substream()
2371 atomic_set(&runtime->oss.rw_ref, 0); in snd_pcm_oss_init_substream()
2785 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready() local
2787 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_playback_ready()
2788 get_hw_ptr_period(runtime); in snd_pcm_oss_playback_ready()
2790 return snd_pcm_playback_avail(runtime) >= in snd_pcm_oss_playback_ready()
2791 runtime->oss.period_frames; in snd_pcm_oss_playback_ready()
2796 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready() local
2798 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_capture_ready()
2799 get_hw_ptr_period(runtime); in snd_pcm_oss_capture_ready()
2801 return snd_pcm_capture_avail(runtime) >= in snd_pcm_oss_capture_ready()
2802 runtime->oss.period_frames; in snd_pcm_oss_capture_ready()
2818 struct snd_pcm_runtime *runtime = psubstream->runtime; in snd_pcm_oss_poll() local
2819 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2821 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING && in snd_pcm_oss_poll()
2822 (runtime->status->state != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2828 struct snd_pcm_runtime *runtime = csubstream->runtime; in snd_pcm_oss_poll() local
2830 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2832 if ((ostate = runtime->status->state) != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2836 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { in snd_pcm_oss_poll()
2840 runtime->oss.trigger = 0; in snd_pcm_oss_poll()
2852 struct snd_pcm_runtime *runtime; in snd_pcm_oss_mmap() local
2879 runtime = substream->runtime; in snd_pcm_oss_mmap()
2880 if (!(runtime->info & SNDRV_PCM_INFO_MMAP_VALID)) in snd_pcm_oss_mmap()
2882 if (runtime->info & SNDRV_PCM_INFO_INTERLEAVED) in snd_pcm_oss_mmap()
2883 runtime->access = SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; in snd_pcm_oss_mmap()
2887 if (runtime->oss.params) { in snd_pcm_oss_mmap()
2897 if (runtime->oss.plugin_first != NULL) in snd_pcm_oss_mmap()
2907 runtime->oss.mmap_bytes = area->vm_end - area->vm_start; in snd_pcm_oss_mmap()
2908 runtime->silence_threshold = 0; in snd_pcm_oss_mmap()
2909 runtime->silence_size = 0; in snd_pcm_oss_mmap()
2912 runtime->oss.mmap_bytes); in snd_pcm_oss_mmap()
2915 runtime->stop_threshold = runtime->boundary; in snd_pcm_oss_mmap()