Commit 05795411 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 660cdce2
...@@ -445,6 +445,7 @@ int rsnd_ssi_probe(struct platform_device *pdev, ...@@ -445,6 +445,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,
struct rsnd_priv *priv); struct rsnd_priv *priv);
struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); 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_pin_sharing(struct rsnd_mod *mod);
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
/* /*
* R-Car DVC * R-Car DVC
......
...@@ -68,7 +68,6 @@ struct rsnd_ssi { ...@@ -68,7 +68,6 @@ struct rsnd_ssi {
struct rsnd_dai *rdai; struct rsnd_dai *rdai;
u32 cr_own; u32 cr_own;
u32 cr_clk; u32 cr_clk;
u32 cr_etc;
int err; int err;
unsigned int usrcnt; unsigned int usrcnt;
unsigned int rate; unsigned int rate;
...@@ -185,6 +184,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, ...@@ -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 rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
u32 cr_mode;
u32 cr; u32 cr;
if (0 == ssi->usrcnt) { if (0 == ssi->usrcnt) {
...@@ -198,9 +198,14 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, ...@@ -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 | cr = ssi->cr_own |
ssi->cr_clk | ssi->cr_clk |
ssi->cr_etc | cr_mode |
EN; EN;
rsnd_mod_write(&ssi->mod, SSICR, cr); rsnd_mod_write(&ssi->mod, SSICR, cr);
...@@ -403,9 +408,6 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod, ...@@ -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_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(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_ssiu_start(mod, rdai, 0);
rsnd_src_enable_ssi_irq(mod, rdai); rsnd_src_enable_ssi_irq(mod, rdai);
...@@ -420,8 +422,6 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod, ...@@ -420,8 +422,6 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
{ {
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
ssi->cr_etc = 0;
rsnd_ssi_hw_stop(ssi, rdai); rsnd_ssi_hw_stop(ssi, rdai);
rsnd_src_ssiu_stop(mod, rdai); rsnd_src_ssiu_stop(mod, rdai);
...@@ -498,9 +498,6 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod, ...@@ -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_dma *dma = rsnd_mod_to_dma(&ssi->mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(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_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
rsnd_dma_start(dma); rsnd_dma_start(dma);
...@@ -520,8 +517,6 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod, ...@@ -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_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dma *dma = rsnd_mod_to_dma(&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_record_error(ssi, rsnd_mod_read(mod, SSISR));
rsnd_ssi_hw_stop(ssi, rdai); rsnd_ssi_hw_stop(ssi, rdai);
...@@ -550,6 +545,12 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = { ...@@ -550,6 +545,12 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
.fallback = rsnd_ssi_fallback, .fallback = rsnd_ssi_fallback,
}; };
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)
{
return mod->ops == &rsnd_ssi_dma_ops;
}
/* /*
* Non SSI * Non SSI
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment