]>
Commit | Line | Data |
---|---|---|
e661faa4 KK |
1 | /* linux/arch/arm/mach-s5p64x0/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 <plat/audio.h> | |
17 | ||
18 | #include <mach/map.h> | |
19 | #include <mach/dma.h> | |
20 | #include <mach/irqs.h> | |
21 | ||
22 | static int s5p6440_cfg_i2s(struct platform_device *pdev) | |
23 | { | |
24 | /* configure GPIO for i2s port */ | |
25 | switch (pdev->id) { | |
26 | case -1: | |
af94e577 BD |
27 | s3c_gpio_cfgpin_range(S5P6440_GPR(4), 5, S3C_GPIO_SFN(5)); |
28 | s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(5)); | |
e661faa4 KK |
29 | break; |
30 | ||
31 | default: | |
32 | printk(KERN_ERR "Invalid Device %d\n", pdev->id); | |
33 | return -EINVAL; | |
34 | } | |
35 | ||
36 | return 0; | |
37 | } | |
38 | ||
39 | static int s5p6450_cfg_i2s(struct platform_device *pdev) | |
40 | { | |
41 | /* configure GPIO for i2s port */ | |
42 | switch (pdev->id) { | |
43 | case -1: | |
44 | s3c_gpio_cfgpin(S5P6450_GPB(4), S3C_GPIO_SFN(5)); | |
af94e577 BD |
45 | s3c_gpio_cfgpin_range(S5P6450_GPR(4), 5, S3C_GPIO_SFN(5)); |
46 | s3c_gpio_cfgpin_range(S5P6450_GPR(13), 2, S3C_GPIO_SFN(5)); | |
47 | ||
e661faa4 KK |
48 | break; |
49 | ||
50 | default: | |
51 | printk(KERN_ERR "Invalid Device %d\n", pdev->id); | |
52 | return -EINVAL; | |
53 | } | |
54 | ||
55 | return 0; | |
56 | } | |
57 | ||
58 | static struct s3c_audio_pdata s5p6440_i2s_pdata = { | |
59 | .cfg_gpio = s5p6440_cfg_i2s, | |
60 | }; | |
61 | ||
62 | static struct s3c_audio_pdata s5p6450_i2s_pdata = { | |
63 | .cfg_gpio = s5p6450_cfg_i2s, | |
64 | }; | |
65 | ||
66 | static struct resource s5p64x0_iis0_resource[] = { | |
67 | [0] = { | |
68 | .start = S5P64X0_PA_I2S, | |
69 | .end = S5P64X0_PA_I2S + 0x100 - 1, | |
70 | .flags = IORESOURCE_MEM, | |
71 | }, | |
72 | [1] = { | |
73 | .start = DMACH_I2S0_TX, | |
74 | .end = DMACH_I2S0_TX, | |
75 | .flags = IORESOURCE_DMA, | |
76 | }, | |
77 | [2] = { | |
78 | .start = DMACH_I2S0_RX, | |
79 | .end = DMACH_I2S0_RX, | |
80 | .flags = IORESOURCE_DMA, | |
81 | }, | |
82 | }; | |
83 | ||
84 | struct platform_device s5p6440_device_iis = { | |
85 | .name = "s3c64xx-iis-v4", | |
86 | .id = -1, | |
87 | .num_resources = ARRAY_SIZE(s5p64x0_iis0_resource), | |
88 | .resource = s5p64x0_iis0_resource, | |
89 | .dev = { | |
90 | .platform_data = &s5p6440_i2s_pdata, | |
91 | }, | |
92 | }; | |
93 | ||
94 | struct platform_device s5p6450_device_iis0 = { | |
95 | .name = "s3c64xx-iis-v4", | |
96 | .id = -1, | |
97 | .num_resources = ARRAY_SIZE(s5p64x0_iis0_resource), | |
98 | .resource = s5p64x0_iis0_resource, | |
99 | .dev = { | |
100 | .platform_data = &s5p6450_i2s_pdata, | |
101 | }, | |
102 | }; | |
103 | ||
104 | /* PCM Controller platform_devices */ | |
105 | ||
106 | static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev) | |
107 | { | |
108 | switch (pdev->id) { | |
109 | case 0: | |
af94e577 BD |
110 | s3c_gpio_cfgpin_range(S5P6440_GPR(6), 3, S3C_GPIO_SFN(2)); |
111 | s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(2)); | |
e661faa4 KK |
112 | break; |
113 | ||
114 | default: | |
115 | printk(KERN_DEBUG "Invalid PCM Controller number!"); | |
116 | return -EINVAL; | |
117 | } | |
118 | ||
119 | return 0; | |
120 | } | |
121 | ||
122 | static struct s3c_audio_pdata s5p6440_pcm_pdata = { | |
123 | .cfg_gpio = s5p6440_pcm_cfg_gpio, | |
124 | }; | |
125 | ||
126 | static struct resource s5p6440_pcm0_resource[] = { | |
127 | [0] = { | |
128 | .start = S5P64X0_PA_PCM, | |
129 | .end = S5P64X0_PA_PCM + 0x100 - 1, | |
130 | .flags = IORESOURCE_MEM, | |
131 | }, | |
132 | [1] = { | |
133 | .start = DMACH_PCM0_TX, | |
134 | .end = DMACH_PCM0_TX, | |
135 | .flags = IORESOURCE_DMA, | |
136 | }, | |
137 | [2] = { | |
138 | .start = DMACH_PCM0_RX, | |
139 | .end = DMACH_PCM0_RX, | |
140 | .flags = IORESOURCE_DMA, | |
141 | }, | |
142 | }; | |
143 | ||
144 | struct platform_device s5p6440_device_pcm = { | |
145 | .name = "samsung-pcm", | |
146 | .id = 0, | |
147 | .num_resources = ARRAY_SIZE(s5p6440_pcm0_resource), | |
148 | .resource = s5p6440_pcm0_resource, | |
149 | .dev = { | |
150 | .platform_data = &s5p6440_pcm_pdata, | |
151 | }, | |
152 | }; |