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>
14 #include <asm/mach-ralink/dev-gpio-leds.h>
16 void __init
ramips_register_gpio_leds(int id
, unsigned num_leds
,
17 struct gpio_led
*leds
)
19 struct platform_device
*pdev
;
20 struct gpio_led_platform_data pdata
;
24 p
= kmalloc(num_leds
* sizeof(*p
), GFP_KERNEL
);
28 memcpy(p
, leds
, num_leds
* sizeof(*p
));
30 pdev
= platform_device_alloc("leds-gpio", id
);
34 memset(&pdata
, 0, sizeof(pdata
));
35 pdata
.num_leds
= num_leds
;
38 err
= platform_device_add_data(pdev
, &pdata
, sizeof(pdata
));
42 err
= platform_device_add(pdev
);
49 platform_device_put(pdev
);