This adds support for the PCB LEDs and Reset Button found on the PC
Engines APU2/APU3 embedded boards.
Signed-off-by: Chris Blake
---
package/kernel/leds-apu2/Makefile| 52 +
package/kernel/leds-apu2/src/Kconfig | 8 +
package/kernel/leds-apu2/src/Makefile| 1 +
package/kernel/leds-apu2/src/leds-apu2.c | 374 +++
4 files changed, 435 insertions(+)
create mode 100644 package/kernel/leds-apu2/Makefile
create mode 100644 package/kernel/leds-apu2/src/Kconfig
create mode 100644 package/kernel/leds-apu2/src/Makefile
create mode 100644 package/kernel/leds-apu2/src/leds-apu2.c
diff --git a/package/kernel/leds-apu2/Makefile
b/package/kernel/leds-apu2/Makefile
new file mode 100644
index 000..bab2315
--- /dev/null
+++ b/package/kernel/leds-apu2/Makefile
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2017 Chris Blake
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=leds-apu2
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=Chris Blake
+PKG_LICENSE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/leds-apu2
+ SUBMENU:=LED modules
+ TITLE:= PC Engines APU2/APU3 LED support
+ DEPENDS:= @GPIO_SUPPORT @TARGET_x86
+ FILES:=$(PKG_BUILD_DIR)/leds-apu2.ko
+ AUTOLOAD:=$(call AutoLoad,41,leds-apu2,1)
+ KCONFIG:=
+endef
+
+define KernelPackage/leds-apu2/description
+ Driver for the PC Engines APU2/APU3 LEDs & Reset Button.
+endef
+
+EXTRA_KCONFIG:= \
+ CONFIG_LEDS_APU2=m
+
+EXTRA_CFLAGS:= \
+ $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter
%=m,$(EXTRA_KCONFIG \
+ $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter
%=y,$(EXTRA_KCONFIG \
+
+MAKE_OPTS:= \
+ ARCH="$(LINUX_KARCH)" \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ SUBDIRS="$(PKG_BUILD_DIR)" \
+ EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
+ $(EXTRA_KCONFIG)
+
+define Build/Compile
+$(MAKE) -C "$(LINUX_DIR)" \
+ $(MAKE_OPTS) \
+ modules
+endef
+
+$(eval $(call KernelPackage,leds-apu2))
diff --git a/package/kernel/leds-apu2/src/Kconfig
b/package/kernel/leds-apu2/src/Kconfig
new file mode 100644
index 000..d0ad5be
--- /dev/null
+++ b/package/kernel/leds-apu2/src/Kconfig
@@ -0,0 +1,8 @@
+config LEDS_APU2
+tristate "PC Engines APU2/APU3 LED support"
+depends on LEDS_CLASS
+depends on LEDS_GPIO
+depends on GPIOLIB
+help
+ Say yes here to enable support for the CPU GPIO pins on the PC
Engines
+ APU2/APU3 board, which enables the front LEDs and Reset Button.
diff --git a/package/kernel/leds-apu2/src/Makefile
b/package/kernel/leds-apu2/src/Makefile
new file mode 100644
index 000..4f77b39
--- /dev/null
+++ b/package/kernel/leds-apu2/src/Makefile
@@ -0,0 +1 @@
+obj-${CONFIG_LEDS_APU2}+= leds-apu2.o
diff --git a/package/kernel/leds-apu2/src/leds-apu2.c
b/package/kernel/leds-apu2/src/leds-apu2.c
new file mode 100644
index 000..8da8a2d
--- /dev/null
+++ b/package/kernel/leds-apu2/src/leds-apu2.c
@@ -0,0 +1,374 @@
+/*
+ * APU2 LED/GPIO Driver
+ * Copyright (c) 2016 Christian Lamparter
+ *
+ * Based on gpio-apu2.c - AMD FCH GPIO support for PC-Engines APU-2 board
+ *
+ * Copyright (c) 2015 Carsten Spiess
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+
+ #include
+ #include
+ #include
+
+ #define DEVNAME "leds-apu2"
+
+ #define FCH_ACPI_MMIO_BASE 0xFED8
+ #define FCH_GPIO_BASE (FCH_ACPI_MMIO_BASE + 0x1500)
+ #define FCH_GPIO_SIZE 0x300
+
+ #define APU_NUM_GPIO4
+
+ #define GPIO_BIT_DIR23
+ #define GPIO_BIT_WRITE 22
+ #define GPIO_BIT_READ 16
+
+ /* internal variables */
+ static struct pci_dev *gpio_apu2_pci;
+ static DEFINE_SPINLOCK (gpio_lock);
+
+ /* the watchdog platform device */
+ static struct platform_device *gpio_apu2_platform_device;
+ static struct platform_device *leddev;
+ static struct platform_device *keydev;
+
+ static const struct pci_device_id gpio_apu2_pci_tbl[]