diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-05-08 20:43:26 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-05-13 14:06:15 -0400 |
commit | 739f9502fdd7c7202123ded842415a0392b7dc40 (patch) | |
tree | 394a42aa4fd105e7377ca48ea855b3723109300e | |
parent | 29e69fd2cd6f55233f64f600ad55ce2b661784d1 (diff) |
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>
-rw-r--r-- | sound/soc/sh/rcar/core.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 8ed84703b280..f74d02cb70f1 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -576,14 +576,27 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { | |||
576 | .set_fmt = rsnd_soc_dai_set_fmt, | 576 | .set_fmt = rsnd_soc_dai_set_fmt, |
577 | }; | 577 | }; |
578 | 578 | ||
579 | #define rsnd_path_parse(priv, io, type) \ | ||
580 | ({ \ | ||
581 | struct rsnd_mod *mod; \ | ||
582 | int ret = 0; \ | ||
583 | int id = -1; \ | ||
584 | \ | ||
585 | if (rsnd_is_enable_path(io, type)) { \ | ||
586 | id = rsnd_info_id(priv, io, type); \ | ||
587 | if (id >= 0) { \ | ||
588 | mod = rsnd_##type##_mod_get(priv, id); \ | ||
589 | ret = rsnd_dai_connect(mod, io); \ | ||
590 | } \ | ||
591 | } \ | ||
592 | ret; \ | ||
593 | }) | ||
594 | |||
579 | static int rsnd_path_init(struct rsnd_priv *priv, | 595 | static int rsnd_path_init(struct rsnd_priv *priv, |
580 | struct rsnd_dai *rdai, | 596 | struct rsnd_dai *rdai, |
581 | struct rsnd_dai_stream *io) | 597 | struct rsnd_dai_stream *io) |
582 | { | 598 | { |
583 | struct rsnd_mod *mod; | ||
584 | int ret; | 599 | int ret; |
585 | int ssi_id = -1; | ||
586 | int src_id = -1; | ||
587 | 600 | ||
588 | /* | 601 | /* |
589 | * Gen1 is created by SRU/SSI, and this SRU is base module of | 602 | * 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, | |||
595 | * Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is | 608 | * Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is |
596 | * using fixed path. | 609 | * using fixed path. |
597 | */ | 610 | */ |
598 | if (rsnd_is_enable_path(io, ssi)) | ||
599 | ssi_id = rsnd_info_id(priv, io, ssi); | ||
600 | if (rsnd_is_enable_path(io, src)) | ||
601 | src_id = rsnd_info_id(priv, io, src); | ||
602 | |||
603 | ret = 0; | ||
604 | 611 | ||
605 | /* SRC */ | 612 | /* SRC */ |
606 | if (src_id >= 0) { | 613 | ret = rsnd_path_parse(priv, io, src); |
607 | mod = rsnd_src_mod_get(priv, src_id); | 614 | if (ret < 0) |
608 | ret = rsnd_dai_connect(mod, io); | 615 | return ret; |
609 | if (ret < 0) | ||
610 | return ret; | ||
611 | } | ||
612 | 616 | ||
613 | /* SSI */ | 617 | /* SSI */ |
614 | if (ssi_id >= 0) { | 618 | ret = rsnd_path_parse(priv, io, ssi); |
615 | mod = rsnd_ssi_mod_get(priv, ssi_id); | 619 | if (ret < 0) |
616 | ret = rsnd_dai_connect(mod, io); | 620 | return ret; |
617 | if (ret < 0) | ||
618 | return ret; | ||
619 | } | ||
620 | 621 | ||
621 | return ret; | 622 | return ret; |
622 | } | 623 | } |