2 * Ralink SoC GPIO LED device support
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/leds.h>
15 #include <asm/mach-ralink/dev_gpio_leds.h>
17 void __init
ramips_register_gpio_leds(int id
, unsigned num_leds
,
18 struct gpio_led
*leds
)
20 struct platform_device
*pdev
;
21 struct gpio_led_platform_data pdata
;
25 p
= kmalloc(num_leds
* sizeof(*p
), GFP_KERNEL
);
29 memcpy(p
, leds
, num_leds
* sizeof(*p
));
31 pdev
= platform_device_alloc("leds-gpio", id
);
35 memset(&pdata
, 0, sizeof(pdata
));
36 pdata
.num_leds
= num_leds
;
39 err
= platform_device_add_data(pdev
, &pdata
, sizeof(pdata
));
43 err
= platform_device_add(pdev
);
50 platform_device_put(pdev
);