soekris-net6501: Add a board driver to create leds-net6501 device.
PATCH 2/4 soekris-net6501: Add a board driver to create leds-net6501 device.
Bryan Wu says of creating the platform_device in the leds driver:
Quoted 8 lines
This is wrong,
platform_deviceshould be created in machine board files not in the drivers. For x86, please take a look atdrivers/platform/x86/. And forleds-hp6xx.c, I didn't find any user of this inarch/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.
--- 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
drivers/platform/x86/Kconfig +10 -0
@@ -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
drivers/platform/x86/Makefile +1 -0
@@ -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
drivers/platform/x86/soekris-net6501.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Dear sirs,
Do you have any feedback on my patch?
Thanks, Chris.
Quoted 118 lines · Chris Wilson
Bryan Wu says of creating the
platform_devicein the leds driver:Quoted 8 lines
This is wrong,
platform_deviceshould be created in machine board files not in the drivers. For x86, please take a look atdrivers/platform/x86/. And forleds-hp6xx.c, I didn't find any user of this inarch/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 <[email protected]>---
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.cdrivers/platform/x86/Kconfig +10
-0@@ -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_DEVICESdrivers/platform/x86/Makefile +0
-0@@ -50,3 +50,4 @@ obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.oobj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o
obj-$(CONFIG_SAMSUNG_Q10) += samsung-q10.o
obj-$(CONFIG_APPLE_GMUX) += apple-gmux.odrivers/platform/x86/Makefile +1
-0+obj-$(CONFIG_SOEKRIS_NET6501) += soekris-net6501.odrivers/platform/x86/soekris-net6501.c new file +58
-0@@ -0,0 +1,58 @@ +/* +* Written by Chris Wilson <[email protected]> +* 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 <[email protected]>" ); +MODULE_DESCRIPTION ("Soekris Net6051 board driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:soekris-net6501" );
Signature · 4 lines
_____ __ _ \ __/ / ,__(_)_ | Chris Wilson <[email protected]> Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer | \__/_/_/_//_/___/ | We are GNU : free your mind & your software |
Dear sirs,
I still haven't heard anything about this patch. I don't even know if it reached the mailing lists?
I would like to see it merged, so if there is a reason why you don't want to include it as is, please could you let me know, so I can produce a better version?
I have discovered that the MPTABLE exists on the net6501 and uniquely identifies the device, so we could use it to refuse to load the platform driver on anything other than a net6501:
[ 0.000000] MPTABLE: OEM ID: Soekris [ 0.000000] MPTABLE: Product ID: net6501
I don't know how to go further and integrate this with a plug and play framework, since the device does not have ACPI in the BIOS (yet), nor any identifiable PCI IDs as far as I know. Do you have any advice on this?
Cheers, Chris.
Signature · 5 lines
Aptivate | http://www.aptivate.org | Phone: +44 1223 967 838 Future Business, Cam City FC, Milton Rd, Cambridge, CB4 1UY, UK Aptivate is a not-for-profit company registered in England and Wales with company number 04980791.