aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-10-13 14:10:42 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2010-10-13 14:51:25 -0400
commit447b1d43ded08c11f4f3d344b4e07e6dcddbef95 (patch)
tree0525f9e4a83edede8e5f88dcb9f5b05c61cfa3d9
parentbf1ebf007911d70a89de9a4a1b36d403e8eb064b (diff)
x86, olpc: Register XO-1 platform devices
The upcoming XO-1 rfkill driver (for drivers/platform/x86) will register itself with the name "xo1-rfkill", and the already-merged XO-1 poweroff code uses name "olpc-xo1" Add the necessary mechanics so that these devices are properly initialized on XO-1 laptops. Signed-off-by: Daniel Drake <dsd@laptop.org> LKML-Reference: <20101013181042.90C8F9D401B@zog.reactivated.net> Cc: Matthew Garrett <mjg@redhat.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/kernel/olpc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
index 74726130259..edaf3fe8dc5 100644
--- a/arch/x86/kernel/olpc.c
+++ b/arch/x86/kernel/olpc.c
@@ -17,6 +17,7 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/platform_device.h>
20 21
21#include <asm/geode.h> 22#include <asm/geode.h>
22#include <asm/setup.h> 23#include <asm/setup.h>
@@ -223,8 +224,25 @@ static bool __init platform_detect(void)
223 return true; 224 return true;
224} 225}
225 226
227static int __init add_xo1_platform_devices(void)
228{
229 struct platform_device *pdev;
230
231 pdev = platform_device_register_simple("xo1-rfkill", -1, NULL, 0);
232 if (IS_ERR(pdev))
233 return PTR_ERR(pdev);
234
235 pdev = platform_device_register_simple("olpc-xo1", -1, NULL, 0);
236 if (IS_ERR(pdev))
237 return PTR_ERR(pdev);
238
239 return 0;
240}
241
226static int __init olpc_init(void) 242static int __init olpc_init(void)
227{ 243{
244 int r = 0;
245
228 if (!olpc_ofw_present() || !platform_detect()) 246 if (!olpc_ofw_present() || !platform_detect())
229 return 0; 247 return 0;
230 248
@@ -251,6 +269,12 @@ static int __init olpc_init(void)
251 olpc_platform_info.boardrev >> 4, 269 olpc_platform_info.boardrev >> 4,
252 olpc_platform_info.ecver); 270 olpc_platform_info.ecver);
253 271
272 if (olpc_platform_info.boardrev < olpc_board_pre(0xd0)) { /* XO-1 */
273 r = add_xo1_platform_devices();
274 if (r)
275 return r;
276 }
277
254 return 0; 278 return 0;
255} 279}
256 280