Merge tag 'gcc-plugins-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / leds / leds-sead3.c
blobeb97a3271bb37a265d885f68df82f31e13b15c8c
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 * Copyright (C) 2015 Imagination Technologies, Inc.
8 */
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>
15 #include <linux/io.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)
45 int ret;
47 ret = led_classdev_register(&pdev->dev, &sead3_pled);
48 if (ret < 0)
49 return ret;
51 ret = led_classdev_register(&pdev->dev, &sead3_fled);
52 if (ret < 0)
53 led_classdev_unregister(&sead3_pled);
55 return ret;
58 static int sead3_led_remove(struct platform_device *pdev)
60 led_classdev_unregister(&sead3_pled);
61 led_classdev_unregister(&sead3_fled);
63 return 0;
66 static struct platform_driver sead3_led_driver = {
67 .probe = sead3_led_probe,
68 .remove = sead3_led_remove,
69 .driver = {
70 .name = "sead3-led",
74 module_platform_driver(sead3_led_driver);
76 MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
77 MODULE_DESCRIPTION("SEAD3 LED driver");
78 MODULE_LICENSE("GPL");