|
@@ -223,9 +223,9 @@ static snd_pcm_uframes_t snd_solo_pcm_pointer(struct snd_pcm_substream *ss)
|
|
|
return idx * G723_FRAMES_PER_PAGE;
|
|
|
}
|
|
|
|
|
|
-static int __snd_solo_pcm_copy(struct snd_pcm_substream *ss,
|
|
|
- unsigned long pos, void *dst,
|
|
|
- unsigned long count, bool in_kernel)
|
|
|
+static int snd_solo_pcm_copy_user(struct snd_pcm_substream *ss, int channel,
|
|
|
+ unsigned long pos, void __user *dst,
|
|
|
+ unsigned long count)
|
|
|
{
|
|
|
struct solo_snd_pcm *solo_pcm = snd_pcm_substream_chip(ss);
|
|
|
struct solo_dev *solo_dev = solo_pcm->solo_dev;
|
|
@@ -242,10 +242,7 @@ static int __snd_solo_pcm_copy(struct snd_pcm_substream *ss,
|
|
|
if (err)
|
|
|
return err;
|
|
|
|
|
|
- if (in_kernel)
|
|
|
- memcpy(dst, solo_pcm->g723_buf, G723_PERIOD_BYTES);
|
|
|
- else if (copy_to_user((void __user *)dst,
|
|
|
- solo_pcm->g723_buf, G723_PERIOD_BYTES))
|
|
|
+ if (copy_to_user(dst, solo_pcm->g723_buf, G723_PERIOD_BYTES))
|
|
|
return -EFAULT;
|
|
|
dst += G723_PERIOD_BYTES;
|
|
|
}
|
|
@@ -253,18 +250,30 @@ static int __snd_solo_pcm_copy(struct snd_pcm_substream *ss,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int snd_solo_pcm_copy_user(struct snd_pcm_substream *ss, int channel,
|
|
|
- unsigned long pos, void __user *dst,
|
|
|
- unsigned long count)
|
|
|
-{
|
|
|
- return __snd_solo_pcm_copy(ss, pos, (void *)dst, count, false);
|
|
|
-}
|
|
|
-
|
|
|
static int snd_solo_pcm_copy_kernel(struct snd_pcm_substream *ss, int channel,
|
|
|
unsigned long pos, void *dst,
|
|
|
unsigned long count)
|
|
|
{
|
|
|
- return __snd_solo_pcm_copy(ss, pos, dst, count, true);
|
|
|
+ struct solo_snd_pcm *solo_pcm = snd_pcm_substream_chip(ss);
|
|
|
+ struct solo_dev *solo_dev = solo_pcm->solo_dev;
|
|
|
+ int err, i;
|
|
|
+
|
|
|
+ for (i = 0; i < (count / G723_FRAMES_PER_PAGE); i++) {
|
|
|
+ int page = (pos / G723_FRAMES_PER_PAGE) + i;
|
|
|
+
|
|
|
+ err = solo_p2m_dma_t(solo_dev, 0, solo_pcm->g723_dma,
|
|
|
+ SOLO_G723_EXT_ADDR(solo_dev) +
|
|
|
+ (page * G723_PERIOD_BLOCK) +
|
|
|
+ (ss->number * G723_PERIOD_BYTES),
|
|
|
+ G723_PERIOD_BYTES, 0, 0);
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+
|
|
|
+ memcpy(dst, solo_pcm->g723_buf, G723_PERIOD_BYTES);
|
|
|
+ dst += G723_PERIOD_BYTES;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
static const struct snd_pcm_ops snd_solo_pcm_ops = {
|