]>
Commit | Line | Data |
---|---|---|
17872019 AF |
1 | diff -Naur linux-4.14.101.org/arch/x86/Kconfig linux-4.14.101/arch/x86/Kconfig |
2 | --- linux-4.14.101.org/arch/x86/Kconfig 2019-02-15 09:08:56.000000000 +0100 | |
3 | +++ linux-4.14.101/arch/x86/Kconfig 2019-02-18 22:24:00.682722072 +0100 | |
4 | @@ -2715,6 +2715,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 | |
17872019 | 12 | @@ -2753,6 +2754,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 | |
17872019 | 23 | + bool "PCEngines APU2/3/4 Led Support" |
545c15b0 AF |
24 | + depends on DMI |
25 | + ---help--- | |
17872019 | 26 | + This option enables system support for the PCEngines APU2/3/4. |
e583643a | 27 | + |
4d4f36ef AF |
28 | config AMD_NB |
29 | def_bool y | |
30 | depends on CPU_SUP_AMD && PCI | |
17872019 AF |
31 | diff -Naur linux-4.14.101.org/arch/x86/platform/apu/apu2-led.c linux-4.14.101/arch/x86/platform/apu/apu2-led.c |
32 | --- linux-4.14.101.org/arch/x86/platform/apu/apu2-led.c 1970-01-01 01:00:00.000000000 +0100 | |
33 | +++ linux-4.14.101/arch/x86/platform/apu/apu2-led.c 2019-02-18 22:30:08.503059825 +0100 | |
34 | @@ -0,0 +1,183 @@ | |
545c15b0 | 35 | +/* |
17872019 | 36 | + * LEDs driver for PCEngines apu2/3/4 |
545c15b0 AF |
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); | |
17872019 AF |
178 | + if (!product || ( strcmp(product, "PC Engines apu2") && |
179 | + strcmp(product, "PC Engines apu3") && | |
180 | + strcmp(product, "PC Engines apu4") && | |
181 | + strcmp(product, "apu2") ) ) // apu2 on early bios relases | |
545c15b0 AF |
182 | + goto out; |
183 | + | |
184 | + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n", | |
185 | + KBUILD_MODNAME, vendor, product); | |
186 | + | |
187 | + ret = platform_driver_register(&apu2_led_driver); | |
188 | + if (ret < 0) | |
189 | + goto out; | |
190 | + | |
191 | + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | |
192 | + if (IS_ERR(pdev)) { | |
193 | + ret = PTR_ERR(pdev); | |
194 | + platform_driver_unregister(&apu2_led_driver); | |
195 | + goto out; | |
196 | + } | |
197 | + | |
198 | + apu2_led_p1 = ioremap(BASEADDR, 4); | |
199 | + apu2_led_p2 = ioremap(BASEADDR+4, 4); | |
200 | + apu2_led_p3 = ioremap(BASEADDR+8, 4); | |
201 | + | |
202 | +out: | |
203 | + return ret; | |
204 | +} | |
205 | + | |
206 | +static void __exit apu2_led_exit(void) | |
207 | +{ | |
208 | + platform_device_unregister(pdev); | |
209 | + platform_driver_unregister(&apu2_led_driver); | |
210 | +} | |
211 | + | |
212 | +module_init(apu2_led_init); | |
213 | +module_exit(apu2_led_exit); | |
214 | + | |
215 | +MODULE_AUTHOR("Arne Fitzenreiter"); | |
17872019 | 216 | +MODULE_DESCRIPTION("PCEngines apu2/3/4 LED driver"); |
545c15b0 | 217 | +MODULE_LICENSE("GPL"); |
17872019 AF |
218 | diff -Naur linux-4.14.101.org/arch/x86/platform/apu/apu-led.c linux-4.14.101/arch/x86/platform/apu/apu-led.c |
219 | --- linux-4.14.101.org/arch/x86/platform/apu/apu-led.c 1970-01-01 01:00:00.000000000 +0100 | |
220 | +++ linux-4.14.101/arch/x86/platform/apu/apu-led.c 2019-02-18 22:24:00.686721439 +0100 | |
e583643a AF |
221 | @@ -0,0 +1,181 @@ |
222 | +/* | |
223 | + * LEDs driver for PCEngines apu | |
224 | + * | |
225 | + * Copyright (C) 2013 Christian Herzog <daduke@daduke.org>, based on | |
226 | + * Petr Leibman's leds-alix | |
227 | + * Hardware presence check added by Arne Fitzenreiter <arne_f@ipfire.org> | |
228 | + * Based on leds-wrap.c | |
229 | + * Hardware info taken from http://www.dpie.com/manuals/miniboards/kontron/KTD-S0043-0_KTA55_SoftwareGuide.pdf | |
230 | + * | |
231 | + * This program is free software; you can redistribute it and/or modify | |
232 | + * it under the terms of the GNU General Public License version 2 as | |
233 | + * published by the Free Software Foundation. | |
234 | + */ | |
235 | + | |
236 | +#include <linux/kernel.h> | |
237 | +#include <linux/module.h> | |
238 | +#include <linux/init.h> | |
239 | +#include <linux/platform_device.h> | |
240 | +#include <linux/leds.h> | |
241 | +#include <linux/err.h> | |
242 | +#include <asm/io.h> | |
243 | +#include <linux/dmi.h> | |
244 | + | |
245 | +#define DRVNAME "apu-led" | |
246 | +#define BASEADDR (0xFED801BD) | |
247 | +#define LEDON (0x8) | |
248 | +#define LEDOFF (0xC8) | |
249 | + | |
250 | +static struct platform_device *pdev; | |
545c15b0 AF |
251 | +unsigned int *apu_led_p1; |
252 | +unsigned int *apu_led_p2; | |
253 | +unsigned int *apu_led_p3; | |
e583643a AF |
254 | + |
255 | +static void apu_led_set_1(struct led_classdev *led_cdev, | |
256 | + enum led_brightness value) { | |
257 | + if (value) | |
545c15b0 | 258 | + iowrite8(LEDON, apu_led_p1); |
e583643a | 259 | + else |
545c15b0 | 260 | + iowrite8(LEDOFF, apu_led_p1); |
e583643a AF |
261 | +} |
262 | + | |
263 | +static void apu_led_set_2(struct led_classdev *led_cdev, | |
264 | + enum led_brightness value) { | |
265 | + if (value) | |
545c15b0 | 266 | + iowrite8(LEDON, apu_led_p2); |
e583643a | 267 | + else |
545c15b0 | 268 | + iowrite8(LEDOFF, apu_led_p2); |
e583643a AF |
269 | +} |
270 | + | |
271 | +static void apu_led_set_3(struct led_classdev *led_cdev, | |
272 | + enum led_brightness value) { | |
273 | + if (value) | |
545c15b0 | 274 | + iowrite8(LEDON, apu_led_p3); |
e583643a | 275 | + else |
545c15b0 | 276 | + iowrite8(LEDOFF, apu_led_p3); |
e583643a AF |
277 | +} |
278 | + | |
279 | +static struct led_classdev apu_led_1 = { | |
280 | + .name = "apu:1", | |
281 | + .brightness_set = apu_led_set_1, | |
282 | +}; | |
283 | + | |
284 | +static struct led_classdev apu_led_2 = { | |
285 | + .name = "apu:2", | |
286 | + .brightness_set = apu_led_set_2, | |
287 | +}; | |
288 | + | |
289 | +static struct led_classdev apu_led_3 = { | |
290 | + .name = "apu:3", | |
291 | + .brightness_set = apu_led_set_3, | |
292 | +}; | |
293 | + | |
294 | + | |
295 | +#ifdef CONFIG_PM | |
296 | +static int apu_led_suspend(struct platform_device *dev, | |
297 | + pm_message_t state) | |
298 | +{ | |
299 | + led_classdev_suspend(&apu_led_1); | |
300 | + led_classdev_suspend(&apu_led_2); | |
301 | + led_classdev_suspend(&apu_led_3); | |
302 | + return 0; | |
303 | +} | |
304 | + | |
305 | +static int apu_led_resume(struct platform_device *dev) | |
306 | +{ | |
307 | + led_classdev_resume(&apu_led_1); | |
308 | + led_classdev_resume(&apu_led_2); | |
309 | + led_classdev_resume(&apu_led_3); | |
310 | + return 0; | |
311 | +} | |
312 | +#else | |
313 | +#define apu_led_suspend NULL | |
314 | +#define apu_led_resume NULL | |
315 | +#endif | |
316 | + | |
317 | +static int apu_led_probe(struct platform_device *pdev) | |
318 | +{ | |
319 | + int ret; | |
320 | + | |
321 | + ret = led_classdev_register(&pdev->dev, &apu_led_1); | |
322 | + if (ret == 0) | |
323 | + { | |
324 | + ret = led_classdev_register(&pdev->dev, &apu_led_2); | |
325 | + if (ret >= 0) | |
326 | + { | |
327 | + ret = led_classdev_register(&pdev->dev, &apu_led_3); | |
328 | + if (ret < 0) | |
329 | + led_classdev_unregister(&apu_led_2); | |
330 | + } | |
331 | + if (ret < 0) | |
332 | + led_classdev_unregister(&apu_led_1); | |
333 | + } | |
334 | + return ret; | |
335 | +} | |
336 | + | |
337 | +static int apu_led_remove(struct platform_device *pdev) | |
338 | +{ | |
339 | + led_classdev_unregister(&apu_led_1); | |
340 | + led_classdev_unregister(&apu_led_2); | |
341 | + led_classdev_unregister(&apu_led_3); | |
342 | + return 0; | |
343 | +} | |
344 | + | |
345 | +static struct platform_driver apu_led_driver = { | |
346 | + .probe = apu_led_probe, | |
347 | + .remove = apu_led_remove, | |
348 | + .suspend = apu_led_suspend, | |
349 | + .resume = apu_led_resume, | |
350 | + .driver = { | |
351 | + .name = DRVNAME, | |
352 | + .owner = THIS_MODULE, | |
353 | + }, | |
354 | +}; | |
355 | + | |
356 | +static int __init apu_led_init(void) | |
357 | +{ | |
358 | + int ret=0; | |
359 | + const char *vendor, *product; | |
360 | + | |
361 | + vendor = dmi_get_system_info(DMI_SYS_VENDOR); | |
362 | + if (!vendor || strcmp(vendor, "PC Engines")) | |
363 | + goto out; | |
364 | + | |
365 | + product = dmi_get_system_info(DMI_PRODUCT_NAME); | |
366 | + if (!product || strcmp(product, "APU")) | |
367 | + goto out; | |
368 | + | |
369 | + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n", | |
370 | + KBUILD_MODNAME, vendor, product); | |
371 | + | |
372 | + ret = platform_driver_register(&apu_led_driver); | |
373 | + if (ret < 0) | |
374 | + goto out; | |
375 | + | |
376 | + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | |
377 | + if (IS_ERR(pdev)) { | |
378 | + ret = PTR_ERR(pdev); | |
379 | + platform_driver_unregister(&apu_led_driver); | |
380 | + goto out; | |
381 | + } | |
382 | + | |
545c15b0 AF |
383 | + apu_led_p1 = ioremap(BASEADDR, 1); |
384 | + apu_led_p2 = ioremap(BASEADDR+1, 1); | |
385 | + apu_led_p3 = ioremap(BASEADDR+2, 1); | |
e583643a AF |
386 | + |
387 | +out: | |
388 | + return ret; | |
389 | +} | |
390 | + | |
391 | +static void __exit apu_led_exit(void) | |
392 | +{ | |
393 | + platform_device_unregister(pdev); | |
394 | + platform_driver_unregister(&apu_led_driver); | |
395 | +} | |
396 | + | |
397 | +module_init(apu_led_init); | |
398 | +module_exit(apu_led_exit); | |
399 | + | |
400 | +MODULE_AUTHOR("Christian Herzog"); | |
401 | +MODULE_DESCRIPTION("PCEngines apu LED driver"); | |
402 | +MODULE_LICENSE("GPL"); | |
17872019 AF |
403 | diff -Naur linux-4.14.101.org/arch/x86/platform/apu/Makefile linux-4.14.101/arch/x86/platform/apu/Makefile |
404 | --- linux-4.14.101.org/arch/x86/platform/apu/Makefile 1970-01-01 01:00:00.000000000 +0100 | |
405 | +++ linux-4.14.101/arch/x86/platform/apu/Makefile 2019-02-18 22:24:00.686721439 +0100 | |
545c15b0 | 406 | @@ -0,0 +1,2 @@ |
e583643a | 407 | +obj-$(CONFIG_APULED) += apu-led.o |
545c15b0 | 408 | +obj-$(CONFIG_APU2LED) += apu2-led.o |
17872019 AF |
409 | diff -Naur linux-4.14.101.org/arch/x86/platform/Makefile linux-4.14.101/arch/x86/platform/Makefile |
410 | --- linux-4.14.101.org/arch/x86/platform/Makefile 2019-02-15 09:08:56.000000000 +0100 | |
411 | +++ linux-4.14.101/arch/x86/platform/Makefile 2019-02-18 22:24:00.686721439 +0100 | |
412 | @@ -1,5 +1,6 @@ | |
413 | # SPDX-License-Identifier: GPL-2.0 | |
e583643a AF |
414 | # Platform specific code goes here |
415 | +obj-y += apu/ | |
91648bd1 | 416 | obj-y += atom/ |
e583643a AF |
417 | obj-y += ce4100/ |
418 | obj-y += efi/ |