Commit cdcfcac968a1ec648434892b6addd80e66a5a892

Authored by Kuninori Morimoto
Committed by Mark Brown
1 parent 2192f81c53

ASoC: rcar: add rsnd_scu_hpbif_is_enable()

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>

Showing 4 changed files with 15 additions and 7 deletions Side-by-side Diff

include/sound/rcar_snd.h
... ... @@ -36,7 +36,6 @@
36 36 #define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37 37 #define RSND_SSI_CLK_FROM_ADG (1 << 30) /* clock parent is master */
38 38 #define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */
39   -#define RSND_SSI_DEPENDENT (1 << 28) /* SSI needs SRU/SCU */
40 39  
41 40 #define RSND_SSI_PLAY (1 << 24)
42 41  
sound/soc/sh/rcar/rsnd.h
... ... @@ -281,6 +281,7 @@
281 281 void rsnd_scu_remove(struct platform_device *pdev,
282 282 struct rsnd_priv *priv);
283 283 struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
  284 +bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod);
284 285 #define rsnd_scu_nr(priv) ((priv)->scu_nr)
285 286  
286 287 /*
sound/soc/sh/rcar/scu.c
... ... @@ -146,20 +146,26 @@
146 146 return 0;
147 147 }
148 148  
  149 +bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod)
  150 +{
  151 + struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
  152 + u32 flags = rsnd_scu_mode_flags(scu);
  153 +
  154 + return !!(flags & RSND_SCU_USE_HPBIF);
  155 +}
  156 +
149 157 static int rsnd_scu_start(struct rsnd_mod *mod,
150 158 struct rsnd_dai *rdai,
151 159 struct rsnd_dai_stream *io)
152 160 {
153 161 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
154   - struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
155 162 struct device *dev = rsnd_priv_to_dev(priv);
156   - u32 flags = rsnd_scu_mode_flags(scu);
157 163 int ret;
158 164  
159 165 /*
160 166 * SCU will be used if it has RSND_SCU_USE_HPBIF flags
161 167 */
162   - if (!(flags & RSND_SCU_USE_HPBIF)) {
  168 + if (!rsnd_scu_hpbif_is_enable(mod)) {
163 169 /* it use PIO transter */
164 170 dev_dbg(dev, "%s%d is not used\n",
165 171 rsnd_mod_name(mod), rsnd_mod_id(mod));
sound/soc/sh/rcar/ssi.c
... ... @@ -106,6 +106,7 @@
106 106 {
107 107 struct device *dev = rsnd_priv_to_dev(priv);
108 108 struct rsnd_ssi *ssi;
  109 + struct rsnd_mod *scu;
109 110 u32 flags;
110 111 u32 val;
111 112 int i;
112 113  
113 114  
... ... @@ -116,13 +117,14 @@
116 117 ssiu->ssi_mode0 = 0;
117 118 for_each_rsnd_ssi(ssi, priv, i) {
118 119 flags = rsnd_ssi_mode_flags(ssi);
  120 + scu = rsnd_scu_mod_get(priv, rsnd_mod_id(&ssi->mod));
119 121  
120 122 /* see also BUSIF_MODE */
121   - if (!(flags & RSND_SSI_DEPENDENT)) {
  123 + if (rsnd_scu_hpbif_is_enable(scu)) {
  124 + dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
  125 + } else {
122 126 ssiu->ssi_mode0 |= (1 << i);
123 127 dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", i);
124   - } else {
125   - dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
126 128 }
127 129 }
128 130