blob: d2159cd720984642bd465f03a2af269c70b6873d [file] [log] [blame]
Steven J. Hill30700332012-05-30 21:02:49 +00001/*
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
Steven J. Hill30700332012-05-30 21:02:49 +000016static void sead3_pled_set(struct led_classdev *led_cdev,
17 enum led_brightness value)
18{
Steven J. Hill30700332012-05-30 21:02:49 +000019 writel(value, (void __iomem *)0xBF000210); /* FIXME */
20}
21
22static void sead3_fled_set(struct led_classdev *led_cdev,
23 enum led_brightness value)
24{
Steven J. Hill30700332012-05-30 21:02:49 +000025 writel(value, (void __iomem *)0xBF000218); /* FIXME */
26}
27
28static struct led_classdev sead3_pled = {
29 .name = "sead3::pled",
Ralf Baechle70342282013-01-22 12:59:30 +010030 .brightness_set = sead3_pled_set,
Lars-Peter Clausenf4d1f2b2013-03-25 11:54:17 -050031 .flags = LED_CORE_SUSPENDRESUME,
Steven J. Hill30700332012-05-30 21:02:49 +000032};
33
34static struct led_classdev sead3_fled = {
35 .name = "sead3::fled",
Ralf Baechle70342282013-01-22 12:59:30 +010036 .brightness_set = sead3_fled_set,
Lars-Peter Clausenf4d1f2b2013-03-25 11:54:17 -050037 .flags = LED_CORE_SUSPENDRESUME,
Steven J. Hill30700332012-05-30 21:02:49 +000038};
39
Steven J. Hill30700332012-05-30 21:02:49 +000040static 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
55static 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
62static struct platform_driver sead3_led_driver = {
63 .probe = sead3_led_probe,
64 .remove = sead3_led_remove,
Steven J. Hill30700332012-05-30 21:02:49 +000065 .driver = {
Ralf Baechle2c0916d2015-03-27 21:57:36 +010066 .name = "sead3-led",
Steven J. Hill30700332012-05-30 21:02:49 +000067 },
68};
69
Ralf Baechle4558e092015-03-27 21:47:01 +010070module_platform_driver(sead3_led_driver);
Steven J. Hill30700332012-05-30 21:02:49 +000071
72MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
73MODULE_DESCRIPTION("SEAD3 LED driver");
74MODULE_LICENSE("GPL");