aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/wacom_i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/wacom_i2c.h')
-rw-r--r--include/linux/wacom_i2c.h246
1 files changed, 224 insertions, 22 deletions
diff --git a/include/linux/wacom_i2c.h b/include/linux/wacom_i2c.h
index 209fe53..2d9ad6e 100644
--- a/include/linux/wacom_i2c.h
+++ b/include/linux/wacom_i2c.h
@@ -22,12 +22,22 @@
#define NAMEBUF 12
#define WACNAME "WAC_I2C_EMR"
#define WACFLASH "WAC_I2C_FLASH"
+
+#ifdef CONFIG_EPEN_WACOM_G9PM
+#define WACOM_FW_SIZE 61440
+#else
#define WACOM_FW_SIZE 32768
+#endif
/*Wacom Command*/
-#define COM_COORD_NUM 7
-#define COM_QUERY_NUM 9
+#if defined(CONFIG_MACH_T0)
+#define COM_COORD_NUM 8
+#else
+#define COM_COORD_NUM 7
+#endif
+#define COM_QUERY_NUM 9
+#define COM_SAMPLERATE_STOP 0x30
#define COM_SAMPLERATE_40 0x33
#define COM_SAMPLERATE_80 0x32
#define COM_SAMPLERATE_133 0x31
@@ -57,60 +67,217 @@
#define WACOM_DELAY_FOR_RST_RISING 200
/* #define INIT_FIRMWARE_FLASH */
+#define WACOM_PDCT_WORK_AROUND
+
/*PDCT Signal*/
#define PDCT_NOSIGNAL 1
#define PDCT_DETECT_PEN 0
-#define WACOM_PDCT_WORK_AROUND
+
+#define WACOM_PRESSURE_MAX 255
+
+/*Digitizer Type*/
+#define EPEN_DTYPE_B660 1
+#define EPEN_DTYPE_B713 2
+#define EPEN_DTYPE_B746 3
#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_P4)
+#define WACOM_DVFS_LOCK_FREQ 800000
#ifdef CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
#define SEC_BUS_LOCK
#endif
+#if defined(CONFIG_QC_MODEM)
+#define WACOM_HAVE_FWE_PIN
+#endif
+#define BATTERY_SAVING_MODE
+#define WACOM_CONNECTION_CHECK
#define WACOM_HAVE_RESET_CONTROL 0
#define WACOM_POSX_MAX 21866
#define WACOM_POSY_MAX 13730
#define WACOM_POSX_OFFSET 170
#define WACOM_POSY_OFFSET 170
+#define WACOM_MAX_PRESSURE 0x3FF
#define WACOM_IRQ_WORK_AROUND
+#define WACOM_PEN_DETECT
+#define WACOM_MAX_COORD_X WACOM_POSX_MAX
+#define WACOM_MAX_COORD_Y WACOM_POSY_MAX
+
#elif defined(CONFIG_MACH_Q1_BD)
-#define BOARD_Q1C210
+
#define COOR_WORK_AROUND
#define WACOM_IMPORT_FW_ALGO
+#define WACOM_USE_OFFSET_TABLE
+#define WACOM_USE_AVERAGING
+#define WACOM_USE_TILT_OFFSET
+
#define WACOM_SLEEP_WITH_PEN_SLP
#define WACOM_HAVE_RESET_CONTROL 1
#define CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
+#define WACOM_DVFS_LOCK_FREQ 500000
-#if defined(BOARD_P4ADOBE) && defined(COOR_WORK_AROUND)
- #define COOR_WORK_AROUND_X_MAX 0x54C0
- #define COOR_WORK_AROUND_Y_MAX 0x34F8
- #define COOR_WORK_AROUND_PRESSURE_MAX 0xFF
-#elif (defined(BOARD_Q1OMAP4430) || defined(BOARD_Q1C210))\
- && defined(COOR_WORK_AROUND)
- #define COOR_WORK_AROUND_X_MAX 0x2C80
- #define COOR_WORK_AROUND_Y_MAX 0x1BD0
- #define COOR_WORK_AROUND_PRESSURE_MAX 0xFF
-#endif
+#define COOR_WORK_AROUND_X_MAX 0x2C80
+#define COOR_WORK_AROUND_Y_MAX 0x1BD0
+#define COOR_WORK_AROUND_PRESSURE_MAX 0xFF
#define WACOM_I2C_TRANSFER_STYLE
#if !defined(WACOM_I2C_TRANSFER_STYLE)
#define WACOM_I2C_RECV_SEND_STYLE
#endif
-#ifdef CONFIG_MACH_Q1_BD
+#define WACOM_MAX_COORD_X 11392
+#define WACOM_MAX_COORD_Y 7120
+#define WACOM_MAX_PRESSURE 0xFF
+
/* For Android origin */
-#define WACOM_POSX_MAX 7120
-#define WACOM_POSY_MAX 11392
-#define WACOM_PRESSURE_MAX 255
+#define WACOM_POSX_MAX WACOM_MAX_COORD_Y
+#define WACOM_POSY_MAX WACOM_MAX_COORD_X
#define MAX_ROTATION 4
#define MAX_HAND 2
-#endif /* CONFIG_MACH_Q1_BD */
-#endif /* !defined(WACOM_P4) */
+
+#elif defined(CONFIG_MACH_T0)
+
+#define WACOM_MAX_COORD_X 12288
+#define WACOM_MAX_COORD_Y 6912
+#define WACOM_MAX_PRESSURE 0xFF
+
+/* For Android origin */
+#define WACOM_POSX_MAX WACOM_MAX_COORD_Y
+#define WACOM_POSY_MAX WACOM_MAX_COORD_X
+
+#define COOR_WORK_AROUND
+#define WACOM_IMPORT_FW_ALGO
+#define WACOM_USE_OFFSET_TABLE
+#define WACOM_USE_AVERAGING
+#define WACOM_USE_BOXFILTER
+#define WACOM_USE_TILT_OFFSET
+
+#define MAX_ROTATION 4
+#define MAX_HAND 2
+
+#define WACOM_PEN_DETECT
+
+/* origin offset */
+#define EPEN_B660_ORG_X 456
+#define EPEN_B660_ORG_Y 504
+
+#define EPEN_B713_ORG_X 676
+#define EPEN_B713_ORG_Y 724
+
+/*Box Filter Parameters*/
+#define X_INC_S1 1500
+#define X_INC_E1 (WACOM_MAX_COORD_X - 1500)
+#define Y_INC_S1 1500
+#define Y_INC_E1 (WACOM_MAX_COORD_Y - 1500)
+
+#define Y_INC_S2 700
+#define Y_INC_E2 (WACOM_MAX_COORD_Y - 700)
+#define Y_INC_S3 900
+#define Y_INC_E3 (WACOM_MAX_COORD_Y - 900)
+
+#define CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
+#define WACOM_DVFS_LOCK_FREQ 800000
+#define BATTERY_SAVING_MODE
+
+/*HWID to distinguish Detect Switch*/
+#if defined(CONFIG_MACH_T0_EUR_LTE) \
+ || defined(CONFIG_MACH_T0_EUR_OPEN) \
+ || defined(CONFIG_MACH_T0_USA_ATT) \
+ || defined(CONFIG_MACH_T0_USA_VZW) \
+ || defined(CONFIG_MACH_T0_USA_SPR) \
+ || defined(CONFIG_MACH_T0_USA_TMO) \
+ || defined(CONFIG_MACH_T0GQ_JPN_LTE_DCM) \
+ || defined(CONFIG_MACH_T0_JPN_LTE_DCM) \
+ || defined(CONFIG_MACH_T0_CHN_OPEN) \
+ || defined(CONFIG_MACH_T0_CHN_CU) \
+ || defined(CONFIG_MACH_T0_CHN_CU_DUOS) \
+ || defined(CONFIG_MACH_T0_CHN_CMCC) \
+ || defined(CONFIG_MACH_T0_CHN_CTC) \
+ || defined(CONFIG_MACH_T0_CHN_OPEN_DUOS)
+#define WACOM_DETECT_SWITCH_HWID 7
+
+#elif defined(CONFIG_MACH_T0_KOR_SKT) \
+ || defined(CONFIG_MACH_T0_KOR_LGT) \
+ || defined(CONFIG_MACH_T0_KOR_KT)
+#define WACOM_DETECT_SWITCH_HWID 6
+
+#elif defined(CONFIG_MACH_T0_USA_USCC)
+ #define WACOM_DETECT_SWITCH_HWID 8
+
+#else
+
+#define WACOM_DETECT_SWITCH_HWID 0xFFFF
+#endif
+
+/*HWID to distinguish FWE1*/
+#if defined(CONFIG_MACH_T0_EUR_LTE) \
+ || defined(CONFIG_MACH_T0_EUR_OPEN) \
+ || defined(CONFIG_MACH_T0_USA_ATT) \
+ || defined(CONFIG_MACH_T0_USA_VZW) \
+ || defined(CONFIG_MACH_T0_USA_SPR) \
+ || defined(CONFIG_MACH_T0_USA_TMO) \
+ || defined(CONFIG_MACH_T0_USA_USCC) \
+ || defined(CONFIG_MACH_T0_KOR_SKT) \
+ || defined(CONFIG_MACH_T0_KOR_KT) \
+ || defined(CONFIG_MACH_T0_KOR_LGT) \
+ || defined(CONFIG_MACH_T0GQ_JPN_LTE_DCM) \
+ || defined(CONFIG_MACH_T0_JPN_LTE_DCM) \
+ || defined(CONFIG_MACH_T0_CHN_OPEN) \
+ || defined(CONFIG_MACH_T0_CHN_CU) \
+ || defined(CONFIG_MACH_T0_CHN_CU_DUOS) \
+ || defined(CONFIG_MACH_T0_CHN_CMCC) \
+ || defined(CONFIG_MACH_T0_CHN_CTC) \
+ || defined(CONFIG_MACH_T0_CHN_OPEN_DUOS)
+#define WACOM_FWE1_HWID 8
+
+#else
+#define WACOM_FWE1_HWID 0xFFFF
+
+#endif
+
+/*HWID to distinguish B713 Digitizer*/
+#define WACOM_DTYPE_B713_HWID 4
+/*HWID to distinguish B746 Digitizer*/
+#if defined(CONFIG_MACH_T0_CHN_CMCC)
+#define WACOM_DTYPE_B746_HWID 8
+
+#elif defined(CONFIG_MACH_T0_EUR_LTE) \
+ || defined(CONFIG_MACH_T0_EUR_OPEN) \
+ || defined(CONFIG_MACH_T0_USA_ATT) \
+ || defined(CONFIG_MACH_T0_USA_VZW) \
+ || defined(CONFIG_MACH_T0_USA_SPR) \
+ || defined(CONFIG_MACH_T0_KOR_SKT) \
+ || defined(CONFIG_MACH_T0_KOR_LGT) \
+ || defined(CONFIG_MACH_T0_KOR_KT) \
+ || defined(CONFIG_MACH_T0_CHN_OPEN) \
+ || defined(CONFIG_MACH_T0_CHN_CU) \
+ || defined(CONFIG_MACH_T0_CHN_CU_DUOS) \
+ || defined(CONFIG_MACH_T0_CHN_CTC) \
+ || defined(CONFIG_MACH_T0_CHN_OPEN_DUOS)
+#define WACOM_DTYPE_B746_HWID 9
+
+#elif defined(CONFIG_MACH_T0_USA_TMO) \
+ || defined(CONFIG_MACH_T0_USA_USCC) \
+ || defined(CONFIG_MACH_T0_JPN_LTE_DCM)
+#define WACOM_DTYPE_B746_HWID 10
+
+#else
+#define WACOM_DTYPE_B746_HWID 0xFFFF
+
+#endif
+
+
+#endif /*End of Model config*/
#if !defined(WACOM_SLEEP_WITH_PEN_SLP)
#define WACOM_SLEEP_WITH_PEN_LDO_EN
#endif
+#ifdef BATTERY_SAVING_MODE
+#ifndef WACOM_PEN_DETECT
+#define WACOM_PEN_DETECT
+#endif
+#endif
+
/*Parameters for wacom own features*/
struct wacom_features {
int x_max;
@@ -161,6 +328,12 @@ struct wacom_g5_platform_data {
int max_pressure;
int min_pressure;
int gpio_pendct;
+#ifdef WACOM_PEN_DETECT
+ int gpio_pen_insert;
+#endif
+#ifdef WACOM_HAVE_FWE_PIN
+ int gpio_fwe;
+#endif
int (*init_platform_hw)(void);
int (*exit_platform_hw)(void);
int (*suspend_platform_hw)(void);
@@ -174,6 +347,7 @@ struct wacom_g5_platform_data {
/*Parameters for i2c driver*/
struct wacom_i2c {
struct i2c_client *client;
+ struct i2c_client *client_boot;
struct input_dev *input_dev;
struct early_suspend early_suspend;
struct mutex lock;
@@ -182,6 +356,7 @@ struct wacom_i2c {
int irq;
#ifdef WACOM_PDCT_WORK_AROUND
int irq_pdct;
+ bool rdy_pdct;
#endif
int pen_pdct;
int gpio;
@@ -190,12 +365,29 @@ struct wacom_i2c {
int pen_pressed;
int side_pressed;
int tool;
+ u16 last_x;
+ u16 last_y;
+#ifdef WACOM_PEN_DETECT
+ struct delayed_work pen_insert_dwork;
+ bool pen_insert;
+ int gpio_pen_insert;
+#ifdef CONFIG_MACH_T0
+ int invert_pen_insert;
+#endif
+#endif
+#ifdef WACOM_HAVE_FWE_PIN
+ int gpio_fwe;
+#endif
+#ifdef WACOM_IMPORT_FW_ALGO
+ bool use_offset_table;
+ bool use_box_filter;
+#endif
+ bool checksum_result;
const char name[NAMEBUF];
struct wacom_features *wac_feature;
struct wacom_g5_platform_data *wac_pdata;
struct wacom_g5_callbacks callbacks;
int (*power)(int on);
- struct work_struct update_work;
struct delayed_work resume_work;
#ifdef WACOM_IRQ_WORK_AROUND
struct delayed_work pendct_dwork;
@@ -204,10 +396,20 @@ struct wacom_i2c {
unsigned int cpufreq_level;
bool dvfs_lock_status;
struct delayed_work dvfs_work;
-#if defined(CONFIG_MACH_P4NOTE)
struct device *bus_dev;
#endif
+#ifdef CONFIG_MACH_P4NOTE
+ bool pen_type;
+#endif
+#ifdef WACOM_CONNECTION_CHECK
+ bool connection_check;
+#endif
+#ifdef BATTERY_SAVING_MODE
+ bool battery_saving_mode;
#endif
+ bool power_enable;
+ bool boot_mode;
+ bool query_status;
};
#endif /* _LINUX_WACOM_I2C_H */