Skip to content

Commit c4eff3d

Browse files
committed
Merged in dlech's ui event changes
1 parent 0e795ef commit c4eff3d

File tree

3 files changed

+76
-13
lines changed

3 files changed

+76
-13
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1
1+
4

arch/arm/mach-davinci/board-legoev3.c

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,17 @@
6363
#ifdef CONFIG_MACH_DAVINCI_LEGOEV3
6464

6565
#warning "Consolidate these one-time LED setup macros"
66-
#define EV3_LED_0_PIN GPIO_TO_PIN(6, 12)
67-
#define EV3_LED_1_PIN GPIO_TO_PIN(6, 14)
68-
#define EV3_LED_2_PIN GPIO_TO_PIN(6, 13)
69-
#define EV3_LED_3_PIN GPIO_TO_PIN(6, 7)
70-
66+
#define EV3_LED_0_PIN GPIO_TO_PIN(6, 12)
67+
#define EV3_LED_1_PIN GPIO_TO_PIN(6, 14)
68+
#define EV3_LED_2_PIN GPIO_TO_PIN(6, 13)
69+
#define EV3_LED_3_PIN GPIO_TO_PIN(6, 7)
70+
71+
#define EV3_BUTTON_0_PIN GPIO_TO_PIN(7, 15)
72+
#define EV3_BUTTON_1_PIN GPIO_TO_PIN(1, 13)
73+
#define EV3_BUTTON_2_PIN GPIO_TO_PIN(7, 14)
74+
#define EV3_BUTTON_3_PIN GPIO_TO_PIN(7, 12)
75+
#define EV3_BUTTON_4_PIN GPIO_TO_PIN(6, 6 )
76+
#define EV3_BUTTON_5_PIN GPIO_TO_PIN(6, 10)
7177
#else
7278
#warning "Delete this code and eliminate this warning after copying this file to board-legoev3.c"
7379
#define DAVINCI_BACKLIGHT_MAX_BRIGHTNESS 250
@@ -2021,12 +2027,15 @@ static const short da850_lms2012_lcd_pins[] = {
20212027

20222028
static const short legoev3_ui_pins[] = {
20232029
#if !(defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE))
2024-
#warning "The LEDs are owned by the ui driver, not the kernel - heartbeat LED will not work"
2030+
#warning "The LEDs are owned by the ui driver, not the kernel - LED triggers will not work"
20252031
EV3_LED_0, EV3_LED_1, EV3_LED_2, EV3_LED_3,
20262032
#endif
2033+
2034+
#if !(defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE))
2035+
#warning "The buttons are owned by the ui driver, not the kernel - button events will not work"
20272036
EV3_BUTTON_0, EV3_BUTTON_1, EV3_BUTTON_2,
20282037
EV3_BUTTON_3, EV3_BUTTON_4, EV3_BUTTON_5,
2029-
2038+
#endif
20302039
-1
20312040
};
20322041
#endif
@@ -2069,9 +2078,42 @@ static struct platform_device ev3_device_gpio_leds = {
20692078
.platform_data = &ev3_gpio_led_data,
20702079
},
20712080
};
2072-
20732081
#endif
20742082

2083+
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2084+
#include <linux/gpio_keys.h>
2085+
#include<linux/input.h>
2086+
2087+
static struct gpio_keys_button ev3_gpio_keys_table[] = {
2088+
{KEY_UP, EV3_BUTTON_0_PIN, 1, "ev3:UP", EV_KEY, 0, 50, 1},
2089+
{KEY_ENTER, EV3_BUTTON_1_PIN, 1, "ev3:ENTER", EV_KEY, 0, 50, 1},
2090+
{KEY_DOWN, EV3_BUTTON_2_PIN, 1, "ev3:DOWN", EV_KEY, 0, 50, 1},
2091+
{KEY_RIGHT, EV3_BUTTON_3_PIN, 1, "ev3:RIGHT", EV_KEY, 0, 50, 1},
2092+
{KEY_LEFT, EV3_BUTTON_4_PIN, 1, "ev3:LEFT", EV_KEY, 0, 50, 1},
2093+
{KEY_ESC, EV3_BUTTON_5_PIN, 1, "ev3:ESC", EV_KEY, 0, 50, 1},
2094+
};
2095+
2096+
static struct gpio_keys_platform_data ev3_gpio_keys_data = {
2097+
.buttons = ev3_gpio_keys_table,
2098+
.nbuttons = ARRAY_SIZE(ev3_gpio_keys_table),
2099+
};
2100+
2101+
static struct platform_device ev3_device_gpiokeys = {
2102+
.name = "gpio-keys",
2103+
.dev = {
2104+
.platform_data = &ev3_gpio_keys_data,
2105+
},
2106+
};
2107+
2108+
static const int legoev3_button_gpio[] = {
2109+
EV3_BUTTON_0_PIN,
2110+
EV3_BUTTON_1_PIN,
2111+
EV3_BUTTON_2_PIN,
2112+
EV3_BUTTON_3_PIN,
2113+
EV3_BUTTON_4_PIN,
2114+
EV3_BUTTON_5_PIN
2115+
};
2116+
#endif
20752117

20762118
static __init int da850_set_emif_clk_rate(void)
20772119
{
@@ -2145,6 +2187,23 @@ static __init void da850_legoev3_init(void)
21452187
ret);
21462188
#endif
21472189

2190+
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2191+
/* This is CRITICAL code to making the LEFT button work - it disables
2192+
* the internal pullup on pin group 25 which is where the GPIO6_6 lives.
2193+
*/
2194+
ret = __raw_readl(DA8XX_SYSCFG1_VIRT(DA8XX_PUPD_SEL_REG));
2195+
ret &= 0xFDFFFFFF;
2196+
__raw_writel(ret, DA8XX_SYSCFG1_VIRT(DA8XX_PUPD_SEL_REG));
2197+
2198+
gpio_request_array(legoev3_button_gpio, ARRAY_SIZE(legoev3_button_gpio));
2199+
gpio_free_array(legoev3_button_gpio, ARRAY_SIZE(legoev3_button_gpio));
2200+
2201+
ret = platform_device_register(&ev3_device_gpiokeys);
2202+
if (ret)
2203+
pr_warning("da850_evm_init: button registration failed: %d\n",
2204+
ret);
2205+
#endif
2206+
21482207
#ifdef CONFIG_MACH_DAVINCI_LEGOEV3
21492208
#warning "Eventually, we'll re-enable these pins!"
21502209
#else

arch/arm/mach-davinci/include/mach/da8xx.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ extern unsigned int da850_max_speed;
6262
#define DA8XX_CFGCHIP2_REG 0x184
6363
#define DA8XX_CFGCHIP3_REG 0x188
6464

65-
#define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000)
66-
#define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x))
67-
#define DA8XX_DEEPSLEEP_REG 0x8
68-
#define DA8XX_PWRDN_REG 0x18
65+
#define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000)
66+
#define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x))
67+
#define DA8XX_DDR_SLEW_REG 0x4
68+
#define DA8XX_DEEPSLEEP_REG 0x8
69+
#define DA8XX_PUPD_ENA_REG 0xC
70+
#define DA8XX_PUPD_SEL_REG 0x10
71+
#define DA8XX_RXACTIVE_REG 0x14
72+
#define DA8XX_PWRDN_REG 0x18
6973

7074
#define DA8XX_PSC0_BASE 0x01c10000
7175
#define DA8XX_PLL0_BASE 0x01c11000

0 commit comments

Comments
 (0)