# # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher # --- linux-2.6.16/drivers/leds/Kconfig~a780-leds-r0.patch 2006-06-05 18:05:32.000000000 +0200 +++ linux-2.6.16/drivers/leds/Kconfig 2006-06-05 18:05:32.000000000 +0200 @@ -66,6 +66,13 @@ This options enables support for the LEDs on the Motorola E680(i) GSM Phone. +config LEDS_A780 + tristate "LED Support for the Motorola A780 GSM Phone" + depends LEDS_CLASS && PXA_EZX_A780 + help + This option enables support for the LEDs on the + Motorola A780 GSM Phone. + config LEDS_TRIGGER_TIMER tristate "LED Timer Trigger" depends LEDS_TRIGGERS --- linux-2.6.16/drivers/leds/Makefile~a780-leds-r0.patch 2006-06-05 18:05:32.000000000 +0200 +++ linux-2.6.16/drivers/leds/Makefile 2006-06-05 18:05:32.000000000 +0200 @@ -11,6 +11,7 @@ obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o obj-$(CONFIG_LEDS_E680) += leds-e680.o +obj-$(CONFIG_LEDS_A780) += leds-a780.o # LED Triggers obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o --- linux-2.6.16/arch/arm/mach-pxa/ezx.c~a780-leds-r0.patch 2006-06-05 18:05:32.000000000 +0200 +++ linux-2.6.16/arch/arm/mach-pxa/ezx.c 2006-06-05 18:05:32.000000000 +0200 @@ -367,6 +367,15 @@ }; #endif +#ifdef CONFIG_PXA_EZX_A780 +/* + * A780 LEDs + */ +static struct platform_device a780led_device = { + .name = "a780-led", + .id = -1, +}; +#endif /* keyboard */ @@ -780,6 +789,9 @@ #ifdef CONFIG_PXA_EZX_E680 &e680led_device, #endif +#ifdef CONFIG_PXA_EZX_A780 + &a780led_device, +#endif }; static void __init --- /dev/null 2006-06-05 13:59:28.329930680 +0200 +++ linux-2.6.16/drivers/leds/leds-a780.c 2006-06-05 18:27:13.000000000 +0200 @@ -0,0 +1,123 @@ +/* + * EZX Platform LED Driver for the Motorola A780 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 +#include + +static void a780led_main_set(struct led_classdev *led_cdev, enum led_brightness value) +{ + if ( value > 31 ) value = 31; + printk( KERN_DEBUG "a780led_main_set: %d\n", value ); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL0, value & 0x01); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL1, value & 0x02); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL2, value & 0x04); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL3, value & 0x08); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL4, value & 0x10); +} + +static void a780led_aux_set(struct led_classdev *led_cdev, enum led_brightness value) +{ + if ( value > 31 ) value = 31; + printk( KERN_DEBUG "a780led_aux_set: %d\n", value ); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL0, value & 0x01); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL1, value & 0x02); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL2, value & 0x04); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL3, value & 0x08); + ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL4, value & 0x10); +} + +static struct led_classdev a780_main_led = { + .name = "a780:main", + .default_trigger = "none", + .brightness_set = a780led_main_set, +}; + +static struct led_classdev a780_aux_led = { + .name = "a780:aux", + .default_trigger = "none", + .brightness_set = a780led_aux_set, +}; + +#ifdef CONFIG_PM +static int a780led_suspend(struct platform_device *dev, pm_message_t state) +{ + led_classdev_suspend(&a780_main_led); + led_classdev_suspend(&a780_aux_led); + return 0; +} + +static int a780led_resume(struct platform_device *dev) +{ + led_classdev_resume(&a780_main_led); + led_classdev_resume(&a780_aux_led); + return 0; +} +#endif + +static int a780led_probe(struct platform_device *pdev) +{ + int ret; + + ret = led_classdev_register(&pdev->dev, &a780_main_led); + if (ret < 0) + return ret; + + ret = led_classdev_register(&pdev->dev, &a780_aux_led); + if (ret < 0) + led_classdev_unregister(&a780_main_led); + + return ret; +} + +static int a780led_remove(struct platform_device *pdev) +{ + led_classdev_unregister(&a780_main_led); + led_classdev_unregister(&a780_aux_led); + return 0; +} + +static struct platform_driver a780led_driver = { + .probe = a780led_probe, + .remove = a780led_remove, +#ifdef CONFIG_PM + .suspend = a780led_suspend, + .resume = a780led_resume, +#endif + .driver = { + .name = "a780-led", + }, +}; + +static int __init a780led_init(void) +{ + return platform_driver_register(&a780led_driver); +} + +static void __exit a780led_exit(void) +{ + a780led_main_set( &a780_main_led, 0 ); + a780led_aux_set( &a780_aux_led, 0 ); + platform_driver_unregister(&a780led_driver); +} + +module_init(a780led_init); +module_exit(a780led_exit); + +MODULE_AUTHOR("Michael Lauer "); +MODULE_DESCRIPTION("Motorola A780 LED driver"); +MODULE_LICENSE("GPL");