Loading Documentation/devicetree/bindings/input/touchscreen/gt9xx/gt9xx.txt +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,12 @@ Optional properties: - goodix,cfg-data5 : Touch screen controller config data group 5. Ask vendor to provide that. - goodix,fw-name : Touch screen controller firmware file name. - goodix,slide-wakeup : To specify slide-wakeup property is enabled or not. - goodix,dbl-clk-wakeup : To specify dbl-clk-wakeup property is enabled or not. - goodix,change-x2y : To specify change-x2y property is enabled or not. - goodix,driver-send-cfg : To specify driver-send-cfg property is enabled or not. - goodix,have-touch-key : To specify have-touch-key property is enabled or not. - goodix,with-pen : To specify with-pen property is enabled or not. Example: i2c@f9927000 { goodix@5d { Loading Loading @@ -87,5 +93,7 @@ i2c@f9927000 { FF FF FF FF FF FF FF 22 22 22 22 22 22 FF 07 01]; goodix,fw_name = "gtp_fw.bin"; goodix,have-touch-key; goodix,driver-send-cfg; }; }; arch/arm/boot/dts/qcom/msm8226-qrd-skuf.dtsi +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -102,6 +102,8 @@ FF FF FF FF FF FF FF FF FF FF FF FF FF FF 3E 01]; goodix,fw_name = "gtp_fw.bin"; goodix,have-touch-key; goodix,driver-send-cfg; }; }; }; Loading arch/arm/boot/dts/qcom/msm8610-qrd-skuab.dtsi +2 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,8 @@ 00 FF FF FF FF FF FF FF 00 00 00 FF FF FF FF FF FF FF FF FF F8 FF FF FF E4 01]; goodix,have-touch-key; goodix,driver-send-cfg; }; }; gen-vkeys { Loading drivers/input/touchscreen/gt9xx/gt9xx.c +283 −286 Original line number Diff line number Diff line Loading @@ -77,12 +77,6 @@ #define GTP_MAX_TOUCH 5 #define GTP_ESD_CHECK_CIRCLE_MS 2000 #if GTP_HAVE_TOUCH_KEY static const u16 touch_key_array[] = {KEY_MENU, KEY_HOMEPAGE, KEY_BACK}; #define GTP_MAX_KEY_NUM (sizeof(touch_key_array)/sizeof(touch_key_array[0])) #endif static void gtp_int_sync(struct goodix_ts_data *ts, int ms); static int gtp_i2c_test(struct i2c_client *client); static int goodix_power_off(struct goodix_ts_data *ts); Loading @@ -105,15 +99,14 @@ static void gtp_esd_check_func(struct work_struct *work); static int gtp_init_ext_watchdog(struct i2c_client *client); #endif #if GTP_SLIDE_WAKEUP enum doze_status { enum doze { DOZE_DISABLED = 0, DOZE_ENABLED = 1, DOZE_WAKEUP = 2, }; static enum doze_status = DOZE_DISABLED; static enum doze doze_status = DOZE_DISABLED; static s8 gtp_enter_doze(struct goodix_ts_data *ts); #endif bool init_done; static u8 chip_gt9xxs; /* true if ic is gt9xxs, like gt915s */ u8 grp_cfg_version; Loading Loading @@ -163,11 +156,11 @@ int gtp_i2c_read(struct i2c_client *client, u8 *buf, int len) dev_err(&client->dev, "I2C retry: %d\n", retries + 1); } if (retries == GTP_I2C_RETRY_5) { #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) /* reset chip would quit doze mode */ if (DOZE_ENABLED == doze_status) return ret; #endif if (init_done) gtp_reset_guitar(ts, 10); else Loading Loading @@ -209,10 +202,10 @@ int gtp_i2c_write(struct i2c_client *client, u8 *buf, int len) dev_err(&client->dev, "I2C retry: %d\n", retries + 1); } if ((retries == GTP_I2C_RETRY_5)) { #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) if (DOZE_ENABLED == doze_status) return ret; #endif if (init_done) gtp_reset_guitar(ts, 10); else Loading Loading @@ -278,10 +271,10 @@ Output: *********************************************************/ int gtp_send_cfg(struct goodix_ts_data *ts) { int ret; #if GTP_DRIVER_SEND_CFG int retry = 0; int ret = 0; int retry; if (ts->pdata->driver_send_cfg) { if (ts->fixed_cfg) { dev_dbg(&ts->client->dev, "Ic fixed config, no config sent!"); Loading @@ -290,12 +283,13 @@ int gtp_send_cfg(struct goodix_ts_data *ts) for (retry = 0; retry < GTP_I2C_RETRY_5; retry++) { ret = gtp_i2c_write(ts->client, ts->config_data, GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH); GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH); if (ret > 0) break; } } #endif } return ret; } Loading Loading @@ -355,9 +349,8 @@ Output: static void gtp_touch_down(struct goodix_ts_data *ts, int id, int x, int y, int w) { #if GTP_CHANGE_X2Y if (ts->pdata->change_x2y) swap(x, y); #endif input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); Loading Loading @@ -402,9 +395,7 @@ static void goodix_ts_work_func(struct work_struct *work) u8 finger = 0; static u16 pre_touch; static u8 pre_key; #if GTP_WITH_PEN static u8 pre_pen; #endif u8 key_value = 0; u8 *coor_data = NULL; s32 input_x = 0; Loading @@ -414,10 +405,7 @@ static void goodix_ts_work_func(struct work_struct *work) s32 i = 0; int ret = -1; struct goodix_ts_data *ts = NULL; #if GTP_SLIDE_WAKEUP u8 doze_buf[3] = {0x81, 0x4B}; #endif ts = container_of(work, struct goodix_ts_data, work); #ifdef CONFIG_GT9XX_TOUCHPANEL_UPDATE Loading @@ -425,7 +413,7 @@ static void goodix_ts_work_func(struct work_struct *work) return; #endif #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) { if (DOZE_ENABLED == doze_status) { ret = gtp_i2c_read(ts->client, doze_buf, 3); if (ret > 0) { Loading @@ -446,9 +434,11 @@ static void goodix_ts_work_func(struct work_struct *work) dev_dbg(&ts->client->dev, "Slide(0xBB) To Light up the screen!"); doze_status = DOZE_WAKEUP; input_report_key(ts->input_dev, KEY_POWER, 1); input_report_key(ts->input_dev, KEY_POWER, 1); input_sync(ts->input_dev); input_report_key(ts->input_dev, KEY_POWER, 0); input_report_key(ts->input_dev, KEY_POWER, 0); input_sync(ts->input_dev); /* clear 0x814B*/ doze_buf[2] = 0x00; Loading @@ -457,9 +447,11 @@ static void goodix_ts_work_func(struct work_struct *work) dev_dbg(&ts->client->dev, "double click to light up the screen!"); doze_status = DOZE_WAKEUP; input_report_key(ts->input_dev, KEY_POWER, 1); input_report_key(ts->input_dev, KEY_POWER, 1); input_sync(ts->input_dev); input_report_key(ts->input_dev, KEY_POWER, 0); input_report_key(ts->input_dev, KEY_POWER, 0); input_sync(ts->input_dev); /* clear 0x814B */ doze_buf[2] = 0x00; Loading @@ -473,7 +465,7 @@ static void goodix_ts_work_func(struct work_struct *work) return; } #endif } ret = gtp_i2c_read(ts->client, point_data, 12); if (ret < 0) { Loading Loading @@ -514,7 +506,7 @@ static void goodix_ts_work_func(struct work_struct *work) pre_key = key_value; #if GTP_WITH_PEN if (ts->pdata->with_pen) { if (pre_pen && (touch_num == 0)) { dev_dbg(&ts->client->dev, "Pen touch UP(Slot)!"); input_report_key(ts->input_dev, BTN_TOOL_PEN, 0); Loading @@ -522,7 +514,8 @@ static void goodix_ts_work_func(struct work_struct *work) input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, -1); pre_pen = 0; } #endif } if (pre_touch || touch_num) { s32 pos = 0; u16 touch_index = 0; Loading @@ -530,7 +523,7 @@ static void goodix_ts_work_func(struct work_struct *work) coor_data = &point_data[3]; if (touch_num) { id = coor_data[pos] & 0x0F; #if GTP_WITH_PEN if (ts->pdata->with_pen) { id = coor_data[pos]; if (id == 128) { dev_dbg(&ts->client->dev, Loading Loading @@ -559,16 +552,16 @@ static void goodix_ts_work_func(struct work_struct *work) pre_pen = 1; pre_touch = 0; } #endif } touch_index |= (0x01<<id); } for (i = 0; i < GTP_MAX_TOUCH; i++) { #if GTP_WITH_PEN if (ts->pdata->with_pen) if (pre_pen == 1) break; #endif if (touch_index & (0x01<<i)) { input_x = coor_data[pos + 1] | coor_data[pos + 2] << 8; Loading Loading @@ -673,7 +666,6 @@ void gtp_reset_guitar(struct goodix_ts_data *ts, int ms) } #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB) #if GTP_SLIDE_WAKEUP /******************************************************* Function: Enter doze mode for sliding wakeup. Loading @@ -690,9 +682,9 @@ static s8 gtp_enter_doze(struct goodix_ts_data *ts) (u8)(GTP_REG_SLEEP >> 8), (u8)GTP_REG_SLEEP, 8}; #if GTP_DBL_CLK_WAKEUP if (ts->pdata->dbl_clk_wakeup) i2c_control_buf[2] = 0x09; #endif gtp_irq_disable(ts); while (retry++ < GTP_I2C_RETRY_3) { Loading Loading @@ -721,7 +713,6 @@ static s8 gtp_enter_doze(struct goodix_ts_data *ts) gtp_irq_enable(ts); return ret; } #else /** * gtp_enter_sleep - Enter sleep mode * @ts: driver private data Loading Loading @@ -767,7 +758,6 @@ static u8 gtp_enter_sleep(struct goodix_ts_data *ts) return ret; } } #endif /* !GTP_SLIDE_WAKEUP */ /******************************************************* Function: Loading Loading @@ -813,25 +803,25 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts) "Wakeup sleep send config success."); } else { err_retry: #if GTP_SLIDE_WAKEUP /* wakeup not by slide */ if (ts->pdata->slide_wakeup) { /* wakeup not by slide */ if (DOZE_WAKEUP != doze_status) gtp_reset_guitar(ts, 10); else /* wakeup by slide */ doze_status = DOZE_DISABLED; #else } else { if (chip_gt9xxs == 1) { gtp_reset_guitar(ts, 10); } else { ret = gpio_direction_output(ts->pdata->irq_gpio, 1); ret = gpio_direction_output( ts->pdata->irq_gpio, 1); usleep(5000); } #endif } ret = gtp_i2c_test(ts->client); if (ret == 2) { dev_dbg(&ts->client->dev, "GTP wakeup sleep."); #if (!GTP_SLIDE_WAKEUP) if (!ts->pdata->slide_wakeup) { if (chip_gt9xxs == 0) { gtp_int_sync(ts, 25); msleep(20); Loading @@ -839,7 +829,7 @@ err_retry: gtp_init_ext_watchdog(ts->client); #endif } #endif } return ret; } gtp_reset_guitar(ts, 20); Loading @@ -863,15 +853,14 @@ Output: static int gtp_init_panel(struct goodix_ts_data *ts) { struct i2c_client *client = ts->client; unsigned char *config_data; unsigned char *config_data = NULL; int ret = -EIO; #if GTP_DRIVER_SEND_CFG int i; u8 check_sum = 0; u8 opr_buf[16]; u8 sensor_id = 0; if (ts->pdata->driver_send_cfg) { for (i = 0; i < GOODIX_MAX_CFG_GROUP; i++) dev_dbg(&client->dev, "Config Groups(%d) Lengths: %d", i, ts->pdata->config_data_len[i]); Loading @@ -890,11 +879,12 @@ static int gtp_init_panel(struct goodix_ts_data *ts) if (ts->pdata->config_data_len[i]) break; } if (i == GOODIX_MAX_CFG_GROUP) { sensor_id = 0; } else { ret = gtp_i2c_read_dbl_check(ts->client, GTP_REG_SENSOR_ID, &sensor_id, 1); ret = gtp_i2c_read_dbl_check(ts->client, GTP_REG_SENSOR_ID, &sensor_id, 1); if (SUCCESS == ret) { if (sensor_id >= GOODIX_MAX_CFG_GROUP) { dev_err(&client->dev, Loading @@ -911,7 +901,8 @@ static int gtp_init_panel(struct goodix_ts_data *ts) dev_info(&client->dev, "Sensor ID selected: %d", sensor_id); if (ts->pdata->config_data_len[sensor_id] < GTP_CONFIG_MIN_LENGTH || if (ts->pdata->config_data_len[sensor_id] < GTP_CONFIG_MIN_LENGTH || !ts->pdata->config_data[sensor_id]) { dev_err(&client->dev, "Sensor_ID(%d) matches with NULL or invalid config group!\n", Loading @@ -925,9 +916,11 @@ static int gtp_init_panel(struct goodix_ts_data *ts) if (opr_buf[0] < 90) { /* backup group config version */ grp_cfg_version = ts->pdata->config_data[sensor_id][GTP_ADDR_LENGTH]; ts->pdata->config_data[sensor_id][GTP_ADDR_LENGTH] = 0x00; ts->pdata-> config_data[sensor_id][GTP_ADDR_LENGTH]; ts->pdata-> config_data[sensor_id][GTP_ADDR_LENGTH] = 0x00; ts->fixed_cfg = 0; } else { /* treated as fixed config, not send config */ Loading Loading @@ -968,7 +961,7 @@ static int gtp_init_panel(struct goodix_ts_data *ts) config_data[ts->gtp_cfg_len] = (~check_sum) + 1; #else /* DRIVER NOT SEND CONFIG */ } else { /* DRIVER NOT SEND CONFIG */ ts->gtp_cfg_len = GTP_CONFIG_MAX_LENGTH; ret = gtp_i2c_read(ts->client, config_data, ts->gtp_cfg_len + GTP_ADDR_LENGTH); Loading @@ -979,7 +972,7 @@ static int gtp_init_panel(struct goodix_ts_data *ts) ts->abs_y_max = GTP_MAX_HEIGHT; ts->int_trigger_type = GTP_INT_TRIGGER; } #endif /* !DRIVER NOT SEND CONFIG */ } /* !DRIVER NOT SEND CONFIG */ if ((ts->abs_x_max == 0) && (ts->abs_y_max == 0)) { ts->abs_x_max = (config_data[RESOLUTION_LOC + 1] << 8) Loading Loading @@ -1213,9 +1206,7 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts) { int ret; char phys[PHY_BUF_SIZE]; #if GTP_HAVE_TOUCH_KEY int index = 0; #endif ts->input_dev = input_allocate_device(); if (ts->input_dev == NULL) { Loading @@ -1231,27 +1222,24 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts) /* in case of "out of memory" */ input_mt_init_slots(ts->input_dev, 10, 0); if (ts->pdata->have_touch_key) { for (index = 0; index < ts->pdata->num_button; index++) { input_set_capability(ts->input_dev, EV_KEY, ts->pdata->button_map[index]); } } #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) input_set_capability(ts->input_dev, EV_KEY, KEY_POWER); #endif #if GTP_WITH_PEN /* pen support */ if (ts->pdata->with_pen) { /* pen support */ __set_bit(BTN_TOOL_PEN, ts->input_dev->keybit); __set_bit(INPUT_PROP_DIRECT, ts->input_dev->propbit); __set_bit(INPUT_PROP_POINTER, ts->input_dev->propbit); #endif } #if GTP_CHANGE_X2Y if (ts->pdata->change_x2y) swap(ts->abs_x_max, ts->abs_y_max); #endif input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, ts->abs_x_max, 0, 0); Loading Loading @@ -1851,6 +1839,25 @@ static int goodix_parse_dt(struct device *dev, pdata->enable_power_off = of_property_read_bool(np, "goodix,enable-power-off"); pdata->have_touch_key = of_property_read_bool(np, "goodix,have-touch-key"); pdata->driver_send_cfg = of_property_read_bool(np, "goodix,driver-send-cfg"); pdata->change_x2y = of_property_read_bool(np, "goodix,change-x2y"); pdata->with_pen = of_property_read_bool(np, "goodix,with-pen"); pdata->slide_wakeup = of_property_read_bool(np, "goodix,slide-wakeup"); pdata->dbl_clk_wakeup = of_property_read_bool(np, "goodix,dbl_clk_wakeup"); /* reset, irq gpio info */ pdata->reset_gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &pdata->reset_gpio_flags); Loading Loading @@ -2114,8 +2121,6 @@ exit_free_irq: #endif if (ts->use_irq) free_irq(client->irq, ts); else hrtimer_cancel(&ts->timer); cancel_work_sync(&ts->work); flush_workqueue(ts->goodix_wq); destroy_workqueue(ts->goodix_wq); Loading Loading @@ -2179,8 +2184,6 @@ static int goodix_ts_remove(struct i2c_client *client) if (ts) { if (ts->use_irq) free_irq(client->irq, ts); else hrtimer_cancel(&ts->timer); cancel_work_sync(&ts->work); flush_workqueue(ts->goodix_wq); Loading Loading @@ -2238,13 +2241,11 @@ static int goodix_ts_suspend(struct device *dev) gtp_esd_switch(ts->client, SWITCH_OFF); #endif #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) { ret = gtp_enter_doze(ts); #else } else { if (ts->use_irq) gtp_irq_disable(ts); else hrtimer_cancel(&ts->timer); for (i = 0; i < GTP_MAX_TOUCH; i++) gtp_touch_up(ts, i); Loading @@ -2252,9 +2253,9 @@ static int goodix_ts_suspend(struct device *dev) input_sync(ts->input_dev); ret = gtp_enter_sleep(ts); #endif if (ret < 0) dev_err(&ts->client->dev, "GTP early suspend failed.\n"); } /* to avoid waking up while not sleeping, * delay 48 + 10ms to ensure reliability */ Loading Loading @@ -2286,18 +2287,14 @@ static int goodix_ts_resume(struct device *dev) mutex_lock(&ts->lock); ret = gtp_wakeup_sleep(ts); #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) doze_status = DOZE_DISABLED; #endif if (ret <= 0) dev_err(&ts->client->dev, "GTP resume failed.\n"); if (ts->use_irq) gtp_irq_enable(ts); else hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL); #if GTP_ESD_PROTECT gtp_esd_switch(ts->client, SWITCH_ON); Loading drivers/input/touchscreen/gt9xx/gt9xx.h +6 −9 Original line number Diff line number Diff line Loading @@ -63,6 +63,12 @@ struct goodix_ts_platform_data { u8 *config_data[GOODIX_MAX_CFG_GROUP]; u32 button_map[MAX_BUTTONS]; u8 num_button; bool have_touch_key; bool driver_send_cfg; bool change_x2y; bool with_pen; bool slide_wakeup; bool dbl_clk_wakeup; }; struct goodix_ts_data { spinlock_t irq_lock; Loading Loading @@ -111,16 +117,7 @@ extern u16 total_len; /***************************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 1 #define GTP_ESD_PROTECT 0 #define GTP_WITH_PEN 0 /* This cannot work when enable-power-off is on */ #define GTP_SLIDE_WAKEUP 0 /* double-click wakeup, function together with GTP_SLIDE_WAKEUP */ #define GTP_DBL_CLK_WAKEUP 0 #define GTP_IRQ_TAB {\ IRQ_TYPE_EDGE_RISING,\ Loading Loading
Documentation/devicetree/bindings/input/touchscreen/gt9xx/gt9xx.txt +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,12 @@ Optional properties: - goodix,cfg-data5 : Touch screen controller config data group 5. Ask vendor to provide that. - goodix,fw-name : Touch screen controller firmware file name. - goodix,slide-wakeup : To specify slide-wakeup property is enabled or not. - goodix,dbl-clk-wakeup : To specify dbl-clk-wakeup property is enabled or not. - goodix,change-x2y : To specify change-x2y property is enabled or not. - goodix,driver-send-cfg : To specify driver-send-cfg property is enabled or not. - goodix,have-touch-key : To specify have-touch-key property is enabled or not. - goodix,with-pen : To specify with-pen property is enabled or not. Example: i2c@f9927000 { goodix@5d { Loading Loading @@ -87,5 +93,7 @@ i2c@f9927000 { FF FF FF FF FF FF FF 22 22 22 22 22 22 FF 07 01]; goodix,fw_name = "gtp_fw.bin"; goodix,have-touch-key; goodix,driver-send-cfg; }; };
arch/arm/boot/dts/qcom/msm8226-qrd-skuf.dtsi +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -102,6 +102,8 @@ FF FF FF FF FF FF FF FF FF FF FF FF FF FF 3E 01]; goodix,fw_name = "gtp_fw.bin"; goodix,have-touch-key; goodix,driver-send-cfg; }; }; }; Loading
arch/arm/boot/dts/qcom/msm8610-qrd-skuab.dtsi +2 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,8 @@ 00 FF FF FF FF FF FF FF 00 00 00 FF FF FF FF FF FF FF FF FF F8 FF FF FF E4 01]; goodix,have-touch-key; goodix,driver-send-cfg; }; }; gen-vkeys { Loading
drivers/input/touchscreen/gt9xx/gt9xx.c +283 −286 Original line number Diff line number Diff line Loading @@ -77,12 +77,6 @@ #define GTP_MAX_TOUCH 5 #define GTP_ESD_CHECK_CIRCLE_MS 2000 #if GTP_HAVE_TOUCH_KEY static const u16 touch_key_array[] = {KEY_MENU, KEY_HOMEPAGE, KEY_BACK}; #define GTP_MAX_KEY_NUM (sizeof(touch_key_array)/sizeof(touch_key_array[0])) #endif static void gtp_int_sync(struct goodix_ts_data *ts, int ms); static int gtp_i2c_test(struct i2c_client *client); static int goodix_power_off(struct goodix_ts_data *ts); Loading @@ -105,15 +99,14 @@ static void gtp_esd_check_func(struct work_struct *work); static int gtp_init_ext_watchdog(struct i2c_client *client); #endif #if GTP_SLIDE_WAKEUP enum doze_status { enum doze { DOZE_DISABLED = 0, DOZE_ENABLED = 1, DOZE_WAKEUP = 2, }; static enum doze_status = DOZE_DISABLED; static enum doze doze_status = DOZE_DISABLED; static s8 gtp_enter_doze(struct goodix_ts_data *ts); #endif bool init_done; static u8 chip_gt9xxs; /* true if ic is gt9xxs, like gt915s */ u8 grp_cfg_version; Loading Loading @@ -163,11 +156,11 @@ int gtp_i2c_read(struct i2c_client *client, u8 *buf, int len) dev_err(&client->dev, "I2C retry: %d\n", retries + 1); } if (retries == GTP_I2C_RETRY_5) { #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) /* reset chip would quit doze mode */ if (DOZE_ENABLED == doze_status) return ret; #endif if (init_done) gtp_reset_guitar(ts, 10); else Loading Loading @@ -209,10 +202,10 @@ int gtp_i2c_write(struct i2c_client *client, u8 *buf, int len) dev_err(&client->dev, "I2C retry: %d\n", retries + 1); } if ((retries == GTP_I2C_RETRY_5)) { #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) if (DOZE_ENABLED == doze_status) return ret; #endif if (init_done) gtp_reset_guitar(ts, 10); else Loading Loading @@ -278,10 +271,10 @@ Output: *********************************************************/ int gtp_send_cfg(struct goodix_ts_data *ts) { int ret; #if GTP_DRIVER_SEND_CFG int retry = 0; int ret = 0; int retry; if (ts->pdata->driver_send_cfg) { if (ts->fixed_cfg) { dev_dbg(&ts->client->dev, "Ic fixed config, no config sent!"); Loading @@ -290,12 +283,13 @@ int gtp_send_cfg(struct goodix_ts_data *ts) for (retry = 0; retry < GTP_I2C_RETRY_5; retry++) { ret = gtp_i2c_write(ts->client, ts->config_data, GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH); GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH); if (ret > 0) break; } } #endif } return ret; } Loading Loading @@ -355,9 +349,8 @@ Output: static void gtp_touch_down(struct goodix_ts_data *ts, int id, int x, int y, int w) { #if GTP_CHANGE_X2Y if (ts->pdata->change_x2y) swap(x, y); #endif input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); Loading Loading @@ -402,9 +395,7 @@ static void goodix_ts_work_func(struct work_struct *work) u8 finger = 0; static u16 pre_touch; static u8 pre_key; #if GTP_WITH_PEN static u8 pre_pen; #endif u8 key_value = 0; u8 *coor_data = NULL; s32 input_x = 0; Loading @@ -414,10 +405,7 @@ static void goodix_ts_work_func(struct work_struct *work) s32 i = 0; int ret = -1; struct goodix_ts_data *ts = NULL; #if GTP_SLIDE_WAKEUP u8 doze_buf[3] = {0x81, 0x4B}; #endif ts = container_of(work, struct goodix_ts_data, work); #ifdef CONFIG_GT9XX_TOUCHPANEL_UPDATE Loading @@ -425,7 +413,7 @@ static void goodix_ts_work_func(struct work_struct *work) return; #endif #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) { if (DOZE_ENABLED == doze_status) { ret = gtp_i2c_read(ts->client, doze_buf, 3); if (ret > 0) { Loading @@ -446,9 +434,11 @@ static void goodix_ts_work_func(struct work_struct *work) dev_dbg(&ts->client->dev, "Slide(0xBB) To Light up the screen!"); doze_status = DOZE_WAKEUP; input_report_key(ts->input_dev, KEY_POWER, 1); input_report_key(ts->input_dev, KEY_POWER, 1); input_sync(ts->input_dev); input_report_key(ts->input_dev, KEY_POWER, 0); input_report_key(ts->input_dev, KEY_POWER, 0); input_sync(ts->input_dev); /* clear 0x814B*/ doze_buf[2] = 0x00; Loading @@ -457,9 +447,11 @@ static void goodix_ts_work_func(struct work_struct *work) dev_dbg(&ts->client->dev, "double click to light up the screen!"); doze_status = DOZE_WAKEUP; input_report_key(ts->input_dev, KEY_POWER, 1); input_report_key(ts->input_dev, KEY_POWER, 1); input_sync(ts->input_dev); input_report_key(ts->input_dev, KEY_POWER, 0); input_report_key(ts->input_dev, KEY_POWER, 0); input_sync(ts->input_dev); /* clear 0x814B */ doze_buf[2] = 0x00; Loading @@ -473,7 +465,7 @@ static void goodix_ts_work_func(struct work_struct *work) return; } #endif } ret = gtp_i2c_read(ts->client, point_data, 12); if (ret < 0) { Loading Loading @@ -514,7 +506,7 @@ static void goodix_ts_work_func(struct work_struct *work) pre_key = key_value; #if GTP_WITH_PEN if (ts->pdata->with_pen) { if (pre_pen && (touch_num == 0)) { dev_dbg(&ts->client->dev, "Pen touch UP(Slot)!"); input_report_key(ts->input_dev, BTN_TOOL_PEN, 0); Loading @@ -522,7 +514,8 @@ static void goodix_ts_work_func(struct work_struct *work) input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, -1); pre_pen = 0; } #endif } if (pre_touch || touch_num) { s32 pos = 0; u16 touch_index = 0; Loading @@ -530,7 +523,7 @@ static void goodix_ts_work_func(struct work_struct *work) coor_data = &point_data[3]; if (touch_num) { id = coor_data[pos] & 0x0F; #if GTP_WITH_PEN if (ts->pdata->with_pen) { id = coor_data[pos]; if (id == 128) { dev_dbg(&ts->client->dev, Loading Loading @@ -559,16 +552,16 @@ static void goodix_ts_work_func(struct work_struct *work) pre_pen = 1; pre_touch = 0; } #endif } touch_index |= (0x01<<id); } for (i = 0; i < GTP_MAX_TOUCH; i++) { #if GTP_WITH_PEN if (ts->pdata->with_pen) if (pre_pen == 1) break; #endif if (touch_index & (0x01<<i)) { input_x = coor_data[pos + 1] | coor_data[pos + 2] << 8; Loading Loading @@ -673,7 +666,6 @@ void gtp_reset_guitar(struct goodix_ts_data *ts, int ms) } #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB) #if GTP_SLIDE_WAKEUP /******************************************************* Function: Enter doze mode for sliding wakeup. Loading @@ -690,9 +682,9 @@ static s8 gtp_enter_doze(struct goodix_ts_data *ts) (u8)(GTP_REG_SLEEP >> 8), (u8)GTP_REG_SLEEP, 8}; #if GTP_DBL_CLK_WAKEUP if (ts->pdata->dbl_clk_wakeup) i2c_control_buf[2] = 0x09; #endif gtp_irq_disable(ts); while (retry++ < GTP_I2C_RETRY_3) { Loading Loading @@ -721,7 +713,6 @@ static s8 gtp_enter_doze(struct goodix_ts_data *ts) gtp_irq_enable(ts); return ret; } #else /** * gtp_enter_sleep - Enter sleep mode * @ts: driver private data Loading Loading @@ -767,7 +758,6 @@ static u8 gtp_enter_sleep(struct goodix_ts_data *ts) return ret; } } #endif /* !GTP_SLIDE_WAKEUP */ /******************************************************* Function: Loading Loading @@ -813,25 +803,25 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts) "Wakeup sleep send config success."); } else { err_retry: #if GTP_SLIDE_WAKEUP /* wakeup not by slide */ if (ts->pdata->slide_wakeup) { /* wakeup not by slide */ if (DOZE_WAKEUP != doze_status) gtp_reset_guitar(ts, 10); else /* wakeup by slide */ doze_status = DOZE_DISABLED; #else } else { if (chip_gt9xxs == 1) { gtp_reset_guitar(ts, 10); } else { ret = gpio_direction_output(ts->pdata->irq_gpio, 1); ret = gpio_direction_output( ts->pdata->irq_gpio, 1); usleep(5000); } #endif } ret = gtp_i2c_test(ts->client); if (ret == 2) { dev_dbg(&ts->client->dev, "GTP wakeup sleep."); #if (!GTP_SLIDE_WAKEUP) if (!ts->pdata->slide_wakeup) { if (chip_gt9xxs == 0) { gtp_int_sync(ts, 25); msleep(20); Loading @@ -839,7 +829,7 @@ err_retry: gtp_init_ext_watchdog(ts->client); #endif } #endif } return ret; } gtp_reset_guitar(ts, 20); Loading @@ -863,15 +853,14 @@ Output: static int gtp_init_panel(struct goodix_ts_data *ts) { struct i2c_client *client = ts->client; unsigned char *config_data; unsigned char *config_data = NULL; int ret = -EIO; #if GTP_DRIVER_SEND_CFG int i; u8 check_sum = 0; u8 opr_buf[16]; u8 sensor_id = 0; if (ts->pdata->driver_send_cfg) { for (i = 0; i < GOODIX_MAX_CFG_GROUP; i++) dev_dbg(&client->dev, "Config Groups(%d) Lengths: %d", i, ts->pdata->config_data_len[i]); Loading @@ -890,11 +879,12 @@ static int gtp_init_panel(struct goodix_ts_data *ts) if (ts->pdata->config_data_len[i]) break; } if (i == GOODIX_MAX_CFG_GROUP) { sensor_id = 0; } else { ret = gtp_i2c_read_dbl_check(ts->client, GTP_REG_SENSOR_ID, &sensor_id, 1); ret = gtp_i2c_read_dbl_check(ts->client, GTP_REG_SENSOR_ID, &sensor_id, 1); if (SUCCESS == ret) { if (sensor_id >= GOODIX_MAX_CFG_GROUP) { dev_err(&client->dev, Loading @@ -911,7 +901,8 @@ static int gtp_init_panel(struct goodix_ts_data *ts) dev_info(&client->dev, "Sensor ID selected: %d", sensor_id); if (ts->pdata->config_data_len[sensor_id] < GTP_CONFIG_MIN_LENGTH || if (ts->pdata->config_data_len[sensor_id] < GTP_CONFIG_MIN_LENGTH || !ts->pdata->config_data[sensor_id]) { dev_err(&client->dev, "Sensor_ID(%d) matches with NULL or invalid config group!\n", Loading @@ -925,9 +916,11 @@ static int gtp_init_panel(struct goodix_ts_data *ts) if (opr_buf[0] < 90) { /* backup group config version */ grp_cfg_version = ts->pdata->config_data[sensor_id][GTP_ADDR_LENGTH]; ts->pdata->config_data[sensor_id][GTP_ADDR_LENGTH] = 0x00; ts->pdata-> config_data[sensor_id][GTP_ADDR_LENGTH]; ts->pdata-> config_data[sensor_id][GTP_ADDR_LENGTH] = 0x00; ts->fixed_cfg = 0; } else { /* treated as fixed config, not send config */ Loading Loading @@ -968,7 +961,7 @@ static int gtp_init_panel(struct goodix_ts_data *ts) config_data[ts->gtp_cfg_len] = (~check_sum) + 1; #else /* DRIVER NOT SEND CONFIG */ } else { /* DRIVER NOT SEND CONFIG */ ts->gtp_cfg_len = GTP_CONFIG_MAX_LENGTH; ret = gtp_i2c_read(ts->client, config_data, ts->gtp_cfg_len + GTP_ADDR_LENGTH); Loading @@ -979,7 +972,7 @@ static int gtp_init_panel(struct goodix_ts_data *ts) ts->abs_y_max = GTP_MAX_HEIGHT; ts->int_trigger_type = GTP_INT_TRIGGER; } #endif /* !DRIVER NOT SEND CONFIG */ } /* !DRIVER NOT SEND CONFIG */ if ((ts->abs_x_max == 0) && (ts->abs_y_max == 0)) { ts->abs_x_max = (config_data[RESOLUTION_LOC + 1] << 8) Loading Loading @@ -1213,9 +1206,7 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts) { int ret; char phys[PHY_BUF_SIZE]; #if GTP_HAVE_TOUCH_KEY int index = 0; #endif ts->input_dev = input_allocate_device(); if (ts->input_dev == NULL) { Loading @@ -1231,27 +1222,24 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts) /* in case of "out of memory" */ input_mt_init_slots(ts->input_dev, 10, 0); if (ts->pdata->have_touch_key) { for (index = 0; index < ts->pdata->num_button; index++) { input_set_capability(ts->input_dev, EV_KEY, ts->pdata->button_map[index]); } } #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) input_set_capability(ts->input_dev, EV_KEY, KEY_POWER); #endif #if GTP_WITH_PEN /* pen support */ if (ts->pdata->with_pen) { /* pen support */ __set_bit(BTN_TOOL_PEN, ts->input_dev->keybit); __set_bit(INPUT_PROP_DIRECT, ts->input_dev->propbit); __set_bit(INPUT_PROP_POINTER, ts->input_dev->propbit); #endif } #if GTP_CHANGE_X2Y if (ts->pdata->change_x2y) swap(ts->abs_x_max, ts->abs_y_max); #endif input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, ts->abs_x_max, 0, 0); Loading Loading @@ -1851,6 +1839,25 @@ static int goodix_parse_dt(struct device *dev, pdata->enable_power_off = of_property_read_bool(np, "goodix,enable-power-off"); pdata->have_touch_key = of_property_read_bool(np, "goodix,have-touch-key"); pdata->driver_send_cfg = of_property_read_bool(np, "goodix,driver-send-cfg"); pdata->change_x2y = of_property_read_bool(np, "goodix,change-x2y"); pdata->with_pen = of_property_read_bool(np, "goodix,with-pen"); pdata->slide_wakeup = of_property_read_bool(np, "goodix,slide-wakeup"); pdata->dbl_clk_wakeup = of_property_read_bool(np, "goodix,dbl_clk_wakeup"); /* reset, irq gpio info */ pdata->reset_gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &pdata->reset_gpio_flags); Loading Loading @@ -2114,8 +2121,6 @@ exit_free_irq: #endif if (ts->use_irq) free_irq(client->irq, ts); else hrtimer_cancel(&ts->timer); cancel_work_sync(&ts->work); flush_workqueue(ts->goodix_wq); destroy_workqueue(ts->goodix_wq); Loading Loading @@ -2179,8 +2184,6 @@ static int goodix_ts_remove(struct i2c_client *client) if (ts) { if (ts->use_irq) free_irq(client->irq, ts); else hrtimer_cancel(&ts->timer); cancel_work_sync(&ts->work); flush_workqueue(ts->goodix_wq); Loading Loading @@ -2238,13 +2241,11 @@ static int goodix_ts_suspend(struct device *dev) gtp_esd_switch(ts->client, SWITCH_OFF); #endif #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) { ret = gtp_enter_doze(ts); #else } else { if (ts->use_irq) gtp_irq_disable(ts); else hrtimer_cancel(&ts->timer); for (i = 0; i < GTP_MAX_TOUCH; i++) gtp_touch_up(ts, i); Loading @@ -2252,9 +2253,9 @@ static int goodix_ts_suspend(struct device *dev) input_sync(ts->input_dev); ret = gtp_enter_sleep(ts); #endif if (ret < 0) dev_err(&ts->client->dev, "GTP early suspend failed.\n"); } /* to avoid waking up while not sleeping, * delay 48 + 10ms to ensure reliability */ Loading Loading @@ -2286,18 +2287,14 @@ static int goodix_ts_resume(struct device *dev) mutex_lock(&ts->lock); ret = gtp_wakeup_sleep(ts); #if GTP_SLIDE_WAKEUP if (ts->pdata->slide_wakeup) doze_status = DOZE_DISABLED; #endif if (ret <= 0) dev_err(&ts->client->dev, "GTP resume failed.\n"); if (ts->use_irq) gtp_irq_enable(ts); else hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL); #if GTP_ESD_PROTECT gtp_esd_switch(ts->client, SWITCH_ON); Loading
drivers/input/touchscreen/gt9xx/gt9xx.h +6 −9 Original line number Diff line number Diff line Loading @@ -63,6 +63,12 @@ struct goodix_ts_platform_data { u8 *config_data[GOODIX_MAX_CFG_GROUP]; u32 button_map[MAX_BUTTONS]; u8 num_button; bool have_touch_key; bool driver_send_cfg; bool change_x2y; bool with_pen; bool slide_wakeup; bool dbl_clk_wakeup; }; struct goodix_ts_data { spinlock_t irq_lock; Loading Loading @@ -111,16 +117,7 @@ extern u16 total_len; /***************************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 1 #define GTP_ESD_PROTECT 0 #define GTP_WITH_PEN 0 /* This cannot work when enable-power-off is on */ #define GTP_SLIDE_WAKEUP 0 /* double-click wakeup, function together with GTP_SLIDE_WAKEUP */ #define GTP_DBL_CLK_WAKEUP 0 #define GTP_IRQ_TAB {\ IRQ_TYPE_EDGE_RISING,\ Loading