]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/core/timer.c
tcp FRTO: work-around inorder receivers
[linux-2.6-omap-h63xx.git] / sound / core / timer.c
index f2bbacedd567eedb518c628e33fbdd8dd3691351..9d8184a2c2d06350f44d294fdabd3d4797c6b638 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Timers abstract layer
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,6 @@
  *
  */
 
-#include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #endif
 
 static int timer_limit = DEFAULT_TIMER_LIMIT;
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Takashi Iwai <tiwai@suse.de>");
+static int timer_tstamp_monotonic = 1;
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>");
 MODULE_DESCRIPTION("ALSA timer interface");
 MODULE_LICENSE("GPL");
 module_param(timer_limit, int, 0444);
 MODULE_PARM_DESC(timer_limit, "Maximum global timers in system.");
+module_param(timer_tstamp_monotonic, int, 0444);
+MODULE_PARM_DESC(timer_tstamp_monotonic, "Use posix monotonic clock source for timestamps (default).");
 
 struct snd_timer_user {
        struct snd_timer_instance *timeri;
@@ -148,8 +150,6 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
 
 static void snd_timer_request(struct snd_timer_id *tid)
 {
-       if (! current->fs->root)
-               return;
        switch (tid->dev_class) {
        case SNDRV_TIMER_CLASS_GLOBAL:
                if (tid->device < timer_limit)
@@ -381,7 +381,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
        struct snd_timer_instance *ts;
        struct timespec tstamp;
 
-       getnstimeofday(&tstamp);
+       if (timer_tstamp_monotonic)
+               do_posix_clock_monotonic_gettime(&tstamp);
+       else
+               getnstimeofday(&tstamp);
        snd_assert(event >= SNDRV_TIMER_EVENT_START &&
                   event <= SNDRV_TIMER_EVENT_PAUSE, return);
        if (event == SNDRV_TIMER_EVENT_START ||
@@ -1182,8 +1185,12 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
                spin_unlock(&tu->qlock);
                return;
        }
-       if (tu->last_resolution != resolution || ticks > 0)
-               getnstimeofday(&tstamp);
+       if (tu->last_resolution != resolution || ticks > 0) {
+               if (timer_tstamp_monotonic)
+                       do_posix_clock_monotonic_gettime(&tstamp);
+               else
+                       getnstimeofday(&tstamp);
+       }
        if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) &&
            tu->last_resolution != resolution) {
                r1.event = SNDRV_TIMER_EVENT_RESOLUTION;