diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2014-02-27 08:44:17 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-03-28 05:54:15 -0400 |
commit | 1dc7d8374dccf2815294ceb6a1092253f45ba860 (patch) | |
tree | beb594f2cc4adb185b4fd727a29c36860cdb2cfa /arch/arm/plat-versatile | |
parent | e4ecf2bda239ddef5f4edd0e05d48bfdf88a475d (diff) |
ARM/leds: move ARM Versatile LED driver to leds subsystem
Now that we have converted this driver to a real platform device
module-based thing, we move the driver down into the LEDs
subsystem and rename the config option to LEDS_VERSATILE.
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Pawel Moll <pawel.moll@arm.com>
Acked-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/plat-versatile')
-rw-r--r-- | arch/arm/plat-versatile/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/plat-versatile/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-versatile/leds.c | 110 |
3 files changed, 0 insertions, 117 deletions
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig index 2c4332b9f948..fce41e93b6a4 100644 --- a/arch/arm/plat-versatile/Kconfig +++ b/arch/arm/plat-versatile/Kconfig | |||
@@ -6,12 +6,6 @@ config PLAT_VERSATILE_CLOCK | |||
6 | config PLAT_VERSATILE_CLCD | 6 | config PLAT_VERSATILE_CLCD |
7 | bool | 7 | bool |
8 | 8 | ||
9 | config PLAT_VERSATILE_LEDS | ||
10 | def_bool y if NEW_LEDS | ||
11 | depends on ARCH_REALVIEW || ARCH_VERSATILE | ||
12 | select LEDS_CLASS | ||
13 | select LEDS_TRIGGERS | ||
14 | |||
15 | config PLAT_VERSATILE_SCHED_CLOCK | 9 | config PLAT_VERSATILE_SCHED_CLOCK |
16 | def_bool y | 10 | def_bool y |
17 | 11 | ||
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile index f88d448b629c..2e0c472958ae 100644 --- a/arch/arm/plat-versatile/Makefile +++ b/arch/arm/plat-versatile/Makefile | |||
@@ -2,6 +2,5 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include | |||
2 | 2 | ||
3 | obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o | 3 | obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o |
4 | obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o | 4 | obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o |
5 | obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o | ||
6 | obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o | 5 | obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o |
7 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o | 6 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o |
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c deleted file mode 100644 index 80553022d661..000000000000 --- a/arch/arm/plat-versatile/leds.c +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for the 8 user LEDs found on the RealViews and Versatiles | ||
3 | * Based on DaVinci's DM365 board code | ||
4 | * | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | * Author: Linus Walleij <triad@df.lth.se> | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/leds.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | struct versatile_led { | ||
17 | void __iomem *base; | ||
18 | struct led_classdev cdev; | ||
19 | u8 mask; | ||
20 | }; | ||
21 | |||
22 | /* | ||
23 | * The triggers lines up below will only be used if the | ||
24 | * LED triggers are compiled in. | ||
25 | */ | ||
26 | static const struct { | ||
27 | const char *name; | ||
28 | const char *trigger; | ||
29 | } versatile_leds[] = { | ||
30 | { "versatile:0", "heartbeat", }, | ||
31 | { "versatile:1", "mmc0", }, | ||
32 | { "versatile:2", "cpu0" }, | ||
33 | { "versatile:3", "cpu1" }, | ||
34 | { "versatile:4", "cpu2" }, | ||
35 | { "versatile:5", "cpu3" }, | ||
36 | { "versatile:6", }, | ||
37 | { "versatile:7", }, | ||
38 | }; | ||
39 | |||
40 | static void versatile_led_set(struct led_classdev *cdev, | ||
41 | enum led_brightness b) | ||
42 | { | ||
43 | struct versatile_led *led = container_of(cdev, | ||
44 | struct versatile_led, cdev); | ||
45 | u32 reg = readl(led->base); | ||
46 | |||
47 | if (b != LED_OFF) | ||
48 | reg |= led->mask; | ||
49 | else | ||
50 | reg &= ~led->mask; | ||
51 | writel(reg, led->base); | ||
52 | } | ||
53 | |||
54 | static enum led_brightness versatile_led_get(struct led_classdev *cdev) | ||
55 | { | ||
56 | struct versatile_led *led = container_of(cdev, | ||
57 | struct versatile_led, cdev); | ||
58 | u32 reg = readl(led->base); | ||
59 | |||
60 | return (reg & led->mask) ? LED_FULL : LED_OFF; | ||
61 | } | ||
62 | |||
63 | static int versatile_leds_probe(struct platform_device *dev) | ||
64 | { | ||
65 | int i; | ||
66 | struct resource *res; | ||
67 | void __iomem *base; | ||
68 | |||
69 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
70 | base = devm_ioremap_resource(&dev->dev, res); | ||
71 | if (IS_ERR(base)) | ||
72 | return PTR_ERR(base); | ||
73 | |||
74 | /* All off */ | ||
75 | writel(0, base); | ||
76 | for (i = 0; i < ARRAY_SIZE(versatile_leds); i++) { | ||
77 | struct versatile_led *led; | ||
78 | |||
79 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
80 | if (!led) | ||
81 | break; | ||
82 | |||
83 | led->base = base; | ||
84 | led->cdev.name = versatile_leds[i].name; | ||
85 | led->cdev.brightness_set = versatile_led_set; | ||
86 | led->cdev.brightness_get = versatile_led_get; | ||
87 | led->cdev.default_trigger = versatile_leds[i].trigger; | ||
88 | led->mask = BIT(i); | ||
89 | |||
90 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
91 | kfree(led); | ||
92 | break; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static struct platform_driver versatile_leds_driver = { | ||
100 | .driver = { | ||
101 | .name = "versatile-leds", | ||
102 | }, | ||
103 | .probe = versatile_leds_probe, | ||
104 | }; | ||
105 | |||
106 | module_platform_driver(versatile_leds_driver); | ||
107 | |||
108 | MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); | ||
109 | MODULE_DESCRIPTION("ARM Versatile LED driver"); | ||
110 | MODULE_LICENSE("GPL v2"); | ||