aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r--sound/core/timer.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index e7dc56ca4b97..7e5fe2d91662 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -44,11 +44,14 @@
44#endif 44#endif
45 45
46static int timer_limit = DEFAULT_TIMER_LIMIT; 46static int timer_limit = DEFAULT_TIMER_LIMIT;
47static int timer_tstamp_monotonic = 1;
47MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>"); 48MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>");
48MODULE_DESCRIPTION("ALSA timer interface"); 49MODULE_DESCRIPTION("ALSA timer interface");
49MODULE_LICENSE("GPL"); 50MODULE_LICENSE("GPL");
50module_param(timer_limit, int, 0444); 51module_param(timer_limit, int, 0444);
51MODULE_PARM_DESC(timer_limit, "Maximum global timers in system."); 52MODULE_PARM_DESC(timer_limit, "Maximum global timers in system.");
53module_param(timer_tstamp_monotonic, int, 0444);
54MODULE_PARM_DESC(timer_tstamp_monotonic, "Use posix monotonic clock source for timestamps (default).");
52 55
53struct snd_timer_user { 56struct snd_timer_user {
54 struct snd_timer_instance *timeri; 57 struct snd_timer_instance *timeri;
@@ -381,7 +384,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
381 struct snd_timer_instance *ts; 384 struct snd_timer_instance *ts;
382 struct timespec tstamp; 385 struct timespec tstamp;
383 386
384 getnstimeofday(&tstamp); 387 if (timer_tstamp_monotonic)
388 do_posix_clock_monotonic_gettime(&tstamp);
389 else
390 getnstimeofday(&tstamp);
385 snd_assert(event >= SNDRV_TIMER_EVENT_START && 391 snd_assert(event >= SNDRV_TIMER_EVENT_START &&
386 event <= SNDRV_TIMER_EVENT_PAUSE, return); 392 event <= SNDRV_TIMER_EVENT_PAUSE, return);
387 if (event == SNDRV_TIMER_EVENT_START || 393 if (event == SNDRV_TIMER_EVENT_START ||
@@ -1182,8 +1188,12 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
1182 spin_unlock(&tu->qlock); 1188 spin_unlock(&tu->qlock);
1183 return; 1189 return;
1184 } 1190 }
1185 if (tu->last_resolution != resolution || ticks > 0) 1191 if (tu->last_resolution != resolution || ticks > 0) {
1186 getnstimeofday(&tstamp); 1192 if (timer_tstamp_monotonic)
1193 do_posix_clock_monotonic_gettime(&tstamp);
1194 else
1195 getnstimeofday(&tstamp);
1196 }
1187 if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && 1197 if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) &&
1188 tu->last_resolution != resolution) { 1198 tu->last_resolution != resolution) {
1189 r1.event = SNDRV_TIMER_EVENT_RESOLUTION; 1199 r1.event = SNDRV_TIMER_EVENT_RESOLUTION;