From: Kuninori Morimoto Date: Thu, 27 Nov 2014 08:05:01 +0000 (+0000) Subject: ASoC: rsnd: tidyup PIO/DMA mode settings method X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05795411aeda8a86865b595e09f22273d85fce83;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: Mark Brown --- diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 1344c3ac2ca6..12e894538422 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 a200452484c5..8928913ad452 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 */