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>
24 #include <mach/regs-audss.h>
26 static int exynos4_cfg_i2s(struct platform_device
*pdev
)
28 /* configure GPIO for i2s port */
31 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 7, S3C_GPIO_SFN(2));
34 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(2));
37 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(4));
40 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
47 static struct s3c_audio_pdata i2sv5_pdata
= {
48 .cfg_gpio
= exynos4_cfg_i2s
,
51 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
53 .idma_addr
= EXYNOS4_AUDSS_INT_MEM
,
58 static struct resource exynos4_i2s0_resource
[] = {
59 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S0
, SZ_256
),
60 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX
),
61 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX
),
62 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX
),
65 struct platform_device exynos4_device_i2s0
= {
66 .name
= "samsung-i2s",
68 .num_resources
= ARRAY_SIZE(exynos4_i2s0_resource
),
69 .resource
= exynos4_i2s0_resource
,
71 .platform_data
= &i2sv5_pdata
,
75 static struct s3c_audio_pdata i2sv3_pdata
= {
76 .cfg_gpio
= exynos4_cfg_i2s
,
79 .quirks
= QUIRK_NO_MUXPSR
,
84 static struct resource exynos4_i2s1_resource
[] = {
85 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S1
, SZ_256
),
86 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX
),
87 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX
),
90 struct platform_device exynos4_device_i2s1
= {
91 .name
= "samsung-i2s",
93 .num_resources
= ARRAY_SIZE(exynos4_i2s1_resource
),
94 .resource
= exynos4_i2s1_resource
,
96 .platform_data
= &i2sv3_pdata
,
100 static struct resource exynos4_i2s2_resource
[] = {
101 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S2
, SZ_256
),
102 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX
),
103 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX
),
106 struct platform_device exynos4_device_i2s2
= {
107 .name
= "samsung-i2s",
109 .num_resources
= ARRAY_SIZE(exynos4_i2s2_resource
),
110 .resource
= exynos4_i2s2_resource
,
112 .platform_data
= &i2sv3_pdata
,
116 /* PCM Controller platform_devices */
118 static int exynos4_pcm_cfg_gpio(struct platform_device
*pdev
)
122 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 5, S3C_GPIO_SFN(3));
125 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(3));
128 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(3));
131 printk(KERN_DEBUG
"Invalid PCM Controller number!");
138 static struct s3c_audio_pdata s3c_pcm_pdata
= {
139 .cfg_gpio
= exynos4_pcm_cfg_gpio
,
142 static struct resource exynos4_pcm0_resource
[] = {
143 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM0
, SZ_256
),
144 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX
),
145 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX
),
148 struct platform_device exynos4_device_pcm0
= {
149 .name
= "samsung-pcm",
151 .num_resources
= ARRAY_SIZE(exynos4_pcm0_resource
),
152 .resource
= exynos4_pcm0_resource
,
154 .platform_data
= &s3c_pcm_pdata
,
158 static struct resource exynos4_pcm1_resource
[] = {
159 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM1
, SZ_256
),
160 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX
),
161 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX
),
164 struct platform_device exynos4_device_pcm1
= {
165 .name
= "samsung-pcm",
167 .num_resources
= ARRAY_SIZE(exynos4_pcm1_resource
),
168 .resource
= exynos4_pcm1_resource
,
170 .platform_data
= &s3c_pcm_pdata
,
174 static struct resource exynos4_pcm2_resource
[] = {
175 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM2
, SZ_256
),
176 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX
),
177 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX
),
180 struct platform_device exynos4_device_pcm2
= {
181 .name
= "samsung-pcm",
183 .num_resources
= ARRAY_SIZE(exynos4_pcm2_resource
),
184 .resource
= exynos4_pcm2_resource
,
186 .platform_data
= &s3c_pcm_pdata
,
190 /* AC97 Controller platform devices */
192 static int exynos4_ac97_cfg_gpio(struct platform_device
*pdev
)
194 return s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(4));
197 static struct resource exynos4_ac97_resource
[] = {
198 [0] = DEFINE_RES_MEM(EXYNOS4_PA_AC97
, SZ_256
),
199 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT
),
200 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN
),
201 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN
),
202 [4] = DEFINE_RES_IRQ(EXYNOS4_IRQ_AC97
),
205 static struct s3c_audio_pdata s3c_ac97_pdata
= {
206 .cfg_gpio
= exynos4_ac97_cfg_gpio
,
209 static u64 exynos4_ac97_dmamask
= DMA_BIT_MASK(32);
211 struct platform_device exynos4_device_ac97
= {
212 .name
= "samsung-ac97",
214 .num_resources
= ARRAY_SIZE(exynos4_ac97_resource
),
215 .resource
= exynos4_ac97_resource
,
217 .platform_data
= &s3c_ac97_pdata
,
218 .dma_mask
= &exynos4_ac97_dmamask
,
219 .coherent_dma_mask
= DMA_BIT_MASK(32),
223 /* S/PDIF Controller platform_device */
225 static int exynos4_spdif_cfg_gpio(struct platform_device
*pdev
)
227 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(4));
232 static struct resource exynos4_spdif_resource
[] = {
233 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SPDIF
, SZ_256
),
234 [1] = DEFINE_RES_DMA(DMACH_SPDIF
),
237 static struct s3c_audio_pdata samsung_spdif_pdata
= {
238 .cfg_gpio
= exynos4_spdif_cfg_gpio
,
241 static u64 exynos4_spdif_dmamask
= DMA_BIT_MASK(32);
243 struct platform_device exynos4_device_spdif
= {
244 .name
= "samsung-spdif",
246 .num_resources
= ARRAY_SIZE(exynos4_spdif_resource
),
247 .resource
= exynos4_spdif_resource
,
249 .platform_data
= &samsung_spdif_pdata
,
250 .dma_mask
= &exynos4_spdif_dmamask
,
251 .coherent_dma_mask
= DMA_BIT_MASK(32),