Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2011-2016 Synaptics Incorporated
4 * Copyright (c) 2011 Unixphere
5 */
6
7#ifndef _RMI_2D_SENSOR_H
8#define _RMI_2D_SENSOR_H
9
10enum rmi_2d_sensor_object_type {
11 RMI_2D_OBJECT_NONE,
12 RMI_2D_OBJECT_FINGER,
13 RMI_2D_OBJECT_STYLUS,
14 RMI_2D_OBJECT_PALM,
15 RMI_2D_OBJECT_UNCLASSIFIED,
16};
17
18struct rmi_2d_sensor_abs_object {
19 enum rmi_2d_sensor_object_type type;
20 int mt_tool;
21 u16 x;
22 u16 y;
23 u8 z;
24 u8 wx;
25 u8 wy;
26};
27
28/**
29 * @axis_align - controls parameters that are useful in system prototyping
30 * and bring up.
31 * @max_x - The maximum X coordinate that will be reported by this sensor.
32 * @max_y - The maximum Y coordinate that will be reported by this sensor.
33 * @nbr_fingers - How many fingers can this sensor report?
34 * @data_pkt - buffer for data reported by this sensor.
35 * @pkt_size - number of bytes in that buffer.
36 * @attn_size - Size of the HID attention report (only contains abs data).
37 * position when two fingers are on the device. When this is true, we
38 * assume we have one of those sensors and report events appropriately.
39 * @sensor_type - indicates whether we're touchscreen or touchpad.
40 * @input - input device for absolute pointing stream
41 * @input_phys - buffer for the absolute phys name for this sensor.
42 */
43struct rmi_2d_sensor {
44 struct rmi_2d_axis_alignment axis_align;
45 struct input_mt_pos *tracking_pos;
46 int *tracking_slots;
47 bool kernel_tracking;
48 struct rmi_2d_sensor_abs_object *objs;
49 int dmax;
50 u16 min_x;
51 u16 max_x;
52 u16 min_y;
53 u16 max_y;
54 u8 nbr_fingers;
55 u8 *data_pkt;
56 int pkt_size;
57 int attn_size;
58 bool topbuttonpad;
59 enum rmi_sensor_type sensor_type;
60 struct input_dev *input;
61 struct rmi_function *fn;
62 char input_phys[32];
63 u8 report_abs;
64 u8 report_rel;
65 u8 x_mm;
66 u8 y_mm;
67 enum rmi_reg_state dribble;
68 enum rmi_reg_state palm_detect;
69};
70
71int rmi_2d_sensor_of_probe(struct device *dev,
72 struct rmi_2d_sensor_platform_data *pdata);
73
74void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor,
75 struct rmi_2d_sensor_abs_object *obj,
76 int slot);
77
78void rmi_2d_sensor_abs_report(struct rmi_2d_sensor *sensor,
79 struct rmi_2d_sensor_abs_object *obj,
80 int slot);
81
82void rmi_2d_sensor_rel_report(struct rmi_2d_sensor *sensor, int x, int y);
83
84int rmi_2d_sensor_configure_input(struct rmi_function *fn,
85 struct rmi_2d_sensor *sensor);
86#endif /* _RMI_2D_SENSOR_H */
1/*
2 * Copyright (c) 2011-2016 Synaptics Incorporated
3 * Copyright (c) 2011 Unixphere
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _RMI_2D_SENSOR_H
11#define _RMI_2D_SENSOR_H
12
13enum rmi_2d_sensor_object_type {
14 RMI_2D_OBJECT_NONE,
15 RMI_2D_OBJECT_FINGER,
16 RMI_2D_OBJECT_STYLUS,
17 RMI_2D_OBJECT_PALM,
18 RMI_2D_OBJECT_UNCLASSIFIED,
19};
20
21struct rmi_2d_sensor_abs_object {
22 enum rmi_2d_sensor_object_type type;
23 int mt_tool;
24 u16 x;
25 u16 y;
26 u8 z;
27 u8 wx;
28 u8 wy;
29};
30
31/**
32 * @axis_align - controls parameters that are useful in system prototyping
33 * and bring up.
34 * @max_x - The maximum X coordinate that will be reported by this sensor.
35 * @max_y - The maximum Y coordinate that will be reported by this sensor.
36 * @nbr_fingers - How many fingers can this sensor report?
37 * @data_pkt - buffer for data reported by this sensor.
38 * @pkt_size - number of bytes in that buffer.
39 * @attn_size - Size of the HID attention report (only contains abs data).
40 * position when two fingers are on the device. When this is true, we
41 * assume we have one of those sensors and report events appropriately.
42 * @sensor_type - indicates whether we're touchscreen or touchpad.
43 * @input - input device for absolute pointing stream
44 * @input_phys - buffer for the absolute phys name for this sensor.
45 */
46struct rmi_2d_sensor {
47 struct rmi_2d_axis_alignment axis_align;
48 struct input_mt_pos *tracking_pos;
49 int *tracking_slots;
50 bool kernel_tracking;
51 struct rmi_2d_sensor_abs_object *objs;
52 int dmax;
53 u16 min_x;
54 u16 max_x;
55 u16 min_y;
56 u16 max_y;
57 u8 nbr_fingers;
58 u8 *data_pkt;
59 int pkt_size;
60 int attn_size;
61 bool topbuttonpad;
62 enum rmi_sensor_type sensor_type;
63 struct input_dev *input;
64 struct rmi_function *fn;
65 char input_phys[32];
66 u8 report_abs;
67 u8 report_rel;
68 u8 x_mm;
69 u8 y_mm;
70};
71
72int rmi_2d_sensor_of_probe(struct device *dev,
73 struct rmi_2d_sensor_platform_data *pdata);
74
75void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor,
76 struct rmi_2d_sensor_abs_object *obj,
77 int slot);
78
79void rmi_2d_sensor_abs_report(struct rmi_2d_sensor *sensor,
80 struct rmi_2d_sensor_abs_object *obj,
81 int slot);
82
83void rmi_2d_sensor_rel_report(struct rmi_2d_sensor *sensor, int x, int y);
84
85int rmi_2d_sensor_configure_input(struct rmi_function *fn,
86 struct rmi_2d_sensor *sensor);
87#endif /* _RMI_2D_SENSOR_H */