mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 02:55:55 +02:00
kernel: add pcengines apu led support.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 3.10.30-ipfire Kernel Configuration
|
||||
# Linux/x86 3.10.33 Kernel Configuration
|
||||
#
|
||||
# CONFIG_64BIT is not set
|
||||
CONFIG_X86_32=y
|
||||
@@ -658,6 +658,7 @@ CONFIG_EISA_NAMES=y
|
||||
CONFIG_SCx200=m
|
||||
CONFIG_SCx200HR_TIMER=m
|
||||
# CONFIG_OLPC is not set
|
||||
CONFIG_APULED=y
|
||||
CONFIG_ALIX=y
|
||||
CONFIG_NET5501=y
|
||||
CONFIG_GEOS=y
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 3.10.30-ipfire Kernel Configuration
|
||||
# Linux/x86 3.10.33 Kernel Configuration
|
||||
#
|
||||
# CONFIG_64BIT is not set
|
||||
CONFIG_X86_32=y
|
||||
@@ -670,6 +670,7 @@ CONFIG_EISA_PCI_EISA=y
|
||||
CONFIG_EISA_VIRTUAL_ROOT=y
|
||||
CONFIG_EISA_NAMES=y
|
||||
# CONFIG_SCx200 is not set
|
||||
CONFIG_APULED=y
|
||||
# CONFIG_ALIX is not set
|
||||
# CONFIG_NET5501 is not set
|
||||
# CONFIG_GEOS is not set
|
||||
|
||||
@@ -150,6 +150,9 @@ endif
|
||||
# cs5535audio spams syslog if no ac97 was present (geos router)
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.30_cs5535audio_fix_logspam_on_geos.patch
|
||||
|
||||
# Add PC Engines APU led support
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-apu_leds.patch
|
||||
|
||||
# Fix uevent PHYSDEVDRIVER
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
|
||||
|
||||
215
src/patches/linux-3.10-apu_leds.patch
Normal file
215
src/patches/linux-3.10-apu_leds.patch
Normal file
@@ -0,0 +1,215 @@
|
||||
diff -Naur linux-3.10.33.org/arch/x86/Kconfig linux-3.10.33/arch/x86/Kconfig
|
||||
--- linux-3.10.33.org/arch/x86/Kconfig 2014-03-07 06:58:45.000000000 +0100
|
||||
+++ linux-3.10.33/arch/x86/Kconfig 2014-03-17 17:02:46.703135023 +0100
|
||||
@@ -2199,6 +2199,12 @@
|
||||
- AC adapter status updates
|
||||
- Battery status updates
|
||||
|
||||
+config APULED
|
||||
+ bool "PCEngines APU Led Support"
|
||||
+ depends on DMI
|
||||
+ ---help---
|
||||
+ This option enables system support for the PCEngines APU.
|
||||
+
|
||||
config ALIX
|
||||
bool "PCEngines ALIX System Support (LED setup)"
|
||||
select GPIOLIB
|
||||
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
|
||||
--- linux-3.10.33.org/arch/x86/platform/apu/apu-led.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-3.10.33/arch/x86/platform/apu/apu-led.c 2014-03-17 17:00:36.187188456 +0100
|
||||
@@ -0,0 +1,181 @@
|
||||
+/*
|
||||
+ * LEDs driver for PCEngines apu
|
||||
+ *
|
||||
+ * Copyright (C) 2013 Christian Herzog <daduke@daduke.org>, based on
|
||||
+ * Petr Leibman's leds-alix
|
||||
+ * Hardware presence check added by Arne Fitzenreiter <arne_f@ipfire.org>
|
||||
+ * Based on leds-wrap.c
|
||||
+ * Hardware info taken from http://www.dpie.com/manuals/miniboards/kontron/KTD-S0043-0_KTA55_SoftwareGuide.pdf
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/leds.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <asm/io.h>
|
||||
+#include <linux/dmi.h>
|
||||
+
|
||||
+#define DRVNAME "apu-led"
|
||||
+#define BASEADDR (0xFED801BD)
|
||||
+#define LEDON (0x8)
|
||||
+#define LEDOFF (0xC8)
|
||||
+
|
||||
+static struct platform_device *pdev;
|
||||
+unsigned int *p1;
|
||||
+unsigned int *p2;
|
||||
+unsigned int *p3;
|
||||
+
|
||||
+static void apu_led_set_1(struct led_classdev *led_cdev,
|
||||
+ enum led_brightness value) {
|
||||
+ if (value)
|
||||
+ iowrite8(LEDON, p1);
|
||||
+ else
|
||||
+ iowrite8(LEDOFF, p1);
|
||||
+}
|
||||
+
|
||||
+static void apu_led_set_2(struct led_classdev *led_cdev,
|
||||
+ enum led_brightness value) {
|
||||
+ if (value)
|
||||
+ iowrite8(LEDON, p2);
|
||||
+ else
|
||||
+ iowrite8(LEDOFF, p2);
|
||||
+}
|
||||
+
|
||||
+static void apu_led_set_3(struct led_classdev *led_cdev,
|
||||
+ enum led_brightness value) {
|
||||
+ if (value)
|
||||
+ iowrite8(LEDON, p3);
|
||||
+ else
|
||||
+ iowrite8(LEDOFF, p3);
|
||||
+}
|
||||
+
|
||||
+static struct led_classdev apu_led_1 = {
|
||||
+ .name = "apu:1",
|
||||
+ .brightness_set = apu_led_set_1,
|
||||
+};
|
||||
+
|
||||
+static struct led_classdev apu_led_2 = {
|
||||
+ .name = "apu:2",
|
||||
+ .brightness_set = apu_led_set_2,
|
||||
+};
|
||||
+
|
||||
+static struct led_classdev apu_led_3 = {
|
||||
+ .name = "apu:3",
|
||||
+ .brightness_set = apu_led_set_3,
|
||||
+};
|
||||
+
|
||||
+
|
||||
+#ifdef CONFIG_PM
|
||||
+static int apu_led_suspend(struct platform_device *dev,
|
||||
+ pm_message_t state)
|
||||
+{
|
||||
+ led_classdev_suspend(&apu_led_1);
|
||||
+ led_classdev_suspend(&apu_led_2);
|
||||
+ led_classdev_suspend(&apu_led_3);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int apu_led_resume(struct platform_device *dev)
|
||||
+{
|
||||
+ led_classdev_resume(&apu_led_1);
|
||||
+ led_classdev_resume(&apu_led_2);
|
||||
+ led_classdev_resume(&apu_led_3);
|
||||
+ return 0;
|
||||
+}
|
||||
+#else
|
||||
+#define apu_led_suspend NULL
|
||||
+#define apu_led_resume NULL
|
||||
+#endif
|
||||
+
|
||||
+static int apu_led_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = led_classdev_register(&pdev->dev, &apu_led_1);
|
||||
+ if (ret == 0)
|
||||
+ {
|
||||
+ ret = led_classdev_register(&pdev->dev, &apu_led_2);
|
||||
+ if (ret >= 0)
|
||||
+ {
|
||||
+ ret = led_classdev_register(&pdev->dev, &apu_led_3);
|
||||
+ if (ret < 0)
|
||||
+ led_classdev_unregister(&apu_led_2);
|
||||
+ }
|
||||
+ if (ret < 0)
|
||||
+ led_classdev_unregister(&apu_led_1);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int apu_led_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ led_classdev_unregister(&apu_led_1);
|
||||
+ led_classdev_unregister(&apu_led_2);
|
||||
+ led_classdev_unregister(&apu_led_3);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver apu_led_driver = {
|
||||
+ .probe = apu_led_probe,
|
||||
+ .remove = apu_led_remove,
|
||||
+ .suspend = apu_led_suspend,
|
||||
+ .resume = apu_led_resume,
|
||||
+ .driver = {
|
||||
+ .name = DRVNAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init apu_led_init(void)
|
||||
+{
|
||||
+ int ret=0;
|
||||
+ const char *vendor, *product;
|
||||
+
|
||||
+ vendor = dmi_get_system_info(DMI_SYS_VENDOR);
|
||||
+ if (!vendor || strcmp(vendor, "PC Engines"))
|
||||
+ goto out;
|
||||
+
|
||||
+ product = dmi_get_system_info(DMI_PRODUCT_NAME);
|
||||
+ if (!product || strcmp(product, "APU"))
|
||||
+ goto out;
|
||||
+
|
||||
+ printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
|
||||
+ KBUILD_MODNAME, vendor, product);
|
||||
+
|
||||
+ ret = platform_driver_register(&apu_led_driver);
|
||||
+ if (ret < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
|
||||
+ if (IS_ERR(pdev)) {
|
||||
+ ret = PTR_ERR(pdev);
|
||||
+ platform_driver_unregister(&apu_led_driver);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ p1 = ioremap(BASEADDR, 1);
|
||||
+ p2 = ioremap(BASEADDR+1, 1);
|
||||
+ p3 = ioremap(BASEADDR+2, 1);
|
||||
+
|
||||
+out:
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void __exit apu_led_exit(void)
|
||||
+{
|
||||
+ platform_device_unregister(pdev);
|
||||
+ platform_driver_unregister(&apu_led_driver);
|
||||
+}
|
||||
+
|
||||
+module_init(apu_led_init);
|
||||
+module_exit(apu_led_exit);
|
||||
+
|
||||
+MODULE_AUTHOR("Christian Herzog");
|
||||
+MODULE_DESCRIPTION("PCEngines apu LED driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff -Naur linux-3.10.33.org/arch/x86/platform/apu/Makefile linux-3.10.33/arch/x86/platform/apu/Makefile
|
||||
--- linux-3.10.33.org/arch/x86/platform/apu/Makefile 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-3.10.33/arch/x86/platform/apu/Makefile 2014-03-17 17:05:19.245651480 +0100
|
||||
@@ -0,0 +1 @@
|
||||
+obj-$(CONFIG_APULED) += apu-led.o
|
||||
diff -Naur linux-3.10.33.org/arch/x86/platform/Makefile linux-3.10.33/arch/x86/platform/Makefile
|
||||
--- linux-3.10.33.org/arch/x86/platform/Makefile 2014-03-07 06:58:45.000000000 +0100
|
||||
+++ linux-3.10.33/arch/x86/platform/Makefile 2014-03-17 14:53:15.078571307 +0100
|
||||
@@ -1,4 +1,5 @@
|
||||
# Platform specific code goes here
|
||||
+obj-y += apu/
|
||||
obj-y += ce4100/
|
||||
obj-y += efi/
|
||||
obj-y += geode/
|
||||
Reference in New Issue
Block a user