1 diff -Naur linux-3.14.43.org/arch/x86/Kconfig linux-3.14.43/arch/x86/Kconfig
2 --- linux-3.14.43.org/arch/x86/Kconfig 2015-05-17 18:54:01.000000000 +0200
3 +++ linux-3.14.43/arch/x86/Kconfig 2015-09-19 20:14:52.436654988 +0200
5 - AC adapter status updates
6 - Battery status updates
10 bool "PCEngines ALIX System Support (LED setup)"
12 @@ -2325,6 +2326,12 @@
17 + bool "PCEngines APU Led Support"
20 + This option enables system support for the PCEngines APU.
24 depends on CPU_SUP_AMD && PCI
25 diff -Naur linux-3.14.43.org/arch/x86/platform/apu/apu-led.c linux-3.14.43/arch/x86/platform/apu/apu-led.c
26 --- linux-3.14.43.org/arch/x86/platform/apu/apu-led.c 1970-01-01 01:00:00.000000000 +0100
27 +++ linux-3.14.43/arch/x86/platform/apu/apu-led.c 2015-09-19 20:12:20.520647636 +0200
30 + * LEDs driver for PCEngines apu
32 + * Copyright (C) 2013 Christian Herzog <daduke@daduke.org>, based on
33 + * Petr Leibman's leds-alix
34 + * Hardware presence check added by Arne Fitzenreiter <arne_f@ipfire.org>
35 + * Based on leds-wrap.c
36 + * Hardware info taken from http://www.dpie.com/manuals/miniboards/kontron/KTD-S0043-0_KTA55_SoftwareGuide.pdf
38 + * This program is free software; you can redistribute it and/or modify
39 + * it under the terms of the GNU General Public License version 2 as
40 + * published by the Free Software Foundation.
43 +#include <linux/kernel.h>
44 +#include <linux/module.h>
45 +#include <linux/init.h>
46 +#include <linux/platform_device.h>
47 +#include <linux/leds.h>
48 +#include <linux/err.h>
50 +#include <linux/dmi.h>
52 +#define DRVNAME "apu-led"
53 +#define BASEADDR (0xFED801BD)
55 +#define LEDOFF (0xC8)
57 +static struct platform_device *pdev;
62 +static void apu_led_set_1(struct led_classdev *led_cdev,
63 + enum led_brightness value) {
65 + iowrite8(LEDON, p1);
67 + iowrite8(LEDOFF, p1);
70 +static void apu_led_set_2(struct led_classdev *led_cdev,
71 + enum led_brightness value) {
73 + iowrite8(LEDON, p2);
75 + iowrite8(LEDOFF, p2);
78 +static void apu_led_set_3(struct led_classdev *led_cdev,
79 + enum led_brightness value) {
81 + iowrite8(LEDON, p3);
83 + iowrite8(LEDOFF, p3);
86 +static struct led_classdev apu_led_1 = {
88 + .brightness_set = apu_led_set_1,
91 +static struct led_classdev apu_led_2 = {
93 + .brightness_set = apu_led_set_2,
96 +static struct led_classdev apu_led_3 = {
98 + .brightness_set = apu_led_set_3,
103 +static int apu_led_suspend(struct platform_device *dev,
104 + pm_message_t state)
106 + led_classdev_suspend(&apu_led_1);
107 + led_classdev_suspend(&apu_led_2);
108 + led_classdev_suspend(&apu_led_3);
112 +static int apu_led_resume(struct platform_device *dev)
114 + led_classdev_resume(&apu_led_1);
115 + led_classdev_resume(&apu_led_2);
116 + led_classdev_resume(&apu_led_3);
120 +#define apu_led_suspend NULL
121 +#define apu_led_resume NULL
124 +static int apu_led_probe(struct platform_device *pdev)
128 + ret = led_classdev_register(&pdev->dev, &apu_led_1);
131 + ret = led_classdev_register(&pdev->dev, &apu_led_2);
134 + ret = led_classdev_register(&pdev->dev, &apu_led_3);
136 + led_classdev_unregister(&apu_led_2);
139 + led_classdev_unregister(&apu_led_1);
144 +static int apu_led_remove(struct platform_device *pdev)
146 + led_classdev_unregister(&apu_led_1);
147 + led_classdev_unregister(&apu_led_2);
148 + led_classdev_unregister(&apu_led_3);
152 +static struct platform_driver apu_led_driver = {
153 + .probe = apu_led_probe,
154 + .remove = apu_led_remove,
155 + .suspend = apu_led_suspend,
156 + .resume = apu_led_resume,
159 + .owner = THIS_MODULE,
163 +static int __init apu_led_init(void)
166 + const char *vendor, *product;
168 + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
169 + if (!vendor || strcmp(vendor, "PC Engines"))
172 + product = dmi_get_system_info(DMI_PRODUCT_NAME);
173 + if (!product || strcmp(product, "APU"))
176 + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
177 + KBUILD_MODNAME, vendor, product);
179 + ret = platform_driver_register(&apu_led_driver);
183 + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
184 + if (IS_ERR(pdev)) {
185 + ret = PTR_ERR(pdev);
186 + platform_driver_unregister(&apu_led_driver);
190 + p1 = ioremap(BASEADDR, 1);
191 + p2 = ioremap(BASEADDR+1, 1);
192 + p3 = ioremap(BASEADDR+2, 1);
198 +static void __exit apu_led_exit(void)
200 + platform_device_unregister(pdev);
201 + platform_driver_unregister(&apu_led_driver);
204 +module_init(apu_led_init);
205 +module_exit(apu_led_exit);
207 +MODULE_AUTHOR("Christian Herzog");
208 +MODULE_DESCRIPTION("PCEngines apu LED driver");
209 +MODULE_LICENSE("GPL");
210 diff -Naur linux-3.14.43.org/arch/x86/platform/apu/Makefile linux-3.14.43/arch/x86/platform/apu/Makefile
211 --- linux-3.14.43.org/arch/x86/platform/apu/Makefile 1970-01-01 01:00:00.000000000 +0100
212 +++ linux-3.14.43/arch/x86/platform/apu/Makefile 2015-09-19 20:12:20.520647636 +0200
214 +obj-$(CONFIG_APULED) += apu-led.o
215 diff -Naur linux-3.14.43.org/arch/x86/platform/Makefile linux-3.14.43/arch/x86/platform/Makefile
216 --- linux-3.14.43.org/arch/x86/platform/Makefile 2015-05-17 18:54:01.000000000 +0200
217 +++ linux-3.14.43/arch/x86/platform/Makefile 2015-09-19 20:12:20.520647636 +0200
219 # Platform specific code goes here