2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
8 #include <linux/module.h>
9 #include <linux/leds.h>
10 #include <linux/platform_device.h>
12 #define LEDFLAGS(bits, shift) \
13 ((bits << 8) | (shift << 8))
15 #define LEDBITS(id, shift, bits) \
17 .flags = LEDFLAGS(bits, shift)
19 struct led_info led_data_info
[] = {
20 { LEDBITS("bit", 0, 1) },
21 { LEDBITS("bit", 1, 1) },
22 { LEDBITS("bit", 2, 1) },
23 { LEDBITS("bit", 3, 1) },
24 { LEDBITS("bit", 4, 1) },
25 { LEDBITS("bit", 5, 1) },
26 { LEDBITS("bit", 6, 1) },
27 { LEDBITS("bit", 7, 1) },
28 { LEDBITS("all", 0, 8) },
31 static struct led_platform_data led_data
= {
32 .num_leds
= ARRAY_SIZE(led_data_info
),
36 static struct resource pled_resources
[] = {
40 .flags
= IORESOURCE_MEM
44 static struct platform_device pled_device
= {
45 .name
= "sead3::pled",
48 .platform_data
= &led_data
,
50 .num_resources
= ARRAY_SIZE(pled_resources
),
51 .resource
= pled_resources
55 static struct resource fled_resources
[] = {
59 .flags
= IORESOURCE_MEM
63 static struct platform_device fled_device
= {
64 .name
= "sead3::fled",
67 .platform_data
= &led_data
,
69 .num_resources
= ARRAY_SIZE(fled_resources
),
70 .resource
= fled_resources
73 static int __init
led_init(void)
75 platform_device_register(&pled_device
);
76 return platform_device_register(&fled_device
);
79 module_init(led_init
);
81 MODULE_AUTHOR("Chris Dearman <chris@mips.com>");
82 MODULE_LICENSE("GPL");
83 MODULE_DESCRIPTION("LED probe driver for SEAD-3");