Skip to content

Commit

Permalink
Input: atmel_mxt_ts - implement T9 vector/orientation support
Browse files Browse the repository at this point in the history
The atmel touch messages contain orientation information as a byte in a
packed format which can be passed straight on to Android if the input
device configuration is correct.

This requires vector reports to be enabled in maXTouch config (zero
DISVECT bit 3 in T9 CTRL field)

Android converts the format in InputReader.cpp, search for
ORIENTATION_CALIBRATION_VECTOR.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
  • Loading branch information
ndyer committed Apr 26, 2016
1 parent ab95b5a commit a6f0ee9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message)
int y;
int area;
int amplitude;
u8 vector;

id = message[0] - data->T9_reportid_min;
status = message[1];
Expand All @@ -760,9 +761,10 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message)

area = message[5];
amplitude = message[6];
vector = message[7];

dev_dbg(dev,
"[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u\n",
"[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u vector: %02X\n",
id,
(status & MXT_T9_DETECT) ? 'D' : '.',
(status & MXT_T9_PRESS) ? 'P' : '.',
Expand All @@ -772,7 +774,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message)
(status & MXT_T9_AMP) ? 'A' : '.',
(status & MXT_T9_SUPPRESS) ? 'S' : '.',
(status & MXT_T9_UNGRIP) ? 'U' : '.',
x, y, area, amplitude);
x, y, area, amplitude, vector);

input_mt_slot(input_dev, id);

Expand All @@ -794,6 +796,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message)
input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
input_report_abs(input_dev, ABS_MT_PRESSURE, amplitude);
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area);
input_report_abs(input_dev, ABS_MT_ORIENTATION, vector);
} else {
/* Touch no longer active, close out slot */
input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0);
Expand Down Expand Up @@ -2076,8 +2079,9 @@ static int mxt_initialize_input_device(struct mxt_data *data)
0, 255, 0, 0);
}

if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 &&
data->t100_aux_vect) {
if (data->multitouch == MXT_TOUCH_MULTI_T9 ||
(data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 &&
data->t100_aux_vect)) {
input_set_abs_params(input_dev, ABS_MT_ORIENTATION,
0, 255, 0, 0);
}
Expand Down

0 comments on commit a6f0ee9

Please sign in to comment.