Index: linux-2.6.25.4/drivers/leds/Kconfig =================================================================== --- linux-2.6.25.4.orig/drivers/leds/Kconfig +++ linux-2.6.25.4/drivers/leds/Kconfig @@ -168,6 +168,13 @@ This options enables support for the LEDs on the Motorola E680(i) GSM Phone. +config LEDS_A910 + tristate "LED Support for the Motorola A910 GSM Phone" + depends on LEDS_CLASS && PXA_EZX_A910 + help + This option enables support for the LEDs on the + Motorola A910 GSM Phone. + config LEDS_TRIGGER_TIMER tristate "LED Timer Trigger" depends on LEDS_TRIGGERS Index: linux-2.6.25.4/drivers/leds/Makefile =================================================================== --- linux-2.6.25.4.orig/drivers/leds/Makefile +++ linux-2.6.25.4/drivers/leds/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o obj-$(CONFIG_LEDS_A780) += leds-a780.o obj-$(CONFIG_LEDS_E680) += leds-e680.o +obj-$(CONFIG_LEDS_A910) += leds-a910.o # LED Triggers obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o Index: linux-2.6.25.4/drivers/leds/leds-a910.c =================================================================== --- /dev/null +++ linux-2.6.25.4/drivers/leds/leds-a910.c @@ -0,0 +1,97 @@ +/* + * EZX Platform LED Driver for the Motorola a910 GSM Phone + * + * Copyright 2006 Vanille-Media + * + * Author: Michael Lauer + * + * Based on keylight.c by Motorola and leds-corgi.c by Richard Purdie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include + +static void a910led_keypad_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + value = ( value != 0 ); + printk( KERN_DEBUG "a910led_keypad_set: %d\n", value ); + ezx_pcap_bit_set(PCAP_BIT_AUXVREG_VAUX4_EN, value); +} + +static struct led_classdev a910_keypad_led = { + .name = "a910:keypad", + .default_trigger = "none", + .brightness_set = a910led_keypad_set, +}; + +#ifdef CONFIG_PM +static int a910led_suspend(struct platform_device *dev, pm_message_t state) +{ + led_classdev_suspend(&a910_keypad_led); + return 0; +} + +static int a910led_resume(struct platform_device *dev) +{ + led_classdev_resume(&a910_keypad_led); + return 0; +} +#endif + +static int a910led_probe(struct platform_device *pdev) +{ + int ret; + + ret = led_classdev_register(&pdev->dev, &a910_keypad_led); + if (ret < 0) + return ret; + + return ret; +} + +static int a910led_remove(struct platform_device *pdev) +{ + led_classdev_unregister(&a910_keypad_led); + return 0; +} + +static struct platform_driver a910led_driver = { + .probe = a910led_probe, + .remove = a910led_remove, +#ifdef CONFIG_PM + .suspend = a910led_suspend, + .resume = a910led_resume, +#endif + .driver = { + .name = "a910-led", + }, +}; + +static int __init a910led_init(void) +{ + /* Because MBM turns the led on at boot! */ + a910led_keypad_set( &a910_keypad_led, 0 ); + + return platform_driver_register(&a910led_driver); +} + +static void __exit a910led_exit(void) +{ + a910led_keypad_set( &a910_keypad_led, 0 ); + platform_driver_unregister(&a910led_driver); +} + +module_init(a910led_init); +module_exit(a910led_exit); + +MODULE_AUTHOR("Michael Lauer "); +MODULE_DESCRIPTION("Motorola A910 LED driver"); +MODULE_LICENSE("GPL"); Index: linux-2.6.25.4/arch/arm/mach-pxa/ezx-a910.c =================================================================== --- linux-2.6.25.4.orig/arch/arm/mach-pxa/ezx-a910.c +++ linux-2.6.25.4/arch/arm/mach-pxa/ezx-a910.c @@ -344,10 +344,19 @@ }, }; +static struct platform_device a910led_device = { + .name = "a910-led", + .id = -1, + .dev = { + .parent = &a910_pcap_device.dev, + }, +}; + static struct platform_device *devices[] __initdata = { &a910_pcap_device, &a910_eoc_device, &a910flip_device, + &a910led_device, }; static void __init a910_init(void)