diff options
author | Robert Collins <rcollins@nvidia.com> | 2011-06-06 15:39:14 -0700 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2011-06-24 21:33:25 -0700 |
commit | 28ee0b8860515658f729de857facf457a72d0373 (patch) | |
tree | eae6c9becfec0dc968fc3fd6ab11673e29dfe65b | |
parent | 08bb9eed94479a37999be169c434d561d0074c49 (diff) |
ARM: tegra: touchscreen: Board files for new Atmel touch driver.
* Update board files for new Atmel MaxTouch driver.
* Fix section mismatch with touch init (merged from other commit)
- Mark the tegra_touchscreen_init structures as __initdata,
since theycan be dropped once initialization has completed.
- Mark generic_touch_init() as __init, since it is only called from
the init path of various boards.
BUG 826854
Change-Id: Ifa73d89f8f62d2ac5b1e646276e444f87274d38f
Reviewed-on: http://git-master/r/35287
Reviewed-by: Niket Sirsi <nsirsi@nvidia.com>
Tested-by: Niket Sirsi <nsirsi@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.h | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-touch-atmel_maxtouch.c | 172 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-touch.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-ventana.h | 2 |
6 files changed, 166 insertions, 24 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 3dea412db11c..06d844ff9a0d 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_DEBUG_ICEDCC) += sysfs-dcc.o obj-$(CONFIG_TEGRA_REG_ACCESS) += tegra_reg_access.o obj-$(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) += board-touch-atmel_maxtouch.o +obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += board-touch-atmel_maxtouch.o obj-$(CONFIG_TOUCHSCREEN_PANJIT_I2C) += board-touch-panjit_i2c.o ifeq ($(CONFIG_TEGRA_MC_PROFILE),y) obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_mc.o diff --git a/arch/arm/mach-tegra/board-cardhu.h b/arch/arm/mach-tegra/board-cardhu.h index ffb5129fdb60..cae88456872c 100644 --- a/arch/arm/mach-tegra/board-cardhu.h +++ b/arch/arm/mach-tegra/board-cardhu.h @@ -152,16 +152,8 @@ int cardhu_power_off_init(void); int cardhu_edp_init(void); int cardhu_pmon_init(void); -/* Touchscreen GPIO addresses */ -#ifdef CONFIG_TOUCHSCREEN_PANJIT_I2C -#define TOUCH_GPIO_IRQ_PANJIT TEGRA_GPIO_PV6 -#define TOUCH_GPIO_RST_PANJIT TEGRA_GPIO_PQ7 -#endif - -#ifdef CONFIG_TOUCHSCREEN_ATMEL_MT_T9 #define TOUCH_GPIO_IRQ_ATMEL_T9 TEGRA_GPIO_PH4 #define TOUCH_GPIO_RST_ATMEL_T9 TEGRA_GPIO_PH6 #define TOUCH_BUS_ATMEL_T9 1 -#endif #endif diff --git a/arch/arm/mach-tegra/board-enterprise.h b/arch/arm/mach-tegra/board-enterprise.h index 58f8b8bb65a0..1f31e8bce1f9 100644 --- a/arch/arm/mach-tegra/board-enterprise.h +++ b/arch/arm/mach-tegra/board-enterprise.h @@ -37,11 +37,9 @@ int enterprise_baseband_init(void); int enterprise_suspend_init(void); /* Touchscreen GPIO addresses */ -#ifdef CONFIG_TOUCHSCREEN_ATMEL_MT_T9 #define TOUCH_GPIO_IRQ_ATMEL_T9 TEGRA_GPIO_PH6 #define TOUCH_GPIO_RST_ATMEL_T9 TEGRA_GPIO_PF5 #define TOUCH_BUS_ATMEL_T9 1 -#endif /*****************External GPIO tables ******************/ /* External peripheral gpio base. */ diff --git a/arch/arm/mach-tegra/board-touch-atmel_maxtouch.c b/arch/arm/mach-tegra/board-touch-atmel_maxtouch.c index b65cb0fd406a..a2ab2d990497 100644 --- a/arch/arm/mach-tegra/board-touch-atmel_maxtouch.c +++ b/arch/arm/mach-tegra/board-touch-atmel_maxtouch.c @@ -22,30 +22,186 @@ #include <linux/i2c.h> #include <linux/delay.h> #include <linux/gpio.h> +#include <linux/interrupt.h> + +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT) +#include <linux/i2c/atmel_mxt_ts.h> +#endif + +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) #include <linux/i2c/atmel_maxtouch.h> +#endif -#if defined (CONFIG_MACH_CARDHU) +#if defined(CONFIG_MACH_CARDHU) #include "board-cardhu.h" +#define MXT_I2C_ADDRESS MXT1386_I2C_ADDR3 #endif -#if defined (CONFIG_MACH_TEGRA_ENTERPRISE) +#if defined(CONFIG_MACH_TEGRA_ENTERPRISE) #include "board-enterprise.h" +#define MXT_I2C_ADDRESS MXT224_I2C_ADDR1 #endif -#if defined (CONFIG_MACH_VENTANA) +#if defined(CONFIG_MACH_VENTANA) #include "board-ventana.h" +#define MXT_I2C_ADDRESS MXT1386_I2C_ADDR3 #endif #include "gpio-names.h" #include "touch.h" +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT) +/* Atmel MaxTouch touchscreen Driver data */ +/*-----------------------------------------------------*/ +/* + * Config converted from memory-mapped cfg-file with + * following version information: + * + * + * + * FAMILY_ID=160 + * VARIANT=0 + * VERSION=16 + * BUILD=170 + * VENDOR_ID=255 + * PRODUCT_ID=TBD + * CHECKSUM=0x144A89 + * + * + */ + +#if defined(CONFIG_MACH_VENTANA) || defined(CONFIG_MACH_CARDHU) +#define MXT_CONFIG_CRC 0xD62DE8 +static const u8 config[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x14, 0x14, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, + 0x1B, 0x2A, 0x00, 0x20, 0x3C, 0x04, 0x05, 0x00, + 0x02, 0x01, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xFF, + 0x02, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, + 0x00, 0x00, 0x00, 0x05, 0x0A, 0x15, 0x1E, 0x00, + 0x00, 0x04, 0xFF, 0x03, 0x3F, 0x64, 0x64, 0x01, + 0x0A, 0x14, 0x28, 0x4B, 0x00, 0x02, 0x00, 0x64, + 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x10, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static struct mxt_platform_data atmel_mxt_info = { + .x_line = 27, + .y_line = 42, + .x_size = 768, + .y_size = 1366, + .blen = 0x20, + .threshold = 0x3C, + .voltage = 3300000, /* 3.3V */ + .orient = 5, + .config = config, + .config_length = 157, + .config_crc = MXT_CONFIG_CRC, + .irqflags = IRQF_TRIGGER_FALLING, +/* .read_chg = &read_chg, */ + .read_chg = NULL, +}; +#endif /* CONFIG_MACH_VENTANA, CONFIG_MACH_CARDHU */ + +#if defined(CONFIG_MACH_TEGRA_ENTERPRISE) +#define MXT_CONFIG_CRC 0x62F903 + +/* + * Config converted from memory-mapped cfg-file with + * following version information: + * + * + * + * FAMILY_ID=128 + * VARIANT=1 + * VERSION=32 + * BUILD=170 + * VENDOR_ID=255 + * PRODUCT_ID=TBD + * CHECKSUM=0xC189B6 + * + * + */ + +static const u8 config[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x05, 0x01, 0x00, + 0x00, 0x1E, 0x0A, 0x8B, 0x00, 0x00, 0x13, 0x0B, + 0x00, 0x10, 0x32, 0x03, 0x03, 0x00, 0x03, 0x01, + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xBF, 0x03, 0x1B, + 0x02, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xA9, 0x7F, 0x9A, 0x0E, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x00, 0x0A, + 0x0F, 0x14, 0x19, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x08, 0x10, + 0x00 +}; + +static struct mxt_platform_data atmel_mxt_info = { + .x_line = 19, + .y_line = 11, + .x_size = 960, + .y_size = 540, + .blen = 0x10, + .threshold = 0x32, + .voltage = 3300000, /* 3.3V */ + .orient = 3, + .config = config, + .config_length = 168, + .config_crc = MXT_CONFIG_CRC, + .irqflags = IRQF_TRIGGER_FALLING, +/* .read_chg = &read_chg, */ + .read_chg = NULL, +}; +#endif /* CONFIG_MACH_TEGRA_ENTERPRISE */ + +/* Reads the CHANGELINE state; interrupt is valid if the changeline + * is low. + * +static u8 read_chg(void) +{ + return gpio_get_value(TOUCH_GPIO_IRQ_ATMEL_T9); +} + */ + +static struct i2c_board_info __initdata atmxt_i2c_info[] = { + { + I2C_BOARD_INFO("atmel_mxt_ts", MXT_I2C_ADDRESS), + .irq = TEGRA_GPIO_TO_IRQ(TOUCH_GPIO_IRQ_ATMEL_T9), + .platform_data = &atmel_mxt_info, + }, +}; +#endif +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) /* Atmel MaxTouch touchscreen Driver data */ /*-----------------------------------------------------*/ /* * Reads the CHANGELINE state; interrupt is valid if the changeline * is low. */ + static u8 read_chg(void) { return gpio_get_value(TOUCH_GPIO_IRQ_ATMEL_T9); @@ -60,10 +216,10 @@ static u8 valid_interrupt(void) static struct mxt_platform_data atmel_mxt_info = { /* Maximum number of simultaneous touches to report. */ .numtouch = 10, - // TODO: no need for any hw-specific things at init/exit? + /* TODO: no need for any hw-specific things at init/exit? */ .init_platform_hw = NULL, .exit_platform_hw = NULL, -#if defined (CONFIG_MACH_TEGRA_ENTERPRISE) +#if defined(CONFIG_MACH_TEGRA_ENTERPRISE) .max_x = 540, .max_y = 960, #else @@ -76,20 +232,16 @@ static struct mxt_platform_data atmel_mxt_info = { static struct i2c_board_info __initdata atmxt_i2c_info[] = { { -#if defined (CONFIG_MACH_TEGRA_ENTERPRISE) - I2C_BOARD_INFO("maXTouch", MXT224_I2C_ADDR1), -#else I2C_BOARD_INFO("maXTouch", MXT_I2C_ADDRESS), -#endif .irq = TEGRA_GPIO_TO_IRQ(TOUCH_GPIO_IRQ_ATMEL_T9), .platform_data = &atmel_mxt_info, }, }; +#endif struct tegra_touchscreen_init __initdata atmel_mxt_init_data = { .irq_gpio = TOUCH_GPIO_IRQ_ATMEL_T9, /* GPIO1 Value for IRQ */ .rst_gpio = TOUCH_GPIO_RST_ATMEL_T9, /* GPIO2 Value for RST */ - .sv_gpio1 = {1, TOUCH_GPIO_RST_ATMEL_T9, 0, 1}, /* Valid, GPIOx, Set value, Delay */ .sv_gpio2 = {1, TOUCH_GPIO_RST_ATMEL_T9, 1, 100}, /* Valid, GPIOx, Set value, Delay */ .ts_boardinfo = {TOUCH_BUS_ATMEL_T9, atmxt_i2c_info, 1} /* BusNum, BoardInfo, Value */ }; diff --git a/arch/arm/mach-tegra/board-touch.c b/arch/arm/mach-tegra/board-touch.c index 38ab4ad94a31..b3291f132b69 100644 --- a/arch/arm/mach-tegra/board-touch.c +++ b/arch/arm/mach-tegra/board-touch.c @@ -91,8 +91,7 @@ Check your _defconfig file and remove all but one touch screen driver instances. #endif /*** ATMEL Multitouch Support **********************************************/ -#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) -#include <linux/i2c/atmel_maxtouch.h> +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) || defined(CONFIG_TOUCHSCREEN_ATMEL_MXT) extern struct tegra_touchscreen_init atmel_mxt_init_data; #define ATMEL_TOUCHSCREEN_SKU 0x0A00 #define ATMEL_TOUCHSCREEN_T25 0x0B00 @@ -181,7 +180,7 @@ int __init touch_init(void) pr_info("### sku = %04X\n", sku); switch (sku) { -#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) || defined(CONFIG_TOUCHSCREEN_ATMEL_MXT) case ATMEL_TOUCHSCREEN_SKU: case ATMEL_TOUCHSCREEN_T25: case ATMEL_TOUCHSCREEN_ENTERPRISE: diff --git a/arch/arm/mach-tegra/board-ventana.h b/arch/arm/mach-tegra/board-ventana.h index d3e89ee107ea..f8aff32b11e5 100644 --- a/arch/arm/mach-tegra/board-ventana.h +++ b/arch/arm/mach-tegra/board-ventana.h @@ -68,7 +68,7 @@ int ventana_emc_init(void); #define TOUCH_GPIO_RST_PANJIT TEGRA_GPIO_PQ7 #endif -#ifdef CONFIG_TOUCHSCREEN_ATMEL_MT_T9 +#if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT) || defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) #define TOUCH_GPIO_IRQ_ATMEL_T9 TEGRA_GPIO_PV6 #define TOUCH_GPIO_RST_ATMEL_T9 TEGRA_GPIO_PQ7 #define TOUCH_BUS_ATMEL_T9 0 |