summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Tull <r80115@freescale.com>2010-04-06 08:57:13 -0500
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-05-25 11:20:20 +0200
commit37cb321fc3af7eba444644f351fa54cb41b0f5ed (patch)
tree8ef181efc306cb8c95f4506298ea2ce328e106f0
parent849667d5f9342fc5a30a325890c43203c9fb63e6 (diff)
ENGR00122231 mxs: support read in mxs_pcm_copy to fix record
Record was broken by the patch that fixed 24 bit S/PDIF. Signed-off-by: Alan Tull <r80115@freescale.com> Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
-rw-r--r--sound/soc/mxs/mxs-pcm.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index db3214624c4b..965bbbadafea 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -351,15 +351,21 @@ static int mcs_pcm_copy(struct snd_pcm_substream *substream, int channel,
char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff);
unsigned long count = frames_to_bytes(runtime, frames);
- /* For S/PDIF 24-bit playback, fix the buffer. Code taken
- from snd_pcm_lib_write_transfer() in sound/core/pcm_lib.c */
- if ((prtd->params->dma_ch == MXS_DMA_CHANNEL_AHB_APBX_SPDIF) &&
- ((prtd->format == SNDRV_PCM_FORMAT_S24_LE)
- || (prtd->format == SNDRV_PCM_FORMAT_S20_3LE))) {
- if (copy_from_user(hwbuf + 1, buf, count - 1))
- return -EFAULT;
+ /* For S/PDIF 24-bit playback, fix the buffer. Code taken from
+ snd_pcm_lib_write_transfer() and snd_pcm_lib_read_transfer()
+ in sound/core/pcm_lib.c */
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if ((prtd->params->dma_ch == MXS_DMA_CHANNEL_AHB_APBX_SPDIF) &&
+ ((prtd->format == SNDRV_PCM_FORMAT_S24_LE)
+ || (prtd->format == SNDRV_PCM_FORMAT_S20_3LE))) {
+ if (copy_from_user(hwbuf + 1, buf, count - 1))
+ return -EFAULT;
+ } else {
+ if (copy_from_user(hwbuf, buf, count))
+ return -EFAULT;
+ }
} else {
- if (copy_from_user(hwbuf, buf, count))
+ if (copy_to_user(buf, hwbuf, count))
return -EFAULT;
}