~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-s5pv210/dev-audio.c

Version: ~ [ linux-5.9-rc5 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* linux/arch/arm/mach-s5pv210/dev-audio.c
  2  *
  3  * Copyright (c) 2010 Samsung Electronics Co. Ltd
  4  *      Jaswinder Singh <jassi.brar@samsung.com>
  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>
 16 #include <linux/platform_data/asoc-s3c.h>
 17 
 18 #include <mach/map.h>
 19 #include <mach/dma.h>
 20 #include <mach/irqs.h>
 21 
 22 #define S5PV210_AUDSS_INT_MEM   (0xC0000000)
 23 
 24 static int s5pv210_cfg_i2s(struct platform_device *pdev)
 25 {
 26         /* configure GPIO for i2s port */
 27         switch (pdev->id) {
 28         case 0:
 29                 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
 30                 break;
 31         case 1:
 32                 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
 33                 break;
 34         case 2:
 35                 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
 36                 break;
 37         default:
 38                 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
 39                 return -EINVAL;
 40         }
 41 
 42         return 0;
 43 }
 44 
 45 static struct s3c_audio_pdata i2sv5_pdata = {
 46         .cfg_gpio = s5pv210_cfg_i2s,
 47         .type = {
 48                 .i2s = {
 49                         .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
 50                                          | QUIRK_NEED_RSTCLR,
 51                         .idma_addr = S5PV210_AUDSS_INT_MEM,
 52                 },
 53         },
 54 };
 55 
 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),
 61 };
 62 
 63 struct platform_device s5pv210_device_iis0 = {
 64         .name = "samsung-i2s",
 65         .id = 0,
 66         .num_resources    = ARRAY_SIZE(s5pv210_iis0_resource),
 67         .resource         = s5pv210_iis0_resource,
 68         .dev = {
 69                 .platform_data = &i2sv5_pdata,
 70         },
 71 };
 72 
 73 static struct s3c_audio_pdata i2sv3_pdata = {
 74         .cfg_gpio = s5pv210_cfg_i2s,
 75 };
 76 
 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),
 81 };
 82 
 83 struct platform_device s5pv210_device_iis1 = {
 84         .name             = "samsung-i2s",
 85         .id               = 1,
 86         .num_resources    = ARRAY_SIZE(s5pv210_iis1_resource),
 87         .resource         = s5pv210_iis1_resource,
 88         .dev = {
 89                 .platform_data = &i2sv3_pdata,
 90         },
 91 };
 92 
 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),
 97 };
 98 
 99 struct platform_device s5pv210_device_iis2 = {
100         .name             = "samsung-i2s",
101         .id               = 2,
102         .num_resources    = ARRAY_SIZE(s5pv210_iis2_resource),
103         .resource         = s5pv210_iis2_resource,
104         .dev = {
105                 .platform_data = &i2sv3_pdata,
106         },
107 };
108 
109 /* PCM Controller platform_devices */
110 
111 static int s5pv210_pcm_cfg_gpio(struct platform_device *pdev)
112 {
113         switch (pdev->id) {
114         case 0:
115                 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
116                 break;
117         case 1:
118                 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
119                 break;
120         case 2:
121                 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
122                 break;
123         default:
124                 printk(KERN_DEBUG "Invalid PCM Controller number!");
125                 return -EINVAL;
126         }
127 
128         return 0;
129 }
130 
131 static struct s3c_audio_pdata s3c_pcm_pdata = {
132         .cfg_gpio = s5pv210_pcm_cfg_gpio,
133 };
134 
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),
139 };
140 
141 struct platform_device s5pv210_device_pcm0 = {
142         .name             = "samsung-pcm",
143         .id               = 0,
144         .num_resources    = ARRAY_SIZE(s5pv210_pcm0_resource),
145         .resource         = s5pv210_pcm0_resource,
146         .dev = {
147                 .platform_data = &s3c_pcm_pdata,
148         },
149 };
150 
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),
155 };
156 
157 struct platform_device s5pv210_device_pcm1 = {
158         .name             = "samsung-pcm",
159         .id               = 1,
160         .num_resources    = ARRAY_SIZE(s5pv210_pcm1_resource),
161         .resource         = s5pv210_pcm1_resource,
162         .dev = {
163                 .platform_data = &s3c_pcm_pdata,
164         },
165 };
166 
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),
171 };
172 
173 struct platform_device s5pv210_device_pcm2 = {
174         .name             = "samsung-pcm",
175         .id               = 2,
176         .num_resources    = ARRAY_SIZE(s5pv210_pcm2_resource),
177         .resource         = s5pv210_pcm2_resource,
178         .dev = {
179                 .platform_data = &s3c_pcm_pdata,
180         },
181 };
182 
183 /* AC97 Controller platform devices */
184 
185 static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
186 {
187         return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
188 }
189 
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),
196 };
197 
198 static struct s3c_audio_pdata s3c_ac97_pdata = {
199         .cfg_gpio = s5pv210_ac97_cfg_gpio,
200 };
201 
202 static u64 s5pv210_ac97_dmamask = DMA_BIT_MASK(32);
203 
204 struct platform_device s5pv210_device_ac97 = {
205         .name             = "samsung-ac97",
206         .id               = -1,
207         .num_resources    = ARRAY_SIZE(s5pv210_ac97_resource),
208         .resource         = s5pv210_ac97_resource,
209         .dev = {
210                 .platform_data = &s3c_ac97_pdata,
211                 .dma_mask = &s5pv210_ac97_dmamask,
212                 .coherent_dma_mask = DMA_BIT_MASK(32),
213         },
214 };
215 
216 /* S/PDIF Controller platform_device */
217 
218 static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
219 {
220         s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
221 
222         return 0;
223 }
224 
225 static struct resource s5pv210_spdif_resource[] = {
226         [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF, SZ_256),
227         [1] = DEFINE_RES_DMA(DMACH_SPDIF),
228 };
229 
230 static struct s3c_audio_pdata samsung_spdif_pdata = {
231         .cfg_gpio = s5pv210_spdif_cfg_gpio,
232 };
233 
234 static u64 s5pv210_spdif_dmamask = DMA_BIT_MASK(32);
235 
236 struct platform_device s5pv210_device_spdif = {
237         .name           = "samsung-spdif",
238         .id             = -1,
239         .num_resources  = ARRAY_SIZE(s5pv210_spdif_resource),
240         .resource       = s5pv210_spdif_resource,
241         .dev = {
242                 .platform_data = &samsung_spdif_pdata,
243                 .dma_mask = &s5pv210_spdif_dmamask,
244                 .coherent_dma_mask = DMA_BIT_MASK(32),
245         },
246 };
247 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp