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()
909 (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0); in snd_pcm_oss_change_params_locked()
911 runtime->oss.channels, 0); in snd_pcm_oss_change_params_locked()
913 runtime->oss.rate, 0); in snd_pcm_oss_change_params_locked()
929 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size); in snd_pcm_oss_change_params_locked()
935 runtime->oss.periods, NULL); in snd_pcm_oss_change_params_locked()
960 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
981 if (runtime->oss.trigger) { in snd_pcm_oss_change_params_locked()
984 sw_params->start_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
988 sw_params->stop_threshold = runtime->boundary; in snd_pcm_oss_change_params_locked()
990 sw_params->stop_threshold = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
994 1 : runtime->period_size; in snd_pcm_oss_change_params_locked()
1001 frames = runtime->period_size + 16; in snd_pcm_oss_change_params_locked()
1002 if (frames > runtime->buffer_size) in snd_pcm_oss_change_params_locked()
1003 frames = runtime->buffer_size; in snd_pcm_oss_change_params_locked()
1013 runtime->oss.periods = params_periods(sparams); in snd_pcm_oss_change_params_locked()
1020 if (runtime->oss.plugin_first) { in snd_pcm_oss_change_params_locked()
1028 oss_buffer_size = oss_period_size * runtime->oss.periods; in snd_pcm_oss_change_params_locked()
1034 runtime->oss.period_bytes = oss_period_size; in snd_pcm_oss_change_params_locked()
1035 runtime->oss.buffer_bytes = oss_buffer_size; in snd_pcm_oss_change_params_locked()
1038 runtime->oss.period_bytes, in snd_pcm_oss_change_params_locked()
1039 runtime->oss.buffer_bytes); in snd_pcm_oss_change_params_locked()
1044 runtime->oss.format = snd_pcm_oss_format_to(params_format(params)); in snd_pcm_oss_change_params_locked()
1045 runtime->oss.channels = params_channels(params); in snd_pcm_oss_change_params_locked()
1046 runtime->oss.rate = params_rate(params); in snd_pcm_oss_change_params_locked()
1048 kvfree(runtime->oss.buffer); in snd_pcm_oss_change_params_locked()
1049 runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); in snd_pcm_oss_change_params_locked()
1050 if (!runtime->oss.buffer) { in snd_pcm_oss_change_params_locked()
1055 runtime->oss.params = 0; in snd_pcm_oss_change_params_locked()
1056 runtime->oss.prepare = 1; in snd_pcm_oss_change_params_locked()
1057 runtime->oss.buffer_used = 0; in snd_pcm_oss_change_params_locked()
1058 if (runtime->dma_area) in snd_pcm_oss_change_params_locked()
1059 …snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->… in snd_pcm_oss_change_params_locked()
1061 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); in snd_pcm_oss_change_params_locked()
1075 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_change_params() local
1079 if (!(mutex_trylock(&runtime->oss.params_lock))) in snd_pcm_oss_change_params()
1081 } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_change_params()
1085 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_change_params()
1100 if (substream->runtime->oss.params) { in snd_pcm_oss_get_active_substream()
1115 * runtime->oss.prepare is set or not
1120 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_prepare() local
1128 runtime->oss.prepare = 0; in snd_pcm_oss_prepare()
1129 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_prepare()
1130 runtime->oss.period_ptr = 0; in snd_pcm_oss_prepare()
1131 runtime->oss.buffer_used = 0; in snd_pcm_oss_prepare()
1138 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready() local
1141 runtime = substream->runtime; in snd_pcm_oss_make_ready()
1142 if (runtime->oss.params) { in snd_pcm_oss_make_ready()
1147 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready()
1148 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_make_ready()
1151 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_make_ready()
1161 struct snd_pcm_runtime *runtime; in snd_pcm_oss_make_ready_locked() local
1164 runtime = substream->runtime; in snd_pcm_oss_make_ready_locked()
1165 if (runtime->oss.params) { in snd_pcm_oss_make_ready_locked()
1170 if (runtime->oss.prepare) { in snd_pcm_oss_make_ready_locked()
1180 struct snd_pcm_runtime *runtime; in snd_pcm_oss_capture_position_fixup() local
1188 runtime = substream->runtime; in snd_pcm_oss_capture_position_fixup()
1189 if (*delay <= (snd_pcm_sframes_t)runtime->buffer_size) in snd_pcm_oss_capture_position_fixup()
1193 frames = (*delay - runtime->buffer_size) + runtime->period_size - 1; in snd_pcm_oss_capture_position_fixup()
1194 frames /= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1195 frames *= runtime->period_size; in snd_pcm_oss_capture_position_fixup()
1205 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write3() local
1208 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_write3()
1209 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_write3()
1213 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_write3()
1220 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1223 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_write3()
1228 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_write3()
1236 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read3() local
1240 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_read3()
1241 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_read3()
1245 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_read3()
1251 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_read3()
1259 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1262 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_read3()
1264 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { in snd_pcm_oss_read3()
1280 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_writev3() local
1283 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_writev3()
1284 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_writev3()
1288 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_writev3()
1301 if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) in snd_pcm_oss_writev3()
1309 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_readv3() local
1312 if (runtime->status->state == SNDRV_PCM_STATE_XRUN || in snd_pcm_oss_readv3()
1313 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { in snd_pcm_oss_readv3()
1317 runtime->status->state == SNDRV_PCM_STATE_XRUN ? in snd_pcm_oss_readv3()
1323 } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) { in snd_pcm_oss_readv3()
1338 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write2() local
1341 if (runtime->oss.plugin_first) { in snd_pcm_oss_write2()
1343 …size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_fo… in snd_pcm_oss_write2()
1345 if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes)) in snd_pcm_oss_write2()
1347 buf = runtime->oss.buffer; in snd_pcm_oss_write2()
1360 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_write2()
1364 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_write2()
1373 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_write1() local
1378 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1380 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_write1()
1387 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_write1()
1389 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) in snd_pcm_oss_write1()
1390 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; in snd_pcm_oss_write1()
1392 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) { in snd_pcm_oss_write1()
1397 runtime->oss.buffer_used += tmp; in snd_pcm_oss_write1()
1402 runtime->oss.buffer_used == runtime->oss.period_bytes) { in snd_pcm_oss_write1()
1403 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, in snd_pcm_oss_write1()
1404 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); in snd_pcm_oss_write1()
1407 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1408 runtime->oss.period_ptr += tmp; in snd_pcm_oss_write1()
1409 runtime->oss.period_ptr %= runtime->oss.period_bytes; in snd_pcm_oss_write1()
1410 if (runtime->oss.period_ptr == 0 || in snd_pcm_oss_write1()
1411 runtime->oss.period_ptr == runtime->oss.buffer_used) in snd_pcm_oss_write1()
1412 runtime->oss.buffer_used = 0; in snd_pcm_oss_write1()
1421 runtime->oss.period_bytes, 0); in snd_pcm_oss_write1()
1424 runtime->oss.bytes += tmp; in snd_pcm_oss_write1()
1429 tmp != runtime->oss.period_bytes) in snd_pcm_oss_write1()
1433 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_write1()
1442 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_write1()
1448 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read2() local
1452 if (runtime->oss.plugin_first) { in snd_pcm_oss_read2()
1454 …size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_form… in snd_pcm_oss_read2()
1456 buf = runtime->oss.buffer; in snd_pcm_oss_read2()
1470 frames = bytes_to_frames(runtime, bytes); in snd_pcm_oss_read2()
1474 bytes = frames_to_bytes(runtime, frames1); in snd_pcm_oss_read2()
1483 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_read1() local
1488 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1490 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_read1()
1497 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { in snd_pcm_oss_read1()
1498 if (runtime->oss.buffer_used == 0) { in snd_pcm_oss_read1()
1499 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); in snd_pcm_oss_read1()
1502 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1503 runtime->oss.period_ptr = tmp; in snd_pcm_oss_read1()
1504 runtime->oss.buffer_used = tmp; in snd_pcm_oss_read1()
1507 if ((size_t) tmp > runtime->oss.buffer_used) in snd_pcm_oss_read1()
1508 tmp = runtime->oss.buffer_used; in snd_pcm_oss_read1()
1509 …if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), … in snd_pcm_oss_read1()
1516 runtime->oss.buffer_used -= tmp; in snd_pcm_oss_read1()
1519 runtime->oss.period_bytes, 0); in snd_pcm_oss_read1()
1522 runtime->oss.bytes += tmp; in snd_pcm_oss_read1()
1528 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_read1()
1537 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_read1()
1544 struct snd_pcm_runtime *runtime; in snd_pcm_oss_reset() local
1551 runtime = substream->runtime; in snd_pcm_oss_reset()
1553 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1554 runtime->oss.prepare = 1; in snd_pcm_oss_reset()
1555 runtime->oss.buffer_used = 0; in snd_pcm_oss_reset()
1556 runtime->oss.prev_hw_ptr_period = 0; in snd_pcm_oss_reset()
1557 runtime->oss.period_ptr = 0; in snd_pcm_oss_reset()
1558 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_reset()
1581 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync1() local
1587 runtime = substream->runtime; in snd_pcm_oss_sync1()
1589 add_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1594 result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); in snd_pcm_oss_sync1()
1596 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync1()
1605 state = runtime->status->state; in snd_pcm_oss_sync1()
1623 remove_wait_queue(&runtime->sleep, &wait); in snd_pcm_oss_sync1()
1632 struct snd_pcm_runtime *runtime; in snd_pcm_oss_sync() local
1639 runtime = substream->runtime; in snd_pcm_oss_sync()
1644 atomic_inc(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1645 if (mutex_lock_interruptible(&runtime->oss.params_lock)) { in snd_pcm_oss_sync()
1646 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1649 format = snd_pcm_oss_format_from(runtime->oss.format); in snd_pcm_oss_sync()
1651 if (runtime->oss.buffer_used > 0) { in snd_pcm_oss_sync()
1655 size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; in snd_pcm_oss_sync()
1657 runtime->oss.buffer + runtime->oss.buffer_used, in snd_pcm_oss_sync()
1659 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); in snd_pcm_oss_sync()
1662 } else if (runtime->oss.period_ptr > 0) { in snd_pcm_oss_sync()
1666 size = runtime->oss.period_bytes - runtime->oss.period_ptr; in snd_pcm_oss_sync()
1668 runtime->oss.buffer, in snd_pcm_oss_sync()
1678 size = runtime->control->appl_ptr % runtime->period_size; in snd_pcm_oss_sync()
1680 size = runtime->period_size - size; in snd_pcm_oss_sync()
1681 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) in snd_pcm_oss_sync()
1683 else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) in snd_pcm_oss_sync()
1687 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1688 atomic_dec(&runtime->oss.rw_ref); in snd_pcm_oss_sync()
1701 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1702 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1703 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1710 runtime = substream->runtime; in snd_pcm_oss_sync()
1714 mutex_lock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1715 runtime->oss.buffer_used = 0; in snd_pcm_oss_sync()
1716 runtime->oss.prepare = 1; in snd_pcm_oss_sync()
1717 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_sync()
1728 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_rate() local
1733 runtime = substream->runtime; in snd_pcm_oss_set_rate()
1738 err = lock_params(runtime); in snd_pcm_oss_set_rate()
1741 if (runtime->oss.rate != rate) { in snd_pcm_oss_set_rate()
1742 runtime->oss.params = 1; in snd_pcm_oss_set_rate()
1743 runtime->oss.rate = rate; in snd_pcm_oss_set_rate()
1745 unlock_params(runtime); in snd_pcm_oss_set_rate()
1757 return substream->runtime->oss.rate; in snd_pcm_oss_get_rate()
1769 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_channels() local
1774 runtime = substream->runtime; in snd_pcm_oss_set_channels()
1775 err = lock_params(runtime); in snd_pcm_oss_set_channels()
1778 if (runtime->oss.channels != channels) { in snd_pcm_oss_set_channels()
1779 runtime->oss.params = 1; in snd_pcm_oss_set_channels()
1780 runtime->oss.channels = channels; in snd_pcm_oss_set_channels()
1782 unlock_params(runtime); in snd_pcm_oss_set_channels()
1794 return substream->runtime->oss.channels; in snd_pcm_oss_get_channels()
1804 return substream->runtime->oss.period_bytes; in snd_pcm_oss_get_block_size()
1865 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_format() local
1868 runtime = substream->runtime; in snd_pcm_oss_set_format()
1869 err = lock_params(runtime); in snd_pcm_oss_set_format()
1872 if (runtime->oss.format != format) { in snd_pcm_oss_set_format()
1873 runtime->oss.params = 1; in snd_pcm_oss_set_format()
1874 runtime->oss.format = format; in snd_pcm_oss_set_format()
1876 unlock_params(runtime); in snd_pcm_oss_set_format()
1889 return substream->runtime->oss.format; in snd_pcm_oss_get_format()
1894 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide1() local
1896 runtime = substream->runtime; in snd_pcm_oss_set_subdivide1()
1898 subdivide = runtime->oss.subdivision; in snd_pcm_oss_set_subdivide1()
1903 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_subdivide1()
1908 runtime->oss.subdivision = subdivide; in snd_pcm_oss_set_subdivide1()
1909 runtime->oss.params = 1; in snd_pcm_oss_set_subdivide1()
1919 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_subdivide() local
1923 runtime = substream->runtime; in snd_pcm_oss_set_subdivide()
1924 err = lock_params(runtime); in snd_pcm_oss_set_subdivide()
1928 unlock_params(runtime); in snd_pcm_oss_set_subdivide()
1937 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment1() local
1939 runtime = substream->runtime; in snd_pcm_oss_set_fragment1()
1940 if (runtime->oss.subdivision || runtime->oss.fragshift) in snd_pcm_oss_set_fragment1()
1942 runtime->oss.fragshift = val & 0xffff; in snd_pcm_oss_set_fragment1()
1943 runtime->oss.maxfrags = (val >> 16) & 0xffff; in snd_pcm_oss_set_fragment1()
1944 if (runtime->oss.fragshift < 4) /* < 16 */ in snd_pcm_oss_set_fragment1()
1945 runtime->oss.fragshift = 4; in snd_pcm_oss_set_fragment1()
1946 if (runtime->oss.maxfrags < 2) in snd_pcm_oss_set_fragment1()
1947 runtime->oss.maxfrags = 2; in snd_pcm_oss_set_fragment1()
1948 runtime->oss.params = 1; in snd_pcm_oss_set_fragment1()
1958 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_fragment() local
1962 runtime = substream->runtime; in snd_pcm_oss_set_fragment()
1963 err = lock_params(runtime); in snd_pcm_oss_set_fragment()
1967 unlock_params(runtime); in snd_pcm_oss_set_fragment()
1998 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_get_caps1() local
1999 if (runtime->info & (SNDRV_PCM_INFO_BLOCK_TRANSFER|SNDRV_PCM_INFO_BATCH)) in snd_pcm_oss_get_caps1()
2022 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_simulate_fill() local
2024 appl_ptr = hw_ptr + runtime->buffer_size; in snd_pcm_oss_simulate_fill()
2025 appl_ptr %= runtime->boundary; in snd_pcm_oss_simulate_fill()
2026 runtime->control->appl_ptr = appl_ptr; in snd_pcm_oss_simulate_fill()
2031 struct snd_pcm_runtime *runtime; in snd_pcm_oss_set_trigger() local
2051 runtime = psubstream->runtime; in snd_pcm_oss_set_trigger()
2053 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2056 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2060 get_hw_ptr_period(runtime)); in snd_pcm_oss_set_trigger()
2061 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2062 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2065 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2067 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2068 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2070 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2073 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2081 runtime = csubstream->runtime; in snd_pcm_oss_set_trigger()
2083 if (mutex_lock_interruptible(&runtime->oss.params_lock)) in snd_pcm_oss_set_trigger()
2086 if (runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2088 runtime->oss.trigger = 1; in snd_pcm_oss_set_trigger()
2089 runtime->start_threshold = 1; in snd_pcm_oss_set_trigger()
2092 if (!runtime->oss.trigger) in snd_pcm_oss_set_trigger()
2094 runtime->oss.trigger = 0; in snd_pcm_oss_set_trigger()
2095 runtime->start_threshold = runtime->boundary; in snd_pcm_oss_set_trigger()
2097 runtime->oss.prepare = 1; in snd_pcm_oss_set_trigger()
2100 mutex_unlock(&runtime->oss.params_lock); in snd_pcm_oss_set_trigger()
2117 if (psubstream && psubstream->runtime && psubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2119 if (csubstream && csubstream->runtime && csubstream->runtime->oss.trigger) in snd_pcm_oss_get_trigger()
2127 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_odelay() local
2136 runtime = substream->runtime; in snd_pcm_oss_get_odelay()
2137 if (runtime->oss.params || runtime->oss.prepare) in snd_pcm_oss_get_odelay()
2150 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_ptr() local
2163 runtime = substream->runtime; in snd_pcm_oss_get_ptr()
2164 if (runtime->oss.params || runtime->oss.prepare) { in snd_pcm_oss_get_ptr()
2177 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2181 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_ptr()
2185 info.ptr = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr % runtime->buffer_size); in snd_pcm_oss_get_ptr()
2188 delay = get_hw_ptr_period(runtime); in snd_pcm_oss_get_ptr()
2189 n = delay - runtime->oss.prev_hw_ptr_period; in snd_pcm_oss_get_ptr()
2191 n += runtime->boundary; in snd_pcm_oss_get_ptr()
2192 info.blocks = n / runtime->period_size; in snd_pcm_oss_get_ptr()
2193 runtime->oss.prev_hw_ptr_period = delay; in snd_pcm_oss_get_ptr()
2196 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; in snd_pcm_oss_get_ptr()
2201 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2203 info.blocks = (delay + fixup) / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2204 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2207 info.blocks = delay / runtime->oss.period_bytes; in snd_pcm_oss_get_ptr()
2208 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; in snd_pcm_oss_get_ptr()
2219 struct snd_pcm_runtime *runtime; in snd_pcm_oss_get_space() local
2230 runtime = substream->runtime; in snd_pcm_oss_get_space()
2232 if (runtime->oss.params && in snd_pcm_oss_get_space()
2236 info.fragsize = runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2237 info.fragstotal = runtime->periods; in snd_pcm_oss_get_space()
2238 if (runtime->oss.prepare) { in snd_pcm_oss_get_space()
2240 info.bytes = runtime->oss.period_bytes * runtime->oss.periods; in snd_pcm_oss_get_space()
2241 info.fragments = runtime->oss.periods; in snd_pcm_oss_get_space()
2250 avail = runtime->buffer_size; in snd_pcm_oss_get_space()
2254 avail = runtime->buffer_size - avail; in snd_pcm_oss_get_space()
2255 fixup = -runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2259 fixup = runtime->oss.buffer_used; in snd_pcm_oss_get_space()
2264 info.fragments = info.bytes / runtime->oss.period_bytes; in snd_pcm_oss_get_space()
2316 struct snd_pcm_runtime *runtime; in snd_pcm_oss_release_substream() local
2317 runtime = substream->runtime; in snd_pcm_oss_release_substream()
2318 kvfree(runtime->oss.buffer); in snd_pcm_oss_release_substream()
2319 runtime->oss.buffer = NULL; in snd_pcm_oss_release_substream()
2330 struct snd_pcm_runtime *runtime; in snd_pcm_oss_init_substream() local
2338 runtime = substream->runtime; in snd_pcm_oss_init_substream()
2339 runtime->oss.params = 1; in snd_pcm_oss_init_substream()
2340 runtime->oss.trigger = 1; in snd_pcm_oss_init_substream()
2341 runtime->oss.rate = 8000; in snd_pcm_oss_init_substream()
2342 mutex_init(&runtime->oss.params_lock); in snd_pcm_oss_init_substream()
2345 runtime->oss.format = AFMT_U8; in snd_pcm_oss_init_substream()
2348 runtime->oss.format = AFMT_S16_LE; in snd_pcm_oss_init_substream()
2351 runtime->oss.format = AFMT_MU_LAW; in snd_pcm_oss_init_substream()
2353 runtime->oss.channels = 1; in snd_pcm_oss_init_substream()
2354 runtime->oss.fragshift = 0; in snd_pcm_oss_init_substream()
2355 runtime->oss.maxfrags = 0; in snd_pcm_oss_init_substream()
2356 runtime->oss.subdivision = 0; in snd_pcm_oss_init_substream()
2358 atomic_set(&runtime->oss.rw_ref, 0); in snd_pcm_oss_init_substream()
2775 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_playback_ready() local
2777 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_playback_ready()
2778 get_hw_ptr_period(runtime); in snd_pcm_oss_playback_ready()
2780 return snd_pcm_playback_avail(runtime) >= in snd_pcm_oss_playback_ready()
2781 runtime->oss.period_frames; in snd_pcm_oss_playback_ready()
2786 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_oss_capture_ready() local
2788 return runtime->oss.prev_hw_ptr_period != in snd_pcm_oss_capture_ready()
2789 get_hw_ptr_period(runtime); in snd_pcm_oss_capture_ready()
2791 return snd_pcm_capture_avail(runtime) >= in snd_pcm_oss_capture_ready()
2792 runtime->oss.period_frames; in snd_pcm_oss_capture_ready()
2808 struct snd_pcm_runtime *runtime = psubstream->runtime; in snd_pcm_oss_poll() local
2809 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2811 if (runtime->status->state != SNDRV_PCM_STATE_DRAINING && in snd_pcm_oss_poll()
2812 (runtime->status->state != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2818 struct snd_pcm_runtime *runtime = csubstream->runtime; in snd_pcm_oss_poll() local
2820 poll_wait(file, &runtime->sleep, wait); in snd_pcm_oss_poll()
2822 if ((ostate = runtime->status->state) != SNDRV_PCM_STATE_RUNNING || in snd_pcm_oss_poll()
2826 if (ostate != SNDRV_PCM_STATE_RUNNING && runtime->oss.trigger) { in snd_pcm_oss_poll()
2830 runtime->oss.trigger = 0; in snd_pcm_oss_poll()
2842 struct snd_pcm_runtime *runtime; in snd_pcm_oss_mmap() local
2869 runtime = substream->runtime; in snd_pcm_oss_mmap()
2870 if (!(runtime->info & SNDRV_PCM_INFO_MMAP_VALID)) in snd_pcm_oss_mmap()
2872 if (runtime->info & SNDRV_PCM_INFO_INTERLEAVED) in snd_pcm_oss_mmap()
2873 runtime->access = SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; in snd_pcm_oss_mmap()
2877 if (runtime->oss.params) { in snd_pcm_oss_mmap()
2887 if (runtime->oss.plugin_first != NULL) in snd_pcm_oss_mmap()
2897 runtime->oss.mmap_bytes = area->vm_end - area->vm_start; in snd_pcm_oss_mmap()
2898 runtime->silence_threshold = 0; in snd_pcm_oss_mmap()
2899 runtime->silence_size = 0; in snd_pcm_oss_mmap()
2902 runtime->oss.mmap_bytes); in snd_pcm_oss_mmap()
2905 runtime->stop_threshold = runtime->boundary; in snd_pcm_oss_mmap()