summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-11-27 08:05:01 (GMT)
committerMark Brown <broonie@kernel.org>2014-12-03 18:51:39 (GMT)
commit05795411aeda8a86865b595e09f22273d85fce83 (patch)
treed2529e1e323beef4c673442f86817e66ff5f3b30 /sound
parent660cdce2fbdcbe48eb143cc394fdb24316232dba (diff)
downloadlinux-05795411aeda8a86865b595e09f22273d85fce83.tar.xz
ASoC: rsnd: tidyup PIO/DMA mode settings method
Current ssi.c has .cr_etc which is used for SSICR's etc settings. but, it is used as PIO/DMA switching purpose now. This patch tidyup this method. This is prepare for under/over run issue handling Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sh/rcar/rsnd.h1
-rw-r--r--sound/soc/sh/rcar/ssi.c25
2 files changed, 14 insertions, 12 deletions
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 1344c3a..12e8945 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -445,6 +445,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,
struct rsnd_priv *priv);
struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
+int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
/*
* R-Car DVC
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index a200452..8928913 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -68,7 +68,6 @@ struct rsnd_ssi {
struct rsnd_dai *rdai;
u32 cr_own;
u32 cr_clk;
- u32 cr_etc;
int err;
unsigned int usrcnt;
unsigned int rate;
@@ -185,6 +184,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
{
struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
struct device *dev = rsnd_priv_to_dev(priv);
+ u32 cr_mode;
u32 cr;
if (0 == ssi->usrcnt) {
@@ -198,9 +198,14 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
}
}
+ cr_mode = rsnd_ssi_is_dma_mode(&ssi->mod) ?
+ DMEN : /* DMA : use DMA */
+ UIEN | OIEN | DIEN; /* PIO : enable interrupt */
+
+
cr = ssi->cr_own |
ssi->cr_clk |
- ssi->cr_etc |
+ cr_mode |
EN;
rsnd_mod_write(&ssi->mod, SSICR, cr);
@@ -403,9 +408,6 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- /* enable PIO IRQ */
- ssi->cr_etc = UIEN | OIEN | DIEN;
-
rsnd_src_ssiu_start(mod, rdai, 0);
rsnd_src_enable_ssi_irq(mod, rdai);
@@ -420,8 +422,6 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
- ssi->cr_etc = 0;
-
rsnd_ssi_hw_stop(ssi, rdai);
rsnd_src_ssiu_stop(mod, rdai);
@@ -498,9 +498,6 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
struct rsnd_dma *dma = rsnd_mod_to_dma(&ssi->mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- /* enable DMA transfer */
- ssi->cr_etc = DMEN;
-
rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
rsnd_dma_start(dma);
@@ -520,8 +517,6 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dma *dma = rsnd_mod_to_dma(&ssi->mod);
- ssi->cr_etc = 0;
-
rsnd_ssi_record_error(ssi, rsnd_mod_read(mod, SSISR));
rsnd_ssi_hw_stop(ssi, rdai);
@@ -550,6 +545,12 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
.fallback = rsnd_ssi_fallback,
};
+int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)
+{
+ return mod->ops == &rsnd_ssi_dma_ops;
+}
+
+
/*
* Non SSI
*/