summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0022-beaglebone-add-gpio-keys-for-lcd7-add-notes-for-miss.patch
blob: e29a568d7fc46f5eafdd10763e0022b8165dc3b2 (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
119
120
121
122
123
124
125
126
127
128
129
130
From 7d829ebc289c6e311171cb3974e428ed2562c0ad Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Mon, 19 Mar 2012 13:32:43 +0100
Subject: [PATCH 22/56] beaglebone: add gpio-keys for lcd7, add notes for
 missing functionality for other capes

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
 arch/arm/mach-omap2/board-am335xevm.c |   79 +++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index f854329..9e9cf5b 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -994,6 +994,73 @@ static void volume_keys_init(int evm_id, int profile)
 		pr_err("failed to register matrix keypad (2x3) device\n");
 }
 
+/* pinmux for lcd7 keys */
+static struct pinmux_config lcd7_keys_pin_mux[] = {
+	{"gpmc_a0.gpio1_16",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+	{"gpmc_a1.gpio1_17",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+	{"gpmc_a3.gpio1_19",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+	{"mcasp0_axr0.gpio3_16",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+	{NULL, 0},
+};
+
+/* Configure GPIOs for lcd7 keys */
+static struct gpio_keys_button beaglebone_lcd7_gpio_keys[] = {
+	{
+		.code                   = KEY_LEFT,
+		.gpio                   = GPIO_TO_PIN(1, 16),
+		.active_low             = false,
+		.desc                   = "left",
+		.type                   = EV_KEY,
+		.wakeup                 = 1,
+	},
+	{
+		.code                   = KEY_RIGHT,
+		.gpio                   = GPIO_TO_PIN(1, 17),
+		.active_low             = false,
+		.desc                   = "right",
+		.type                   = EV_KEY,
+		.wakeup                 = 1,
+	},
+	{
+		.code                   = KEY_UP,
+		.gpio                   = GPIO_TO_PIN(1, 19),
+		.active_low             = false,
+		.desc                   = "up",
+		.type                   = EV_KEY,
+		.wakeup                 = 1,
+	},
+	{
+		.code                   = KEY_DOWN,
+		.gpio                   = GPIO_TO_PIN(3, 16),
+		.active_low             = false,
+		.desc                   = "down",
+		.type                   = EV_KEY,
+		.wakeup                 = 1,
+	},
+};
+
+static struct gpio_keys_platform_data beaglebone_lcd7_gpio_key_info = {
+	.buttons        = beaglebone_lcd7_gpio_keys,
+	.nbuttons       = ARRAY_SIZE(beaglebone_lcd7_gpio_keys),
+};
+
+static struct platform_device beaglebone_lcd7_keys = {
+	.name   = "gpio-keys",
+	.id     = -1,
+	.dev    = {
+		.platform_data  = &beaglebone_lcd7_gpio_key_info,
+	},
+};
+
+static void beaglebone_lcd7_keys_init(int evm_id, int profile)
+{
+	int err;
+	setup_pin_mux(lcd7_keys_pin_mux);
+	err = platform_device_register(&beaglebone_lcd7_keys);
+	if (err)
+		pr_err("failed to register gpio keys for LCD7 cape\n");
+}
+
 /*
 * @evm_id - evm id which needs to be configured
 * @dev_cfg - single evm structure which includes
@@ -1945,6 +2012,8 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
 		pr_info("BeagleBone cape: Registering PWM backlight for LCD cape\n");
 		enable_ehrpwm1(0,0);
 		beaglebone_tsadcpins_free = 0;
+		pr_info("BeagleBone cape: Registering gpio-keys for LCD cape\n");
+		beaglebone_lcd7_keys_init(0,0);
 	}
 	
 	if (!strncmp("BB-BONE-LCD3-01", cape_config.partnumber, 15)) {
@@ -1953,6 +2022,10 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
 		pr_info("BeagleBone cape: initializing LCD cape touchscreen\n");
 		tsc_init(0,0);
 		beaglebone_tsadcpins_free = 0;
+		// gpio1_16 -> button
+		// gpio1_17 -> button
+		// gpio3_19 -> button
+		// gpio1_28 -> button
 	}
 	
 	if (!strncmp("BB-BONE-VGA-01", cape_config.partnumber, 15)) {
@@ -1962,11 +2035,17 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
 	
 	if (!strncmp("BB-BONE-BATT-01", cape_config.partnumber, 15)) {
 		pr_info("BeagleBone cape: initializing battery cape\n");
+		// gpio1_6, P9_15 lowbat output
+		// AIN4, P9_33 vbat
 		//foo_init(0,0);
 	}
 	
 	if (!strncmp("BB-BONE-SERL", cape_config.partnumber, 12)) {
 		pr_info("BeagleBone cape: initializing serial cape\n");
+		// 01 -> CAN
+		// 02 -> Profibus
+		// 03 -> RS232
+		// 04 -> RS485
 		//foo_init(0,0);
 	}
 	
-- 
1.7.7.6