blob: d67490653d50c0e297e7b68747e234c0f1cd42b4 [file] [log] [blame]
From 4b24bc4c0a1df601316e85449136ebfd005d75ab Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 23 Jan 2014 18:38:26 -0800
Subject: ASoC: rsnd: control SCU ops in probe timing
SCU will be used if platform requested to use.
Current driver is checking it in runtime,
but, it can be decided in probe timing.
This patch do it
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 013f38fe260af6f505ad5da5f6b0db3e42ca1fbb)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
sound/soc/sh/rcar/scu.c | 30 +++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index e4b82ab31dca..ab5f1d21731e 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -270,24 +270,10 @@ static int rsnd_scu_start(struct rsnd_mod *mod,
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
- struct device *dev = rsnd_priv_to_dev(priv);
int ret;
- /*
- * SCU will be used if it has RSND_SCU_USE_HPBIF flags
- */
- if (!rsnd_scu_hpbif_is_enable(mod)) {
- /* it use PIO transter */
- dev_dbg(dev, "%s%d is not used\n",
- rsnd_mod_name(mod), rsnd_mod_id(mod));
-
- return 0;
- }
-
clk_enable(scu->clk);
- /* it use DMA transter */
-
ret = rsnd_src_set_route_if_gen1(priv, mod, rdai, io);
if (ret < 0)
return ret;
@@ -310,9 +296,6 @@ static int rsnd_scu_stop(struct rsnd_mod *mod,
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
- if (!rsnd_scu_hpbif_is_enable(mod))
- return 0;
-
rsnd_scu_transfer_stop(priv, mod, rdai, io);
clk_disable(scu->clk);
@@ -326,6 +309,10 @@ static struct rsnd_mod_ops rsnd_scu_ops = {
.stop = rsnd_scu_stop,
};
+static struct rsnd_mod_ops rsnd_scu_non_ops = {
+ .name = "scu (non)",
+};
+
struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id)
{
if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv)))
@@ -340,6 +327,7 @@ int rsnd_scu_probe(struct platform_device *pdev,
{
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_scu *scu;
+ struct rsnd_mod_ops *ops;
struct clk *clk;
char name[RSND_SCU_NAME_SIZE];
int i, nr;
@@ -364,11 +352,15 @@ int rsnd_scu_probe(struct platform_device *pdev,
if (IS_ERR(clk))
return PTR_ERR(clk);
- rsnd_mod_init(priv, &scu->mod,
- &rsnd_scu_ops, i);
scu->info = &info->scu_info[i];
scu->clk = clk;
+ ops = &rsnd_scu_non_ops;
+ if (rsnd_scu_hpbif_is_enable(&scu->mod))
+ ops = &rsnd_scu_ops;
+
+ rsnd_mod_init(priv, &scu->mod, ops, i);
+
dev_dbg(dev, "SCU%d probed\n", i);
}
dev_dbg(dev, "scu probed\n");
--
2.1.2