author | Gongwei Chen <gongwei.chen@amlogic.com> | 2019-10-16 06:08:03 (GMT) |
---|---|---|
committer | Jianxin Pan <jianxin.pan@amlogic.com> | 2019-10-21 09:30:03 (GMT) |
commit | 43db4e3141e9ee7b81706b76e99db081ad12ae56 (patch) | |
tree | 35d9f12d5a76827d2ee798fff4994a0da51b8875 | |
parent | c463ec252d915f6b67584556c76fbdb59f1740ca (diff) | |
download | common-43db4e3141e9ee7b81706b76e99db081ad12ae56.zip common-43db4e3141e9ee7b81706b76e99db081ad12ae56.tar.gz common-43db4e3141e9ee7b81706b76e99db081ad12ae56.tar.bz2 |
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 <gongwei.chen@amlogic.com>
4 files changed, 43 insertions, 24 deletions
diff --git a/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts b/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts index bd632299..57dfed8 100644 --- a/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts +++ b/arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts @@ -913,12 +913,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 0551a62..91cff26 100644 --- a/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts +++ b/arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts @@ -914,12 +914,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 |