diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2008-04-12 08:28:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 06:29:08 -0400 |
commit | 81447b2ee6a62cef884aa017e70bbe8c02f0d63b (patch) | |
tree | f54135121703e5a0175f7fa2fd2403529a3cd40e /arch/arm/mach-pxa/magician.c | |
parent | 5dc3339aa5ba29593ea57814049ddca8c12831c8 (diff) |
[ARM] 4965/1: magician: use htc-pasic3,leds-pasic3,ds1wm,leds-gpio
This patch enables LEDs and the 1-wire bus (connected to
a DS2760 battery monitor) on the magician.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/magician.c')
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 116 |
1 files changed, 113 insertions, 3 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 9e126a901137..06dad3552300 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/gpio_keys.h> | 20 | #include <linux/gpio_keys.h> |
21 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/mfd/htc-egpio.h> | 22 | #include <linux/mfd/htc-egpio.h> |
23 | #include <linux/mfd/htc-pasic3.h> | ||
23 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/map.h> | 25 | #include <linux/mtd/map.h> |
25 | #include <linux/mtd/physmap.h> | 26 | #include <linux/mtd/physmap.h> |
@@ -299,6 +300,107 @@ static struct platform_device backlight = { | |||
299 | .id = -1, | 300 | .id = -1, |
300 | }; | 301 | }; |
301 | 302 | ||
303 | /* | ||
304 | * LEDs | ||
305 | */ | ||
306 | |||
307 | struct gpio_led gpio_leds[] = { | ||
308 | { | ||
309 | .name = "magician::vibra", | ||
310 | .default_trigger = "none", | ||
311 | .gpio = GPIO22_MAGICIAN_VIBRA_EN, | ||
312 | }, | ||
313 | { | ||
314 | .name = "magician::phone_bl", | ||
315 | .default_trigger = "none", | ||
316 | .gpio = GPIO103_MAGICIAN_LED_KP, | ||
317 | }, | ||
318 | }; | ||
319 | |||
320 | static struct gpio_led_platform_data gpio_led_info = { | ||
321 | .leds = gpio_leds, | ||
322 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
323 | }; | ||
324 | |||
325 | static struct platform_device leds_gpio = { | ||
326 | .name = "leds-gpio", | ||
327 | .id = -1, | ||
328 | .dev = { | ||
329 | .platform_data = &gpio_led_info, | ||
330 | }, | ||
331 | }; | ||
332 | |||
333 | static struct pasic3_led pasic3_leds[] = { | ||
334 | { | ||
335 | .led = { | ||
336 | .name = "magician:red", | ||
337 | .default_trigger = "ds2760-battery.0-charging", | ||
338 | }, | ||
339 | .hw_num = 0, | ||
340 | .bit2 = PASIC3_BIT2_LED0, | ||
341 | .mask = PASIC3_MASK_LED0, | ||
342 | }, | ||
343 | { | ||
344 | .led = { | ||
345 | .name = "magician:green", | ||
346 | .default_trigger = "ds2760-battery.0-charging-or-full", | ||
347 | }, | ||
348 | .hw_num = 1, | ||
349 | .bit2 = PASIC3_BIT2_LED1, | ||
350 | .mask = PASIC3_MASK_LED1, | ||
351 | }, | ||
352 | { | ||
353 | .led = { | ||
354 | .name = "magician:blue", | ||
355 | .default_trigger = "bluetooth", | ||
356 | }, | ||
357 | .hw_num = 2, | ||
358 | .bit2 = PASIC3_BIT2_LED2, | ||
359 | .mask = PASIC3_MASK_LED2, | ||
360 | }, | ||
361 | }; | ||
362 | |||
363 | static struct platform_device pasic3; | ||
364 | |||
365 | static struct pasic3_leds_machinfo __devinit pasic3_leds_info = { | ||
366 | .num_leds = ARRAY_SIZE(pasic3_leds), | ||
367 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, | ||
368 | .leds = pasic3_leds, | ||
369 | }; | ||
370 | |||
371 | /* | ||
372 | * PASIC3 with DS1WM | ||
373 | */ | ||
374 | |||
375 | static struct resource pasic3_resources[] = { | ||
376 | [0] = { | ||
377 | .start = PXA_CS2_PHYS, | ||
378 | .end = PXA_CS2_PHYS + 0x1b, | ||
379 | .flags = IORESOURCE_MEM, | ||
380 | }, | ||
381 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ | ||
382 | [1] = { | ||
383 | .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), | ||
384 | .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), | ||
385 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
386 | } | ||
387 | }; | ||
388 | |||
389 | static struct pasic3_platform_data pasic3_platform_data = { | ||
390 | .bus_shift = 2, | ||
391 | .led_pdata = &pasic3_leds_info, | ||
392 | .clock_rate = 4000000, | ||
393 | }; | ||
394 | |||
395 | static struct platform_device pasic3 = { | ||
396 | .name = "pasic3", | ||
397 | .id = -1, | ||
398 | .num_resources = ARRAY_SIZE(pasic3_resources), | ||
399 | .resource = pasic3_resources, | ||
400 | .dev = { | ||
401 | .platform_data = &pasic3_platform_data, | ||
402 | }, | ||
403 | }; | ||
302 | 404 | ||
303 | /* | 405 | /* |
304 | * External power | 406 | * External power |
@@ -320,10 +422,16 @@ static void magician_set_charge(int flags) | |||
320 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); | 422 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); |
321 | } | 423 | } |
322 | 424 | ||
425 | static char *magician_supplicants[] = { | ||
426 | "ds2760-battery.0", "backup-battery" | ||
427 | }; | ||
428 | |||
323 | static struct pda_power_pdata power_supply_info = { | 429 | static struct pda_power_pdata power_supply_info = { |
324 | .is_ac_online = magician_is_ac_online, | 430 | .is_ac_online = magician_is_ac_online, |
325 | .is_usb_online = magician_is_usb_online, | 431 | .is_usb_online = magician_is_usb_online, |
326 | .set_charge = magician_set_charge, | 432 | .set_charge = magician_set_charge, |
433 | .supplied_to = magician_supplicants, | ||
434 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | ||
327 | }; | 435 | }; |
328 | 436 | ||
329 | static struct resource power_supply_resources[] = { | 437 | static struct resource power_supply_resources[] = { |
@@ -449,8 +557,10 @@ static struct platform_device *devices[] __initdata = { | |||
449 | &gpio_keys, | 557 | &gpio_keys, |
450 | &egpio, | 558 | &egpio, |
451 | &backlight, | 559 | &backlight, |
560 | &pasic3, | ||
452 | &power_supply, | 561 | &power_supply, |
453 | &strataflash, | 562 | &strataflash, |
563 | &leds_gpio, | ||
454 | }; | 564 | }; |
455 | 565 | ||
456 | static void __init magician_init(void) | 566 | static void __init magician_init(void) |