From afe71eafc38739b1a2623843196bf93fba816546 Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Tue, 6 May 2008 19:38:11 -0700 Subject: [PATCH] OMAP3 EVM: Add touchscreen support Add touchscreen support for OMAP3 EVM Signed-off-by: Steve Sakoman Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/board-omap3evm.c | 46 ++++++++++++++++++++++ include/asm-arm/arch-omap/board-omap3evm.h | 1 + 2 files changed, 47 insertions(+) diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 96a3f9761c5..825da19165a 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -31,6 +33,7 @@ #include #include #include +#include static struct omap_uart_config omap3_evm_uart_config __initdata = { .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), @@ -65,6 +68,44 @@ static struct platform_device omap3_evm_twl4030rtc_device = { .id = -1, }; +static void ads7846_dev_init(void) +{ + if (omap_request_gpio(OMAP3_EVM_TS_GPIO) < 0) + printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); + + omap_set_gpio_direction(OMAP3_EVM_TS_GPIO, 1); + + omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1); + omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa); +} + +static int ads7846_get_pendown_state(void) +{ + return !omap_get_gpio_datain(OMAP3_EVM_TS_GPIO); +} + +struct ads7846_platform_data ads7846_config = { + .get_pendown_state = ads7846_get_pendown_state, + .keep_vref_on = 1, +}; + +static struct omap2_mcspi_device_config ads7846_mcspi_config = { + .turbo_mode = 0, + .single_channel = 1, /* 0: slave, 1: master */ +}; + +struct spi_board_info omap3evm_spi_board_info[] = { + [0] = { + .modalias = "ads7846", + .bus_num = 1, + .chip_select = 0, + .max_speed_hz = 1500000, + .controller_data = &ads7846_mcspi_config, + .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO), + .platform_data = &ads7846_config, + }, +}; + static void __init omap3_evm_init_irq(void) { omap2_init_common_hw(); @@ -90,11 +131,16 @@ static void __init omap3_evm_init(void) platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); omap_board_config = omap3_evm_config; omap_board_config_size = ARRAY_SIZE(omap3_evm_config); + + spi_register_board_info(omap3evm_spi_board_info, + ARRAY_SIZE(omap3evm_spi_board_info)); + omap_serial_init(); hsmmc_init(); usb_musb_init(); usb_ehci_init(); omap3evm_flash_init(); + ads7846_dev_init(); } arch_initcall(omap3_evm_i2c_init); diff --git a/include/asm-arm/arch-omap/board-omap3evm.h b/include/asm-arm/arch-omap/board-omap3evm.h index b9d37521ef9..67188c3efd3 100644 --- a/include/asm-arm/arch-omap/board-omap3evm.h +++ b/include/asm-arm/arch-omap/board-omap3evm.h @@ -31,6 +31,7 @@ extern void omap3evm_flash_init(void); +#define OMAP3_EVM_TS_GPIO 175 #define ONENAND_MAP 0x20000000 #endif /* __ASM_ARCH_OMAP3_EVM_H */ -- 2.41.1