aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c64xx/dev-audio.c
diff options
context:
space:
mode:
authorJassi Brar <jassi.brar@samsung.com>2010-02-12 05:38:51 -0500
committerBen Dooks <ben-linux@fluff.org>2010-02-23 21:01:40 -0500
commitde6985be185167d14a79695f345025c531a685d0 (patch)
tree6a111532c17d191ad419fedf3eb66015a706664e /arch/arm/mach-s3c64xx/dev-audio.c
parent1f1008684a392f92c174252243d72a3297d6fa46 (diff)
ARM: S3C64XX: Add AC97 platform resources
This patch defines the platform device and the resources: IRQ, DMA and MEM, needed by the AC97 controller driver. Signed-off-by: Jassi Brar <jassi.brar@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s3c64xx/dev-audio.c')
-rw-r--r--arch/arm/mach-s3c64xx/dev-audio.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c
index aaffb8066707..c3e9e73bd0f9 100644
--- a/arch/arm/mach-s3c64xx/dev-audio.c
+++ b/arch/arm/mach-s3c64xx/dev-audio.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/dma-mapping.h>
14 15
15#include <mach/irqs.h> 16#include <mach/irqs.h>
16#include <mach/map.h> 17#include <mach/map.h>
@@ -255,3 +256,80 @@ struct platform_device s3c64xx_device_pcm1 = {
255 }, 256 },
256}; 257};
257EXPORT_SYMBOL(s3c64xx_device_pcm1); 258EXPORT_SYMBOL(s3c64xx_device_pcm1);
259
260/* AC97 Controller platform devices */
261
262static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev)
263{
264 s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_AC97_BITCLK);
265 s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_AC97_nRESET);
266 s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_AC97_SYNC);
267 s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_AC97_SDI);
268 s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_AC97_SDO);
269
270 return 0;
271}
272
273static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
274{
275 s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_AC97_BITCLK);
276 s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_AC97_nRESET);
277 s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_AC97_SYNC);
278 s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_AC97_SDI);
279 s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_AC97_SDO);
280
281 return 0;
282}
283
284static struct resource s3c64xx_ac97_resource[] = {
285 [0] = {
286 .start = S3C64XX_PA_AC97,
287 .end = S3C64XX_PA_AC97 + 0x100 - 1,
288 .flags = IORESOURCE_MEM,
289 },
290 [1] = {
291 .start = DMACH_AC97_PCMOUT,
292 .end = DMACH_AC97_PCMOUT,
293 .flags = IORESOURCE_DMA,
294 },
295 [2] = {
296 .start = DMACH_AC97_PCMIN,
297 .end = DMACH_AC97_PCMIN,
298 .flags = IORESOURCE_DMA,
299 },
300 [3] = {
301 .start = DMACH_AC97_MICIN,
302 .end = DMACH_AC97_MICIN,
303 .flags = IORESOURCE_DMA,
304 },
305 [4] = {
306 .start = IRQ_AC97,
307 .end = IRQ_AC97,
308 .flags = IORESOURCE_IRQ,
309 },
310};
311
312static struct s3c_audio_pdata s3c_ac97_pdata;
313
314static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
315
316struct platform_device s3c64xx_device_ac97 = {
317 .name = "s3c-ac97",
318 .id = -1,
319 .num_resources = ARRAY_SIZE(s3c64xx_ac97_resource),
320 .resource = s3c64xx_ac97_resource,
321 .dev = {
322 .platform_data = &s3c_ac97_pdata,
323 .dma_mask = &s3c64xx_ac97_dmamask,
324 .coherent_dma_mask = DMA_BIT_MASK(32),
325 },
326};
327EXPORT_SYMBOL(s3c64xx_device_ac97);
328
329void __init s3c64xx_ac97_setup_gpio(int num)
330{
331 if (num == S3C64XX_AC97_GPD)
332 s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpd;
333 else
334 s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpe;
335}