summaryrefslogtreecommitdiff
path: root/ft3658
diff options
context:
space:
mode:
authorMason Wang <masonwang@google.com>2022-04-13 18:20:00 +0800
committerMason Wang <masonwang@google.com>2022-04-25 11:32:01 +0800
commit67df5767fb65632cdee7bc8aa0718496114f8d30 (patch)
treec4de761b4ae90d79354fb253d37351b1c89e4176 /ft3658
parent7626ac16a51034ca025d643623d1160f5f0f1272 (diff)
downloadfocaltech_touch-67df5767fb65632cdee7bc8aa0718496114f8d30.tar.gz
touch/focaltech: Support touch orientation.
Note: The focaltech touch firmware does not support to report the rotation/orientation data, but the rotation/orientation is calculated from offload and reported to upper layer. Bug: 227525554 Test: Touch works well. Signed-off-by: Mason Wang <masonwang@google.com> Change-Id: I6e2309845056397ed495965d8fb2010adefe866f
Diffstat (limited to 'ft3658')
-rw-r--r--ft3658/focaltech_core.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ft3658/focaltech_core.c b/ft3658/focaltech_core.c
index b9c8970..79daf59 100644
--- a/ft3658/focaltech_core.c
+++ b/ft3658/focaltech_core.c
@@ -547,6 +547,8 @@ static int fts_input_report_b(struct fts_ts_data *data)
data->offload.coords[events[i].id].pressure = events[i].p;
data->offload.coords[events[i].id].major = events[i].major;
data->offload.coords[events[i].id].minor = events[i].minor;
+ /* Rotation is not supported by firmware */
+ data->offload.coords[events[i].id].rotation = 0;
if (!data->offload.offload_running) {
#endif
input_mt_slot(data->input_dev, events[i].id);
@@ -1511,11 +1513,14 @@ static void fts_offload_report(void *handle,
report->coords[i].minor);
input_report_abs(ts_data->input_dev, ABS_MT_PRESSURE,
report->coords[i].pressure);
+ input_report_abs(ts_data->input_dev, ABS_MT_ORIENTATION,
+ report->coords[i].rotation);
} else {
input_mt_slot(ts_data->input_dev, i);
input_report_abs(ts_data->input_dev, ABS_MT_PRESSURE, 0);
input_mt_report_slot_state(ts_data->input_dev, MT_TOOL_FINGER, 0);
input_report_abs(ts_data->input_dev, ABS_MT_TRACKING_ID, -1);
+ input_report_abs(ts_data->input_dev, ABS_MT_ORIENTATION, 0);
}
}
input_report_key(ts_data->input_dev, BTN_TOUCH, touch_down);
@@ -1545,6 +1550,7 @@ static void fts_populate_coordinate_channel(struct fts_ts_data *ts_data,
dc->coords[i].major = ts_data->offload.coords[i].major;
dc->coords[i].minor = ts_data->offload.coords[i].minor;
dc->coords[i].pressure = ts_data->offload.coords[i].pressure;
+ dc->coords[i].rotation = ts_data->offload.coords[i].rotation;
dc->coords[i].status = ts_data->offload.coords[i].status;
}
}
@@ -1789,7 +1795,10 @@ static int fts_input_init(struct fts_ts_data *ts_data)
#if FTS_REPORT_PRESSURE_EN
input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0xFF, 0, 0);
#endif
-
+ /* Units are (-4096, 4096), representing the range between rotation
+ * 90 degrees to left and 90 degrees to the right.
+ */
+ input_set_abs_params(input_dev, ABS_MT_ORIENTATION, -4096, 4096, 0, 0);
ret = input_register_device(input_dev);
if (ret) {
FTS_ERROR("Input device registration failed");
@@ -2698,6 +2707,7 @@ static int fts_ts_probe_entry(struct fts_ts_data *ts_data)
ts_data->offload.caps.continuous_reporting = true;
ts_data->offload.caps.noise_reporting = false;
ts_data->offload.caps.cancel_reporting = false;
+ ts_data->offload.caps.rotation_reporting = true;
ts_data->offload.caps.size_reporting = true;
ts_data->offload.caps.filter_grip = true;
ts_data->offload.caps.filter_palm = true;