Lines Matching refs:coord
102 static void parse_pen_data(u8 *data, struct w8001_coord *coord) in parse_pen_data() argument
104 memset(coord, 0, sizeof(*coord)); in parse_pen_data()
106 coord->rdy = data[0] & 0x20; in parse_pen_data()
107 coord->tsw = data[0] & 0x01; in parse_pen_data()
108 coord->f1 = data[0] & 0x02; in parse_pen_data()
109 coord->f2 = data[0] & 0x04; in parse_pen_data()
111 coord->x = (data[1] & 0x7F) << 9; in parse_pen_data()
112 coord->x |= (data[2] & 0x7F) << 2; in parse_pen_data()
113 coord->x |= (data[6] & 0x60) >> 5; in parse_pen_data()
115 coord->y = (data[3] & 0x7F) << 9; in parse_pen_data()
116 coord->y |= (data[4] & 0x7F) << 2; in parse_pen_data()
117 coord->y |= (data[6] & 0x18) >> 3; in parse_pen_data()
119 coord->pen_pressure = data[5] & 0x7F; in parse_pen_data()
120 coord->pen_pressure |= (data[6] & 0x07) << 7 ; in parse_pen_data()
122 coord->tilt_x = data[7] & 0x7F; in parse_pen_data()
123 coord->tilt_y = data[8] & 0x7F; in parse_pen_data()
126 static void parse_single_touch(u8 *data, struct w8001_coord *coord) in parse_single_touch() argument
128 coord->x = (data[1] << 7) | data[2]; in parse_single_touch()
129 coord->y = (data[3] << 7) | data[4]; in parse_single_touch()
130 coord->tsw = data[0] & 0x01; in parse_single_touch()
209 static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord) in report_pen_events() argument
225 if (!coord->f2) { in report_pen_events()
243 w8001->type = coord->f2 ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in report_pen_events()
247 input_report_key(dev, BTN_STYLUS2, coord->f2); in report_pen_events()
251 input_report_abs(dev, ABS_X, coord->x); in report_pen_events()
252 input_report_abs(dev, ABS_Y, coord->y); in report_pen_events()
253 input_report_abs(dev, ABS_PRESSURE, coord->pen_pressure); in report_pen_events()
254 input_report_key(dev, BTN_TOUCH, coord->tsw); in report_pen_events()
255 input_report_key(dev, BTN_STYLUS, coord->f1); in report_pen_events()
256 input_report_key(dev, w8001->type, coord->rdy); in report_pen_events()
259 if (!coord->rdy) in report_pen_events()
263 static void report_single_touch(struct w8001 *w8001, struct w8001_coord *coord) in report_single_touch() argument
266 unsigned int x = coord->x; in report_single_touch()
267 unsigned int y = coord->y; in report_single_touch()
274 input_report_key(dev, BTN_TOUCH, coord->tsw); in report_single_touch()
275 input_report_key(dev, BTN_TOOL_FINGER, coord->tsw); in report_single_touch()
279 w8001->type = coord->tsw ? BTN_TOOL_FINGER : KEY_RESERVED; in report_single_touch()
286 struct w8001_coord coord; in w8001_interrupt() local
308 parse_single_touch(w8001->data, &coord); in w8001_interrupt()
309 report_single_touch(w8001, &coord); in w8001_interrupt()
325 parse_pen_data(w8001->data, &coord); in w8001_interrupt()
326 report_pen_events(w8001, &coord); in w8001_interrupt()
387 struct w8001_coord coord; in w8001_setup() local
411 parse_pen_data(w8001->response, &coord); in w8001_setup()
412 w8001->max_pen_x = coord.x; in w8001_setup()
413 w8001->max_pen_y = coord.y; in w8001_setup()
415 input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); in w8001_setup()
416 input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); in w8001_setup()
419 input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); in w8001_setup()
420 if (coord.tilt_x && coord.tilt_y) { in w8001_setup()
421 input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); in w8001_setup()
422 input_set_abs_params(dev, ABS_TILT_Y, 0, coord.tilt_y, 0, 0); in w8001_setup()