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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/*
* Button and Button LED support OMAP44xx tablet.
*
* Copyright (C) 2011 Texas Instruments
*
* Author: Dan Murphy <dmurphy@ti.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/leds.h>
#include <linux/leds_pwm.h>
#include <plat/omap_apps_brd_id.h>
#include "mux.h"
#include "board-44xx-tablet.h"
#define TABLET2_GREEN_LED_GPIO 174
#define TABLET2_GREEN_DBG2_LED_GPIO 173
static struct gpio_led tablet_gpio_leds[] = {
{
.name = "omap4:green:debug2",
.gpio = 7,
},
{
.name = "omap4:green:debug4",
.gpio = 50,
},
{
.name = "blue",
.default_trigger = "timer",
.gpio = 169,
},
{
.name = "red",
.default_trigger = "timer",
.gpio = 170,
},
{
.name = "green",
.default_trigger = "timer",
.gpio = 139,
},
};
static struct gpio_led_platform_data tablet_led_data = {
.leds = tablet_gpio_leds,
.num_leds = ARRAY_SIZE(tablet_gpio_leds),
};
static struct led_pwm tablet_pwm_leds[] = {
{
.name = "omap4:green:chrg",
.pwm_id = 1,
.max_brightness = 255,
.pwm_period_ns = 7812500,
},
};
static struct led_pwm_platform_data tablet_pwm_data = {
.num_leds = ARRAY_SIZE(tablet_pwm_leds),
.leds = tablet_pwm_leds,
};
static struct platform_device tablet_leds_pwm = {
.name = "leds_pwm",
.id = -1,
.dev = {
.platform_data = &tablet_pwm_data,
},
};
static struct platform_device tablet_leds_gpio = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &tablet_led_data,
},
};
/* GPIO_KEY for Tablet */
static struct gpio_keys_button tablet_gpio_keys_buttons[] = {
[0] = {
.code = KEY_VOLUMEUP,
.gpio = 43,
.desc = "SW1",
.active_low = 1,
},
[1] = {
.code = KEY_HOME,
.gpio = 46,
.desc = "SW2",
.active_low = 1,
.wakeup = 1,
},
[2] = {
.code = KEY_VOLUMEDOWN,
.gpio = 47,
.desc = "SW3",
.active_low = 1,
},
};
static struct gpio_keys_platform_data tablet_gpio_keys = {
.buttons = tablet_gpio_keys_buttons,
.nbuttons = ARRAY_SIZE(tablet_gpio_keys_buttons),
.rep = 0,
};
static struct platform_device tablet_gpio_keys_device = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &tablet_gpio_keys,
},
};
static struct platform_device *tablet_devices[] __initdata = {
&tablet_leds_gpio,
&tablet_leds_pwm,
&tablet_gpio_keys_device,
};
int __init tablet_button_init(void)
{
if (omap_is_board_version(OMAP4_TABLET_2_0) ||
omap_is_board_version(OMAP4_TABLET_2_1) ||
omap_is_board_version(OMAP4_TABLET_2_1_1) ||
omap_is_board_version(OMAP4_TABLET_2_1_2)) {
omap_mux_init_gpio(TABLET2_GREEN_DBG2_LED_GPIO,
OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
omap_mux_init_gpio(TABLET2_GREEN_LED_GPIO,
OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT);
tablet_gpio_leds[0].gpio = TABLET2_GREEN_DBG2_LED_GPIO;
tablet_gpio_leds[4].gpio = TABLET2_GREEN_LED_GPIO;
}
if (omap_board_uses_hsic()) {
tablet_gpio_leds[2].gpio = 104;
tablet_gpio_leds[3].gpio = 36;
}
platform_add_devices(tablet_devices, ARRAY_SIZE(tablet_devices));
return 0;
}
|