X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH 2/4] soekris-net6501: Add a board driver to create leds-net6501 device.
@ 2012-08-13 12:23 Chris Wilson
  2012-08-29 13:32 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2012-08-13 12:23 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: bryan.wu, Chris Wilson

Bryan Wu says of creating the platform_device in the leds driver:

> This is wrong, platform_device should be created in machine board
> files not in the drivers. For x86, please take a look at
> drivers/platform/x86/. And for leds-hp6xx.c, I didn't find any user of
> this in arch/sh. So probably we can drop it sometime.
>
> I also suggest you can just add this driver into the machine board
> file of this Soekris machine in drivers/platform/x86/ like other
> machines do...

So I did. Currently I don't know of any reliable way to detect the
hardware platform, the device that's listening on the LED GPIO
I/O ports isn't on the PCI bus and there is no ACPI support on this
system, so I can't see anything to do except unconditionally create
the platform_device.

Signed-off-by: Chris Wilson <chris+github@qwirx.com>
---
 drivers/platform/x86/Kconfig           |   10 +++++
 drivers/platform/x86/Makefile          |    1 +
 drivers/platform/x86/soekris-net6501.c |   58 ++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 0 deletions(-)
 create mode 100644 drivers/platform/x86/soekris-net6501.c

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 2a262f5..17a4d1d 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -766,4 +766,14 @@ config APPLE_GMUX
 	  graphics as well as the backlight. Currently only backlight
 	  control is supported by the driver.
 
+config SOEKRIS_NET6501
+	tristate "Soekris Net6501 Extras"
+	depends on X86
+	---help---
+	  This driver provides support for the Ready and Error LEDs on the
+	  Soekris Net6501, along with leds-net6501.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called soekris-net6501.
+
 endif # X86_PLATFORM_DEVICES
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index bf7e4f9..ba96e46 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -50,3 +50,4 @@ obj-$(CONFIG_INTEL_MID_POWER_BUTTON)	+= intel_mid_powerbtn.o
 obj-$(CONFIG_INTEL_OAKTRAIL)	+= intel_oaktrail.o
 obj-$(CONFIG_SAMSUNG_Q10)	+= samsung-q10.o
 obj-$(CONFIG_APPLE_GMUX)	+= apple-gmux.o
+obj-$(CONFIG_SOEKRIS_NET6501)	+= soekris-net6501.o
diff --git a/drivers/platform/x86/soekris-net6501.c b/drivers/platform/x86/soekris-net6501.c
new file mode 100644
index 0000000..e908841
--- /dev/null
+++ b/drivers/platform/x86/soekris-net6501.c
@@ -0,0 +1,58 @@
+/*
+ *  Written by Chris Wilson <chris+soekris@aptivate.org>
+ *  Based on classmate-laptop.c by Thadeu Lima de Souza Cascardo
+ *
+ *  This driver does nothing except make leds-net6501 work, by creating its
+ *  platform device, as requested by Bryan Wu.
+ *
+ *  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.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+MODULE_LICENSE("GPL");
+
+#define NET6501_LEDS_DEVICE "leds-net6501"
+
+static struct platform_device *pd;
+
+static int net6501_init(void)
+{
+	pd = platform_device_register_simple(NET6501_LEDS_DEVICE, -1, NULL, 0);
+
+	if (IS_ERR(pd)) {
+		printk(KERN_WARNING NET6501_LEDS_DEVICE ": failed to register "
+			"platform device: error %ld\n", PTR_ERR(pd));
+		return PTR_ERR(pd);
+	}
+
+	dev_info(&pd->dev, "Soekris Net6501 board driver\n");
+	return 0;
+}
+
+static void net6501_exit(void)
+{
+	platform_device_unregister(pd);
+}
+
+module_init(net6501_init);
+module_exit(net6501_exit);
+
+MODULE_AUTHOR("Chris Wilson <chris+soekris@aptivate.org>");
+MODULE_DESCRIPTION("Soekris Net6051 board driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:soekris-net6501");
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-12 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13 12:23 [PATCH 2/4] soekris-net6501: Add a board driver to create leds-net6501 device Chris Wilson
2012-08-29 13:32 ` Chris Wilson
2012-10-12 16:45   ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox