aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s5pv210
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2010-07-14 06:39:47 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-08-05 05:31:00 -0400
commitba149f3acdbbf143d70a64275917a6297c2373ba (patch)
tree92776884c501faae65becefdaaa1ecf284e2d654 /arch/arm/mach-s5pv210
parenta1660c1205d0b82b238bf03001cd8d78874612b2 (diff)
ARM: S5PV210: Add MAX8998 PMIC support for GONI
This patch adds required platform definitions for MAX8998 PMIC driver. Power regulators for LDO and BUCK outputs has been defined as well as a simple gpio-keys button for power key (to enable wakeup functionality with external interrupt). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> [broonie@opensource.wolfsonmicro.com: For the regulator API usage] Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> [kgene.kim@samsung.com: minor title fix] Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s5pv210')
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c324
1 files changed, 324 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index bec488e5d23c..7b18505e5171 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -13,6 +13,12 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/serial_core.h> 14#include <linux/serial_core.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/i2c.h>
17#include <linux/i2c-gpio.h>
18#include <linux/mfd/max8998.h>
19#include <linux/gpio_keys.h>
20#include <linux/input.h>
21#include <linux/gpio.h>
16 22
17#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 24#include <asm/mach/map.h>
@@ -23,6 +29,7 @@
23#include <mach/regs-clock.h> 29#include <mach/regs-clock.h>
24#include <mach/regs-fb.h> 30#include <mach/regs-fb.h>
25 31
32#include <plat/gpio-cfg.h>
26#include <plat/regs-serial.h> 33#include <plat/regs-serial.h>
27#include <plat/s5pv210.h> 34#include <plat/s5pv210.h>
28#include <plat/devs.h> 35#include <plat/devs.h>
@@ -103,9 +110,322 @@ static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
103 .setup_gpio = s5pv210_fb_gpio_setup_24bpp, 110 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
104}; 111};
105 112
113/* MAX8998 regulators */
114#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
115
116static struct regulator_init_data goni_ldo2_data = {
117 .constraints = {
118 .name = "VALIVE_1.1V",
119 .min_uV = 1100000,
120 .max_uV = 1100000,
121 .apply_uV = 1,
122 .always_on = 1,
123 .state_mem = {
124 .enabled = 1,
125 },
126 },
127};
128
129static struct regulator_init_data goni_ldo3_data = {
130 .constraints = {
131 .name = "VUSB/MIPI_1.1V",
132 .min_uV = 1100000,
133 .max_uV = 1100000,
134 .apply_uV = 1,
135 .always_on = 1,
136 },
137};
138
139static struct regulator_init_data goni_ldo4_data = {
140 .constraints = {
141 .name = "VDAC_3.3V",
142 .min_uV = 3300000,
143 .max_uV = 3300000,
144 .apply_uV = 1,
145 },
146};
147
148static struct regulator_init_data goni_ldo5_data = {
149 .constraints = {
150 .name = "VTF_2.8V",
151 .min_uV = 2800000,
152 .max_uV = 2800000,
153 .apply_uV = 1,
154 },
155};
156
157static struct regulator_init_data goni_ldo6_data = {
158 .constraints = {
159 .name = "VCC_3.3V",
160 .min_uV = 3300000,
161 .max_uV = 3300000,
162 .apply_uV = 1,
163 },
164};
165
166static struct regulator_init_data goni_ldo7_data = {
167 .constraints = {
168 .name = "VLCD_1.8V",
169 .min_uV = 1800000,
170 .max_uV = 1800000,
171 .apply_uV = 1,
172 .always_on = 1,
173 },
174};
175
176static struct regulator_init_data goni_ldo8_data = {
177 .constraints = {
178 .name = "VUSB/VADC_3.3V",
179 .min_uV = 3300000,
180 .max_uV = 3300000,
181 .apply_uV = 1,
182 .always_on = 1,
183 },
184};
185
186static struct regulator_init_data goni_ldo9_data = {
187 .constraints = {
188 .name = "VCC/VCAM_2.8V",
189 .min_uV = 2800000,
190 .max_uV = 2800000,
191 .apply_uV = 1,
192 .always_on = 1,
193 },
194};
195
196static struct regulator_init_data goni_ldo10_data = {
197 .constraints = {
198 .name = "VPLL_1.1V",
199 .min_uV = 1100000,
200 .max_uV = 1100000,
201 .apply_uV = 1,
202 .boot_on = 1,
203 },
204};
205
206static struct regulator_init_data goni_ldo11_data = {
207 .constraints = {
208 .name = "CAM_IO_2.8V",
209 .min_uV = 2800000,
210 .max_uV = 2800000,
211 .apply_uV = 1,
212 .always_on = 1,
213 },
214};
215
216static struct regulator_init_data goni_ldo12_data = {
217 .constraints = {
218 .name = "CAM_ISP_1.2V",
219 .min_uV = 1200000,
220 .max_uV = 1200000,
221 .apply_uV = 1,
222 .always_on = 1,
223 },
224};
225
226static struct regulator_init_data goni_ldo13_data = {
227 .constraints = {
228 .name = "CAM_A_2.8V",
229 .min_uV = 2800000,
230 .max_uV = 2800000,
231 .apply_uV = 1,
232 .always_on = 1,
233 },
234};
235
236static struct regulator_init_data goni_ldo14_data = {
237 .constraints = {
238 .name = "CAM_CIF_1.8V",
239 .min_uV = 1800000,
240 .max_uV = 1800000,
241 .apply_uV = 1,
242 .always_on = 1,
243 },
244};
245
246static struct regulator_init_data goni_ldo15_data = {
247 .constraints = {
248 .name = "CAM_AF_3.3V",
249 .min_uV = 3300000,
250 .max_uV = 3300000,
251 .apply_uV = 1,
252 .always_on = 1,
253 },
254};
255
256static struct regulator_init_data goni_ldo16_data = {
257 .constraints = {
258 .name = "VMIPI_1.8V",
259 .min_uV = 1800000,
260 .max_uV = 1800000,
261 .apply_uV = 1,
262 .always_on = 1,
263 },
264};
265
266static struct regulator_init_data goni_ldo17_data = {
267 .constraints = {
268 .name = "VCC_3.0V_LCD",
269 .min_uV = 3000000,
270 .max_uV = 3000000,
271 .apply_uV = 1,
272 .always_on = 1,
273 },
274};
275
276/* BUCK */
277static struct regulator_consumer_supply buck1_consumer[] = {
278 { .supply = "vddarm", },
279};
280
281static struct regulator_consumer_supply buck2_consumer[] = {
282 { .supply = "vddint", },
283};
284
285static struct regulator_init_data goni_buck1_data = {
286 .constraints = {
287 .name = "VARM_1.2V",
288 .min_uV = 1200000,
289 .max_uV = 1200000,
290 .apply_uV = 1,
291 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
292 REGULATOR_CHANGE_STATUS,
293 },
294 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
295 .consumer_supplies = buck1_consumer,
296};
297
298static struct regulator_init_data goni_buck2_data = {
299 .constraints = {
300 .name = "VINT_1.2V",
301 .min_uV = 1200000,
302 .max_uV = 1200000,
303 .apply_uV = 1,
304 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
305 REGULATOR_CHANGE_STATUS,
306 },
307 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
308 .consumer_supplies = buck2_consumer,
309};
310
311static struct regulator_init_data goni_buck3_data = {
312 .constraints = {
313 .name = "VCC_1.8V",
314 .min_uV = 1800000,
315 .max_uV = 1800000,
316 .apply_uV = 1,
317 .state_mem = {
318 .enabled = 1,
319 },
320 },
321};
322
323static struct regulator_init_data goni_buck4_data = {
324 .constraints = {
325 .name = "CAM_CORE_1.2V",
326 .min_uV = 1200000,
327 .max_uV = 1200000,
328 .apply_uV = 1,
329 .always_on = 1,
330 },
331};
332
333static struct max8998_regulator_data goni_regulators[] = {
334 { MAX8998_LDO2, &goni_ldo2_data },
335 { MAX8998_LDO3, &goni_ldo3_data },
336 { MAX8998_LDO4, &goni_ldo4_data },
337 { MAX8998_LDO5, &goni_ldo5_data },
338 { MAX8998_LDO6, &goni_ldo6_data },
339 { MAX8998_LDO7, &goni_ldo7_data },
340 { MAX8998_LDO8, &goni_ldo8_data },
341 { MAX8998_LDO9, &goni_ldo9_data },
342 { MAX8998_LDO10, &goni_ldo10_data },
343 { MAX8998_LDO11, &goni_ldo11_data },
344 { MAX8998_LDO12, &goni_ldo12_data },
345 { MAX8998_LDO13, &goni_ldo13_data },
346 { MAX8998_LDO14, &goni_ldo14_data },
347 { MAX8998_LDO15, &goni_ldo15_data },
348 { MAX8998_LDO16, &goni_ldo16_data },
349 { MAX8998_LDO17, &goni_ldo17_data },
350 { MAX8998_BUCK1, &goni_buck1_data },
351 { MAX8998_BUCK2, &goni_buck2_data },
352 { MAX8998_BUCK3, &goni_buck3_data },
353 { MAX8998_BUCK4, &goni_buck4_data },
354};
355
356static struct max8998_platform_data goni_max8998_pdata = {
357 .num_regulators = ARRAY_SIZE(goni_regulators),
358 .regulators = goni_regulators,
359};
360#endif
361
362/* GPIO I2C PMIC */
363#define AP_I2C_GPIO_PMIC_BUS_4 4
364static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
365 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
366 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
367};
368
369static struct platform_device goni_i2c_gpio_pmic = {
370 .name = "i2c-gpio",
371 .id = AP_I2C_GPIO_PMIC_BUS_4,
372 .dev = {
373 .platform_data = &goni_i2c_gpio_pmic_data,
374 },
375};
376
377static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
378#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
379 {
380 /* 0xCC when SRAD = 0 */
381 I2C_BOARD_INFO("max8998", 0xCC >> 1),
382 .platform_data = &goni_max8998_pdata,
383 },
384#endif
385};
386
387/* PMIC Power button */
388static struct gpio_keys_button goni_gpio_keys_table[] = {
389 {
390 .code = KEY_POWER,
391 .gpio = S5PV210_GPH2(6),
392 .desc = "gpio-keys: KEY_POWER",
393 .type = EV_KEY,
394 .active_low = 1,
395 .wakeup = 1,
396 .debounce_interval = 1,
397 },
398};
399
400static struct gpio_keys_platform_data goni_gpio_keys_data = {
401 .buttons = goni_gpio_keys_table,
402 .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
403};
404
405static struct platform_device goni_device_gpiokeys = {
406 .name = "gpio-keys",
407 .dev = {
408 .platform_data = &goni_gpio_keys_data,
409 },
410};
411
412static void __init goni_pmic_init(void)
413{
414 /* AP_PMIC_IRQ: EINT7 */
415 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
416 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
417
418 /* nPower: EINT22 */
419 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
420 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
421}
422
423
106static struct platform_device *goni_devices[] __initdata = { 424static struct platform_device *goni_devices[] __initdata = {
107 &s3c_device_fb, 425 &s3c_device_fb,
108 &s5pc110_device_onenand, 426 &s5pc110_device_onenand,
427 &goni_i2c_gpio_pmic,
428 &goni_device_gpiokeys,
109}; 429};
110 430
111static void __init goni_map_io(void) 431static void __init goni_map_io(void)
@@ -117,6 +437,10 @@ static void __init goni_map_io(void)
117 437
118static void __init goni_machine_init(void) 438static void __init goni_machine_init(void)
119{ 439{
440 /* PMIC */
441 goni_pmic_init();
442 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
443 ARRAY_SIZE(i2c_gpio_pmic_devs));
120 /* FB */ 444 /* FB */
121 s3c_fb_set_platdata(&goni_lcd_pdata); 445 s3c_fb_set_platdata(&goni_lcd_pdata);
122 446