/* drivers/input/touchscreen/gt9xx.h * * 2010 - 2013 Goodix Technology. * * 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. * * This program is distributed in the hope that it will be a reference * to you, when you are integrating the GOODiX's CTP IC into your system, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * */ #ifndef _GOODIX_GT9XX_H_ #define _GOODIX_GT9XX_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_HAS_EARLYSUSPEND #include #endif struct goodix_ts_data { //spinlock_t irq_lock; struct i2c_client *client; struct input_dev *input_dev; struct hrtimer timer; struct work_struct work; #ifdef CONFIG_HAS_EARLYSUSPEND struct early_suspend early_suspend; #endif char fw_name[20]; s32 i2c_addr; s32 irq_is_disable; s32 use_irq; s32 irq_gpio; s32 rst_gpio; s32 abs_x_max; s32 abs_y_max; s32 max_touch_num; u8 int_trigger_type; s32 swap; s32 xdir; s32 ydir; s32 lcd_exchg; u8 green_wake_mode; u8 chip_type; u8 enter_update; u8 gtp_is_suspend; u8 gtp_rawdiff_mode; u8 gtp_cfg_len; u8 fixed_cfg; u8 esd_running; u8 fw_error; }; extern u16 show_len; extern u16 total_len; extern int wmt_getsyspara(char *varname, unsigned char *varval, int *varlen); //***************************PART1:ON/OFF define******************************* #define GTP_CUSTOM_CFG 0 #define GTP_CHANGE_X2Y 0 #define GTP_DRIVER_SEND_CFG 1 #define GTP_HAVE_TOUCH_KEY 0 #define GTP_POWER_CTRL_SLEEP 0 #define GTP_ICS_SLOT_REPORT 0 #define GTP_AUTO_UPDATE 1 // auto updated by .bin file as default #define GTP_HEADER_FW_UPDATE 0 // auto updated by head_fw_array in gt9xx_firmware.h, function together with GTP_AUTO_UPDATE #define GTP_CREATE_WR_NODE 1 #define GTP_ESD_PROTECT 0 #define GTP_WITH_PEN 0 #define GTP_SLIDE_WAKEUP 0 #define GTP_DBL_CLK_WAKEUP 0 // double-click wakeup, function together with GTP_SLIDE_WAKEUP #define GTP_DEBUG_ON 0 #define GTP_DEBUG_ARRAY_ON 0 #define GTP_DEBUG_FUNC_ON 0 //*************************** PART2:TODO define ********************************** // STEP_1(REQUIRED): Define Configuration Information Group(s) // Sensor_ID Map: /* sensor_opt1 sensor_opt2 Sensor_ID GND GND 0 VDDIO GND 1 NC GND 2 GND NC/300K 3 VDDIO NC/300K 4 NC NC/300K 5 */ // TODO: define your own default or for Sensor_ID == 0 config here. // The predefined one is just a sample config, which is not suitable for your tp in most cases. #define CTP_CFG_GROUP1 {\ 0x42,0x00,0x03,0x00,0x04,0x0A,0x34,0x00,0x01,0x3F,\ 0x28,0x0F,0x50,0x3C,0x03,0x05,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x16,0x18,0x1C,0x14,0x8B,0x2A,0x0E,\ 0x2D,0x3D,0x12,0x0C,0x00,0x00,0x00,0x01,0x03,0x1D,\ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ 0x00,0x20,0x3D,0x94,0xC5,0x02,0x08,0x00,0x00,0x04,\ 0x9A,0x22,0x00,0x8F,0x26,0x00,0x81,0x2C,0x00,0x77,\ 0x32,0x00,0x6E,0x39,0x00,0x6E,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,0x0A,0x08,0x06,0x04,0x02,0x0C,0x0E,0x10,\ 0x12,0x14,0x16,0x18,0x1A,0x1C,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,\ 0x10,0x12,0x13,0x16,0x18,0x1C,0x1D,0x1E,0x1F,0x20,\ 0x21,0x22,0x24,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,\ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x00,0x9D,0x01\ } /* #define CTP_CFG_GROUP1 {\ 0x00,0x00,0x03,0x00,0x04,0x0A,0x35,0x00,0x01,0x08,\ 0x14,0x05,0x37,0x28,0x03,0x05,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x16,0x18,0x1A,0x14,0x8B,0x2A,0x0E,\ 0x63,0x5E,0x31,0x0D,0x00,0x00,0x02,0xB9,0x02,0x2D,\ 0x00,0x00,0x00,0x00,0x00,0x03,0x64,0x32,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x0A,0x08,0x06,0x04,0x02,0x0C,0x0E,0x10,\ 0x12,0x14,0x16,0x18,0x1A,0x1C,0xFF,0xFF,0xFF,0xFF,\ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\ 0xFF,0xFF,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,\ 0x10,0x12,0x13,0x16,0x18,0x1C,0x1D,0x1E,0x1F,0x20,\ 0x21,0x22,0x24,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\ 0xFF,0xFF,0xFF,0xFF,0x4A,0x01\ } */ // TODO: define your config for Sensor_ID == 1 here, if needed #define CTP_CFG_GROUP2 {\ } // TODO: define your config for Sensor_ID == 2 here, if needed #define CTP_CFG_GROUP3 {\ } // TODO: define your config for Sensor_ID == 3 here, if needed #define CTP_CFG_GROUP4 {\ } // TODO: define your config for Sensor_ID == 4 here, if needed #define CTP_CFG_GROUP5 {\ } // TODO: define your config for Sensor_ID == 5 here, if needed #define CTP_CFG_GROUP6 {\ } // STEP_2(REQUIRED): Customize your I/O ports & I/O operations #define GTP_RST_PORT S5PV210_GPJ3(6) #define GTP_INT_PORT S5PV210_GPH1(3) #define GTP_INT_IRQ gpio_to_irq(GTP_INT_PORT) #define GTP_INT_CFG S3C_GPIO_SFN(0xF) #define GTP_GPIO_AS_INPUT(pin) do{\ gpio_direction_input(pin);\ wmt_gpio_setpull(pin, WMT_GPIO_PULL_NONE);\ }while(0) #define GTP_GPIO_AS_INT(pin,type) do{\ GTP_GPIO_AS_INPUT(pin);\ wmt_gpio_set_irq_type(pin,type);\ }while(0) #define GTP_GPIO_GET_VALUE(pin) gpio_get_value(pin) #define GTP_GPIO_OUTPUT(pin,level) gpio_direction_output(pin,level) #define GTP_GPIO_REQUEST(pin, label) gpio_request(pin, label) #define GTP_GPIO_FREE(pin) gpio_free(pin) #define GTP_IRQ_TAB {IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH} // STEP_3(optional): Specify your special config info if needed #if GTP_CUSTOM_CFG #define GTP_MAX_HEIGHT 800 #define GTP_MAX_WIDTH 480 #define GTP_INT_TRIGGER 0 // 0: Rising 1: Falling #else #define GTP_MAX_HEIGHT 4096 #define GTP_MAX_WIDTH 4096 #define GTP_INT_TRIGGER 1 #endif #define GTP_MAX_TOUCH 5 #define GTP_ESD_CHECK_CIRCLE 2000 // jiffy: ms // STEP_4(optional): If keys are available and reported as keys, config your key info here #if GTP_HAVE_TOUCH_KEY #define GTP_KEY_TAB {KEY_MENU, KEY_HOME, KEY_BACK} #endif //***************************PART3:OTHER define********************************* #define GTP_DRIVER_VERSION "V1.8<2013/06/08>" #define GTP_I2C_NAME "Goodix-TS" #define GTP_I2C_ADDR 0x5d #define GTP_POLL_TIME 10 // jiffy: ms #define GTP_ADDR_LENGTH 2 #define GTP_CONFIG_MIN_LENGTH 186 #define GTP_CONFIG_MAX_LENGTH 240 #define FAIL 0 #define SUCCESS 1 #define SWITCH_OFF 0 #define SWITCH_ON 1 // Registers define #define GTP_READ_COOR_ADDR 0x814E #define GTP_REG_SLEEP 0x8040 #define GTP_REG_SENSOR_ID 0x814A #define GTP_REG_CONFIG_DATA 0x8047 #define GTP_REG_VERSION 0x8140 #define RESOLUTION_LOC 3 #define TRIGGER_LOC 8 #define CFG_GROUP_LEN(p_cfg_grp) (sizeof(p_cfg_grp) / sizeof(p_cfg_grp[0])) // Log define #define GTP_INFO(fmt,arg...) printk("<<-GTP-INFO->> "fmt"\n",##arg) #define GTP_ERROR(fmt,arg...) printk("<<-GTP-ERROR->> "fmt"\n",##arg) #define GTP_DEBUG(fmt,arg...) do{\ if(GTP_DEBUG_ON)\ printk("<<-GTP-DEBUG->> [%d]"fmt"\n",__LINE__, ##arg);\ }while(0) #define GTP_DEBUG_ARRAY(array, num) do{\ s32 i;\ u8* a = array;\ if(GTP_DEBUG_ARRAY_ON)\ {\ printk("<<-GTP-DEBUG-ARRAY->>\n");\ for (i = 0; i < (num); i++)\ {\ printk("%02x ", (a)[i]);\ if ((i + 1 ) %10 == 0)\ {\ printk("\n");\ }\ }\ printk("\n");\ }\ }while(0) #define GTP_DEBUG_FUNC() do{\ if(GTP_DEBUG_FUNC_ON)\ printk("<<-GTP-FUNC->> Func:%s@Line:%d\n",__func__,__LINE__);\ }while(0) #define GTP_SWAP(x, y) do{\ typeof(x) z = x;\ x = y;\ y = z;\ }while (0) //*****************************End of Part III******************************** #endif /* _GOODIX_GT9XX_H_ */