Commit 27924f32 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: enable to use rsnd_dai_connect() from each 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.

DMAC/SSIU/SSI-parent/CMD will be implemented as module, but these are
not customer controlled module. These should be automatically install
to system. Because of this, rsnd_dai_connect() should be called from
each mod. SSI can be very special, because it will be installed as
SSI-parent / SSI-child. Thus, new rsnd_dai_connect() has type parameter
which should be mod->type except SSI-parent
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 81ecbb65
...@@ -332,8 +332,9 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io) ...@@ -332,8 +332,9 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
ret; \ ret; \
}) })
static int rsnd_dai_connect(struct rsnd_mod *mod, int rsnd_dai_connect(struct rsnd_mod *mod,
struct rsnd_dai_stream *io) struct rsnd_dai_stream *io,
enum rsnd_mod_type type)
{ {
struct rsnd_priv *priv; struct rsnd_priv *priv;
struct device *dev; struct device *dev;
...@@ -344,7 +345,7 @@ static int rsnd_dai_connect(struct rsnd_mod *mod, ...@@ -344,7 +345,7 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
priv = rsnd_mod_to_priv(mod); priv = rsnd_mod_to_priv(mod);
dev = rsnd_priv_to_dev(priv); dev = rsnd_priv_to_dev(priv);
io->mod[mod->type] = mod; io->mod[type] = mod;
dev_dbg(dev, "%s[%d] is connected to io (%s)\n", dev_dbg(dev, "%s[%d] is connected to io (%s)\n",
rsnd_mod_name(mod), rsnd_mod_id(mod), rsnd_mod_name(mod), rsnd_mod_id(mod),
...@@ -354,9 +355,10 @@ static int rsnd_dai_connect(struct rsnd_mod *mod, ...@@ -354,9 +355,10 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
} }
static void rsnd_dai_disconnect(struct rsnd_mod *mod, static void rsnd_dai_disconnect(struct rsnd_mod *mod,
struct rsnd_dai_stream *io) struct rsnd_dai_stream *io,
enum rsnd_mod_type type)
{ {
io->mod[mod->type] = NULL; io->mod[type] = NULL;
} }
struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id) struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id)
...@@ -572,32 +574,32 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { ...@@ -572,32 +574,32 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
.set_fmt = rsnd_soc_dai_set_fmt, .set_fmt = rsnd_soc_dai_set_fmt,
}; };
#define rsnd_path_add(priv, io, type) \ #define rsnd_path_add(priv, io, _type) \
({ \ ({ \
struct rsnd_mod *mod; \ struct rsnd_mod *mod; \
int ret = 0; \ int ret = 0; \
int id = -1; \ int id = -1; \
\ \
if (rsnd_is_enable_path(io, type)) { \ if (rsnd_is_enable_path(io, _type)) { \
id = rsnd_info_id(priv, io, type); \ id = rsnd_info_id(priv, io, _type); \
if (id >= 0) { \ if (id >= 0) { \
mod = rsnd_##type##_mod_get(priv, id); \ mod = rsnd_##_type##_mod_get(priv, id); \
ret = rsnd_dai_connect(mod, io); \ ret = rsnd_dai_connect(mod, io, mod->type);\
} \ } \
} \ } \
ret; \ ret; \
}) })
#define rsnd_path_remove(priv, io, type) \ #define rsnd_path_remove(priv, io, _type) \
{ \ { \
struct rsnd_mod *mod; \ struct rsnd_mod *mod; \
int id = -1; \ int id = -1; \
\ \
if (rsnd_is_enable_path(io, type)) { \ if (rsnd_is_enable_path(io, _type)) { \
id = rsnd_info_id(priv, io, type); \ id = rsnd_info_id(priv, io, _type); \
if (id >= 0) { \ if (id >= 0) { \
mod = rsnd_##type##_mod_get(priv, id); \ mod = rsnd_##_type##_mod_get(priv, id); \
rsnd_dai_disconnect(mod, io); \ rsnd_dai_disconnect(mod, io, mod->type);\
} \ } \
} \ } \
} }
......
...@@ -380,6 +380,9 @@ struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); ...@@ -380,6 +380,9 @@ struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id);
bool rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt); bool rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io); void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io);
int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional); int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);
int rsnd_dai_connect(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
enum rsnd_mod_type type);
/* /*
* R-Car Gen1/Gen2 * R-Car Gen1/Gen2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment