Input: wacom_i2c - Add touchscren properties
Connect touchscreen properties to the wacom_i2c. Signed-off-by: Alistair Francis <alistair@alistair23.me>rM2-mainline
parent
24ad97add7
commit
d389912489
|
@ -11,6 +11,7 @@
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
|
#include <linux/input/touchscreen.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
@ -33,6 +34,7 @@ struct wacom_features {
|
||||||
struct wacom_i2c {
|
struct wacom_i2c {
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
struct input_dev *input;
|
struct input_dev *input;
|
||||||
|
struct touchscreen_properties props;
|
||||||
u8 data[WACOM_QUERY_SIZE];
|
u8 data[WACOM_QUERY_SIZE];
|
||||||
bool prox;
|
bool prox;
|
||||||
int tool;
|
int tool;
|
||||||
|
@ -114,12 +116,12 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id)
|
||||||
|
|
||||||
wac_i2c->prox = data[3] & 0x20;
|
wac_i2c->prox = data[3] & 0x20;
|
||||||
|
|
||||||
|
touchscreen_report_pos(input, &wac_i2c->props, features.x_max,
|
||||||
|
features.y_max, true);
|
||||||
input_report_key(input, BTN_TOUCH, tsw || ers);
|
input_report_key(input, BTN_TOUCH, tsw || ers);
|
||||||
input_report_key(input, wac_i2c->tool, wac_i2c->prox);
|
input_report_key(input, wac_i2c->tool, wac_i2c->prox);
|
||||||
input_report_key(input, BTN_STYLUS, f1);
|
input_report_key(input, BTN_STYLUS, f1);
|
||||||
input_report_key(input, BTN_STYLUS2, f2);
|
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_PRESSURE, pressure);
|
input_report_abs(input, ABS_PRESSURE, pressure);
|
||||||
input_sync(input);
|
input_sync(input);
|
||||||
|
|
||||||
|
@ -188,6 +190,7 @@ static int wacom_i2c_probe(struct i2c_client *client,
|
||||||
__set_bit(BTN_STYLUS2, input->keybit);
|
__set_bit(BTN_STYLUS2, input->keybit);
|
||||||
__set_bit(BTN_TOUCH, input->keybit);
|
__set_bit(BTN_TOUCH, input->keybit);
|
||||||
|
|
||||||
|
touchscreen_parse_properties(input, true, &wac_i2c->props);
|
||||||
input_set_abs_params(input, ABS_X, 0, features.x_max, 0, 0);
|
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_Y, 0, features.y_max, 0, 0);
|
||||||
input_set_abs_params(input, ABS_PRESSURE,
|
input_set_abs_params(input, ABS_PRESSURE,
|
||||||
|
|
Loading…
Reference in New Issue