From patchwork Fri Dec 3 15:05:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sundar Iyer X-Patchwork-Id: 378271 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB3F8Rvk009958 for ; Fri, 3 Dec 2010 15:08:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752464Ab0LCPHZ (ORCPT ); Fri, 3 Dec 2010 10:07:25 -0500 Received: from eu1sys200aog108.obsmtp.com ([207.126.144.125]:47483 "EHLO eu1sys200aog108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752222Ab0LCPHW (ORCPT ); Fri, 3 Dec 2010 10:07:22 -0500 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob108.postini.com ([207.126.147.11]) with SMTP ID DSNKTPkHixJEmFGaqpw0V+EimnPKIjU1AjZN@postini.com; Fri, 03 Dec 2010 15:07:21 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 990BAA5; Fri, 3 Dec 2010 15:06:50 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3EB2E23F8; Fri, 3 Dec 2010 15:06:50 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 819B824C303; Fri, 3 Dec 2010 16:06:42 +0100 (CET) Received: from localhost (10.201.54.119) by exdcvycastm022.EQ1STM.local (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 3 Dec 2010 16:06:48 +0100 From: Sundar Iyer To: , , , Cc: , , Sundar Iyer Subject: [PATCH 15/20] mach-ux500: add touchscreen interfaces platform data Date: Fri, 3 Dec 2010 20:35:48 +0530 Message-ID: <1291388753-14662-16-git-send-email-sundar.iyer@stericsson.com> X-Mailer: git-send-email 1.7.2.dirty In-Reply-To: <1291388753-14662-1-git-send-email-sundar.iyer@stericsson.com> References: <1291388753-14662-1-git-send-email-sundar.iyer@stericsson.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 03 Dec 2010 15:08:29 +0000 (UTC) diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index e1d3822..e2af105 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -14,3 +14,4 @@ obj-$(CONFIG_REGULATOR_AB8500) += board-mop500-regulators.o obj-$(CONFIG_U5500_MODEM_IRQ) += modem_irq.o obj-$(CONFIG_U5500_MBOX) += mbox.o obj-$(CONFIG_INPUT_KEYBOARD) += board-mop500-keypads.o +obj-$(CONFIG_INPUT_TOUCHSCREEN) += board-mop500-touchscreen.o diff --git a/arch/arm/mach-ux500/board-mop500-touchscreen.c b/arch/arm/mach-ux500/board-mop500-touchscreen.c new file mode 100644 index 0000000..87cf2ac --- /dev/null +++ b/arch/arm/mach-ux500/board-mop500-touchscreen.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * License Terms: GNU General Public License v2 + * + * Author: Naveen Kumar G + * + * Touchscreen interfaces for various boards + */ +#include +#include +#include +#include +#include <../drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h> + +#include +#include + +/* + * Synaptics RMI4 touchscreen interface on the NUIBs + */ + +/* + * Descriptor structure. + * Describes the number of i2c devices on the bus that speak RMI. + */ +static struct synaptics_rmi4_platform_data rmi4_i2c_dev_platformdata = { + .name = "synaptics_rmi4_i2c0", + .irq_number = NOMADIK_GPIO_TO_IRQ(84), + .irq_type = (IRQF_TRIGGER_FALLING | IRQF_SHARED), + .x_flip = true, + .y_flip = false, + .regulator_en = true, +}; + +static struct i2c_board_info __initdata u8500_i2c3_devices_nuib[] = { + { + I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B), + .platform_data = &rmi4_i2c_dev_platformdata, + }, +}; + +/* + * BU21013 ROHM touchscreen interface on the STUIBs + */ + +/* tracks number of bu21013 devices being enabled */ +static int bu21013_devices; + +#define TOUCH_GPIO_PIN 84 + +#define TOUCH_XMAX 384 +#define TOUCH_YMAX 704 + +#define PRCMU_CLOCK_OCR 0x1CC +#define TSC_EXT_CLOCK_9_6MHZ 0x840000 + +/** + * bu21013_gpio_board_init : configures the touch panel. + * @reset_pin: reset pin number + * This function can be used to configures + * the voltage and reset the touch panel controller. + */ +static int bu21013_gpio_board_init(int reset_pin) +{ + int retval = 0; + + bu21013_devices++; + if (bu21013_devices == 1) { + retval = gpio_request(reset_pin, "touchp_reset"); + if (retval) { + printk(KERN_ERR "Unable to request gpio reset_pin"); + return retval; + } + retval = gpio_direction_output(reset_pin, 1); + if (retval < 0) { + printk(KERN_ERR "%s: gpio direction failed\n", + __func__); + return retval; + } + gpio_set_value(reset_pin, 1); + } + + return retval; +} + +/** + * bu21013_gpio_board_exit : deconfigures the touch panel controller + * @reset_pin: reset pin number + * This function can be used to deconfigures the chip selection + * for touch panel controller. + */ +static int bu21013_gpio_board_exit(int reset_pin) +{ + int retval = 0; + + if (bu21013_devices == 1) { + retval = gpio_direction_output(reset_pin, 0); + if (retval < 0) { + printk(KERN_ERR "%s: gpio direction failed\n", + __func__); + return retval; + } + gpio_set_value(reset_pin, 0); + } + bu21013_devices--; + + return retval; +} + +/** + * bu21013_read_pin_val : get the interrupt pin value + * This function can be used to get the interrupt pin value for touch panel + * controller. + */ +static int bu21013_read_pin_val(void) +{ + return gpio_get_value(TOUCH_GPIO_PIN); +} + +static struct bu21013_platform_device tsc_plat_device = { + .cs_en = bu21013_gpio_board_init, + .cs_dis = bu21013_gpio_board_exit, + .irq_read_val = bu21013_read_pin_val, + .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN), + .cs_pin = EGPIO_PIN_13, + .x_max_res = 480, + .y_max_res = 864, + .touch_x_max = TOUCH_XMAX, + .touch_y_max = TOUCH_YMAX, + .ext_clk = true, + .x_flip = true, + .y_flip = false, +}; + +static struct bu21013_platform_device tsc_cntl2_plat_device = { + .cs_en = bu21013_gpio_board_init, + .cs_dis = bu21013_gpio_board_exit, + .irq_read_val = bu21013_read_pin_val, + .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN), + .cs_pin = EGPIO_PIN_13, + .x_max_res = 480, + .y_max_res = 864, + .touch_x_max = TOUCH_XMAX, + .touch_y_max = TOUCH_YMAX, + .ext_clk = true, + .x_flip = true, + .y_flip = false, +}; + +static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = { + { + I2C_BOARD_INFO("bu21013_ts", 0x5C), + .platform_data = &tsc_plat_device, + }, + { + I2C_BOARD_INFO("bu21013_ts", 0x5D), + .platform_data = &tsc_cntl2_plat_device, + }, +}; + +void mop500_touchpanel_init(void) +{ + i2c_register_board_info(3, u8500_i2c3_devices_nuib, + ARRAY_SIZE(u8500_i2c3_devices_nuib)); + + i2c_register_board_info(3, u8500_i2c3_devices_stuib, + ARRAY_SIZE(u8500_i2c3_devices_stuib)); +} + diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 703840b..63313c4 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -202,8 +202,12 @@ static void __init u8500_init_machine(void) mop500_spi_init(); mop500_uart_init(); +#ifdef CONFIG_INPUT_KEYBOARD mop500_keypad_init(); - +#endif +#ifdef CONFIG_INPUT_TOUCHSCREEN + mop500_touchpanel_init(); +#endif platform_device_register(&ab8500_device); i2c_register_board_info(0, mop500_i2c0_devices, diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index 3104ae2..bac81c5 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h @@ -17,5 +17,5 @@ extern void mop500_sdi_init(void); extern void mop500_sdi_tc35892_init(void); extern void mop500_keypad_init(void); - +extern void mop500_touchpanel_init(void); #endif