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-s5pc100/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 
22 static int s5pc100_cfg_i2s(struct platform_device *pdev)
23 {
24  /* configure GPIO for i2s port */
25  switch (pdev->id) {
26  case 0: /* Dedicated pins */
27  break;
28  case 1:
30  break;
31  case 2:
33  break;
34  default:
35  printk(KERN_ERR "Invalid Device %d\n", pdev->id);
36  return -EINVAL;
37  }
38 
39  return 0;
40 }
41 
42 static const char *rclksrc_v5[] = {
43  [0] = "iis",
44  [1] = "i2sclkd2",
45 };
46 
47 static struct s3c_audio_pdata i2sv5_pdata = {
48  .cfg_gpio = s5pc100_cfg_i2s,
49  .type = {
50  .i2s = {
51  .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
53  .src_clk = rclksrc_v5,
54  },
55  },
56 };
57 
58 static struct resource s5pc100_iis0_resource[] = {
63 };
64 
66  .name = "samsung-i2s",
67  .id = 0,
68  .num_resources = ARRAY_SIZE(s5pc100_iis0_resource),
69  .resource = s5pc100_iis0_resource,
70  .dev = {
71  .platform_data = &i2sv5_pdata,
72  },
73 };
74 
75 static const char *rclksrc_v3[] = {
76  [0] = "iis",
77  [1] = "sclk_audio",
78 };
79 
80 static struct s3c_audio_pdata i2sv3_pdata = {
81  .cfg_gpio = s5pc100_cfg_i2s,
82  .type = {
83  .i2s = {
84  .src_clk = rclksrc_v3,
85  },
86  },
87 };
88 
89 static struct resource s5pc100_iis1_resource[] = {
93 };
94 
96  .name = "samsung-i2s",
97  .id = 1,
98  .num_resources = ARRAY_SIZE(s5pc100_iis1_resource),
99  .resource = s5pc100_iis1_resource,
100  .dev = {
101  .platform_data = &i2sv3_pdata,
102  },
103 };
104 
105 static struct resource s5pc100_iis2_resource[] = {
109 };
110 
112  .name = "samsung-i2s",
113  .id = 2,
114  .num_resources = ARRAY_SIZE(s5pc100_iis2_resource),
115  .resource = s5pc100_iis2_resource,
116  .dev = {
117  .platform_data = &i2sv3_pdata,
118  },
119 };
120 
121 /* PCM Controller platform_devices */
122 
123 static int s5pc100_pcm_cfg_gpio(struct platform_device *pdev)
124 {
125  switch (pdev->id) {
126  case 0:
128  break;
129 
130  case 1:
132  break;
133 
134  default:
135  printk(KERN_DEBUG "Invalid PCM Controller number!");
136  return -EINVAL;
137  }
138 
139  return 0;
140 }
141 
142 static struct s3c_audio_pdata s3c_pcm_pdata = {
143  .cfg_gpio = s5pc100_pcm_cfg_gpio,
144 };
145 
146 static struct resource s5pc100_pcm0_resource[] = {
150 };
151 
153  .name = "samsung-pcm",
154  .id = 0,
155  .num_resources = ARRAY_SIZE(s5pc100_pcm0_resource),
156  .resource = s5pc100_pcm0_resource,
157  .dev = {
158  .platform_data = &s3c_pcm_pdata,
159  },
160 };
161 
162 static struct resource s5pc100_pcm1_resource[] = {
166 };
167 
169  .name = "samsung-pcm",
170  .id = 1,
171  .num_resources = ARRAY_SIZE(s5pc100_pcm1_resource),
172  .resource = s5pc100_pcm1_resource,
173  .dev = {
174  .platform_data = &s3c_pcm_pdata,
175  },
176 };
177 
178 /* AC97 Controller platform devices */
179 
180 static int s5pc100_ac97_cfg_gpio(struct platform_device *pdev)
181 {
183 }
184 
185 static struct resource s5pc100_ac97_resource[] = {
190  [4] = DEFINE_RES_IRQ(IRQ_AC97),
191 };
192 
193 static struct s3c_audio_pdata s3c_ac97_pdata = {
194  .cfg_gpio = s5pc100_ac97_cfg_gpio,
195 };
196 
197 static u64 s5pc100_ac97_dmamask = DMA_BIT_MASK(32);
198 
200  .name = "samsung-ac97",
201  .id = -1,
202  .num_resources = ARRAY_SIZE(s5pc100_ac97_resource),
203  .resource = s5pc100_ac97_resource,
204  .dev = {
205  .platform_data = &s3c_ac97_pdata,
206  .dma_mask = &s5pc100_ac97_dmamask,
207  .coherent_dma_mask = DMA_BIT_MASK(32),
208  },
209 };
210 
211 /* S/PDIF Controller platform_device */
212 static int s5pc100_spdif_cfg_gpd(struct platform_device *pdev)
213 {
215 
216  return 0;
217 }
218 
219 static int s5pc100_spdif_cfg_gpg3(struct platform_device *pdev)
220 {
222 
223  return 0;
224 }
225 
226 static struct resource s5pc100_spdif_resource[] = {
229 };
230 
231 static struct s3c_audio_pdata s5p_spdif_pdata = {
232  .cfg_gpio = s5pc100_spdif_cfg_gpd,
233 };
234 
235 static u64 s5pc100_spdif_dmamask = DMA_BIT_MASK(32);
236 
238  .name = "samsung-spdif",
239  .id = -1,
240  .num_resources = ARRAY_SIZE(s5pc100_spdif_resource),
241  .resource = s5pc100_spdif_resource,
242  .dev = {
243  .platform_data = &s5p_spdif_pdata,
244  .dma_mask = &s5pc100_spdif_dmamask,
245  .coherent_dma_mask = DMA_BIT_MASK(32),
246  },
247 };
248 
250 {
251  if (gpio == S5PC100_SPDIF_GPD)
252  s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpd;
253  else
254  s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpg3;
255 }