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
698 if (oss_buffer_size > runtime->oss.mmap_bytes) in snd_pcm_oss_period_size()
699 oss_buffer_size = runtime->oss.mmap_bytes; in snd_pcm_oss_period_size()
704 else if (runtime->oss.fragshift) { in snd_pcm_oss_period_size()
705 oss_period_size = 1 << runtime->oss.fragshift; in snd_pcm_oss_period_size()
716 if (runtime->oss.subdivision == 0) { in snd_pcm_oss_period_size()
723 sd = runtime->oss.subdivision; in snd_pcm_oss_period_size()
749 if (runtime->oss.maxfrags && s > runtime->oss.maxfrags) in snd_pcm_oss_period_size()
750 s = runtime->oss.maxfrags; in snd_pcm_oss_period_size()
765 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_period_size()
766 runtime->oss.period_frames = 1; in snd_pcm_oss_period_size()
767 runtime->oss.periods = oss_periods; in snd_pcm_oss_period_size()
812 static int lock_params(struct snd_pcm_runtime *runtime) in lock_params() argument
814 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in lock_params()
816 if (atomic_read(&runtime->oss.rw_ref)) { in lock_params()
817 mutex_unlock(&runtime->oss.params_lock); in lock_params()
823 static void unlock_params(struct snd_pcm_runtime *runtime) in unlock_params() argument
825 mutex_unlock(&runtime->oss.params_lock); in unlock_params()
831 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params_locked() local
843 if (!runtime->oss.params) in snd_pcm_oss_change_params_locked()
875 choose_rate(substream, sparams, runtime->oss.rate); in snd_pcm_oss_change_params_locked()
876 …snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL… in snd_pcm_oss_change_params_locked()
878 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_change_params_locked()
912 (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0); in snd_pcm_oss_change_params_locked()
914 runtime->oss.channels, 0); in snd_pcm_oss_change_params_locked()
916 runtime->oss.rate, 0); in snd_pcm_oss_change_params_locked()
932 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
938 runtime->oss.periods, NULL); in snd_pcm_oss_change_params_locked()
963 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
984 if (runtime->oss.trigger) { in snd_pcm_oss_change_params_locked()
987 sw_params->start_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
991 sw_params->stop_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
993 sw_params->stop_threshold = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
997 1 : runtime->period_size; in snd_pcm_oss_change_params_locked()
1004 frames = runtime->period_size + 16; in snd_pcm_oss_change_params_locked()
1005 if (frames > runtime->buffer_size) in snd_pcm_oss_change_params_locked()
1006 frames = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1016 runtime->oss.periods = params_periods(sparams); in snd_pcm_oss_change_params_locked()
1023 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1031 oss_buffer_size = oss_period_size * runtime->oss.periods; in snd_pcm_oss_change_params_locked()
1037 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_change_params_locked()
1038 runtime->oss.buffer_bytes = oss_buffer_size; in snd_pcm_oss_change_params_locked()
1041 runtime->oss.period_bytes, in snd_pcm_oss_change_params_locked()
1042 runtime->oss.buffer_bytes); in snd_pcm_oss_change_params_locked()
1047 runtime->oss.format = snd_pcm_oss_format_to(params_format(params)); in snd_pcm_oss_change_params_locked()
1048 runtime->oss.channels = params_channels(params); in snd_pcm_oss_change_params_locked()
1049 runtime->oss.rate = params_rate(params); in snd_pcm_oss_change_params_locked()
1051 kvfree(runtime->oss.buffer); in snd_pcm_oss_change_params_locked()
1052 runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); in snd_pcm_oss_change_params_locked()
1053 if (!runtime->oss.buffer) { in snd_pcm_oss_change_params_locked()
1058 runtime->oss.params = 0; in snd_pcm_oss_change_params_locked()
1059 runtime->oss.prepare = 1; in snd_pcm_oss_change_params_locked()
1060 runtime->oss.buffer_used = 0; in snd_pcm_oss_change_params_locked()
1061 if (runtime->dma_area) in snd_pcm_oss_change_params_locked()
1062 …snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->… in snd_pcm_oss_change_params_locked()
1064 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1078 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params() local
1082 if (!(mutex_trylock(&runtime->oss.params_lock))) in snd_pcm_oss_change_params()
1084 } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_change_params()
1088 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_change_params()
1103 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1118 * runtime->oss.prepare is set or not
1123 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare() local
1131 runtime->oss.prepare = 0; in snd_pcm_oss_prepare()
1132 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_prepare()
1133 runtime->oss.period_ptr = 0; in snd_pcm_oss_prepare()
1134 runtime->oss.buffer_used = 0; in snd_pcm_oss_prepare()
1141 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready() local
1144 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1145 if (runtime->oss.params) { in snd_pcm_oss_make_ready()
1150 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready()
1151 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_make_ready()
1154 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_make_ready()
1164 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready_locked() local
1167 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1168 if (runtime->oss.params) { in snd_pcm_oss_make_ready_locked()
1173 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready_locked()
1183 struct snd_pcm_runtime *runtime; in snd_pcm_oss_capture_position_fixup() local
1191 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1192 if (*delay <= (snd_pcm_sframes_t)runtime->buffer_size) in snd_pcm_oss_capture_position_fixup()
1196 frames = (*delay - runtime->buffer_size) + runtime->period_size - 1; in snd_pcm_oss_capture_position_fixup()
1197 frames /= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1198 frames *= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1208 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3() local
1211 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_write3()
1212 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_write3()
1216 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_write3()
1229 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_write3()
1237 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3() local
1241 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_read3()
1242 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_read3()
1246 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_read3()
1252 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_read3()
1263 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_oss_read3()
1279 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3() local
1282 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_writev3()
1283 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_writev3()
1287 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_writev3()
1300 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_writev3()
1308 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3() local
1311 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_readv3()
1312 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_readv3()
1316 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_readv3()
1322 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_readv3()
1337 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2() local
1340 if (runtime->oss.plugin_first) { in snd_pcm_oss_write2()
1342 …size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_fo… in snd_pcm_oss_write2()
1344 if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes)) in snd_pcm_oss_write2()
1346 buf = runtime->oss.buffer; in snd_pcm_oss_write2()
1359 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_write2()
1363 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_write2()
1372 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1() local
1377 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1379 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_write1()
1386 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_write1()
1388 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) in snd_pcm_oss_write1()
1389 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; in snd_pcm_oss_write1()
1391 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) { in snd_pcm_oss_write1()
1396 runtime->oss.buffer_used += tmp; in snd_pcm_oss_write1()
1401 runtime->oss.buffer_used == runtime->oss.period_bytes) { in snd_pcm_oss_write1()
1402 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1403 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); in snd_pcm_oss_write1()
1406 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1407 runtime->oss.period_ptr += tmp; in snd_pcm_oss_write1()
1408 runtime->oss.period_ptr %= runtime->oss.period_bytes; in snd_pcm_oss_write1()
1409 if (runtime->oss.period_ptr == 0 || in snd_pcm_oss_write1()
1410 runtime->oss.period_ptr == runtime->oss.buffer_used) in snd_pcm_oss_write1()
1411 runtime->oss.buffer_used = 0; in snd_pcm_oss_write1()
1420 runtime->oss.period_bytes, 0); in snd_pcm_oss_write1()
1423 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1428 tmp != runtime->oss.period_bytes) in snd_pcm_oss_write1()
1432 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write1()
1441 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1447 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2() local
1451 if (runtime->oss.plugin_first) { in snd_pcm_oss_read2()
1453 …size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_form… in snd_pcm_oss_read2()
1455 buf = runtime->oss.buffer; in snd_pcm_oss_read2()
1469 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_read2()
1473 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_read2()
1482 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1() local
1487 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1489 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_read1()
1496 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_read1()
1497 if (runtime->oss.buffer_used == 0) { in snd_pcm_oss_read1()
1498 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1501 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1502 runtime->oss.period_ptr = tmp; in snd_pcm_oss_read1()
1503 runtime->oss.buffer_used = tmp; in snd_pcm_oss_read1()
1506 if ((size_t) tmp > runtime->oss.buffer_used) in snd_pcm_oss_read1()
1507 tmp = runtime->oss.buffer_used; in snd_pcm_oss_read1()
1508 …if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), … in snd_pcm_oss_read1()
1515 runtime->oss.buffer_used -= tmp; in snd_pcm_oss_read1()
1518 runtime->oss.period_bytes, 0); in snd_pcm_oss_read1()
1521 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1527 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read1()
1536 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1543 struct snd_pcm_runtime *runtime; in snd_pcm_oss_reset() local
1550 runtime = substream->runtime; in snd_pcm_oss_reset()
1552 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1553 runtime->oss.prepare = 1; in snd_pcm_oss_reset()
1554 runtime->oss.buffer_used = 0; in snd_pcm_oss_reset()
1555 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_reset()
1556 runtime->oss.period_ptr = 0; in snd_pcm_oss_reset()
1557 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1580 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync1() local
1586 runtime = substream->runtime; in snd_pcm_oss_sync1()
1588 add_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1593 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1595 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync1()
1604 state = runtime->status->state; in snd_pcm_oss_sync1()
1622 remove_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1631 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync() local
1638 runtime = substream->runtime; in snd_pcm_oss_sync()
1643 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1644 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_sync()
1645 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1648 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_sync()
1650 if (runtime->oss.buffer_used > 0) { in snd_pcm_oss_sync()
1654 size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; in snd_pcm_oss_sync()
1656 runtime->oss.buffer + runtime->oss.buffer_used, in snd_pcm_oss_sync()
1658 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1661 } else if (runtime->oss.period_ptr > 0) { in snd_pcm_oss_sync()
1665 size = runtime->oss.period_bytes - runtime->oss.period_ptr; in snd_pcm_oss_sync()
1667 runtime->oss.buffer, in snd_pcm_oss_sync()
1677 size = runtime->control->appl_ptr % runtime->period_size; in snd_pcm_oss_sync()
1679 size = runtime->period_size - size; in snd_pcm_oss_sync()
1680 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) in snd_pcm_oss_sync()
1682 else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_oss_sync()
1686 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1687 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1700 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1701 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1702 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1709 runtime = substream->runtime; in snd_pcm_oss_sync()
1713 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1714 runtime->oss.buffer_used = 0; 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()
1727 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_rate() local
1732 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1737 err = lock_params(runtime); in snd_pcm_oss_set_rate()
1740 if (runtime->oss.rate != rate) { in snd_pcm_oss_set_rate()
1741 runtime->oss.params = 1; in snd_pcm_oss_set_rate()
1742 runtime->oss.rate = rate; in snd_pcm_oss_set_rate()
1744 unlock_params(runtime); in snd_pcm_oss_set_rate()
1756 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1768 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_channels() local
1773 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1774 err = lock_params(runtime); in snd_pcm_oss_set_channels()
1777 if (runtime->oss.channels != channels) { in snd_pcm_oss_set_channels()
1778 runtime->oss.params = 1; in snd_pcm_oss_set_channels()
1779 runtime->oss.channels = channels; in snd_pcm_oss_set_channels()
1781 unlock_params(runtime); in snd_pcm_oss_set_channels()
1793 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1803 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1864 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_format() local
1867 runtime = substream->runtime; in snd_pcm_oss_set_format()
1868 err = lock_params(runtime); in snd_pcm_oss_set_format()
1871 if (runtime->oss.format != format) { in snd_pcm_oss_set_format()
1872 runtime->oss.params = 1; in snd_pcm_oss_set_format()
1873 runtime->oss.format = format; in snd_pcm_oss_set_format()
1875 unlock_params(runtime); in snd_pcm_oss_set_format()
1888 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1893 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide1() local
1895 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1897 subdivide = runtime->oss.subdivision; in snd_pcm_oss_set_subdivide1()
1902 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_subdivide1()
1907 runtime->oss.subdivision = subdivide; in snd_pcm_oss_set_subdivide1()
1908 runtime->oss.params = 1; in snd_pcm_oss_set_subdivide1()
1918 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide() local
1922 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1923 err = lock_params(runtime); in snd_pcm_oss_set_subdivide()
1927 unlock_params(runtime); in snd_pcm_oss_set_subdivide()
1936 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment1() local
1938 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1939 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_fragment1()
1941 runtime->oss.fragshift = val & 0xffff; in snd_pcm_oss_set_fragment1()
1942 runtime->oss.maxfrags = (val >> 16) & 0xffff; in snd_pcm_oss_set_fragment1()
1943 if (runtime->oss.fragshift < 4) /* < 16 */ in snd_pcm_oss_set_fragment1()
1944 runtime->oss.fragshift = 4; in snd_pcm_oss_set_fragment1()
1945 if (runtime->oss.maxfrags < 2) in snd_pcm_oss_set_fragment1()
1946 runtime->oss.maxfrags = 2; in snd_pcm_oss_set_fragment1()
1947 runtime->oss.params = 1; in snd_pcm_oss_set_fragment1()
1957 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment() local
1961 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1962 err = lock_params(runtime); in snd_pcm_oss_set_fragment()
1966 unlock_params(runtime); in snd_pcm_oss_set_fragment()
1997 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1() local
1998 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) in snd_pcm_oss_get_caps1()
2021 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill() local
2023 appl_ptr = hw_ptr + runtime->buffer_size; in snd_pcm_oss_simulate_fill()
2024 appl_ptr %= runtime->boundary; in snd_pcm_oss_simulate_fill()
2025 runtime->control->appl_ptr = appl_ptr; in snd_pcm_oss_simulate_fill()
2030 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_trigger() local
2050 runtime = psubstream->runtime; in snd_pcm_oss_set_trigger()
2052 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2055 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2059 get_hw_ptr_period(runtime)); in snd_pcm_oss_set_trigger()
2060 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2061 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2064 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2066 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2067 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2069 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2072 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2080 runtime = csubstream->runtime; in snd_pcm_oss_set_trigger()
2082 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2085 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2087 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2088 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2091 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2093 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2094 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2096 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2099 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2116 if (psubstream && psubstream->runtime && psubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2118 if (csubstream && csubstream->runtime && csubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2126 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_odelay() local
2135 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2136 if (runtime->oss.params || runtime->oss.prepare) in snd_pcm_oss_get_odelay()
2149 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_ptr() local
2162 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2163 if (runtime->oss.params || runtime->oss.prepare) { in snd_pcm_oss_get_ptr()
2176 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2180 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2184 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2187 delay = get_hw_ptr_period(runtime); in snd_pcm_oss_get_ptr()
2188 n = delay - runtime->oss.prev_hw_ptr_period; in snd_pcm_oss_get_ptr()
2190 n += runtime->boundary; in snd_pcm_oss_get_ptr()
2191 info.blocks = n / runtime->period_size; in snd_pcm_oss_get_ptr()
2192 runtime->oss.prev_hw_ptr_period = delay; in snd_pcm_oss_get_ptr()
2195 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2200 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2202 info.blocks = (delay + fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2203 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2206 info.blocks = delay / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2207 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2218 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_space() local
2229 runtime = substream->runtime; in snd_pcm_oss_get_space()
2231 if (runtime->oss.params && in snd_pcm_oss_get_space()
2235 info.fragsize = runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2236 info.fragstotal = runtime->periods; in snd_pcm_oss_get_space()
2237 if (runtime->oss.prepare) { in snd_pcm_oss_get_space()
2239 info.bytes = runtime->oss.period_bytes * runtime->oss.periods; in snd_pcm_oss_get_space()
2240 info.fragments = runtime->oss.periods; in snd_pcm_oss_get_space()
2249 avail = runtime->buffer_size; in snd_pcm_oss_get_space()
2253 avail = runtime->buffer_size - avail; in snd_pcm_oss_get_space()
2254 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2258 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2263 info.fragments = info.bytes / runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2315 struct snd_pcm_runtime *runtime; in snd_pcm_oss_release_substream() local
2316 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2317 kvfree(runtime->oss.buffer); in snd_pcm_oss_release_substream()
2318 runtime->oss.buffer = NULL; in snd_pcm_oss_release_substream()
2329 struct snd_pcm_runtime *runtime; in snd_pcm_oss_init_substream() local
2337 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2338 runtime->oss.params = 1; in snd_pcm_oss_init_substream()
2339 runtime->oss.trigger = 1; in snd_pcm_oss_init_substream()
2340 runtime->oss.rate = 8000; in snd_pcm_oss_init_substream()
2341 mutex_init(&runtime->oss.params_lock); in snd_pcm_oss_init_substream()
2344 runtime->oss.format = AFMT_U8; in snd_pcm_oss_init_substream()
2347 runtime->oss.format = AFMT_S16_LE; in snd_pcm_oss_init_substream()
2350 runtime->oss.format = AFMT_MU_LAW; in snd_pcm_oss_init_substream()
2352 runtime->oss.channels = 1; in snd_pcm_oss_init_substream()
2353 runtime->oss.fragshift = 0; in snd_pcm_oss_init_substream()
2354 runtime->oss.maxfrags = 0; in snd_pcm_oss_init_substream()
2355 runtime->oss.subdivision = 0; in snd_pcm_oss_init_substream()
2357 atomic_set(&runtime->oss.rw_ref, 0); in snd_pcm_oss_init_substream()
2770 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready() local
2772 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_playback_ready()
2773 get_hw_ptr_period(runtime); in snd_pcm_oss_playback_ready()
2775 return snd_pcm_playback_avail(runtime) >= in snd_pcm_oss_playback_ready()
2776 runtime->oss.period_frames; in snd_pcm_oss_playback_ready()
2781 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready() local
2783 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_capture_ready()
2784 get_hw_ptr_period(runtime); in snd_pcm_oss_capture_ready()
2786 return snd_pcm_capture_avail(runtime) >= in snd_pcm_oss_capture_ready()
2787 runtime->oss.period_frames; in snd_pcm_oss_capture_ready()
2803 struct snd_pcm_runtime *runtime = psubstream->runtime; in snd_pcm_oss_poll() local
2804 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2806 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING && in snd_pcm_oss_poll()
2807 (runtime->status->state != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2813 struct snd_pcm_runtime *runtime = csubstream->runtime; in snd_pcm_oss_poll() local
2815 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2817 if ((ostate = runtime->status->state) != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2821 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { in snd_pcm_oss_poll()
2825 runtime->oss.trigger = 0; in snd_pcm_oss_poll()
2837 struct snd_pcm_runtime *runtime; in snd_pcm_oss_mmap() local
2864 runtime = substream->runtime; in snd_pcm_oss_mmap()
2865 if (!(runtime->info & SNDRV_PCM_INFO_MMAP_VALID)) in snd_pcm_oss_mmap()
2867 if (runtime->info & SNDRV_PCM_INFO_INTERLEAVED) in snd_pcm_oss_mmap()
2868 runtime->access = SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; in snd_pcm_oss_mmap()
2872 if (runtime->oss.params) { in snd_pcm_oss_mmap()
2882 if (runtime->oss.plugin_first != NULL) in snd_pcm_oss_mmap()
2892 runtime->oss.mmap_bytes = area->vm_end - area->vm_start; in snd_pcm_oss_mmap()
2893 runtime->silence_threshold = 0; in snd_pcm_oss_mmap()
2894 runtime->silence_size = 0; in snd_pcm_oss_mmap()
2897 runtime->oss.mmap_bytes); in snd_pcm_oss_mmap()
2900 runtime->stop_threshold = runtime->boundary; in snd_pcm_oss_mmap()