1 diff -Naur linux-3.10.33.org/arch/x86/Kconfig linux-3.10.33/arch/x86/Kconfig
2 --- linux-3.10.33.org/arch/x86/Kconfig 2014-03-07 06:58:45.000000000 +0100
3 +++ linux-3.10.33/arch/x86/Kconfig 2014-03-17 17:02:46.703135023 +0100
5 - AC adapter status updates
6 - Battery status updates
9 + bool "PCEngines APU Led Support"
12 + This option enables system support for the PCEngines APU.
15 bool "PCEngines ALIX System Support (LED setup)"
17 diff -Naur linux-3.10.33.org/arch/x86/platform/apu/apu-led.c linux-3.10.33/arch/x86/platform/apu/apu-led.c
18 --- linux-3.10.33.org/arch/x86/platform/apu/apu-led.c 1970-01-01 01:00:00.000000000 +0100
19 +++ linux-3.10.33/arch/x86/platform/apu/apu-led.c 2014-03-17 17:00:36.187188456 +0100
22 + * LEDs driver for PCEngines apu
24 + * Copyright (C) 2013 Christian Herzog <daduke@daduke.org>, based on
25 + * Petr Leibman's leds-alix
26 + * Hardware presence check added by Arne Fitzenreiter <arne_f@ipfire.org>
27 + * Based on leds-wrap.c
28 + * Hardware info taken from http://www.dpie.com/manuals/miniboards/kontron/KTD-S0043-0_KTA55_SoftwareGuide.pdf
30 + * This program is free software; you can redistribute it and/or modify
31 + * it under the terms of the GNU General Public License version 2 as
32 + * published by the Free Software Foundation.
35 +#include <linux/kernel.h>
36 +#include <linux/module.h>
37 +#include <linux/init.h>
38 +#include <linux/platform_device.h>
39 +#include <linux/leds.h>
40 +#include <linux/err.h>
42 +#include <linux/dmi.h>
44 +#define DRVNAME "apu-led"
45 +#define BASEADDR (0xFED801BD)
47 +#define LEDOFF (0xC8)
49 +static struct platform_device *pdev;
54 +static void apu_led_set_1(struct led_classdev *led_cdev,
55 + enum led_brightness value) {
57 + iowrite8(LEDON, p1);
59 + iowrite8(LEDOFF, p1);
62 +static void apu_led_set_2(struct led_classdev *led_cdev,
63 + enum led_brightness value) {
65 + iowrite8(LEDON, p2);
67 + iowrite8(LEDOFF, p2);
70 +static void apu_led_set_3(struct led_classdev *led_cdev,
71 + enum led_brightness value) {
73 + iowrite8(LEDON, p3);
75 + iowrite8(LEDOFF, p3);
78 +static struct led_classdev apu_led_1 = {
80 + .brightness_set = apu_led_set_1,
83 +static struct led_classdev apu_led_2 = {
85 + .brightness_set = apu_led_set_2,
88 +static struct led_classdev apu_led_3 = {
90 + .brightness_set = apu_led_set_3,
95 +static int apu_led_suspend(struct platform_device *dev,
98 + led_classdev_suspend(&apu_led_1);
99 + led_classdev_suspend(&apu_led_2);
100 + led_classdev_suspend(&apu_led_3);
104 +static int apu_led_resume(struct platform_device *dev)
106 + led_classdev_resume(&apu_led_1);
107 + led_classdev_resume(&apu_led_2);
108 + led_classdev_resume(&apu_led_3);
112 +#define apu_led_suspend NULL
113 +#define apu_led_resume NULL
116 +static int apu_led_probe(struct platform_device *pdev)
120 + ret = led_classdev_register(&pdev->dev, &apu_led_1);
123 + ret = led_classdev_register(&pdev->dev, &apu_led_2);
126 + ret = led_classdev_register(&pdev->dev, &apu_led_3);
128 + led_classdev_unregister(&apu_led_2);
131 + led_classdev_unregister(&apu_led_1);
136 +static int apu_led_remove(struct platform_device *pdev)
138 + led_classdev_unregister(&apu_led_1);
139 + led_classdev_unregister(&apu_led_2);
140 + led_classdev_unregister(&apu_led_3);
144 +static struct platform_driver apu_led_driver = {
145 + .probe = apu_led_probe,
146 + .remove = apu_led_remove,
147 + .suspend = apu_led_suspend,
148 + .resume = apu_led_resume,
151 + .owner = THIS_MODULE,
155 +static int __init apu_led_init(void)
158 + const char *vendor, *product;
160 + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
161 + if (!vendor || strcmp(vendor, "PC Engines"))
164 + product = dmi_get_system_info(DMI_PRODUCT_NAME);
165 + if (!product || strcmp(product, "APU"))
168 + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
169 + KBUILD_MODNAME, vendor, product);
171 + ret = platform_driver_register(&apu_led_driver);
175 + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
176 + if (IS_ERR(pdev)) {
177 + ret = PTR_ERR(pdev);
178 + platform_driver_unregister(&apu_led_driver);
182 + p1 = ioremap(BASEADDR, 1);
183 + p2 = ioremap(BASEADDR+1, 1);
184 + p3 = ioremap(BASEADDR+2, 1);
190 +static void __exit apu_led_exit(void)
192 + platform_device_unregister(pdev);
193 + platform_driver_unregister(&apu_led_driver);
196 +module_init(apu_led_init);
197 +module_exit(apu_led_exit);
199 +MODULE_AUTHOR("Christian Herzog");
200 +MODULE_DESCRIPTION("PCEngines apu LED driver");
201 +MODULE_LICENSE("GPL");
202 diff -Naur linux-3.10.33.org/arch/x86/platform/apu/Makefile linux-3.10.33/arch/x86/platform/apu/Makefile
203 --- linux-3.10.33.org/arch/x86/platform/apu/Makefile 1970-01-01 01:00:00.000000000 +0100
204 +++ linux-3.10.33/arch/x86/platform/apu/Makefile 2014-03-17 17:05:19.245651480 +0100
206 +obj-$(CONFIG_APULED) += apu-led.o
207 diff -Naur linux-3.10.33.org/arch/x86/platform/Makefile linux-3.10.33/arch/x86/platform/Makefile
208 --- linux-3.10.33.org/arch/x86/platform/Makefile 2014-03-07 06:58:45.000000000 +0100
209 +++ linux-3.10.33/arch/x86/platform/Makefile 2014-03-17 14:53:15.078571307 +0100
211 # Platform specific code goes here