summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-02-03 00:52:38 -0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-03 11:55:39 +0000
commit95b0cf05976b7d0571e283b1fcd4c32095018cd6 (patch)
tree08ea0afff8de914c81d64d2d0d8ba8e1b9925c96 /sound
parent8c4152951cab90b52406afc72b62e9590bbe2d85 (diff)
downloadlinux-3.10-95b0cf05976b7d0571e283b1fcd4c32095018cd6.tar.gz
linux-3.10-95b0cf05976b7d0571e283b1fcd4c32095018cd6.tar.bz2
linux-3.10-95b0cf05976b7d0571e283b1fcd4c32095018cd6.zip
ASoC: fsi: modify fsi_pio_get_area() parameter and using position
This patch modify fsi_pio_get_area() parameter to use struct fsi_stream, and used it on fsi_fifo_data_ctrl(). This is just prepare cleanup for DMAEngine support. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sh/fsi.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 2e2663bb224..c814d8a7cec 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -477,58 +477,46 @@ static void fsi_stream_quit(struct fsi_priv *fsi, int is_play)
* pio function
*/
-static u8 *fsi_pio_get_area(struct fsi_priv *fsi, int stream)
+static u8 *fsi_pio_get_area(struct fsi_priv *fsi, struct fsi_stream *io)
{
- int is_play = fsi_stream_is_play(stream);
- struct fsi_stream *io = fsi_stream_get(fsi, is_play);
struct snd_pcm_runtime *runtime = io->substream->runtime;
return runtime->dma_area +
samples_to_bytes(runtime, io->buff_sample_pos);
}
-static void fsi_pio_push16(struct fsi_priv *fsi, int num)
+static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int num)
{
- u16 *start;
+ u16 *start = (u16 *)_buf;
int i;
- start = (u16 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_PLAYBACK);
-
for (i = 0; i < num; i++)
fsi_reg_write(fsi, DODT, ((u32)*(start + i) << 8));
}
-static void fsi_pio_pop16(struct fsi_priv *fsi, int num)
+static void fsi_pio_pop16(struct fsi_priv *fsi, u8 *_buf, int num)
{
- u16 *start;
+ u16 *start = (u16 *)_buf;
int i;
- start = (u16 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_CAPTURE);
-
-
for (i = 0; i < num; i++)
*(start + i) = (u16)(fsi_reg_read(fsi, DIDT) >> 8);
}
-static void fsi_pio_push32(struct fsi_priv *fsi, int num)
+static void fsi_pio_push32(struct fsi_priv *fsi, u8 *_buf, int num)
{
- u32 *start;
+ u32 *start = (u32 *)_buf;
int i;
- start = (u32 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_PLAYBACK);
-
-
for (i = 0; i < num; i++)
fsi_reg_write(fsi, DODT, *(start + i));
}
-static void fsi_pio_pop32(struct fsi_priv *fsi, int num)
+static void fsi_pio_pop32(struct fsi_priv *fsi, u8 *_buf, int num)
{
- u32 *start;
+ u32 *start = (u32 *)_buf;
int i;
- start = (u32 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_CAPTURE);
-
for (i = 0; i < num; i++)
*(start + i) = fsi_reg_read(fsi, DIDT);
}
@@ -693,12 +681,13 @@ static void __fsi_port_clk_ctrl(struct fsi_priv *fsi, int is_play, int enable)
* ctrl function
*/
static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io,
- void (*run16)(struct fsi_priv *fsi, int size),
- void (*run32)(struct fsi_priv *fsi, int size),
- int samples)
+ void (*run16)(struct fsi_priv *fsi, u8 *buf, int samples),
+ void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples),
+ int samples)
{
struct snd_pcm_runtime *runtime;
struct snd_pcm_substream *substream;
+ u8 *buf;
int over_period;
if (!fsi ||
@@ -723,12 +712,14 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io,
io->buff_sample_pos = 0;
}
+ buf = fsi_pio_get_area(fsi, io);
+
switch (io->sample_width) {
case 2:
- run16(fsi, samples);
+ run16(fsi, buf, samples);
break;
case 4:
- run32(fsi, samples);
+ run32(fsi, buf, samples);
break;
default:
return -EINVAL;