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>
17 #include <linux/platform_data/asoc-s3c.h>
19 #include <plat/gpio-cfg.h>
23 #include <mach/irqs.h>
25 #define EXYNOS4_AUDSS_INT_MEM (0x03000000)
27 static int exynos4_cfg_i2s(struct platform_device
*pdev
)
29 /* configure GPIO for i2s port */
32 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 7, S3C_GPIO_SFN(2));
35 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(2));
38 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(4));
41 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
48 static struct s3c_audio_pdata i2sv5_pdata
= {
49 .cfg_gpio
= exynos4_cfg_i2s
,
52 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
54 .idma_addr
= EXYNOS4_AUDSS_INT_MEM
,
59 static struct resource exynos4_i2s0_resource
[] = {
60 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S0
, SZ_256
),
61 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX
),
62 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX
),
63 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX
),
66 struct platform_device exynos4_device_i2s0
= {
67 .name
= "samsung-i2s",
69 .num_resources
= ARRAY_SIZE(exynos4_i2s0_resource
),
70 .resource
= exynos4_i2s0_resource
,
72 .platform_data
= &i2sv5_pdata
,
76 static struct s3c_audio_pdata i2sv3_pdata
= {
77 .cfg_gpio
= exynos4_cfg_i2s
,
80 .quirks
= QUIRK_NO_MUXPSR
,
85 static struct resource exynos4_i2s1_resource
[] = {
86 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S1
, SZ_256
),
87 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX
),
88 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX
),
91 struct platform_device exynos4_device_i2s1
= {
92 .name
= "samsung-i2s",
94 .num_resources
= ARRAY_SIZE(exynos4_i2s1_resource
),
95 .resource
= exynos4_i2s1_resource
,
97 .platform_data
= &i2sv3_pdata
,
101 static struct resource exynos4_i2s2_resource
[] = {
102 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S2
, SZ_256
),
103 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX
),
104 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX
),
107 struct platform_device exynos4_device_i2s2
= {
108 .name
= "samsung-i2s",
110 .num_resources
= ARRAY_SIZE(exynos4_i2s2_resource
),
111 .resource
= exynos4_i2s2_resource
,
113 .platform_data
= &i2sv3_pdata
,
117 /* PCM Controller platform_devices */
119 static int exynos4_pcm_cfg_gpio(struct platform_device
*pdev
)
123 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 5, S3C_GPIO_SFN(3));
126 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(3));
129 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(3));
132 printk(KERN_DEBUG
"Invalid PCM Controller number!");
139 static struct s3c_audio_pdata s3c_pcm_pdata
= {
140 .cfg_gpio
= exynos4_pcm_cfg_gpio
,
143 static struct resource exynos4_pcm0_resource
[] = {
144 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM0
, SZ_256
),
145 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX
),
146 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX
),
149 struct platform_device exynos4_device_pcm0
= {
150 .name
= "samsung-pcm",
152 .num_resources
= ARRAY_SIZE(exynos4_pcm0_resource
),
153 .resource
= exynos4_pcm0_resource
,
155 .platform_data
= &s3c_pcm_pdata
,
159 static struct resource exynos4_pcm1_resource
[] = {
160 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM1
, SZ_256
),
161 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX
),
162 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX
),
165 struct platform_device exynos4_device_pcm1
= {
166 .name
= "samsung-pcm",
168 .num_resources
= ARRAY_SIZE(exynos4_pcm1_resource
),
169 .resource
= exynos4_pcm1_resource
,
171 .platform_data
= &s3c_pcm_pdata
,
175 static struct resource exynos4_pcm2_resource
[] = {
176 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM2
, SZ_256
),
177 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX
),
178 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX
),
181 struct platform_device exynos4_device_pcm2
= {
182 .name
= "samsung-pcm",
184 .num_resources
= ARRAY_SIZE(exynos4_pcm2_resource
),
185 .resource
= exynos4_pcm2_resource
,
187 .platform_data
= &s3c_pcm_pdata
,
191 /* AC97 Controller platform devices */
193 static int exynos4_ac97_cfg_gpio(struct platform_device
*pdev
)
195 return s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(4));
198 static struct resource exynos4_ac97_resource
[] = {
199 [0] = DEFINE_RES_MEM(EXYNOS4_PA_AC97
, SZ_256
),
200 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT
),
201 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN
),
202 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN
),
203 [4] = DEFINE_RES_IRQ(EXYNOS4_IRQ_AC97
),
206 static struct s3c_audio_pdata s3c_ac97_pdata
= {
207 .cfg_gpio
= exynos4_ac97_cfg_gpio
,
210 static u64 exynos4_ac97_dmamask
= DMA_BIT_MASK(32);
212 struct platform_device exynos4_device_ac97
= {
213 .name
= "samsung-ac97",
215 .num_resources
= ARRAY_SIZE(exynos4_ac97_resource
),
216 .resource
= exynos4_ac97_resource
,
218 .platform_data
= &s3c_ac97_pdata
,
219 .dma_mask
= &exynos4_ac97_dmamask
,
220 .coherent_dma_mask
= DMA_BIT_MASK(32),
224 /* S/PDIF Controller platform_device */
226 static int exynos4_spdif_cfg_gpio(struct platform_device
*pdev
)
228 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(4));
233 static struct resource exynos4_spdif_resource
[] = {
234 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SPDIF
, SZ_256
),
235 [1] = DEFINE_RES_DMA(DMACH_SPDIF
),
238 static struct s3c_audio_pdata samsung_spdif_pdata
= {
239 .cfg_gpio
= exynos4_spdif_cfg_gpio
,
242 static u64 exynos4_spdif_dmamask
= DMA_BIT_MASK(32);
244 struct platform_device exynos4_device_spdif
= {
245 .name
= "samsung-spdif",
247 .num_resources
= ARRAY_SIZE(exynos4_spdif_resource
),
248 .resource
= exynos4_spdif_resource
,
250 .platform_data
= &samsung_spdif_pdata
,
251 .dma_mask
= &exynos4_spdif_dmamask
,
252 .coherent_dma_mask
= DMA_BIT_MASK(32),