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 | |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 16 | static void sead3_pled_set(struct led_classdev *led_cdev, |
| 17 | enum led_brightness value) |
| 18 | { |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 19 | writel(value, (void __iomem *)0xBF000210); /* FIXME */ |
| 20 | } |
| 21 | |
| 22 | static void sead3_fled_set(struct led_classdev *led_cdev, |
| 23 | enum led_brightness value) |
| 24 | { |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 25 | writel(value, (void __iomem *)0xBF000218); /* FIXME */ |
| 26 | } |
| 27 | |
| 28 | static struct led_classdev sead3_pled = { |
| 29 | .name = "sead3::pled", |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 30 | .brightness_set = sead3_pled_set, |
Lars-Peter Clausen | f4d1f2b | 2013-03-25 11:54:17 -0500 | [diff] [blame] | 31 | .flags = LED_CORE_SUSPENDRESUME, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | static struct led_classdev sead3_fled = { |
| 35 | .name = "sead3::fled", |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 36 | .brightness_set = sead3_fled_set, |
Lars-Peter Clausen | f4d1f2b | 2013-03-25 11:54:17 -0500 | [diff] [blame] | 37 | .flags = LED_CORE_SUSPENDRESUME, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 40 | static 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 | |
| 55 | static 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 | |
| 62 | static struct platform_driver sead3_led_driver = { |
| 63 | .probe = sead3_led_probe, |
| 64 | .remove = sead3_led_remove, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 65 | .driver = { |
Ralf Baechle | 2c0916d | 2015-03-27 21:57:36 +0100 | [diff] [blame^] | 66 | .name = "sead3-led", |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 67 | }, |
| 68 | }; |
| 69 | |
Ralf Baechle | 4558e09 | 2015-03-27 21:47:01 +0100 | [diff] [blame] | 70 | module_platform_driver(sead3_led_driver); |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 71 | |
| 72 | MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>"); |
| 73 | MODULE_DESCRIPTION("SEAD3 LED driver"); |
| 74 | MODULE_LICENSE("GPL"); |