blob: 1d1e8b3319251f5f6e944c74901530dc39889d5c [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
16#define DRVNAME "sead3-led"
17
Steven J. Hill30700332012-05-30 21:02:49 +000018static void sead3_pled_set(struct led_classdev *led_cdev,
19 enum led_brightness value)
20{
21 pr_debug("sead3_pled_set\n");
22 writel(value, (void __iomem *)0xBF000210); /* FIXME */
23}
24
25static void sead3_fled_set(struct led_classdev *led_cdev,
26 enum led_brightness value)
27{
28 pr_debug("sead3_fled_set\n");
29 writel(value, (void __iomem *)0xBF000218); /* FIXME */
30}
31
32static struct led_classdev sead3_pled = {
33 .name = "sead3::pled",
Ralf Baechle70342282013-01-22 12:59:30 +010034 .brightness_set = sead3_pled_set,
Lars-Peter Clausenf4d1f2b2013-03-25 11:54:17 -050035 .flags = LED_CORE_SUSPENDRESUME,
Steven J. Hill30700332012-05-30 21:02:49 +000036};
37
38static struct led_classdev sead3_fled = {
39 .name = "sead3::fled",
Ralf Baechle70342282013-01-22 12:59:30 +010040 .brightness_set = sead3_fled_set,
Lars-Peter Clausenf4d1f2b2013-03-25 11:54:17 -050041 .flags = LED_CORE_SUSPENDRESUME,
Steven J. Hill30700332012-05-30 21:02:49 +000042};
43
Steven J. Hill30700332012-05-30 21:02:49 +000044static int sead3_led_probe(struct platform_device *pdev)
45{
46 int ret;
47
48 ret = led_classdev_register(&pdev->dev, &sead3_pled);
49 if (ret < 0)
50 return ret;
51
52 ret = led_classdev_register(&pdev->dev, &sead3_fled);
53 if (ret < 0)
54 led_classdev_unregister(&sead3_pled);
55
56 return ret;
57}
58
59static int sead3_led_remove(struct platform_device *pdev)
60{
61 led_classdev_unregister(&sead3_pled);
62 led_classdev_unregister(&sead3_fled);
63 return 0;
64}
65
66static struct platform_driver sead3_led_driver = {
67 .probe = sead3_led_probe,
68 .remove = sead3_led_remove,
Steven J. Hill30700332012-05-30 21:02:49 +000069 .driver = {
70 .name = DRVNAME,
Steven J. Hill30700332012-05-30 21:02:49 +000071 },
72};
73
Ralf Baechle4558e092015-03-27 21:47:01 +010074module_platform_driver(sead3_led_driver);
Steven J. Hill30700332012-05-30 21:02:49 +000075
76MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
77MODULE_DESCRIPTION("SEAD3 LED driver");
78MODULE_LICENSE("GPL");