diff options
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r-- | sound/soc/pxa/Kconfig | 20 | ||||
-rw-r--r-- | sound/soc/pxa/Makefile | 4 | ||||
-rw-r--r-- | sound/soc/pxa/mmp-pcm.c | 6 | ||||
-rw-r--r-- | sound/soc/pxa/mmp-sspa.c | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.c | 10 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.h | 3 | ||||
-rw-r--r-- | sound/soc/pxa/saarb.c | 190 | ||||
-rw-r--r-- | sound/soc/pxa/tavorevb3.c | 189 | ||||
-rw-r--r-- | sound/soc/pxa/zylonite.c | 1 |
9 files changed, 12 insertions, 413 deletions
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 4d2e46fae77c..b35809467547 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -130,26 +130,6 @@ config SND_PXA2XX_SOC_PALM27X | |||
130 | Say Y if you want to add support for SoC audio on | 130 | Say Y if you want to add support for SoC audio on |
131 | Palm T|X, T5, E2 or LifeDrive handheld computer. | 131 | Palm T|X, T5, E2 or LifeDrive handheld computer. |
132 | 132 | ||
133 | config SND_SOC_SAARB | ||
134 | tristate "SoC Audio support for Marvell Saarb" | ||
135 | depends on SND_PXA2XX_SOC && MACH_SAARB | ||
136 | select MFD_88PM860X | ||
137 | select SND_PXA_SOC_SSP | ||
138 | select SND_SOC_88PM860X | ||
139 | help | ||
140 | Say Y if you want to add support for SoC audio on the | ||
141 | Marvell Saarb reference platform. | ||
142 | |||
143 | config SND_SOC_TAVOREVB3 | ||
144 | tristate "SoC Audio support for Marvell Tavor EVB3" | ||
145 | depends on SND_PXA2XX_SOC && MACH_TAVOREVB3 | ||
146 | select MFD_88PM860X | ||
147 | select SND_PXA_SOC_SSP | ||
148 | select SND_SOC_88PM860X | ||
149 | help | ||
150 | Say Y if you want to add support for SoC audio on the | ||
151 | Marvell Saarb reference platform. | ||
152 | |||
153 | config SND_PXA910_SOC | 133 | config SND_PXA910_SOC |
154 | tristate "SoC Audio for Marvell PXA910 chip" | 134 | tristate "SoC Audio for Marvell PXA910 chip" |
155 | depends on ARCH_MMP && SND | 135 | depends on ARCH_MMP && SND |
diff --git a/sound/soc/pxa/Makefile b/sound/soc/pxa/Makefile index d8a265d2d5d7..2cff67b61dc3 100644 --- a/sound/soc/pxa/Makefile +++ b/sound/soc/pxa/Makefile | |||
@@ -23,8 +23,6 @@ snd-soc-e800-objs := e800_wm9712.o | |||
23 | snd-soc-spitz-objs := spitz.o | 23 | snd-soc-spitz-objs := spitz.o |
24 | snd-soc-em-x270-objs := em-x270.o | 24 | snd-soc-em-x270-objs := em-x270.o |
25 | snd-soc-palm27x-objs := palm27x.o | 25 | snd-soc-palm27x-objs := palm27x.o |
26 | snd-soc-saarb-objs := saarb.o | ||
27 | snd-soc-tavorevb3-objs := tavorevb3.o | ||
28 | snd-soc-zylonite-objs := zylonite.o | 26 | snd-soc-zylonite-objs := zylonite.o |
29 | snd-soc-hx4700-objs := hx4700.o | 27 | snd-soc-hx4700-objs := hx4700.o |
30 | snd-soc-magician-objs := magician.o | 28 | snd-soc-magician-objs := magician.o |
@@ -48,8 +46,6 @@ obj-$(CONFIG_SND_PXA2XX_SOC_HX4700) += snd-soc-hx4700.o | |||
48 | obj-$(CONFIG_SND_PXA2XX_SOC_MAGICIAN) += snd-soc-magician.o | 46 | obj-$(CONFIG_SND_PXA2XX_SOC_MAGICIAN) += snd-soc-magician.o |
49 | obj-$(CONFIG_SND_PXA2XX_SOC_MIOA701) += snd-soc-mioa701.o | 47 | obj-$(CONFIG_SND_PXA2XX_SOC_MIOA701) += snd-soc-mioa701.o |
50 | obj-$(CONFIG_SND_PXA2XX_SOC_Z2) += snd-soc-z2.o | 48 | obj-$(CONFIG_SND_PXA2XX_SOC_Z2) += snd-soc-z2.o |
51 | obj-$(CONFIG_SND_SOC_SAARB) += snd-soc-saarb.o | ||
52 | obj-$(CONFIG_SND_SOC_TAVOREVB3) += snd-soc-tavorevb3.o | ||
53 | obj-$(CONFIG_SND_SOC_ZYLONITE) += snd-soc-zylonite.o | 49 | obj-$(CONFIG_SND_SOC_ZYLONITE) += snd-soc-zylonite.o |
54 | obj-$(CONFIG_SND_PXA2XX_SOC_IMOTE2) += snd-soc-imote2.o | 50 | obj-$(CONFIG_SND_PXA2XX_SOC_IMOTE2) += snd-soc-imote2.o |
55 | obj-$(CONFIG_SND_SOC_RAUMFELD) += snd-soc-raumfeld.o | 51 | obj-$(CONFIG_SND_SOC_RAUMFELD) += snd-soc-raumfeld.o |
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c index 349930015264..5d57e071cdf5 100644 --- a/sound/soc/pxa/mmp-pcm.c +++ b/sound/soc/pxa/mmp-pcm.c | |||
@@ -147,7 +147,7 @@ static int mmp_pcm_mmap(struct snd_pcm_substream *substream, | |||
147 | vma->vm_end - vma->vm_start, vma->vm_page_prot); | 147 | vma->vm_end - vma->vm_start, vma->vm_page_prot); |
148 | } | 148 | } |
149 | 149 | ||
150 | struct snd_pcm_ops mmp_pcm_ops = { | 150 | static struct snd_pcm_ops mmp_pcm_ops = { |
151 | .open = mmp_pcm_open, | 151 | .open = mmp_pcm_open, |
152 | .close = snd_dmaengine_pcm_close_release_chan, | 152 | .close = snd_dmaengine_pcm_close_release_chan, |
153 | .ioctl = snd_pcm_lib_ioctl, | 153 | .ioctl = snd_pcm_lib_ioctl, |
@@ -208,7 +208,7 @@ static int mmp_pcm_preallocate_dma_buffer(struct snd_pcm_substream *substream, | |||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | 210 | ||
211 | int mmp_pcm_new(struct snd_soc_pcm_runtime *rtd) | 211 | static int mmp_pcm_new(struct snd_soc_pcm_runtime *rtd) |
212 | { | 212 | { |
213 | struct snd_pcm_substream *substream; | 213 | struct snd_pcm_substream *substream; |
214 | struct snd_pcm *pcm = rtd->pcm; | 214 | struct snd_pcm *pcm = rtd->pcm; |
@@ -229,7 +229,7 @@ err: | |||
229 | return ret; | 229 | return ret; |
230 | } | 230 | } |
231 | 231 | ||
232 | struct snd_soc_platform_driver mmp_soc_platform = { | 232 | static struct snd_soc_platform_driver mmp_soc_platform = { |
233 | .ops = &mmp_pcm_ops, | 233 | .ops = &mmp_pcm_ops, |
234 | .pcm_new = mmp_pcm_new, | 234 | .pcm_new = mmp_pcm_new, |
235 | .pcm_free = mmp_pcm_free_dma_buffers, | 235 | .pcm_free = mmp_pcm_free_dma_buffers, |
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c index a64779980177..62142ce367c7 100644 --- a/sound/soc/pxa/mmp-sspa.c +++ b/sound/soc/pxa/mmp-sspa.c | |||
@@ -388,7 +388,7 @@ static struct snd_soc_dai_ops mmp_sspa_dai_ops = { | |||
388 | .set_fmt = mmp_sspa_set_dai_fmt, | 388 | .set_fmt = mmp_sspa_set_dai_fmt, |
389 | }; | 389 | }; |
390 | 390 | ||
391 | struct snd_soc_dai_driver mmp_sspa_dai = { | 391 | static struct snd_soc_dai_driver mmp_sspa_dai = { |
392 | .probe = mmp_sspa_probe, | 392 | .probe = mmp_sspa_probe, |
393 | .playback = { | 393 | .playback = { |
394 | .channels_min = 1, | 394 | .channels_min = 1, |
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 57ea8e6c5488..1475515712e6 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -41,13 +41,12 @@ static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97) | |||
41 | pxa2xx_ac97_finish_reset(ac97); | 41 | pxa2xx_ac97_finish_reset(ac97); |
42 | } | 42 | } |
43 | 43 | ||
44 | struct snd_ac97_bus_ops soc_ac97_ops = { | 44 | static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { |
45 | .read = pxa2xx_ac97_read, | 45 | .read = pxa2xx_ac97_read, |
46 | .write = pxa2xx_ac97_write, | 46 | .write = pxa2xx_ac97_write, |
47 | .warm_reset = pxa2xx_ac97_warm_reset, | 47 | .warm_reset = pxa2xx_ac97_warm_reset, |
48 | .reset = pxa2xx_ac97_cold_reset, | 48 | .reset = pxa2xx_ac97_cold_reset, |
49 | }; | 49 | }; |
50 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
51 | 50 | ||
52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { | 51 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { |
53 | .name = "AC97 PCM Stereo out", | 52 | .name = "AC97 PCM Stereo out", |
@@ -239,11 +238,17 @@ static const struct snd_soc_component_driver pxa_ac97_component = { | |||
239 | 238 | ||
240 | static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) | 239 | static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) |
241 | { | 240 | { |
241 | int ret; | ||
242 | |||
242 | if (pdev->id != -1) { | 243 | if (pdev->id != -1) { |
243 | dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); | 244 | dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); |
244 | return -ENXIO; | 245 | return -ENXIO; |
245 | } | 246 | } |
246 | 247 | ||
248 | ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops); | ||
249 | if (ret != 0) | ||
250 | return ret; | ||
251 | |||
247 | /* Punt most of the init to the SoC probe; we may need the machine | 252 | /* Punt most of the init to the SoC probe; we may need the machine |
248 | * driver to do interesting things with the clocking to get us up | 253 | * driver to do interesting things with the clocking to get us up |
249 | * and running. | 254 | * and running. |
@@ -255,6 +260,7 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) | |||
255 | static int pxa2xx_ac97_dev_remove(struct platform_device *pdev) | 260 | static int pxa2xx_ac97_dev_remove(struct platform_device *pdev) |
256 | { | 261 | { |
257 | snd_soc_unregister_component(&pdev->dev); | 262 | snd_soc_unregister_component(&pdev->dev); |
263 | snd_soc_set_ac97_ops(NULL); | ||
258 | return 0; | 264 | return 0; |
259 | } | 265 | } |
260 | 266 | ||
diff --git a/sound/soc/pxa/pxa2xx-ac97.h b/sound/soc/pxa/pxa2xx-ac97.h index eda891e6f31b..a49c21ba3842 100644 --- a/sound/soc/pxa/pxa2xx-ac97.h +++ b/sound/soc/pxa/pxa2xx-ac97.h | |||
@@ -14,7 +14,4 @@ | |||
14 | #define PXA2XX_DAI_AC97_AUX 1 | 14 | #define PXA2XX_DAI_AC97_AUX 1 |
15 | #define PXA2XX_DAI_AC97_MIC 2 | 15 | #define PXA2XX_DAI_AC97_MIC 2 |
16 | 16 | ||
17 | /* platform data */ | ||
18 | extern struct snd_ac97_bus_ops pxa2xx_ac97_ops; | ||
19 | |||
20 | #endif | 17 | #endif |
diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c deleted file mode 100644 index c34146b776b4..000000000000 --- a/sound/soc/pxa/saarb.c +++ /dev/null | |||
@@ -1,190 +0,0 @@ | |||
1 | /* | ||
2 | * saarb.c -- SoC audio for saarb | ||
3 | * | ||
4 | * Copyright (C) 2010 Marvell International Ltd. | ||
5 | * Haojian Zhuang <haojian.zhuang@marvell.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/clk.h> | ||
16 | #include <linux/i2c.h> | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/pcm_params.h> | ||
20 | #include <sound/soc.h> | ||
21 | #include <sound/jack.h> | ||
22 | |||
23 | #include <asm/mach-types.h> | ||
24 | |||
25 | #include "../codecs/88pm860x-codec.h" | ||
26 | #include "pxa-ssp.h" | ||
27 | |||
28 | static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd); | ||
29 | |||
30 | static struct platform_device *saarb_snd_device; | ||
31 | |||
32 | static struct snd_soc_jack hs_jack, mic_jack; | ||
33 | |||
34 | static struct snd_soc_jack_pin hs_jack_pins[] = { | ||
35 | { .pin = "Headset Stereophone", .mask = SND_JACK_HEADPHONE, }, | ||
36 | }; | ||
37 | |||
38 | static struct snd_soc_jack_pin mic_jack_pins[] = { | ||
39 | { .pin = "Headset Mic 2", .mask = SND_JACK_MICROPHONE, }, | ||
40 | }; | ||
41 | |||
42 | /* saarb machine dapm widgets */ | ||
43 | static const struct snd_soc_dapm_widget saarb_dapm_widgets[] = { | ||
44 | SND_SOC_DAPM_HP("Headphone Stereophone", NULL), | ||
45 | SND_SOC_DAPM_LINE("Lineout Out 1", NULL), | ||
46 | SND_SOC_DAPM_LINE("Lineout Out 2", NULL), | ||
47 | SND_SOC_DAPM_SPK("Ext Speaker", NULL), | ||
48 | SND_SOC_DAPM_MIC("Ext Mic 1", NULL), | ||
49 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
50 | SND_SOC_DAPM_MIC("Ext Mic 3", NULL), | ||
51 | }; | ||
52 | |||
53 | /* saarb machine audio map */ | ||
54 | static const struct snd_soc_dapm_route saarb_audio_map[] = { | ||
55 | {"Headset Stereophone", NULL, "HS1"}, | ||
56 | {"Headset Stereophone", NULL, "HS2"}, | ||
57 | |||
58 | {"Ext Speaker", NULL, "LSP"}, | ||
59 | {"Ext Speaker", NULL, "LSN"}, | ||
60 | |||
61 | {"Lineout Out 1", NULL, "LINEOUT1"}, | ||
62 | {"Lineout Out 2", NULL, "LINEOUT2"}, | ||
63 | |||
64 | {"MIC1P", NULL, "Mic1 Bias"}, | ||
65 | {"MIC1N", NULL, "Mic1 Bias"}, | ||
66 | {"Mic1 Bias", NULL, "Ext Mic 1"}, | ||
67 | |||
68 | {"MIC2P", NULL, "Mic1 Bias"}, | ||
69 | {"MIC2N", NULL, "Mic1 Bias"}, | ||
70 | {"Mic1 Bias", NULL, "Headset Mic 2"}, | ||
71 | |||
72 | {"MIC3P", NULL, "Mic3 Bias"}, | ||
73 | {"MIC3N", NULL, "Mic3 Bias"}, | ||
74 | {"Mic3 Bias", NULL, "Ext Mic 3"}, | ||
75 | }; | ||
76 | |||
77 | static int saarb_i2s_hw_params(struct snd_pcm_substream *substream, | ||
78 | struct snd_pcm_hw_params *params) | ||
79 | { | ||
80 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
81 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
82 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
83 | int width = snd_pcm_format_physical_width(params_format(params)); | ||
84 | int ret; | ||
85 | |||
86 | ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_NET_PLL, 0, | ||
87 | PM860X_CLK_DIR_OUT); | ||
88 | if (ret < 0) | ||
89 | return ret; | ||
90 | |||
91 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, 0, PM860X_CLK_DIR_OUT); | ||
92 | if (ret < 0) | ||
93 | return ret; | ||
94 | |||
95 | ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); | ||
96 | |||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | static struct snd_soc_ops saarb_i2s_ops = { | ||
101 | .hw_params = saarb_i2s_hw_params, | ||
102 | }; | ||
103 | |||
104 | static struct snd_soc_dai_link saarb_dai[] = { | ||
105 | { | ||
106 | .name = "88PM860x I2S", | ||
107 | .stream_name = "I2S Audio", | ||
108 | .cpu_dai_name = "pxa-ssp-dai.1", | ||
109 | .codec_dai_name = "88pm860x-i2s", | ||
110 | .platform_name = "pxa-pcm-audio", | ||
111 | .codec_name = "88pm860x-codec", | ||
112 | .init = saarb_pm860x_init, | ||
113 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
114 | SND_SOC_DAIFMT_CBM_CFM, | ||
115 | .ops = &saarb_i2s_ops, | ||
116 | }, | ||
117 | }; | ||
118 | |||
119 | static struct snd_soc_card snd_soc_card_saarb = { | ||
120 | .name = "Saarb", | ||
121 | .owner = THIS_MODULE, | ||
122 | .dai_link = saarb_dai, | ||
123 | .num_links = ARRAY_SIZE(saarb_dai), | ||
124 | |||
125 | .dapm_widgets = saarb_dapm_widgets, | ||
126 | .num_dapm_widgets = ARRAY_SIZE(saarb_dapm_widgets), | ||
127 | .dapm_routes = saarb_audio_map, | ||
128 | .num_dapm_routes = ARRAY_SIZE(saarb_audio_map), | ||
129 | }; | ||
130 | |||
131 | static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd) | ||
132 | { | ||
133 | struct snd_soc_codec *codec = rtd->codec; | ||
134 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
135 | |||
136 | /* connected pins */ | ||
137 | snd_soc_dapm_enable_pin(dapm, "Ext Speaker"); | ||
138 | snd_soc_dapm_enable_pin(dapm, "Ext Mic 1"); | ||
139 | snd_soc_dapm_enable_pin(dapm, "Ext Mic 3"); | ||
140 | snd_soc_dapm_disable_pin(dapm, "Headset Mic 2"); | ||
141 | snd_soc_dapm_disable_pin(dapm, "Headset Stereophone"); | ||
142 | |||
143 | /* Headset jack detection */ | ||
144 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE | ||
145 | | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, | ||
146 | &hs_jack); | ||
147 | snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), | ||
148 | hs_jack_pins); | ||
149 | snd_soc_jack_new(codec, "Microphone Jack", SND_JACK_MICROPHONE, | ||
150 | &mic_jack); | ||
151 | snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), | ||
152 | mic_jack_pins); | ||
153 | |||
154 | /* headphone, microphone detection & headset short detection */ | ||
155 | pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE, | ||
156 | SND_JACK_BTN_0, SND_JACK_BTN_1, SND_JACK_BTN_2); | ||
157 | pm860x_mic_jack_detect(codec, &hs_jack, SND_JACK_MICROPHONE); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int __init saarb_init(void) | ||
162 | { | ||
163 | int ret; | ||
164 | |||
165 | if (!machine_is_saarb()) | ||
166 | return -ENODEV; | ||
167 | saarb_snd_device = platform_device_alloc("soc-audio", -1); | ||
168 | if (!saarb_snd_device) | ||
169 | return -ENOMEM; | ||
170 | |||
171 | platform_set_drvdata(saarb_snd_device, &snd_soc_card_saarb); | ||
172 | |||
173 | ret = platform_device_add(saarb_snd_device); | ||
174 | if (ret) | ||
175 | platform_device_put(saarb_snd_device); | ||
176 | |||
177 | return ret; | ||
178 | } | ||
179 | |||
180 | static void __exit saarb_exit(void) | ||
181 | { | ||
182 | platform_device_unregister(saarb_snd_device); | ||
183 | } | ||
184 | |||
185 | module_init(saarb_init); | ||
186 | module_exit(saarb_exit); | ||
187 | |||
188 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | ||
189 | MODULE_DESCRIPTION("ALSA SoC 88PM860x Saarb"); | ||
190 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c deleted file mode 100644 index 8b5ab8f72726..000000000000 --- a/sound/soc/pxa/tavorevb3.c +++ /dev/null | |||
@@ -1,189 +0,0 @@ | |||
1 | /* | ||
2 | * tavorevb3.c -- SoC audio for Tavor EVB3 | ||
3 | * | ||
4 | * Copyright (C) 2010 Marvell International Ltd. | ||
5 | * Haojian Zhuang <haojian.zhuang@marvell.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/clk.h> | ||
16 | #include <linux/i2c.h> | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/pcm_params.h> | ||
20 | #include <sound/soc.h> | ||
21 | #include <sound/jack.h> | ||
22 | |||
23 | #include <asm/mach-types.h> | ||
24 | |||
25 | #include "../codecs/88pm860x-codec.h" | ||
26 | #include "pxa-ssp.h" | ||
27 | |||
28 | static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd); | ||
29 | |||
30 | static struct platform_device *evb3_snd_device; | ||
31 | |||
32 | static struct snd_soc_jack hs_jack, mic_jack; | ||
33 | |||
34 | static struct snd_soc_jack_pin hs_jack_pins[] = { | ||
35 | { .pin = "Headset Stereophone", .mask = SND_JACK_HEADPHONE, }, | ||
36 | }; | ||
37 | |||
38 | static struct snd_soc_jack_pin mic_jack_pins[] = { | ||
39 | { .pin = "Headset Mic 2", .mask = SND_JACK_MICROPHONE, }, | ||
40 | }; | ||
41 | |||
42 | /* tavorevb3 machine dapm widgets */ | ||
43 | static const struct snd_soc_dapm_widget evb3_dapm_widgets[] = { | ||
44 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | ||
45 | SND_SOC_DAPM_LINE("Lineout Out 1", NULL), | ||
46 | SND_SOC_DAPM_LINE("Lineout Out 2", NULL), | ||
47 | SND_SOC_DAPM_SPK("Ext Speaker", NULL), | ||
48 | SND_SOC_DAPM_MIC("Ext Mic 1", NULL), | ||
49 | SND_SOC_DAPM_MIC("Headset Mic 2", NULL), | ||
50 | SND_SOC_DAPM_MIC("Ext Mic 3", NULL), | ||
51 | }; | ||
52 | |||
53 | /* tavorevb3 machine audio map */ | ||
54 | static const struct snd_soc_dapm_route evb3_audio_map[] = { | ||
55 | {"Headset Stereophone", NULL, "HS1"}, | ||
56 | {"Headset Stereophone", NULL, "HS2"}, | ||
57 | |||
58 | {"Ext Speaker", NULL, "LSP"}, | ||
59 | {"Ext Speaker", NULL, "LSN"}, | ||
60 | |||
61 | {"Lineout Out 1", NULL, "LINEOUT1"}, | ||
62 | {"Lineout Out 2", NULL, "LINEOUT2"}, | ||
63 | |||
64 | {"MIC1P", NULL, "Mic1 Bias"}, | ||
65 | {"MIC1N", NULL, "Mic1 Bias"}, | ||
66 | {"Mic1 Bias", NULL, "Ext Mic 1"}, | ||
67 | |||
68 | {"MIC2P", NULL, "Mic1 Bias"}, | ||
69 | {"MIC2N", NULL, "Mic1 Bias"}, | ||
70 | {"Mic1 Bias", NULL, "Headset Mic 2"}, | ||
71 | |||
72 | {"MIC3P", NULL, "Mic3 Bias"}, | ||
73 | {"MIC3N", NULL, "Mic3 Bias"}, | ||
74 | {"Mic3 Bias", NULL, "Ext Mic 3"}, | ||
75 | }; | ||
76 | |||
77 | static int evb3_i2s_hw_params(struct snd_pcm_substream *substream, | ||
78 | struct snd_pcm_hw_params *params) | ||
79 | { | ||
80 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
81 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
82 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
83 | int width = snd_pcm_format_physical_width(params_format(params)); | ||
84 | int ret; | ||
85 | |||
86 | ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_NET_PLL, 0, | ||
87 | PM860X_CLK_DIR_OUT); | ||
88 | if (ret < 0) | ||
89 | return ret; | ||
90 | |||
91 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, 0, PM860X_CLK_DIR_OUT); | ||
92 | if (ret < 0) | ||
93 | return ret; | ||
94 | |||
95 | ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); | ||
96 | return ret; | ||
97 | } | ||
98 | |||
99 | static struct snd_soc_ops evb3_i2s_ops = { | ||
100 | .hw_params = evb3_i2s_hw_params, | ||
101 | }; | ||
102 | |||
103 | static struct snd_soc_dai_link evb3_dai[] = { | ||
104 | { | ||
105 | .name = "88PM860x I2S", | ||
106 | .stream_name = "I2S Audio", | ||
107 | .cpu_dai_name = "pxa-ssp-dai.1", | ||
108 | .codec_dai_name = "88pm860x-i2s", | ||
109 | .platform_name = "pxa-pcm-audio", | ||
110 | .codec_name = "88pm860x-codec", | ||
111 | .init = evb3_pm860x_init, | ||
112 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
113 | SND_SOC_DAIFMT_CBM_CFM, | ||
114 | .ops = &evb3_i2s_ops, | ||
115 | }, | ||
116 | }; | ||
117 | |||
118 | static struct snd_soc_card snd_soc_card_evb3 = { | ||
119 | .name = "Tavor EVB3", | ||
120 | .owner = THIS_MODULE, | ||
121 | .dai_link = evb3_dai, | ||
122 | .num_links = ARRAY_SIZE(evb3_dai), | ||
123 | |||
124 | .dapm_widgets = evb3_dapm_widgets, | ||
125 | .num_dapm_widgets = ARRAY_SIZE(evb3_dapm_widgets), | ||
126 | .dapm_routes = evb3_audio_map, | ||
127 | .num_dapm_routes = ARRAY_SIZE(evb3_audio_map), | ||
128 | }; | ||
129 | |||
130 | static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd) | ||
131 | { | ||
132 | struct snd_soc_codec *codec = rtd->codec; | ||
133 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
134 | |||
135 | /* connected pins */ | ||
136 | snd_soc_dapm_enable_pin(dapm, "Ext Speaker"); | ||
137 | snd_soc_dapm_enable_pin(dapm, "Ext Mic 1"); | ||
138 | snd_soc_dapm_enable_pin(dapm, "Ext Mic 3"); | ||
139 | snd_soc_dapm_disable_pin(dapm, "Headset Mic 2"); | ||
140 | snd_soc_dapm_disable_pin(dapm, "Headset Stereophone"); | ||
141 | |||
142 | /* Headset jack detection */ | ||
143 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE | ||
144 | | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, | ||
145 | &hs_jack); | ||
146 | snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), | ||
147 | hs_jack_pins); | ||
148 | snd_soc_jack_new(codec, "Microphone Jack", SND_JACK_MICROPHONE, | ||
149 | &mic_jack); | ||
150 | snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), | ||
151 | mic_jack_pins); | ||
152 | |||
153 | /* headphone, microphone detection & headset short detection */ | ||
154 | pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE, | ||
155 | SND_JACK_BTN_0, SND_JACK_BTN_1, SND_JACK_BTN_2); | ||
156 | pm860x_mic_jack_detect(codec, &hs_jack, SND_JACK_MICROPHONE); | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static int __init tavorevb3_init(void) | ||
161 | { | ||
162 | int ret; | ||
163 | |||
164 | if (!machine_is_tavorevb3()) | ||
165 | return -ENODEV; | ||
166 | evb3_snd_device = platform_device_alloc("soc-audio", -1); | ||
167 | if (!evb3_snd_device) | ||
168 | return -ENOMEM; | ||
169 | |||
170 | platform_set_drvdata(evb3_snd_device, &snd_soc_card_evb3); | ||
171 | |||
172 | ret = platform_device_add(evb3_snd_device); | ||
173 | if (ret) | ||
174 | platform_device_put(evb3_snd_device); | ||
175 | |||
176 | return ret; | ||
177 | } | ||
178 | |||
179 | static void __exit tavorevb3_exit(void) | ||
180 | { | ||
181 | platform_device_unregister(evb3_snd_device); | ||
182 | } | ||
183 | |||
184 | module_init(tavorevb3_init); | ||
185 | module_exit(tavorevb3_exit); | ||
186 | |||
187 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | ||
188 | MODULE_DESCRIPTION("ALSA SoC 88PM860x Tavor EVB3"); | ||
189 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c index ceb656695b0f..db8aadf8932d 100644 --- a/sound/soc/pxa/zylonite.c +++ b/sound/soc/pxa/zylonite.c | |||
@@ -256,7 +256,6 @@ static struct snd_soc_card zylonite = { | |||
256 | .resume_pre = &zylonite_resume_pre, | 256 | .resume_pre = &zylonite_resume_pre, |
257 | .dai_link = zylonite_dai, | 257 | .dai_link = zylonite_dai, |
258 | .num_links = ARRAY_SIZE(zylonite_dai), | 258 | .num_links = ARRAY_SIZE(zylonite_dai), |
259 | .owner = THIS_MODULE, | ||
260 | }; | 259 | }; |
261 | 260 | ||
262 | static struct platform_device *zylonite_snd_ac97_device; | 261 | static struct platform_device *zylonite_snd_ac97_device; |