1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _TOUCH_OFFLOAD_H 20 #define _TOUCH_OFFLOAD_H 21 #define TOUCH_OFFLOAD_INTERFACE_MAJOR_VERSION 2 22 #define TOUCH_OFFLOAD_INTERFACE_MINOR_VERSION 0 23 #define TOUCH_OFFLOAD_MAGIC '7' 24 #define BUS_TYPE_I2C 0 25 #define BUS_TYPE_SPI 1 26 #define BUS_TYPE_I3C 2 27 #define HEATMAP_SIZE_PARTIAL 0 28 #define HEATMAP_SIZE_FULL 1 29 #define TOUCH_DATA_TYPE_COORD 0x0001 30 #define TOUCH_DATA_TYPE_RAW 0x0002 31 #define TOUCH_DATA_TYPE_FILTERED 0x0004 32 #define TOUCH_DATA_TYPE_BASELINE 0x0008 33 #define TOUCH_DATA_TYPE_STRENGTH 0x0010 34 #define TOUCH_SCAN_TYPE_MUTUAL 0x0040 35 #define TOUCH_SCAN_TYPE_SELF 0x0080 36 #define CONTEXT_CHANNEL_TYPE_DRIVER_STATUS 0x0100 37 #define CONTEXT_CHANNEL_TYPE_STYLUS_STATUS 0x0200 38 #define CONTEXT_CHANNEL_BIT_START 0x0100 39 #define CONTEXT_CHANNEL_BIT_END 0x0200 40 struct TouchOffloadCaps { 41 __u32 touch_offload_major_version; 42 __u32 touch_offload_minor_version; 43 __u8 reserved1[8]; 44 __u32 device_id; 45 __u16 display_width; 46 __u16 display_height; 47 __u16 tx_size; 48 __u16 rx_size; 49 __u8 bus_type; 50 __u32 bus_speed_hz; 51 __u8 reserved2[16]; 52 __u8 heatmap_size; 53 __u16 touch_data_types; 54 __u16 touch_scan_types; 55 __u16 context_channel_types; 56 __u8 reserved3[16]; 57 __u8 continuous_reporting; 58 __u8 noise_reporting; 59 __u8 cancel_reporting; 60 __u8 size_reporting; 61 __u8 rotation_reporting; 62 __u8 filter_grip; 63 __u8 filter_palm; 64 __u8 num_sensitivity_settings; 65 __u8 auto_reporting; 66 __u8 reserved4[32]; 67 } __attribute__((packed)); 68 struct TouchOffloadConfig { 69 __u8 continuous_reporting; 70 __u8 noise_reporting; 71 __u8 cancel_reporting; 72 __u8 filter_grip; 73 __u8 filter_palm; 74 __u8 sensitivity_setting; 75 __u8 auto_reporting; 76 __u8 reserved1[16]; 77 __u8 read_coords; 78 __u16 mutual_data_types; 79 __u16 self_data_types; 80 __u16 context_channel_types; 81 __u8 reserved2[16]; 82 } __attribute__((packed)); 83 struct TouchOffloadFrameHeader { 84 __u32 frame_size; 85 __u64 index; 86 __u64 timestamp; 87 __u8 num_channels; 88 } __attribute__((packed)); 89 struct TouchOffloadChannelHeader { 90 __u32 channel_type; 91 __u32 channel_size; 92 } __attribute__((packed)); 93 enum CoordStatus { 94 COORD_STATUS_INACTIVE = 0x00, 95 COORD_STATUS_FINGER = 0x01, 96 COORD_STATUS_EDGE = 0x02, 97 COORD_STATUS_PALM = 0x03, 98 COORD_STATUS_CANCEL = 0x04, 99 COORD_STATUS_PEN = 0x05 100 }; 101 #define MAX_COORDS 10 102 struct TouchOffloadCoord { 103 __u16 x; 104 __u16 y; 105 enum CoordStatus status; 106 __u32 major; 107 __u32 minor; 108 __u32 pressure; 109 __s16 rotation; 110 __u8 reserved1[16]; 111 } __attribute__((packed)); 112 struct TouchOffloadDataCoord { 113 struct TouchOffloadChannelHeader header; 114 struct TouchOffloadCoord coords[MAX_COORDS]; 115 __u8 reserved1[16]; 116 } __attribute__((packed)); 117 #define TOUCH_OFFLOAD_FRAME_SIZE_COORD (sizeof(struct TouchOffloadDataCoord)) 118 struct TouchOffloadData2d { 119 struct TouchOffloadChannelHeader header; 120 __u16 tx_size; 121 __u16 rx_size; 122 __u8 reserved1[16]; 123 __u8 data[1]; 124 } __attribute__((packed)); 125 #define TOUCH_OFFLOAD_DATA_SIZE_2D(rx,tx) (sizeof(__u16) * (rx) * (tx)) 126 #define TOUCH_OFFLOAD_FRAME_SIZE_2D(rx,tx) (sizeof(struct TouchOffloadData2d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_2D((rx), (tx))) 127 struct TouchOffloadData1d { 128 struct TouchOffloadChannelHeader header; 129 __u16 tx_size; 130 __u16 rx_size; 131 __u8 reserved1[16]; 132 __u8 data[1]; 133 } __attribute__((packed)); 134 #define TOUCH_OFFLOAD_DATA_SIZE_1D(rx,tx) (sizeof(__u16) * ((rx) + (tx))) 135 #define TOUCH_OFFLOAD_FRAME_SIZE_1D(rx,tx) (sizeof(struct TouchOffloadData1d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_1D((rx), (tx))) 136 struct TouchOffloadDriverStatus { 137 struct TouchOffloadChannelHeader header; 138 struct { 139 __u32 screen_state : 1; 140 __u32 display_refresh_rate : 1; 141 __u32 touch_report_rate : 1; 142 __u32 noise_state : 1; 143 __u32 water_mode : 1; 144 __u32 charger_state : 1; 145 __u32 hinge_angle : 1; 146 __u32 offload_timestamp : 1; 147 } contents; 148 __u8 reserved1[8]; 149 __u8 screen_state; 150 __u8 display_refresh_rate; 151 __u8 touch_report_rate; 152 __u8 noise_state; 153 __u8 water_mode; 154 __u8 charger_state; 155 __s16 hinge_angle; 156 __u64 offload_timestamp; 157 __u8 reserved2[32]; 158 } __attribute__((packed)); 159 #define TOUCH_OFFLOAD_FRAME_SIZE_DRIVER_STATUS (sizeof(struct TouchOffloadDriverStatus)) 160 struct TouchOffloadStylusStatus { 161 struct TouchOffloadChannelHeader header; 162 struct { 163 __u32 coords : 1; 164 __u32 coords_timestamp : 1; 165 __u32 pen_paired : 1; 166 __u32 pen_active : 1; 167 } contents; 168 __u8 reserved1[8]; 169 struct TouchOffloadCoord coords[MAX_COORDS]; 170 __u64 coords_timestamp; 171 __u8 reserved2[16]; 172 __u8 pen_paired; 173 __u8 pen_active; 174 __u8 reserved3[16]; 175 } __attribute__((packed)); 176 #define TOUCH_OFFLOAD_FRAME_SIZE_STYLUS_STATUS (sizeof(struct TouchOffloadStylusStatus)) 177 struct TouchOffloadIocGetCaps { 178 struct TouchOffloadCaps caps; 179 __u8 reserved1[16]; 180 } __attribute__((packed)); 181 struct TouchOffloadIocConfigure { 182 struct TouchOffloadConfig config; 183 __u8 reserved1[16]; 184 } __attribute__((packed)); 185 struct TouchOffloadIocReport { 186 __u64 index; 187 __u64 timestamp; 188 __u8 num_coords; 189 __u8 reserved1[16]; 190 struct TouchOffloadCoord coords[MAX_COORDS]; 191 } __attribute__((packed)); 192 #define TOUCH_OFFLOAD_IOC_RD_GETCAPS _IOR(TOUCH_OFFLOAD_MAGIC, 0, struct TouchOffloadIocGetCaps) 193 #define TOUCH_OFFLOAD_IOC_WR_CONFIGURE _IOW(TOUCH_OFFLOAD_MAGIC, 1, struct TouchOffloadIocConfigure) 194 #define TOUCH_OFFLOAD_IOC_START _IOC(TOUCH_OFFLOAD_MAGIC, 2) 195 #define TOUCH_OFFLOAD_IOC_WR_REPORT _IOW(TOUCH_OFFLOAD_MAGIC, 3, struct TouchOffloadIocReport) 196 #define TOUCH_OFFLOAD_IOC_STOP _IOC(TOUCH_OFFLOAD_MAGIC, 4) 197 #endif 198