2 +++ b/arch/mips/include/asm/mach-lantiq/dev-leds-gpio.h
5 + * Lantiq GPIO LED device support
7 + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
8 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
10 + * This program is free software; you can redistribute it and/or modify it
11 + * under the terms of the GNU General Public License version 2 as published
12 + * by the Free Software Foundation.
15 +#ifndef _LANTIQ_DEV_LEDS_GPIO_H
16 +#define _LANTIQ_DEV_LEDS_GPIO_H
18 +#include <linux/leds.h>
20 +void ltq_add_device_leds_gpio(int id,
22 + struct gpio_led *leds) __init;
24 +#endif /* _LANTIQ_DEV_LEDS_GPIO_H */
26 +++ b/arch/mips/lantiq/dev-leds-gpio.c
29 + * Lantiq GPIO LED device support
31 + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
32 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
34 + * Parts of this file are based on Atheros' 2.6.15 BSP
36 + * This program is free software; you can redistribute it and/or modify it
37 + * under the terms of the GNU General Public License version 2 as published
38 + * by the Free Software Foundation.
41 +#include <linux/init.h>
42 +#include <linux/slab.h>
43 +#include <linux/platform_device.h>
45 +#include "dev-leds-gpio.h"
47 +void __init ltq_add_device_leds_gpio(int id, unsigned num_leds,
48 + struct gpio_led *leds)
50 + struct platform_device *pdev;
51 + struct gpio_led_platform_data pdata;
55 + p = kmalloc(num_leds * sizeof(*p), GFP_KERNEL);
59 + memcpy(p, leds, num_leds * sizeof(*p));
61 + pdev = platform_device_alloc("leds-gpio", id);
65 + memset(&pdata, 0, sizeof(pdata));
66 + pdata.num_leds = num_leds;
69 + err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
73 + err = platform_device_add(pdev);
80 + platform_device_put(pdev);
85 --- a/arch/mips/lantiq/Makefile
86 +++ b/arch/mips/lantiq/Makefile
88 # under the terms of the GNU General Public License version 2 as published
89 # by the Free Software Foundation.
91 -obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o
92 +obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o dev-leds-gpio.o
94 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o