From: Gongwei Chen Date: Wed, 16 Oct 2019 06:08:03 +0000 (+0800) Subject: tp: enble tp in w400 dts [2/2] X-Git-Tag: hardkernel-4.9.236-104~524 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a209ff19a3d33a9abe8b09b7c33f328d3ad00bc1;p=platform%2Fkernel%2Flinux-amlogic.git tp: enble tp in w400 dts [2/2] 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 --- diff --git a/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts b/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts index f9e5b94..0d4affa 100644 --- a/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts +++ b/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts @@ -901,12 +901,13 @@ 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>; }; }; diff --git a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts index fd75ce9..f6b2008 100644 --- a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts +++ b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts @@ -902,12 +902,13 @@ 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>; }; }; diff --git a/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.c b/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.c index 5e8cd66..076b22b 100644 --- a/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.c +++ b/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.c @@ -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; diff --git a/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.h b/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.h index d9ca8b0..a18ec47 100644 --- a/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.h +++ b/drivers/amlogic/input/touchscreen/focaltech_touch/focaltech_core.h @@ -109,20 +109,21 @@ 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