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 | |
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')
-rw-r--r-- | arch/arm/configs/magician_defconfig | 23 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 116 |
2 files changed, 132 insertions, 7 deletions
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 69ac0e4f1fe8..4d11678584db 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.24-rc6 | 3 | # Linux kernel version: 2.6.24-rc6 |
4 | # Sat Dec 22 10:38:43 2007 | 4 | # Sun Dec 30 13:02:54 2007 |
5 | # | 5 | # |
6 | CONFIG_ARM=y | 6 | CONFIG_ARM=y |
7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y | 7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y |
@@ -694,12 +694,26 @@ CONFIG_I2C_PXA=m | |||
694 | # | 694 | # |
695 | # CONFIG_SPI is not set | 695 | # CONFIG_SPI is not set |
696 | # CONFIG_SPI_MASTER is not set | 696 | # CONFIG_SPI_MASTER is not set |
697 | # CONFIG_W1 is not set | 697 | CONFIG_W1=y |
698 | |||
699 | # | ||
700 | # 1-wire Bus Masters | ||
701 | # | ||
702 | # CONFIG_W1_MASTER_DS2482 is not set | ||
703 | CONFIG_W1_MASTER_DS1WM=y | ||
704 | |||
705 | # | ||
706 | # 1-wire Slaves | ||
707 | # | ||
708 | # CONFIG_W1_SLAVE_THERM is not set | ||
709 | # CONFIG_W1_SLAVE_SMEM is not set | ||
710 | # CONFIG_W1_SLAVE_DS2433 is not set | ||
711 | CONFIG_W1_SLAVE_DS2760=y | ||
698 | CONFIG_POWER_SUPPLY=y | 712 | CONFIG_POWER_SUPPLY=y |
699 | # CONFIG_POWER_SUPPLY_DEBUG is not set | 713 | # CONFIG_POWER_SUPPLY_DEBUG is not set |
700 | CONFIG_PDA_POWER=y | 714 | CONFIG_PDA_POWER=y |
701 | # CONFIG_APM_POWER is not set | 715 | # CONFIG_APM_POWER is not set |
702 | # CONFIG_BATTERY_DS2760 is not set | 716 | CONFIG_BATTERY_DS2760=y |
703 | # CONFIG_HWMON is not set | 717 | # CONFIG_HWMON is not set |
704 | # CONFIG_WATCHDOG is not set | 718 | # CONFIG_WATCHDOG is not set |
705 | 719 | ||
@@ -714,6 +728,7 @@ CONFIG_SSB_POSSIBLE=y | |||
714 | # | 728 | # |
715 | # CONFIG_MFD_SM501 is not set | 729 | # CONFIG_MFD_SM501 is not set |
716 | CONFIG_HTC_EGPIO=y | 730 | CONFIG_HTC_EGPIO=y |
731 | CONFIG_HTC_PASIC3=y | ||
717 | 732 | ||
718 | # | 733 | # |
719 | # Multimedia devices | 734 | # Multimedia devices |
@@ -855,7 +870,7 @@ CONFIG_SDIO_UART=m | |||
855 | # MMC/SD Host Controller Drivers | 870 | # MMC/SD Host Controller Drivers |
856 | # | 871 | # |
857 | CONFIG_MMC_PXA=y | 872 | CONFIG_MMC_PXA=y |
858 | # CONFIG_NEW_LEDS is not set | 873 | CONFIG_NEW_LEDS=y |
859 | CONFIG_RTC_LIB=y | 874 | CONFIG_RTC_LIB=y |
860 | CONFIG_RTC_CLASS=y | 875 | CONFIG_RTC_CLASS=y |
861 | CONFIG_RTC_HCTOSYS=y | 876 | CONFIG_RTC_HCTOSYS=y |
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) |