Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 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. |
| 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. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 18 | static 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 | |
| 25 | static 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 | |
| 32 | static struct led_classdev sead3_pled = { |
| 33 | .name = "sead3::pled", |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 34 | .brightness_set = sead3_pled_set, |
Lars-Peter Clausen | f4d1f2b | 2013-03-25 11:54:17 -0500 | [diff] [blame] | 35 | .flags = LED_CORE_SUSPENDRESUME, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | static struct led_classdev sead3_fled = { |
| 39 | .name = "sead3::fled", |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 40 | .brightness_set = sead3_fled_set, |
Lars-Peter Clausen | f4d1f2b | 2013-03-25 11:54:17 -0500 | [diff] [blame] | 41 | .flags = LED_CORE_SUSPENDRESUME, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 44 | static 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 | |
| 59 | static 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 | |
| 66 | static struct platform_driver sead3_led_driver = { |
| 67 | .probe = sead3_led_probe, |
| 68 | .remove = sead3_led_remove, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 69 | .driver = { |
| 70 | .name = DRVNAME, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 71 | }, |
| 72 | }; |
| 73 | |
Ralf Baechle | 4558e09 | 2015-03-27 21:47:01 +0100 | [diff] [blame^] | 74 | module_platform_driver(sead3_led_driver); |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 75 | |
| 76 | MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>"); |
| 77 | MODULE_DESCRIPTION("SEAD3 LED driver"); |
| 78 | MODULE_LICENSE("GPL"); |