tree 4e7ce36dcef022ae6c29ef7461290fb32463a70c
parent 47123197c5522f4ae3dc5914e7832dd047f9ddc8
author Jaroslav Kysela <[EMAIL PROTECTED]> Tue, 16 Aug 2005 11:09:05 +0200
committer Jaroslav Kysela <[EMAIL PROTECTED]> Tue, 30 Aug 2005 08:46:18 +0200

[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 <[EMAIL PROTECTED]>

 include/sound/asound.h  |    6 +++++-
 sound/core/pcm_native.c |    4 ++--
 sound/core/timer.c      |   12 +++++++++---
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/sound/asound.h b/include/sound/asound.h
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -560,7 +560,7 @@ enum {
  *  Timer section - /dev/snd/timer
  */
 
-#define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 4)
+#define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 5)
 
 enum sndrv_timer_class {
        SNDRV_TIMER_CLASS_NONE = -1,
@@ -693,11 +693,15 @@ enum sndrv_timer_event {
        SNDRV_TIMER_EVENT_CONTINUE,             /* val = resolution in ns */
        SNDRV_TIMER_EVENT_PAUSE,                /* val = 0 */
        SNDRV_TIMER_EVENT_EARLY,                /* val = 0, early event */
+       SNDRV_TIMER_EVENT_SUSPEND,              /* val = 0 */
+       SNDRV_TIMER_EVENT_RESUME,               /* val = 0 */
        /* master timer events for slave timer instances */
        SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
        SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
        SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
        SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
+       SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
+       SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
 };
 
 struct sndrv_timer_tread {
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1025,7 +1025,7 @@ static void snd_pcm_post_suspend(snd_pcm
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_pcm_trigger_tstamp(substream);
        if (substream->timer)
-               snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, 
&runtime->trigger_tstamp);
+               snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, 
&runtime->trigger_tstamp);
        runtime->status->suspended_state = runtime->status->state;
        runtime->status->state = SNDRV_PCM_STATE_SUSPENDED;
        snd_pcm_tick_set(substream, 0);
@@ -1115,7 +1115,7 @@ static void snd_pcm_post_resume(snd_pcm_
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_pcm_trigger_tstamp(substream);
        if (substream->timer)
-               snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, 
&runtime->trigger_tstamp);
+               snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, 
&runtime->trigger_tstamp);
        runtime->status->state = runtime->status->suspended_state;
        if (runtime->sleep_min)
                snd_pcm_tick_prepare(substream);
diff --git a/sound/core/timer.c b/sound/core/timer.c
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -880,9 +880,11 @@ void snd_timer_notify(snd_timer_t *timer
        struct list_head *p, *n;
 
        snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return);      
-       snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= 
SNDRV_TIMER_EVENT_MPAUSE, return);
+       snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= 
SNDRV_TIMER_EVENT_MRESUME, return);
        spin_lock_irqsave(&timer->lock, flags);
-       if (event == SNDRV_TIMER_EVENT_MSTART || event == 
SNDRV_TIMER_EVENT_MCONTINUE) {
+       if (event == SNDRV_TIMER_EVENT_MSTART ||
+           event == SNDRV_TIMER_EVENT_MCONTINUE ||
+           event == SNDRV_TIMER_EVENT_MRESUME) {
                if (timer->hw.c_resolution)
                        resolution = timer->hw.c_resolution(timer);
                else
@@ -1555,10 +1557,14 @@ static int snd_timer_user_params(struct 
                              (1<<SNDRV_TIMER_EVENT_STOP)|
                              (1<<SNDRV_TIMER_EVENT_CONTINUE)|
                              (1<<SNDRV_TIMER_EVENT_PAUSE)|
+                             (1<<SNDRV_TIMER_EVENT_SUSPEND)|
+                             (1<<SNDRV_TIMER_EVENT_RESUME)|
                              (1<<SNDRV_TIMER_EVENT_MSTART)|
                              (1<<SNDRV_TIMER_EVENT_MSTOP)|
                              (1<<SNDRV_TIMER_EVENT_MCONTINUE)|
-                             (1<<SNDRV_TIMER_EVENT_MPAUSE))) {
+                             (1<<SNDRV_TIMER_EVENT_MPAUSE|
+                             (1<<SNDRV_TIMER_EVENT_MSUSPEND|
+                             (1<<SNDRV_TIMER_EVENT_MRESUME))) {
                err = -EINVAL;
                goto _end;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to