Lines Matching full:runtime
541 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_plugin_clear() local
544 plugin = runtime->oss.plugin_first; in snd_pcm_oss_plugin_clear()
550 runtime->oss.plugin_first = runtime->oss.plugin_last = NULL; in snd_pcm_oss_plugin_clear()
556 struct snd_pcm_runtime *runtime = plugin->plug->runtime; in snd_pcm_plugin_insert() local
557 plugin->next = runtime->oss.plugin_first; in snd_pcm_plugin_insert()
559 if (runtime->oss.plugin_first) { in snd_pcm_plugin_insert()
560 runtime->oss.plugin_first->prev = plugin; in snd_pcm_plugin_insert()
561 runtime->oss.plugin_first = plugin; in snd_pcm_plugin_insert()
563 runtime->oss.plugin_last = in snd_pcm_plugin_insert()
564 runtime->oss.plugin_first = plugin; in snd_pcm_plugin_insert()
571 struct snd_pcm_runtime *runtime = plugin->plug->runtime; in snd_pcm_plugin_append() local
573 plugin->prev = runtime->oss.plugin_last; in snd_pcm_plugin_append()
574 if (runtime->oss.plugin_last) { in snd_pcm_plugin_append()
575 runtime->oss.plugin_last->next = plugin; in snd_pcm_plugin_append()
576 runtime->oss.plugin_last = plugin; in snd_pcm_plugin_append()
578 runtime->oss.plugin_last = in snd_pcm_plugin_append()
579 runtime->oss.plugin_first = plugin; in snd_pcm_plugin_append()
587 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_bytes() local
589 long bytes = frames_to_bytes(runtime, frames); in snd_pcm_oss_bytes()
590 if (buffer_size == runtime->oss.buffer_bytes) in snd_pcm_oss_bytes()
593 return runtime->oss.buffer_bytes * bytes / buffer_size; in snd_pcm_oss_bytes()
596 u64 bsize = (u64)runtime->oss.buffer_bytes * (u64)bytes; in snd_pcm_oss_bytes()
604 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_alsa_frames() local
606 if (buffer_size == runtime->oss.buffer_bytes) in snd_pcm_alsa_frames()
607 return bytes_to_frames(runtime, bytes); in snd_pcm_alsa_frames()
608 return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes); in snd_pcm_alsa_frames()
612 snd_pcm_uframes_t get_hw_ptr_period(struct snd_pcm_runtime *runtime) in get_hw_ptr_period() argument
614 return runtime->hw_ptr_interrupt; in get_hw_ptr_period()
689 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_period_size() local
706 if (oss_buffer_size > runtime->oss.mmap_bytes) in snd_pcm_oss_period_size()
707 oss_buffer_size = runtime->oss.mmap_bytes; in snd_pcm_oss_period_size()
712 else if (runtime->oss.fragshift) { in snd_pcm_oss_period_size()
713 oss_period_size = 1 << runtime->oss.fragshift; in snd_pcm_oss_period_size()
724 if (runtime->oss.subdivision == 0) { in snd_pcm_oss_period_size()
731 sd = runtime->oss.subdivision; in snd_pcm_oss_period_size()
761 if (s > 0 && runtime->oss.maxfrags && s > runtime->oss.maxfrags) in snd_pcm_oss_period_size()
762 s = runtime->oss.maxfrags; in snd_pcm_oss_period_size()
782 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_period_size()
783 runtime->oss.period_frames = 1; in snd_pcm_oss_period_size()
784 runtime->oss.periods = oss_periods; in snd_pcm_oss_period_size()
829 static int lock_params(struct snd_pcm_runtime *runtime) in lock_params() argument
831 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in lock_params()
833 if (atomic_read(&runtime->oss.rw_ref)) { in lock_params()
834 mutex_unlock(&runtime->oss.params_lock); in lock_params()
840 static void unlock_params(struct snd_pcm_runtime *runtime) in unlock_params() argument
842 mutex_unlock(&runtime->oss.params_lock); in unlock_params()
847 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_release_buffers() local
849 kvfree(runtime->oss.buffer); in snd_pcm_oss_release_buffers()
850 runtime->oss.buffer = NULL; in snd_pcm_oss_release_buffers()
859 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked() local
871 if (!runtime->oss.params) in snd_pcm_oss_change_params_locked()
904 err = choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
909 runtime->oss.channels, NULL); in snd_pcm_oss_change_params_locked()
913 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_change_params_locked()
944 (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0); in snd_pcm_oss_change_params_locked()
946 runtime->oss.channels, 0); in snd_pcm_oss_change_params_locked()
948 runtime->oss.rate, 0); 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()
970 runtime->oss.periods, NULL); in snd_pcm_oss_change_params_locked()
992 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1011 if (runtime->oss.trigger) { in snd_pcm_oss_change_params_locked()
1014 sw_params->start_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
1018 sw_params->stop_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
1020 sw_params->stop_threshold = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1024 1 : runtime->period_size; in snd_pcm_oss_change_params_locked()
1031 frames = runtime->period_size + 16; in snd_pcm_oss_change_params_locked()
1032 if (frames > runtime->buffer_size) in snd_pcm_oss_change_params_locked()
1033 frames = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1044 runtime->oss.periods = params_periods(sparams); in snd_pcm_oss_change_params_locked()
1051 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1058 oss_buffer_size = array_size(oss_period_size, runtime->oss.periods); in snd_pcm_oss_change_params_locked()
1064 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_change_params_locked()
1065 runtime->oss.buffer_bytes = oss_buffer_size; in snd_pcm_oss_change_params_locked()
1068 runtime->oss.period_bytes, in snd_pcm_oss_change_params_locked()
1069 runtime->oss.buffer_bytes); in snd_pcm_oss_change_params_locked()
1074 runtime->oss.format = snd_pcm_oss_format_to(params_format(params)); in snd_pcm_oss_change_params_locked()
1075 runtime->oss.channels = params_channels(params); in snd_pcm_oss_change_params_locked()
1076 runtime->oss.rate = params_rate(params); in snd_pcm_oss_change_params_locked()
1078 kvfree(runtime->oss.buffer); in snd_pcm_oss_change_params_locked()
1079 runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); in snd_pcm_oss_change_params_locked()
1080 if (!runtime->oss.buffer) { in snd_pcm_oss_change_params_locked()
1085 runtime->oss.params = 0; in snd_pcm_oss_change_params_locked()
1086 runtime->oss.prepare = 1; in snd_pcm_oss_change_params_locked()
1087 runtime->oss.buffer_used = 0; in snd_pcm_oss_change_params_locked()
1088 if (runtime->dma_area) in snd_pcm_oss_change_params_locked()
1089 …snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->… 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()
1107 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params() local
1111 if (!(mutex_trylock(&runtime->oss.params_lock))) in snd_pcm_oss_change_params()
1113 } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_change_params()
1117 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_change_params()
1132 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1147 * runtime->oss.prepare is set or not
1152 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare() local
1160 runtime->oss.prepare = 0; in snd_pcm_oss_prepare()
1161 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_prepare()
1162 runtime->oss.period_ptr = 0; in snd_pcm_oss_prepare()
1163 runtime->oss.buffer_used = 0; in snd_pcm_oss_prepare()
1170 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready() local
1173 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1174 if (runtime->oss.params) { in snd_pcm_oss_make_ready()
1179 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready()
1180 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_make_ready()
1183 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_make_ready()
1193 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready_locked() local
1196 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1197 if (runtime->oss.params) { in snd_pcm_oss_make_ready_locked()
1202 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready_locked()
1212 struct snd_pcm_runtime *runtime; in snd_pcm_oss_capture_position_fixup() local
1220 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1221 if (*delay <= (snd_pcm_sframes_t)runtime->buffer_size) in snd_pcm_oss_capture_position_fixup()
1225 frames = (*delay - runtime->buffer_size) + runtime->period_size - 1; in snd_pcm_oss_capture_position_fixup()
1226 frames /= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1227 frames *= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1237 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3() local
1240 if (runtime->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_write3()
1241 runtime->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_write3()
1245 runtime->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_write3()
1252 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1255 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1260 if (runtime->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_write3()
1268 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3() local
1272 if (runtime->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_read3()
1273 runtime->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_read3()
1277 runtime->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_read3()
1283 } else if (runtime->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_read3()
1291 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1294 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1296 if (runtime->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_oss_read3()
1312 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3() local
1315 if (runtime->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_writev3()
1316 runtime->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_writev3()
1320 runtime->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_writev3()
1333 if (runtime->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_writev3()
1341 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3() local
1344 if (runtime->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_readv3()
1345 runtime->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_readv3()
1349 runtime->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_readv3()
1355 } else if (runtime->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_readv3()
1370 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2() local
1373 if (runtime->oss.plugin_first) { in snd_pcm_oss_write2()
1375 …size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_fo… in snd_pcm_oss_write2()
1377 if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes)) in snd_pcm_oss_write2()
1379 buf = runtime->oss.buffer; in snd_pcm_oss_write2()
1392 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_write2()
1396 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_write2()
1405 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1() local
1410 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1412 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_write1()
1419 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_write1()
1421 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) in snd_pcm_oss_write1()
1422 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; in snd_pcm_oss_write1()
1424 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) { in snd_pcm_oss_write1()
1429 runtime->oss.buffer_used += tmp; in snd_pcm_oss_write1()
1434 runtime->oss.buffer_used == runtime->oss.period_bytes) { in snd_pcm_oss_write1()
1435 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1436 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); in snd_pcm_oss_write1()
1439 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1440 runtime->oss.period_ptr += tmp; in snd_pcm_oss_write1()
1441 runtime->oss.period_ptr %= runtime->oss.period_bytes; in snd_pcm_oss_write1()
1442 if (runtime->oss.period_ptr == 0 || in snd_pcm_oss_write1()
1443 runtime->oss.period_ptr == runtime->oss.buffer_used) in snd_pcm_oss_write1()
1444 runtime->oss.buffer_used = 0; in snd_pcm_oss_write1()
1453 runtime->oss.period_bytes, 0); in snd_pcm_oss_write1()
1456 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1461 tmp != runtime->oss.period_bytes) in snd_pcm_oss_write1()
1465 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write1()
1474 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1480 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2() local
1484 if (runtime->oss.plugin_first) { in snd_pcm_oss_read2()
1486 …size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_form… in snd_pcm_oss_read2()
1488 buf = runtime->oss.buffer; in snd_pcm_oss_read2()
1502 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_read2()
1506 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_read2()
1515 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1() local
1520 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1522 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_read1()
1529 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_read1()
1530 if (runtime->oss.buffer_used == 0) { 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()
1534 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1535 runtime->oss.period_ptr = tmp; in snd_pcm_oss_read1()
1536 runtime->oss.buffer_used = tmp; in snd_pcm_oss_read1()
1539 if ((size_t) tmp > runtime->oss.buffer_used) in snd_pcm_oss_read1()
1540 tmp = runtime->oss.buffer_used; in snd_pcm_oss_read1()
1541 …if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), … in snd_pcm_oss_read1()
1548 runtime->oss.buffer_used -= tmp; in snd_pcm_oss_read1()
1551 runtime->oss.period_bytes, 0); in snd_pcm_oss_read1()
1554 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1560 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read1()
1569 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1576 struct snd_pcm_runtime *runtime; in snd_pcm_oss_reset() local
1583 runtime = substream->runtime; in snd_pcm_oss_reset()
1585 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1586 runtime->oss.prepare = 1; in snd_pcm_oss_reset()
1587 runtime->oss.buffer_used = 0; in snd_pcm_oss_reset()
1588 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_reset()
1589 runtime->oss.period_ptr = 0; in snd_pcm_oss_reset()
1590 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1614 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync1() local
1620 runtime = substream->runtime; in snd_pcm_oss_sync1()
1622 add_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1627 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1629 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync1()
1638 state = runtime->state; in snd_pcm_oss_sync1()
1656 remove_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1665 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync() local
1672 runtime = substream->runtime; in snd_pcm_oss_sync()
1675 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1676 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_sync()
1677 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1683 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_sync()
1685 if (runtime->oss.buffer_used > 0) { in snd_pcm_oss_sync()
1689 size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; in snd_pcm_oss_sync()
1691 runtime->oss.buffer + runtime->oss.buffer_used, in snd_pcm_oss_sync()
1693 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1696 } else if (runtime->oss.period_ptr > 0) { in snd_pcm_oss_sync()
1700 size = runtime->oss.period_bytes - runtime->oss.period_ptr; in snd_pcm_oss_sync()
1702 runtime->oss.buffer, in snd_pcm_oss_sync()
1712 size = runtime->control->appl_ptr % runtime->period_size; in snd_pcm_oss_sync()
1714 size = runtime->period_size - size; in snd_pcm_oss_sync()
1715 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) in snd_pcm_oss_sync()
1717 else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_oss_sync()
1721 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1722 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1735 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1736 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1737 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1745 runtime = substream->runtime; in snd_pcm_oss_sync()
1749 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1750 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync()
1751 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1752 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1763 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_rate() local
1768 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1773 err = lock_params(runtime); in snd_pcm_oss_set_rate()
1776 if (runtime->oss.rate != rate) { in snd_pcm_oss_set_rate()
1777 runtime->oss.params = 1; in snd_pcm_oss_set_rate()
1778 runtime->oss.rate = rate; in snd_pcm_oss_set_rate()
1780 unlock_params(runtime); in snd_pcm_oss_set_rate()
1793 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1805 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_channels() local
1810 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1811 err = lock_params(runtime); in snd_pcm_oss_set_channels()
1814 if (runtime->oss.channels != channels) { in snd_pcm_oss_set_channels()
1815 runtime->oss.params = 1; in snd_pcm_oss_set_channels()
1816 runtime->oss.channels = channels; in snd_pcm_oss_set_channels()
1818 unlock_params(runtime); in snd_pcm_oss_set_channels()
1831 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1842 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1904 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_format() local
1907 runtime = substream->runtime; in snd_pcm_oss_set_format()
1908 err = lock_params(runtime); in snd_pcm_oss_set_format()
1911 if (runtime->oss.format != format) { in snd_pcm_oss_set_format()
1912 runtime->oss.params = 1; in snd_pcm_oss_set_format()
1913 runtime->oss.format = format; in snd_pcm_oss_set_format()
1915 unlock_params(runtime); in snd_pcm_oss_set_format()
1929 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1934 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide1() local
1936 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1938 subdivide = runtime->oss.subdivision; in snd_pcm_oss_set_subdivide1()
1943 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_subdivide1()
1948 runtime->oss.subdivision = subdivide; in snd_pcm_oss_set_subdivide1()
1949 runtime->oss.params = 1; in snd_pcm_oss_set_subdivide1()
1959 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide() local
1963 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1964 err = lock_params(runtime); in snd_pcm_oss_set_subdivide()
1968 unlock_params(runtime); in snd_pcm_oss_set_subdivide()
1977 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment1() local
1980 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1981 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_fragment1()
1986 runtime->oss.fragshift = fragshift; in snd_pcm_oss_set_fragment1()
1987 runtime->oss.maxfrags = (val >> 16) & 0xffff; in snd_pcm_oss_set_fragment1()
1988 if (runtime->oss.fragshift < 4) /* < 16 */ in snd_pcm_oss_set_fragment1()
1989 runtime->oss.fragshift = 4; in snd_pcm_oss_set_fragment1()
1990 if (runtime->oss.maxfrags < 2) in snd_pcm_oss_set_fragment1()
1991 runtime->oss.maxfrags = 2; in snd_pcm_oss_set_fragment1()
1992 runtime->oss.params = 1; in snd_pcm_oss_set_fragment1()
2002 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment() local
2006 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
2007 err = lock_params(runtime); in snd_pcm_oss_set_fragment()
2011 unlock_params(runtime); in snd_pcm_oss_set_fragment()
2042 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1() local
2043 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) in snd_pcm_oss_get_caps1()
2066 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill() local
2068 appl_ptr = hw_ptr + runtime->buffer_size; in snd_pcm_oss_simulate_fill()
2069 appl_ptr %= runtime->boundary; in snd_pcm_oss_simulate_fill()
2070 runtime->control->appl_ptr = appl_ptr; in snd_pcm_oss_simulate_fill()
2075 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_trigger() local
2097 runtime = psubstream->runtime; in snd_pcm_oss_set_trigger()
2099 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2102 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2106 get_hw_ptr_period(runtime)); in snd_pcm_oss_set_trigger()
2107 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2108 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2111 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2113 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2114 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2116 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2119 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2127 runtime = csubstream->runtime; in snd_pcm_oss_set_trigger()
2129 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2132 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2134 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2135 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2138 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2140 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2141 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2143 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2146 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2163 if (psubstream && psubstream->runtime && psubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2165 if (csubstream && csubstream->runtime && csubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2173 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_odelay() local
2183 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2184 if (runtime->oss.params || runtime->oss.prepare) in snd_pcm_oss_get_odelay()
2197 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_ptr() local
2211 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2212 if (runtime->oss.params || runtime->oss.prepare) { in snd_pcm_oss_get_ptr()
2225 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2229 fixup = -runtime->oss.buffer_used; 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()
2236 delay = get_hw_ptr_period(runtime); in snd_pcm_oss_get_ptr()
2237 n = delay - runtime->oss.prev_hw_ptr_period; in snd_pcm_oss_get_ptr()
2239 n += runtime->boundary; in snd_pcm_oss_get_ptr()
2240 info.blocks = n / runtime->period_size; in snd_pcm_oss_get_ptr()
2241 runtime->oss.prev_hw_ptr_period = 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()
2249 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2251 info.blocks = (delay + fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2252 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2255 info.blocks = delay / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2256 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2267 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_space() local
2278 runtime = substream->runtime; in snd_pcm_oss_get_space()
2280 if (runtime->oss.params) { in snd_pcm_oss_get_space()
2286 info.fragsize = runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2287 info.fragstotal = runtime->periods; in snd_pcm_oss_get_space()
2288 if (runtime->oss.prepare) { in snd_pcm_oss_get_space()
2290 info.bytes = runtime->oss.period_bytes * runtime->oss.periods; in snd_pcm_oss_get_space()
2291 info.fragments = runtime->oss.periods; in snd_pcm_oss_get_space()
2300 avail = runtime->buffer_size; in snd_pcm_oss_get_space()
2304 avail = runtime->buffer_size - avail; in snd_pcm_oss_get_space()
2305 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2309 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2314 info.fragments = info.bytes / runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2374 struct snd_pcm_runtime *runtime; in snd_pcm_oss_init_substream() local
2382 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2383 runtime->oss.params = 1; in snd_pcm_oss_init_substream()
2384 runtime->oss.trigger = 1; in snd_pcm_oss_init_substream()
2385 runtime->oss.rate = 8000; in snd_pcm_oss_init_substream()
2386 mutex_init(&runtime->oss.params_lock); in snd_pcm_oss_init_substream()
2389 runtime->oss.format = AFMT_U8; in snd_pcm_oss_init_substream()
2392 runtime->oss.format = AFMT_S16_LE; in snd_pcm_oss_init_substream()
2395 runtime->oss.format = AFMT_MU_LAW; in snd_pcm_oss_init_substream()
2397 runtime->oss.channels = 1; in snd_pcm_oss_init_substream()
2398 runtime->oss.fragshift = 0; in snd_pcm_oss_init_substream()
2399 runtime->oss.maxfrags = 0; in snd_pcm_oss_init_substream()
2400 runtime->oss.subdivision = 0; in snd_pcm_oss_init_substream()
2402 atomic_set(&runtime->oss.rw_ref, 0); in snd_pcm_oss_init_substream()
2821 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready() local
2823 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_playback_ready()
2824 get_hw_ptr_period(runtime); in snd_pcm_oss_playback_ready()
2826 return snd_pcm_playback_avail(runtime) >= in snd_pcm_oss_playback_ready()
2827 runtime->oss.period_frames; in snd_pcm_oss_playback_ready()
2832 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready() local
2834 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_capture_ready()
2835 get_hw_ptr_period(runtime); in snd_pcm_oss_capture_ready()
2837 return snd_pcm_capture_avail(runtime) >= in snd_pcm_oss_capture_ready()
2838 runtime->oss.period_frames; in snd_pcm_oss_capture_ready()
2854 struct snd_pcm_runtime *runtime = psubstream->runtime; in snd_pcm_oss_poll() local
2855 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2857 if (runtime->state != SNDRV_PCM_STATE_DRAINING && in snd_pcm_oss_poll()
2858 (runtime->state != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2864 struct snd_pcm_runtime *runtime = csubstream->runtime; in snd_pcm_oss_poll() local
2866 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2868 ostate = runtime->state; in snd_pcm_oss_poll()
2873 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { in snd_pcm_oss_poll()
2877 runtime->oss.trigger = 0; in snd_pcm_oss_poll()
2889 struct snd_pcm_runtime *runtime; in snd_pcm_oss_mmap() local
2916 runtime = substream->runtime; in snd_pcm_oss_mmap()
2917 if (!(runtime->info & SNDRV_PCM_INFO_MMAP_VALID)) in snd_pcm_oss_mmap()
2919 if (runtime->info & SNDRV_PCM_INFO_INTERLEAVED) in snd_pcm_oss_mmap()
2920 runtime->access = SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; in snd_pcm_oss_mmap()
2924 if (runtime->oss.params) { in snd_pcm_oss_mmap()
2934 if (runtime->oss.plugin_first != NULL) in snd_pcm_oss_mmap()
2944 runtime->oss.mmap_bytes = area->vm_end - area->vm_start; in snd_pcm_oss_mmap()
2945 runtime->silence_threshold = 0; in snd_pcm_oss_mmap()
2946 runtime->silence_size = 0; in snd_pcm_oss_mmap()
2949 runtime->oss.mmap_bytes); in snd_pcm_oss_mmap()
2952 runtime->stop_threshold = runtime->boundary; in snd_pcm_oss_mmap()