From cbb5ae48bf80d4fa46fdff5ca97e11c976ef6358 Mon Sep 17 00:00:00 2001 From: Zorro Liu Date: Mon, 9 May 2022 11:26:44 +0800 Subject: [PATCH] input: touchscreen: wacom_w9013: support tilt report Signed-off-by: Zorro Liu Change-Id: I03c51dab934f4fce1c7718884ea6a0cd96c354d9 --- drivers/input/touchscreen/wacom_w9013.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/input/touchscreen/wacom_w9013.c b/drivers/input/touchscreen/wacom_w9013.c index 04ea7ce47679..051059ce38fd 100644 --- a/drivers/input/touchscreen/wacom_w9013.c +++ b/drivers/input/touchscreen/wacom_w9013.c @@ -183,6 +183,7 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) //struct wacom_features *features = wac_i2c->features; u8 *data = wac_i2c->data; unsigned int x, y, pressure; + signed short tilt_x, tilt_y; unsigned char tsw, f1, f2, ers; int error; @@ -200,6 +201,8 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) x = le16_to_cpup((__le16 *)&data[4]); y = le16_to_cpup((__le16 *)&data[6]); pressure = le16_to_cpup((__le16 *)&data[8]); + tilt_x = le16_to_cpup((__le16 *)&data[11]); + tilt_y = le16_to_cpup((__le16 *)&data[13]); if (!wac_i2c->prox) wac_i2c->tool = (data[3] & 0x0c) ? @@ -223,6 +226,8 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) input_report_key(input, BTN_STYLUS2, f2); input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); + input_report_abs(input, ABS_TILT_X, tilt_x / 100); + input_report_abs(input, ABS_TILT_Y, tilt_y / 100); input_report_abs(input, ABS_PRESSURE, pressure); input_sync(input); @@ -403,6 +408,8 @@ static int wacom_i2c_probe(struct i2c_client *client, input_set_abs_params(input, ABS_X, 0, features.x_max, 0, 0); input_set_abs_params(input, ABS_Y, 0, features.y_max, 0, 0); input_set_abs_params(input, ABS_PRESSURE, 0, features.pressure_max, 0, 0); + input_set_abs_params(input, ABS_TILT_X, -90, 90, 0, 0); + input_set_abs_params(input, ABS_TILT_Y, -90, 90, 0, 0); input_set_drvdata(input, wac_i2c);