diff options
author | Alan Tull <r80115@freescale.com> | 2010-04-06 08:57:13 -0500 |
---|---|---|
committer | Alan Tull <r80115@freescale.com> | 2010-04-06 11:07:02 -0500 |
commit | 02d8a6ee770d5aaebe82290be249192abb6e4808 (patch) | |
tree | 4c410003623e3287c50df7b6943529c84ac3b73d /sound | |
parent | 72013d7931689d4addd9500bb36651afa14c1611 (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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/mxs/mxs-pcm.c | 22 |
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; } |