IB/srp: Let srp_abort() return FAST_IO_FAIL if TL offline
[linux/fpc-iii.git] / arch / mips / mti-sead3 / leds-sead3.c
blob0a168c948b01a9e593c5c4cc7cce7679a86c618b
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/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>
16 #define DRVNAME "sead3-led"
18 static struct platform_device *pdev;
20 static void sead3_pled_set(struct led_classdev *led_cdev,
21 enum led_brightness value)
23 pr_debug("sead3_pled_set\n");
24 writel(value, (void __iomem *)0xBF000210); /* FIXME */
27 static void sead3_fled_set(struct led_classdev *led_cdev,
28 enum led_brightness value)
30 pr_debug("sead3_fled_set\n");
31 writel(value, (void __iomem *)0xBF000218); /* FIXME */
34 static struct led_classdev sead3_pled = {
35 .name = "sead3::pled",
36 .brightness_set = sead3_pled_set,
37 .flags = LED_CORE_SUSPENDRESUME,
40 static struct led_classdev sead3_fled = {
41 .name = "sead3::fled",
42 .brightness_set = sead3_fled_set,
43 .flags = LED_CORE_SUSPENDRESUME,
46 static int sead3_led_probe(struct platform_device *pdev)
48 int ret;
50 ret = led_classdev_register(&pdev->dev, &sead3_pled);
51 if (ret < 0)
52 return ret;
54 ret = led_classdev_register(&pdev->dev, &sead3_fled);
55 if (ret < 0)
56 led_classdev_unregister(&sead3_pled);
58 return ret;
61 static int sead3_led_remove(struct platform_device *pdev)
63 led_classdev_unregister(&sead3_pled);
64 led_classdev_unregister(&sead3_fled);
65 return 0;
68 static struct platform_driver sead3_led_driver = {
69 .probe = sead3_led_probe,
70 .remove = sead3_led_remove,
71 .driver = {
72 .name = DRVNAME,
73 .owner = THIS_MODULE,
77 static int __init sead3_led_init(void)
79 int ret;
81 ret = platform_driver_register(&sead3_led_driver);
82 if (ret < 0)
83 goto out;
85 pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
86 if (IS_ERR(pdev)) {
87 ret = PTR_ERR(pdev);
88 platform_driver_unregister(&sead3_led_driver);
89 goto out;
92 out:
93 return ret;
96 static void __exit sead3_led_exit(void)
98 platform_device_unregister(pdev);
99 platform_driver_unregister(&sead3_led_driver);
102 module_init(sead3_led_init);
103 module_exit(sead3_led_exit);
105 MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
106 MODULE_DESCRIPTION("SEAD3 LED driver");
107 MODULE_LICENSE("GPL");