Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 1 | /* |
| 2 | * leds-ns2.c - Driver for the Network Space v2 (and parents) dual-GPIO LED |
| 3 | * |
| 4 | * Copyright (C) 2010 LaCie |
| 5 | * |
| 6 | * Author: Simon Guinot <sguinot@lacie.com> |
| 7 | * |
| 8 | * Based on leds-gpio.c by Raphael Assenat <raph@8d.com> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 | */ |
| 24 | |
| 25 | #include <linux/kernel.h> |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/slab.h> |
| 28 | #include <linux/gpio.h> |
| 29 | #include <linux/leds.h> |
Paul Gortmaker | 54f4ded | 2011-07-03 13:56:03 -0400 | [diff] [blame] | 30 | #include <linux/module.h> |
Arnd Bergmann | c02cecb | 2012-08-24 15:21:54 +0200 | [diff] [blame] | 31 | #include <linux/platform_data/leds-kirkwood-ns2.h> |
Sachin Kamat | c68f46d | 2013-09-28 04:38:30 -0700 | [diff] [blame] | 32 | #include <linux/of.h> |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 33 | #include <linux/of_gpio.h> |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 34 | |
| 35 | /* |
| 36 | * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in |
| 37 | * relation with the SATA activity. This capability is exposed through the |
| 38 | * "sata" sysfs attribute. |
| 39 | * |
| 40 | * The following array detail the different LED registers and the combination |
| 41 | * of their possible values: |
| 42 | * |
| 43 | * cmd_led | slow_led | /SATA active | LED state |
| 44 | * | | | |
| 45 | * 1 | 0 | x | off |
| 46 | * - | 1 | x | on |
| 47 | * 0 | 0 | 1 | on |
| 48 | * 0 | 0 | 0 | blink (rate 300ms) |
| 49 | */ |
| 50 | |
| 51 | enum ns2_led_modes { |
| 52 | NS_V2_LED_OFF, |
| 53 | NS_V2_LED_ON, |
| 54 | NS_V2_LED_SATA, |
| 55 | }; |
| 56 | |
| 57 | struct ns2_led_mode_value { |
| 58 | enum ns2_led_modes mode; |
| 59 | int cmd_level; |
| 60 | int slow_level; |
| 61 | }; |
| 62 | |
| 63 | static struct ns2_led_mode_value ns2_led_modval[] = { |
| 64 | { NS_V2_LED_OFF , 1, 0 }, |
| 65 | { NS_V2_LED_ON , 0, 1 }, |
| 66 | { NS_V2_LED_ON , 1, 1 }, |
| 67 | { NS_V2_LED_SATA, 0, 0 }, |
| 68 | }; |
| 69 | |
| 70 | struct ns2_led_data { |
| 71 | struct led_classdev cdev; |
| 72 | unsigned cmd; |
| 73 | unsigned slow; |
| 74 | unsigned char sata; /* True when SATA mode active. */ |
| 75 | rwlock_t rw_lock; /* Lock GPIOs. */ |
| 76 | }; |
| 77 | |
| 78 | static int ns2_led_get_mode(struct ns2_led_data *led_dat, |
| 79 | enum ns2_led_modes *mode) |
| 80 | { |
| 81 | int i; |
| 82 | int ret = -EINVAL; |
| 83 | int cmd_level; |
| 84 | int slow_level; |
| 85 | |
Simon Guinot | f539dfe | 2010-09-19 15:30:59 +0200 | [diff] [blame] | 86 | read_lock_irq(&led_dat->rw_lock); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 87 | |
| 88 | cmd_level = gpio_get_value(led_dat->cmd); |
| 89 | slow_level = gpio_get_value(led_dat->slow); |
| 90 | |
| 91 | for (i = 0; i < ARRAY_SIZE(ns2_led_modval); i++) { |
| 92 | if (cmd_level == ns2_led_modval[i].cmd_level && |
| 93 | slow_level == ns2_led_modval[i].slow_level) { |
| 94 | *mode = ns2_led_modval[i].mode; |
| 95 | ret = 0; |
| 96 | break; |
| 97 | } |
| 98 | } |
| 99 | |
Simon Guinot | f539dfe | 2010-09-19 15:30:59 +0200 | [diff] [blame] | 100 | read_unlock_irq(&led_dat->rw_lock); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 101 | |
| 102 | return ret; |
| 103 | } |
| 104 | |
| 105 | static void ns2_led_set_mode(struct ns2_led_data *led_dat, |
| 106 | enum ns2_led_modes mode) |
| 107 | { |
| 108 | int i; |
Simon Guinot | f539dfe | 2010-09-19 15:30:59 +0200 | [diff] [blame] | 109 | unsigned long flags; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 110 | |
Simon Guinot | f539dfe | 2010-09-19 15:30:59 +0200 | [diff] [blame] | 111 | write_lock_irqsave(&led_dat->rw_lock, flags); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 112 | |
| 113 | for (i = 0; i < ARRAY_SIZE(ns2_led_modval); i++) { |
| 114 | if (mode == ns2_led_modval[i].mode) { |
| 115 | gpio_set_value(led_dat->cmd, |
| 116 | ns2_led_modval[i].cmd_level); |
| 117 | gpio_set_value(led_dat->slow, |
| 118 | ns2_led_modval[i].slow_level); |
| 119 | } |
| 120 | } |
| 121 | |
Simon Guinot | f539dfe | 2010-09-19 15:30:59 +0200 | [diff] [blame] | 122 | write_unlock_irqrestore(&led_dat->rw_lock, flags); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | static void ns2_led_set(struct led_classdev *led_cdev, |
| 126 | enum led_brightness value) |
| 127 | { |
| 128 | struct ns2_led_data *led_dat = |
| 129 | container_of(led_cdev, struct ns2_led_data, cdev); |
| 130 | enum ns2_led_modes mode; |
| 131 | |
| 132 | if (value == LED_OFF) |
| 133 | mode = NS_V2_LED_OFF; |
| 134 | else if (led_dat->sata) |
| 135 | mode = NS_V2_LED_SATA; |
| 136 | else |
| 137 | mode = NS_V2_LED_ON; |
| 138 | |
| 139 | ns2_led_set_mode(led_dat, mode); |
| 140 | } |
| 141 | |
| 142 | static ssize_t ns2_led_sata_store(struct device *dev, |
| 143 | struct device_attribute *attr, |
| 144 | const char *buff, size_t count) |
| 145 | { |
Simon Guinot | e5971bb | 2010-10-07 16:35:40 +0200 | [diff] [blame] | 146 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
| 147 | struct ns2_led_data *led_dat = |
| 148 | container_of(led_cdev, struct ns2_led_data, cdev); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 149 | int ret; |
| 150 | unsigned long enable; |
| 151 | enum ns2_led_modes mode; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 152 | |
Jingoo Han | 3874350 | 2012-10-23 05:25:35 -0700 | [diff] [blame] | 153 | ret = kstrtoul(buff, 10, &enable); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 154 | if (ret < 0) |
| 155 | return ret; |
| 156 | |
| 157 | enable = !!enable; |
| 158 | |
| 159 | if (led_dat->sata == enable) |
| 160 | return count; |
| 161 | |
| 162 | ret = ns2_led_get_mode(led_dat, &mode); |
| 163 | if (ret < 0) |
| 164 | return ret; |
| 165 | |
| 166 | if (enable && mode == NS_V2_LED_ON) |
| 167 | ns2_led_set_mode(led_dat, NS_V2_LED_SATA); |
| 168 | if (!enable && mode == NS_V2_LED_SATA) |
| 169 | ns2_led_set_mode(led_dat, NS_V2_LED_ON); |
| 170 | |
| 171 | led_dat->sata = enable; |
| 172 | |
| 173 | return count; |
| 174 | } |
| 175 | |
| 176 | static ssize_t ns2_led_sata_show(struct device *dev, |
| 177 | struct device_attribute *attr, char *buf) |
| 178 | { |
Simon Guinot | e5971bb | 2010-10-07 16:35:40 +0200 | [diff] [blame] | 179 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
| 180 | struct ns2_led_data *led_dat = |
| 181 | container_of(led_cdev, struct ns2_led_data, cdev); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 182 | |
| 183 | return sprintf(buf, "%d\n", led_dat->sata); |
| 184 | } |
| 185 | |
| 186 | static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store); |
| 187 | |
Johan Hovold | 475f854 | 2014-06-25 10:08:51 -0700 | [diff] [blame] | 188 | static struct attribute *ns2_led_attrs[] = { |
| 189 | &dev_attr_sata.attr, |
| 190 | NULL |
| 191 | }; |
| 192 | ATTRIBUTE_GROUPS(ns2_led); |
| 193 | |
Bill Pemberton | 98ea1ea | 2012-11-19 13:23:02 -0500 | [diff] [blame] | 194 | static int |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 195 | create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, |
| 196 | const struct ns2_led *template) |
| 197 | { |
| 198 | int ret; |
| 199 | enum ns2_led_modes mode; |
| 200 | |
Sachin Kamat | 0419582 | 2012-11-25 10:28:10 +0530 | [diff] [blame] | 201 | ret = devm_gpio_request_one(&pdev->dev, template->cmd, |
Jingoo Han | 9d04cba | 2013-03-07 18:38:26 -0800 | [diff] [blame] | 202 | gpio_get_value(template->cmd) ? |
| 203 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, |
Jingoo Han | 31c3dc7 | 2012-10-23 05:18:21 -0700 | [diff] [blame] | 204 | template->name); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 205 | if (ret) { |
| 206 | dev_err(&pdev->dev, "%s: failed to setup command GPIO\n", |
| 207 | template->name); |
Jingoo Han | 31c3dc7 | 2012-10-23 05:18:21 -0700 | [diff] [blame] | 208 | return ret; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 209 | } |
| 210 | |
Sachin Kamat | 0419582 | 2012-11-25 10:28:10 +0530 | [diff] [blame] | 211 | ret = devm_gpio_request_one(&pdev->dev, template->slow, |
Jingoo Han | 9d04cba | 2013-03-07 18:38:26 -0800 | [diff] [blame] | 212 | gpio_get_value(template->slow) ? |
| 213 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, |
Jingoo Han | 31c3dc7 | 2012-10-23 05:18:21 -0700 | [diff] [blame] | 214 | template->name); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 215 | if (ret) { |
| 216 | dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n", |
| 217 | template->name); |
Sachin Kamat | 0419582 | 2012-11-25 10:28:10 +0530 | [diff] [blame] | 218 | return ret; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | rwlock_init(&led_dat->rw_lock); |
| 222 | |
| 223 | led_dat->cdev.name = template->name; |
| 224 | led_dat->cdev.default_trigger = template->default_trigger; |
| 225 | led_dat->cdev.blink_set = NULL; |
| 226 | led_dat->cdev.brightness_set = ns2_led_set; |
| 227 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; |
Johan Hovold | 475f854 | 2014-06-25 10:08:51 -0700 | [diff] [blame] | 228 | led_dat->cdev.groups = ns2_led_groups; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 229 | led_dat->cmd = template->cmd; |
| 230 | led_dat->slow = template->slow; |
| 231 | |
| 232 | ret = ns2_led_get_mode(led_dat, &mode); |
| 233 | if (ret < 0) |
Sachin Kamat | 0419582 | 2012-11-25 10:28:10 +0530 | [diff] [blame] | 234 | return ret; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 235 | |
| 236 | /* Set LED initial state. */ |
| 237 | led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0; |
| 238 | led_dat->cdev.brightness = |
| 239 | (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL; |
| 240 | |
| 241 | ret = led_classdev_register(&pdev->dev, &led_dat->cdev); |
| 242 | if (ret < 0) |
Sachin Kamat | 0419582 | 2012-11-25 10:28:10 +0530 | [diff] [blame] | 243 | return ret; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 244 | |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 245 | return 0; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 246 | } |
| 247 | |
Arnd Bergmann | b8cd742 | 2012-05-10 13:01:46 -0700 | [diff] [blame] | 248 | static void delete_ns2_led(struct ns2_led_data *led_dat) |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 249 | { |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 250 | led_classdev_unregister(&led_dat->cdev); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 251 | } |
| 252 | |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 253 | #ifdef CONFIG_OF_GPIO |
| 254 | /* |
| 255 | * Translate OpenFirmware node properties into platform_data. |
| 256 | */ |
Linus Torvalds | cf4af01 | 2012-12-12 12:14:06 -0800 | [diff] [blame] | 257 | static int |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 258 | ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) |
| 259 | { |
| 260 | struct device_node *np = dev->of_node; |
| 261 | struct device_node *child; |
| 262 | struct ns2_led *leds; |
| 263 | int num_leds = 0; |
| 264 | int i = 0; |
| 265 | |
| 266 | num_leds = of_get_child_count(np); |
| 267 | if (!num_leds) |
| 268 | return -ENODEV; |
| 269 | |
| 270 | leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led), |
| 271 | GFP_KERNEL); |
| 272 | if (!leds) |
| 273 | return -ENOMEM; |
| 274 | |
| 275 | for_each_child_of_node(np, child) { |
| 276 | const char *string; |
| 277 | int ret; |
| 278 | |
| 279 | ret = of_get_named_gpio(child, "cmd-gpio", 0); |
| 280 | if (ret < 0) |
| 281 | return ret; |
| 282 | leds[i].cmd = ret; |
| 283 | ret = of_get_named_gpio(child, "slow-gpio", 0); |
| 284 | if (ret < 0) |
| 285 | return ret; |
| 286 | leds[i].slow = ret; |
| 287 | ret = of_property_read_string(child, "label", &string); |
| 288 | leds[i].name = (ret == 0) ? string : child->name; |
| 289 | ret = of_property_read_string(child, "linux,default-trigger", |
| 290 | &string); |
| 291 | if (ret == 0) |
| 292 | leds[i].default_trigger = string; |
| 293 | |
| 294 | i++; |
| 295 | } |
| 296 | |
| 297 | pdata->leds = leds; |
| 298 | pdata->num_leds = num_leds; |
| 299 | |
| 300 | return 0; |
| 301 | } |
| 302 | |
| 303 | static const struct of_device_id of_ns2_leds_match[] = { |
| 304 | { .compatible = "lacie,ns2-leds", }, |
| 305 | {}, |
| 306 | }; |
| 307 | #endif /* CONFIG_OF_GPIO */ |
| 308 | |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 309 | struct ns2_led_priv { |
| 310 | int num_leds; |
| 311 | struct ns2_led_data leds_data[]; |
| 312 | }; |
| 313 | |
| 314 | static inline int sizeof_ns2_led_priv(int num_leds) |
| 315 | { |
| 316 | return sizeof(struct ns2_led_priv) + |
| 317 | (sizeof(struct ns2_led_data) * num_leds); |
| 318 | } |
| 319 | |
Bill Pemberton | 98ea1ea | 2012-11-19 13:23:02 -0500 | [diff] [blame] | 320 | static int ns2_led_probe(struct platform_device *pdev) |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 321 | { |
Jingoo Han | 87aae1e | 2013-07-30 01:07:35 -0700 | [diff] [blame] | 322 | struct ns2_led_platform_data *pdata = dev_get_platdata(&pdev->dev); |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 323 | struct ns2_led_priv *priv; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 324 | int i; |
| 325 | int ret; |
| 326 | |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 327 | #ifdef CONFIG_OF_GPIO |
| 328 | if (!pdata) { |
| 329 | pdata = devm_kzalloc(&pdev->dev, |
| 330 | sizeof(struct ns2_led_platform_data), |
| 331 | GFP_KERNEL); |
| 332 | if (!pdata) |
| 333 | return -ENOMEM; |
| 334 | |
| 335 | ret = ns2_leds_get_of_pdata(&pdev->dev, pdata); |
| 336 | if (ret) |
| 337 | return ret; |
| 338 | } |
| 339 | #else |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 340 | if (!pdata) |
| 341 | return -EINVAL; |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 342 | #endif /* CONFIG_OF_GPIO */ |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 343 | |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 344 | priv = devm_kzalloc(&pdev->dev, |
| 345 | sizeof_ns2_led_priv(pdata->num_leds), GFP_KERNEL); |
| 346 | if (!priv) |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 347 | return -ENOMEM; |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 348 | priv->num_leds = pdata->num_leds; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 349 | |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 350 | for (i = 0; i < priv->num_leds; i++) { |
| 351 | ret = create_ns2_led(pdev, &priv->leds_data[i], |
| 352 | &pdata->leds[i]); |
Bryan Wu | a209f76 | 2012-07-04 12:30:50 +0800 | [diff] [blame] | 353 | if (ret < 0) { |
| 354 | for (i = i - 1; i >= 0; i--) |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 355 | delete_ns2_led(&priv->leds_data[i]); |
Bryan Wu | a209f76 | 2012-07-04 12:30:50 +0800 | [diff] [blame] | 356 | return ret; |
| 357 | } |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 358 | } |
| 359 | |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 360 | platform_set_drvdata(pdev, priv); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 361 | |
| 362 | return 0; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 363 | } |
| 364 | |
Bill Pemberton | 678e8a6 | 2012-11-19 13:26:00 -0500 | [diff] [blame] | 365 | static int ns2_led_remove(struct platform_device *pdev) |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 366 | { |
| 367 | int i; |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 368 | struct ns2_led_priv *priv; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 369 | |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 370 | priv = platform_get_drvdata(pdev); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 371 | |
Simon Guinot | 3de1929 | 2013-03-19 11:07:29 -0700 | [diff] [blame] | 372 | for (i = 0; i < priv->num_leds; i++) |
| 373 | delete_ns2_led(&priv->leds_data[i]); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 374 | |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 375 | return 0; |
| 376 | } |
| 377 | |
| 378 | static struct platform_driver ns2_led_driver = { |
| 379 | .probe = ns2_led_probe, |
Bill Pemberton | df07cf8 | 2012-11-19 13:20:20 -0500 | [diff] [blame] | 380 | .remove = ns2_led_remove, |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 381 | .driver = { |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 382 | .name = "leds-ns2", |
Simon Guinot | 72052fc | 2012-10-17 12:09:03 +0200 | [diff] [blame] | 383 | .of_match_table = of_match_ptr(of_ns2_leds_match), |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 384 | }, |
| 385 | }; |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 386 | |
Axel Lin | 892a884 | 2012-01-10 15:09:24 -0800 | [diff] [blame] | 387 | module_platform_driver(ns2_led_driver); |
Simon Guinot | 11efe71 | 2010-07-06 16:08:46 +0200 | [diff] [blame] | 388 | |
| 389 | MODULE_AUTHOR("Simon Guinot <sguinot@lacie.com>"); |
| 390 | MODULE_DESCRIPTION("Network Space v2 LED driver"); |
| 391 | MODULE_LICENSE("GPL"); |
Axel Lin | 892a884 | 2012-01-10 15:09:24 -0800 | [diff] [blame] | 392 | MODULE_ALIAS("platform:leds-ns2"); |