From 294bf90eaa9cb6184ee3208efedaf07af5042730 Mon Sep 17 00:00:00 2001 From: "chunlong.cao" Date: Thu, 10 Sep 2020 17:25:50 +0800 Subject: [PATCH] touchscreen: [W400][BDS]change to GT911 touch panel [1/1] PD#SWPL-32704 Problem: Unable to touch operation on panel Solution: change to GT911 touch panel Verify: W400 Signed-off-by: chunlong.cao Change-Id: Id49d5c93e7576f59926006d5cb993880c2badc8c --- arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts | 5 +++-- .../boot/dts/amlogic/g12b_a311d_w400_a.dts | 5 +++-- .../boot/dts/amlogic/g12b_a311d_w400.dts | 5 +++-- .../boot/dts/amlogic/g12b_a311d_w400_a.dts | 5 +++-- .../input/touchscreen/goodix_gt9xx/gt9xx.c | 22 ++++++++++++++++--- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts b/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts index e7102147969f..4abdde8ac1cc 100644 --- a/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts +++ b/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts @@ -885,10 +885,11 @@ touchscreen@5d { compatible = "goodix,gt9xx"; - status = "disabled"; + status = "okay"; reg = <0x5d>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; + rotation = <2>; goodix,cfg-group0 = [ 41 00 04 58 02 05 0C 00 02 54 07 0F 50 2D 03 05 00 00 00 00 40 00 @@ -911,7 +912,7 @@ touchscreen@38 { compatible = "focaltech,fts"; - status = "okay"; + status = "disabled"; reg = <0x38>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; diff --git a/arch/arm/boot/dts/amlogic/g12b_a311d_w400_a.dts b/arch/arm/boot/dts/amlogic/g12b_a311d_w400_a.dts index 92fa8d31d61a..e81934ceadba 100644 --- a/arch/arm/boot/dts/amlogic/g12b_a311d_w400_a.dts +++ b/arch/arm/boot/dts/amlogic/g12b_a311d_w400_a.dts @@ -859,10 +859,11 @@ touchscreen@5d { compatible = "goodix,gt9xx"; - status = "disabled"; + status = "okay"; reg = <0x5d>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; + rotation = <2>; goodix,cfg-group0 = [ 41 00 04 58 02 05 0C 00 02 54 07 0F 50 2D 03 05 00 00 00 00 40 00 @@ -885,7 +886,7 @@ touchscreen@38 { compatible = "focaltech,fts"; - status = "okay"; + status = "disabled"; reg = <0x38>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; diff --git a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts index 760249d10087..16dff86b560d 100644 --- a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts +++ b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts @@ -887,10 +887,11 @@ touchscreen@5d { compatible = "goodix,gt9xx"; - status = "disabled"; + status = "okay"; reg = <0x5d>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; + rotation = <2>; goodix,cfg-group0 = [ 41 00 04 58 02 05 0C 00 02 54 07 0F 50 2D 03 05 00 00 00 00 40 00 @@ -913,7 +914,7 @@ touchscreen@38 { compatible = "focaltech,fts"; - status = "okay"; + status = "disabled"; reg = <0x38>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; diff --git a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400_a.dts b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400_a.dts index 94be332da480..ea34513b667a 100644 --- a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400_a.dts +++ b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400_a.dts @@ -861,10 +861,11 @@ touchscreen@5d { compatible = "goodix,gt9xx"; - status = "disabled"; + status = "okay"; reg = <0x5d>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; + rotation = <2>; goodix,cfg-group0 = [ 41 00 04 58 02 05 0C 00 02 54 07 0F 50 2D 03 05 00 00 00 00 40 00 @@ -887,7 +888,7 @@ touchscreen@38 { compatible = "focaltech,fts"; - status = "okay"; + status = "disabled"; reg = <0x38>; reset-gpio = <&gpio GPIOZ_9 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOZ_3 GPIO_ACTIVE_HIGH>; diff --git a/drivers/amlogic/input/touchscreen/goodix_gt9xx/gt9xx.c b/drivers/amlogic/input/touchscreen/goodix_gt9xx/gt9xx.c index 7184e971d3be..239c8814c2bb 100644 --- a/drivers/amlogic/input/touchscreen/goodix_gt9xx/gt9xx.c +++ b/drivers/amlogic/input/touchscreen/goodix_gt9xx/gt9xx.c @@ -31,6 +31,7 @@ static struct workqueue_struct *goodix_wq; struct i2c_client * i2c_connect_client = NULL; int gtp_rst_gpio; int gtp_int_gpio; +static u32 rotation; u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH] = {GTP_REG_CONFIG_DATA >> 8, GTP_REG_CONFIG_DATA & 0xff}; @@ -391,8 +392,14 @@ static void gtp_touch_down(struct goodix_ts_data* ts,s32 id,s32 x,s32 y,s32 w) input_mt_report_slot_state(ts->input_dev,MT_TOOL_FINGER,true); } input_report_abs(ts->input_dev, ABS_MT_PRESSURE, w); - input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); - input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); + + if (2 == rotation) { + input_report_abs(ts->input_dev, ABS_MT_POSITION_X, ts->abs_x_max-x); + input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, ts->abs_y_max-y); + }else{ + input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); + input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); + } input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w); input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w); #else @@ -2311,10 +2318,19 @@ void gtp_get_chip_type(struct goodix_ts_data *ts) static void gtp_parse_dt(struct device *dev) { struct device_node *np = dev->of_node; - + u32 temp_val; + int ret = 0; + gtp_int_gpio = of_get_named_gpio(np, "irq-gpio", 0); gtp_rst_gpio = of_get_named_gpio(np, "reset-gpio", 0); + ret = of_property_read_u32(np, "rotation", &temp_val); + if (!ret) { + rotation = temp_val; + } else { + rotation = 0; + GTP_ERROR("cannot get rotation value of touchscreen"); + } } /**