diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-01-08 12:09:57 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:47 -0500 |
commit | 31e8960b35975ed235d283d6fb95d0e28dffded0 (patch) | |
tree | f084becc6e5dbec3efa1d79d0961facd68e585f9 | |
parent | 130755108ba03461f69da990e54e02a254accd23 (diff) |
[ALSA] Remove PCM sleep_min and tick
The 'tick' in PCM is set (again) via sw_params. And, nobody uses
this feature at all except for a command line option of aplay.
(This is literally 'nobody', as I checked alsa-lib API calls in all
programs in major distros.)
Above all, if we need finer wake-ups for the position update, it's
basically an issue that the driver should solve, not tuned by each
application.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | include/sound/pcm.h | 7 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 1 | ||||
-rw-r--r-- | sound/core/pcm.c | 11 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 113 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 30 |
5 files changed, 3 insertions, 159 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 1270cbce776a..51d58ccda2d8 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -274,7 +274,6 @@ struct snd_pcm_runtime { | |||
274 | snd_pcm_uframes_t period_size; /* period size */ | 274 | snd_pcm_uframes_t period_size; /* period size */ |
275 | unsigned int periods; /* periods */ | 275 | unsigned int periods; /* periods */ |
276 | snd_pcm_uframes_t buffer_size; /* buffer size */ | 276 | snd_pcm_uframes_t buffer_size; /* buffer size */ |
277 | unsigned int tick_time; /* tick time */ | ||
278 | snd_pcm_uframes_t min_align; /* Min alignment for the format */ | 277 | snd_pcm_uframes_t min_align; /* Min alignment for the format */ |
279 | size_t byte_align; | 278 | size_t byte_align; |
280 | unsigned int frame_bits; | 279 | unsigned int frame_bits; |
@@ -286,7 +285,6 @@ struct snd_pcm_runtime { | |||
286 | /* -- SW params -- */ | 285 | /* -- SW params -- */ |
287 | int tstamp_mode; /* mmap timestamp is updated */ | 286 | int tstamp_mode; /* mmap timestamp is updated */ |
288 | unsigned int period_step; | 287 | unsigned int period_step; |
289 | unsigned int sleep_min; /* min ticks to sleep */ | ||
290 | snd_pcm_uframes_t start_threshold; | 288 | snd_pcm_uframes_t start_threshold; |
291 | snd_pcm_uframes_t stop_threshold; | 289 | snd_pcm_uframes_t stop_threshold; |
292 | snd_pcm_uframes_t silence_threshold; /* Silence filling happens when | 290 | snd_pcm_uframes_t silence_threshold; /* Silence filling happens when |
@@ -305,7 +303,6 @@ struct snd_pcm_runtime { | |||
305 | 303 | ||
306 | /* -- locking / scheduling -- */ | 304 | /* -- locking / scheduling -- */ |
307 | wait_queue_head_t sleep; | 305 | wait_queue_head_t sleep; |
308 | struct timer_list tick_timer; | ||
309 | struct fasync_struct *fasync; | 306 | struct fasync_struct *fasync; |
310 | 307 | ||
311 | /* -- private section -- */ | 308 | /* -- private section -- */ |
@@ -810,7 +807,6 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc | |||
810 | #define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min | 807 | #define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min |
811 | #define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min | 808 | #define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min |
812 | #define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min | 809 | #define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min |
813 | #define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min | ||
814 | 810 | ||
815 | 811 | ||
816 | int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); | 812 | int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); |
@@ -908,9 +904,6 @@ int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); | |||
908 | int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream); | 904 | int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream); |
909 | int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream); | 905 | int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream); |
910 | void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr); | 906 | void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr); |
911 | void snd_pcm_tick_prepare(struct snd_pcm_substream *substream); | ||
912 | void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks); | ||
913 | void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream); | ||
914 | void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); | 907 | void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); |
915 | snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, | 908 | snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, |
916 | const void __user *buf, | 909 | const void __user *buf, |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index be089ccd736d..f7f15e399842 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -985,7 +985,6 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
985 | sw_params->stop_threshold = runtime->buffer_size; | 985 | sw_params->stop_threshold = runtime->buffer_size; |
986 | sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; | 986 | sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; |
987 | sw_params->period_step = 1; | 987 | sw_params->period_step = 1; |
988 | sw_params->sleep_min = 0; | ||
989 | sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | 988 | sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? |
990 | 1 : runtime->period_size; | 989 | 1 : runtime->period_size; |
991 | if (atomic_read(&substream->mmap_count) || | 990 | if (atomic_read(&substream->mmap_count) || |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 97cb681502a3..cf3af39c3514 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -359,7 +359,6 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry, | |||
359 | snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); | 359 | snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); |
360 | snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); | 360 | snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); |
361 | snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); | 361 | snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); |
362 | snd_iprintf(buffer, "tick_time: %u\n", runtime->tick_time); | ||
363 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 362 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
364 | if (substream->oss.oss) { | 363 | if (substream->oss.oss) { |
365 | snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format)); | 364 | snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format)); |
@@ -387,7 +386,6 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, | |||
387 | } | 386 | } |
388 | snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode)); | 387 | snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode)); |
389 | snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); | 388 | snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); |
390 | snd_iprintf(buffer, "sleep_min: %u\n", runtime->sleep_min); | ||
391 | snd_iprintf(buffer, "avail_min: %lu\n", runtime->control->avail_min); | 389 | snd_iprintf(buffer, "avail_min: %lu\n", runtime->control->avail_min); |
392 | snd_iprintf(buffer, "start_threshold: %lu\n", runtime->start_threshold); | 390 | snd_iprintf(buffer, "start_threshold: %lu\n", runtime->start_threshold); |
393 | snd_iprintf(buffer, "stop_threshold: %lu\n", runtime->stop_threshold); | 391 | snd_iprintf(buffer, "stop_threshold: %lu\n", runtime->stop_threshold); |
@@ -764,12 +762,6 @@ static int snd_pcm_dev_free(struct snd_device *device) | |||
764 | return snd_pcm_free(pcm); | 762 | return snd_pcm_free(pcm); |
765 | } | 763 | } |
766 | 764 | ||
767 | static void snd_pcm_tick_timer_func(unsigned long data) | ||
768 | { | ||
769 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *) data; | ||
770 | snd_pcm_tick_elapsed(substream); | ||
771 | } | ||
772 | |||
773 | int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | 765 | int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, |
774 | struct file *file, | 766 | struct file *file, |
775 | struct snd_pcm_substream **rsubstream) | 767 | struct snd_pcm_substream **rsubstream) |
@@ -876,9 +868,6 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | |||
876 | memset((void*)runtime->control, 0, size); | 868 | memset((void*)runtime->control, 0, size); |
877 | 869 | ||
878 | init_waitqueue_head(&runtime->sleep); | 870 | init_waitqueue_head(&runtime->sleep); |
879 | init_timer(&runtime->tick_timer); | ||
880 | runtime->tick_timer.function = snd_pcm_tick_timer_func; | ||
881 | runtime->tick_timer.data = (unsigned long) substream; | ||
882 | 871 | ||
883 | runtime->status->state = SNDRV_PCM_STATE_OPEN; | 872 | runtime->status->state = SNDRV_PCM_STATE_OPEN; |
884 | 873 | ||
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index b406630d8fdf..f00758c2bded 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1451,112 +1451,13 @@ int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, | |||
1451 | 1451 | ||
1452 | EXPORT_SYMBOL(snd_pcm_lib_ioctl); | 1452 | EXPORT_SYMBOL(snd_pcm_lib_ioctl); |
1453 | 1453 | ||
1454 | /* | ||
1455 | * Conditions | ||
1456 | */ | ||
1457 | |||
1458 | static void snd_pcm_system_tick_set(struct snd_pcm_substream *substream, | ||
1459 | unsigned long ticks) | ||
1460 | { | ||
1461 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1462 | if (ticks == 0) | ||
1463 | del_timer(&runtime->tick_timer); | ||
1464 | else { | ||
1465 | ticks += (1000000 / HZ) - 1; | ||
1466 | ticks /= (1000000 / HZ); | ||
1467 | mod_timer(&runtime->tick_timer, jiffies + ticks); | ||
1468 | } | ||
1469 | } | ||
1470 | |||
1471 | /* Temporary alias */ | ||
1472 | void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks) | ||
1473 | { | ||
1474 | snd_pcm_system_tick_set(substream, ticks); | ||
1475 | } | ||
1476 | |||
1477 | void snd_pcm_tick_prepare(struct snd_pcm_substream *substream) | ||
1478 | { | ||
1479 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1480 | snd_pcm_uframes_t frames = ULONG_MAX; | ||
1481 | snd_pcm_uframes_t avail, dist; | ||
1482 | unsigned int ticks; | ||
1483 | u_int64_t n; | ||
1484 | u_int32_t r; | ||
1485 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
1486 | if (runtime->silence_size >= runtime->boundary) { | ||
1487 | frames = 1; | ||
1488 | } else if (runtime->silence_size > 0 && | ||
1489 | runtime->silence_filled < runtime->buffer_size) { | ||
1490 | snd_pcm_sframes_t noise_dist; | ||
1491 | noise_dist = snd_pcm_playback_hw_avail(runtime) + runtime->silence_filled; | ||
1492 | if (noise_dist > (snd_pcm_sframes_t)runtime->silence_threshold) | ||
1493 | frames = noise_dist - runtime->silence_threshold; | ||
1494 | } | ||
1495 | avail = snd_pcm_playback_avail(runtime); | ||
1496 | } else { | ||
1497 | avail = snd_pcm_capture_avail(runtime); | ||
1498 | } | ||
1499 | if (avail < runtime->control->avail_min) { | ||
1500 | snd_pcm_sframes_t to_avail_min = | ||
1501 | runtime->control->avail_min - avail; | ||
1502 | if (to_avail_min > 0 && | ||
1503 | frames > (snd_pcm_uframes_t)to_avail_min) | ||
1504 | frames = to_avail_min; | ||
1505 | } | ||
1506 | if (avail < runtime->buffer_size) { | ||
1507 | snd_pcm_sframes_t to_buffer_size = | ||
1508 | runtime->buffer_size - avail; | ||
1509 | if (to_buffer_size > 0 && | ||
1510 | frames > (snd_pcm_uframes_t)to_buffer_size) | ||
1511 | frames = to_buffer_size; | ||
1512 | } | ||
1513 | if (frames == ULONG_MAX) { | ||
1514 | snd_pcm_tick_set(substream, 0); | ||
1515 | return; | ||
1516 | } | ||
1517 | dist = runtime->status->hw_ptr - runtime->hw_ptr_base; | ||
1518 | /* Distance to next interrupt */ | ||
1519 | dist = runtime->period_size - dist % runtime->period_size; | ||
1520 | if (dist <= frames) { | ||
1521 | snd_pcm_tick_set(substream, 0); | ||
1522 | return; | ||
1523 | } | ||
1524 | /* the base time is us */ | ||
1525 | n = frames; | ||
1526 | n *= 1000000; | ||
1527 | div64_32(&n, runtime->tick_time * runtime->rate, &r); | ||
1528 | ticks = n + (r > 0 ? 1 : 0); | ||
1529 | if (ticks < runtime->sleep_min) | ||
1530 | ticks = runtime->sleep_min; | ||
1531 | snd_pcm_tick_set(substream, (unsigned long) ticks); | ||
1532 | } | ||
1533 | |||
1534 | void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream) | ||
1535 | { | ||
1536 | struct snd_pcm_runtime *runtime; | ||
1537 | unsigned long flags; | ||
1538 | |||
1539 | snd_assert(substream != NULL, return); | ||
1540 | runtime = substream->runtime; | ||
1541 | snd_assert(runtime != NULL, return); | ||
1542 | |||
1543 | snd_pcm_stream_lock_irqsave(substream, flags); | ||
1544 | if (!snd_pcm_running(substream) || | ||
1545 | snd_pcm_update_hw_ptr(substream) < 0) | ||
1546 | goto _end; | ||
1547 | if (runtime->sleep_min) | ||
1548 | snd_pcm_tick_prepare(substream); | ||
1549 | _end: | ||
1550 | snd_pcm_stream_unlock_irqrestore(substream, flags); | ||
1551 | } | ||
1552 | |||
1553 | /** | 1454 | /** |
1554 | * snd_pcm_period_elapsed - update the pcm status for the next period | 1455 | * snd_pcm_period_elapsed - update the pcm status for the next period |
1555 | * @substream: the pcm substream instance | 1456 | * @substream: the pcm substream instance |
1556 | * | 1457 | * |
1557 | * This function is called from the interrupt handler when the | 1458 | * This function is called from the interrupt handler when the |
1558 | * PCM has processed the period size. It will update the current | 1459 | * PCM has processed the period size. It will update the current |
1559 | * pointer, set up the tick, wake up sleepers, etc. | 1460 | * pointer, wake up sleepers, etc. |
1560 | * | 1461 | * |
1561 | * Even if more than one periods have elapsed since the last call, you | 1462 | * Even if more than one periods have elapsed since the last call, you |
1562 | * have to call this only once. | 1463 | * have to call this only once. |
@@ -1580,8 +1481,6 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) | |||
1580 | 1481 | ||
1581 | if (substream->timer_running) | 1482 | if (substream->timer_running) |
1582 | snd_timer_interrupt(substream->timer, 1); | 1483 | snd_timer_interrupt(substream->timer, 1); |
1583 | if (runtime->sleep_min) | ||
1584 | snd_pcm_tick_prepare(substream); | ||
1585 | _end: | 1484 | _end: |
1586 | snd_pcm_stream_unlock_irqrestore(substream, flags); | 1485 | snd_pcm_stream_unlock_irqrestore(substream, flags); |
1587 | if (runtime->transfer_ack_end) | 1486 | if (runtime->transfer_ack_end) |
@@ -1715,7 +1614,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1715 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; | 1614 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; |
1716 | snd_pcm_uframes_t avail; | 1615 | snd_pcm_uframes_t avail; |
1717 | snd_pcm_uframes_t cont; | 1616 | snd_pcm_uframes_t cont; |
1718 | if (runtime->sleep_min == 0 && runtime->status->state == SNDRV_PCM_STATE_RUNNING) | 1617 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) |
1719 | snd_pcm_update_hw_ptr(substream); | 1618 | snd_pcm_update_hw_ptr(substream); |
1720 | avail = snd_pcm_playback_avail(runtime); | 1619 | avail = snd_pcm_playback_avail(runtime); |
1721 | if (!avail) { | 1620 | if (!avail) { |
@@ -1764,9 +1663,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1764 | if (err < 0) | 1663 | if (err < 0) |
1765 | goto _end_unlock; | 1664 | goto _end_unlock; |
1766 | } | 1665 | } |
1767 | if (runtime->sleep_min && | ||
1768 | runtime->status->state == SNDRV_PCM_STATE_RUNNING) | ||
1769 | snd_pcm_tick_prepare(substream); | ||
1770 | } | 1666 | } |
1771 | _end_unlock: | 1667 | _end_unlock: |
1772 | snd_pcm_stream_unlock_irq(substream); | 1668 | snd_pcm_stream_unlock_irq(substream); |
@@ -1923,7 +1819,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
1923 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; | 1819 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; |
1924 | snd_pcm_uframes_t avail; | 1820 | snd_pcm_uframes_t avail; |
1925 | snd_pcm_uframes_t cont; | 1821 | snd_pcm_uframes_t cont; |
1926 | if (runtime->sleep_min == 0 && runtime->status->state == SNDRV_PCM_STATE_RUNNING) | 1822 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) |
1927 | snd_pcm_update_hw_ptr(substream); | 1823 | snd_pcm_update_hw_ptr(substream); |
1928 | avail = snd_pcm_capture_avail(runtime); | 1824 | avail = snd_pcm_capture_avail(runtime); |
1929 | if (!avail) { | 1825 | if (!avail) { |
@@ -1973,9 +1869,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
1973 | offset += frames; | 1869 | offset += frames; |
1974 | size -= frames; | 1870 | size -= frames; |
1975 | xfer += frames; | 1871 | xfer += frames; |
1976 | if (runtime->sleep_min && | ||
1977 | runtime->status->state == SNDRV_PCM_STATE_RUNNING) | ||
1978 | snd_pcm_tick_prepare(substream); | ||
1979 | } | 1872 | } |
1980 | _end_unlock: | 1873 | _end_unlock: |
1981 | snd_pcm_stream_unlock_irq(substream); | 1874 | snd_pcm_stream_unlock_irq(substream); |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 3c22d78ee8f4..d6b4e6b6108f 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -413,7 +413,6 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
413 | runtime->period_size = params_period_size(params); | 413 | runtime->period_size = params_period_size(params); |
414 | runtime->periods = params_periods(params); | 414 | runtime->periods = params_periods(params); |
415 | runtime->buffer_size = params_buffer_size(params); | 415 | runtime->buffer_size = params_buffer_size(params); |
416 | runtime->tick_time = params_tick_time(params); | ||
417 | runtime->info = params->info; | 416 | runtime->info = params->info; |
418 | runtime->rate_num = params->rate_num; | 417 | runtime->rate_num = params->rate_num; |
419 | runtime->rate_den = params->rate_den; | 418 | runtime->rate_den = params->rate_den; |
@@ -433,7 +432,6 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
433 | /* Default sw params */ | 432 | /* Default sw params */ |
434 | runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; | 433 | runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; |
435 | runtime->period_step = 1; | 434 | runtime->period_step = 1; |
436 | runtime->sleep_min = 0; | ||
437 | runtime->control->avail_min = runtime->period_size; | 435 | runtime->control->avail_min = runtime->period_size; |
438 | runtime->start_threshold = 1; | 436 | runtime->start_threshold = 1; |
439 | runtime->stop_threshold = runtime->buffer_size; | 437 | runtime->stop_threshold = runtime->buffer_size; |
@@ -542,7 +540,6 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, | |||
542 | } | 540 | } |
543 | snd_pcm_stream_lock_irq(substream); | 541 | snd_pcm_stream_lock_irq(substream); |
544 | runtime->tstamp_mode = params->tstamp_mode; | 542 | runtime->tstamp_mode = params->tstamp_mode; |
545 | runtime->sleep_min = params->sleep_min; | ||
546 | runtime->period_step = params->period_step; | 543 | runtime->period_step = params->period_step; |
547 | runtime->control->avail_min = params->avail_min; | 544 | runtime->control->avail_min = params->avail_min; |
548 | runtime->start_threshold = params->start_threshold; | 545 | runtime->start_threshold = params->start_threshold; |
@@ -551,10 +548,6 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, | |||
551 | runtime->silence_size = params->silence_size; | 548 | runtime->silence_size = params->silence_size; |
552 | params->boundary = runtime->boundary; | 549 | params->boundary = runtime->boundary; |
553 | if (snd_pcm_running(substream)) { | 550 | if (snd_pcm_running(substream)) { |
554 | if (runtime->sleep_min) | ||
555 | snd_pcm_tick_prepare(substream); | ||
556 | else | ||
557 | snd_pcm_tick_set(substream, 0); | ||
558 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 551 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
559 | runtime->silence_size > 0) | 552 | runtime->silence_size > 0) |
560 | snd_pcm_playback_silence(substream, ULONG_MAX); | 553 | snd_pcm_playback_silence(substream, ULONG_MAX); |
@@ -865,8 +858,6 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) | |||
865 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 858 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
866 | runtime->silence_size > 0) | 859 | runtime->silence_size > 0) |
867 | snd_pcm_playback_silence(substream, ULONG_MAX); | 860 | snd_pcm_playback_silence(substream, ULONG_MAX); |
868 | if (runtime->sleep_min) | ||
869 | snd_pcm_tick_prepare(substream); | ||
870 | if (substream->timer) | 861 | if (substream->timer) |
871 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, | 862 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, |
872 | &runtime->trigger_tstamp); | 863 | &runtime->trigger_tstamp); |
@@ -920,7 +911,6 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) | |||
920 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, | 911 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, |
921 | &runtime->trigger_tstamp); | 912 | &runtime->trigger_tstamp); |
922 | runtime->status->state = state; | 913 | runtime->status->state = state; |
923 | snd_pcm_tick_set(substream, 0); | ||
924 | } | 914 | } |
925 | wake_up(&runtime->sleep); | 915 | wake_up(&runtime->sleep); |
926 | } | 916 | } |
@@ -1004,12 +994,9 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) | |||
1004 | snd_timer_notify(substream->timer, | 994 | snd_timer_notify(substream->timer, |
1005 | SNDRV_TIMER_EVENT_MPAUSE, | 995 | SNDRV_TIMER_EVENT_MPAUSE, |
1006 | &runtime->trigger_tstamp); | 996 | &runtime->trigger_tstamp); |
1007 | snd_pcm_tick_set(substream, 0); | ||
1008 | wake_up(&runtime->sleep); | 997 | wake_up(&runtime->sleep); |
1009 | } else { | 998 | } else { |
1010 | runtime->status->state = SNDRV_PCM_STATE_RUNNING; | 999 | runtime->status->state = SNDRV_PCM_STATE_RUNNING; |
1011 | if (runtime->sleep_min) | ||
1012 | snd_pcm_tick_prepare(substream); | ||
1013 | if (substream->timer) | 1000 | if (substream->timer) |
1014 | snd_timer_notify(substream->timer, | 1001 | snd_timer_notify(substream->timer, |
1015 | SNDRV_TIMER_EVENT_MCONTINUE, | 1002 | SNDRV_TIMER_EVENT_MCONTINUE, |
@@ -1064,7 +1051,6 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) | |||
1064 | &runtime->trigger_tstamp); | 1051 | &runtime->trigger_tstamp); |
1065 | runtime->status->suspended_state = runtime->status->state; | 1052 | runtime->status->suspended_state = runtime->status->state; |
1066 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1053 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1067 | snd_pcm_tick_set(substream, 0); | ||
1068 | wake_up(&runtime->sleep); | 1054 | wake_up(&runtime->sleep); |
1069 | } | 1055 | } |
1070 | 1056 | ||
@@ -1167,8 +1153,6 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) | |||
1167 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, | 1153 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, |
1168 | &runtime->trigger_tstamp); | 1154 | &runtime->trigger_tstamp); |
1169 | runtime->status->state = runtime->status->suspended_state; | 1155 | runtime->status->state = runtime->status->suspended_state; |
1170 | if (runtime->sleep_min) | ||
1171 | snd_pcm_tick_prepare(substream); | ||
1172 | } | 1156 | } |
1173 | 1157 | ||
1174 | static struct action_ops snd_pcm_action_resume = { | 1158 | static struct action_ops snd_pcm_action_resume = { |
@@ -1997,8 +1981,6 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) | |||
1997 | } | 1981 | } |
1998 | 1982 | ||
1999 | /* FIXME: this belong to lowlevel */ | 1983 | /* FIXME: this belong to lowlevel */ |
2000 | snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_TICK_TIME, | ||
2001 | 1000000 / HZ, 1000000 / HZ); | ||
2002 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); | 1984 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); |
2003 | 1985 | ||
2004 | return 0; | 1986 | return 0; |
@@ -2238,9 +2220,6 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *subst | |||
2238 | if (appl_ptr < 0) | 2220 | if (appl_ptr < 0) |
2239 | appl_ptr += runtime->boundary; | 2221 | appl_ptr += runtime->boundary; |
2240 | runtime->control->appl_ptr = appl_ptr; | 2222 | runtime->control->appl_ptr = appl_ptr; |
2241 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && | ||
2242 | runtime->sleep_min) | ||
2243 | snd_pcm_tick_prepare(substream); | ||
2244 | ret = frames; | 2223 | ret = frames; |
2245 | __end: | 2224 | __end: |
2246 | snd_pcm_stream_unlock_irq(substream); | 2225 | snd_pcm_stream_unlock_irq(substream); |
@@ -2286,9 +2265,6 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substr | |||
2286 | if (appl_ptr < 0) | 2265 | if (appl_ptr < 0) |
2287 | appl_ptr += runtime->boundary; | 2266 | appl_ptr += runtime->boundary; |
2288 | runtime->control->appl_ptr = appl_ptr; | 2267 | runtime->control->appl_ptr = appl_ptr; |
2289 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && | ||
2290 | runtime->sleep_min) | ||
2291 | snd_pcm_tick_prepare(substream); | ||
2292 | ret = frames; | 2268 | ret = frames; |
2293 | __end: | 2269 | __end: |
2294 | snd_pcm_stream_unlock_irq(substream); | 2270 | snd_pcm_stream_unlock_irq(substream); |
@@ -2335,9 +2311,6 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *subs | |||
2335 | if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) | 2311 | if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) |
2336 | appl_ptr -= runtime->boundary; | 2312 | appl_ptr -= runtime->boundary; |
2337 | runtime->control->appl_ptr = appl_ptr; | 2313 | runtime->control->appl_ptr = appl_ptr; |
2338 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && | ||
2339 | runtime->sleep_min) | ||
2340 | snd_pcm_tick_prepare(substream); | ||
2341 | ret = frames; | 2314 | ret = frames; |
2342 | __end: | 2315 | __end: |
2343 | snd_pcm_stream_unlock_irq(substream); | 2316 | snd_pcm_stream_unlock_irq(substream); |
@@ -2384,9 +2357,6 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *subst | |||
2384 | if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) | 2357 | if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) |
2385 | appl_ptr -= runtime->boundary; | 2358 | appl_ptr -= runtime->boundary; |
2386 | runtime->control->appl_ptr = appl_ptr; | 2359 | runtime->control->appl_ptr = appl_ptr; |
2387 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && | ||
2388 | runtime->sleep_min) | ||
2389 | snd_pcm_tick_prepare(substream); | ||
2390 | ret = frames; | 2360 | ret = frames; |
2391 | __end: | 2361 | __end: |
2392 | snd_pcm_stream_unlock_irq(substream); | 2362 | snd_pcm_stream_unlock_irq(substream); |