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> | |
436d42c6 | 16 | #include <linux/platform_data/asoc-s3c.h> |
e661faa4 KK |
17 | |
18 | #include <mach/map.h> | |
19 | #include <mach/dma.h> | |
20 | #include <mach/irqs.h> | |
21 | ||
e0b9c88b | 22 | static int s5p6440_cfg_i2s(struct platform_device *pdev) |
e661faa4 | 23 | { |
e661faa4 | 24 | switch (pdev->id) { |
d9a93c34 | 25 | case 0: |
e0b9c88b RS |
26 | s3c_gpio_cfgpin_range(S5P6440_GPC(4), 2, S3C_GPIO_SFN(5)); |
27 | s3c_gpio_cfgpin(S5P6440_GPC(7), S3C_GPIO_SFN(5)); | |
28 | s3c_gpio_cfgpin_range(S5P6440_GPH(6), 4, S3C_GPIO_SFN(5)); | |
e661faa4 | 29 | break; |
e661faa4 KK |
30 | default: |
31 | printk(KERN_ERR "Invalid Device %d\n", pdev->id); | |
32 | return -EINVAL; | |
33 | } | |
34 | ||
35 | return 0; | |
36 | } | |
37 | ||
e0b9c88b RS |
38 | static struct s3c_audio_pdata s5p6440_i2s_pdata = { |
39 | .cfg_gpio = s5p6440_cfg_i2s, | |
d9a93c34 JB |
40 | .type = { |
41 | .i2s = { | |
42 | .quirks = QUIRK_PRI_6CHAN, | |
d9a93c34 JB |
43 | }, |
44 | }, | |
e661faa4 KK |
45 | }; |
46 | ||
e0b9c88b | 47 | static struct resource s5p64x0_i2s0_resource[] = { |
5e9cf656 TB |
48 | [0] = DEFINE_RES_MEM(S5P64X0_PA_I2S, SZ_256), |
49 | [1] = DEFINE_RES_DMA(DMACH_I2S0_TX), | |
50 | [2] = DEFINE_RES_DMA(DMACH_I2S0_RX), | |
e661faa4 KK |
51 | }; |
52 | ||
53 | struct platform_device s5p6440_device_iis = { | |
d9a93c34 JB |
54 | .name = "samsung-i2s", |
55 | .id = 0, | |
e0b9c88b RS |
56 | .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource), |
57 | .resource = s5p64x0_i2s0_resource, | |
e661faa4 | 58 | .dev = { |
e0b9c88b RS |
59 | .platform_data = &s5p6440_i2s_pdata, |
60 | }, | |
61 | }; | |
62 | ||
63 | static int s5p6450_cfg_i2s(struct platform_device *pdev) | |
64 | { | |
65 | switch (pdev->id) { | |
66 | case 0: | |
67 | s3c_gpio_cfgpin_range(S5P6450_GPR(4), 5, S3C_GPIO_SFN(5)); | |
68 | s3c_gpio_cfgpin_range(S5P6450_GPR(13), 2, S3C_GPIO_SFN(5)); | |
69 | break; | |
70 | case 1: | |
71 | s3c_gpio_cfgpin(S5P6440_GPB(4), S3C_GPIO_SFN(5)); | |
72 | s3c_gpio_cfgpin_range(S5P6450_GPC(0), 4, S3C_GPIO_SFN(5)); | |
73 | break; | |
74 | case 2: | |
75 | s3c_gpio_cfgpin_range(S5P6450_GPK(0), 5, S3C_GPIO_SFN(5)); | |
76 | break; | |
77 | default: | |
78 | printk(KERN_ERR "Invalid Device %d\n", pdev->id); | |
79 | return -EINVAL; | |
80 | } | |
81 | ||
82 | return 0; | |
83 | } | |
84 | ||
85 | static struct s3c_audio_pdata s5p6450_i2s0_pdata = { | |
86 | .cfg_gpio = s5p6450_cfg_i2s, | |
87 | .type = { | |
88 | .i2s = { | |
89 | .quirks = QUIRK_PRI_6CHAN, | |
e0b9c88b | 90 | }, |
e661faa4 KK |
91 | }, |
92 | }; | |
93 | ||
94 | struct platform_device s5p6450_device_iis0 = { | |
d9a93c34 JB |
95 | .name = "samsung-i2s", |
96 | .id = 0, | |
e0b9c88b RS |
97 | .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource), |
98 | .resource = s5p64x0_i2s0_resource, | |
99 | .dev = { | |
100 | .platform_data = &s5p6450_i2s0_pdata, | |
101 | }, | |
102 | }; | |
103 | ||
104 | static struct s3c_audio_pdata s5p6450_i2s_pdata = { | |
105 | .cfg_gpio = s5p6450_cfg_i2s, | |
e0b9c88b RS |
106 | }; |
107 | ||
108 | static struct resource s5p6450_i2s1_resource[] = { | |
5e9cf656 TB |
109 | [0] = DEFINE_RES_MEM(S5P6450_PA_I2S1, SZ_256), |
110 | [1] = DEFINE_RES_DMA(DMACH_I2S1_TX), | |
111 | [2] = DEFINE_RES_DMA(DMACH_I2S1_RX), | |
e0b9c88b RS |
112 | }; |
113 | ||
114 | struct platform_device s5p6450_device_iis1 = { | |
115 | .name = "samsung-i2s", | |
116 | .id = 1, | |
117 | .num_resources = ARRAY_SIZE(s5p6450_i2s1_resource), | |
118 | .resource = s5p6450_i2s1_resource, | |
119 | .dev = { | |
120 | .platform_data = &s5p6450_i2s_pdata, | |
121 | }, | |
122 | }; | |
123 | ||
124 | static struct resource s5p6450_i2s2_resource[] = { | |
5e9cf656 TB |
125 | [0] = DEFINE_RES_MEM(S5P6450_PA_I2S2, SZ_256), |
126 | [1] = DEFINE_RES_DMA(DMACH_I2S2_TX), | |
127 | [2] = DEFINE_RES_DMA(DMACH_I2S2_RX), | |
e0b9c88b RS |
128 | }; |
129 | ||
130 | struct platform_device s5p6450_device_iis2 = { | |
131 | .name = "samsung-i2s", | |
132 | .id = 2, | |
133 | .num_resources = ARRAY_SIZE(s5p6450_i2s2_resource), | |
134 | .resource = s5p6450_i2s2_resource, | |
e661faa4 | 135 | .dev = { |
e0b9c88b | 136 | .platform_data = &s5p6450_i2s_pdata, |
e661faa4 KK |
137 | }, |
138 | }; | |
139 | ||
140 | /* PCM Controller platform_devices */ | |
141 | ||
142 | static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev) | |
143 | { | |
144 | switch (pdev->id) { | |
145 | case 0: | |
af94e577 BD |
146 | s3c_gpio_cfgpin_range(S5P6440_GPR(6), 3, S3C_GPIO_SFN(2)); |
147 | s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(2)); | |
e661faa4 KK |
148 | break; |
149 | ||
150 | default: | |
151 | printk(KERN_DEBUG "Invalid PCM Controller number!"); | |
152 | return -EINVAL; | |
153 | } | |
154 | ||
155 | return 0; | |
156 | } | |
157 | ||
158 | static struct s3c_audio_pdata s5p6440_pcm_pdata = { | |
159 | .cfg_gpio = s5p6440_pcm_cfg_gpio, | |
160 | }; | |
161 | ||
162 | static struct resource s5p6440_pcm0_resource[] = { | |
5e9cf656 TB |
163 | [0] = DEFINE_RES_MEM(S5P64X0_PA_PCM, SZ_256), |
164 | [1] = DEFINE_RES_DMA(DMACH_PCM0_TX), | |
165 | [2] = DEFINE_RES_DMA(DMACH_PCM0_RX), | |
e661faa4 KK |
166 | }; |
167 | ||
168 | struct platform_device s5p6440_device_pcm = { | |
169 | .name = "samsung-pcm", | |
170 | .id = 0, | |
171 | .num_resources = ARRAY_SIZE(s5p6440_pcm0_resource), | |
172 | .resource = s5p6440_pcm0_resource, | |
173 | .dev = { | |
174 | .platform_data = &s5p6440_pcm_pdata, | |
175 | }, | |
176 | }; |