]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/linux-2.6.24-leds-alix.patch
Fix core38 updater replace openvpn config.
[people/pmueller/ipfire-2.x.git] / src / patches / linux-2.6.24-leds-alix.patch
1 diff -Nur linux-2.6.24.old/drivers/leds/Kconfig linux-2.6.24/drivers/leds/Kconfig
2 --- linux-2.6.24.old/drivers/leds/Kconfig 2008-01-24 23:58:37.000000000 +0100
3 +++ linux-2.6.24/drivers/leds/Kconfig 2008-05-24 09:32:18.000000000 +0200
4 @@ -81,6 +81,12 @@
5 help
6 This option enables support for the PCEngines WRAP programmable LEDs.
7
8 +config LEDS_ALIX
9 + tristate "LED Support for the ALIX 2/3 boards"
10 + depends on LEDS_CLASS
11 + help
12 + This option enables support for the three LEDs on the PCEngines ALIX 2/3 boards.
13 +
14 config LEDS_H1940
15 tristate "LED Support for iPAQ H1940 device"
16 depends on LEDS_CLASS && ARCH_H1940
17 diff -Nur linux-2.6.24.old/drivers/leds/leds-alix.c linux-2.6.24/drivers/leds/leds-alix.c
18 --- linux-2.6.24.old/drivers/leds/leds-alix.c 1970-01-01 01:00:00.000000000 +0100
19 +++ linux-2.6.24/drivers/leds/leds-alix.c 2008-05-24 09:32:18.000000000 +0200
20 @@ -0,0 +1,172 @@
21 +/*
22 + * LEDs driver for PCEngines ALIX 2/3 series
23 + *
24 + * Copyright (C) 2007 Petr Liebman
25 + *
26 + * Based on leds-wrap.c
27 + *
28 + * This program is free software; you can redistribute it and/or modify
29 + * it under the terms of the GNU General Public License version 2 as
30 + * published by the Free Software Foundation.
31 + */
32 +
33 +#include <linux/kernel.h>
34 +#include <linux/init.h>
35 +#include <linux/platform_device.h>
36 +#include <linux/leds.h>
37 +#include <linux/err.h>
38 +#include <asm/io.h>
39 +
40 +#define DRVNAME "alix-led"
41 +
42 +#define ALIX_LED1_PORT (0x6100)
43 +#define ALIX_LED1_ON (1<<22)
44 +#define ALIX_LED1_OFF (1<<6)
45 +
46 +#define ALIX_LED2_PORT (0x6180)
47 +#define ALIX_LED2_ON (1<<25)
48 +#define ALIX_LED2_OFF (1<<9)
49 +
50 +#define ALIX_LED3_PORT (0x6180)
51 +#define ALIX_LED3_ON (1<<27)
52 +#define ALIX_LED3_OFF (1<<11)
53 +
54 +
55 +static struct platform_device *pdev;
56 +
57 +static void alix_led_set_1(struct led_classdev *led_cdev,
58 + enum led_brightness value)
59 +{
60 + if (value)
61 + outl(ALIX_LED1_ON, ALIX_LED1_PORT);
62 + else
63 + outl(ALIX_LED1_OFF, ALIX_LED1_PORT);
64 +}
65 +
66 +static void alix_led_set_2(struct led_classdev *led_cdev,
67 + enum led_brightness value)
68 +{
69 + if (value)
70 + outl(ALIX_LED2_ON, ALIX_LED2_PORT);
71 + else
72 + outl(ALIX_LED2_OFF, ALIX_LED2_PORT);
73 +}
74 +
75 +static void alix_led_set_3(struct led_classdev *led_cdev,
76 + enum led_brightness value)
77 +{
78 + if (value)
79 + outl(ALIX_LED3_ON, ALIX_LED3_PORT);
80 + else
81 + outl(ALIX_LED3_OFF, ALIX_LED3_PORT);
82 +}
83 +
84 +static struct led_classdev alix_led_1 = {
85 + .name = "alix:1",
86 + .brightness_set = alix_led_set_1,
87 +};
88 +
89 +static struct led_classdev alix_led_2 = {
90 + .name = "alix:2",
91 + .brightness_set = alix_led_set_2,
92 +};
93 +
94 +static struct led_classdev alix_led_3 = {
95 + .name = "alix:3",
96 + .brightness_set = alix_led_set_3,
97 +};
98 +
99 +
100 +#ifdef CONFIG_PM
101 +static int alix_led_suspend(struct platform_device *dev,
102 + pm_message_t state)
103 +{
104 + led_classdev_suspend(&alix_led_1);
105 + led_classdev_suspend(&alix_led_2);
106 + led_classdev_suspend(&alix_led_3);
107 + return 0;
108 +}
109 +
110 +static int alix_led_resume(struct platform_device *dev)
111 +{
112 + led_classdev_resume(&alix_led_1);
113 + led_classdev_resume(&alix_led_2);
114 + led_classdev_resume(&alix_led_3);
115 + return 0;
116 +}
117 +#else
118 +#define alix_led_suspend NULL
119 +#define alix_led_resume NULL
120 +#endif
121 +
122 +static int alix_led_probe(struct platform_device *pdev)
123 +{
124 + int ret;
125 +
126 + ret = led_classdev_register(&pdev->dev, &alix_led_1);
127 + if (ret >= 0)
128 + {
129 + ret = led_classdev_register(&pdev->dev, &alix_led_2);
130 + if (ret >= 0)
131 + {
132 + ret = led_classdev_register(&pdev->dev, &alix_led_3);
133 + if (ret < 0)
134 + led_classdev_unregister(&alix_led_2);
135 + }
136 + if (ret < 0)
137 + led_classdev_unregister(&alix_led_1);
138 + }
139 + return ret;
140 +}
141 +
142 +static int alix_led_remove(struct platform_device *pdev)
143 +{
144 + led_classdev_unregister(&alix_led_1);
145 + led_classdev_unregister(&alix_led_2);
146 + led_classdev_unregister(&alix_led_3);
147 + return 0;
148 +}
149 +
150 +static struct platform_driver alix_led_driver = {
151 + .probe = alix_led_probe,
152 + .remove = alix_led_remove,
153 + .suspend = alix_led_suspend,
154 + .resume = alix_led_resume,
155 + .driver = {
156 + .name = DRVNAME,
157 + .owner = THIS_MODULE,
158 + },
159 +};
160 +
161 +static int __init alix_led_init(void)
162 +{
163 + int ret;
164 +
165 + ret = platform_driver_register(&alix_led_driver);
166 + if (ret < 0)
167 + goto out;
168 +
169 + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
170 + if (IS_ERR(pdev)) {
171 + ret = PTR_ERR(pdev);
172 + platform_driver_unregister(&alix_led_driver);
173 + goto out;
174 + }
175 +
176 +out:
177 + return ret;
178 +}
179 +
180 +static void __exit alix_led_exit(void)
181 +{
182 + platform_device_unregister(pdev);
183 + platform_driver_unregister(&alix_led_driver);
184 +}
185 +
186 +module_init(alix_led_init);
187 +module_exit(alix_led_exit);
188 +
189 +MODULE_AUTHOR("Petr Liebman");
190 +MODULE_DESCRIPTION("PCEngines ALIX LED driver");
191 +MODULE_LICENSE("GPL");
192 +
193 diff -Nur linux-2.6.24.old/drivers/leds/Makefile linux-2.6.24/drivers/leds/Makefile
194 --- linux-2.6.24.old/drivers/leds/Makefile 2008-01-24 23:58:37.000000000 +0100
195 +++ linux-2.6.24/drivers/leds/Makefile 2008-05-24 08:34:40.000000000 +0200
196 @@ -14,6 +14,7 @@
197 obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
198 obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
199 obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
200 +obj-$(CONFIG_LEDS_ALIX) += leds-alix.o
201 obj-$(CONFIG_LEDS_H1940) += leds-h1940.o
202 obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o
203 obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o