rogeriopimentel

Audio swap on i.MX27 -blog archive

Discussion created by rogeriopimentel Employee on Dec 30, 2011


Every time the swap occours, the overrun bit of SSI RX0 is set and we need to reset the ssi. The following lines need to be added file mxc-alsa-pmic.c, function: snd_mxc_audio_capture_trigger

ssi_enable(s->ssi, false);
ssi_rx_flush_fifo(s->ssi);
ssi_enable(s->ssi, true);

 

-------

The complete function is:

 

static int
snd_mxc_audio_capture_trigger(struct snd_pcm_substream *substream, int cmd)
{
mxc_pmic_audio_t *chip;
int stream_id;
audio_stream_t *s;
int err;

chip = snd_pcm_substream_chip(substream);
stream_id = substream->pstr->stream;
s = &chip->s[stream_id];
err = 0;

/* note local interrupts are already disabled in the midlevel code */
spin_lock(&s->dma_lock);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
pr_debug("MXC: SNDRV_PCM_TRIGGER_START\n");
s->tx_spin = 0;
/* requested stream startup */
s->active = 1;
audio_capture_dma(s);
break;
case SNDRV_PCM_TRIGGER_STOP:
pr_debug("MXC: SNDRV_PCM_TRIGGER_STOP\n");
/* requested stream shutdown */
audio_capture_stop_dma(s);
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
pr_debug("MXC : SNDRV_PCM_TRIGGER_SUSPEND active = 0\n");
s->active = 0;
s->periods = 0;
break;
case SNDRV_PCM_TRIGGER_RESUME:
pr_debug("MXC: SNDRV_PCM_TRIGGER_RESUME\n");
s->active = 1;
s->tx_spin = 0;
audio_capture_dma(s);
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
pr_debug("MXC: SNDRV_PCM_TRIGGER_PAUSE_PUSH\n");
s->active = 0;
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
pr_debug("MXC: SNDRV_PCM_TRIGGER_PAUSE_RELEASE\n");
s->active = 1;
if (s->old_offset) {
s->tx_spin = 0;
audio_capture_dma(s);
break;
}
break;
default:
err = -EINVAL;
break;
}

ssi_enable(s->ssi, false);
ssi_rx_flush_fifo(s->ssi);
ssi_enable(s->ssi, true);

spin_unlock(&s->dma_lock);
return err;
}

Outcomes