Commit | Line | Data |
---|---|---|
3070033a SH |
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 | ||
3070033a SH |
16 | static void sead3_pled_set(struct led_classdev *led_cdev, |
17 | enum led_brightness value) | |
18 | { | |
3070033a SH |
19 | writel(value, (void __iomem *)0xBF000210); /* FIXME */ |
20 | } | |
21 | ||
22 | static void sead3_fled_set(struct led_classdev *led_cdev, | |
23 | enum led_brightness value) | |
24 | { | |
3070033a SH |
25 | writel(value, (void __iomem *)0xBF000218); /* FIXME */ |
26 | } | |
27 | ||
28 | static struct led_classdev sead3_pled = { | |
29 | .name = "sead3::pled", | |
70342287 | 30 | .brightness_set = sead3_pled_set, |
f4d1f2be | 31 | .flags = LED_CORE_SUSPENDRESUME, |
3070033a SH |
32 | }; |
33 | ||
34 | static struct led_classdev sead3_fled = { | |
35 | .name = "sead3::fled", | |
70342287 | 36 | .brightness_set = sead3_fled_set, |
f4d1f2be | 37 | .flags = LED_CORE_SUSPENDRESUME, |
3070033a SH |
38 | }; |
39 | ||
3070033a SH |
40 | static int sead3_led_probe(struct platform_device *pdev) |
41 | { | |
42 | int ret; | |
43 | ||
44 | ret = led_classdev_register(&pdev->dev, &sead3_pled); | |
45 | if (ret < 0) | |
46 | return ret; | |
47 | ||
48 | ret = led_classdev_register(&pdev->dev, &sead3_fled); | |
49 | if (ret < 0) | |
50 | led_classdev_unregister(&sead3_pled); | |
51 | ||
52 | return ret; | |
53 | } | |
54 | ||
55 | static int sead3_led_remove(struct platform_device *pdev) | |
56 | { | |
57 | led_classdev_unregister(&sead3_pled); | |
58 | led_classdev_unregister(&sead3_fled); | |
59 | return 0; | |
60 | } | |
61 | ||
62 | static struct platform_driver sead3_led_driver = { | |
63 | .probe = sead3_led_probe, | |
64 | .remove = sead3_led_remove, | |
3070033a | 65 | .driver = { |
2c0916d4 | 66 | .name = "sead3-led", |
3070033a SH |
67 | }, |
68 | }; | |
69 | ||
4558e094 | 70 | module_platform_driver(sead3_led_driver); |
3070033a SH |
71 | |
72 | MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>"); | |
73 | MODULE_DESCRIPTION("SEAD3 LED driver"); | |
74 | MODULE_LICENSE("GPL"); |