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 <plat/audio.h>
20 #include <mach/irqs.h>
21 #include <mach/regs-audss.h>
23 static const char *rclksrc
[] = {
28 static int s5pv210_cfg_i2s(struct platform_device
*pdev
)
30 /* configure GPIO for i2s port */
33 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
36 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
39 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
42 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
49 static struct s3c_audio_pdata i2sv5_pdata
= {
50 .cfg_gpio
= s5pv210_cfg_i2s
,
53 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
56 .idma_addr
= S5PV210_AUDSS_INT_MEM
,
61 static struct resource s5pv210_iis0_resource
[] = {
62 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS0
, SZ_256
),
63 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX
),
64 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX
),
65 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX
),
68 struct platform_device s5pv210_device_iis0
= {
69 .name
= "samsung-i2s",
71 .num_resources
= ARRAY_SIZE(s5pv210_iis0_resource
),
72 .resource
= s5pv210_iis0_resource
,
74 .platform_data
= &i2sv5_pdata
,
78 static const char *rclksrc_v3
[] = {
83 static struct s3c_audio_pdata i2sv3_pdata
= {
84 .cfg_gpio
= s5pv210_cfg_i2s
,
87 .src_clk
= rclksrc_v3
,
92 static struct resource s5pv210_iis1_resource
[] = {
93 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS1
, SZ_256
),
94 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX
),
95 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX
),
98 struct platform_device s5pv210_device_iis1
= {
99 .name
= "samsung-i2s",
101 .num_resources
= ARRAY_SIZE(s5pv210_iis1_resource
),
102 .resource
= s5pv210_iis1_resource
,
104 .platform_data
= &i2sv3_pdata
,
108 static struct resource s5pv210_iis2_resource
[] = {
109 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS2
, SZ_256
),
110 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX
),
111 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX
),
114 struct platform_device s5pv210_device_iis2
= {
115 .name
= "samsung-i2s",
117 .num_resources
= ARRAY_SIZE(s5pv210_iis2_resource
),
118 .resource
= s5pv210_iis2_resource
,
120 .platform_data
= &i2sv3_pdata
,
124 /* PCM Controller platform_devices */
126 static int s5pv210_pcm_cfg_gpio(struct platform_device
*pdev
)
130 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
133 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
136 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
139 printk(KERN_DEBUG
"Invalid PCM Controller number!");
146 static struct s3c_audio_pdata s3c_pcm_pdata
= {
147 .cfg_gpio
= s5pv210_pcm_cfg_gpio
,
150 static struct resource s5pv210_pcm0_resource
[] = {
151 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM0
, SZ_256
),
152 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX
),
153 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX
),
156 struct platform_device s5pv210_device_pcm0
= {
157 .name
= "samsung-pcm",
159 .num_resources
= ARRAY_SIZE(s5pv210_pcm0_resource
),
160 .resource
= s5pv210_pcm0_resource
,
162 .platform_data
= &s3c_pcm_pdata
,
166 static struct resource s5pv210_pcm1_resource
[] = {
167 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM1
, SZ_256
),
168 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX
),
169 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX
),
172 struct platform_device s5pv210_device_pcm1
= {
173 .name
= "samsung-pcm",
175 .num_resources
= ARRAY_SIZE(s5pv210_pcm1_resource
),
176 .resource
= s5pv210_pcm1_resource
,
178 .platform_data
= &s3c_pcm_pdata
,
182 static struct resource s5pv210_pcm2_resource
[] = {
183 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM2
, SZ_256
),
184 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX
),
185 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX
),
188 struct platform_device s5pv210_device_pcm2
= {
189 .name
= "samsung-pcm",
191 .num_resources
= ARRAY_SIZE(s5pv210_pcm2_resource
),
192 .resource
= s5pv210_pcm2_resource
,
194 .platform_data
= &s3c_pcm_pdata
,
198 /* AC97 Controller platform devices */
200 static int s5pv210_ac97_cfg_gpio(struct platform_device
*pdev
)
202 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
205 static struct resource s5pv210_ac97_resource
[] = {
206 [0] = DEFINE_RES_MEM(S5PV210_PA_AC97
, SZ_256
),
207 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT
),
208 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN
),
209 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN
),
210 [4] = DEFINE_RES_IRQ(IRQ_AC97
),
213 static struct s3c_audio_pdata s3c_ac97_pdata
= {
214 .cfg_gpio
= s5pv210_ac97_cfg_gpio
,
217 static u64 s5pv210_ac97_dmamask
= DMA_BIT_MASK(32);
219 struct platform_device s5pv210_device_ac97
= {
220 .name
= "samsung-ac97",
222 .num_resources
= ARRAY_SIZE(s5pv210_ac97_resource
),
223 .resource
= s5pv210_ac97_resource
,
225 .platform_data
= &s3c_ac97_pdata
,
226 .dma_mask
= &s5pv210_ac97_dmamask
,
227 .coherent_dma_mask
= DMA_BIT_MASK(32),
231 /* S/PDIF Controller platform_device */
233 static int s5pv210_spdif_cfg_gpio(struct platform_device
*pdev
)
235 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
240 static struct resource s5pv210_spdif_resource
[] = {
241 [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF
, SZ_256
),
242 [1] = DEFINE_RES_DMA(DMACH_SPDIF
),
245 static struct s3c_audio_pdata samsung_spdif_pdata
= {
246 .cfg_gpio
= s5pv210_spdif_cfg_gpio
,
249 static u64 s5pv210_spdif_dmamask
= DMA_BIT_MASK(32);
251 struct platform_device s5pv210_device_spdif
= {
252 .name
= "samsung-spdif",
254 .num_resources
= ARRAY_SIZE(s5pv210_spdif_resource
),
255 .resource
= s5pv210_spdif_resource
,
257 .platform_data
= &samsung_spdif_pdata
,
258 .dma_mask
= &s5pv210_spdif_dmamask
,
259 .coherent_dma_mask
= DMA_BIT_MASK(32),