1 /* linux/arch/arm/mach-exynos4/dev-audio.c
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Copyright (c) 2010 Samsung Electronics Co. Ltd
7 * Jaswinder Singh <jassi.brar@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/platform_device.h>
15 #include <linux/dma-mapping.h>
16 #include <linux/gpio.h>
18 #include <plat/gpio-cfg.h>
19 #include <plat/audio.h>
23 #include <mach/irqs.h>
25 static const char *rclksrc
[] = {
30 static int exynos4_cfg_i2s(struct platform_device
*pdev
)
32 /* configure GPIO for i2s port */
35 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 7, S3C_GPIO_SFN(2));
38 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(2));
41 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(4));
44 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
51 static struct s3c_audio_pdata i2sv5_pdata
= {
52 .cfg_gpio
= exynos4_cfg_i2s
,
55 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
62 static struct resource exynos4_i2s0_resource
[] = {
64 .start
= EXYNOS4_PA_I2S0
,
65 .end
= EXYNOS4_PA_I2S0
+ 0x100 - 1,
66 .flags
= IORESOURCE_MEM
,
69 .start
= DMACH_I2S0_TX
,
71 .flags
= IORESOURCE_DMA
,
74 .start
= DMACH_I2S0_RX
,
76 .flags
= IORESOURCE_DMA
,
79 .start
= DMACH_I2S0S_TX
,
80 .end
= DMACH_I2S0S_TX
,
81 .flags
= IORESOURCE_DMA
,
85 struct platform_device exynos4_device_i2s0
= {
86 .name
= "samsung-i2s",
88 .num_resources
= ARRAY_SIZE(exynos4_i2s0_resource
),
89 .resource
= exynos4_i2s0_resource
,
91 .platform_data
= &i2sv5_pdata
,
95 static const char *rclksrc_v3
[] = {
97 [1] = "no_such_clock",
100 static struct s3c_audio_pdata i2sv3_pdata
= {
101 .cfg_gpio
= exynos4_cfg_i2s
,
104 .quirks
= QUIRK_NO_MUXPSR
,
105 .src_clk
= rclksrc_v3
,
110 static struct resource exynos4_i2s1_resource
[] = {
112 .start
= EXYNOS4_PA_I2S1
,
113 .end
= EXYNOS4_PA_I2S1
+ 0x100 - 1,
114 .flags
= IORESOURCE_MEM
,
117 .start
= DMACH_I2S1_TX
,
118 .end
= DMACH_I2S1_TX
,
119 .flags
= IORESOURCE_DMA
,
122 .start
= DMACH_I2S1_RX
,
123 .end
= DMACH_I2S1_RX
,
124 .flags
= IORESOURCE_DMA
,
128 struct platform_device exynos4_device_i2s1
= {
129 .name
= "samsung-i2s",
131 .num_resources
= ARRAY_SIZE(exynos4_i2s1_resource
),
132 .resource
= exynos4_i2s1_resource
,
134 .platform_data
= &i2sv3_pdata
,
138 static struct resource exynos4_i2s2_resource
[] = {
140 .start
= EXYNOS4_PA_I2S2
,
141 .end
= EXYNOS4_PA_I2S2
+ 0x100 - 1,
142 .flags
= IORESOURCE_MEM
,
145 .start
= DMACH_I2S2_TX
,
146 .end
= DMACH_I2S2_TX
,
147 .flags
= IORESOURCE_DMA
,
150 .start
= DMACH_I2S2_RX
,
151 .end
= DMACH_I2S2_RX
,
152 .flags
= IORESOURCE_DMA
,
156 struct platform_device exynos4_device_i2s2
= {
157 .name
= "samsung-i2s",
159 .num_resources
= ARRAY_SIZE(exynos4_i2s2_resource
),
160 .resource
= exynos4_i2s2_resource
,
162 .platform_data
= &i2sv3_pdata
,
166 /* PCM Controller platform_devices */
168 static int exynos4_pcm_cfg_gpio(struct platform_device
*pdev
)
172 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 5, S3C_GPIO_SFN(3));
175 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(3));
178 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(3));
181 printk(KERN_DEBUG
"Invalid PCM Controller number!");
188 static struct s3c_audio_pdata s3c_pcm_pdata
= {
189 .cfg_gpio
= exynos4_pcm_cfg_gpio
,
192 static struct resource exynos4_pcm0_resource
[] = {
194 .start
= EXYNOS4_PA_PCM0
,
195 .end
= EXYNOS4_PA_PCM0
+ 0x100 - 1,
196 .flags
= IORESOURCE_MEM
,
199 .start
= DMACH_PCM0_TX
,
200 .end
= DMACH_PCM0_TX
,
201 .flags
= IORESOURCE_DMA
,
204 .start
= DMACH_PCM0_RX
,
205 .end
= DMACH_PCM0_RX
,
206 .flags
= IORESOURCE_DMA
,
210 struct platform_device exynos4_device_pcm0
= {
211 .name
= "samsung-pcm",
213 .num_resources
= ARRAY_SIZE(exynos4_pcm0_resource
),
214 .resource
= exynos4_pcm0_resource
,
216 .platform_data
= &s3c_pcm_pdata
,
220 static struct resource exynos4_pcm1_resource
[] = {
222 .start
= EXYNOS4_PA_PCM1
,
223 .end
= EXYNOS4_PA_PCM1
+ 0x100 - 1,
224 .flags
= IORESOURCE_MEM
,
227 .start
= DMACH_PCM1_TX
,
228 .end
= DMACH_PCM1_TX
,
229 .flags
= IORESOURCE_DMA
,
232 .start
= DMACH_PCM1_RX
,
233 .end
= DMACH_PCM1_RX
,
234 .flags
= IORESOURCE_DMA
,
238 struct platform_device exynos4_device_pcm1
= {
239 .name
= "samsung-pcm",
241 .num_resources
= ARRAY_SIZE(exynos4_pcm1_resource
),
242 .resource
= exynos4_pcm1_resource
,
244 .platform_data
= &s3c_pcm_pdata
,
248 static struct resource exynos4_pcm2_resource
[] = {
250 .start
= EXYNOS4_PA_PCM2
,
251 .end
= EXYNOS4_PA_PCM2
+ 0x100 - 1,
252 .flags
= IORESOURCE_MEM
,
255 .start
= DMACH_PCM2_TX
,
256 .end
= DMACH_PCM2_TX
,
257 .flags
= IORESOURCE_DMA
,
260 .start
= DMACH_PCM2_RX
,
261 .end
= DMACH_PCM2_RX
,
262 .flags
= IORESOURCE_DMA
,
266 struct platform_device exynos4_device_pcm2
= {
267 .name
= "samsung-pcm",
269 .num_resources
= ARRAY_SIZE(exynos4_pcm2_resource
),
270 .resource
= exynos4_pcm2_resource
,
272 .platform_data
= &s3c_pcm_pdata
,
276 /* AC97 Controller platform devices */
278 static int exynos4_ac97_cfg_gpio(struct platform_device
*pdev
)
280 return s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(4));
283 static struct resource exynos4_ac97_resource
[] = {
285 .start
= EXYNOS4_PA_AC97
,
286 .end
= EXYNOS4_PA_AC97
+ 0x100 - 1,
287 .flags
= IORESOURCE_MEM
,
290 .start
= DMACH_AC97_PCMOUT
,
291 .end
= DMACH_AC97_PCMOUT
,
292 .flags
= IORESOURCE_DMA
,
295 .start
= DMACH_AC97_PCMIN
,
296 .end
= DMACH_AC97_PCMIN
,
297 .flags
= IORESOURCE_DMA
,
300 .start
= DMACH_AC97_MICIN
,
301 .end
= DMACH_AC97_MICIN
,
302 .flags
= IORESOURCE_DMA
,
307 .flags
= IORESOURCE_IRQ
,
311 static struct s3c_audio_pdata s3c_ac97_pdata
= {
312 .cfg_gpio
= exynos4_ac97_cfg_gpio
,
315 static u64 exynos4_ac97_dmamask
= DMA_BIT_MASK(32);
317 struct platform_device exynos4_device_ac97
= {
318 .name
= "samsung-ac97",
320 .num_resources
= ARRAY_SIZE(exynos4_ac97_resource
),
321 .resource
= exynos4_ac97_resource
,
323 .platform_data
= &s3c_ac97_pdata
,
324 .dma_mask
= &exynos4_ac97_dmamask
,
325 .coherent_dma_mask
= DMA_BIT_MASK(32),
329 /* S/PDIF Controller platform_device */
331 static int exynos4_spdif_cfg_gpio(struct platform_device
*pdev
)
333 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(3));
338 static struct resource exynos4_spdif_resource
[] = {
340 .start
= EXYNOS4_PA_SPDIF
,
341 .end
= EXYNOS4_PA_SPDIF
+ 0x100 - 1,
342 .flags
= IORESOURCE_MEM
,
345 .start
= DMACH_SPDIF
,
347 .flags
= IORESOURCE_DMA
,
351 static struct s3c_audio_pdata samsung_spdif_pdata
= {
352 .cfg_gpio
= exynos4_spdif_cfg_gpio
,
355 static u64 exynos4_spdif_dmamask
= DMA_BIT_MASK(32);
357 struct platform_device exynos4_device_spdif
= {
358 .name
= "samsung-spdif",
360 .num_resources
= ARRAY_SIZE(exynos4_spdif_resource
),
361 .resource
= exynos4_spdif_resource
,
363 .platform_data
= &samsung_spdif_pdata
,
364 .dma_mask
= &exynos4_spdif_dmamask
,
365 .coherent_dma_mask
= DMA_BIT_MASK(32),