diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2015-04-13 17:33:18 +0200 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2015-04-13 17:33:18 +0200 |
commit | f95b5a8016c03c8f429115e97000c0fbbcf41e53 (patch) | |
tree | 4d860f2f5b3121d3912bd3001564e3df582b0c1f /sound | |
parent | 2fb49898603791dc7631f651a9ba0e0e0c305bce (diff) |
ASoC: fsl_sai_ac97: improve AC97 read performance
Improve performance of AC97 read by using usleep instead of udelay.
Also wait take the very next frame to send, but return a error code
in case the read failed.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_sai_ac97.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sound/soc/fsl/fsl_sai_ac97.c b/sound/soc/fsl/fsl_sai_ac97.c index ecfff0364d66..18a873fc2bdb 100644 --- a/sound/soc/fsl/fsl_sai_ac97.c +++ b/sound/soc/fsl/fsl_sai_ac97.c @@ -321,7 +321,7 @@ static int vf610_sai_ac97_read_write(struct snd_ac97 *ac97, bool isread, /* Calculate next DMA buffer sent out to the AC97 codec */ rxbufidstart = (SAI_AC97_RBUF_SIZE_TOT - rx_state.residue) / SAI_AC97_DMABUF_SIZE; txbufid = (SAI_AC97_RBUF_SIZE_TOT - tx_state.residue) / SAI_AC97_DMABUF_SIZE; - txbufid += 2; + txbufid += 1; txbufid %= SAI_AC97_RBUF_COUNT * SAI_AC97_RBUF_FRAMES; tx_aclink = (struct ac97_tx *)(info->tx_buf.area + (txbufid * SAI_AC97_DMABUF_SIZE)); @@ -377,8 +377,7 @@ static int vf610_sai_ac97_read_write(struct snd_ac97 *ac97, bool isread, if (unlikely(rxbufid < rxbufidstart) && (curbufid > rxbufid && curbufid < rxbufidstart)) break; - - udelay(50); + usleep_range(50, 200); } while (--timeout); if (!timeout) { @@ -411,7 +410,7 @@ clear_command: tx_aclink->cmdindex = 0; tx_aclink->cmddata = 0; - return 0; + return ret; } static unsigned short vf610_sai_ac97_read(struct snd_ac97 *ac97, |