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()
688 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_period_size() local
700 if (oss_buffer_size > runtime->oss.mmap_bytes) in snd_pcm_oss_period_size()
701 oss_buffer_size = runtime->oss.mmap_bytes; in snd_pcm_oss_period_size()
706 else if (runtime->oss.fragshift) { in snd_pcm_oss_period_size()
707 oss_period_size = 1 << runtime->oss.fragshift; in snd_pcm_oss_period_size()
718 if (runtime->oss.subdivision == 0) { in snd_pcm_oss_period_size()
725 sd = runtime->oss.subdivision; in snd_pcm_oss_period_size()
755 if (runtime->oss.maxfrags && s > runtime->oss.maxfrags) in snd_pcm_oss_period_size()
756 s = runtime->oss.maxfrags; in snd_pcm_oss_period_size()
771 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_period_size()
772 runtime->oss.period_frames = 1; in snd_pcm_oss_period_size()
773 runtime->oss.periods = oss_periods; in snd_pcm_oss_period_size()
818 static int lock_params(struct snd_pcm_runtime *runtime) in lock_params() argument
820 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in lock_params()
822 if (atomic_read(&runtime->oss.rw_ref)) { in lock_params()
823 mutex_unlock(&runtime->oss.params_lock); in lock_params()
829 static void unlock_params(struct snd_pcm_runtime *runtime) in unlock_params() argument
831 mutex_unlock(&runtime->oss.params_lock); in unlock_params()
837 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked() local
849 if (!runtime->oss.params) in snd_pcm_oss_change_params_locked()
881 choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
882 …snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL… in snd_pcm_oss_change_params_locked()
884 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_change_params_locked()
915 (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0); in snd_pcm_oss_change_params_locked()
917 runtime->oss.channels, 0); in snd_pcm_oss_change_params_locked()
919 runtime->oss.rate, 0); in snd_pcm_oss_change_params_locked()
935 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
941 runtime->oss.periods, NULL); in snd_pcm_oss_change_params_locked()
965 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
987 if (runtime->oss.trigger) { in snd_pcm_oss_change_params_locked()
990 sw_params->start_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
994 sw_params->stop_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
996 sw_params->stop_threshold = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1000 1 : runtime->period_size; in snd_pcm_oss_change_params_locked()
1007 frames = runtime->period_size + 16; in snd_pcm_oss_change_params_locked()
1008 if (frames > runtime->buffer_size) in snd_pcm_oss_change_params_locked()
1009 frames = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1020 runtime->oss.periods = params_periods(sparams); in snd_pcm_oss_change_params_locked()
1027 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1035 oss_buffer_size = oss_period_size * runtime->oss.periods; in snd_pcm_oss_change_params_locked()
1041 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_change_params_locked()
1042 runtime->oss.buffer_bytes = oss_buffer_size; in snd_pcm_oss_change_params_locked()
1045 runtime->oss.period_bytes, in snd_pcm_oss_change_params_locked()
1046 runtime->oss.buffer_bytes); in snd_pcm_oss_change_params_locked()
1051 runtime->oss.format = snd_pcm_oss_format_to(params_format(params)); in snd_pcm_oss_change_params_locked()
1052 runtime->oss.channels = params_channels(params); in snd_pcm_oss_change_params_locked()
1053 runtime->oss.rate = params_rate(params); in snd_pcm_oss_change_params_locked()
1055 kvfree(runtime->oss.buffer); in snd_pcm_oss_change_params_locked()
1056 runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); in snd_pcm_oss_change_params_locked()
1057 if (!runtime->oss.buffer) { in snd_pcm_oss_change_params_locked()
1062 runtime->oss.params = 0; in snd_pcm_oss_change_params_locked()
1063 runtime->oss.prepare = 1; in snd_pcm_oss_change_params_locked()
1064 runtime->oss.buffer_used = 0; in snd_pcm_oss_change_params_locked()
1065 if (runtime->dma_area) in snd_pcm_oss_change_params_locked()
1066 …snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->… in snd_pcm_oss_change_params_locked()
1068 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1082 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params() local
1086 if (!(mutex_trylock(&runtime->oss.params_lock))) in snd_pcm_oss_change_params()
1088 } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_change_params()
1092 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_change_params()
1107 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1122 * runtime->oss.prepare is set or not
1127 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare() local
1135 runtime->oss.prepare = 0; in snd_pcm_oss_prepare()
1136 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_prepare()
1137 runtime->oss.period_ptr = 0; in snd_pcm_oss_prepare()
1138 runtime->oss.buffer_used = 0; in snd_pcm_oss_prepare()
1145 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready() local
1148 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1149 if (runtime->oss.params) { in snd_pcm_oss_make_ready()
1154 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready()
1155 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_make_ready()
1158 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_make_ready()
1168 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready_locked() local
1171 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1172 if (runtime->oss.params) { in snd_pcm_oss_make_ready_locked()
1177 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready_locked()
1187 struct snd_pcm_runtime *runtime; in snd_pcm_oss_capture_position_fixup() local
1195 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1196 if (*delay <= (snd_pcm_sframes_t)runtime->buffer_size) in snd_pcm_oss_capture_position_fixup()
1200 frames = (*delay - runtime->buffer_size) + runtime->period_size - 1; in snd_pcm_oss_capture_position_fixup()
1201 frames /= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1202 frames *= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1212 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3() local
1215 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_write3()
1216 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_write3()
1220 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_write3()
1227 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1230 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1235 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_write3()
1243 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3() local
1247 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_read3()
1248 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_read3()
1252 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_read3()
1258 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_read3()
1266 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1269 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1271 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_oss_read3()
1287 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3() local
1290 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_writev3()
1291 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_writev3()
1295 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_writev3()
1308 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_writev3()
1316 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3() local
1319 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_readv3()
1320 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_readv3()
1324 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_readv3()
1330 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_readv3()
1345 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2() local
1348 if (runtime->oss.plugin_first) { in snd_pcm_oss_write2()
1350 …size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_fo… in snd_pcm_oss_write2()
1352 if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes)) in snd_pcm_oss_write2()
1354 buf = runtime->oss.buffer; in snd_pcm_oss_write2()
1367 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_write2()
1371 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_write2()
1380 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1() local
1385 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1387 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_write1()
1394 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_write1()
1396 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) in snd_pcm_oss_write1()
1397 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; in snd_pcm_oss_write1()
1399 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) { in snd_pcm_oss_write1()
1404 runtime->oss.buffer_used += tmp; in snd_pcm_oss_write1()
1409 runtime->oss.buffer_used == runtime->oss.period_bytes) { in snd_pcm_oss_write1()
1410 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1411 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); in snd_pcm_oss_write1()
1414 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1415 runtime->oss.period_ptr += tmp; in snd_pcm_oss_write1()
1416 runtime->oss.period_ptr %= runtime->oss.period_bytes; in snd_pcm_oss_write1()
1417 if (runtime->oss.period_ptr == 0 || in snd_pcm_oss_write1()
1418 runtime->oss.period_ptr == runtime->oss.buffer_used) in snd_pcm_oss_write1()
1419 runtime->oss.buffer_used = 0; in snd_pcm_oss_write1()
1428 runtime->oss.period_bytes, 0); in snd_pcm_oss_write1()
1431 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1436 tmp != runtime->oss.period_bytes) in snd_pcm_oss_write1()
1440 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write1()
1449 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1455 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2() local
1459 if (runtime->oss.plugin_first) { in snd_pcm_oss_read2()
1461 …size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_form… in snd_pcm_oss_read2()
1463 buf = runtime->oss.buffer; in snd_pcm_oss_read2()
1477 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_read2()
1481 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_read2()
1490 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1() local
1495 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1497 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_read1()
1504 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_read1()
1505 if (runtime->oss.buffer_used == 0) { in snd_pcm_oss_read1()
1506 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1509 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1510 runtime->oss.period_ptr = tmp; in snd_pcm_oss_read1()
1511 runtime->oss.buffer_used = tmp; in snd_pcm_oss_read1()
1514 if ((size_t) tmp > runtime->oss.buffer_used) in snd_pcm_oss_read1()
1515 tmp = runtime->oss.buffer_used; in snd_pcm_oss_read1()
1516 …if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), … in snd_pcm_oss_read1()
1523 runtime->oss.buffer_used -= tmp; in snd_pcm_oss_read1()
1526 runtime->oss.period_bytes, 0); in snd_pcm_oss_read1()
1529 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1535 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read1()
1544 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1551 struct snd_pcm_runtime *runtime; in snd_pcm_oss_reset() local
1558 runtime = substream->runtime; in snd_pcm_oss_reset()
1560 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1561 runtime->oss.prepare = 1; in snd_pcm_oss_reset()
1562 runtime->oss.buffer_used = 0; in snd_pcm_oss_reset()
1563 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_reset()
1564 runtime->oss.period_ptr = 0; in snd_pcm_oss_reset()
1565 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1589 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync1() local
1595 runtime = substream->runtime; in snd_pcm_oss_sync1()
1597 add_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1602 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1604 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync1()
1613 state = runtime->status->state; in snd_pcm_oss_sync1()
1631 remove_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1640 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync() local
1647 runtime = substream->runtime; in snd_pcm_oss_sync()
1653 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1654 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_sync()
1655 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1658 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_sync()
1660 if (runtime->oss.buffer_used > 0) { in snd_pcm_oss_sync()
1664 size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; in snd_pcm_oss_sync()
1666 runtime->oss.buffer + runtime->oss.buffer_used, in snd_pcm_oss_sync()
1668 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1671 } else if (runtime->oss.period_ptr > 0) { in snd_pcm_oss_sync()
1675 size = runtime->oss.period_bytes - runtime->oss.period_ptr; in snd_pcm_oss_sync()
1677 runtime->oss.buffer, in snd_pcm_oss_sync()
1687 size = runtime->control->appl_ptr % runtime->period_size; in snd_pcm_oss_sync()
1689 size = runtime->period_size - size; in snd_pcm_oss_sync()
1690 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) in snd_pcm_oss_sync()
1692 else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_oss_sync()
1696 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1697 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1710 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1711 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1712 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1720 runtime = substream->runtime; in snd_pcm_oss_sync()
1724 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1725 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync()
1726 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1727 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1738 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_rate() local
1743 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1748 err = lock_params(runtime); in snd_pcm_oss_set_rate()
1751 if (runtime->oss.rate != rate) { in snd_pcm_oss_set_rate()
1752 runtime->oss.params = 1; in snd_pcm_oss_set_rate()
1753 runtime->oss.rate = rate; in snd_pcm_oss_set_rate()
1755 unlock_params(runtime); in snd_pcm_oss_set_rate()
1768 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1780 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_channels() local
1785 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1786 err = lock_params(runtime); in snd_pcm_oss_set_channels()
1789 if (runtime->oss.channels != channels) { in snd_pcm_oss_set_channels()
1790 runtime->oss.params = 1; in snd_pcm_oss_set_channels()
1791 runtime->oss.channels = channels; in snd_pcm_oss_set_channels()
1793 unlock_params(runtime); in snd_pcm_oss_set_channels()
1806 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()
1879 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_format() local
1882 runtime = substream->runtime; in snd_pcm_oss_set_format()
1883 err = lock_params(runtime); in snd_pcm_oss_set_format()
1886 if (runtime->oss.format != format) { in snd_pcm_oss_set_format()
1887 runtime->oss.params = 1; in snd_pcm_oss_set_format()
1888 runtime->oss.format = format; in snd_pcm_oss_set_format()
1890 unlock_params(runtime); in snd_pcm_oss_set_format()
1904 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1909 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide1() local
1911 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1913 subdivide = runtime->oss.subdivision; in snd_pcm_oss_set_subdivide1()
1918 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_subdivide1()
1923 runtime->oss.subdivision = subdivide; in snd_pcm_oss_set_subdivide1()
1924 runtime->oss.params = 1; in snd_pcm_oss_set_subdivide1()
1934 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide() local
1938 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1939 err = lock_params(runtime); in snd_pcm_oss_set_subdivide()
1943 unlock_params(runtime); in snd_pcm_oss_set_subdivide()
1952 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment1() local
1955 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1956 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_fragment1()
1961 runtime->oss.fragshift = fragshift; in snd_pcm_oss_set_fragment1()
1962 runtime->oss.maxfrags = (val >> 16) & 0xffff; in snd_pcm_oss_set_fragment1()
1963 if (runtime->oss.fragshift < 4) /* < 16 */ in snd_pcm_oss_set_fragment1()
1964 runtime->oss.fragshift = 4; in snd_pcm_oss_set_fragment1()
1965 if (runtime->oss.maxfrags < 2) in snd_pcm_oss_set_fragment1()
1966 runtime->oss.maxfrags = 2; in snd_pcm_oss_set_fragment1()
1967 runtime->oss.params = 1; in snd_pcm_oss_set_fragment1()
1977 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment() local
1981 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1982 err = lock_params(runtime); in snd_pcm_oss_set_fragment()
1986 unlock_params(runtime); in snd_pcm_oss_set_fragment()
2017 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1() local
2018 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) in snd_pcm_oss_get_caps1()
2041 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill() local
2043 appl_ptr = hw_ptr + runtime->buffer_size; in snd_pcm_oss_simulate_fill()
2044 appl_ptr %= runtime->boundary; in snd_pcm_oss_simulate_fill()
2045 runtime->control->appl_ptr = appl_ptr; in snd_pcm_oss_simulate_fill()
2050 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_trigger() local
2072 runtime = psubstream->runtime; in snd_pcm_oss_set_trigger()
2074 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2077 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2081 get_hw_ptr_period(runtime)); in snd_pcm_oss_set_trigger()
2082 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2083 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2086 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2088 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2089 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2091 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2094 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2102 runtime = csubstream->runtime; in snd_pcm_oss_set_trigger()
2104 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2107 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2109 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2110 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2113 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2115 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2116 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2118 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2121 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2138 if (psubstream && psubstream->runtime && psubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2140 if (csubstream && csubstream->runtime && csubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2148 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_odelay() local
2158 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2159 if (runtime->oss.params || runtime->oss.prepare) in snd_pcm_oss_get_odelay()
2172 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_ptr() local
2186 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2187 if (runtime->oss.params || runtime->oss.prepare) { in snd_pcm_oss_get_ptr()
2200 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2204 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2208 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2211 delay = get_hw_ptr_period(runtime); in snd_pcm_oss_get_ptr()
2212 n = delay - runtime->oss.prev_hw_ptr_period; in snd_pcm_oss_get_ptr()
2214 n += runtime->boundary; in snd_pcm_oss_get_ptr()
2215 info.blocks = n / runtime->period_size; in snd_pcm_oss_get_ptr()
2216 runtime->oss.prev_hw_ptr_period = delay; in snd_pcm_oss_get_ptr()
2219 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2224 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2226 info.blocks = (delay + fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2227 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2230 info.blocks = delay / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2231 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2242 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_space() local
2253 runtime = substream->runtime; in snd_pcm_oss_get_space()
2255 if (runtime->oss.params) { in snd_pcm_oss_get_space()
2261 info.fragsize = runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2262 info.fragstotal = runtime->periods; in snd_pcm_oss_get_space()
2263 if (runtime->oss.prepare) { in snd_pcm_oss_get_space()
2265 info.bytes = runtime->oss.period_bytes * runtime->oss.periods; in snd_pcm_oss_get_space()
2266 info.fragments = runtime->oss.periods; in snd_pcm_oss_get_space()
2275 avail = runtime->buffer_size; in snd_pcm_oss_get_space()
2279 avail = runtime->buffer_size - avail; in snd_pcm_oss_get_space()
2280 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2284 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2289 info.fragments = info.bytes / runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2341 struct snd_pcm_runtime *runtime; in snd_pcm_oss_release_substream() local
2342 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2343 kvfree(runtime->oss.buffer); in snd_pcm_oss_release_substream()
2344 runtime->oss.buffer = NULL; in snd_pcm_oss_release_substream()
2355 struct snd_pcm_runtime *runtime; in snd_pcm_oss_init_substream() local
2363 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2364 runtime->oss.params = 1; in snd_pcm_oss_init_substream()
2365 runtime->oss.trigger = 1; in snd_pcm_oss_init_substream()
2366 runtime->oss.rate = 8000; in snd_pcm_oss_init_substream()
2367 mutex_init(&runtime->oss.params_lock); in snd_pcm_oss_init_substream()
2370 runtime->oss.format = AFMT_U8; in snd_pcm_oss_init_substream()
2373 runtime->oss.format = AFMT_S16_LE; in snd_pcm_oss_init_substream()
2376 runtime->oss.format = AFMT_MU_LAW; in snd_pcm_oss_init_substream()
2378 runtime->oss.channels = 1; in snd_pcm_oss_init_substream()
2379 runtime->oss.fragshift = 0; in snd_pcm_oss_init_substream()
2380 runtime->oss.maxfrags = 0; in snd_pcm_oss_init_substream()
2381 runtime->oss.subdivision = 0; in snd_pcm_oss_init_substream()
2383 atomic_set(&runtime->oss.rw_ref, 0); in snd_pcm_oss_init_substream()
2802 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready() local
2804 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_playback_ready()
2805 get_hw_ptr_period(runtime); in snd_pcm_oss_playback_ready()
2807 return snd_pcm_playback_avail(runtime) >= in snd_pcm_oss_playback_ready()
2808 runtime->oss.period_frames; in snd_pcm_oss_playback_ready()
2813 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready() local
2815 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_capture_ready()
2816 get_hw_ptr_period(runtime); in snd_pcm_oss_capture_ready()
2818 return snd_pcm_capture_avail(runtime) >= in snd_pcm_oss_capture_ready()
2819 runtime->oss.period_frames; in snd_pcm_oss_capture_ready()
2835 struct snd_pcm_runtime *runtime = psubstream->runtime; in snd_pcm_oss_poll() local
2836 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2838 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING && in snd_pcm_oss_poll()
2839 (runtime->status->state != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2845 struct snd_pcm_runtime *runtime = csubstream->runtime; in snd_pcm_oss_poll() local
2847 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2849 ostate = runtime->status->state; in snd_pcm_oss_poll()
2854 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { in snd_pcm_oss_poll()
2858 runtime->oss.trigger = 0; in snd_pcm_oss_poll()
2870 struct snd_pcm_runtime *runtime; in snd_pcm_oss_mmap() local
2897 runtime = substream->runtime; in snd_pcm_oss_mmap()
2898 if (!(runtime->info & SNDRV_PCM_INFO_MMAP_VALID)) in snd_pcm_oss_mmap()
2900 if (runtime->info & SNDRV_PCM_INFO_INTERLEAVED) in snd_pcm_oss_mmap()
2901 runtime->access = SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; in snd_pcm_oss_mmap()
2905 if (runtime->oss.params) { in snd_pcm_oss_mmap()
2915 if (runtime->oss.plugin_first != NULL) in snd_pcm_oss_mmap()
2925 runtime->oss.mmap_bytes = area->vm_end - area->vm_start; in snd_pcm_oss_mmap()
2926 runtime->silence_threshold = 0; in snd_pcm_oss_mmap()
2927 runtime->silence_size = 0; in snd_pcm_oss_mmap()
2930 runtime->oss.mmap_bytes); in snd_pcm_oss_mmap()
2933 runtime->stop_threshold = runtime->boundary; in snd_pcm_oss_mmap()