aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2016-02-18 03:17:52 -0500
committerMark Brown <broonie@kernel.org>2016-02-19 10:53:02 -0500
commit098bd8911a5eacc3b70fdc09fa4084657511c584 (patch)
tree8664dcd58585cf18bcf871df5e052dc425665b5c
parent0dc6bf75023a42895962800020583c19e0b87159 (diff)
ASoC: rsnd: Parent SSI attach is not needed if not clock master
Parent SSI is needed if it is PIN sharing and clock master, otherwise, not needed. But, whether clockk master is judged on .set_fmt, thus, it can't call rsnd_ssi_parent_attach() on .probe. Now, .pcm_new will be called after .set_fmt, so this patch reuses it at this point. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sh/rcar/ssi.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 120587270fe7..b5c6f0c274c3 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -545,12 +545,17 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
545 * SSI PIO 545 * SSI PIO
546 */ 546 */
547static void rsnd_ssi_parent_attach(struct rsnd_mod *mod, 547static void rsnd_ssi_parent_attach(struct rsnd_mod *mod,
548 struct rsnd_dai_stream *io, 548 struct rsnd_dai_stream *io)
549 struct rsnd_priv *priv)
550{ 549{
550 struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
551 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
552
551 if (!__rsnd_ssi_is_pin_sharing(mod)) 553 if (!__rsnd_ssi_is_pin_sharing(mod))
552 return; 554 return;
553 555
556 if (!rsnd_rdai_is_clk_master(rdai))
557 return;
558
554 switch (rsnd_mod_id(mod)) { 559 switch (rsnd_mod_id(mod)) {
555 case 1: 560 case 1:
556 case 2: 561 case 2:
@@ -565,6 +570,20 @@ static void rsnd_ssi_parent_attach(struct rsnd_mod *mod,
565 } 570 }
566} 571}
567 572
573static int rsnd_ssi_pcm_new(struct rsnd_mod *mod,
574 struct rsnd_dai_stream *io,
575 struct snd_soc_pcm_runtime *rtd)
576{
577 /*
578 * rsnd_rdai_is_clk_master() will be enabled after set_fmt,
579 * and, pcm_new will be called after it.
580 * This function reuse pcm_new at this point.
581 */
582 rsnd_ssi_parent_attach(mod, io);
583
584 return 0;
585}
586
568static int rsnd_ssi_common_probe(struct rsnd_mod *mod, 587static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
569 struct rsnd_dai_stream *io, 588 struct rsnd_dai_stream *io,
570 struct rsnd_priv *priv) 589 struct rsnd_priv *priv)
@@ -580,7 +599,10 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
580 if (rsnd_ssi_is_multi_slave(mod, io)) 599 if (rsnd_ssi_is_multi_slave(mod, io))
581 return 0; 600 return 0;
582 601
583 rsnd_ssi_parent_attach(mod, io, priv); 602 /*
603 * It can't judge ssi parent at this point
604 * see rsnd_ssi_pcm_new()
605 */
584 606
585 ret = rsnd_ssiu_attach(io, mod); 607 ret = rsnd_ssiu_attach(io, mod);
586 if (ret < 0) 608 if (ret < 0)
@@ -602,6 +624,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
602 .start = rsnd_ssi_start, 624 .start = rsnd_ssi_start,
603 .stop = rsnd_ssi_stop, 625 .stop = rsnd_ssi_stop,
604 .irq = rsnd_ssi_irq, 626 .irq = rsnd_ssi_irq,
627 .pcm_new = rsnd_ssi_pcm_new,
605 .hw_params = rsnd_ssi_hw_params, 628 .hw_params = rsnd_ssi_hw_params,
606}; 629};
607 630
@@ -691,6 +714,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
691 .start = rsnd_ssi_start, 714 .start = rsnd_ssi_start,
692 .stop = rsnd_ssi_stop, 715 .stop = rsnd_ssi_stop,
693 .irq = rsnd_ssi_irq, 716 .irq = rsnd_ssi_irq,
717 .pcm_new = rsnd_ssi_pcm_new,
694 .fallback = rsnd_ssi_fallback, 718 .fallback = rsnd_ssi_fallback,
695 .hw_params = rsnd_ssi_hw_params, 719 .hw_params = rsnd_ssi_hw_params,
696}; 720};