1 /* linux/arch/arm/mach-s5p6442/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>
22 static int s5p6442_cfg_i2s(struct platform_device
*pdev
)
26 /* configure GPIO for i2s port */
29 base
= S5P6442_GPC1(0);
33 base
= S5P6442_GPC0(0);
37 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
41 s3c_gpio_cfgpin_range(base
, 5, S3C_GPIO_SFN(2));
45 static const char *rclksrc_v35
[] = {
50 static struct s3c_audio_pdata i2sv35_pdata
= {
51 .cfg_gpio
= s5p6442_cfg_i2s
,
54 .quirks
= QUIRK_SEC_DAI
| QUIRK_NEED_RSTCLR
,
55 .src_clk
= rclksrc_v35
,
60 static struct resource s5p6442_iis0_resource
[] = {
62 .start
= S5P6442_PA_I2S0
,
63 .end
= S5P6442_PA_I2S0
+ 0x100 - 1,
64 .flags
= IORESOURCE_MEM
,
67 .start
= DMACH_I2S0_TX
,
69 .flags
= IORESOURCE_DMA
,
72 .start
= DMACH_I2S0_RX
,
74 .flags
= IORESOURCE_DMA
,
77 .start
= DMACH_I2S0S_TX
,
78 .end
= DMACH_I2S0S_TX
,
79 .flags
= IORESOURCE_DMA
,
83 struct platform_device s5p6442_device_iis0
= {
84 .name
= "samsung-i2s",
86 .num_resources
= ARRAY_SIZE(s5p6442_iis0_resource
),
87 .resource
= s5p6442_iis0_resource
,
89 .platform_data
= &i2sv35_pdata
,
93 static const char *rclksrc_v3
[] = {
98 static struct s3c_audio_pdata i2sv3_pdata
= {
99 .cfg_gpio
= s5p6442_cfg_i2s
,
102 .src_clk
= rclksrc_v3
,
107 static struct resource s5p6442_iis1_resource
[] = {
109 .start
= S5P6442_PA_I2S1
,
110 .end
= S5P6442_PA_I2S1
+ 0x100 - 1,
111 .flags
= IORESOURCE_MEM
,
114 .start
= DMACH_I2S1_TX
,
115 .end
= DMACH_I2S1_TX
,
116 .flags
= IORESOURCE_DMA
,
119 .start
= DMACH_I2S1_RX
,
120 .end
= DMACH_I2S1_RX
,
121 .flags
= IORESOURCE_DMA
,
125 struct platform_device s5p6442_device_iis1
= {
126 .name
= "samsung-i2s",
128 .num_resources
= ARRAY_SIZE(s5p6442_iis1_resource
),
129 .resource
= s5p6442_iis1_resource
,
131 .platform_data
= &i2sv3_pdata
,
135 /* PCM Controller platform_devices */
137 static int s5p6442_pcm_cfg_gpio(struct platform_device
*pdev
)
143 base
= S5P6442_GPC0(0);
147 base
= S5P6442_GPC1(0);
151 printk(KERN_DEBUG
"Invalid PCM Controller number!");
155 s3c_gpio_cfgpin_range(base
, 5, S3C_GPIO_SFN(3));
159 static struct s3c_audio_pdata s3c_pcm_pdata
= {
160 .cfg_gpio
= s5p6442_pcm_cfg_gpio
,
163 static struct resource s5p6442_pcm0_resource
[] = {
165 .start
= S5P6442_PA_PCM0
,
166 .end
= S5P6442_PA_PCM0
+ 0x100 - 1,
167 .flags
= IORESOURCE_MEM
,
170 .start
= DMACH_PCM0_TX
,
171 .end
= DMACH_PCM0_TX
,
172 .flags
= IORESOURCE_DMA
,
175 .start
= DMACH_PCM0_RX
,
176 .end
= DMACH_PCM0_RX
,
177 .flags
= IORESOURCE_DMA
,
181 struct platform_device s5p6442_device_pcm0
= {
182 .name
= "samsung-pcm",
184 .num_resources
= ARRAY_SIZE(s5p6442_pcm0_resource
),
185 .resource
= s5p6442_pcm0_resource
,
187 .platform_data
= &s3c_pcm_pdata
,
191 static struct resource s5p6442_pcm1_resource
[] = {
193 .start
= S5P6442_PA_PCM1
,
194 .end
= S5P6442_PA_PCM1
+ 0x100 - 1,
195 .flags
= IORESOURCE_MEM
,
198 .start
= DMACH_PCM1_TX
,
199 .end
= DMACH_PCM1_TX
,
200 .flags
= IORESOURCE_DMA
,
203 .start
= DMACH_PCM1_RX
,
204 .end
= DMACH_PCM1_RX
,
205 .flags
= IORESOURCE_DMA
,
209 struct platform_device s5p6442_device_pcm1
= {
210 .name
= "samsung-pcm",
212 .num_resources
= ARRAY_SIZE(s5p6442_pcm1_resource
),
213 .resource
= s5p6442_pcm1_resource
,
215 .platform_data
= &s3c_pcm_pdata
,