Lines Matching refs: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()
848 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked() local
860 if (!runtime->oss.params) in snd_pcm_oss_change_params_locked()
893 err = choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
898 runtime->oss.channels, NULL); in snd_pcm_oss_change_params_locked()
902 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_change_params_locked()
933 (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0); in snd_pcm_oss_change_params_locked()
935 runtime->oss.channels, 0); in snd_pcm_oss_change_params_locked()
937 runtime->oss.rate, 0); in snd_pcm_oss_change_params_locked()
953 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
959 runtime->oss.periods, NULL); in snd_pcm_oss_change_params_locked()
983 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1005 if (runtime->oss.trigger) { in snd_pcm_oss_change_params_locked()
1008 sw_params->start_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
1012 sw_params->stop_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
1014 sw_params->stop_threshold = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1018 1 : runtime->period_size; in snd_pcm_oss_change_params_locked()
1025 frames = runtime->period_size + 16; in snd_pcm_oss_change_params_locked()
1026 if (frames > runtime->buffer_size) in snd_pcm_oss_change_params_locked()
1027 frames = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1038 runtime->oss.periods = params_periods(sparams); in snd_pcm_oss_change_params_locked()
1045 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1052 oss_buffer_size = array_size(oss_period_size, runtime->oss.periods); in snd_pcm_oss_change_params_locked()
1058 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_change_params_locked()
1059 runtime->oss.buffer_bytes = oss_buffer_size; in snd_pcm_oss_change_params_locked()
1062 runtime->oss.period_bytes, in snd_pcm_oss_change_params_locked()
1063 runtime->oss.buffer_bytes); in snd_pcm_oss_change_params_locked()
1068 runtime->oss.format = snd_pcm_oss_format_to(params_format(params)); in snd_pcm_oss_change_params_locked()
1069 runtime->oss.channels = params_channels(params); in snd_pcm_oss_change_params_locked()
1070 runtime->oss.rate = params_rate(params); in snd_pcm_oss_change_params_locked()
1072 kvfree(runtime->oss.buffer); in snd_pcm_oss_change_params_locked()
1073 runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); in snd_pcm_oss_change_params_locked()
1074 if (!runtime->oss.buffer) { in snd_pcm_oss_change_params_locked()
1079 runtime->oss.params = 0; in snd_pcm_oss_change_params_locked()
1080 runtime->oss.prepare = 1; in snd_pcm_oss_change_params_locked()
1081 runtime->oss.buffer_used = 0; in snd_pcm_oss_change_params_locked()
1082 if (runtime->dma_area) in snd_pcm_oss_change_params_locked()
1083 …snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->… in snd_pcm_oss_change_params_locked()
1085 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1099 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params() local
1103 if (!(mutex_trylock(&runtime->oss.params_lock))) in snd_pcm_oss_change_params()
1105 } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_change_params()
1109 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_change_params()
1124 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1144 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare() local
1152 runtime->oss.prepare = 0; in snd_pcm_oss_prepare()
1153 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_prepare()
1154 runtime->oss.period_ptr = 0; in snd_pcm_oss_prepare()
1155 runtime->oss.buffer_used = 0; in snd_pcm_oss_prepare()
1162 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready() local
1165 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1166 if (runtime->oss.params) { in snd_pcm_oss_make_ready()
1171 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready()
1172 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_make_ready()
1175 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_make_ready()
1185 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready_locked() local
1188 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1189 if (runtime->oss.params) { in snd_pcm_oss_make_ready_locked()
1194 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready_locked()
1204 struct snd_pcm_runtime *runtime; in snd_pcm_oss_capture_position_fixup() local
1212 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1213 if (*delay <= (snd_pcm_sframes_t)runtime->buffer_size) in snd_pcm_oss_capture_position_fixup()
1217 frames = (*delay - runtime->buffer_size) + runtime->period_size - 1; in snd_pcm_oss_capture_position_fixup()
1218 frames /= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1219 frames *= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1229 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3() local
1232 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_write3()
1233 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_write3()
1237 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_write3()
1244 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1247 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1252 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_write3()
1260 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3() local
1264 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_read3()
1265 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_read3()
1269 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_read3()
1275 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_read3()
1283 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1286 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1288 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_oss_read3()
1304 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3() local
1307 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_writev3()
1308 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_writev3()
1312 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_writev3()
1325 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_writev3()
1333 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3() local
1336 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_readv3()
1337 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_readv3()
1341 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_readv3()
1347 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_readv3()
1362 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2() local
1365 if (runtime->oss.plugin_first) { in snd_pcm_oss_write2()
1367 …size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_fo… in snd_pcm_oss_write2()
1369 if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes)) in snd_pcm_oss_write2()
1371 buf = runtime->oss.buffer; in snd_pcm_oss_write2()
1384 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_write2()
1388 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_write2()
1397 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1() local
1402 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1404 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_write1()
1411 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_write1()
1413 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) in snd_pcm_oss_write1()
1414 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; in snd_pcm_oss_write1()
1416 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) { in snd_pcm_oss_write1()
1421 runtime->oss.buffer_used += tmp; in snd_pcm_oss_write1()
1426 runtime->oss.buffer_used == runtime->oss.period_bytes) { in snd_pcm_oss_write1()
1427 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1428 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); in snd_pcm_oss_write1()
1431 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1432 runtime->oss.period_ptr += tmp; in snd_pcm_oss_write1()
1433 runtime->oss.period_ptr %= runtime->oss.period_bytes; in snd_pcm_oss_write1()
1434 if (runtime->oss.period_ptr == 0 || in snd_pcm_oss_write1()
1435 runtime->oss.period_ptr == runtime->oss.buffer_used) in snd_pcm_oss_write1()
1436 runtime->oss.buffer_used = 0; in snd_pcm_oss_write1()
1445 runtime->oss.period_bytes, 0); in snd_pcm_oss_write1()
1448 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1453 tmp != runtime->oss.period_bytes) in snd_pcm_oss_write1()
1457 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write1()
1466 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1472 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2() local
1476 if (runtime->oss.plugin_first) { in snd_pcm_oss_read2()
1478 …size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_form… in snd_pcm_oss_read2()
1480 buf = runtime->oss.buffer; in snd_pcm_oss_read2()
1494 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_read2()
1498 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_read2()
1507 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1() local
1512 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1514 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_read1()
1521 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_read1()
1522 if (runtime->oss.buffer_used == 0) { in snd_pcm_oss_read1()
1523 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1526 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1527 runtime->oss.period_ptr = tmp; in snd_pcm_oss_read1()
1528 runtime->oss.buffer_used = tmp; in snd_pcm_oss_read1()
1531 if ((size_t) tmp > runtime->oss.buffer_used) in snd_pcm_oss_read1()
1532 tmp = runtime->oss.buffer_used; in snd_pcm_oss_read1()
1533 …if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), … in snd_pcm_oss_read1()
1540 runtime->oss.buffer_used -= tmp; in snd_pcm_oss_read1()
1543 runtime->oss.period_bytes, 0); in snd_pcm_oss_read1()
1546 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1552 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read1()
1561 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1568 struct snd_pcm_runtime *runtime; in snd_pcm_oss_reset() local
1575 runtime = substream->runtime; in snd_pcm_oss_reset()
1577 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1578 runtime->oss.prepare = 1; in snd_pcm_oss_reset()
1579 runtime->oss.buffer_used = 0; in snd_pcm_oss_reset()
1580 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_reset()
1581 runtime->oss.period_ptr = 0; in snd_pcm_oss_reset()
1582 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1606 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync1() local
1612 runtime = substream->runtime; in snd_pcm_oss_sync1()
1614 add_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1619 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1621 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync1()
1630 state = runtime->status->state; in snd_pcm_oss_sync1()
1648 remove_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1657 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync() local
1664 runtime = substream->runtime; in snd_pcm_oss_sync()
1667 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1668 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_sync()
1669 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1675 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_sync()
1677 if (runtime->oss.buffer_used > 0) { in snd_pcm_oss_sync()
1681 size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; in snd_pcm_oss_sync()
1683 runtime->oss.buffer + runtime->oss.buffer_used, in snd_pcm_oss_sync()
1685 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1688 } else if (runtime->oss.period_ptr > 0) { in snd_pcm_oss_sync()
1692 size = runtime->oss.period_bytes - runtime->oss.period_ptr; in snd_pcm_oss_sync()
1694 runtime->oss.buffer, in snd_pcm_oss_sync()
1704 size = runtime->control->appl_ptr % runtime->period_size; in snd_pcm_oss_sync()
1706 size = runtime->period_size - size; in snd_pcm_oss_sync()
1707 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) in snd_pcm_oss_sync()
1709 else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_oss_sync()
1713 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1714 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1727 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1728 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1729 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1737 runtime = substream->runtime; in snd_pcm_oss_sync()
1741 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1742 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync()
1743 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1744 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1755 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_rate() local
1760 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1765 err = lock_params(runtime); in snd_pcm_oss_set_rate()
1768 if (runtime->oss.rate != rate) { in snd_pcm_oss_set_rate()
1769 runtime->oss.params = 1; in snd_pcm_oss_set_rate()
1770 runtime->oss.rate = rate; in snd_pcm_oss_set_rate()
1772 unlock_params(runtime); in snd_pcm_oss_set_rate()
1785 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1797 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_channels() local
1802 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1803 err = lock_params(runtime); in snd_pcm_oss_set_channels()
1806 if (runtime->oss.channels != channels) { in snd_pcm_oss_set_channels()
1807 runtime->oss.params = 1; in snd_pcm_oss_set_channels()
1808 runtime->oss.channels = channels; in snd_pcm_oss_set_channels()
1810 unlock_params(runtime); in snd_pcm_oss_set_channels()
1823 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1834 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1896 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_format() local
1899 runtime = substream->runtime; in snd_pcm_oss_set_format()
1900 err = lock_params(runtime); in snd_pcm_oss_set_format()
1903 if (runtime->oss.format != format) { in snd_pcm_oss_set_format()
1904 runtime->oss.params = 1; in snd_pcm_oss_set_format()
1905 runtime->oss.format = format; in snd_pcm_oss_set_format()
1907 unlock_params(runtime); in snd_pcm_oss_set_format()
1921 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1926 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide1() local
1928 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1930 subdivide = runtime->oss.subdivision; in snd_pcm_oss_set_subdivide1()
1935 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_subdivide1()
1940 runtime->oss.subdivision = subdivide; in snd_pcm_oss_set_subdivide1()
1941 runtime->oss.params = 1; in snd_pcm_oss_set_subdivide1()
1951 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide() local
1955 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1956 err = lock_params(runtime); in snd_pcm_oss_set_subdivide()
1960 unlock_params(runtime); in snd_pcm_oss_set_subdivide()
1969 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment1() local
1972 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1973 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_fragment1()
1978 runtime->oss.fragshift = fragshift; in snd_pcm_oss_set_fragment1()
1979 runtime->oss.maxfrags = (val >> 16) & 0xffff; in snd_pcm_oss_set_fragment1()
1980 if (runtime->oss.fragshift < 4) /* < 16 */ in snd_pcm_oss_set_fragment1()
1981 runtime->oss.fragshift = 4; in snd_pcm_oss_set_fragment1()
1982 if (runtime->oss.maxfrags < 2) in snd_pcm_oss_set_fragment1()
1983 runtime->oss.maxfrags = 2; in snd_pcm_oss_set_fragment1()
1984 runtime->oss.params = 1; in snd_pcm_oss_set_fragment1()
1994 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment() local
1998 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1999 err = lock_params(runtime); in snd_pcm_oss_set_fragment()
2003 unlock_params(runtime); in snd_pcm_oss_set_fragment()
2034 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1() local
2035 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) in snd_pcm_oss_get_caps1()
2058 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill() local
2060 appl_ptr = hw_ptr + runtime->buffer_size; in snd_pcm_oss_simulate_fill()
2061 appl_ptr %= runtime->boundary; in snd_pcm_oss_simulate_fill()
2062 runtime->control->appl_ptr = appl_ptr; in snd_pcm_oss_simulate_fill()
2067 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_trigger() local
2089 runtime = psubstream->runtime; in snd_pcm_oss_set_trigger()
2091 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2094 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2098 get_hw_ptr_period(runtime)); in snd_pcm_oss_set_trigger()
2099 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2100 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2103 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2105 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2106 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2108 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2111 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2119 runtime = csubstream->runtime; in snd_pcm_oss_set_trigger()
2121 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2124 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2126 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2127 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2130 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2132 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2133 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2135 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2138 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2155 if (psubstream && psubstream->runtime && psubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2157 if (csubstream && csubstream->runtime && csubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2165 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_odelay() local
2175 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2176 if (runtime->oss.params || runtime->oss.prepare) in snd_pcm_oss_get_odelay()
2189 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_ptr() local
2203 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2204 if (runtime->oss.params || runtime->oss.prepare) { in snd_pcm_oss_get_ptr()
2217 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2221 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2225 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2228 delay = get_hw_ptr_period(runtime); in snd_pcm_oss_get_ptr()
2229 n = delay - runtime->oss.prev_hw_ptr_period; in snd_pcm_oss_get_ptr()
2231 n += runtime->boundary; in snd_pcm_oss_get_ptr()
2232 info.blocks = n / runtime->period_size; in snd_pcm_oss_get_ptr()
2233 runtime->oss.prev_hw_ptr_period = delay; in snd_pcm_oss_get_ptr()
2236 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2241 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2243 info.blocks = (delay + fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2244 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2247 info.blocks = delay / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2248 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2259 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_space() local
2270 runtime = substream->runtime; in snd_pcm_oss_get_space()
2272 if (runtime->oss.params) { in snd_pcm_oss_get_space()
2278 info.fragsize = runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2279 info.fragstotal = runtime->periods; in snd_pcm_oss_get_space()
2280 if (runtime->oss.prepare) { in snd_pcm_oss_get_space()
2282 info.bytes = runtime->oss.period_bytes * runtime->oss.periods; in snd_pcm_oss_get_space()
2283 info.fragments = runtime->oss.periods; in snd_pcm_oss_get_space()
2292 avail = runtime->buffer_size; in snd_pcm_oss_get_space()
2296 avail = runtime->buffer_size - avail; in snd_pcm_oss_get_space()
2297 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2301 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2306 info.fragments = info.bytes / runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2358 struct snd_pcm_runtime *runtime; in snd_pcm_oss_release_substream() local
2359 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2360 kvfree(runtime->oss.buffer); in snd_pcm_oss_release_substream()
2361 runtime->oss.buffer = NULL; in snd_pcm_oss_release_substream()
2372 struct snd_pcm_runtime *runtime; in snd_pcm_oss_init_substream() local
2380 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2381 runtime->oss.params = 1; in snd_pcm_oss_init_substream()
2382 runtime->oss.trigger = 1; in snd_pcm_oss_init_substream()
2383 runtime->oss.rate = 8000; in snd_pcm_oss_init_substream()
2384 mutex_init(&runtime->oss.params_lock); in snd_pcm_oss_init_substream()
2387 runtime->oss.format = AFMT_U8; in snd_pcm_oss_init_substream()
2390 runtime->oss.format = AFMT_S16_LE; in snd_pcm_oss_init_substream()
2393 runtime->oss.format = AFMT_MU_LAW; in snd_pcm_oss_init_substream()
2395 runtime->oss.channels = 1; in snd_pcm_oss_init_substream()
2396 runtime->oss.fragshift = 0; in snd_pcm_oss_init_substream()
2397 runtime->oss.maxfrags = 0; in snd_pcm_oss_init_substream()
2398 runtime->oss.subdivision = 0; in snd_pcm_oss_init_substream()
2400 atomic_set(&runtime->oss.rw_ref, 0); in snd_pcm_oss_init_substream()
2819 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready() local
2821 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_playback_ready()
2822 get_hw_ptr_period(runtime); in snd_pcm_oss_playback_ready()
2824 return snd_pcm_playback_avail(runtime) >= in snd_pcm_oss_playback_ready()
2825 runtime->oss.period_frames; in snd_pcm_oss_playback_ready()
2830 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready() local
2832 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_capture_ready()
2833 get_hw_ptr_period(runtime); in snd_pcm_oss_capture_ready()
2835 return snd_pcm_capture_avail(runtime) >= in snd_pcm_oss_capture_ready()
2836 runtime->oss.period_frames; in snd_pcm_oss_capture_ready()
2852 struct snd_pcm_runtime *runtime = psubstream->runtime; in snd_pcm_oss_poll() local
2853 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2855 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING && in snd_pcm_oss_poll()
2856 (runtime->status->state != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2862 struct snd_pcm_runtime *runtime = csubstream->runtime; in snd_pcm_oss_poll() local
2864 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2866 ostate = runtime->status->state; in snd_pcm_oss_poll()
2871 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { in snd_pcm_oss_poll()
2875 runtime->oss.trigger = 0; in snd_pcm_oss_poll()
2887 struct snd_pcm_runtime *runtime; in snd_pcm_oss_mmap() local
2914 runtime = substream->runtime; in snd_pcm_oss_mmap()
2915 if (!(runtime->info & SNDRV_PCM_INFO_MMAP_VALID)) in snd_pcm_oss_mmap()
2917 if (runtime->info & SNDRV_PCM_INFO_INTERLEAVED) in snd_pcm_oss_mmap()
2918 runtime->access = SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; in snd_pcm_oss_mmap()
2922 if (runtime->oss.params) { in snd_pcm_oss_mmap()
2932 if (runtime->oss.plugin_first != NULL) in snd_pcm_oss_mmap()
2942 runtime->oss.mmap_bytes = area->vm_end - area->vm_start; in snd_pcm_oss_mmap()
2943 runtime->silence_threshold = 0; in snd_pcm_oss_mmap()
2944 runtime->silence_size = 0; in snd_pcm_oss_mmap()
2947 runtime->oss.mmap_bytes); in snd_pcm_oss_mmap()
2950 runtime->stop_threshold = runtime->boundary; in snd_pcm_oss_mmap()