aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2015-10-26 04:41:17 -0400
committerMark Brown <broonie@kernel.org>2015-11-16 05:09:29 -0500
commitc2dc47d5cff62bfe21a691bef40eb30a585caa3c (patch)
treed92621c550a6e94cafb4a908559da046a44c3909 /sound/soc/sh
parentb761bf272bce6dff4d8a7ccf4385c9f3d4018094 (diff)
ASoC: rsnd: rsnd_dai_stream has each mod's status insted of rsnd_mod
Renesas sound needs many devices (SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp). SSI/SRC/CTU/MIX/DVC are implemented as module. SSI parent, SSIU are implemented as part of SSI CMD is implemented as part of CTU/MIX/DVC AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC It is nice sense that these all devices are implemented as mod. Current rsnd is controling each mod's status on mod. But it was not good design for SSI, because stream might has SSI-parent. In such case, it can't play/capture in same time, because SSI-parent is used as normal SSI in other stream, but it shares same status. To avoid this issue each mod's status is controlled by rsnd_dai_stream instead of rsnd_mod. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/rcar/core.c12
-rw-r--r--sound/soc/sh/rcar/rsnd.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index b6fc0d86c03d..5f20d6776281 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -300,20 +300,22 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
300/* 300/*
301 * rsnd_dai functions 301 * rsnd_dai functions
302 */ 302 */
303#define rsnd_mod_call(mod, io, func, param...) \ 303#define rsnd_mod_call(idx, io, func, param...) \
304({ \ 304({ \
305 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \ 305 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
306 struct rsnd_mod *mod = (io)->mod[idx]; \
306 struct device *dev = rsnd_priv_to_dev(priv); \ 307 struct device *dev = rsnd_priv_to_dev(priv); \
308 u32 *status = (io)->mod_status + idx; \
307 u32 mask = 0xF << __rsnd_mod_shift_##func; \ 309 u32 mask = 0xF << __rsnd_mod_shift_##func; \
308 u8 val = (mod->status >> __rsnd_mod_shift_##func) & 0xF; \ 310 u8 val = (*status >> __rsnd_mod_shift_##func) & 0xF; \
309 u8 add = ((val + __rsnd_mod_add_##func) & 0xF); \ 311 u8 add = ((val + __rsnd_mod_add_##func) & 0xF); \
310 int ret = 0; \ 312 int ret = 0; \
311 int call = (val == __rsnd_mod_call_##func) && (mod)->ops->func; \ 313 int call = (val == __rsnd_mod_call_##func) && (mod)->ops->func; \
312 mod->status = (mod->status & ~mask) + \ 314 *status = (*status & ~mask) + \
313 (add << __rsnd_mod_shift_##func); \ 315 (add << __rsnd_mod_shift_##func); \
314 dev_dbg(dev, "%s[%d]\t0x%08x %s\n", \ 316 dev_dbg(dev, "%s[%d]\t0x%08x %s\n", \
315 rsnd_mod_name(mod), rsnd_mod_id(mod), \ 317 rsnd_mod_name(mod), rsnd_mod_id(mod), \
316 mod->status, call ? #func : ""); \ 318 *status, call ? #func : ""); \
317 if (call) \ 319 if (call) \
318 ret = (mod)->ops->func(mod, io, param); \ 320 ret = (mod)->ops->func(mod, io, param); \
319 ret; \ 321 ret; \
@@ -327,7 +329,7 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
327 mod = (io)->mod[i]; \ 329 mod = (io)->mod[i]; \
328 if (!mod) \ 330 if (!mod) \
329 continue; \ 331 continue; \
330 ret |= rsnd_mod_call(mod, io, fn, param); \ 332 ret |= rsnd_mod_call(i, io, fn, param); \
331 } \ 333 } \
332 ret; \ 334 ret; \
333}) 335})
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index d6365dc2ac99..774cb24b7338 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -259,7 +259,6 @@ struct rsnd_mod {
259 struct rsnd_mod_ops *ops; 259 struct rsnd_mod_ops *ops;
260 struct rsnd_priv *priv; 260 struct rsnd_priv *priv;
261 struct clk *clk; 261 struct clk *clk;
262 u32 status;
263}; 262};
264/* 263/*
265 * status 264 * status
@@ -335,6 +334,7 @@ struct rsnd_dai_stream {
335 struct rsnd_mod *mod[RSND_MOD_MAX]; 334 struct rsnd_mod *mod[RSND_MOD_MAX];
336 struct rsnd_dai_path_info *info; /* rcar_snd.h */ 335 struct rsnd_dai_path_info *info; /* rcar_snd.h */
337 struct rsnd_dai *rdai; 336 struct rsnd_dai *rdai;
337 u32 mod_status[RSND_MOD_MAX];
338 int byte_pos; 338 int byte_pos;
339 int period_pos; 339 int period_pos;
340 int byte_per_period; 340 int byte_per_period;