mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 11:13:58 +08:00
ASoC: rsnd: add rsnd_path_parse() macro
Current R-Car sound supports only SRC/SSI, but, other module will be supported. This patch adds rsnd_path_parse() macro to share code Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
29e69fd2cd
commit
739f9502fd
@ -576,14 +576,27 @@ 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_parse(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 (id >= 0) { \
|
||||||
|
mod = rsnd_##type##_mod_get(priv, id); \
|
||||||
|
ret = rsnd_dai_connect(mod, io); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
ret; \
|
||||||
|
})
|
||||||
|
|
||||||
static int rsnd_path_init(struct rsnd_priv *priv,
|
static int rsnd_path_init(struct rsnd_priv *priv,
|
||||||
struct rsnd_dai *rdai,
|
struct rsnd_dai *rdai,
|
||||||
struct rsnd_dai_stream *io)
|
struct rsnd_dai_stream *io)
|
||||||
{
|
{
|
||||||
struct rsnd_mod *mod;
|
|
||||||
int ret;
|
int ret;
|
||||||
int ssi_id = -1;
|
|
||||||
int src_id = -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gen1 is created by SRU/SSI, and this SRU is base module of
|
* Gen1 is created by SRU/SSI, and this SRU is base module of
|
||||||
@ -595,28 +608,16 @@ static int rsnd_path_init(struct rsnd_priv *priv,
|
|||||||
* Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is
|
* Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is
|
||||||
* using fixed path.
|
* using fixed path.
|
||||||
*/
|
*/
|
||||||
if (rsnd_is_enable_path(io, ssi))
|
|
||||||
ssi_id = rsnd_info_id(priv, io, ssi);
|
|
||||||
if (rsnd_is_enable_path(io, src))
|
|
||||||
src_id = rsnd_info_id(priv, io, src);
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
/* SRC */
|
/* SRC */
|
||||||
if (src_id >= 0) {
|
ret = rsnd_path_parse(priv, io, src);
|
||||||
mod = rsnd_src_mod_get(priv, src_id);
|
if (ret < 0)
|
||||||
ret = rsnd_dai_connect(mod, io);
|
return ret;
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SSI */
|
/* SSI */
|
||||||
if (ssi_id >= 0) {
|
ret = rsnd_path_parse(priv, io, ssi);
|
||||||
mod = rsnd_ssi_mod_get(priv, ssi_id);
|
if (ret < 0)
|
||||||
ret = rsnd_dai_connect(mod, io);
|
return ret;
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user