ret; \
})
-static int rsnd_dai_connect(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io)
+int rsnd_dai_connect(struct rsnd_mod *mod,
+ struct rsnd_dai_stream *io,
+ enum rsnd_mod_type type)
{
struct rsnd_priv *priv;
struct device *dev;
priv = rsnd_mod_to_priv(mod);
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",
rsnd_mod_name(mod), rsnd_mod_id(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)
.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; \
int ret = 0; \
int id = -1; \
\
- if (rsnd_is_enable_path(io, type)) { \
- id = rsnd_info_id(priv, io, type); \
+ if (rsnd_is_enable_path(io, _type)) { \
+ id = rsnd_info_id(priv, io, _type); \
if (id >= 0) { \
- mod = rsnd_##type##_mod_get(priv, id); \
- ret = rsnd_dai_connect(mod, io); \
+ mod = rsnd_##_type##_mod_get(priv, id); \
+ ret = rsnd_dai_connect(mod, io, mod->type);\
} \
} \
ret; \
})
-#define rsnd_path_remove(priv, io, type) \
+#define rsnd_path_remove(priv, io, _type) \
{ \
struct rsnd_mod *mod; \
int id = -1; \
\
- if (rsnd_is_enable_path(io, type)) { \
- id = rsnd_info_id(priv, io, type); \
+ if (rsnd_is_enable_path(io, _type)) { \
+ id = rsnd_info_id(priv, io, _type); \
if (id >= 0) { \
- mod = rsnd_##type##_mod_get(priv, id); \
- rsnd_dai_disconnect(mod, io); \
+ mod = rsnd_##_type##_mod_get(priv, id); \
+ rsnd_dai_disconnect(mod, io, mod->type);\
} \
} \
}