Browse Source

atmel touch für 7inch mit glasfront ohne tiva eingebaut

Reinhard Russinger 7 years ago
parent
commit
aaa81866a7

+ 1 - 1
board/GfA/Display001/BUILD

@@ -1 +1 @@
-600
+603

+ 11 - 1
board/GfA/Display001/DTS_4.4/Display002_7.dts

@@ -219,12 +219,22 @@ i2c@3 {
                         pinctrl-names = "default";
                         pinctrl-0 = <&edt_ft5x06_pins>;
                         interrupt-parent = <&gpio2>;
-                        interrupts = <1 0>;
+                        interrupts = <1 8>;
                         reset-gpios = <&gpio3 21 1>;
 			max_x = <800>;
 			max_y = <480>;
                 };
 
+        maxtouch: atmel_mxt_ts@4a {
+                        compatible = "atmel,maxtouch";
+                   	invert_y;
+			reg = <0x4a>;
+                        pinctrl-names = "default";
+                        pinctrl-0 = <&edt_ft5x06_pins>;
+                        interrupt-parent = <&gpio2>;
+                        interrupts = <1 8>;
+                };
+
 	mcp7940x: rtc@6f {
 		compatible = "microchip,mcp7940x";
 		reg = <0x6f>;

+ 108 - 0
board/GfA/Display001/linux_4.4.94_rt19/linux-022-add-dts-flags-to-atmel-mxt-touch.patch

@@ -0,0 +1,108 @@
+diff -Naurp a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
+--- a/drivers/input/touchscreen/atmel_mxt_ts.c	2018-01-20 11:42:13.000000000 +0100
++++ b/drivers/input/touchscreen/atmel_mxt_ts.c	2018-01-25 09:03:33.876115406 +0100
+@@ -24,6 +24,7 @@
+ #include <linux/i2c.h>
+ #include <linux/platform_data/atmel_mxt_ts.h>
+ #include <linux/input/mt.h>
++#include <linux/input/touchscreen.h>
+ #include <linux/interrupt.h>
+ #include <linux/of.h>
+ #include <linux/slab.h>
+@@ -216,6 +217,9 @@ struct mxt_data {
+ 	unsigned int irq;
+ 	unsigned int max_x;
+ 	unsigned int max_y;
++	bool invert_x;
++	bool invert_y;
++	bool swap_x_y;
+ 	bool xy_switch;
+ 	bool in_bootloader;
+ 	u16 mem_size;
+@@ -257,6 +261,22 @@ struct mxt_data {
+ 	struct completion crc_completion;
+ };
+ 
++static void mxt_apply_prop_to_x_y(const struct mxt_data *data,
++                             int *x, int *y)
++{
++        if (data->invert_x)
++                *x = data->max_x - *x;
++
++        if (data->invert_y)
++                *y = data->max_y - *y;
++
++        if (data->swap_x_y)
++                swap(*x, *y);
++}
++
++
++
++
+ static size_t mxt_obj_size(const struct mxt_object *obj)
+ {
+ 	return obj->size_minus_one + 1;
+@@ -741,6 +761,8 @@ static void mxt_proc_t9_message(struct m
+ 
+ 		/* Touch active */
+ 		input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 1);
++		mxt_apply_prop_to_x_y(data, &x, &y);
++		
+ 		input_report_abs(input_dev, ABS_MT_POSITION_X, x);
+ 		input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
+ 		input_report_abs(input_dev, ABS_MT_PRESSURE, amplitude);
+@@ -760,8 +782,8 @@ static void mxt_proc_t100_message(struct
+ 	int id;
+ 	u8 status;
+ 	u8 type = 0;
+-	u16 x;
+-	u16 y;
++	/*u16*/ int x;
++	/*u16*/ int y;
+ 	int distance = 0;
+ 	int tool = 0;
+ 	u8 major = 0;
+@@ -845,6 +867,7 @@ static void mxt_proc_t100_message(struct
+ 			id, type, x, y, major, pressure, orientation);
+ 
+ 		input_mt_report_slot_state(input_dev, tool, 1);
++		mxt_apply_prop_to_x_y(data, &x, &y);
+ 		input_report_abs(input_dev, ABS_MT_POSITION_X, x);
+ 		input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
+ 		input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, major);
+@@ -1778,7 +1801,8 @@ static int mxt_initialize_input_device(s
+ 	int error;
+ 	unsigned int num_mt_slots;
+ 	unsigned int mt_flags = 0;
+-
++	struct device_node *np = dev->of_node;
++	
+ 	switch (data->multitouch) {
+ 	case MXT_TOUCH_MULTI_T9:
+ 		num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1;
+@@ -1818,6 +1842,7 @@ static int mxt_initialize_input_device(s
+ 		return -ENOMEM;
+ 	}
+ 
++
+ 	input_dev->name = "Atmel maXTouch Touchscreen";
+ 	input_dev->phys = data->phys;
+ 	input_dev->id.bustype = BUS_I2C;
+@@ -1908,6 +1933,17 @@ static int mxt_initialize_input_device(s
+ 
+ 	data->input_dev = input_dev;
+ 
++	if (np) {
++		data->invert_x = of_property_read_bool(np, "invert_x")?1:0;
++		data->invert_y = of_property_read_bool(np, "invert_y")?1:0;
++        	data->swap_x_y = of_property_read_bool(np, "swap_x_y")?1:0;
++        	
++        	dev_info(dev, "loaded toucscreen properties\n");
++        	dev_info(dev, "touchscreen-inverted-x %d\n", data->invert_x);
++        	dev_info(dev, "touchscreen-inverted-y %d\n", data->invert_y);
++        	dev_info(dev, "touchscreen-swap-x-y %d\n", data->swap_x_y);
++        }
++
+ 	return 0;
+ 
+ err_free_mem:

BIN
board/GfA/Display001/rootfs/opt/GfA-Browser/GfA-browser


+ 1 - 1
board/GfA/Display001/rootfs/root/startbrowser.sh

@@ -9,4 +9,4 @@ export HOME=/tmp
 export QT_QPA_EGLFS_PHYSICAL_WIDTH=152
 export QT_QPA_EGLFS_PHYSICAL_HEIGHT=92
 
-/opt/di-soric/HMI/VISU_di-soric
+/opt/GfA-Browser/GfA-browser

+ 3 - 0
configs/Display001_4.4.104_rt21_Qt5.7_defconfig

@@ -80,8 +80,11 @@ BR2_PACKAGE_BINUTILS=y
 BR2_PACKAGE_BINUTILS_TARGET=y
 BR2_PACKAGE_CMAKE_CTEST=y
 BR2_PACKAGE_GETTEXT=y
+BR2_PACKAGE_GIT=y
 BR2_PACKAGE_MAKE=y
+BR2_PACKAGE_PATCH=y
 BR2_PACKAGE_SED=y
+BR2_PACKAGE_TREE=y
 BR2_PACKAGE_CIFS_UTILS=y
 BR2_PACKAGE_DOSFSTOOLS=y
 BR2_PACKAGE_DOSFSTOOLS_FATLABEL=y