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.
7 * Copyright (C) 2015 Imagination Technologies, Inc.
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/leds.h>
14 #include <linux/err.h>
17 #include <asm/mips-boards/sead3-addr.h>
19 static void sead3_pled_set(struct led_classdev
*led_cdev
,
20 enum led_brightness value
)
22 writel(value
, (void __iomem
*)SEAD3_CPLD_P_LED
);
25 static void sead3_fled_set(struct led_classdev
*led_cdev
,
26 enum led_brightness value
)
28 writel(value
, (void __iomem
*)SEAD3_CPLD_F_LED
);
31 static struct led_classdev sead3_pled
= {
32 .name
= "sead3::pled",
33 .brightness_set
= sead3_pled_set
,
34 .flags
= LED_CORE_SUSPENDRESUME
,
37 static struct led_classdev sead3_fled
= {
38 .name
= "sead3::fled",
39 .brightness_set
= sead3_fled_set
,
40 .flags
= LED_CORE_SUSPENDRESUME
,
43 static int sead3_led_probe(struct platform_device
*pdev
)
47 ret
= led_classdev_register(&pdev
->dev
, &sead3_pled
);
51 ret
= led_classdev_register(&pdev
->dev
, &sead3_fled
);
53 led_classdev_unregister(&sead3_pled
);
58 static int sead3_led_remove(struct platform_device
*pdev
)
60 led_classdev_unregister(&sead3_pled
);
61 led_classdev_unregister(&sead3_fled
);
65 static struct platform_driver sead3_led_driver
= {
66 .probe
= sead3_led_probe
,
67 .remove
= sead3_led_remove
,
73 module_platform_driver(sead3_led_driver
);
75 MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
76 MODULE_DESCRIPTION("SEAD3 LED driver");
77 MODULE_LICENSE("GPL");