Audio module TDM functions have a problem, TDM channel 0, 1, 2, 3, 4, 5, at the time of playing music, often appear 3, 5 channel no sound output
1, by using an oscilloscope waveform measurement TDM data, found that when 3, 5 channels play music when there was no voice, TDM data feet of the output waveform corresponding 3, 5 channel no data output.
2, analyze the logcat and kernel information found that the kernel has the following information "Transmit buffer underflow"
[ 3375.921033] davinci-mcasp 48460000.mcasp: Transmit buffer underflow
[ 3645.218992] davinci-mcasp 48460000.mcasp: Transmit buffer underflow
android-4.4/sound/soc/davinci/davinci-mcasp.c
static irqreturn_t davinci_mcasp_tx_irq_handler(int irq, void *data)
{
struct davinci_mcasp *mcasp = (struct davinci_mcasp *)data;
struct snd_pcm_substream *substream;
u32 irq_mask = mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK];
u32 handled_mask = 0;
u32 stat;
stat = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG);
if (stat & XUNDRN & irq_mask) {
dev_warn(mcasp->dev, "Transmit buffer underflow\n");
handled_mask |= XUNDRN;
substream = mcasp->substreams[SNDRV_PCM_STREAM_PLAYBACK];
if (substream) {
snd_pcm_stream_lock_irq(substream);
if (snd_pcm_running(substream))
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irq(substream);
}
}
if (!handled_mask)
dev_warn(mcasp->dev, "unhandled tx event. txstat: 0x%08x\n",
stat);
if (stat & XRERR)
handled_mask |= XRERR;
/* Ack the handled event only */
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG, handled_mask);
return IRQ_RETVAL(handled_mask);
}