|
@@ -0,0 +1,138 @@
|
|
|
+--- a/drivers/input/touchscreen/edt-ft5x06.c 2017-03-07 10:54:46.545922867 +0100
|
|
|
++++ b/drivers/input/touchscreen/edt-ft5x06.c 2017-03-07 10:31:23.486054905 +0100
|
|
|
+@@ -115,6 +115,13 @@
|
|
|
+ int offset;
|
|
|
+ int report_rate;
|
|
|
+
|
|
|
++ u32 invert_x;
|
|
|
++ u32 invert_y;
|
|
|
++ u32 swap_xy;
|
|
|
++
|
|
|
++ u32 max_x;
|
|
|
++ u32 max_y;
|
|
|
++
|
|
|
+ char name[EDT_NAME_LEN];
|
|
|
+
|
|
|
+ struct edt_reg_addr reg_addr;
|
|
|
+@@ -240,11 +247,24 @@
|
|
|
+ if (tsdata->version == M06 && type == TOUCH_EVENT_DOWN)
|
|
|
+ continue;
|
|
|
+
|
|
|
+- x = ((buf[0] << 8) | buf[1]) & 0x0fff;
|
|
|
+- y = ((buf[2] << 8) | buf[3]) & 0x0fff;
|
|
|
++ if( tsdata->swap_xy) {
|
|
|
++ y = ((buf[0] << 8) | buf[1]) & 0x0fff;
|
|
|
++ x = ((buf[2] << 8) | buf[3]) & 0x0fff;
|
|
|
++ } else {
|
|
|
++ x = ((buf[0] << 8) | buf[1]) & 0x0fff;
|
|
|
++ y = ((buf[2] << 8) | buf[3]) & 0x0fff;
|
|
|
++ }
|
|
|
+ id = (buf[2] >> 4) & 0x0f;
|
|
|
+ down = type != TOUCH_EVENT_UP;
|
|
|
+
|
|
|
++ if(tsdata->invert_x) {
|
|
|
++ x = tsdata->max_x - x;
|
|
|
++ }
|
|
|
++
|
|
|
++ if(tsdata->invert_y) {
|
|
|
++ y = tsdata->max_y - y;
|
|
|
++ }
|
|
|
++
|
|
|
+ input_mt_slot(tsdata->input, id);
|
|
|
+ input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER, down);
|
|
|
+
|
|
|
+@@ -746,9 +766,9 @@
|
|
|
+
|
|
|
+ debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x);
|
|
|
+ debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y);
|
|
|
+- debugfs_create_u16("threshold", S_IRUSR, tsdata->debug_dir, &tsdata->threshold);
|
|
|
+- debugfs_create_u16("gain", S_IRUSR, tsdata->debug_dir, &tsdata->gain);
|
|
|
+- debugfs_create_u16("offset", S_IRUSR, tsdata->debug_dir, &tsdata->offset);
|
|
|
++ debugfs_create_u32("threshold", S_IRUSR, tsdata->debug_dir, &tsdata->threshold);
|
|
|
++ debugfs_create_u32("gain", S_IRUSR, tsdata->debug_dir, &tsdata->gain);
|
|
|
++ debugfs_create_u32("offset", S_IRUSR, tsdata->debug_dir, &tsdata->offset);
|
|
|
+
|
|
|
+
|
|
|
+ debugfs_create_file("mode", S_IRUSR | S_IWUSR,
|
|
|
+@@ -757,7 +777,20 @@
|
|
|
+ tsdata->debug_dir, tsdata, &debugfs_raw_data_fops);
|
|
|
+
|
|
|
+ if (reg_addr->reg_report_rate != NO_REGISTER)
|
|
|
+- debugfs_create_u16("report_rate", S_IRUSR, tsdata->debug_dir, &tsdata->report_rate);
|
|
|
++ debugfs_create_u32("report_rate", S_IRUSR, tsdata->debug_dir, &tsdata->report_rate);
|
|
|
++
|
|
|
++ debugfs_create_u32("invert_x", S_IRUSR | S_IWUSR,
|
|
|
++ tsdata->debug_dir, &tsdata->invert_x);
|
|
|
++ debugfs_create_u32("invert_y", S_IRUSR | S_IWUSR,
|
|
|
++ tsdata->debug_dir, &tsdata->invert_y);
|
|
|
++ debugfs_create_u32("swap_xy", S_IRUSR,
|
|
|
++ tsdata->debug_dir, &tsdata->swap_xy);
|
|
|
++ debugfs_create_u32("max_x", S_IRUSR,
|
|
|
++ tsdata->debug_dir, &tsdata->max_x);
|
|
|
++ debugfs_create_u32("max_y", S_IRUSR,
|
|
|
++ tsdata->debug_dir, &tsdata->max_y);
|
|
|
++
|
|
|
++
|
|
|
+ }
|
|
|
+
|
|
|
+ static void
|
|
|
+@@ -967,6 +1000,12 @@
|
|
|
+ reg_addr->reg_report_rate);
|
|
|
+ tsdata->num_x = edt_ft5x06_register_read(tsdata, reg_addr->reg_num_x);
|
|
|
+ tsdata->num_y = edt_ft5x06_register_read(tsdata, reg_addr->reg_num_y);
|
|
|
++
|
|
|
++ if(tsdata->max_x == 0)
|
|
|
++ tsdata->max_x = tsdata->num_x * 64;
|
|
|
++ if(tsdata->max_y == 0)
|
|
|
++ tsdata->max_y = tsdata->num_y * 64;
|
|
|
++
|
|
|
+ }
|
|
|
+
|
|
|
+ static void
|
|
|
+@@ -1008,7 +1047,6 @@
|
|
|
+ struct edt_ft5x06_ts_data *tsdata)
|
|
|
+ {
|
|
|
+ struct device_node *np = dev->of_node;
|
|
|
+-
|
|
|
+ /*
|
|
|
+ * irq_pin is not needed for DT setup.
|
|
|
+ * irq is associated via 'interrupts' property in DT
|
|
|
+@@ -1016,7 +1054,19 @@
|
|
|
+ tsdata->irq_pin = -EINVAL;
|
|
|
+ tsdata->reset_pin = of_get_named_gpio(np, "reset-gpios", 0);
|
|
|
+ tsdata->wake_pin = of_get_named_gpio(np, "wake-gpios", 0);
|
|
|
+-
|
|
|
++
|
|
|
++ tsdata->swap_xy = of_property_read_bool(np, "swap_xy")?1:0;
|
|
|
++ tsdata->invert_x = of_property_read_bool(np, "invert_x")?1:0;
|
|
|
++ tsdata->invert_y = of_property_read_bool(np, "invert_y")?1:0;
|
|
|
++
|
|
|
++ if(of_property_read_u32(np, "max_x", &tsdata->max_x))
|
|
|
++ tsdata->max_x = 0;
|
|
|
++ if(of_property_read_u32(np, "max_y", &tsdata->max_y))
|
|
|
++ tsdata->max_y = 0;
|
|
|
++
|
|
|
++ if(tsdata->swap_xy) {
|
|
|
++ printk(KERN_INFO "EDT-TC:: %s :: SWAP_XY\n", __func__);
|
|
|
++ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ #else
|
|
|
+@@ -1111,12 +1161,13 @@
|
|
|
+ __set_bit(EV_KEY, input->evbit);
|
|
|
+ __set_bit(EV_ABS, input->evbit);
|
|
|
+ __set_bit(BTN_TOUCH, input->keybit);
|
|
|
+- input_set_abs_params(input, ABS_X, 0, tsdata->num_x * 64 - 1, 0, 0);
|
|
|
+- input_set_abs_params(input, ABS_Y, 0, tsdata->num_y * 64 - 1, 0, 0);
|
|
|
++
|
|
|
++ input_set_abs_params(input, ABS_X, 0, tsdata->max_x - 1, 0, 0);
|
|
|
++ input_set_abs_params(input, ABS_Y, 0, tsdata->max_y - 1, 0, 0);
|
|
|
+ input_set_abs_params(input, ABS_MT_POSITION_X,
|
|
|
+- 0, tsdata->num_x * 64 - 1, 0, 0);
|
|
|
++ 0, tsdata->max_x - 1, 0, 0);
|
|
|
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
|
|
|
+- 0, tsdata->num_y * 64 - 1, 0, 0);
|
|
|
++ 0, tsdata->max_y - 1, 0, 0);
|
|
|
+ error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0);
|
|
|
+ if (error) {
|
|
|
+ dev_err(&client->dev, "Unable to init MT slots.\n");
|