aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2009-03-02 20:41:00 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-03-04 17:29:47 -0500
commit6335d05548eece40092000aa91b64a50310d69d5 (patch)
treeac72c74562f349879a127b4067827476a7875c88 /sound/soc/pxa
parentff09d49ad0176a5f52a398c137a7ff5f669d6be4 (diff)
ASoC: make ops a pointer in 'struct snd_soc_dai'
Considering the fact that most cpu_dai or codec_dai are using a same 'snd_soc_dai_ops' for several similar interfaces, 'ops' would be better made a pointer instead, to make sharing easier and code a bit cleaner. The patch below is rather preliminary since the asoc tree is being actively developed, and this touches almost every piece of code, (and possibly many others in development need to be changed as well). Building of all codecs are OK, yet to every SoC, I didn't test that. Signed-off-by: Eric Miao <eric.miao@marvell.com> Acked-by: Timur Tabi <timur@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/pxa-ssp.c65
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c13
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c18
3 files changed, 34 insertions, 62 deletions
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 4a973ab710be..3e18064e86b2 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -784,6 +784,19 @@ static void pxa_ssp_remove(struct platform_device *pdev,
784 SNDRV_PCM_FMTBIT_S24_LE | \ 784 SNDRV_PCM_FMTBIT_S24_LE | \
785 SNDRV_PCM_FMTBIT_S32_LE) 785 SNDRV_PCM_FMTBIT_S32_LE)
786 786
787static struct snd_soc_dai_ops pxa_ssp_dai_ops = {
788 .startup = pxa_ssp_startup,
789 .shutdown = pxa_ssp_shutdown,
790 .trigger = pxa_ssp_trigger,
791 .hw_params = pxa_ssp_hw_params,
792 .set_sysclk = pxa_ssp_set_dai_sysclk,
793 .set_clkdiv = pxa_ssp_set_dai_clkdiv,
794 .set_pll = pxa_ssp_set_dai_pll,
795 .set_fmt = pxa_ssp_set_dai_fmt,
796 .set_tdm_slot = pxa_ssp_set_dai_tdm_slot,
797 .set_tristate = pxa_ssp_set_dai_tristate,
798};
799
787struct snd_soc_dai pxa_ssp_dai[] = { 800struct snd_soc_dai pxa_ssp_dai[] = {
788 { 801 {
789 .name = "pxa2xx-ssp1", 802 .name = "pxa2xx-ssp1",
@@ -804,18 +817,7 @@ struct snd_soc_dai pxa_ssp_dai[] = {
804 .rates = PXA_SSP_RATES, 817 .rates = PXA_SSP_RATES,
805 .formats = PXA_SSP_FORMATS, 818 .formats = PXA_SSP_FORMATS,
806 }, 819 },
807 .ops = { 820 .ops = &pxa_ssp_dai_ops,
808 .startup = pxa_ssp_startup,
809 .shutdown = pxa_ssp_shutdown,
810 .trigger = pxa_ssp_trigger,
811 .hw_params = pxa_ssp_hw_params,
812 .set_sysclk = pxa_ssp_set_dai_sysclk,
813 .set_clkdiv = pxa_ssp_set_dai_clkdiv,
814 .set_pll = pxa_ssp_set_dai_pll,
815 .set_fmt = pxa_ssp_set_dai_fmt,
816 .set_tdm_slot = pxa_ssp_set_dai_tdm_slot,
817 .set_tristate = pxa_ssp_set_dai_tristate,
818 },
819 }, 821 },
820 { .name = "pxa2xx-ssp2", 822 { .name = "pxa2xx-ssp2",
821 .id = 1, 823 .id = 1,
@@ -835,18 +837,7 @@ struct snd_soc_dai pxa_ssp_dai[] = {
835 .rates = PXA_SSP_RATES, 837 .rates = PXA_SSP_RATES,
836 .formats = PXA_SSP_FORMATS, 838 .formats = PXA_SSP_FORMATS,
837 }, 839 },
838 .ops = { 840 .ops = &pxa_ssp_dai_ops,
839 .startup = pxa_ssp_startup,
840 .shutdown = pxa_ssp_shutdown,
841 .trigger = pxa_ssp_trigger,
842 .hw_params = pxa_ssp_hw_params,
843 .set_sysclk = pxa_ssp_set_dai_sysclk,
844 .set_clkdiv = pxa_ssp_set_dai_clkdiv,
845 .set_pll = pxa_ssp_set_dai_pll,
846 .set_fmt = pxa_ssp_set_dai_fmt,
847 .set_tdm_slot = pxa_ssp_set_dai_tdm_slot,
848 .set_tristate = pxa_ssp_set_dai_tristate,
849 },
850 }, 841 },
851 { 842 {
852 .name = "pxa2xx-ssp3", 843 .name = "pxa2xx-ssp3",
@@ -867,18 +858,7 @@ struct snd_soc_dai pxa_ssp_dai[] = {
867 .rates = PXA_SSP_RATES, 858 .rates = PXA_SSP_RATES,
868 .formats = PXA_SSP_FORMATS, 859 .formats = PXA_SSP_FORMATS,
869 }, 860 },
870 .ops = { 861 .ops = &pxa_ssp_dai_ops,
871 .startup = pxa_ssp_startup,
872 .shutdown = pxa_ssp_shutdown,
873 .trigger = pxa_ssp_trigger,
874 .hw_params = pxa_ssp_hw_params,
875 .set_sysclk = pxa_ssp_set_dai_sysclk,
876 .set_clkdiv = pxa_ssp_set_dai_clkdiv,
877 .set_pll = pxa_ssp_set_dai_pll,
878 .set_fmt = pxa_ssp_set_dai_fmt,
879 .set_tdm_slot = pxa_ssp_set_dai_tdm_slot,
880 .set_tristate = pxa_ssp_set_dai_tristate,
881 },
882 }, 862 },
883 { 863 {
884 .name = "pxa2xx-ssp4", 864 .name = "pxa2xx-ssp4",
@@ -899,18 +879,7 @@ struct snd_soc_dai pxa_ssp_dai[] = {
899 .rates = PXA_SSP_RATES, 879 .rates = PXA_SSP_RATES,
900 .formats = PXA_SSP_FORMATS, 880 .formats = PXA_SSP_FORMATS,
901 }, 881 },
902 .ops = { 882 .ops = &pxa_ssp_dai_ops,
903 .startup = pxa_ssp_startup,
904 .shutdown = pxa_ssp_shutdown,
905 .trigger = pxa_ssp_trigger,
906 .hw_params = pxa_ssp_hw_params,
907 .set_sysclk = pxa_ssp_set_dai_sysclk,
908 .set_clkdiv = pxa_ssp_set_dai_clkdiv,
909 .set_pll = pxa_ssp_set_dai_pll,
910 .set_fmt = pxa_ssp_set_dai_fmt,
911 .set_tdm_slot = pxa_ssp_set_dai_tdm_slot,
912 .set_tristate = pxa_ssp_set_dai_tristate,
913 },
914 }, 883 },
915}; 884};
916EXPORT_SYMBOL_GPL(pxa_ssp_dai); 885EXPORT_SYMBOL_GPL(pxa_ssp_dai);
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 812c2b4d3e07..11cd0f289c16 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -164,6 +164,10 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream,
164 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ 164 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
165 SNDRV_PCM_RATE_48000) 165 SNDRV_PCM_RATE_48000)
166 166
167static struct snd_soc_dai_ops pxa_ac97_dai_ops = {
168 .hw_params = pxa2xx_ac97_hw_params,
169};
170
167/* 171/*
168 * There is only 1 physical AC97 interface for pxa2xx, but it 172 * There is only 1 physical AC97 interface for pxa2xx, but it
169 * has extra fifo's that can be used for aux DACs and ADCs. 173 * has extra fifo's that can be used for aux DACs and ADCs.
@@ -189,8 +193,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
189 .channels_max = 2, 193 .channels_max = 2,
190 .rates = PXA2XX_AC97_RATES, 194 .rates = PXA2XX_AC97_RATES,
191 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 195 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
192 .ops = { 196 .ops = &pxa_ac97_dai_ops,
193 .hw_params = pxa2xx_ac97_hw_params,},
194}, 197},
195{ 198{
196 .name = "pxa2xx-ac97-aux", 199 .name = "pxa2xx-ac97-aux",
@@ -208,8 +211,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
208 .channels_max = 1, 211 .channels_max = 1,
209 .rates = PXA2XX_AC97_RATES, 212 .rates = PXA2XX_AC97_RATES,
210 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 213 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
211 .ops = { 214 .ops = &pxa_ac97_dai_ops,
212 .hw_params = pxa2xx_ac97_hw_aux_params,},
213}, 215},
214{ 216{
215 .name = "pxa2xx-ac97-mic", 217 .name = "pxa2xx-ac97-mic",
@@ -221,8 +223,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
221 .channels_max = 1, 223 .channels_max = 1,
222 .rates = PXA2XX_AC97_RATES, 224 .rates = PXA2XX_AC97_RATES,
223 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 225 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
224 .ops = { 226 .ops = &pxa_ac97_dai_ops,
225 .hw_params = pxa2xx_ac97_hw_mic_params,},
226}, 227},
227}; 228};
228 229
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 83b59d7fe96e..e6c24408c5f9 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -304,6 +304,15 @@ static int pxa2xx_i2s_resume(struct snd_soc_dai *dai)
304 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ 304 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
305 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) 305 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
306 306
307static struct snd_soc_dai_ops pxa_i2s_dai_ops = {
308 .startup = pxa2xx_i2s_startup,
309 .shutdown = pxa2xx_i2s_shutdown,
310 .trigger = pxa2xx_i2s_trigger,
311 .hw_params = pxa2xx_i2s_hw_params,
312 .set_fmt = pxa2xx_i2s_set_dai_fmt,
313 .set_sysclk = pxa2xx_i2s_set_dai_sysclk,
314};
315
307struct snd_soc_dai pxa_i2s_dai = { 316struct snd_soc_dai pxa_i2s_dai = {
308 .name = "pxa2xx-i2s", 317 .name = "pxa2xx-i2s",
309 .id = 0, 318 .id = 0,
@@ -319,14 +328,7 @@ struct snd_soc_dai pxa_i2s_dai = {
319 .channels_max = 2, 328 .channels_max = 2,
320 .rates = PXA2XX_I2S_RATES, 329 .rates = PXA2XX_I2S_RATES,
321 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 330 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
322 .ops = { 331 .ops = &pxa_i2s_dai_ops,
323 .startup = pxa2xx_i2s_startup,
324 .shutdown = pxa2xx_i2s_shutdown,
325 .trigger = pxa2xx_i2s_trigger,
326 .hw_params = pxa2xx_i2s_hw_params,
327 .set_fmt = pxa2xx_i2s_set_dai_fmt,
328 .set_sysclk = pxa2xx_i2s_set_dai_sysclk,
329 },
330}; 332};
331 333
332EXPORT_SYMBOL_GPL(pxa_i2s_dai); 334EXPORT_SYMBOL_GPL(pxa_i2s_dai);