diff mbox

[107/237] ASoC: rcar: add rsnd_scu_hpbif_is_enable()

Message ID 1387000406-29111-108-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State New, archived
Headers show

Commit Message

Simon Horman Dec. 14, 2013, 5:51 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current SSI needs RSND_SSI_DEPENDENT flag to
decide dependent/independent mode.
And SCU needs RSND_SCU_USE_HPBIF flag
to decide HPBIF is enable/disable.
But these 2 means same things.

This patch adds new rsnd_scu_hpbif_is_enable()
function, and merges above methods.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cdcfcac968a1ec648434892b6addd80e66a5a892)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 include/sound/rcar_snd.h |  1 -
 sound/soc/sh/rcar/rsnd.h |  1 +
 sound/soc/sh/rcar/scu.c  | 12 +++++++++---
 sound/soc/sh/rcar/ssi.c  |  8 +++++---
 4 files changed, 15 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index fb0a312..12afab1 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -36,7 +36,6 @@ 
 #define RSND_SSI_CLK_PIN_SHARE		(1 << 31)
 #define RSND_SSI_CLK_FROM_ADG		(1 << 30) /* clock parent is master */
 #define RSND_SSI_SYNC			(1 << 29) /* SSI34_sync etc */
-#define RSND_SSI_DEPENDENT		(1 << 28) /* SSI needs SRU/SCU */
 
 #define RSND_SSI_PLAY			(1 << 24)
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 3b71c3f..9e463e5 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -281,6 +281,7 @@  int rsnd_scu_probe(struct platform_device *pdev,
 void rsnd_scu_remove(struct platform_device *pdev,
 		     struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
+bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod);
 #define rsnd_scu_nr(priv) ((priv)->scu_nr)
 
 /*
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index 2df2e91..1ab1bce 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -146,20 +146,26 @@  static int rsnd_scu_set_hpbif(struct rsnd_priv *priv,
 	return 0;
 }
 
+bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod)
+{
+	struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
+	u32 flags = rsnd_scu_mode_flags(scu);
+
+	return !!(flags & RSND_SCU_USE_HPBIF);
+}
+
 static int rsnd_scu_start(struct rsnd_mod *mod,
 			  struct rsnd_dai *rdai,
 			  struct rsnd_dai_stream *io)
 {
 	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);
-	u32 flags = rsnd_scu_mode_flags(scu);
 	int ret;
 
 	/*
 	 * SCU will be used if it has RSND_SCU_USE_HPBIF flags
 	 */
-	if (!(flags & RSND_SCU_USE_HPBIF)) {
+	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));
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fae26d3..7613256 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -106,6 +106,7 @@  static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
 {
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct rsnd_ssi *ssi;
+	struct rsnd_mod *scu;
 	u32 flags;
 	u32 val;
 	int i;
@@ -116,13 +117,14 @@  static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
 	ssiu->ssi_mode0 = 0;
 	for_each_rsnd_ssi(ssi, priv, i) {
 		flags = rsnd_ssi_mode_flags(ssi);
+		scu   = rsnd_scu_mod_get(priv, rsnd_mod_id(&ssi->mod));
 
 		/* see also BUSIF_MODE */
-		if (!(flags & RSND_SSI_DEPENDENT)) {
+		if (rsnd_scu_hpbif_is_enable(scu)) {
+			dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
+		} else {
 			ssiu->ssi_mode0 |= (1 << i);
 			dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", i);
-		} else {
-			dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
 		}
 	}