From patchwork Thu Nov 19 14:47:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 61370 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAJElEmB011309 for ; Thu, 19 Nov 2009 14:47:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754886AbZKSOrH (ORCPT ); Thu, 19 Nov 2009 09:47:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755158AbZKSOrG (ORCPT ); Thu, 19 Nov 2009 09:47:06 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:56063 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753287AbZKSOrE (ORCPT ); Thu, 19 Nov 2009 09:47:04 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id nAJEl8Gw006163 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Nov 2009 08:47:10 -0600 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id nAJEl7qs021799; Thu, 19 Nov 2009 20:17:07 +0530 (IST) From: hvaibhav@ti.com To: linux-input@vger.kernel.org Cc: linux-omap@vger.kernel.org, Vaibhav Hiremath Subject: [PATCH 3/3] AM3517: Add support for TSC2004 driver Date: Thu, 19 Nov 2009 20:17:07 +0530 Message-Id: <1258642027-2520-1-git-send-email-hvaibhav@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: References: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 415a13d..ae47b51 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include @@ -27,10 +29,64 @@ #include #include +#include #include #include /* + * TSC 2004 Support + */ +#define GPIO_TSC2004_IRQ 65 + +static int tsc2004_init_irq(void) +{ + int ret = 0; + + ret = gpio_request(GPIO_TSC2004_IRQ, "tsc2004-irq"); + if (ret < 0) { + printk(KERN_WARNING "failed to request GPIO#%d: %d\n", + GPIO_TSC2004_IRQ, ret); + return ret; + } + + if (gpio_direction_input(GPIO_TSC2004_IRQ)) { + printk(KERN_WARNING "GPIO#%d cannot be configured as " + "input\n", GPIO_TSC2004_IRQ); + return -ENXIO; + } + + omap_set_gpio_debounce(GPIO_TSC2004_IRQ, 1); + omap_set_gpio_debounce_time(GPIO_TSC2004_IRQ, 0xa); + return ret; +} + +static void tsc2004_exit_irq(void) +{ + gpio_free(GPIO_TSC2004_IRQ); +} + +static int tsc2004_get_irq_level(void) +{ + return gpio_get_value(GPIO_TSC2004_IRQ) ? 0 : 1; +} + +struct tsc2004_platform_data am3517evm_tsc2004data = { + .model = 2004, + .x_plate_ohms = 180, + .get_pendown_state = tsc2004_get_irq_level, + .init_platform_hw = tsc2004_init_irq, + .exit_platform_hw = tsc2004_exit_irq, +}; + +static struct i2c_board_info __initdata am3517evm_tsc_i2c_boardinfo[] = { + { + I2C_BOARD_INFO("tsc2004", 0x4B), + .type = "tsc2004", + .platform_data = &am3517evm_tsc2004data, + }, +}; + +/* * Board initialization */ static struct omap_board_config_kernel am3517_evm_config[] __initdata = { @@ -67,6 +123,12 @@ static void __init am3517_evm_init(void) omap_serial_init(); usb_ehci_init(&ehci_pdata); + + /* TSC 2004 */ + omap_cfg_reg(U1_34XX_GPIO65); + am3517evm_tsc_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_TSC2004_IRQ); + i2c_register_board_info(1, am3517evm_tsc_i2c_boardinfo, + ARRAY_SIZE(am3517evm_tsc_i2c_boardinfo)); } static void __init am3517_evm_map_io(void)