aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rwxr-xr-x[-rw-r--r--]arch/arm/configs/mop500_USB_HOST_defconfig3
-rwxr-xr-xarch/arm/configs/mop500_defconfig9
-rwxr-xr-xarch/arm/configs/mop500_ed_defconfig9
-rwxr-xr-xarch/arm/configs/mop500_power_defconfig9
-rwxr-xr-xarch/arm/mach-ux500/board-mop500.c234
-rwxr-xr-xarch/arm/mach-ux500/include/mach/devices.h15
-rwxr-xr-xarch/arm/mach-ux500/include/mach/u8500_tsc.h286
7 files changed, 149 insertions, 416 deletions
diff --git a/arch/arm/configs/mop500_USB_HOST_defconfig b/arch/arm/configs/mop500_USB_HOST_defconfig
index 7a672a088b4..4d5baad47af 100644..100755
--- a/arch/arm/configs/mop500_USB_HOST_defconfig
+++ b/arch/arm/configs/mop500_USB_HOST_defconfig
@@ -784,6 +784,9 @@ CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_W90X900 is not set
+CONFIG_TOUCHSCREEN_BU21013=y
+CONFIG_BU21013_TSC_CNTL1=y
+# CONFIG_BU21013_TSC_CNTL2 is not set
# CONFIG_INPUT_MISC is not set
#
diff --git a/arch/arm/configs/mop500_defconfig b/arch/arm/configs/mop500_defconfig
index 8a20009329b..d5a6b934a81 100755
--- a/arch/arm/configs/mop500_defconfig
+++ b/arch/arm/configs/mop500_defconfig
@@ -903,13 +903,10 @@ CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_W90X900 is not set
-CONFIG_U8500_TSC=y
-# CONFIG_U8500_TSC_SINGLETOUCH is not set
-CONFIG_U8500_TSC_MULTITOUCH=y
-# CONFIG_U8500_TSC_X_FLIP is not set
-CONFIG_U8500_TSC_Y_FLIP=y
-# CONFIG_U8500_TSC_EXT_CLK_9_6 is not set
CONFIG_TOUCHP_TUNING=y
+CONFIG_TOUCHSCREEN_BU21013=y
+CONFIG_BU21013_TSC_CNTL1=y
+# CONFIG_BU21013_TSC_CNTL2 is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_ATI_REMOTE is not set
# CONFIG_INPUT_ATI_REMOTE2 is not set
diff --git a/arch/arm/configs/mop500_ed_defconfig b/arch/arm/configs/mop500_ed_defconfig
index 23ec4889f89..f54d89a9d47 100755
--- a/arch/arm/configs/mop500_ed_defconfig
+++ b/arch/arm/configs/mop500_ed_defconfig
@@ -881,13 +881,10 @@ CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_W90X900 is not set
-CONFIG_U8500_TSC=y
-# CONFIG_U8500_TSC_SINGLETOUCH is not set
-CONFIG_U8500_TSC_MULTITOUCH=y
-# CONFIG_U8500_TSC_X_FLIP is not set
-CONFIG_U8500_TSC_Y_FLIP=y
-# CONFIG_U8500_TSC_EXT_CLK_9_6 is not set
CONFIG_TOUCHP_TUNING=y
+CONFIG_TOUCHSCREEN_BU21013=y
+#CONFIG_BU21013_TSC_CNTL1=y
+# CONFIG_BU21013_TSC_CNTL2 is not set
# CONFIG_INPUT_MISC is not set
#
diff --git a/arch/arm/configs/mop500_power_defconfig b/arch/arm/configs/mop500_power_defconfig
index 3d0ec148809..42664d52ef7 100755
--- a/arch/arm/configs/mop500_power_defconfig
+++ b/arch/arm/configs/mop500_power_defconfig
@@ -903,13 +903,10 @@ CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_W90X900 is not set
-CONFIG_U8500_TSC=y
-# CONFIG_U8500_TSC_SINGLETOUCH is not set
-CONFIG_U8500_TSC_MULTITOUCH=y
-# CONFIG_U8500_TSC_X_FLIP is not set
-CONFIG_U8500_TSC_Y_FLIP=y
-# CONFIG_U8500_TSC_EXT_CLK_9_6 is not set
CONFIG_TOUCHP_TUNING=y
+CONFIG_TOUCHSCREEN_BU21013=y
+#CONFIG_BU21013_TSC_CNTL1=y
+# CONFIG_BU21013_TSC_CNTL2 is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_ATI_REMOTE is not set
# CONFIG_INPUT_ATI_REMOTE2 is not set
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 4fd04c72af1..c72b3699c9c 100755
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -18,6 +18,7 @@
#include <linux/i2c/lp5521.h>
#include <linux/power_supply.h>
#include <linux/lsm303dlh.h>
+#include <linux/bu21013.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
@@ -37,7 +38,6 @@
#include <mach/mmc.h>
#include <mach/setup.h>
#include <mach/i2c.h>
-#include <mach/u8500_tsc.h>
#include <video/mcde_display.h>
#include <video/mcde_display-generic_dsi.h>
@@ -179,243 +179,250 @@ static struct i2c_board_info __initdata nmdk_i2c0_egpio1_devices[] = {
/**
* Touch panel related platform specific initialization
*/
-#if defined(CONFIG_U8500_TSC)
/**
- * tp_gpio_board_init : configures the touch panel.
+ * bu21013_gpio_board_init : configures the touch panel.
+ * @ext_clk_en: external clcok enable
+ * @reset_pin: reset pin number
* This function can be used to configures
* the voltage and reset the touch panel controller.
*/
-int tp_gpio_board_init(void)
+static int bu21013_gpio_board_init(int reset_pin)
{
#ifndef CONFIG_REGULATOR
int val;
#endif
int retval = 0;
-#if (defined CONFIG_U8500_TSC_EXT_CLK_9_6 && !defined CONFIG_U8500_TSC_EXT_CLK_SHARE)
void __iomem *clk_base;
unsigned int clk_value;
-#endif
+
+ static bool config_set;
#ifndef CONFIG_REGULATOR
- /** Set the voltage for Bu21013 controller */
+ /* Set the voltage for Bu21013 controller */
val = ab8500_read(AB8500_REGU_CTRL2, AB8500_REGU_VAUX12_REGU_REG);
retval = ab8500_write(AB8500_REGU_CTRL2, AB8500_REGU_VAUX12_REGU_REG,
- (val | 0x1));
+ (val | TSC_AVDD_AUX1_REGULATOR));
if (retval < 0)
- return -1;
+ return retval;
val = ab8500_read(AB8500_REGU_CTRL2, AB8500_REGU_VAUX1_SEL_REG);
retval = ab8500_write(AB8500_REGU_CTRL2, AB8500_REGU_VAUX1_SEL_REG,
- 0x0C);
+ TSC_AVDD_VOLTAGE_2_5);
if (retval < 0)
- return -1;
-#endif
-#ifdef CONFIG_U8500_TSC_EXT_CLK_9_6
-#ifndef CONFIG_U8500_TSC_EXT_CLK_SHARE
- retval = stm_gpio_altfuncenable(GPIO_ALT_TP_SET_EXT_CLK);
- if (retval < 0) {
- printk(KERN_ERR " ext clock stm_gpio_altfuncenable failed \n");
- return -1;
- }
- clk_base = (void __iomem *)IO_ADDRESS(U8500_PRCMU_BASE + 0x1CC);
- clk_value = readl(clk_base);
- writel(0x840000, clk_base);
-#endif
+ return retval;
#endif
- if (platform_id == MOP500_PLATFORM_ID) {
- retval = gpio_request(TOUCHP_CS0, "touchp_cs0");
- if (retval) {
- printk(KERN_ERR "Unable to request gpio TOUCHP_CS0");
+ if (!config_set) {
+ retval = stm_gpio_altfuncenable(GPIO_ALT_TP_SET_EXT_CLK);
+ if (retval < 0) {
+ printk(KERN_ERR "%s: gpio alternate failed\n", __func__);
return retval;
}
- /** why set directtion is not working ~ FIXME */
- /* gpio_direction_output(270,1); */
- gpio_set_value(TOUCHP_CS0, 1);
+ clk_base = (void __iomem *)IO_ADDRESS(U8500_PRCMU_BASE + PRCMU_CLOCK_OCR);
+ clk_value = readl(clk_base);
+ writel(TSC_EXT_CLOCK_9_6MHZ, clk_base);
+ }
+ if (platform_id == MOP500_PLATFORM_ID) {
+ gpio_set_value(EGPIO_PIN_2, 1);
} else if (platform_id == HREF_PLATFORM_ID) {
- retval = gpio_request(EGPIO_PIN_13, "touchp_cs0");
- if (retval) {
- printk(KERN_ERR "Unable to request gpio TOUCHP_CS0");
- return retval;
- }
-
- retval = gpio_direction_output(EGPIO_PIN_13, 1);
- if (retval < 0) {
- printk(KERN_ERR " reset gpio_direction_output init failed \n");
- return -1;
+ if (!config_set) {
+ 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);
+ config_set = true;
}
- gpio_set_value(EGPIO_PIN_13, 1);
}
return retval;
}
/**
- * tp_gpio_board_exit : deconfigures the touch panel controller
+ * 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.
*/
-int tp_gpio_board_exit(void)
+static int bu21013_gpio_board_exit(int reset_pin)
{
int retval = 0;
+ static bool config_disable_set;
if (platform_id == MOP500_PLATFORM_ID) {
- /** why set directtion is not working ~ FIXME */
- /* gpio_direction_output(270,1); */
- gpio_set_value(TOUCHP_CS0, 0);
+ gpio_set_value(EGPIO_PIN_2, 0);
} else if (platform_id == HREF_PLATFORM_ID) {
- retval = gpio_direction_output(EGPIO_PIN_13, 0);
- if (retval < 0) {
- printk(KERN_ERR " reset gpio_direction_output exit failed \n");
- return -1;
+ if (!config_disable_set) {
+ 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);
+ config_disable_set = true;
}
- gpio_set_value(EGPIO_PIN_13, 0);
}
return retval;
}
/**
- * tp_init_irq : sets the callback for touch panel controller
+ * bu21013_init_irq : sets the callback for touch panel controller
* @parameter: function pointer for touch screen callback handler.
* @data: data to be passed for touch panel callback handler.
* This function can be used to set the callback handler for
* touch panel controller.
*/
-int tp_init_irq(void (*callback)(void *parameter), void *data)
+static int bu21013_init_irq(void (*callback)(void *parameter), void *data)
{
int retval = 0;
-
if (platform_id == MOP500_PLATFORM_ID) {
- retval = stmpe2401_set_callback(TOUCHP_IRQ, callback,
+ retval = stmpe2401_set_callback(EGPIO_PIN_3, callback,
(void *)data);
if (retval < 0)
- printk(KERN_ERR " stmpe2401_set_callback failed \n");
+ printk(KERN_ERR "%s: set callback failed\n", __func__);
} else if (platform_id == HREF_PLATFORM_ID) {
- if (href_v1_board == 0) {
+ if (!href_v1_board) {
retval = tc35892_set_callback(EGPIO_PIN_12, callback,
(void *)data);
if (retval < 0)
- printk(KERN_ERR " tc35892_set_callback failed \n");
+ printk(KERN_ERR "%s: set callback failed\n", __func__);
+ retval = tc35892_set_gpio_intr_conf(EGPIO_PIN_12,
+ EDGE_SENSITIVE, TC35892_FALLING_EDGE_OR_LOWLEVEL);
+ if (retval < 0)
+ printk(KERN_ERR "%s: config failed\n", __func__);
}
}
return retval;
}
/**
- * tp_exit_irq : removes the callback for touch panel controller
+ * bu21013_exit_irq : removes the callback for touch panel controller
* This function can be used to removes the callback handler for
* touch panel controller.
*/
-int tp_exit_irq(void)
+static int bu21013_exit_irq(void)
{
int retval = 0;
if (platform_id == MOP500_PLATFORM_ID) {
- retval = stmpe2401_remove_callback(TOUCHP_IRQ);
+ retval = stmpe2401_remove_callback(EGPIO_PIN_3);
if (retval < 0)
- printk(KERN_ERR " stmpe2401_remove_callback failed \n");
+ printk(KERN_ERR "%s: remove callback failed\n", __func__);
} else if (platform_id == HREF_PLATFORM_ID) {
- if (href_v1_board == 0) {
+ if (!href_v1_board) {
retval = tc35892_remove_callback(EGPIO_PIN_12);
if (retval < 0)
- printk(KERN_ERR " tc35892_remove_callback failed \n");
+ printk(KERN_ERR "%s: remove calllback failed\n", __func__);
}
}
return retval;
}
/**
- * tp_pen_down_irq_enable : enable the interrupt for touch panel controller
+ * bu21013_pen_down_irq_enable : enable the interrupt for touch panel controller
* This function can be used to enable the interrupt for touch panel controller.
*/
-int tp_pen_down_irq_enable(void)
+static int bu21013_pen_down_irq_enable(void)
{
int retval = 0;
- if (platform_id == MOP500_PLATFORM_ID) {
- /* do nothing */
- } else if (platform_id == HREF_PLATFORM_ID) {
- if (href_v1_board == 0) {
- retval = tc35892_set_gpio_intr_conf(EGPIO_PIN_12,
- EDGE_SENSITIVE, TC35892_FALLING_EDGE_OR_LOWLEVEL);
- if (retval < 0)
- printk(KERN_ERR " tc35892_set_gpio_intr_conf failed\n");
+ if (platform_id == HREF_PLATFORM_ID) {
+ if (!href_v1_board) {
retval = tc35892_set_intr_enable(EGPIO_PIN_12,
ENABLE_INTERRUPT);
if (retval < 0)
- printk(KERN_ERR " tc35892_set_intr_enable failed \n");
+ printk(KERN_ERR "%s: failed\n", __func__);
}
}
return retval;
}
/**
- * tp_pen_down_irq_disable : disable the interrupt
+ * bu21013_pen_down_irq_disable : disable the interrupt
* This function can be used to disable the interrupt for
* touch panel controller.
*/
-int tp_pen_down_irq_disable(void)
+static int bu21013_pen_down_irq_disable(void)
{
int retval = 0;
- if (platform_id == MOP500_PLATFORM_ID) {
- /* do nothing */
- } else if (platform_id == HREF_PLATFORM_ID) {
- if (href_v1_board == 0) {
+ if (platform_id == HREF_PLATFORM_ID) {
+ if (!href_v1_board) {
retval = tc35892_set_intr_enable(EGPIO_PIN_12,
DISABLE_INTERRUPT);
if (retval < 0)
- printk(KERN_ERR " tc35892_set_intr_enable failed \n");
+ printk(KERN_ERR "%s: failed\n", __func__);
}
}
return retval;
}
/**
- * tp_read_pin_val : get the interrupt pin value
+ * bu21013_read_pin_val : get the interrupt pin value
* This function can be used to get the interrupt pin value for touch panel
* controller.
*/
-int tp_read_pin_val(void)
+static int bu21013_read_pin_val(void)
{
int data = 0;
- unsigned int touch_gpio_pin = 84;
if (platform_id == MOP500_PLATFORM_ID)
- data = gpio_get_value(TOUCHP_IRQ);
+ data = gpio_get_value(EGPIO_PIN_3);
else if (platform_id == HREF_PLATFORM_ID) {
- if (href_v1_board == 0)
+ if (!href_v1_board)
data = gpio_get_value(EGPIO_PIN_12);
else
- data = gpio_get_value(touch_gpio_pin);
+ data = gpio_get_value(TOUCH_GPIO_PIN);
}
return data;
}
/**
- * tp_board_href_v1 : update the href v1 flag
+ * bu21013_board_href_v1 : update the href v1 flag
* This function can be used to update the board.
*/
-int tp_board_href_v1(void)
+static bool bu21013_board_check(void)
{
- unsigned int touch_gpio_pin = 84;
+ href_v1_board = false;
if (platform_id == HREF_PLATFORM_ID) {
- if (u8500_is_earlydrop())
- href_v1_board = 0;
- else
- href_v1_board = gpio_get_value(touch_gpio_pin);
- } else
- href_v1_board = 0;
+ if (!u8500_is_earlydrop()) {
+ if (gpio_get_value(TOUCH_GPIO_PIN) == 1)
+ href_v1_board = true;
+ }
+ }
return href_v1_board;
}
-static struct tp_device tsc_plat_device = {
- .cs_en = tp_gpio_board_init,
- .cs_dis = tp_gpio_board_exit,
- .irq_init = tp_init_irq,
- .irq_exit = tp_exit_irq,
- .pirq_en = tp_pen_down_irq_enable,
- .pirq_dis = tp_pen_down_irq_disable,
- .pirq_read_val = tp_read_pin_val,
- .board_href_v1 = tp_board_href_v1,
- .irq = GPIO_TO_IRQ(84),
-};
+static struct bu21013_platform_device tsc_plat_device = {
+ .cs_en = bu21013_gpio_board_init,
+ .cs_dis = bu21013_gpio_board_exit,
+ .irq_init = bu21013_init_irq,
+ .irq_exit = bu21013_exit_irq,
+ .pirq_en = bu21013_pen_down_irq_enable,
+ .pirq_dis = bu21013_pen_down_irq_disable,
+ .pirq_read_val = bu21013_read_pin_val,
+ .board_check = bu21013_board_check,
+ .irq = 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,
+#ifdef CONFIG_BU21013_TSC_CNTL1
+ .tp_cntl = 1,
#endif
+};
+static struct bu21013_platform_device tsc_cntl2_plat_device = {
+ .cs_en = bu21013_gpio_board_init,
+ .cs_dis = bu21013_gpio_board_exit,
+ .board_check = bu21013_board_check,
+ .pirq_read_val = bu21013_read_pin_val,
+ .irq = 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,
+#ifdef CONFIG_BU21013_TSC_CNTL2
+ .tp_cntl = 2,
+#endif
+};
/* Portrait */
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY
/* Rotation always on */
@@ -510,13 +517,16 @@ static struct i2c_board_info __initdata u8500_i2c3_devices[] = {
/* NFC - Address TBD, FIXME */
I2C_BOARD_INFO("nfc", 0x68),
},
-#if defined(CONFIG_U8500_TSC)
{
/* Touschscreen */
- I2C_BOARD_INFO(DRIVER_TP, I2C3_TOUCHP_ADDRESS),
+ I2C_BOARD_INFO("bu21013_tp", 0x5C),
.platform_data = &tsc_plat_device,
},
-#endif
+ {
+ /* Touschscreen */
+ I2C_BOARD_INFO("bu21013_tp", 0x5D),
+ .platform_data = &tsc_cntl2_plat_device,
+ },
};
@@ -1467,8 +1477,8 @@ static struct platform_device *platform_board_devs[] __initdata = {
&ab8500_gpadc_device,
&ab8500_bm_device,
&ux500_musb_device,
- &ux500_b2r2_device,
&ux500_mcde_device,
+ &ux500_b2r2_device,
#ifdef CONFIG_ANDROID_PMEM
&u8500_pmem_device,
&u8500_pmem_mio_device,
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h
index c00a36cffed..73ddb146626 100755
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/include/mach/devices.h
@@ -63,4 +63,19 @@ extern int platform_id;
#define MOP500_PLATFORM_ID 0
#define HREF_PLATFORM_ID 1
+#define MOP500_PLATFORM_ID 0
+#define HREF_PLATFORM_ID 1
+
+/**
+ * Touchpanel related macros declaration
+ */
+#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
+#define TSC_AVDD_VOLTAGE_2_5 0x08
+#define TSC_AVDD_AUX1_REGULATOR 0x01
#endif
diff --git a/arch/arm/mach-ux500/include/mach/u8500_tsc.h b/arch/arm/mach-ux500/include/mach/u8500_tsc.h
deleted file mode 100755
index c51ca4cc207..00000000000
--- a/arch/arm/mach-ux500/include/mach/u8500_tsc.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Overview:
- * Touch panel register definitions
- *
- * Copyright (C) 2009 ST-Ericsson SA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-
-
-#ifndef _TOUCHP_NOMADIK_H
-#define _TOUCHP_NOMADIK_H
-
-#include <mach/hardware.h>
-
-/**
- * Touchpanel related macros declaration
- */
-#define I2C3_TOUCHP_ADDRESS 0x5C/* I2C slave address */
-#define TOUCHP_IRQ EGPIO_PIN_3 /* PENIRQNO egpio3 */
-#define TOUCHP_CS0 EGPIO_PIN_2 /* Chip select egpio2 */
-
-#define DRIVER_TP "u8500_tp"
-/*
- *TOUCH SCREEN DRIVER MACROS used for Power on Sequence
- */
-#define TSC_INT_CLR 0xE8
-#define TSC_INT_MODE 0xE9
-#define TSC_GAIN 0xEA
-#define TSC_OFFSET_MODE 0xEB
-#define TSC_XY_EDGE 0xEC
-#define TSC_RESET 0xED
-#define TSC_CALIB 0xEE
-#define TSC_DONE 0xEF
-#define TSC_SENSOR_0_7 0xF0
-#define TSC_SENSOR_8_15 0xF1
-#define TSC_SENSOR_16_23 0xF2
-#define TSC_POS_MODE1 0xF3
-#define TSC_POS_MODE2 0xF4
-#define TSC_CLK_MODE 0xF5
-#define TSC_IDLE 0xFA
-#define TSC_FILTER 0xFB
-#define TSC_TH_ON 0xFC
-#define TSC_TH_OFF 0xFD
-#define TSC_INTR_STATUS 0x7B
-#define TSC_POS_X1 0x73
-#define TSC_POS_Y1 0x75
-#define TSC_POS_X2 0x77
-#define TSC_POS_Y2 0x79
-
-#define MAX_10BIT ((1<<10)-1)
-
-
-#define TSC_CLK_MODE_VAL1 0x82
-#define TSC_CLK_MODE_VAL2 0x81
-#define TSC_IDLE_VAL 0x11
-#define TSC_INT_MODE_VAL 0x00
-#define TSC_FILTER_VAL 0xFF
-#define TSC_TH_ON_VAL 0x20
-#define TSC_TH_OFF_VAL 0x18
-#define TSC_GAIN_VAL 0x03
-#define TSC_OFFSET_MODE_VAL 0x00
-#define TSC_XY_EDGE_VAL 0xA5
-#define TSC_DONE_VAL 0x01
-
-
-/*
- * Resolutions
- */
-/*Panel Resolution, Target size. (864*480)*/
-#define X_MAX (480)
-#define Y_MAX (864)
-
-/*Touchpanel Resolution */
-#define TOUCH_XMAX 384
-#define TOUCH_YMAX 704
-
-#define TRUE (1)
-#define FALSE (0)
-
-#define SET (1)
-#define CLR (0)
-
-#define START (0)
-#define STOP (-1)
-
-/*Direction Indicator */
-#define DIR_INVALID (0)
-#define DIR_LEFT (1)
-#define DIR_RIGHT (2)
-#define DIR_UP (3)
-#define DIR_DOWN (4)
-
-/* Pinch */
-#define PINCH_KEEP (0)
-#define PINCH_IN (1)
-#define PINCH_OUT (2)
-
-/* Rotate */
-#define ROTATE_INVALID (0)
-#define ROTATE_R_UR (1)
-#define ROTATE_R_RD (2)
-#define ROTATE_R_DL (3)
-#define ROTATE_R_LU (4)
-#define ROTATE_L_LD (5)
-#define ROTATE_L_DR (6)
-#define ROTATE_L_RU (7)
-#define ROTATE_L_UL (8)
-
-/* Gesture Information */
-#define GES_FLICK 0x01
-#define GES_TAP 0x02
-#define GES_PINCH 0x03
-#define GES_DRAGDROP 0x04
-#define GES_TOUCHSTART 0x05
-#define GES_TOUCHEND 0x06
-#define GES_MOVE 0x07
-#define GES_ROTATE 0x08
-#define GES_UNKNOWN 0xff
-
-/* Tap times */
-#define TAP_SINGLE 0x01
-#define TAP_DOUBLE 0x02
-#define TAP_TRIPLE 0x03
-
-/* Speed */
-#define LOWSPEED 1
-#define HIGHSPEED 2
-#define THRESHOLD_TAPLIMIT 60
-#define THRESHOLD_FLICK 60
-#define THRESHOLD_FLICK_SPEED 300
-#define THRESHOLD_PINCH_SPEED 3000
-#define THRESHOLD_DRAGDROP 100
-#define THRESHOLD_ROTATE 3
-#define THRESHOLD_ROTATE_HIST 8
-#define THRESHOLD_PINCH 500
-#define DIRHEADER 6
-#define DIRTRACEN 32
-#define SMA_N 80
-#define SMA_ARRAY 81
-#define THRESHOLD_SMA_N SMA_N
-#define MULTITOUCH_SIN_N 6
-#define PENUP_TIMEOUT (10) /* msec */
-
-/**
- * Error handling messages
- **/
-typedef enum {
- TSC_OK = 0,
- TSC_BAD_PARAMETER = -2,
- TSC_FEAT_NOT_SUPPORTED = -3,
- TSC_INTERNAL_ERROR = -4,
- TSC_TIMEOUT_ERROR = -5,
- TSC_INITIALIZATION_ERROR = -6,
- TSC_I2C_ERROR = -7,
- TSC_ERROR = -8
-} tsc_error;
-
-/**
- * struct tp_device - Handle the platform data
- * @cs_en: pointer to the cs enable function
- * @cs_dis: pointer to the cs disable function
- * @irq_init: pointer to the irq init function
- * @irq_exit: pointer to the irq exit function
- * @pirq_en: pointer to the pen irq en function
- * @pirq_dis: pointer to the pen irq disable function
- * @pirq_read_val: pointer to read the pen irq value function
- * @board_href_v1: pointer to the get the board version
- * @irq: irq variable
- * This is used to handle the platform data
- **/
-struct tp_device {
- int (*cs_en)(void);
- int (*cs_dis)(void);
- int (*irq_init)(void (*callback)(void *parameter), void *p);
- int (*irq_exit)(void);
- int (*pirq_en) (void);
- int (*pirq_dis)(void);
- int (*pirq_read_val)(void);
- int (*board_href_v1)(void);
- unsigned int irq;
-};
-
-/**
- * struct touch_point - x and y co-ordinates of touch panel
- * @x: x co-ordinate
- * @y: y co-ordinate
- * This is used to hold the x and y co-ordinates of touch panel
- **/
-struct touch_point {
- signed short x;
- signed short y;
-};
-
-/**
- * struct gesture_info - hold the gesture of the touch
- * @gesture_kind: gesture kind variable
- * @pt: arry to touch_point structure
- * @dir: direction variable
- * @times: touch times
- * @speed: speed of the touch
- * This is used to hold the gesture of the touch.
- **/
-struct gesture_info {
- signed short gesture_kind;
- struct touch_point pt[2];
- signed short dir;
- signed short times;
- signed short speed;
-};
-
-/**
- * struct u8500_tsc_data - touch panel data structure
- * @client: pointer to the i2c client
- * @chip: pointer to the touch panel controller
- * @pin_dev: pointer to the input device structure
- * @penirq_timer: variable to the timer list structure
- * @touchp_event: variable to the wait_queue_head_t structure
- * @touch_en: variable for reporting the co-ordinates to input device.
- * @finger1_pressed: variable to indicate the first co-ordinates.
- * @finger2_pressed: variable to indicate the first co-ordinates.
- * @m_tp_timer_int_wq: variable to work structure for timer
- * @m_tp_timer_gpio_wq: variable to work structure for interrupt
- * @gesture_info: variable to gesture_info structure
- * @touch_count: variable to maintain sensors input count
- * @touchflag: variable to indicate the touch
- * @pre_tap_flag: flag to indicate the pre tap
- * @flick_flag: flickering flag
- * @touch_continue: to continue the touch flag
- * @pre_tap_flag_level: pre tap level flag
- * @x1: x1 co-ordinate
- * @y1: y1 co-ordinate
- * @x2: x2 co-ordinate
- * @y2: y2 co-ordinate
- * @pinch_start: pinch start
- * @tap_start_point: variable to touch_point structure
- * @dir_trace: array for data trace
- * @dir_idx: id for direction
- * @rotate_data: array to maintain the rotate data
- * @href_v1_flag: variable to indicate the href v1 board
- * @finger2_count: count for finger2 touches
- *
- * Tocuh panel data structure
- */
-struct u8500_tsc_data {
- struct i2c_client *client;
- struct tp_device *chip;
- struct input_dev *pin_dev;
- struct task_struct *touchp_tsk;
- struct timer_list penirq_timer;
- wait_queue_head_t touchp_event;
- unsigned short touch_en;
- unsigned short finger1_pressed;
- unsigned short finger2_pressed;
- struct work_struct m_tp_timer_int_wq;
- struct work_struct m_tp_gpio_int_wq;
- struct gesture_info gesture_info;
- signed long touch_count;
- unsigned short touchflag;
- unsigned char pre_tap_flag;
- unsigned char flick_flag;
- unsigned char touch_continue;
- unsigned char pre_tap_flag_level;
- signed short x1, y1;
- signed short x2, y2;
- unsigned char pinch_start;
- struct touch_point tap_start_point;
- unsigned char dir_trace[DIRHEADER+DIRTRACEN];
- unsigned char dir_idx;
- unsigned char rotate_data[5][5];
- bool href_v1_flag;
- u8 finger2_count;
-};
-
-int doCalibrate(struct i2c_client *i2c);
-int getCalibStatus(struct i2c_client *i2c);
-void init_config(struct u8500_tsc_data *data);
-void get_touch(struct u8500_tsc_data *data);
-void touch_calculation(struct gesture_info *p_gesture_info);
-int get_touch_message(struct u8500_tsc_data *data);
-void check_board(struct u8500_tsc_data *data);
-#endif