summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorHaibo Chen <haibo.chen@nxp.com>2018-07-20 15:45:12 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit9f662edd6478c999f344c11107a161dffe288ca4 (patch)
treed3dc92162ea174bf8ba333e8796664f38731077c /drivers/input/touchscreen
parent1c2afcb03c04b81edc89bf94e776382c87b24d3d (diff)
MLK-18721-1: input: touch: Synaptics: add x/y diagonal rotation support
Add x/y coordinate diagonal rotation support, user can use this feature by add "synaptics,diagonal-rotation" in dts. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c12
-rw-r--r--drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c
index 415ea943b795..35fc226a5190 100644
--- a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c
+++ b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c
@@ -1092,6 +1092,11 @@ static int synaptics_rmi4_f11_abs_report(struct synaptics_rmi4_data *rmi4_data,
x = (data.x_position_11_4 << 4) | data.x_position_3_0;
y = (data.y_position_11_4 << 4) | data.y_position_3_0;
+ if (rmi4_data->diagonal_rotation) {
+ x = rmi4_data->sensor_max_x - x;
+ y = rmi4_data->sensor_max_y - y;
+ }
+
wx = data.wx;
wy = data.wy;
@@ -1270,6 +1275,11 @@ static int synaptics_rmi4_f12_abs_report(struct synaptics_rmi4_data *rmi4_data,
x = (finger_data->x_msb << 8) | (finger_data->x_lsb);
y = (finger_data->y_msb << 8) | (finger_data->y_lsb);
+ if (rmi4_data->diagonal_rotation) {
+ x = rmi4_data->sensor_max_x - x;
+ y = rmi4_data->sensor_max_y - y;
+ }
+
#ifdef REPORT_2D_W
wx = finger_data->wx;
wy = finger_data->wy;
@@ -3228,6 +3238,8 @@ static int synaptics_rmi4_probe(struct i2c_client *client,
rmi4_data->sleep_enable = synaptics_rmi4_sleep_enable;
rmi4_data->i2c_addr = client->addr;
+ rmi4_data->diagonal_rotation = of_property_read_bool(np,
+ "synaptics,diagonal-rotation");
mutex_init(&(rmi4_data->rmi4_io_ctrl_mutex));
mutex_init(&(rmi4_data->rmi4_reset_mutex));
diff --git a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.h b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.h
index d2d738126ff9..12d7bf4ca225 100644
--- a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.h
+++ b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.h
@@ -306,6 +306,7 @@ struct synaptics_rmi4_data {
int irq;
int sensor_max_x;
int sensor_max_y;
+ bool diagonal_rotation;
bool flash_prog_mode;
bool irq_enabled;
bool touch_stopped;