tp: enble tp in w400 dts [2/2]
authorGongwei Chen <gongwei.chen@amlogic.com>
Wed, 16 Oct 2019 06:08:03 +0000 (14:08 +0800)
committerGongwei Chen <gongwei.chen@amlogic.com>
Thu, 17 Oct 2019 11:23:37 +0000 (04:23 -0700)
PD#SWPL-15292

Problem:
W400 is not touch panel

Solution:
add touch panel in w400

Verify:
verify by w400

Change-Id: Ibb4323458a2e84ba9fa84177fe6c747611277c55
Signed-off-by: GongWei Chen <gongwei.chen@amlogic.com>
arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts
drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.c
drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.h

index f9e5b94..0d4affa 100644 (file)
 
        touchscreen@38 {
                compatible = "focaltech,fts";
-               status = "disabled";
+               status = "okay";
                reg = <0x38>;
                reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>;
                irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>;
-               x_max = <720>;
-               y_max = <1280>;
+               x_max = <1280>;
+               y_max = <720>;
+               rotation = <1>;
                max-touch-number = <10>;
        };
 };
index fd75ce9..f6b2008 100644 (file)
 
        touchscreen@38 {
                compatible = "focaltech,fts";
-               status = "disabled";
+               status = "okay";
                reg = <0x38>;
                reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>;
                irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>;
-               x_max = <720>;
-               y_max = <1280>;
+               x_max = <1280>;
+               y_max = <720>;
+               rotation = <1>;
                max-touch-number = <10>;
        };
 };
index 5e8cd66..076b22b 100644 (file)
@@ -492,8 +492,19 @@ static int fts_input_dev_report_b(struct ts_event *event, struct fts_ts_data *da
             }
             input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, event->area[i]);
 
-            input_report_abs(data->input_dev, ABS_MT_POSITION_X, event->au16_x[i]);
-            input_report_abs(data->input_dev, ABS_MT_POSITION_Y, event->au16_y[i]);
+       if (data->pdata->rotation) {
+               input_report_abs(data->input_dev, ABS_MT_POSITION_X,
+                                data->pdata->x_max - event->au16_y[i]);
+               input_report_abs(data->input_dev, ABS_MT_POSITION_Y,
+                                event->au16_x[i]);
+
+       } else {
+               input_report_abs(data->input_dev, ABS_MT_POSITION_X,
+                                event->au16_x[i]);
+               input_report_abs(data->input_dev, ABS_MT_POSITION_Y,
+                                event->au16_y[i]);
+       }
+
             touchs |= BIT(event->au8_finger_id[i]);
             data->touchs |= BIT(event->au8_finger_id[i]);
 
@@ -994,10 +1005,15 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata)
     rc = of_property_read_u32(np, "y_max", &temp_val);
     if (!rc)
     {
-        pdata->x_max = temp_val;
-        FTS_DEBUG("y_max=%d", pdata->x_max);
+       pdata->y_max = temp_val;
+       FTS_DEBUG("y_max=%d", pdata->y_max);
     }
 
+       rc = of_property_read_u32(np, "rotation", &temp_val);
+       if (!rc) {
+               pdata->rotation = temp_val;
+               FTS_DEBUG("rotation = %d", pdata->rotation);
+       }
 
     FTS_FUNC_EXIT();
     return 0;
index d9ca8b0..a18ec47 100644 (file)
 
 struct fts_ts_platform_data
 {
-    s32 irq_gpio;
-    u32 irq_gpio_flags;
-    s32 reset_gpio;
-    u32 reset_gpio_flags;
-    bool have_key;
-    u32 key_number;
-    u32 keys[4];
-    u32 key_y_coord;
-    u32 key_x_coords[4];
-    u32 x_max;
-    u32 y_max;
-    u32 x_min;
-    u32 y_min;
-    u32 max_touch_number;
+       s32 irq_gpio;
+       u32 irq_gpio_flags;
+       s32 reset_gpio;
+       u32 reset_gpio_flags;
+       bool have_key;
+       u32 key_number;
+       u32 keys[4];
+       u32 key_y_coord;
+       u32 key_x_coords[4];
+       u32 x_max;
+       u32 y_max;
+       u32 x_min;
+       u32 y_min;
+       u32 max_touch_number;
+       u32 rotation;
 };
 
 struct ts_event