Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dev-audio.c
Go to the documentation of this file.
1 /* linux/arch/arm/mach-s5pv210/dev-audio.c
2  *
3  * Copyright (c) 2010 Samsung Electronics Co. Ltd
4  * Jaswinder Singh <[email protected]>
5  *
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.
9  */
10 
11 #include <linux/platform_device.h>
12 #include <linux/dma-mapping.h>
13 #include <linux/gpio.h>
14 
15 #include <plat/gpio-cfg.h>
17 
18 #include <mach/map.h>
19 #include <mach/dma.h>
20 #include <mach/irqs.h>
21 #include <mach/regs-audss.h>
22 
23 static const char *rclksrc[] = {
24  [0] = "busclk",
25  [1] = "i2sclk",
26 };
27 
28 static int s5pv210_cfg_i2s(struct platform_device *pdev)
29 {
30  /* configure GPIO for i2s port */
31  switch (pdev->id) {
32  case 0:
34  break;
35  case 1:
37  break;
38  case 2:
40  break;
41  default:
42  printk(KERN_ERR "Invalid Device %d\n", pdev->id);
43  return -EINVAL;
44  }
45 
46  return 0;
47 }
48 
49 static struct s3c_audio_pdata i2sv5_pdata = {
50  .cfg_gpio = s5pv210_cfg_i2s,
51  .type = {
52  .i2s = {
53  .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
55  .src_clk = rclksrc,
56  .idma_addr = S5PV210_AUDSS_INT_MEM,
57  },
58  },
59 };
60 
61 static struct resource s5pv210_iis0_resource[] = {
66 };
67 
69  .name = "samsung-i2s",
70  .id = 0,
71  .num_resources = ARRAY_SIZE(s5pv210_iis0_resource),
72  .resource = s5pv210_iis0_resource,
73  .dev = {
74  .platform_data = &i2sv5_pdata,
75  },
76 };
77 
78 static const char *rclksrc_v3[] = {
79  [0] = "iis",
80  [1] = "audio-bus",
81 };
82 
83 static struct s3c_audio_pdata i2sv3_pdata = {
84  .cfg_gpio = s5pv210_cfg_i2s,
85  .type = {
86  .i2s = {
87  .src_clk = rclksrc_v3,
88  },
89  },
90 };
91 
92 static struct resource s5pv210_iis1_resource[] = {
96 };
97 
99  .name = "samsung-i2s",
100  .id = 1,
101  .num_resources = ARRAY_SIZE(s5pv210_iis1_resource),
102  .resource = s5pv210_iis1_resource,
103  .dev = {
104  .platform_data = &i2sv3_pdata,
105  },
106 };
107 
108 static struct resource s5pv210_iis2_resource[] = {
112 };
113 
115  .name = "samsung-i2s",
116  .id = 2,
117  .num_resources = ARRAY_SIZE(s5pv210_iis2_resource),
118  .resource = s5pv210_iis2_resource,
119  .dev = {
120  .platform_data = &i2sv3_pdata,
121  },
122 };
123 
124 /* PCM Controller platform_devices */
125 
126 static int s5pv210_pcm_cfg_gpio(struct platform_device *pdev)
127 {
128  switch (pdev->id) {
129  case 0:
131  break;
132  case 1:
134  break;
135  case 2:
137  break;
138  default:
139  printk(KERN_DEBUG "Invalid PCM Controller number!");
140  return -EINVAL;
141  }
142 
143  return 0;
144 }
145 
146 static struct s3c_audio_pdata s3c_pcm_pdata = {
147  .cfg_gpio = s5pv210_pcm_cfg_gpio,
148 };
149 
150 static struct resource s5pv210_pcm0_resource[] = {
154 };
155 
157  .name = "samsung-pcm",
158  .id = 0,
159  .num_resources = ARRAY_SIZE(s5pv210_pcm0_resource),
160  .resource = s5pv210_pcm0_resource,
161  .dev = {
162  .platform_data = &s3c_pcm_pdata,
163  },
164 };
165 
166 static struct resource s5pv210_pcm1_resource[] = {
170 };
171 
173  .name = "samsung-pcm",
174  .id = 1,
175  .num_resources = ARRAY_SIZE(s5pv210_pcm1_resource),
176  .resource = s5pv210_pcm1_resource,
177  .dev = {
178  .platform_data = &s3c_pcm_pdata,
179  },
180 };
181 
182 static struct resource s5pv210_pcm2_resource[] = {
186 };
187 
189  .name = "samsung-pcm",
190  .id = 2,
191  .num_resources = ARRAY_SIZE(s5pv210_pcm2_resource),
192  .resource = s5pv210_pcm2_resource,
193  .dev = {
194  .platform_data = &s3c_pcm_pdata,
195  },
196 };
197 
198 /* AC97 Controller platform devices */
199 
200 static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
201 {
203 }
204 
205 static struct resource s5pv210_ac97_resource[] = {
210  [4] = DEFINE_RES_IRQ(IRQ_AC97),
211 };
212 
213 static struct s3c_audio_pdata s3c_ac97_pdata = {
214  .cfg_gpio = s5pv210_ac97_cfg_gpio,
215 };
216 
217 static u64 s5pv210_ac97_dmamask = DMA_BIT_MASK(32);
218 
220  .name = "samsung-ac97",
221  .id = -1,
222  .num_resources = ARRAY_SIZE(s5pv210_ac97_resource),
223  .resource = s5pv210_ac97_resource,
224  .dev = {
225  .platform_data = &s3c_ac97_pdata,
226  .dma_mask = &s5pv210_ac97_dmamask,
227  .coherent_dma_mask = DMA_BIT_MASK(32),
228  },
229 };
230 
231 /* S/PDIF Controller platform_device */
232 
233 static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
234 {
236 
237  return 0;
238 }
239 
240 static struct resource s5pv210_spdif_resource[] = {
243 };
244 
245 static struct s3c_audio_pdata samsung_spdif_pdata = {
246  .cfg_gpio = s5pv210_spdif_cfg_gpio,
247 };
248 
249 static u64 s5pv210_spdif_dmamask = DMA_BIT_MASK(32);
250 
252  .name = "samsung-spdif",
253  .id = -1,
254  .num_resources = ARRAY_SIZE(s5pv210_spdif_resource),
255  .resource = s5pv210_spdif_resource,
256  .dev = {
257  .platform_data = &samsung_spdif_pdata,
258  .dma_mask = &s5pv210_spdif_dmamask,
259  .coherent_dma_mask = DMA_BIT_MASK(32),
260  },
261 };