1 /* linux/arch/arm/mach-s5pv210/dev-audio.c
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/platform_device.h>
12 #include <linux/dma-mapping.h>
13 #include <linux/gpio.h>
15 #include <plat/gpio-cfg.h>
16 #include <linux/platform_data/asoc-s3c.h>
20 #include <mach/irqs.h>
22 #define S5PV210_AUDSS_INT_MEM (0xC0000000)
24 static int s5pv210_cfg_i2s(struct platform_device
*pdev
)
26 /* configure GPIO for i2s port */
29 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
32 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
35 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
38 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
45 static struct s3c_audio_pdata i2sv5_pdata
= {
46 .cfg_gpio
= s5pv210_cfg_i2s
,
49 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
51 .idma_addr
= S5PV210_AUDSS_INT_MEM
,
56 static struct resource s5pv210_iis0_resource
[] = {
57 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS0
, SZ_256
),
58 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX
),
59 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX
),
60 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX
),
63 struct platform_device s5pv210_device_iis0
= {
64 .name
= "samsung-i2s",
66 .num_resources
= ARRAY_SIZE(s5pv210_iis0_resource
),
67 .resource
= s5pv210_iis0_resource
,
69 .platform_data
= &i2sv5_pdata
,
73 static struct s3c_audio_pdata i2sv3_pdata
= {
74 .cfg_gpio
= s5pv210_cfg_i2s
,
77 static struct resource s5pv210_iis1_resource
[] = {
78 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS1
, SZ_256
),
79 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX
),
80 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX
),
83 struct platform_device s5pv210_device_iis1
= {
84 .name
= "samsung-i2s",
86 .num_resources
= ARRAY_SIZE(s5pv210_iis1_resource
),
87 .resource
= s5pv210_iis1_resource
,
89 .platform_data
= &i2sv3_pdata
,
93 static struct resource s5pv210_iis2_resource
[] = {
94 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS2
, SZ_256
),
95 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX
),
96 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX
),
99 struct platform_device s5pv210_device_iis2
= {
100 .name
= "samsung-i2s",
102 .num_resources
= ARRAY_SIZE(s5pv210_iis2_resource
),
103 .resource
= s5pv210_iis2_resource
,
105 .platform_data
= &i2sv3_pdata
,
109 /* PCM Controller platform_devices */
111 static int s5pv210_pcm_cfg_gpio(struct platform_device
*pdev
)
115 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
118 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
121 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
124 printk(KERN_DEBUG
"Invalid PCM Controller number!");
131 static struct s3c_audio_pdata s3c_pcm_pdata
= {
132 .cfg_gpio
= s5pv210_pcm_cfg_gpio
,
135 static struct resource s5pv210_pcm0_resource
[] = {
136 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM0
, SZ_256
),
137 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX
),
138 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX
),
141 struct platform_device s5pv210_device_pcm0
= {
142 .name
= "samsung-pcm",
144 .num_resources
= ARRAY_SIZE(s5pv210_pcm0_resource
),
145 .resource
= s5pv210_pcm0_resource
,
147 .platform_data
= &s3c_pcm_pdata
,
151 static struct resource s5pv210_pcm1_resource
[] = {
152 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM1
, SZ_256
),
153 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX
),
154 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX
),
157 struct platform_device s5pv210_device_pcm1
= {
158 .name
= "samsung-pcm",
160 .num_resources
= ARRAY_SIZE(s5pv210_pcm1_resource
),
161 .resource
= s5pv210_pcm1_resource
,
163 .platform_data
= &s3c_pcm_pdata
,
167 static struct resource s5pv210_pcm2_resource
[] = {
168 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM2
, SZ_256
),
169 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX
),
170 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX
),
173 struct platform_device s5pv210_device_pcm2
= {
174 .name
= "samsung-pcm",
176 .num_resources
= ARRAY_SIZE(s5pv210_pcm2_resource
),
177 .resource
= s5pv210_pcm2_resource
,
179 .platform_data
= &s3c_pcm_pdata
,
183 /* AC97 Controller platform devices */
185 static int s5pv210_ac97_cfg_gpio(struct platform_device
*pdev
)
187 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
190 static struct resource s5pv210_ac97_resource
[] = {
191 [0] = DEFINE_RES_MEM(S5PV210_PA_AC97
, SZ_256
),
192 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT
),
193 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN
),
194 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN
),
195 [4] = DEFINE_RES_IRQ(IRQ_AC97
),
198 static struct s3c_audio_pdata s3c_ac97_pdata
= {
199 .cfg_gpio
= s5pv210_ac97_cfg_gpio
,
202 static u64 s5pv210_ac97_dmamask
= DMA_BIT_MASK(32);
204 struct platform_device s5pv210_device_ac97
= {
205 .name
= "samsung-ac97",
207 .num_resources
= ARRAY_SIZE(s5pv210_ac97_resource
),
208 .resource
= s5pv210_ac97_resource
,
210 .platform_data
= &s3c_ac97_pdata
,
211 .dma_mask
= &s5pv210_ac97_dmamask
,
212 .coherent_dma_mask
= DMA_BIT_MASK(32),
216 /* S/PDIF Controller platform_device */
218 static int s5pv210_spdif_cfg_gpio(struct platform_device
*pdev
)
220 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
225 static struct resource s5pv210_spdif_resource
[] = {
226 [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF
, SZ_256
),
227 [1] = DEFINE_RES_DMA(DMACH_SPDIF
),
230 static struct s3c_audio_pdata samsung_spdif_pdata
= {
231 .cfg_gpio
= s5pv210_spdif_cfg_gpio
,
234 static u64 s5pv210_spdif_dmamask
= DMA_BIT_MASK(32);
236 struct platform_device s5pv210_device_spdif
= {
237 .name
= "samsung-spdif",
239 .num_resources
= ARRAY_SIZE(s5pv210_spdif_resource
),
240 .resource
= s5pv210_spdif_resource
,
242 .platform_data
= &samsung_spdif_pdata
,
243 .dma_mask
= &s5pv210_spdif_dmamask
,
244 .coherent_dma_mask
= DMA_BIT_MASK(32),