aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/seq/seq_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/seq/seq_timer.c')
-rw-r--r--sound/core/seq/seq_timer.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index b80985fbc334..23167578231f 100644
--- a/sound/core/seq/seq_timer.c
+++ b/sound/core/seq/seq_timer.c
@@ -191,14 +191,15 @@ int snd_seq_timer_set_tempo(struct snd_seq_timer * tmr, int tempo)
191 return 0; 191 return 0;
192} 192}
193 193
194/* set current ppq */ 194/* set current tempo and ppq in a shot */
195int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq) 195int snd_seq_timer_set_tempo_ppq(struct snd_seq_timer *tmr, int tempo, int ppq)
196{ 196{
197 int changed;
197 unsigned long flags; 198 unsigned long flags;
198 199
199 if (snd_BUG_ON(!tmr)) 200 if (snd_BUG_ON(!tmr))
200 return -EINVAL; 201 return -EINVAL;
201 if (ppq <= 0) 202 if (tempo <= 0 || ppq <= 0)
202 return -EINVAL; 203 return -EINVAL;
203 spin_lock_irqsave(&tmr->lock, flags); 204 spin_lock_irqsave(&tmr->lock, flags);
204 if (tmr->running && (ppq != tmr->ppq)) { 205 if (tmr->running && (ppq != tmr->ppq)) {
@@ -208,9 +209,11 @@ int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq)
208 pr_debug("ALSA: seq: cannot change ppq of a running timer\n"); 209 pr_debug("ALSA: seq: cannot change ppq of a running timer\n");
209 return -EBUSY; 210 return -EBUSY;
210 } 211 }
211 212 changed = (tempo != tmr->tempo) || (ppq != tmr->ppq);
213 tmr->tempo = tempo;
212 tmr->ppq = ppq; 214 tmr->ppq = ppq;
213 snd_seq_timer_set_tick_resolution(tmr); 215 if (changed)
216 snd_seq_timer_set_tick_resolution(tmr);
214 spin_unlock_irqrestore(&tmr->lock, flags); 217 spin_unlock_irqrestore(&tmr->lock, flags);
215 return 0; 218 return 0;
216} 219}