]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/mips/au1000/mtx-1/platform.c
[MIPS] Pb1200/DBAu1200 code style cleanup
[mirror_ubuntu-zesty-kernel.git] / arch / mips / au1000 / mtx-1 / platform.c
CommitLineData
26c288f8
FF
1/*
2 * MTX-1 platform devices registration
3 *
4 * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/init.h>
26c288f8
FF
22#include <linux/platform_device.h>
23#include <linux/leds.h>
f6ed10ab
FF
24#include <linux/gpio_keys.h>
25#include <linux/input.h>
26c288f8
FF
26
27#include <asm/gpio.h>
28
f6ed10ab
FF
29static struct gpio_keys_button mtx1_gpio_button[] = {
30 {
31 .gpio = 207,
32 .code = BTN_0,
33 .desc = "System button",
34 }
35};
36
37static struct gpio_keys_platform_data mtx1_buttons_data = {
38 .buttons = mtx1_gpio_button,
39 .nbuttons = ARRAY_SIZE(mtx1_gpio_button),
40};
41
42static struct platform_device mtx1_button = {
43 .name = "gpio-keys",
44 .id = -1,
45 .dev = {
46 .platform_data = &mtx1_buttons_data,
47 }
48};
49
26c288f8
FF
50static struct resource mtx1_wdt_res[] = {
51 [0] = {
52 .start = 15,
53 .end = 15,
54 .name = "mtx1-wdt-gpio",
55 .flags = IORESOURCE_IRQ,
56 }
57};
58
26c288f8
FF
59static struct platform_device mtx1_wdt = {
60 .name = "mtx1-wdt",
61 .id = 0,
62 .num_resources = ARRAY_SIZE(mtx1_wdt_res),
63 .resource = mtx1_wdt_res,
64};
65
66static struct gpio_led default_leds[] = {
67 {
68 .name = "mtx1:green",
69 .gpio = 211,
70 }, {
71 .name = "mtx1:red",
72 .gpio = 212,
73 },
74};
75
76static struct gpio_led_platform_data mtx1_led_data = {
77 .num_leds = ARRAY_SIZE(default_leds),
78 .leds = default_leds,
79};
80
81static struct platform_device mtx1_gpio_leds = {
82 .name = "leds-gpio",
83 .id = -1,
84 .dev = {
85 .platform_data = &mtx1_led_data,
86 }
87};
88
89static struct __initdata platform_device * mtx1_devs[] = {
90 &mtx1_gpio_leds,
f6ed10ab
FF
91 &mtx1_wdt,
92 &mtx1_button
26c288f8
FF
93};
94
95static int __init mtx1_register_devices(void)
96{
f6ed10ab 97 gpio_direction_input(207);
26c288f8
FF
98 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
99}
100
101arch_initcall(mtx1_register_devices);