Skip to content

Commit

Permalink
Add touch pressure support in synaptics touch driver.
Browse files Browse the repository at this point in the history
Enabled touch pressure report in touch sensor. Read and report
pressure data to input class.

See here https://jira.cyanogenmod.org/browse/BACON-403
  • Loading branch information
kimmoli committed Feb 28, 2016
1 parent 7157188 commit 88ce493
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion drivers/input/touchscreen/synaptics_dsx_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
//#define VENDOR_EDIT
#define NO_0D_WHILE_2D

//#define REPORT_2D_Z
#define REPORT_2D_Z

#define REPORT_2D_W

Expand Down Expand Up @@ -2708,6 +2708,9 @@ static int synaptics_rmi4_f12_abs_report(struct synaptics_rmi4_data *rmi4_data,
int wx;
int wy;
int temp;
#ifdef REPORT_2D_Z
int z;
#endif
struct synaptics_rmi4_f12_extra_data *extra_data;
struct synaptics_rmi4_f12_finger_data *data;
struct synaptics_rmi4_f12_finger_data *finger_data;
Expand Down Expand Up @@ -2821,6 +2824,10 @@ static int synaptics_rmi4_f12_abs_report(struct synaptics_rmi4_data *rmi4_data,
if (finger_status) {
x = (finger_data->x_msb << 8) | (finger_data->x_lsb);
y = (finger_data->y_msb << 8) | (finger_data->y_lsb);
#ifdef REPORT_2D_Z
// The presssure from the sensor is weak, *4
z = finger_data->z << 2;
#endif
#ifdef REPORT_2D_W
wx = finger_data->wx;
wy = finger_data->wy;
Expand Down Expand Up @@ -2870,6 +2877,10 @@ static int synaptics_rmi4_f12_abs_report(struct synaptics_rmi4_data *rmi4_data,
ABS_MT_POSITION_X, x);
input_report_abs(rmi4_data->input_dev,
ABS_MT_POSITION_Y, 1919);
#ifdef REPORT_2D_Z
input_report_abs(rmi4_data->input_dev,
ABS_MT_PRESSURE, z);
#endif
#ifdef REPORT_2D_W
input_report_abs(rmi4_data->input_dev,
ABS_MT_TOUCH_MAJOR, max(wx, wy));
Expand All @@ -2888,6 +2899,10 @@ static int synaptics_rmi4_f12_abs_report(struct synaptics_rmi4_data *rmi4_data,
ABS_MT_POSITION_X, x);
input_report_abs(rmi4_data->input_dev,
ABS_MT_POSITION_Y, y);
#ifdef REPORT_2D_Z
input_report_abs(rmi4_data->input_dev,
ABS_MT_PRESSURE, z);
#endif
#ifdef REPORT_2D_W
input_report_abs(rmi4_data->input_dev,
ABS_MT_TOUCH_MAJOR, max(wx, wy));
Expand Down Expand Up @@ -4170,6 +4185,10 @@ static void synaptics_rmi4_set_params(struct synaptics_rmi4_data *rmi4_data)
input_set_abs_params(rmi4_data->input_dev,
ABS_MT_POSITION_Y, rmi4_data->snap_top,
rmi4_data->sensor_max_y-rmi4_data->virtual_key_height-rmi4_data->snap_bottom, 0, 0);
#ifdef REPORT_2D_Z
input_set_abs_params(rmi4_data->input_dev,
ABS_MT_PRESSURE, 0, 255, 0, 0);
#endif
#ifdef REPORT_2D_W
input_set_abs_params(rmi4_data->input_dev,
ABS_MT_TOUCH_MAJOR, 0,
Expand Down

0 comments on commit 88ce493

Please sign in to comment.