]>
Commit | Line | Data |
---|---|---|
545c15b0 AF |
1 | diff -Naur linux-3.14.65.org/arch/x86/Kconfig linux-3.14.65/arch/x86/Kconfig |
2 | --- linux-3.14.65.org/arch/x86/Kconfig 2016-03-16 16:42:30.000000000 +0100 | |
3 | +++ linux-3.14.65/arch/x86/Kconfig 2016-03-25 14:36:22.953256019 +0100 | |
4d4f36ef | 4 | @@ -2287,6 +2287,7 @@ |
e583643a AF |
5 | - AC adapter status updates |
6 | - Battery status updates | |
7 | ||
4d4f36ef AF |
8 | + |
9 | config ALIX | |
10 | bool "PCEngines ALIX System Support (LED setup)" | |
11 | select GPIOLIB | |
545c15b0 | 12 | @@ -2325,6 +2326,18 @@ |
4d4f36ef AF |
13 | |
14 | endif # X86_32 | |
15 | ||
e583643a AF |
16 | +config APULED |
17 | + bool "PCEngines APU Led Support" | |
18 | + depends on DMI | |
19 | + ---help--- | |
545c15b0 AF |
20 | + This option enables system support for the PCEngines APU1. |
21 | + | |
22 | +config APU2LED | |
23 | + bool "PCEngines APU2 Led Support" | |
24 | + depends on DMI | |
25 | + ---help--- | |
26 | + This option enables system support for the PCEngines APU2. | |
e583643a | 27 | + |
4d4f36ef AF |
28 | config AMD_NB |
29 | def_bool y | |
30 | depends on CPU_SUP_AMD && PCI | |
545c15b0 AF |
31 | diff -Naur linux-3.14.65.org/arch/x86/platform/apu/apu2-led.c linux-3.14.65/arch/x86/platform/apu/apu2-led.c |
32 | --- linux-3.14.65.org/arch/x86/platform/apu/apu2-led.c 1970-01-01 01:00:00.000000000 +0100 | |
33 | +++ linux-3.14.65/arch/x86/platform/apu/apu2-led.c 2016-03-25 15:04:34.476689422 +0100 | |
34 | @@ -0,0 +1,180 @@ | |
35 | +/* | |
36 | + * LEDs driver for PCEngines apu2 | |
37 | + * | |
38 | + * this basic driver only set the output, configuration | |
39 | + * has already done by bios/coreboot. | |
40 | + * suspend/resume was not tested because IPFire not use it. | |
41 | + * | |
42 | + * Copyright (C) 2016 Arne Fitzenreiter <arne_f@ipfire.org> , | |
43 | + * based on Christian Herzog's apu_led. | |
44 | + * | |
45 | + * This program is free software; you can redistribute it and/or modify | |
46 | + * it under the terms of the GNU General Public License version 2 as | |
47 | + * published by the Free Software Foundation. | |
48 | + */ | |
49 | + | |
50 | +#include <linux/kernel.h> | |
51 | +#include <linux/module.h> | |
52 | +#include <linux/init.h> | |
53 | +#include <linux/platform_device.h> | |
54 | +#include <linux/leds.h> | |
55 | +#include <linux/err.h> | |
56 | +#include <asm/io.h> | |
57 | +#include <linux/dmi.h> | |
58 | + | |
59 | +#define DRVNAME "apu2-led" | |
60 | +#define BASEADDR (0xFED81610) | |
61 | + | |
62 | +static struct platform_device *pdev; | |
63 | +unsigned int *apu2_led_p1; | |
64 | +unsigned int *apu2_led_p2; | |
65 | +unsigned int *apu2_led_p3; | |
66 | + | |
67 | +static void apu2_led_set_1(struct led_classdev *led_cdev, | |
68 | + enum led_brightness value) { | |
69 | + if (value) | |
70 | + iowrite32((ioread32(apu2_led_p1)&~BIT(22)), apu2_led_p1); | |
71 | + else | |
72 | + iowrite32((ioread32(apu2_led_p1)|BIT(22)), apu2_led_p1); | |
73 | +} | |
74 | + | |
75 | +static void apu2_led_set_2(struct led_classdev *led_cdev, | |
76 | + enum led_brightness value) { | |
77 | + if (value) | |
78 | + iowrite32((ioread32(apu2_led_p2)&~BIT(22)), apu2_led_p2); | |
79 | + else | |
80 | + iowrite32((ioread32(apu2_led_p2)|BIT(22)), apu2_led_p2); | |
81 | +} | |
82 | + | |
83 | +static void apu2_led_set_3(struct led_classdev *led_cdev, | |
84 | + enum led_brightness value) { | |
85 | + if (value) | |
86 | + iowrite32((ioread32(apu2_led_p3)&~BIT(22)), apu2_led_p3); | |
87 | + else | |
88 | + iowrite32((ioread32(apu2_led_p3)|BIT(22)), apu2_led_p3); | |
89 | +} | |
90 | + | |
91 | +static struct led_classdev apu2_led_1 = { | |
92 | + .name = "apu:1", | |
93 | + .brightness_set = apu2_led_set_1, | |
94 | +}; | |
95 | + | |
96 | +static struct led_classdev apu2_led_2 = { | |
97 | + .name = "apu:2", | |
98 | + .brightness_set = apu2_led_set_2, | |
99 | +}; | |
100 | + | |
101 | +static struct led_classdev apu2_led_3 = { | |
102 | + .name = "apu:3", | |
103 | + .brightness_set = apu2_led_set_3, | |
104 | +}; | |
105 | + | |
106 | + | |
107 | +#ifdef CONFIG_PM | |
108 | +static int apu2_led_suspend(struct platform_device *dev, | |
109 | + pm_message_t state) | |
110 | +{ | |
111 | + led_classdev_suspend(&apu2_led_1); | |
112 | + led_classdev_suspend(&apu2_led_2); | |
113 | + led_classdev_suspend(&apu2_led_3); | |
114 | + return 0; | |
115 | +} | |
116 | + | |
117 | +static int apu2_led_resume(struct platform_device *dev) | |
118 | +{ | |
119 | + led_classdev_resume(&apu2_led_1); | |
120 | + led_classdev_resume(&apu2_led_2); | |
121 | + led_classdev_resume(&apu2_led_3); | |
122 | + return 0; | |
123 | +} | |
124 | +#else | |
125 | +#define apu2_led_suspend NULL | |
126 | +#define apu2_led_resume NULL | |
127 | +#endif | |
128 | + | |
129 | +static int apu2_led_probe(struct platform_device *pdev) | |
130 | +{ | |
131 | + int ret; | |
132 | + | |
133 | + ret = led_classdev_register(&pdev->dev, &apu2_led_1); | |
134 | + if (ret == 0) | |
135 | + { | |
136 | + ret = led_classdev_register(&pdev->dev, &apu2_led_2); | |
137 | + if (ret >= 0) | |
138 | + { | |
139 | + ret = led_classdev_register(&pdev->dev, &apu2_led_3); | |
140 | + if (ret < 0) | |
141 | + led_classdev_unregister(&apu2_led_2); | |
142 | + } | |
143 | + if (ret < 0) | |
144 | + led_classdev_unregister(&apu2_led_1); | |
145 | + } | |
146 | + return ret; | |
147 | +} | |
148 | + | |
149 | +static int apu2_led_remove(struct platform_device *pdev) | |
150 | +{ | |
151 | + led_classdev_unregister(&apu2_led_1); | |
152 | + led_classdev_unregister(&apu2_led_2); | |
153 | + led_classdev_unregister(&apu2_led_3); | |
154 | + return 0; | |
155 | +} | |
156 | + | |
157 | +static struct platform_driver apu2_led_driver = { | |
158 | + .probe = apu2_led_probe, | |
159 | + .remove = apu2_led_remove, | |
160 | + .suspend = apu2_led_suspend, | |
161 | + .resume = apu2_led_resume, | |
162 | + .driver = { | |
163 | + .name = DRVNAME, | |
164 | + .owner = THIS_MODULE, | |
165 | + }, | |
166 | +}; | |
167 | + | |
168 | +static int __init apu2_led_init(void) | |
169 | +{ | |
170 | + int ret=0; | |
171 | + const char *vendor, *product; | |
172 | + | |
173 | + vendor = dmi_get_system_info(DMI_SYS_VENDOR); | |
174 | + if (!vendor || strcmp(vendor, "PC Engines")) | |
175 | + goto out; | |
176 | + | |
177 | + product = dmi_get_system_info(DMI_PRODUCT_NAME); | |
178 | + if (!product || strcmp(product, "apu2")) | |
179 | + goto out; | |
180 | + | |
181 | + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n", | |
182 | + KBUILD_MODNAME, vendor, product); | |
183 | + | |
184 | + ret = platform_driver_register(&apu2_led_driver); | |
185 | + if (ret < 0) | |
186 | + goto out; | |
187 | + | |
188 | + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | |
189 | + if (IS_ERR(pdev)) { | |
190 | + ret = PTR_ERR(pdev); | |
191 | + platform_driver_unregister(&apu2_led_driver); | |
192 | + goto out; | |
193 | + } | |
194 | + | |
195 | + apu2_led_p1 = ioremap(BASEADDR, 4); | |
196 | + apu2_led_p2 = ioremap(BASEADDR+4, 4); | |
197 | + apu2_led_p3 = ioremap(BASEADDR+8, 4); | |
198 | + | |
199 | +out: | |
200 | + return ret; | |
201 | +} | |
202 | + | |
203 | +static void __exit apu2_led_exit(void) | |
204 | +{ | |
205 | + platform_device_unregister(pdev); | |
206 | + platform_driver_unregister(&apu2_led_driver); | |
207 | +} | |
208 | + | |
209 | +module_init(apu2_led_init); | |
210 | +module_exit(apu2_led_exit); | |
211 | + | |
212 | +MODULE_AUTHOR("Arne Fitzenreiter"); | |
213 | +MODULE_DESCRIPTION("PCEngines apu2 LED driver"); | |
214 | +MODULE_LICENSE("GPL"); | |
215 | diff -Naur linux-3.14.65.org/arch/x86/platform/apu/apu-led.c linux-3.14.65/arch/x86/platform/apu/apu-led.c | |
216 | --- linux-3.14.65.org/arch/x86/platform/apu/apu-led.c 1970-01-01 01:00:00.000000000 +0100 | |
217 | +++ linux-3.14.65/arch/x86/platform/apu/apu-led.c 2016-03-25 15:05:35.776693425 +0100 | |
e583643a AF |
218 | @@ -0,0 +1,181 @@ |
219 | +/* | |
220 | + * LEDs driver for PCEngines apu | |
221 | + * | |
222 | + * Copyright (C) 2013 Christian Herzog <daduke@daduke.org>, based on | |
223 | + * Petr Leibman's leds-alix | |
224 | + * Hardware presence check added by Arne Fitzenreiter <arne_f@ipfire.org> | |
225 | + * Based on leds-wrap.c | |
226 | + * Hardware info taken from http://www.dpie.com/manuals/miniboards/kontron/KTD-S0043-0_KTA55_SoftwareGuide.pdf | |
227 | + * | |
228 | + * This program is free software; you can redistribute it and/or modify | |
229 | + * it under the terms of the GNU General Public License version 2 as | |
230 | + * published by the Free Software Foundation. | |
231 | + */ | |
232 | + | |
233 | +#include <linux/kernel.h> | |
234 | +#include <linux/module.h> | |
235 | +#include <linux/init.h> | |
236 | +#include <linux/platform_device.h> | |
237 | +#include <linux/leds.h> | |
238 | +#include <linux/err.h> | |
239 | +#include <asm/io.h> | |
240 | +#include <linux/dmi.h> | |
241 | + | |
242 | +#define DRVNAME "apu-led" | |
243 | +#define BASEADDR (0xFED801BD) | |
244 | +#define LEDON (0x8) | |
245 | +#define LEDOFF (0xC8) | |
246 | + | |
247 | +static struct platform_device *pdev; | |
545c15b0 AF |
248 | +unsigned int *apu_led_p1; |
249 | +unsigned int *apu_led_p2; | |
250 | +unsigned int *apu_led_p3; | |
e583643a AF |
251 | + |
252 | +static void apu_led_set_1(struct led_classdev *led_cdev, | |
253 | + enum led_brightness value) { | |
254 | + if (value) | |
545c15b0 | 255 | + iowrite8(LEDON, apu_led_p1); |
e583643a | 256 | + else |
545c15b0 | 257 | + iowrite8(LEDOFF, apu_led_p1); |
e583643a AF |
258 | +} |
259 | + | |
260 | +static void apu_led_set_2(struct led_classdev *led_cdev, | |
261 | + enum led_brightness value) { | |
262 | + if (value) | |
545c15b0 | 263 | + iowrite8(LEDON, apu_led_p2); |
e583643a | 264 | + else |
545c15b0 | 265 | + iowrite8(LEDOFF, apu_led_p2); |
e583643a AF |
266 | +} |
267 | + | |
268 | +static void apu_led_set_3(struct led_classdev *led_cdev, | |
269 | + enum led_brightness value) { | |
270 | + if (value) | |
545c15b0 | 271 | + iowrite8(LEDON, apu_led_p3); |
e583643a | 272 | + else |
545c15b0 | 273 | + iowrite8(LEDOFF, apu_led_p3); |
e583643a AF |
274 | +} |
275 | + | |
276 | +static struct led_classdev apu_led_1 = { | |
277 | + .name = "apu:1", | |
278 | + .brightness_set = apu_led_set_1, | |
279 | +}; | |
280 | + | |
281 | +static struct led_classdev apu_led_2 = { | |
282 | + .name = "apu:2", | |
283 | + .brightness_set = apu_led_set_2, | |
284 | +}; | |
285 | + | |
286 | +static struct led_classdev apu_led_3 = { | |
287 | + .name = "apu:3", | |
288 | + .brightness_set = apu_led_set_3, | |
289 | +}; | |
290 | + | |
291 | + | |
292 | +#ifdef CONFIG_PM | |
293 | +static int apu_led_suspend(struct platform_device *dev, | |
294 | + pm_message_t state) | |
295 | +{ | |
296 | + led_classdev_suspend(&apu_led_1); | |
297 | + led_classdev_suspend(&apu_led_2); | |
298 | + led_classdev_suspend(&apu_led_3); | |
299 | + return 0; | |
300 | +} | |
301 | + | |
302 | +static int apu_led_resume(struct platform_device *dev) | |
303 | +{ | |
304 | + led_classdev_resume(&apu_led_1); | |
305 | + led_classdev_resume(&apu_led_2); | |
306 | + led_classdev_resume(&apu_led_3); | |
307 | + return 0; | |
308 | +} | |
309 | +#else | |
310 | +#define apu_led_suspend NULL | |
311 | +#define apu_led_resume NULL | |
312 | +#endif | |
313 | + | |
314 | +static int apu_led_probe(struct platform_device *pdev) | |
315 | +{ | |
316 | + int ret; | |
317 | + | |
318 | + ret = led_classdev_register(&pdev->dev, &apu_led_1); | |
319 | + if (ret == 0) | |
320 | + { | |
321 | + ret = led_classdev_register(&pdev->dev, &apu_led_2); | |
322 | + if (ret >= 0) | |
323 | + { | |
324 | + ret = led_classdev_register(&pdev->dev, &apu_led_3); | |
325 | + if (ret < 0) | |
326 | + led_classdev_unregister(&apu_led_2); | |
327 | + } | |
328 | + if (ret < 0) | |
329 | + led_classdev_unregister(&apu_led_1); | |
330 | + } | |
331 | + return ret; | |
332 | +} | |
333 | + | |
334 | +static int apu_led_remove(struct platform_device *pdev) | |
335 | +{ | |
336 | + led_classdev_unregister(&apu_led_1); | |
337 | + led_classdev_unregister(&apu_led_2); | |
338 | + led_classdev_unregister(&apu_led_3); | |
339 | + return 0; | |
340 | +} | |
341 | + | |
342 | +static struct platform_driver apu_led_driver = { | |
343 | + .probe = apu_led_probe, | |
344 | + .remove = apu_led_remove, | |
345 | + .suspend = apu_led_suspend, | |
346 | + .resume = apu_led_resume, | |
347 | + .driver = { | |
348 | + .name = DRVNAME, | |
349 | + .owner = THIS_MODULE, | |
350 | + }, | |
351 | +}; | |
352 | + | |
353 | +static int __init apu_led_init(void) | |
354 | +{ | |
355 | + int ret=0; | |
356 | + const char *vendor, *product; | |
357 | + | |
358 | + vendor = dmi_get_system_info(DMI_SYS_VENDOR); | |
359 | + if (!vendor || strcmp(vendor, "PC Engines")) | |
360 | + goto out; | |
361 | + | |
362 | + product = dmi_get_system_info(DMI_PRODUCT_NAME); | |
363 | + if (!product || strcmp(product, "APU")) | |
364 | + goto out; | |
365 | + | |
366 | + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n", | |
367 | + KBUILD_MODNAME, vendor, product); | |
368 | + | |
369 | + ret = platform_driver_register(&apu_led_driver); | |
370 | + if (ret < 0) | |
371 | + goto out; | |
372 | + | |
373 | + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | |
374 | + if (IS_ERR(pdev)) { | |
375 | + ret = PTR_ERR(pdev); | |
376 | + platform_driver_unregister(&apu_led_driver); | |
377 | + goto out; | |
378 | + } | |
379 | + | |
545c15b0 AF |
380 | + apu_led_p1 = ioremap(BASEADDR, 1); |
381 | + apu_led_p2 = ioremap(BASEADDR+1, 1); | |
382 | + apu_led_p3 = ioremap(BASEADDR+2, 1); | |
e583643a AF |
383 | + |
384 | +out: | |
385 | + return ret; | |
386 | +} | |
387 | + | |
388 | +static void __exit apu_led_exit(void) | |
389 | +{ | |
390 | + platform_device_unregister(pdev); | |
391 | + platform_driver_unregister(&apu_led_driver); | |
392 | +} | |
393 | + | |
394 | +module_init(apu_led_init); | |
395 | +module_exit(apu_led_exit); | |
396 | + | |
397 | +MODULE_AUTHOR("Christian Herzog"); | |
398 | +MODULE_DESCRIPTION("PCEngines apu LED driver"); | |
399 | +MODULE_LICENSE("GPL"); | |
545c15b0 AF |
400 | diff -Naur linux-3.14.65.org/arch/x86/platform/apu/Makefile linux-3.14.65/arch/x86/platform/apu/Makefile |
401 | --- linux-3.14.65.org/arch/x86/platform/apu/Makefile 1970-01-01 01:00:00.000000000 +0100 | |
402 | +++ linux-3.14.65/arch/x86/platform/apu/Makefile 2016-03-25 14:35:30.506585952 +0100 | |
403 | @@ -0,0 +1,2 @@ | |
e583643a | 404 | +obj-$(CONFIG_APULED) += apu-led.o |
545c15b0 AF |
405 | +obj-$(CONFIG_APU2LED) += apu2-led.o |
406 | diff -Naur linux-3.14.65.org/arch/x86/platform/Makefile linux-3.14.65/arch/x86/platform/Makefile | |
407 | --- linux-3.14.65.org/arch/x86/platform/Makefile 2016-03-16 16:42:30.000000000 +0100 | |
408 | +++ linux-3.14.65/arch/x86/platform/Makefile 2016-03-25 14:31:04.079903947 +0100 | |
e583643a AF |
409 | @@ -1,4 +1,5 @@ |
410 | # Platform specific code goes here | |
411 | +obj-y += apu/ | |
412 | obj-y += ce4100/ | |
413 | obj-y += efi/ | |
414 | obj-y += geode/ |