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>
24 #include <mach/regs-audss.h>
26 static const char *rclksrc
[] = {
31 static int exynos4_cfg_i2s(struct platform_device
*pdev
)
33 /* configure GPIO for i2s port */
36 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 7, S3C_GPIO_SFN(2));
39 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(2));
42 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(4));
45 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
52 static struct s3c_audio_pdata i2sv5_pdata
= {
53 .cfg_gpio
= exynos4_cfg_i2s
,
56 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
59 .idma_addr
= EXYNOS4_AUDSS_INT_MEM
,
64 static struct resource exynos4_i2s0_resource
[] = {
66 .start
= EXYNOS4_PA_I2S0
,
67 .end
= EXYNOS4_PA_I2S0
+ 0x100 - 1,
68 .flags
= IORESOURCE_MEM
,
71 .start
= DMACH_I2S0_TX
,
73 .flags
= IORESOURCE_DMA
,
76 .start
= DMACH_I2S0_RX
,
78 .flags
= IORESOURCE_DMA
,
81 .start
= DMACH_I2S0S_TX
,
82 .end
= DMACH_I2S0S_TX
,
83 .flags
= IORESOURCE_DMA
,
87 struct platform_device exynos4_device_i2s0
= {
88 .name
= "samsung-i2s",
90 .num_resources
= ARRAY_SIZE(exynos4_i2s0_resource
),
91 .resource
= exynos4_i2s0_resource
,
93 .platform_data
= &i2sv5_pdata
,
97 static const char *rclksrc_v3
[] = {
99 [1] = "no_such_clock",
102 static struct s3c_audio_pdata i2sv3_pdata
= {
103 .cfg_gpio
= exynos4_cfg_i2s
,
106 .quirks
= QUIRK_NO_MUXPSR
,
107 .src_clk
= rclksrc_v3
,
112 static struct resource exynos4_i2s1_resource
[] = {
114 .start
= EXYNOS4_PA_I2S1
,
115 .end
= EXYNOS4_PA_I2S1
+ 0x100 - 1,
116 .flags
= IORESOURCE_MEM
,
119 .start
= DMACH_I2S1_TX
,
120 .end
= DMACH_I2S1_TX
,
121 .flags
= IORESOURCE_DMA
,
124 .start
= DMACH_I2S1_RX
,
125 .end
= DMACH_I2S1_RX
,
126 .flags
= IORESOURCE_DMA
,
130 struct platform_device exynos4_device_i2s1
= {
131 .name
= "samsung-i2s",
133 .num_resources
= ARRAY_SIZE(exynos4_i2s1_resource
),
134 .resource
= exynos4_i2s1_resource
,
136 .platform_data
= &i2sv3_pdata
,
140 static struct resource exynos4_i2s2_resource
[] = {
142 .start
= EXYNOS4_PA_I2S2
,
143 .end
= EXYNOS4_PA_I2S2
+ 0x100 - 1,
144 .flags
= IORESOURCE_MEM
,
147 .start
= DMACH_I2S2_TX
,
148 .end
= DMACH_I2S2_TX
,
149 .flags
= IORESOURCE_DMA
,
152 .start
= DMACH_I2S2_RX
,
153 .end
= DMACH_I2S2_RX
,
154 .flags
= IORESOURCE_DMA
,
158 struct platform_device exynos4_device_i2s2
= {
159 .name
= "samsung-i2s",
161 .num_resources
= ARRAY_SIZE(exynos4_i2s2_resource
),
162 .resource
= exynos4_i2s2_resource
,
164 .platform_data
= &i2sv3_pdata
,
168 /* PCM Controller platform_devices */
170 static int exynos4_pcm_cfg_gpio(struct platform_device
*pdev
)
174 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 5, S3C_GPIO_SFN(3));
177 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(3));
180 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(3));
183 printk(KERN_DEBUG
"Invalid PCM Controller number!");
190 static struct s3c_audio_pdata s3c_pcm_pdata
= {
191 .cfg_gpio
= exynos4_pcm_cfg_gpio
,
194 static struct resource exynos4_pcm0_resource
[] = {
196 .start
= EXYNOS4_PA_PCM0
,
197 .end
= EXYNOS4_PA_PCM0
+ 0x100 - 1,
198 .flags
= IORESOURCE_MEM
,
201 .start
= DMACH_PCM0_TX
,
202 .end
= DMACH_PCM0_TX
,
203 .flags
= IORESOURCE_DMA
,
206 .start
= DMACH_PCM0_RX
,
207 .end
= DMACH_PCM0_RX
,
208 .flags
= IORESOURCE_DMA
,
212 struct platform_device exynos4_device_pcm0
= {
213 .name
= "samsung-pcm",
215 .num_resources
= ARRAY_SIZE(exynos4_pcm0_resource
),
216 .resource
= exynos4_pcm0_resource
,
218 .platform_data
= &s3c_pcm_pdata
,
222 static struct resource exynos4_pcm1_resource
[] = {
224 .start
= EXYNOS4_PA_PCM1
,
225 .end
= EXYNOS4_PA_PCM1
+ 0x100 - 1,
226 .flags
= IORESOURCE_MEM
,
229 .start
= DMACH_PCM1_TX
,
230 .end
= DMACH_PCM1_TX
,
231 .flags
= IORESOURCE_DMA
,
234 .start
= DMACH_PCM1_RX
,
235 .end
= DMACH_PCM1_RX
,
236 .flags
= IORESOURCE_DMA
,
240 struct platform_device exynos4_device_pcm1
= {
241 .name
= "samsung-pcm",
243 .num_resources
= ARRAY_SIZE(exynos4_pcm1_resource
),
244 .resource
= exynos4_pcm1_resource
,
246 .platform_data
= &s3c_pcm_pdata
,
250 static struct resource exynos4_pcm2_resource
[] = {
252 .start
= EXYNOS4_PA_PCM2
,
253 .end
= EXYNOS4_PA_PCM2
+ 0x100 - 1,
254 .flags
= IORESOURCE_MEM
,
257 .start
= DMACH_PCM2_TX
,
258 .end
= DMACH_PCM2_TX
,
259 .flags
= IORESOURCE_DMA
,
262 .start
= DMACH_PCM2_RX
,
263 .end
= DMACH_PCM2_RX
,
264 .flags
= IORESOURCE_DMA
,
268 struct platform_device exynos4_device_pcm2
= {
269 .name
= "samsung-pcm",
271 .num_resources
= ARRAY_SIZE(exynos4_pcm2_resource
),
272 .resource
= exynos4_pcm2_resource
,
274 .platform_data
= &s3c_pcm_pdata
,
278 /* AC97 Controller platform devices */
280 static int exynos4_ac97_cfg_gpio(struct platform_device
*pdev
)
282 return s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(4));
285 static struct resource exynos4_ac97_resource
[] = {
287 .start
= EXYNOS4_PA_AC97
,
288 .end
= EXYNOS4_PA_AC97
+ 0x100 - 1,
289 .flags
= IORESOURCE_MEM
,
292 .start
= DMACH_AC97_PCMOUT
,
293 .end
= DMACH_AC97_PCMOUT
,
294 .flags
= IORESOURCE_DMA
,
297 .start
= DMACH_AC97_PCMIN
,
298 .end
= DMACH_AC97_PCMIN
,
299 .flags
= IORESOURCE_DMA
,
302 .start
= DMACH_AC97_MICIN
,
303 .end
= DMACH_AC97_MICIN
,
304 .flags
= IORESOURCE_DMA
,
309 .flags
= IORESOURCE_IRQ
,
313 static struct s3c_audio_pdata s3c_ac97_pdata
= {
314 .cfg_gpio
= exynos4_ac97_cfg_gpio
,
317 static u64 exynos4_ac97_dmamask
= DMA_BIT_MASK(32);
319 struct platform_device exynos4_device_ac97
= {
320 .name
= "samsung-ac97",
322 .num_resources
= ARRAY_SIZE(exynos4_ac97_resource
),
323 .resource
= exynos4_ac97_resource
,
325 .platform_data
= &s3c_ac97_pdata
,
326 .dma_mask
= &exynos4_ac97_dmamask
,
327 .coherent_dma_mask
= DMA_BIT_MASK(32),
331 /* S/PDIF Controller platform_device */
333 static int exynos4_spdif_cfg_gpio(struct platform_device
*pdev
)
335 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(4));
340 static struct resource exynos4_spdif_resource
[] = {
342 .start
= EXYNOS4_PA_SPDIF
,
343 .end
= EXYNOS4_PA_SPDIF
+ 0x100 - 1,
344 .flags
= IORESOURCE_MEM
,
347 .start
= DMACH_SPDIF
,
349 .flags
= IORESOURCE_DMA
,
353 static struct s3c_audio_pdata samsung_spdif_pdata
= {
354 .cfg_gpio
= exynos4_spdif_cfg_gpio
,
357 static u64 exynos4_spdif_dmamask
= DMA_BIT_MASK(32);
359 struct platform_device exynos4_device_spdif
= {
360 .name
= "samsung-spdif",
362 .num_resources
= ARRAY_SIZE(exynos4_spdif_resource
),
363 .resource
= exynos4_spdif_resource
,
365 .platform_data
= &samsung_spdif_pdata
,
366 .dma_mask
= &exynos4_spdif_dmamask
,
367 .coherent_dma_mask
= DMA_BIT_MASK(32),