aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/timer.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-02-03 02:29:41 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2008-02-03 02:30:32 -0500
commitc1f3ee120bb61045b1c0a3ead620d1d65af47130 (patch)
tree908430bf2b47fe8e96ac623ae7ab6dd5698d0938 /sound/core/timer.c
parente619a75ff6201b567a539e787aa9af9bc63a3187 (diff)
parent9135f1901ee6449dfe338adf6e40e9c2025b8150 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r--sound/core/timer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index e7dc56ca4b97..aece465934b8 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
@@ -44,11 +43,14 @@
44#endif 43#endif
45 44
46static int timer_limit = DEFAULT_TIMER_LIMIT; 45static int timer_limit = DEFAULT_TIMER_LIMIT;
46static int timer_tstamp_monotonic = 1;
47MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>"); 47MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>");
48MODULE_DESCRIPTION("ALSA timer interface"); 48MODULE_DESCRIPTION("ALSA timer interface");
49MODULE_LICENSE("GPL"); 49MODULE_LICENSE("GPL");
50module_param(timer_limit, int, 0444); 50module_param(timer_limit, int, 0444);
51MODULE_PARM_DESC(timer_limit, "Maximum global timers in system."); 51MODULE_PARM_DESC(timer_limit, "Maximum global timers in system.");
52module_param(timer_tstamp_monotonic, int, 0444);
53MODULE_PARM_DESC(timer_tstamp_monotonic, "Use posix monotonic clock source for timestamps (default).");
52 54
53struct snd_timer_user { 55struct snd_timer_user {
54 struct snd_timer_instance *timeri; 56 struct snd_timer_instance *timeri;
@@ -381,7 +383,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
381 struct snd_timer_instance *ts; 383 struct snd_timer_instance *ts;
382 struct timespec tstamp; 384 struct timespec tstamp;
383 385
384 getnstimeofday(&tstamp); 386 if (timer_tstamp_monotonic)
387 do_posix_clock_monotonic_gettime(&tstamp);
388 else
389 getnstimeofday(&tstamp);
385 snd_assert(event >= SNDRV_TIMER_EVENT_START && 390 snd_assert(event >= SNDRV_TIMER_EVENT_START &&
386 event <= SNDRV_TIMER_EVENT_PAUSE, return); 391 event <= SNDRV_TIMER_EVENT_PAUSE, return);
387 if (event == SNDRV_TIMER_EVENT_START || 392 if (event == SNDRV_TIMER_EVENT_START ||
@@ -1182,8 +1187,12 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
1182 spin_unlock(&tu->qlock); 1187 spin_unlock(&tu->qlock);
1183 return; 1188 return;
1184 } 1189 }
1185 if (tu->last_resolution != resolution || ticks > 0) 1190 if (tu->last_resolution != resolution || ticks > 0) {
1186 getnstimeofday(&tstamp); 1191 if (timer_tstamp_monotonic)
1192 do_posix_clock_monotonic_gettime(&tstamp);
1193 else
1194 getnstimeofday(&tstamp);
1195 }
1187 if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && 1196 if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) &&
1188 tu->last_resolution != resolution) { 1197 tu->last_resolution != resolution) {
1189 r1.event = SNDRV_TIMER_EVENT_RESOLUTION; 1198 r1.event = SNDRV_TIMER_EVENT_RESOLUTION;