u-boot-mkimage-gta01-native: re-add till uboot-utils actually works
[openembedded.git] / packages / linux / linux-ezx-2.6.21 / patches / a780-leds.patch
1
2 #
3 # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
4 #
5
6 Index: linux-2.6.21/drivers/leds/Kconfig
7 ===================================================================
8 --- linux-2.6.21.orig/drivers/leds/Kconfig      2007-06-08 18:33:45.000000000 +0200
9 +++ linux-2.6.21/drivers/leds/Kconfig   2007-06-08 18:39:04.000000000 +0200
10 @@ -104,6 +104,13 @@
11           These triggers allow kernel events to drive the LEDs and can
12           be configured via sysfs. If unsure, say Y.
13  
14 +config LEDS_A780
15 +       tristate "LED Support for the Motorola A780 GSM Phone"
16 +       depends LEDS_CLASS && PXA_EZX_A780
17 +       help
18 +         This option enables support for the LEDs on the
19 +         Motorola A780 GSM Phone.
20 +
21  config LEDS_TRIGGER_TIMER
22         tristate "LED Timer Trigger"
23         depends on LEDS_TRIGGERS
24 Index: linux-2.6.21/drivers/leds/Makefile
25 ===================================================================
26 --- linux-2.6.21.orig/drivers/leds/Makefile     2007-06-08 18:33:45.000000000 +0200
27 +++ linux-2.6.21/drivers/leds/Makefile  2007-06-08 18:39:04.000000000 +0200
28 @@ -16,6 +16,7 @@
29  obj-$(CONFIG_LEDS_WRAP)                        += leds-wrap.o
30  obj-$(CONFIG_LEDS_H1940)               += leds-h1940.o
31  obj-$(CONFIG_LEDS_COBALT)              += leds-cobalt.o
32 +obj-$(CONFIG_LEDS_A780)                += leds-a780.o
33  
34  # LED Triggers
35  obj-$(CONFIG_LEDS_TRIGGER_TIMER)       += ledtrig-timer.o
36 Index: linux-2.6.21/drivers/leds/leds-a780.c
37 ===================================================================
38 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
39 +++ linux-2.6.21/drivers/leds/leds-a780.c       2007-06-08 18:39:04.000000000 +0200
40 @@ -0,0 +1,122 @@
41 +/*
42 + * EZX Platform LED Driver for the Motorola A780 GSM Phone
43 + *
44 + * Copyright 2006 Vanille-Media
45 + *
46 + * Author: Michael Lauer <mickey@Vanille.de>
47 + *
48 + * Based on keylight.c by Motorola and leds-corgi.c by Richard Purdie
49 + *
50 + * This program is free software; you can redistribute it and/or modify
51 + * it under the terms of the GNU General Public License version 2 as
52 + * published by the Free Software Foundation.
53 + *
54 + */
55 +
56 +#include <linux/kernel.h>
57 +#include <linux/platform_device.h>
58 +#include <linux/leds.h>
59 +#include <asm/arch/ezx-pcap.h>
60 +
61 +static void a780led_main_set(struct led_classdev *led_cdev, enum led_brightness value)
62 +{
63 +       if ( value > 31 ) value = 31;
64 +       printk( KERN_DEBUG "a780led_main_set: %d\n", value );
65 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL0, value & 0x01);
66 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL1, value & 0x02);
67 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL2, value & 0x04);
68 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL3, value & 0x08);
69 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL_CTRL4, value & 0x10);
70 +}
71 +
72 +static void a780led_aux_set(struct led_classdev *led_cdev, enum led_brightness value)
73 +{
74 +       if ( value > 31 ) value = 31;
75 +       printk( KERN_DEBUG "a780led_aux_set: %d\n", value );
76 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL0, value & 0x01);
77 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL1, value & 0x02);
78 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL2, value & 0x04);
79 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL3, value & 0x08);
80 +       ezx_pcap_bit_set(SSP_PCAP_ADJ_BIT_PERIPH_BL2_CTRL4, value & 0x10);
81 +}
82 +
83 +static struct led_classdev a780_main_led = {
84 +       .name                   = "a780:main",
85 +       .default_trigger        = "none",
86 +       .brightness_set         = a780led_main_set,
87 +};
88 +
89 +static struct led_classdev a780_aux_led = {
90 +       .name                   = "a780:aux",
91 +       .default_trigger        = "none",
92 +       .brightness_set         = a780led_aux_set,
93 +};
94 +
95 +#ifdef CONFIG_PM
96 +static int a780led_suspend(struct platform_device *dev, pm_message_t state)
97 +{
98 +       led_classdev_suspend(&a780_main_led);
99 +       led_classdev_suspend(&a780_aux_led);
100 +       return 0;
101 +}
102 +
103 +static int a780led_resume(struct platform_device *dev)
104 +{
105 +       led_classdev_resume(&a780_main_led);
106 +       led_classdev_resume(&a780_aux_led);
107 +       return 0;
108 +}
109 +#endif
110 +
111 +static int a780led_probe(struct platform_device *pdev)
112 +{
113 +       int ret;
114 +
115 +       ret = led_classdev_register(&pdev->dev, &a780_main_led);
116 +       if (ret < 0)
117 +               return ret;
118 +
119 +       ret = led_classdev_register(&pdev->dev, &a780_aux_led);
120 +       if (ret < 0)
121 +               led_classdev_unregister(&a780_main_led);
122 +
123 +       return ret;
124 +}
125 +
126 +static int a780led_remove(struct platform_device *pdev)
127 +{
128 +       led_classdev_unregister(&a780_main_led);
129 +       led_classdev_unregister(&a780_aux_led);
130 +       return 0;
131 +}
132 +
133 +static struct platform_driver a780led_driver = {
134 +       .probe          = a780led_probe,
135 +       .remove         = a780led_remove,
136 +#ifdef CONFIG_PM
137 +       .suspend        = a780led_suspend,
138 +       .resume         = a780led_resume,
139 +#endif
140 +       .driver         = {
141 +               .name           = "a780-led",
142 +       },
143 +};
144 +
145 +static int __init a780led_init(void)
146 +{
147 +       return platform_driver_register(&a780led_driver);
148 +}
149 +
150 +static void __exit a780led_exit(void)
151 +{
152 +       a780led_main_set( &a780_main_led, 0 );
153 +       a780led_aux_set( &a780_aux_led, 0 );
154 +       platform_driver_unregister(&a780led_driver);
155 +}
156 +
157 +module_init(a780led_init);
158 +module_exit(a780led_exit);
159 +
160 +MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
161 +MODULE_DESCRIPTION("Motorola A780 LED driver");
162 +MODULE_LICENSE("GPL");
163 Index: linux-2.6.21/arch/arm/mach-pxa/ezx-a780.c
164 ===================================================================
165 --- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-a780.c      2007-06-08 18:38:50.000000000 +0200
166 +++ linux-2.6.21/arch/arm/mach-pxa/ezx-a780.c   2007-06-08 18:39:04.000000000 +0200
167 @@ -236,10 +236,15 @@
168         },
169  };
170  
171 +static struct platform_device a780led_device = {
172 +       .name           = "a780-led",
173 +       .id             = -1,
174 +};
175  
176  static struct platform_device *devices[] __initdata = {
177         &pcap_ts_device,
178         &a780flip_device,
179 +       &a780led_device,
180  };
181  
182  static void __init a780_init(void)