diff options
author | Jaroslav Kysela <perex@suse.cz> | 2005-08-16 05:09:05 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-08-30 02:46:18 -0400 |
commit | a501dfa3a763451dedd583eb90a6c9e90d0e3a3c (patch) | |
tree | 4e7ce36dcef022ae6c29ef7461290fb32463a70c /sound | |
parent | 47123197c5522f4ae3dc5914e7832dd047f9ddc8 (diff) |
[ALSA] Timer API - added SUSPEND/RESUME events
PCM Midlevel,Timer Midlevel,ALSA Core
- added SNDRV_TIMER_EVENT_SUSPEND / RESUME events
- changed timer events from PAUSE / CONTINUE in PCM midlevel to SUSPEND / RESUME
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_native.c | 4 | ||||
-rw-r--r-- | sound/core/timer.c | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 5041be25d75b..03c17159dd8e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1025,7 +1025,7 @@ static void snd_pcm_post_suspend(snd_pcm_substream_t *substream, int state) | |||
1025 | snd_pcm_runtime_t *runtime = substream->runtime; | 1025 | snd_pcm_runtime_t *runtime = substream->runtime; |
1026 | snd_pcm_trigger_tstamp(substream); | 1026 | snd_pcm_trigger_tstamp(substream); |
1027 | if (substream->timer) | 1027 | if (substream->timer) |
1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); | 1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, &runtime->trigger_tstamp); |
1029 | runtime->status->suspended_state = runtime->status->state; | 1029 | runtime->status->suspended_state = runtime->status->state; |
1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1031 | snd_pcm_tick_set(substream, 0); | 1031 | snd_pcm_tick_set(substream, 0); |
@@ -1115,7 +1115,7 @@ static void snd_pcm_post_resume(snd_pcm_substream_t *substream, int state) | |||
1115 | snd_pcm_runtime_t *runtime = substream->runtime; | 1115 | snd_pcm_runtime_t *runtime = substream->runtime; |
1116 | snd_pcm_trigger_tstamp(substream); | 1116 | snd_pcm_trigger_tstamp(substream); |
1117 | if (substream->timer) | 1117 | if (substream->timer) |
1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, &runtime->trigger_tstamp); | 1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); |
1119 | runtime->status->state = runtime->status->suspended_state; | 1119 | runtime->status->state = runtime->status->suspended_state; |
1120 | if (runtime->sleep_min) | 1120 | if (runtime->sleep_min) |
1121 | snd_pcm_tick_prepare(substream); | 1121 | snd_pcm_tick_prepare(substream); |
diff --git a/sound/core/timer.c b/sound/core/timer.c index c3997e047214..56bd383a06c2 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -880,9 +880,11 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t | |||
880 | struct list_head *p, *n; | 880 | struct list_head *p, *n; |
881 | 881 | ||
882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); | 882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); |
883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MPAUSE, return); | 883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MRESUME, return); |
884 | spin_lock_irqsave(&timer->lock, flags); | 884 | spin_lock_irqsave(&timer->lock, flags); |
885 | if (event == SNDRV_TIMER_EVENT_MSTART || event == SNDRV_TIMER_EVENT_MCONTINUE) { | 885 | if (event == SNDRV_TIMER_EVENT_MSTART || |
886 | event == SNDRV_TIMER_EVENT_MCONTINUE || | ||
887 | event == SNDRV_TIMER_EVENT_MRESUME) { | ||
886 | if (timer->hw.c_resolution) | 888 | if (timer->hw.c_resolution) |
887 | resolution = timer->hw.c_resolution(timer); | 889 | resolution = timer->hw.c_resolution(timer); |
888 | else | 890 | else |
@@ -1555,10 +1557,14 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1555 | (1<<SNDRV_TIMER_EVENT_STOP)| | 1557 | (1<<SNDRV_TIMER_EVENT_STOP)| |
1556 | (1<<SNDRV_TIMER_EVENT_CONTINUE)| | 1558 | (1<<SNDRV_TIMER_EVENT_CONTINUE)| |
1557 | (1<<SNDRV_TIMER_EVENT_PAUSE)| | 1559 | (1<<SNDRV_TIMER_EVENT_PAUSE)| |
1560 | (1<<SNDRV_TIMER_EVENT_SUSPEND)| | ||
1561 | (1<<SNDRV_TIMER_EVENT_RESUME)| | ||
1558 | (1<<SNDRV_TIMER_EVENT_MSTART)| | 1562 | (1<<SNDRV_TIMER_EVENT_MSTART)| |
1559 | (1<<SNDRV_TIMER_EVENT_MSTOP)| | 1563 | (1<<SNDRV_TIMER_EVENT_MSTOP)| |
1560 | (1<<SNDRV_TIMER_EVENT_MCONTINUE)| | 1564 | (1<<SNDRV_TIMER_EVENT_MCONTINUE)| |
1561 | (1<<SNDRV_TIMER_EVENT_MPAUSE))) { | 1565 | (1<<SNDRV_TIMER_EVENT_MPAUSE| |
1566 | (1<<SNDRV_TIMER_EVENT_MSUSPEND| | ||
1567 | (1<<SNDRV_TIMER_EVENT_MRESUME))) { | ||
1562 | err = -EINVAL; | 1568 | err = -EINVAL; |
1563 | goto _end; | 1569 | goto _end; |
1564 | } | 1570 | } |