Commit 4f7a5009 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Takashi Iwai <tiwai@suse.de>

Timer Midlevel,ALSA sequencer
Clemens Ladisch <clemens@ladisch.de>:

- fixed timer resolution calculations
  Some functions assumed that timer->hw.resolution is in Hz, while it's
  actually in ns/tick.
parent 81c3795c
...@@ -335,7 +335,7 @@ static int initialize_timer(seq_timer_t *tmr) ...@@ -335,7 +335,7 @@ static int initialize_timer(seq_timer_t *tmr)
if (! r && t->hw.c_resolution) if (! r && t->hw.c_resolution)
r = t->hw.c_resolution(t); r = t->hw.c_resolution(t);
if (r) { if (r) {
tmr->ticks = (unsigned int)(tmr->preferred_resolution / r); tmr->ticks = (unsigned int)(1000000000uL / (r * tmr->preferred_resolution));
if (! tmr->ticks) if (! tmr->ticks)
tmr->ticks = 1; tmr->ticks = 1;
} }
......
...@@ -47,7 +47,7 @@ typedef struct { ...@@ -47,7 +47,7 @@ typedef struct {
snd_timer_id_t alsa_id; /* ALSA's timer ID */ snd_timer_id_t alsa_id; /* ALSA's timer ID */
snd_timer_instance_t *timeri; /* timer instance */ snd_timer_instance_t *timeri; /* timer instance */
unsigned int ticks; unsigned int ticks;
unsigned long preferred_resolution; /* timer resolution */ unsigned long preferred_resolution; /* timer resolution, ticks/sec */
unsigned int skew; unsigned int skew;
unsigned int skew_base; unsigned int skew_base;
......
...@@ -1381,8 +1381,8 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstat ...@@ -1381,8 +1381,8 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstat
if (t->hw.precise_resolution) { if (t->hw.precise_resolution) {
t->hw.precise_resolution(t, &gstatus.resolution_num, &gstatus.resolution_den); t->hw.precise_resolution(t, &gstatus.resolution_num, &gstatus.resolution_den);
} else { } else {
gstatus.resolution_num = 1; gstatus.resolution_num = gstatus.resolution;
gstatus.resolution_den = gstatus.resolution; gstatus.resolution_den = 1000000000uL;
} }
} else { } else {
err = -ENODEV; err = -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment