summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/board-snowball-digio.c
blob: b8fc1c033b7c964c91e8b76d6b84855083a7657f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

/*
 * This defines the user led (output) and 4-keys gpio keyboard (input)
 * Original code by Gregory Hermant
 * Split to a standalone file by Alessandro Rubini
 */
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/leds.h>
#include <plat/pincfg.h>
#include <plat/gpio.h>
#include "pins-db5500.h"

static pin_cfg_t snowball_pins[] = {
	PIN_CFG(32, GPIO)     | PIN_INPUT_PULLUP, /* led */
	PIN_CFG(151, GPIO)	| PIN_INPUT_PULLUP, /* button */
	PIN_CFG(152, GPIO)	| PIN_INPUT_PULLUP, /* button */
/*	PIN_CFG(161, GPIO)	| PIN_INPUT_PULLUP,  button */
	PIN_CFG(162, GPIO)	| PIN_INPUT_PULLUP, /* button */
};

static struct gpio_led snowball_led_array[] = {
	{
		.name = "user_led",
		.default_trigger = "none",
		.gpio = 142,
	},
};

static struct gpio_led_platform_data snowball_led_data = {
	.leds = snowball_led_array,
	.num_leds = ARRAY_SIZE(snowball_led_array),
};

static struct platform_device snowball_led_dev = {
	.name = "leds-gpio",
	.dev = {
		.platform_data = &snowball_led_data,
	},
};

static struct gpio_keys_button snowball_key_array[] = {
	{
		.gpio		= 32,
		.type		= EV_KEY,
		.code		= KEY_1,
		.desc		= "userpb",
		.active_low	= 1,
		.debounce_interval = 50,
		.wakeup		= 1,
	},
	{
		.gpio		= 151,
		.type		= EV_KEY,
		.code		= KEY_2,
		.desc		= "extkb1",
		.active_low	= 1,
		.debounce_interval = 50,
		.wakeup		= 1,
	},
	{
		.gpio		= 152,
		.type		= EV_KEY,
		.code		= KEY_3,
		.desc		= "extkb2",
		.active_low	= 1,
		.debounce_interval = 50,
		.wakeup		= 1,
	},
	/*
	{
		.gpio		= 161,
		.type		= EV_KEY,
		.code		= KEY_4,
		.desc		= "extkb3",
		.active_low	= 1,
		.debounce_interval = 50,
		.wakeup		= 1,
	},
	*/
	{
		.gpio		= 162,
		.type		= EV_KEY,
		.code		= KEY_5,
		.desc		= "extkb4",
		.active_low	= 1,
		.debounce_interval = 50,
		.wakeup		= 1,
	},
};

static struct gpio_keys_platform_data snowball_key_data = {
	.buttons	= snowball_key_array,
	.nbuttons	= ARRAY_SIZE(snowball_key_array),
};

static struct platform_device snowball_key_dev = {
	.name		= "gpio-keys",
	.id		= -1,
	.dev		= {
		.platform_data	= &snowball_key_data,
	}
};

static int snowball_digio_init(void)
{
        nmk_config_pins(snowball_pins, ARRAY_SIZE(snowball_pins));
	platform_device_register(&snowball_led_dev);
	platform_device_register(&snowball_key_dev);
	return 0;
}

module_init(snowball_digio_init);

/* no release function: I'm lazy at this point */