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