diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-05-08 04:59:26 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-05-08 07:17:59 -0400 |
commit | 29e69fd2cd6f55233f64f600ad55ce2b661784d1 (patch) | |
tree | 4a97366f4c2b349e06ed00e8dcdb396766541f54 | |
parent | 5e392ea0da04d4206d56ec1479565fb42a044b57 (diff) |
ASoC: rsnd: remove compatibility code
Now, all platform is using new style rsnd_dai_platform_info.
Keeping compatibility is no longer needed.
We can cleanup code.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | include/sound/rcar_snd.h | 22 | ||||
-rw-r--r-- | sound/soc/sh/rcar/core.c | 54 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 3 | ||||
-rw-r--r-- | sound/soc/sh/rcar/src.c | 69 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 51 |
5 files changed, 36 insertions, 163 deletions
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h index 34a3c02a4576..a03268ec59c3 100644 --- a/include/sound/rcar_snd.h +++ b/include/sound/rcar_snd.h | |||
@@ -34,40 +34,24 @@ | |||
34 | * B : SSI direction | 34 | * B : SSI direction |
35 | */ | 35 | */ |
36 | #define RSND_SSI_CLK_PIN_SHARE (1 << 31) | 36 | #define RSND_SSI_CLK_PIN_SHARE (1 << 31) |
37 | #define RSND_SSI_PLAY (1 << 24) | ||
38 | 37 | ||
39 | #define RSND_SSI(_dma_id, _pio_irq, _flags) \ | 38 | #define RSND_SSI(_dma_id, _pio_irq, _flags) \ |
40 | { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } | 39 | { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } |
41 | #define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \ | ||
42 | { .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } | ||
43 | #define RSND_SSI_UNUSED \ | 40 | #define RSND_SSI_UNUSED \ |
44 | { .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 } | 41 | { .dma_id = -1, .pio_irq = -1, .flags = 0 } |
45 | 42 | ||
46 | struct rsnd_ssi_platform_info { | 43 | struct rsnd_ssi_platform_info { |
47 | int dai_id; /* will be removed */ | ||
48 | int dma_id; | 44 | int dma_id; |
49 | int pio_irq; | 45 | int pio_irq; |
50 | u32 flags; | 46 | u32 flags; |
51 | }; | 47 | }; |
52 | 48 | ||
53 | /* | ||
54 | * flags | ||
55 | */ | ||
56 | #define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */ | ||
57 | |||
58 | #define RSND_SRC(rate, _dma_id) \ | 49 | #define RSND_SRC(rate, _dma_id) \ |
59 | { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } | 50 | { .convert_rate = rate, .dma_id = _dma_id, } |
60 | #define RSND_SRC_SET(rate, _dma_id) \ | ||
61 | { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } | ||
62 | #define RSND_SRC_UNUSED \ | 51 | #define RSND_SRC_UNUSED \ |
63 | { .flags = 0, .convert_rate = 0, .dma_id = 0, } | 52 | { .convert_rate = 0, .dma_id = -1, } |
64 | |||
65 | #define rsnd_scu_platform_info rsnd_src_platform_info | ||
66 | #define src_info scu_info | ||
67 | #define src_info_nr scu_info_nr | ||
68 | 53 | ||
69 | struct rsnd_src_platform_info { | 54 | struct rsnd_src_platform_info { |
70 | u32 flags; | ||
71 | u32 convert_rate; /* sampling rate convert */ | 55 | u32 convert_rate; /* sampling rate convert */ |
72 | int dma_id; /* for Gen2 SCU */ | 56 | int dma_id; /* for Gen2 SCU */ |
73 | }; | 57 | }; |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 215b668166be..8ed84703b280 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -468,10 +468,7 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd, | |||
468 | struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai); | 468 | struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai); |
469 | struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); | 469 | struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); |
470 | struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); | 470 | struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); |
471 | struct rsnd_mod *mod = rsnd_ssi_mod_get_frm_dai(priv, | 471 | int ssi_id = rsnd_mod_id(rsnd_io_to_mod_ssi(io)); |
472 | rsnd_dai_id(priv, rdai), | ||
473 | rsnd_dai_is_play(rdai, io)); | ||
474 | int ssi_id = rsnd_mod_id(mod); | ||
475 | int ret; | 472 | int ret; |
476 | unsigned long flags; | 473 | unsigned long flags; |
477 | 474 | ||
@@ -584,7 +581,6 @@ static int rsnd_path_init(struct rsnd_priv *priv, | |||
584 | struct rsnd_dai_stream *io) | 581 | struct rsnd_dai_stream *io) |
585 | { | 582 | { |
586 | struct rsnd_mod *mod; | 583 | struct rsnd_mod *mod; |
587 | struct rsnd_dai_platform_info *dai_info = rdai->info; | ||
588 | int ret; | 584 | int ret; |
589 | int ssi_id = -1; | 585 | int ssi_id = -1; |
590 | int src_id = -1; | 586 | int src_id = -1; |
@@ -599,20 +595,10 @@ static int rsnd_path_init(struct rsnd_priv *priv, | |||
599 | * Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is | 595 | * Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is |
600 | * using fixed path. | 596 | * using fixed path. |
601 | */ | 597 | */ |
602 | if (dai_info) { | 598 | if (rsnd_is_enable_path(io, ssi)) |
603 | if (rsnd_is_enable_path(io, ssi)) | 599 | ssi_id = rsnd_info_id(priv, io, ssi); |
604 | ssi_id = rsnd_info_id(priv, io, ssi); | 600 | if (rsnd_is_enable_path(io, src)) |
605 | if (rsnd_is_enable_path(io, src)) | 601 | src_id = rsnd_info_id(priv, io, src); |
606 | src_id = rsnd_info_id(priv, io, src); | ||
607 | } else { | ||
608 | /* get SSI's ID */ | ||
609 | mod = rsnd_ssi_mod_get_frm_dai(priv, | ||
610 | rsnd_dai_id(priv, rdai), | ||
611 | rsnd_dai_is_play(rdai, io)); | ||
612 | if (!mod) | ||
613 | return 0; | ||
614 | ssi_id = src_id = rsnd_mod_id(mod); | ||
615 | } | ||
616 | 602 | ||
617 | ret = 0; | 603 | ret = 0; |
618 | 604 | ||
@@ -726,30 +712,15 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
726 | struct snd_soc_dai_driver *drv; | 712 | struct snd_soc_dai_driver *drv; |
727 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | 713 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); |
728 | struct rsnd_dai *rdai; | 714 | struct rsnd_dai *rdai; |
729 | struct rsnd_mod *pmod, *cmod; | 715 | struct rsnd_ssi_platform_info *pmod, *cmod; |
730 | struct device *dev = rsnd_priv_to_dev(priv); | 716 | struct device *dev = rsnd_priv_to_dev(priv); |
731 | int dai_nr; | 717 | int dai_nr; |
732 | int i; | 718 | int i; |
733 | 719 | ||
734 | rsnd_of_parse_dai(pdev, of_data, priv); | 720 | rsnd_of_parse_dai(pdev, of_data, priv); |
735 | 721 | ||
736 | /* | ||
737 | * dai_nr should be set via dai_info_nr, | ||
738 | * but allow it to keeping compatible | ||
739 | */ | ||
740 | dai_nr = info->dai_info_nr; | 722 | dai_nr = info->dai_info_nr; |
741 | if (!dai_nr) { | 723 | if (!dai_nr) { |
742 | /* get max dai nr */ | ||
743 | for (dai_nr = 0; dai_nr < 32; dai_nr++) { | ||
744 | pmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 1); | ||
745 | cmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 0); | ||
746 | |||
747 | if (!pmod && !cmod) | ||
748 | break; | ||
749 | } | ||
750 | } | ||
751 | |||
752 | if (!dai_nr) { | ||
753 | dev_err(dev, "no dai\n"); | 724 | dev_err(dev, "no dai\n"); |
754 | return -EIO; | 725 | return -EIO; |
755 | } | 726 | } |
@@ -766,11 +737,10 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
766 | priv->rdai = rdai; | 737 | priv->rdai = rdai; |
767 | 738 | ||
768 | for (i = 0; i < dai_nr; i++) { | 739 | for (i = 0; i < dai_nr; i++) { |
769 | if (info->dai_info) | 740 | rdai[i].info = &info->dai_info[i]; |
770 | rdai[i].info = &info->dai_info[i]; | ||
771 | 741 | ||
772 | pmod = rsnd_ssi_mod_get_frm_dai(priv, i, 1); | 742 | pmod = rdai[i].info->playback.ssi; |
773 | cmod = rsnd_ssi_mod_get_frm_dai(priv, i, 0); | 743 | cmod = rdai[i].info->capture.ssi; |
774 | 744 | ||
775 | /* | 745 | /* |
776 | * init rsnd_dai | 746 | * init rsnd_dai |
@@ -788,8 +758,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
788 | drv[i].playback.channels_min = 2; | 758 | drv[i].playback.channels_min = 2; |
789 | drv[i].playback.channels_max = 2; | 759 | drv[i].playback.channels_max = 2; |
790 | 760 | ||
791 | if (info->dai_info) | 761 | rdai[i].playback.info = &info->dai_info[i].playback; |
792 | rdai[i].playback.info = &info->dai_info[i].playback; | ||
793 | rsnd_path_init(priv, &rdai[i], &rdai[i].playback); | 762 | rsnd_path_init(priv, &rdai[i], &rdai[i].playback); |
794 | } | 763 | } |
795 | if (cmod) { | 764 | if (cmod) { |
@@ -798,8 +767,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
798 | drv[i].capture.channels_min = 2; | 767 | drv[i].capture.channels_min = 2; |
799 | drv[i].capture.channels_max = 2; | 768 | drv[i].capture.channels_max = 2; |
800 | 769 | ||
801 | if (info->dai_info) | 770 | rdai[i].capture.info = &info->dai_info[i].capture; |
802 | rdai[i].capture.info = &info->dai_info[i].capture; | ||
803 | rsnd_path_init(priv, &rdai[i], &rdai[i].capture); | 771 | rsnd_path_init(priv, &rdai[i], &rdai[i].capture); |
804 | } | 772 | } |
805 | 773 | ||
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 619d198c7d2e..061b04cbd7d5 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -379,9 +379,6 @@ int rsnd_ssi_probe(struct platform_device *pdev, | |||
379 | const struct rsnd_of_data *of_data, | 379 | const struct rsnd_of_data *of_data, |
380 | struct rsnd_priv *priv); | 380 | struct rsnd_priv *priv); |
381 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); | 381 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); |
382 | struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv, | ||
383 | int dai_id, int is_play); | ||
384 | int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); | 382 | int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); |
385 | int rsnd_ssi_is_play(struct rsnd_mod *mod); | ||
386 | 383 | ||
387 | #endif | 384 | #endif |
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 6232b7d307aa..d51c59bf7c47 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c | |||
@@ -27,12 +27,9 @@ struct rsnd_src { | |||
27 | #define OTBL_18 (6 << 16) | 27 | #define OTBL_18 (6 << 16) |
28 | #define OTBL_16 (8 << 16) | 28 | #define OTBL_16 (8 << 16) |
29 | 29 | ||
30 | #define rsnd_src_mode_flags(p) ((p)->info->flags) | ||
31 | #define rsnd_src_convert_rate(p) ((p)->info->convert_rate) | 30 | #define rsnd_src_convert_rate(p) ((p)->info->convert_rate) |
32 | #define rsnd_mod_to_src(_mod) \ | 31 | #define rsnd_mod_to_src(_mod) \ |
33 | container_of((_mod), struct rsnd_src, mod) | 32 | container_of((_mod), struct rsnd_src, mod) |
34 | #define rsnd_src_hpbif_is_enable(src) \ | ||
35 | (rsnd_src_mode_flags(src) & RSND_SCU_USE_HPBIF) | ||
36 | #define rsnd_src_dma_available(src) \ | 33 | #define rsnd_src_dma_available(src) \ |
37 | rsnd_dma_available(rsnd_mod_to_dma(&(src)->mod)) | 34 | rsnd_dma_available(rsnd_mod_to_dma(&(src)->mod)) |
38 | 35 | ||
@@ -80,34 +77,35 @@ struct rsnd_src { | |||
80 | * | 77 | * |
81 | * This driver request | 78 | * This driver request |
82 | * struct rsnd_src_platform_info { | 79 | * struct rsnd_src_platform_info { |
83 | * u32 flags; | ||
84 | * u32 convert_rate; | 80 | * u32 convert_rate; |
81 | * int dma_id; | ||
85 | * } | 82 | * } |
86 | * | 83 | * |
87 | * rsnd_src_hpbif_is_enable() will be true | ||
88 | * if flags had RSND_SRC_USE_HPBIF, | ||
89 | * and it controls whether SSIU is used or not. | ||
90 | * | ||
91 | * rsnd_src_convert_rate() indicates | 84 | * rsnd_src_convert_rate() indicates |
92 | * above convert_rate, and it controls | 85 | * above convert_rate, and it controls |
93 | * whether SRC is used or not. | 86 | * whether SRC is used or not. |
94 | * | 87 | * |
95 | * ex) doesn't use SRC | 88 | * ex) doesn't use SRC |
96 | * struct rsnd_src_platform_info info = { | 89 | * static struct rsnd_dai_platform_info rsnd_dai = { |
97 | * .flags = 0, | 90 | * .playback = { .ssi = &rsnd_ssi[0], }, |
98 | * .convert_rate = 0, | ||
99 | * }; | 91 | * }; |
100 | * | 92 | * |
101 | * ex) uses SRC | 93 | * ex) uses SRC |
102 | * struct rsnd_src_platform_info info = { | 94 | * static struct rsnd_src_platform_info rsnd_src[] = { |
103 | * .flags = RSND_SRC_USE_HPBIF, | 95 | * RSND_SCU(48000, 0), |
104 | * .convert_rate = 48000, | 96 | * ... |
97 | * }; | ||
98 | * static struct rsnd_dai_platform_info rsnd_dai = { | ||
99 | * .playback = { .ssi = &rsnd_ssi[0], .src = &rsnd_src[0] }, | ||
105 | * }; | 100 | * }; |
106 | * | 101 | * |
107 | * ex) uses SRC bypass mode | 102 | * ex) uses SRC bypass mode |
108 | * struct rsnd_src_platform_info info = { | 103 | * static struct rsnd_src_platform_info rsnd_src[] = { |
109 | * .flags = RSND_SRC_USE_HPBIF, | 104 | * RSND_SCU(0, 0), |
110 | * .convert_rate = 0, | 105 | * ... |
106 | * }; | ||
107 | * static struct rsnd_dai_platform_info rsnd_dai = { | ||
108 | * .playback = { .ssi = &rsnd_ssi[0], .src = &rsnd_src[0] }, | ||
111 | * }; | 109 | * }; |
112 | * | 110 | * |
113 | */ | 111 | */ |
@@ -119,24 +117,14 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod, | |||
119 | struct rsnd_dai *rdai, | 117 | struct rsnd_dai *rdai, |
120 | struct rsnd_dai_stream *io) | 118 | struct rsnd_dai_stream *io) |
121 | { | 119 | { |
122 | struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod); | ||
123 | struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io); | 120 | struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io); |
124 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | ||
125 | int ssi_id = rsnd_mod_id(ssi_mod); | 121 | int ssi_id = rsnd_mod_id(ssi_mod); |
126 | int has_src = 0; | ||
127 | 122 | ||
128 | /* | 123 | /* |
129 | * SSI_MODE0 | 124 | * SSI_MODE0 |
130 | */ | 125 | */ |
131 | if (info->dai_info) { | ||
132 | has_src = !!src_mod; | ||
133 | } else { | ||
134 | struct rsnd_src *src = rsnd_mod_to_src(src_mod); | ||
135 | has_src = rsnd_src_hpbif_is_enable(src); | ||
136 | } | ||
137 | |||
138 | rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id), | 126 | rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id), |
139 | has_src ? 0 : (1 << ssi_id)); | 127 | src_mod ? 0 : (1 << ssi_id)); |
140 | 128 | ||
141 | /* | 129 | /* |
142 | * SSI_MODE1 | 130 | * SSI_MODE1 |
@@ -534,21 +522,13 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod, | |||
534 | struct rsnd_dai_stream *io) | 522 | struct rsnd_dai_stream *io) |
535 | { | 523 | { |
536 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | 524 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
537 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | ||
538 | struct rsnd_src *src = rsnd_mod_to_src(mod); | 525 | struct rsnd_src *src = rsnd_mod_to_src(mod); |
539 | struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, rsnd_mod_id(mod)); | ||
540 | struct device *dev = rsnd_priv_to_dev(priv); | 526 | struct device *dev = rsnd_priv_to_dev(priv); |
541 | int ret; | 527 | int ret; |
542 | int is_play; | ||
543 | |||
544 | if (info->dai_info) | ||
545 | is_play = rsnd_info_is_playback(priv, src); | ||
546 | else | ||
547 | is_play = rsnd_ssi_is_play(ssi); | ||
548 | 528 | ||
549 | ret = rsnd_dma_init(priv, | 529 | ret = rsnd_dma_init(priv, |
550 | rsnd_mod_to_dma(mod), | 530 | rsnd_mod_to_dma(mod), |
551 | is_play, | 531 | rsnd_info_is_playback(priv, src), |
552 | src->info->dma_id); | 532 | src->info->dma_id); |
553 | if (ret < 0) | 533 | if (ret < 0) |
554 | dev_err(dev, "SRC DMA failed\n"); | 534 | dev_err(dev, "SRC DMA failed\n"); |
@@ -699,11 +679,6 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
699 | snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i); | 679 | snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i); |
700 | 680 | ||
701 | clk = devm_clk_get(dev, name); | 681 | clk = devm_clk_get(dev, name); |
702 | if (IS_ERR(clk)) { | ||
703 | snprintf(name, RSND_SRC_NAME_SIZE, "scu.%d", i); | ||
704 | clk = devm_clk_get(dev, name); | ||
705 | } | ||
706 | |||
707 | if (IS_ERR(clk)) | 682 | if (IS_ERR(clk)) |
708 | return PTR_ERR(clk); | 683 | return PTR_ERR(clk); |
709 | 684 | ||
@@ -711,12 +686,10 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
711 | src->clk = clk; | 686 | src->clk = clk; |
712 | 687 | ||
713 | ops = &rsnd_src_non_ops; | 688 | ops = &rsnd_src_non_ops; |
714 | if (rsnd_src_hpbif_is_enable(src)) { | 689 | if (rsnd_is_gen1(priv)) |
715 | if (rsnd_is_gen1(priv)) | 690 | ops = &rsnd_src_gen1_ops; |
716 | ops = &rsnd_src_gen1_ops; | 691 | if (rsnd_is_gen2(priv)) |
717 | if (rsnd_is_gen2(priv)) | 692 | ops = &rsnd_src_gen2_ops; |
718 | ops = &rsnd_src_gen2_ops; | ||
719 | } | ||
720 | 693 | ||
721 | rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i); | 694 | rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i); |
722 | 695 | ||
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 4b7e20603dd7..77b7b60325c1 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -422,20 +422,13 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, | |||
422 | { | 422 | { |
423 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | 423 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
424 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); | 424 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
425 | struct rcar_snd_info *info = rsnd_priv_to_info(priv); | ||
426 | struct device *dev = rsnd_priv_to_dev(priv); | 425 | struct device *dev = rsnd_priv_to_dev(priv); |
427 | int dma_id = ssi->info->dma_id; | 426 | int dma_id = ssi->info->dma_id; |
428 | int is_play; | ||
429 | int ret; | 427 | int ret; |
430 | 428 | ||
431 | if (info->dai_info) | ||
432 | is_play = rsnd_info_is_playback(priv, ssi); | ||
433 | else | ||
434 | is_play = rsnd_ssi_is_play(&ssi->mod); | ||
435 | |||
436 | ret = rsnd_dma_init( | 429 | ret = rsnd_dma_init( |
437 | priv, rsnd_mod_to_dma(mod), | 430 | priv, rsnd_mod_to_dma(mod), |
438 | is_play, | 431 | rsnd_info_is_playback(priv, ssi), |
439 | dma_id); | 432 | dma_id); |
440 | 433 | ||
441 | if (ret < 0) | 434 | if (ret < 0) |
@@ -512,41 +505,6 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = { | |||
512 | /* | 505 | /* |
513 | * ssi mod function | 506 | * ssi mod function |
514 | */ | 507 | */ |
515 | struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv, | ||
516 | int dai_id, int is_play) | ||
517 | { | ||
518 | struct rsnd_dai_platform_info *dai_info = NULL; | ||
519 | struct rsnd_dai_path_info *path_info = NULL; | ||
520 | struct rsnd_ssi_platform_info *target_info = NULL; | ||
521 | struct rsnd_ssi *ssi; | ||
522 | int i, has_play; | ||
523 | |||
524 | if (priv->rdai) | ||
525 | dai_info = priv->rdai[dai_id].info; | ||
526 | if (dai_info) | ||
527 | path_info = (is_play) ? &dai_info->playback : &dai_info->capture; | ||
528 | if (path_info) | ||
529 | target_info = path_info->ssi; | ||
530 | |||
531 | is_play = !!is_play; | ||
532 | |||
533 | for_each_rsnd_ssi(ssi, priv, i) { | ||
534 | if (target_info == ssi->info) | ||
535 | return &ssi->mod; | ||
536 | |||
537 | /* for compatible */ | ||
538 | if (rsnd_ssi_dai_id(ssi) != dai_id) | ||
539 | continue; | ||
540 | |||
541 | has_play = rsnd_ssi_is_play(&ssi->mod); | ||
542 | |||
543 | if (is_play == has_play) | ||
544 | return &ssi->mod; | ||
545 | } | ||
546 | |||
547 | return NULL; | ||
548 | } | ||
549 | |||
550 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) | 508 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) |
551 | { | 509 | { |
552 | if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv))) | 510 | if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv))) |
@@ -562,13 +520,6 @@ int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) | |||
562 | return !!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_CLK_PIN_SHARE); | 520 | return !!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_CLK_PIN_SHARE); |
563 | } | 521 | } |
564 | 522 | ||
565 | int rsnd_ssi_is_play(struct rsnd_mod *mod) | ||
566 | { | ||
567 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); | ||
568 | |||
569 | return !!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_PLAY); | ||
570 | } | ||
571 | |||
572 | static void rsnd_ssi_parent_clk_setup(struct rsnd_priv *priv, struct rsnd_ssi *ssi) | 523 | static void rsnd_ssi_parent_clk_setup(struct rsnd_priv *priv, struct rsnd_ssi *ssi) |
573 | { | 524 | { |
574 | if (!rsnd_ssi_is_pin_sharing(&ssi->mod)) | 525 | if (!rsnd_ssi_is_pin_sharing(&ssi->mod)) |