Skip to contentSkip to conversation

OLPC: register XO-1 RF kill device

PATCH New Daniel Drake 1 participant 1 message Oct 5, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 OLPC: register XO-1 RF kill device

The upcoming XO-1 rfkill driver (for drivers/platform/x86) will register itself with the name "xo1-rfkill"

Add the necessary mechanics so that this is properly probed and initialized on XO-1 laptops.

---
 arch/x86/kernel/olpc.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

v2: move platform device creation to separate function

arch/x86/kernel/olpc.c +20 -0
index 37c49934..06c245b 100644
@@ -17,6 +17,7 @@
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/string.h>
+#include <linux/platform_device.h>
 
 #include <asm/geode.h>
 #include <asm/setup.h>
@@ -220,8 +221,21 @@ static bool __init platform_detect(void)
 	return true;
 }
 
+static int __init add_xo1_platform_devices(void)
+{
+	struct platform_device *pdev;
+
+	pdev = platform_device_register_simple("xo1-rfkill", -1, NULL, 0);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+}
+
 static int __init olpc_init(void)
 {
+	int r = 0;
+
 	if (!olpc_ofw_present() || !platform_detect())
 		return 0;
 
@@ -248,6 +262,12 @@ static int __init olpc_init(void)
 			olpc_platform_info.boardrev >> 4,
 			olpc_platform_info.ecver);
 
+	if (olpc_platform_info.boardrev < olpc_board_pre(0xd0)) { /* XO-1 */
+		r = add_xo1_platform_devices();
+		if (r)
+			return r;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.7.2.3