Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux/fpc-iii.git] / arch / mips / mti-sead3 / sead3-leds.c
blob20102a6d41410fbba6854edab6ee1199d50cc7fa
1 /*
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
4 * for more details.
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
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) \
16 .name = id #shift, \
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),
33 .leds = led_data_info
36 static struct resource pled_resources[] = {
38 .start = 0x1f000210,
39 .end = 0x1f000217,
40 .flags = IORESOURCE_MEM
44 static struct platform_device pled_device = {
45 .name = "sead3::pled",
46 .id = 0,
47 .dev = {
48 .platform_data = &led_data,
50 .num_resources = ARRAY_SIZE(pled_resources),
51 .resource = pled_resources
55 static struct resource fled_resources[] = {
57 .start = 0x1f000218,
58 .end = 0x1f00021f,
59 .flags = IORESOURCE_MEM
63 static struct platform_device fled_device = {
64 .name = "sead3::fled",
65 .id = 0,
66 .dev = {
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");