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/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>
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
)
50 ret
= led_classdev_register(&pdev
->dev
, &sead3_pled
);
54 ret
= led_classdev_register(&pdev
->dev
, &sead3_fled
);
56 led_classdev_unregister(&sead3_pled
);
61 static int sead3_led_remove(struct platform_device
*pdev
)
63 led_classdev_unregister(&sead3_pled
);
64 led_classdev_unregister(&sead3_fled
);
68 static struct platform_driver sead3_led_driver
= {
69 .probe
= sead3_led_probe
,
70 .remove
= sead3_led_remove
,
77 static int __init
sead3_led_init(void)
81 ret
= platform_driver_register(&sead3_led_driver
);
85 pdev
= platform_device_register_simple(DRVNAME
, -1, NULL
, 0);
88 platform_driver_unregister(&sead3_led_driver
);
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");