PD#SWPL-972
Problem:
audio crash when ATV switch channel long time burning test
Solution:
there is a risk to fetch the timer lock. when input stop, stop_timer
will call del_timer, at the same time the function
"aml_i2s_hrtimer_callback" is waiting for the timer lock,after
stop_timer release the lock,"aml_i2s_hrtimer_callback" get the
lock and call mod_timer again, which will set the timer to pending
status. It will cause the next "start input" stage,add_timer will
trigger BUG_ON.Now we put the lock before the active status
checking then we will not touch the timer.
Verify:
Need burning test
Change-Id: I1fb66903a4d31e9491ac0533e477e1597575d4cf
Signed-off-by: Jian Xu <jian.xu@amlogic.com>
struct audio_stream *s = &prtd->s;
unsigned int last_ptr, size;
unsigned long flags = 0;
-
+ spin_lock_irqsave(&prtd->timer_lock, flags);
if (prtd->active == 0) {
hrtimer_forward_now(timer, prtd->wakeups_per_second);
+ spin_unlock_irqrestore(&prtd->timer_lock, flags);
return HRTIMER_RESTART;
}
-
- spin_lock_irqsave(&prtd->timer_lock, flags);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
last_ptr = read_i2s_rd_ptr();
if (last_ptr < s->last_ptr)