| 
      1
     | 
    
      /*
 
     | 
  
  
    | 
      2
     | 
    
       * drivers/input/touchscreen/sitronix_i2c_touch.h
 
     | 
  
  
    | 
      3
     | 
    
       *
 
     | 
  
  
    | 
      4
     | 
    
       * Touchscreen driver for Sitronix
 
     | 
  
  
    | 
      5
     | 
    
       *
 
     | 
  
  
    | 
      6
     | 
    
       * Copyright (C) 2011 Sitronix Technology Co., Ltd.
 
     | 
  
  
    | 
      7
     | 
    
       *	Rudy Huang <rudy_huang@sitronix.com.tw>
 
     | 
  
  
    | 
      8
     | 
    
       */
 
     | 
  
  
    | 
      9
     | 
    
      /*
 
     | 
  
  
    | 
      10
     | 
    
       * This program is free software; you can redistribute it and/or modify it
 
     | 
  
  
    | 
      11
     | 
    
       * under the terms of the GNU General Public License as published by the Free
 
     | 
  
  
    | 
      12
     | 
    
       * Software Foundation; either version 2 of the License, or (at your option)
 
     | 
  
  
    | 
      13
     | 
    
       * any later version.
 
     | 
  
  
    | 
      14
     | 
    
       */
 
     | 
  
  
    | 
      15
     | 
    
      
 
     | 
  
  
    | 
      16
     | 
    
      #ifndef __SITRONIX_I2C_TOUCH_h
 
     | 
  
  
    | 
      17
     | 
    
      #define __SITRONIX_I2C_TOUCH_h
 
     | 
  
  
    | 
      18
     | 
    
      
 
     | 
  
  
    | 
      19
     | 
    
      #include <linux/kernel.h>
 
     | 
  
  
    | 
      20
     | 
    
      #include <linux/hrtimer.h>
 
     | 
  
  
    | 
      21
     | 
    
      #include <linux/i2c.h>
 
     | 
  
  
    | 
      22
     | 
    
      #include <linux/input.h>
 
     | 
  
  
    | 
      23
     | 
    
      #include <linux/module.h>
 
     | 
  
  
    | 
      24
     | 
    
      #include <linux/delay.h>
 
     | 
  
  
    | 
      25
     | 
    
      #include <linux/i2c.h>
 
     | 
  
  
    | 
      26
     | 
    
      #include <linux/proc_fs.h>
 
     | 
  
  
    | 
      27
     | 
    
      #include <linux/string.h>
 
     | 
  
  
    | 
      28
     | 
    
      #include <asm/uaccess.h>
 
     | 
  
  
    | 
      29
     | 
    
      #include <linux/vmalloc.h>
 
     | 
  
  
    | 
      30
     | 
    
      #include <linux/interrupt.h>
 
     | 
  
  
    | 
      31
     | 
    
      #include <linux/io.h>
 
     | 
  
  
    | 
      32
     | 
    
      
 
     | 
  
  
    | 
      33
     | 
    
      #ifdef CONFIG_HAS_EARLYSUSPEND
 
     | 
  
  
    | 
      34
     | 
    
      #include <linux/earlysuspend.h>
 
     | 
  
  
    | 
      35
     | 
    
      #endif
 
     | 
  
  
    | 
      36
     | 
    
      
 
     | 
  
  
    | 
      37
     | 
    
      
 
     | 
  
  
    | 
      38
     | 
    
      #include <linux/device.h>
 
     | 
  
  
    | 
      39
     | 
    
      #include <linux/slab.h>
 
     | 
  
  
    | 
      40
     | 
    
      #include <linux/init.h>
 
     | 
  
  
    | 
      41
     | 
    
      #include <linux/errno.h>
 
     | 
  
  
    | 
      42
     | 
    
      #include <linux/platform_device.h>
 
     | 
  
  
    | 
      43
     | 
    
      #include <linux/async.h>
 
     | 
  
  
    | 
      44
     | 
    
      #include <linux/ioport.h>
 
     | 
  
  
    | 
      45
     | 
    
      #include <asm/irq.h>
 
     | 
  
  
    | 
      46
     | 
    
      #include <asm/delay.h>
 
     | 
  
  
    | 
      47
     | 
    
      #include <linux/irq.h>
 
     | 
  
  
    | 
      48
     | 
    
      #include <linux/gpio.h>
 
     | 
  
  
    | 
      49
     | 
    
      //#include <mach/irqs.h>
 
     | 
  
  
    | 
      50
     | 
    
      //#include <soc/sprd/hardware.h>
 
     | 
  
  
    | 
      51
     | 
    
      //#include <mach/sys_config.h>
 
     | 
  
  
    | 
      52
     | 
    
      //#include <linux/init-input.h>
 
     | 
  
  
    | 
      53
     | 
    
      
 
     | 
  
  
    | 
      54
     | 
    
      #include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
 
     | 
  
  
    | 
      55
     | 
    
      
 
     | 
  
  
    | 
      56
     | 
    
      
 
     | 
  
  
    | 
      57
     | 
    
      
 
     | 
  
  
    | 
      58
     | 
    
      #define SITRONIX_TOUCH_DRIVER_VERSION 0x03
 
     | 
  
  
    | 
      59
     | 
    
      #define SITRONIX_MAX_SUPPORTED_POINT 10
 
     | 
  
  
    | 
      60
     | 
    
      #define SITRONIX_I2C_TOUCH_DRV_NAME "sitronix"
 
     | 
  
  
    | 
      61
     | 
    
      #define SITRONIX_I2C_TOUCH_DEV_NAME "sitronixDev"
 
     | 
  
  
    | 
      62
     | 
    
      //#define SITRONIX_I2C_TOUCH_MT_INPUT_DEV_NAME "sitronix"
 
     | 
  
  
    | 
      63
     | 
    
      #define SITRONIX_I2C_TOUCH_MT_INPUT_DEV_NAME "SITRONIX"
 
     | 
  
  
    | 
      64
     | 
    
      #define SITRONIX_I2C_TOUCH_KEY_INPUT_DEV_NAME "sitronix-i2c-touch-key"
 
     | 
  
  
    | 
      65
     | 
    
      
 
     | 
  
  
    | 
      66
     | 
    
      //#define CONFIG_ARCH_SUNXI
 
     | 
  
  
    | 
      67
     | 
    
      
 
     | 
  
  
    | 
      68
     | 
    
      #ifdef CONFIG_MACH_DEVKIT8000
 
     | 
  
  
    | 
      69
     | 
    
      #define SITRONIX_RESET_GPIO	170
 
     | 
  
  
    | 
      70
     | 
    
      #define SITRONIX_INT_GPIO	157
 
     | 
  
  
    | 
      71
     | 
    
      #elif defined(CONFIG_MACH_OMAP4_PANDA)
 
     | 
  
  
    | 
      72
     | 
    
      #define SITRONIX_RESET_GPIO	44
 
     | 
  
  
    | 
      73
     | 
    
      #define SITRONIX_INT_GPIO	47
 
     | 
  
  
    | 
      74
     | 
    
      #elif defined(CONFIG_ARCH_MSM8X60)
 
     | 
  
  
    | 
      75
     | 
    
      #define SITRONIX_RESET_GPIO	58
 
     | 
  
  
    | 
      76
     | 
    
      #define SITRONIX_INT_GPIO	61
 
     | 
  
  
    | 
      77
     | 
    
      #endif // CONFIG_MACH_DEVKIT8000
 
     | 
  
  
    | 
      78
     | 
    
      
 
     | 
  
  
    | 
      79
     | 
    
      // MT SLOT feature is implmented in linux kernel 2.6.38 and later. Make sure that version of your linux kernel before using this feature.
 
     | 
  
  
    | 
      80
     | 
    
      //#define SITRONIX_SUPPORT_MT_SLOT
 
     | 
  
  
    | 
      81
     | 
    
      //#define SITRONIX_SWAP_XY
 
     | 
  
  
    | 
      82
     | 
    
      //#define SITRONIX_I2C_COMBINED_MESSAGE
 
     | 
  
  
    | 
      83
     | 
    
      #ifndef SITRONIX_I2C_COMBINED_MESSAGE
 
     | 
  
  
    | 
      84
     | 
    
      #define SITRONIX_I2C_SINGLE_MESSAGE
 
     | 
  
  
    | 
      85
     | 
    
      #endif // SITRONIX_I2C_COMBINED_MESSAGE
 
     | 
  
  
    | 
      86
     | 
    
      //#define SITRONIX_MONITOR_THREAD
 
     | 
  
  
    | 
      87
     | 
    
      #define DELAY_MONITOR_THREAD_START_PROBE 10000
 
     | 
  
  
    | 
      88
     | 
    
      #define DELAY_MONITOR_THREAD_START_RESUME 3000
 
     | 
  
  
    | 
      89
     | 
    
      #define SITRONIX_FW_UPGRADE_FEATURE
 
     | 
  
  
    | 
      90
     | 
    
      //#define SITRONIX_PERMISSION_THREAD
 
     | 
  
  
    | 
      91
     | 
    
      #define SITRONIX_SYSFS
 
     | 
  
  
    | 
      92
     | 
    
      #define SITRONIX_LEVEL_TRIGGERED
 
     | 
  
  
    | 
      93
     | 
    
      
 
     | 
  
  
    | 
      94
     | 
    
      // When enable_irq() is invoked, irq will be sent once while INT is not triggered if CONFIG_HARDIRQS_SW_RESEND is set.
 
     | 
  
  
    | 
      95
     | 
    
      // This behavior is implemented by linux kernel, it is used to prevent irq from losting when irq is edge-triggered mode.
 
     | 
  
  
    | 
      96
     | 
    
      #ifndef SITRONIX_LEVEL_TRIGGERED
 
     | 
  
  
    | 
      97
     | 
    
      #define SITRONIX_INT_POLLING_MODE
 
     | 
  
  
    | 
      98
     | 
    
      #define INT_POLLING_MODE_INTERVAL 14
 
     | 
  
  
    | 
      99
     | 
    
      #endif // SITRONIX_LEVEL_TRIGGERED
 
     | 
  
  
    | 
      100
     | 
    
      //#define SITRONIX_IDENTIFY_ID
 
     | 
  
  
    | 
      101
     | 
    
      //#define SITRONIX_MULTI_SLAVE_ADDR
 
     | 
  
  
    | 
      102
     | 
    
      
 
     | 
  
  
    | 
      103
     | 
    
      #define EnableDbgMsg 1
 
     | 
  
  
    | 
      104
     | 
    
      #define EnableUpgradeMsg 1
 
     | 
  
  
    | 
      105
     | 
    
      
 
     | 
  
  
    | 
      106
     | 
    
      #ifdef EnableDbgMsg
 
     | 
  
  
    | 
      107
     | 
    
      #define DbgMsg(arg...) printk(arg)
 
     | 
  
  
    | 
      108
     | 
    
      #else
 
     | 
  
  
    | 
      109
     | 
    
      #define DbgMsg(arg...)
 
     | 
  
  
    | 
      110
     | 
    
      #endif
 
     | 
  
  
    | 
      111
     | 
    
      
 
     | 
  
  
    | 
      112
     | 
    
      #define ErrorMsg(fmt,arg...) 	printk(KERN_ERR"<<-SITRONIX-ERROR->> "fmt"\n",##arg)
 
     | 
  
  
    | 
      113
     | 
    
      
 
     | 
  
  
    | 
      114
     | 
    
      #ifdef EnableUpgradeMsg
 
     | 
  
  
    | 
      115
     | 
    
      #define UpgradeMsg(arg...) printk(arg)
 
     | 
  
  
    | 
      116
     | 
    
      #else
 
     | 
  
  
    | 
      117
     | 
    
      #define UpgradeMsg(arg...)
 
     | 
  
  
    | 
      118
     | 
    
      #endif
 
     | 
  
  
    | 
      119
     | 
    
      
 
     | 
  
  
    | 
      120
     | 
    
      #define CTP_AP_SP_SYNC_NONE	0
 
     | 
  
  
    | 
      121
     | 
    
      #define CTP_AP_SP_SYNC_APP		(1 << 0)
 
     | 
  
  
    | 
      122
     | 
    
      #define CTP_AP_SP_SYNC_GPIO 	(1 << 1)
 
     | 
  
  
    | 
      123
     | 
    
      #define CTP_AP_SP_SYNC_BOTH 	(CTP_AP_SP_SYNC_GPIO | CTP_AP_SP_SYNC_APP)
 
     | 
  
  
    | 
      124
     | 
    
      
 
     | 
  
  
    | 
      125
     | 
    
      #define CTP_AP_SP_SYNC_WAY	CTP_AP_SP_SYNC_BOTH
 
     | 
  
  
    | 
      126
     | 
    
      
 
     | 
  
  
    | 
      127
     | 
    
      typedef enum{
     | 
  
  
    | 
      128
     | 
    
      	FIRMWARE_VERSION,
 
     | 
  
  
    | 
      129
     | 
    
      	STATUS_REG,
 
     | 
  
  
    | 
      130
     | 
    
      	DEVICE_CONTROL_REG,
 
     | 
  
  
    | 
      131
     | 
    
      	TIMEOUT_TO_IDLE_REG,
 
     | 
  
  
    | 
      132
     | 
    
      	XY_RESOLUTION_HIGH,
 
     | 
  
  
    | 
      133
     | 
    
      	X_RESOLUTION_LOW,
 
     | 
  
  
    | 
      134
     | 
    
      	Y_RESOLUTION_LOW,
 
     | 
  
  
    | 
      135
     | 
    
      	DEVICE_CONTROL_REG2 = 0x09,
 
     | 
  
  
    | 
      136
     | 
    
      	FIRMWARE_REVISION_3 = 0x0C,
 
     | 
  
  
    | 
      137
     | 
    
      	FIRMWARE_REVISION_2,
 
     | 
  
  
    | 
      138
     | 
    
      	FIRMWARE_REVISION_1,
 
     | 
  
  
    | 
      139
     | 
    
      	FIRMWARE_REVISION_0,
 
     | 
  
  
    | 
      140
     | 
    
      	FINGERS,
 
     | 
  
  
    | 
      141
     | 
    
      	KEYS_REG,
 
     | 
  
  
    | 
      142
     | 
    
      	XY0_COORD_H,
 
     | 
  
  
    | 
      143
     | 
    
      	X0_COORD_L,
 
     | 
  
  
    | 
      144
     | 
    
      	Y0_COORD_L,
 
     | 
  
  
    | 
      145
     | 
    
      	I2C_PROTOCOL = 0x3E,
 
     | 
  
  
    | 
      146
     | 
    
      	MAX_NUM_TOUCHES,
 
     | 
  
  
    | 
      147
     | 
    
      	DATA_0_HIGH,
 
     | 
  
  
    | 
      148
     | 
    
      	DATA_0_LOW,
 
     | 
  
  
    | 
      149
     | 
    
      	MISC_CONTROL = 0xF1,
 
     | 
  
  
    | 
      150
     | 
    
      	SMART_WAKE_UP_REG = 0xF2,
 
     | 
  
  
    | 
      151
     | 
    
      	CHIP_ID = 0xF4,
 
     | 
  
  
    | 
      152
     | 
    
      	PAGE_REG = 0xff,
 
     | 
  
  
    | 
      153
     | 
    
      }RegisterOffset;
 
     | 
  
  
    | 
      154
     | 
    
      
 
     | 
  
  
    | 
      155
     | 
    
      
 
     | 
  
  
    | 
      156
     | 
    
      //#define SITRONIX_SMART_WAKE_UP
 
     | 
  
  
    | 
      157
     | 
    
      #ifdef SITRONIX_SMART_WAKE_UP
 
     | 
  
  
    | 
      158
     | 
    
      typedef enum{
     | 
  
  
    | 
      159
     | 
    
      	SWK_NO = 0x0,
 
     | 
  
  
    | 
      160
     | 
    
      	CHARACTER_C	    = 0x63,
 
     | 
  
  
    | 
      161
     | 
    
      	CHARACTER_E	    = 0x65,
 
     | 
  
  
    | 
      162
     | 
    
      	CHARACTER_M	    = 0x6D,
 
     | 
  
  
    | 
      163
     | 
    
      	CHARACTER_O	    = 0x6F,
 
     | 
  
  
    | 
      164
     | 
    
      	CHARACTER_S	    = 0x73,
 
     | 
  
  
    | 
      165
     | 
    
      	CHARACTER_V	    = 0x76,
 
     | 
  
  
    | 
      166
     | 
    
      	CHARACTER_W	    = 0x77,
 
     | 
  
  
    | 
      167
     | 
    
      	CHARACTER_Z	    = 0x7A,
 
     | 
  
  
    | 
      168
     | 
    
      	LEFT_TO_RIGHT_SLIDE = 0xB0,
 
     | 
  
  
    | 
      169
     | 
    
      	RIGHT_TO_LEFT_SLIDE = 0xB4,
 
     | 
  
  
    | 
      170
     | 
    
      	TOP_TO_DOWN_SLIDE   = 0xB8,
 
     | 
  
  
    | 
      171
     | 
    
      	DOWN_TO_UP_SLIDE    = 0xBC,
 
     | 
  
  
    | 
      172
     | 
    
      	DOUBLE_CLICK	    = 0xC0,
 
     | 
  
  
    | 
      173
     | 
    
      	SINGLE_CLICK	    = 0xC8,
 
     | 
  
  
    | 
      174
     | 
    
      }SWK_ID;
 
     | 
  
  
    | 
      175
     | 
    
      #endif
 
     | 
  
  
    | 
      176
     | 
    
      
 
     | 
  
  
    | 
      177
     | 
    
      //#define SITRONIX_GESTURE
 
     | 
  
  
    | 
      178
     | 
    
      #ifdef SITRONIX_GESTURE
 
     | 
  
  
    | 
      179
     | 
    
      typedef enum{
     | 
  
  
    | 
      180
     | 
    
      	G_NO 			 = 0x0,
 
     | 
  
  
    | 
      181
     | 
    
      	G_ZOOM_IN	   	 = 0x2,
 
     | 
  
  
    | 
      182
     | 
    
      	G_ZOOM_OUT	 = 0x3,
 
     | 
  
  
    | 
      183
     | 
    
      	G_L_2_R		 = 0x4,
 
     | 
  
  
    | 
      184
     | 
    
      	G_R_2_L		 = 0x5,
 
     | 
  
  
    | 
      185
     | 
    
      	G_T_2_D		 = 0x6,
 
     | 
  
  
    | 
      186
     | 
    
      	G_D_2_T		 = 0x7,
 
     | 
  
  
    | 
      187
     | 
    
      	G_PALM		   	 = 0x8,
 
     | 
  
  
    | 
      188
     | 
    
      	G_SINGLE_TAB	 = 0x9,
 
     | 
  
  
    | 
      189
     | 
    
      }GESTURE_ID;
 
     | 
  
  
    | 
      190
     | 
    
      #endif
 
     | 
  
  
    | 
      191
     | 
    
      
 
     | 
  
  
    | 
      192
     | 
    
      #define SITRONIX_TS_CHANGE_MODE_DELAY 150
 
     | 
  
  
    | 
      193
     | 
    
      
 
     | 
  
  
    | 
      194
     | 
    
      typedef enum{
     | 
  
  
    | 
      195
     | 
    
      	XY_COORD_H,
 
     | 
  
  
    | 
      196
     | 
    
      	X_COORD_L,
 
     | 
  
  
    | 
      197
     | 
    
      	Y_COORD_L,
 
     | 
  
  
    | 
      198
     | 
    
      	PIXEL_DATA_LENGTH_B,
 
     | 
  
  
    | 
      199
     | 
    
      	PIXEL_DATA_LENGTH_A,
 
     | 
  
  
    | 
      200
     | 
    
      }PIXEL_DATA_FORMAT;
 
     | 
  
  
    | 
      201
     | 
    
      
 
     | 
  
  
    | 
      202
     | 
    
      #define X_RES_H_SHFT 4
 
     | 
  
  
    | 
      203
     | 
    
      #define X_RES_H_BMSK 0xf
 
     | 
  
  
    | 
      204
     | 
    
      #define Y_RES_H_SHFT 0
 
     | 
  
  
    | 
      205
     | 
    
      #define Y_RES_H_BMSK 0xf
 
     | 
  
  
    | 
      206
     | 
    
      #define FINGERS_SHFT 0
 
     | 
  
  
    | 
      207
     | 
    
      #define FINGERS_BMSK 0xf
 
     | 
  
  
    | 
      208
     | 
    
      #define X_COORD_VALID_SHFT 7
 
     | 
  
  
    | 
      209
     | 
    
      #define X_COORD_VALID_BMSK 0x1
 
     | 
  
  
    | 
      210
     | 
    
      #define X_COORD_H_SHFT 4
 
     | 
  
  
    | 
      211
     | 
    
      #define X_COORD_H_BMSK 0x7
 
     | 
  
  
    | 
      212
     | 
    
      #define Y_COORD_H_SHFT 0
 
     | 
  
  
    | 
      213
     | 
    
      #define Y_COORD_H_BMSK 0x7
 
     | 
  
  
    | 
      214
     | 
    
      
 
     | 
  
  
    | 
      215
     | 
    
      typedef enum{
     | 
  
  
    | 
      216
     | 
    
      	SITRONIX_RESERVED_TYPE_0,
 
     | 
  
  
    | 
      217
     | 
    
      	SITRONIX_A_TYPE,
 
     | 
  
  
    | 
      218
     | 
    
      	SITRONIX_B_TYPE,
 
     | 
  
  
    | 
      219
     | 
    
      }I2C_PROTOCOL_TYPE;
 
     | 
  
  
    | 
      220
     | 
    
      
 
     | 
  
  
    | 
      221
     | 
    
      #define I2C_PROTOCOL_SHFT 0x0
 
     | 
  
  
    | 
      222
     | 
    
      #define I2C_PROTOCOL_BMSK 0x3
 
     | 
  
  
    | 
      223
     | 
    
      
 
     | 
  
  
    | 
      224
     | 
    
      typedef enum{
     | 
  
  
    | 
      225
     | 
    
      	SENSING_BOTH,
 
     | 
  
  
    | 
      226
     | 
    
      	SENSING_X_ONLY,
 
     | 
  
  
    | 
      227
     | 
    
      	SENSING_Y_ONLY,
 
     | 
  
  
    | 
      228
     | 
    
      	SENSING_BOTH_NOT,
 
     | 
  
  
    | 
      229
     | 
    
      }ONE_D_SENSING_CONTROL_MODE;
 
     | 
  
  
    | 
      230
     | 
    
      
 
     | 
  
  
    | 
      231
     | 
    
      #define ONE_D_SENSING_CONTROL_SHFT 0x2
 
     | 
  
  
    | 
      232
     | 
    
      #define ONE_D_SENSING_CONTROL_BMSK 0x3
 
     | 
  
  
    | 
      233
     | 
    
      
 
     | 
  
  
    | 
      234
     | 
    
      #define SMT_IOC_MAGIC   0xf1
 
     | 
  
  
    | 
      235
     | 
    
      
 
     | 
  
  
    | 
      236
     | 
    
      enum{
     | 
  
  
    | 
      237
     | 
    
      	SMT_GET_DRIVER_REVISION = 1,
 
     | 
  
  
    | 
      238
     | 
    
      	SMT_GET_FW_REVISION,
 
     | 
  
  
    | 
      239
     | 
    
      	SMT_ENABLE_IRQ,
 
     | 
  
  
    | 
      240
     | 
    
      	SMT_DISABLE_IRQ,
 
     | 
  
  
    | 
      241
     | 
    
      	SMT_RESUME,
 
     | 
  
  
    | 
      242
     | 
    
      	SMT_SUSPEND,
 
     | 
  
  
    | 
      243
     | 
    
      	SMT_HW_RESET,
 
     | 
  
  
    | 
      244
     | 
    
      	SMT_REPROBE,
 
     | 
  
  
    | 
      245
     | 
    
      	SMT_RAW_TEST,
 
     | 
  
  
    | 
      246
     | 
    
      	SMT_IOC_MAXNR,
 
     | 
  
  
    | 
      247
     | 
    
      };
 
     | 
  
  
    | 
      248
     | 
    
      
 
     | 
  
  
    | 
      249
     | 
    
      #define IOCTL_SMT_GET_DRIVER_REVISION				_IOC(_IOC_READ,  SMT_IOC_MAGIC, SMT_GET_DRIVER_REVISION, 			1)
 
     | 
  
  
    | 
      250
     | 
    
      #define IOCTL_SMT_GET_FW_REVISION					_IOC(_IOC_READ,  SMT_IOC_MAGIC, SMT_GET_FW_REVISION, 				4)
 
     | 
  
  
    | 
      251
     | 
    
      #define IOCTL_SMT_ENABLE_IRQ					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_ENABLE_IRQ, 0)
 
     | 
  
  
    | 
      252
     | 
    
      #define IOCTL_SMT_DISABLE_IRQ					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_DISABLE_IRQ, 0)
 
     | 
  
  
    | 
      253
     | 
    
      #define IOCTL_SMT_RESUME					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_RESUME, 0)
 
     | 
  
  
    | 
      254
     | 
    
      #define IOCTL_SMT_SUSPEND					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_SUSPEND, 0)
 
     | 
  
  
    | 
      255
     | 
    
      #define IOCTL_SMT_HW_RESET					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_HW_RESET, 0)
 
     | 
  
  
    | 
      256
     | 
    
      #define IOCTL_SMT_REPROBE					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_REPROBE, 0)
 
     | 
  
  
    | 
      257
     | 
    
      #define IOCTL_SMT_RAW_TEST					_IOC(_IOC_NONE, SMT_IOC_MAGIC, SMT_RAW_TEST, 0)
 
     | 
  
  
    | 
      258
     | 
    
      
 
     | 
  
  
    | 
      259
     | 
    
      
 
     | 
  
  
    | 
      260
     | 
    
      //#define SITRONIX_AA_KEY
 
     | 
  
  
    | 
      261
     | 
    
      #define SITRONIX_KEY_BOUNDARY_MANUAL_SPECIFY
 
     | 
  
  
    | 
      262
     | 
    
      
 
     | 
  
  
    | 
      263
     | 
    
      typedef struct {
     | 
  
  
    | 
      264
     | 
    
      	u8 y_h		:3,
 
     | 
  
  
    | 
      265
     | 
    
      	   reserved	:1,
 
     | 
  
  
    | 
      266
     | 
    
      	   x_h		:3,
 
     | 
  
  
    | 
      267
     | 
    
      	   valid	:1;
 
     | 
  
  
    | 
      268
     | 
    
      	u8 x_l;
 
     | 
  
  
    | 
      269
     | 
    
      	u8 y_l;
 
     | 
  
  
    | 
      270
     | 
    
      	u8 z;
 
     | 
  
  
    | 
      271
     | 
    
      }xy_data_t;
 
     | 
  
  
    | 
      272
     | 
    
      
 
     | 
  
  
    | 
      273
     | 
    
      typedef struct {
     | 
  
  
    | 
      274
     | 
    
      	xy_data_t	xy_data[SITRONIX_MAX_SUPPORTED_POINT];
 
     | 
  
  
    | 
      275
     | 
    
      }stx_report_data_t;
 
     | 
  
  
    | 
      276
     | 
    
      
 
     | 
  
  
    | 
      277
     | 
    
      struct sitronix_sensor_key_t{
     | 
  
  
    | 
      278
     | 
    
      	unsigned int code;
 
     | 
  
  
    | 
      279
     | 
    
      };
 
     | 
  
  
    | 
      280
     | 
    
      
 
     | 
  
  
    | 
      281
     | 
    
      #ifndef SITRONIX_AA_KEY
 
     | 
  
  
    | 
      282
     | 
    
      enum{
     | 
  
  
    | 
      283
     | 
    
      	AREA_NONE,
 
     | 
  
  
    | 
      284
     | 
    
      	AREA_DISPLAY,
 
     | 
  
  
    | 
      285
     | 
    
      };
 
     | 
  
  
    | 
      286
     | 
    
      #else
 
     | 
  
  
    | 
      287
     | 
    
      enum{
     | 
  
  
    | 
      288
     | 
    
      	AREA_NONE,
 
     | 
  
  
    | 
      289
     | 
    
      	AREA_DISPLAY,
 
     | 
  
  
    | 
      290
     | 
    
      	AREA_KEY,
 
     | 
  
  
    | 
      291
     | 
    
      	AREA_INVALID,
 
     | 
  
  
    | 
      292
     | 
    
      };
 
     | 
  
  
    | 
      293
     | 
    
      
 
     | 
  
  
    | 
      294
     | 
    
      struct sitronix_AA_key{
     | 
  
  
    | 
      295
     | 
    
      	int x_low;
 
     | 
  
  
    | 
      296
     | 
    
      	int x_high;
 
     | 
  
  
    | 
      297
     | 
    
      	int y_low;
 
     | 
  
  
    | 
      298
     | 
    
      	int y_high;
 
     | 
  
  
    | 
      299
     | 
    
      	unsigned int code;
 
     | 
  
  
    | 
      300
     | 
    
      };
 
     | 
  
  
    | 
      301
     | 
    
      #endif // SITRONIX_AA_KEY
 
     | 
  
  
    | 
      302
     | 
    
      
 
     | 
  
  
    | 
      303
     | 
    
      typedef struct {
     | 
  
  
    | 
      304
     | 
    
      	uint8_t offset;
 
     | 
  
  
    | 
      305
     | 
    
      	uint8_t shft;
 
     | 
  
  
    | 
      306
     | 
    
      	uint8_t bmsk;
 
     | 
  
  
    | 
      307
     | 
    
      }sitronix_reg_field;
 
     | 
  
  
    | 
      308
     | 
    
      
 
     | 
  
  
    | 
      309
     | 
    
      typedef struct {
     | 
  
  
    | 
      310
     | 
    
      	sitronix_reg_field dis_coord_flag;
 
     | 
  
  
    | 
      311
     | 
    
      }sitronix_i2c_protocol_map;
 
     | 
  
  
    | 
      312
     | 
    
      #if 0
 
     | 
  
  
    | 
      313
     | 
    
      static sitronix_i2c_protocol_map sitronix_i2c_ptcl_v1 = {
     | 
  
  
    | 
      314
     | 
    
      	.dis_coord_flag = {
     | 
  
  
    | 
      315
     | 
    
      		.offset = 0x09,
 
     | 
  
  
    | 
      316
     | 
    
      		.shft = 0,
 
     | 
  
  
    | 
      317
     | 
    
      		.bmsk = 0x1,
 
     | 
  
  
    | 
      318
     | 
    
      	},
 
     | 
  
  
    | 
      319
     | 
    
      };
 
     | 
  
  
    | 
      320
     | 
    
      
 
     | 
  
  
    | 
      321
     | 
    
      static sitronix_i2c_protocol_map sitronix_i2c_ptcl_v2 = {
     | 
  
  
    | 
      322
     | 
    
      	.dis_coord_flag = {
     | 
  
  
    | 
      323
     | 
    
      		.offset = 0xF1,
 
     | 
  
  
    | 
      324
     | 
    
      		.shft = 2,
 
     | 
  
  
    | 
      325
     | 
    
      		.bmsk = 0x1,
 
     | 
  
  
    | 
      326
     | 
    
      	},
 
     | 
  
  
    | 
      327
     | 
    
      };
 
     | 
  
  
    | 
      328
     | 
    
      #endif
 
     | 
  
  
    | 
      329
     | 
    
      #define GTP_ERROR(fmt,arg...)          printk("<<-GTP-ERROR->> "fmt"\n",##arg)
     | 
  
  
    | 
      330
     | 
    
      
 
     | 
  
  
    | 
      331
     | 
    
      struct sitronix_i2c_touch_platform_data {
     | 
  
  
    | 
      332
     | 
    
      	uint32_t version;	/* Use this entry for panels with */
 
     | 
  
  
    | 
      333
     | 
    
      				/* (major << 8 | minor) version or above. */
 
     | 
  
  
    | 
      334
     | 
    
      				/* If non-zero another array entry follows */
 
     | 
  
  
    | 
      335
     | 
    
      	void (*reset_ic)(void);
 
     | 
  
  
    | 
      336
     | 
    
      	int irq_gpio;
 
     | 
  
  
    | 
      337
     | 
    
      	u32 irq_gpio_flags;
 
     | 
  
  
    | 
      338
     | 
    
      	int reset_gpio;
 
     | 
  
  
    | 
      339
     | 
    
      	u32 reset_gpio_flags;
 
     | 
  
  
    | 
      340
     | 
    
      	u32 num_max_touches;
 
     | 
  
  
    | 
      341
     | 
    
      	u32 soft_rst_dly;
 
     | 
  
  
    | 
      342
     | 
    
      	const char *product_id;
 
     | 
  
  
    | 
      343
     | 
    
      	const char *fw_name;
 
     | 
  
  
    | 
      344
     | 
    
      	char *name;
 
     | 
  
  
    | 
      345
     | 
    
      	u32 x_max;
 
     | 
  
  
    | 
      346
     | 
    
      	u32 y_max;
 
     | 
  
  
    | 
      347
     | 
    
      	u32 x_min;
 
     | 
  
  
    | 
      348
     | 
    
      	u32 y_min;
 
     | 
  
  
    | 
      349
     | 
    
      	u32 panel_minx;
 
     | 
  
  
    | 
      350
     | 
    
      	u32 panel_miny;
 
     | 
  
  
    | 
      351
     | 
    
      	u32 panel_maxx;
 
     | 
  
  
    | 
      352
     | 
    
      	u32 panel_maxy;
 
     | 
  
  
    | 
      353
     | 
    
      	bool no_force_update;
 
     | 
  
  
    | 
      354
     | 
    
      	bool i2c_pull_up;
 
     | 
  
  
    | 
      355
     | 
    
      	bool enable_power_off;
 
     | 
  
  
    | 
      356
     | 
    
      	bool fw_vkey_support;
 
     | 
  
  
    | 
      357
     | 
    
      	//size_t config_data_len[GOODIX_MAX_CFG_GROUP];
 
     | 
  
  
    | 
      358
     | 
    
      	//u8 *config_data[GOODIX_MAX_CFG_GROUP];
 
     | 
  
  
    | 
      359
     | 
    
      };
 
     | 
  
  
    | 
      360
     | 
    
      //petitk add
 
     | 
  
  
    | 
      361
     | 
    
      
 
     | 
  
  
    | 
      362
     | 
    
      //#define CONFIG_TOUCHSCREEN_SITRONIX_I2C_TOUCH
 
     | 
  
  
    | 
      363
     | 
    
      //#define KERN_DEBUG    "<7>"    /* debug-level messages */
 
     | 
  
  
    | 
      364
     | 
    
      ////////////
 
     | 
  
  
    | 
      365
     | 
    
      
 
     | 
  
  
    | 
      366
     | 
    
      #define stmsg(format, ...)	\
 
     | 
  
  
    | 
      367
     | 
    
      	printk("[sitronix 000] " format "\n", ## __VA_ARGS__)
     | 
  
  
    | 
      368
     | 
    
      //Upgrade
 
     | 
  
  
    | 
      369
     | 
    
      //#define ST_UPGRADE_FIRMWARE
 
     | 
  
  
    | 
      370
     | 
    
      
 
     | 
  
  
    | 
      371
     | 
    
      //#ifdef ST_UPGRADE_FIRMWARE
 
     | 
  
  
    | 
      372
     | 
    
      
 
     | 
  
  
    | 
      373
     | 
    
      //#define ST_FIREWARE_FILE
 
     | 
  
  
    | 
      374
     | 
    
      
 
     | 
  
  
    | 
      375
     | 
    
      #define ST_FW_LEN	0x4000
 
     | 
  
  
    | 
      376
     | 
    
      #define ST_CFG_LEN	0xFE
 
     | 
  
  
    | 
      377
     | 
    
      #define ST_CFG_OFFSET	0x3F00
 
     | 
  
  
    | 
      378
     | 
    
      #define ST_FLASH_PAGE_SIZE 1024
 
     | 
  
  
    | 
      379
     | 
    
      #define ST_FLASH_SIZE 0x3FFE
 
     | 
  
  
    | 
      380
     | 
    
      #define ISP_PACKET_SIZE 8
 
     | 
  
  
    | 
      381
     | 
    
      #define ST_FW_INFO_LEN	0x10
 
     | 
  
  
    | 
      382
     | 
    
      
 
     | 
  
  
    | 
      383
     | 
    
      #define ISP_CMD_ERASE						0x80
 
     | 
  
  
    | 
      384
     | 
    
      #define ISP_CMD_SEND_DATA					0x81
 
     | 
  
  
    | 
      385
     | 
    
      #define	ISP_CMD_WRITE_FLASH					0x82
 
     | 
  
  
    | 
      386
     | 
    
      #define	ISP_CMD_READ_FLASH					0x83
 
     | 
  
  
    | 
      387
     | 
    
      #define	ISP_CMD_RESET						0x84
 
     | 
  
  
    | 
      388
     | 
    
      #define	ISP_CMD_UNLOCK						0x87
 
     | 
  
  
    | 
      389
     | 
    
      #define	ISP_CMD_READY						0x8F
 
     | 
  
  
    | 
      390
     | 
    
      
 
     | 
  
  
    | 
      391
     | 
    
      #ifdef ST_FIREWARE_FILE
 
     | 
  
  
    | 
      392
     | 
    
      // from file
 
     | 
  
  
    | 
      393
     | 
    
      #define st_file file
 
     | 
  
  
    | 
      394
     | 
    
      #define st_filp_open filp_open
 
     | 
  
  
    | 
      395
     | 
    
      #define st_filp_close filp_close
 
     | 
  
  
    | 
      396
     | 
    
      #define ST_FW_DIR "/data"
 
     | 
  
  
    | 
      397
     | 
    
      #define ST_FW_PATH "/data/sitronix_fw.bin"
 
     | 
  
  
    | 
      398
     | 
    
      #define ST_CFG_PATH "/data/CFG_4221_0x55.cfg"
 
     | 
  
  
    | 
      399
     | 
    
      //#define ST_FW_PATH "/data/FW4221_16K.bin"
 
     | 
  
  
    | 
      400
     | 
    
      
 
     | 
  
  
    | 
      401
     | 
    
      #else
 
     | 
  
  
    | 
      402
     | 
    
      // from .h
 
     | 
  
  
    | 
      403
     | 
    
      #define SITRONIX_FW {\
     | 
  
  
    | 
      404
     | 
    
      }
 
     | 
  
  
    | 
      405
     | 
    
      
 
     | 
  
  
    | 
      406
     | 
    
      
 
     | 
  
  
    | 
      407
     | 
    
      #define SITRONIX_CFG {\
     | 
  
  
    | 
      408
     | 
    
      }
 
     | 
  
  
    | 
      409
     | 
    
      
 
     | 
  
  
    | 
      410
     | 
    
      #endif //ST_FIREWARE_FILE
 
     | 
  
  
    | 
      411
     | 
    
      
 
     | 
  
  
    | 
      412
     | 
    
      //#endif //ST_UPGRADE_FIRMWARE
 
     | 
  
  
    | 
      413
     | 
    
      //
 
     | 
  
  
    | 
      414
     | 
    
      
 
     | 
  
  
    | 
      415
     | 
    
      //#define ST_TEST_RAW
 
     | 
  
  
    | 
      416
     | 
    
      
 
     | 
  
  
    | 
      417
     | 
    
      #ifdef ST_TEST_RAW
 
     | 
  
  
    | 
      418
     | 
    
      #define MAX_RX_COUNT	12
 
     | 
  
  
    | 
      419
     | 
    
      #define MAX_TX_COUNT	21
 
     | 
  
  
    | 
      420
     | 
    
      #define MAX_KEY_COUNT	4
 
     | 
  
  
    | 
      421
     | 
    
      #define MAX_SENSOR_COUNT	MAX_RX_COUNT+MAX_TX_COUNT+MAX_KEY_COUNT
 
     | 
  
  
    | 
      422
     | 
    
      #define TX_ASSIGNMENT	1
 
     | 
  
  
    | 
      423
     | 
    
      
 
     | 
  
  
    | 
      424
     | 
    
      #define MAX_RAW_LIMIT	7800
 
     | 
  
  
    | 
      425
     | 
    
      #define MIN_RAW_LIMIT	3700
 
     | 
  
  
    | 
      426
     | 
    
      #endif //ST_TEST_RAW
 
     | 
  
  
    | 
      427
     | 
    
      
 
     | 
  
  
    | 
      428
     | 
    
      #if defined(ST_TEST_RAW) || defined(ST_UPGRADE_FIRMWARE)
 
     | 
  
  
    | 
      429
     | 
    
      #define st_u8 u8
 
     | 
  
  
    | 
      430
     | 
    
      #define st_char char
 
     | 
  
  
    | 
      431
     | 
    
      #define st_msleep msleep
 
     | 
  
  
    | 
      432
     | 
    
      #define st_int int
 
     | 
  
  
    | 
      433
     | 
    
      #endif
 
     | 
  
  
    | 
      434
     | 
    
      
 
     | 
  
  
    | 
      435
     | 
    
      #endif // __SITRONIX_I2C_TOUCH_h
 
     |