diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-03-03 23:50:41 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-05 01:07:53 -0500 |
commit | 76c6fb5c49790da44d553f655182b426ade2c599 (patch) | |
tree | b19f632710e3473e10b76eff322d96daf67f1696 /sound/soc/sh/rcar | |
parent | 7681f6ac6b6338932621f842d68e54f6267b785f (diff) |
ASoC: rsnd: use mod probe method on SCU
Now, it can use .probe
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/sh/rcar')
-rw-r--r-- | sound/soc/sh/rcar/scu.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 63e6aeb8c42d..40250acf608d 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c | |||
@@ -525,6 +525,42 @@ static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod, | |||
525 | return ret; | 525 | return ret; |
526 | } | 526 | } |
527 | 527 | ||
528 | static int rsnd_scu_probe_gen2(struct rsnd_mod *mod, | ||
529 | struct rsnd_dai *rdai, | ||
530 | struct rsnd_dai_stream *io) | ||
531 | { | ||
532 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | ||
533 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | ||
534 | struct rsnd_scu *scu = rsnd_mod_to_scu(mod); | ||
535 | struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, rsnd_mod_id(mod)); | ||
536 | struct device *dev = rsnd_priv_to_dev(priv); | ||
537 | int ret; | ||
538 | int is_play; | ||
539 | |||
540 | if (info->dai_info) | ||
541 | is_play = rsnd_info_is_playback(priv, scu); | ||
542 | else | ||
543 | is_play = rsnd_ssi_is_play(ssi); | ||
544 | |||
545 | ret = rsnd_dma_init(priv, | ||
546 | rsnd_mod_to_dma(mod), | ||
547 | is_play, | ||
548 | scu->info->dma_id); | ||
549 | if (ret < 0) | ||
550 | dev_err(dev, "SCU DMA failed\n"); | ||
551 | |||
552 | return ret; | ||
553 | } | ||
554 | |||
555 | static int rsnd_scu_remove_gen2(struct rsnd_mod *mod, | ||
556 | struct rsnd_dai *rdai, | ||
557 | struct rsnd_dai_stream *io) | ||
558 | { | ||
559 | rsnd_dma_quit(rsnd_mod_to_priv(mod), rsnd_mod_to_dma(mod)); | ||
560 | |||
561 | return 0; | ||
562 | } | ||
563 | |||
528 | static int rsnd_scu_init_gen2(struct rsnd_mod *mod, | 564 | static int rsnd_scu_init_gen2(struct rsnd_mod *mod, |
529 | struct rsnd_dai *rdai, | 565 | struct rsnd_dai *rdai, |
530 | struct rsnd_dai_stream *io) | 566 | struct rsnd_dai_stream *io) |
@@ -576,6 +612,8 @@ static int rsnd_scu_stop_gen2(struct rsnd_mod *mod, | |||
576 | 612 | ||
577 | static struct rsnd_mod_ops rsnd_scu_gen2_ops = { | 613 | static struct rsnd_mod_ops rsnd_scu_gen2_ops = { |
578 | .name = "scu (gen2)", | 614 | .name = "scu (gen2)", |
615 | .probe = rsnd_scu_probe_gen2, | ||
616 | .remove = rsnd_scu_remove_gen2, | ||
579 | .init = rsnd_scu_init_gen2, | 617 | .init = rsnd_scu_init_gen2, |
580 | .quit = rsnd_scu_quit, | 618 | .quit = rsnd_scu_quit, |
581 | .start = rsnd_scu_start_gen2, | 619 | .start = rsnd_scu_start_gen2, |
@@ -631,25 +669,8 @@ int rsnd_scu_probe(struct platform_device *pdev, | |||
631 | if (rsnd_scu_hpbif_is_enable(scu)) { | 669 | if (rsnd_scu_hpbif_is_enable(scu)) { |
632 | if (rsnd_is_gen1(priv)) | 670 | if (rsnd_is_gen1(priv)) |
633 | ops = &rsnd_scu_gen1_ops; | 671 | ops = &rsnd_scu_gen1_ops; |
634 | if (rsnd_is_gen2(priv)) { | 672 | if (rsnd_is_gen2(priv)) |
635 | int ret; | ||
636 | int is_play; | ||
637 | |||
638 | if (info->dai_info) { | ||
639 | is_play = rsnd_info_is_playback(priv, scu); | ||
640 | } else { | ||
641 | struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, i); | ||
642 | is_play = rsnd_ssi_is_play(ssi); | ||
643 | } | ||
644 | ret = rsnd_dma_init(priv, | ||
645 | rsnd_mod_to_dma(&scu->mod), | ||
646 | is_play, | ||
647 | scu->info->dma_id); | ||
648 | if (ret < 0) | ||
649 | return ret; | ||
650 | |||
651 | ops = &rsnd_scu_gen2_ops; | 673 | ops = &rsnd_scu_gen2_ops; |
652 | } | ||
653 | } | 674 | } |
654 | 675 | ||
655 | rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i); | 676 | rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i); |
@@ -663,11 +684,4 @@ int rsnd_scu_probe(struct platform_device *pdev, | |||
663 | void rsnd_scu_remove(struct platform_device *pdev, | 684 | void rsnd_scu_remove(struct platform_device *pdev, |
664 | struct rsnd_priv *priv) | 685 | struct rsnd_priv *priv) |
665 | { | 686 | { |
666 | struct rsnd_scu *scu; | ||
667 | int i; | ||
668 | |||
669 | for_each_rsnd_scu(scu, priv, i) { | ||
670 | if (rsnd_scu_dma_available(scu)) | ||
671 | rsnd_dma_quit(priv, rsnd_mod_to_dma(&scu->mod)); | ||
672 | } | ||
673 | } | 687 | } |