diff options
author | Steven J. Hill <sjhill@mips.com> | 2012-05-30 17:02:49 -0400 |
---|---|---|
committer | Steven J. Hill <sjhill@mips.com> | 2012-09-13 16:43:46 -0400 |
commit | 3070033a16edcc21688d5ea8967c89522f833862 (patch) | |
tree | 48d1a4601dd4750d103bc0b02ff2494d75220321 /arch/mips/mti-sead3/leds-sead3.c | |
parent | 006a851b10a395955c153a145ad8241494d43688 (diff) |
MIPS: Add core files for MIPS SEAD-3 development platform.
More information about the SEAD-3 platform can be found at
<http://www.mips.com/products/development-kits/mips-sead-3/>
on MTI's site. Currently, the M14K family of cores is what
the SEAD-3 is utilised with.
Signed-off-by: Douglas Leung <douglas@mips.com>
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Steven J. Hill <sjhill@mips.com>
Diffstat (limited to 'arch/mips/mti-sead3/leds-sead3.c')
-rw-r--r-- | arch/mips/mti-sead3/leds-sead3.c | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/arch/mips/mti-sead3/leds-sead3.c b/arch/mips/mti-sead3/leds-sead3.c new file mode 100644 index 000000000000..a95ac5985206 --- /dev/null +++ b/arch/mips/mti-sead3/leds-sead3.c | |||
@@ -0,0 +1,128 @@ | |||
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. | ||
5 | * | ||
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/leds.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/io.h> | ||
15 | |||
16 | #define DRVNAME "sead3-led" | ||
17 | |||
18 | static struct platform_device *pdev; | ||
19 | |||
20 | static void sead3_pled_set(struct led_classdev *led_cdev, | ||
21 | enum led_brightness value) | ||
22 | { | ||
23 | pr_debug("sead3_pled_set\n"); | ||
24 | writel(value, (void __iomem *)0xBF000210); /* FIXME */ | ||
25 | } | ||
26 | |||
27 | static void sead3_fled_set(struct led_classdev *led_cdev, | ||
28 | enum led_brightness value) | ||
29 | { | ||
30 | pr_debug("sead3_fled_set\n"); | ||
31 | writel(value, (void __iomem *)0xBF000218); /* FIXME */ | ||
32 | } | ||
33 | |||
34 | static struct led_classdev sead3_pled = { | ||
35 | .name = "sead3::pled", | ||
36 | .brightness_set = sead3_pled_set, | ||
37 | }; | ||
38 | |||
39 | static struct led_classdev sead3_fled = { | ||
40 | .name = "sead3::fled", | ||
41 | .brightness_set = sead3_fled_set, | ||
42 | }; | ||
43 | |||
44 | #ifdef CONFIG_PM | ||
45 | static int sead3_led_suspend(struct platform_device *dev, | ||
46 | pm_message_t state) | ||
47 | { | ||
48 | led_classdev_suspend(&sead3_pled); | ||
49 | led_classdev_suspend(&sead3_fled); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static int sead3_led_resume(struct platform_device *dev) | ||
54 | { | ||
55 | led_classdev_resume(&sead3_pled); | ||
56 | led_classdev_resume(&sead3_fled); | ||
57 | return 0; | ||
58 | } | ||
59 | #else | ||
60 | #define sead3_led_suspend NULL | ||
61 | #define sead3_led_resume NULL | ||
62 | #endif | ||
63 | |||
64 | static int sead3_led_probe(struct platform_device *pdev) | ||
65 | { | ||
66 | int ret; | ||
67 | |||
68 | ret = led_classdev_register(&pdev->dev, &sead3_pled); | ||
69 | if (ret < 0) | ||
70 | return ret; | ||
71 | |||
72 | ret = led_classdev_register(&pdev->dev, &sead3_fled); | ||
73 | if (ret < 0) | ||
74 | led_classdev_unregister(&sead3_pled); | ||
75 | |||
76 | return ret; | ||
77 | } | ||
78 | |||
79 | static int sead3_led_remove(struct platform_device *pdev) | ||
80 | { | ||
81 | led_classdev_unregister(&sead3_pled); | ||
82 | led_classdev_unregister(&sead3_fled); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static struct platform_driver sead3_led_driver = { | ||
87 | .probe = sead3_led_probe, | ||
88 | .remove = sead3_led_remove, | ||
89 | .suspend = sead3_led_suspend, | ||
90 | .resume = sead3_led_resume, | ||
91 | .driver = { | ||
92 | .name = DRVNAME, | ||
93 | .owner = THIS_MODULE, | ||
94 | }, | ||
95 | }; | ||
96 | |||
97 | static int __init sead3_led_init(void) | ||
98 | { | ||
99 | int ret; | ||
100 | |||
101 | ret = platform_driver_register(&sead3_led_driver); | ||
102 | if (ret < 0) | ||
103 | goto out; | ||
104 | |||
105 | pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | ||
106 | if (IS_ERR(pdev)) { | ||
107 | ret = PTR_ERR(pdev); | ||
108 | platform_driver_unregister(&sead3_led_driver); | ||
109 | goto out; | ||
110 | } | ||
111 | |||
112 | out: | ||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | static void __exit sead3_led_exit(void) | ||
117 | { | ||
118 | platform_device_unregister(pdev); | ||
119 | platform_driver_unregister(&sead3_led_driver); | ||
120 | } | ||
121 | |||
122 | module_init(sead3_led_init); | ||
123 | module_exit(sead3_led_exit); | ||
124 | |||
125 | MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>"); | ||
126 | MODULE_DESCRIPTION("SEAD3 LED driver"); | ||
127 | MODULE_LICENSE("GPL"); | ||
128 | |||