1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _TOUCH_OFFLOAD_H 8 #define _TOUCH_OFFLOAD_H 9 #define TOUCH_OFFLOAD_INTERFACE_MAJOR_VERSION 2 10 #define TOUCH_OFFLOAD_INTERFACE_MINOR_VERSION 1 11 #define TOUCH_OFFLOAD_MAGIC '7' 12 #define BUS_TYPE_I2C 0 13 #define BUS_TYPE_SPI 1 14 #define BUS_TYPE_I3C 2 15 #define HEATMAP_SIZE_PARTIAL 0 16 #define HEATMAP_SIZE_FULL 1 17 #define TOUCH_DATA_TYPE_COORD 0x0001 18 #define TOUCH_DATA_TYPE_RAW 0x0002 19 #define TOUCH_DATA_TYPE_FILTERED 0x0004 20 #define TOUCH_DATA_TYPE_BASELINE 0x0008 21 #define TOUCH_DATA_TYPE_STRENGTH 0x0010 22 #define TOUCH_SCAN_TYPE_MUTUAL 0x0040 23 #define TOUCH_SCAN_TYPE_SELF 0x0080 24 #define CONTEXT_CHANNEL_TYPE_DRIVER_STATUS 0x0100 25 #define CONTEXT_CHANNEL_TYPE_STYLUS_STATUS 0x0200 26 #define CONTEXT_CHANNEL_BIT_START 0x0100 27 #define CONTEXT_CHANNEL_BIT_END 0x0200 28 struct TouchOffloadCaps { 29 __u32 touch_offload_major_version; 30 __u32 touch_offload_minor_version; 31 __u8 reserved1[8]; 32 __u32 device_id; 33 union { 34 __u16 display_width; 35 __u16 touch_width; 36 }; 37 union { 38 __u16 display_height; 39 __u16 touch_height; 40 }; 41 union { 42 __u16 tx_size; 43 __u16 heatmap_width; 44 }; 45 union { 46 __u16 rx_size; 47 __u16 heatmap_height; 48 }; 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 coord_filter; 67 __u8 reserved4[31]; 68 } __attribute__((packed)); 69 struct TouchOffloadConfig { 70 __u8 continuous_reporting; 71 __u8 noise_reporting; 72 __u8 cancel_reporting; 73 __u8 filter_grip; 74 __u8 filter_palm; 75 __u8 sensitivity_setting; 76 __u8 auto_reporting; 77 __u8 coord_filter; 78 __u8 reserved1[15]; 79 __u8 read_coords; 80 __u16 mutual_data_types; 81 __u16 self_data_types; 82 __u16 context_channel_types; 83 __u8 reserved2[16]; 84 } __attribute__((packed)); 85 struct TouchOffloadFrameHeader { 86 __u32 frame_size; 87 __u64 index; 88 __u64 timestamp; 89 __u8 num_channels; 90 } __attribute__((packed)); 91 struct TouchOffloadChannelHeader { 92 __u32 channel_type; 93 __u32 channel_size; 94 } __attribute__((packed)); 95 enum CoordStatus { 96 COORD_STATUS_INACTIVE = 0x00, 97 COORD_STATUS_FINGER = 0x01, 98 COORD_STATUS_EDGE = 0x02, 99 COORD_STATUS_PALM = 0x03, 100 COORD_STATUS_CANCEL = 0x04, 101 COORD_STATUS_PEN = 0x05 102 }; 103 #define MAX_COORDS 10 104 struct TouchOffloadCoord { 105 __u16 x; 106 __u16 y; 107 enum CoordStatus status; 108 __u32 major; 109 __u32 minor; 110 __u32 pressure; 111 __s16 rotation; 112 __u8 reserved1[16]; 113 } __attribute__((packed)); 114 struct TouchOffloadDataCoord { 115 struct TouchOffloadChannelHeader header; 116 struct TouchOffloadCoord coords[MAX_COORDS]; 117 __u8 reserved1[16]; 118 } __attribute__((packed)); 119 #define TOUCH_OFFLOAD_FRAME_SIZE_COORD (sizeof(struct TouchOffloadDataCoord)) 120 struct TouchOffloadData2d { 121 struct TouchOffloadChannelHeader header; 122 union { 123 __u16 tx_size; 124 __u16 heatmap_width; 125 }; 126 union { 127 __u16 rx_size; 128 __u16 heatmap_height; 129 }; 130 __u8 reserved1[16]; 131 __u8 data[1]; 132 } __attribute__((packed)); 133 #define TOUCH_OFFLOAD_DATA_SIZE_2D(heatmap_height,heatmap_width) (sizeof(__u16) * (heatmap_height) * (heatmap_width)) 134 #define TOUCH_OFFLOAD_FRAME_SIZE_2D(heatmap_height,heatmap_width) (sizeof(struct TouchOffloadData2d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_2D((heatmap_height), (heatmap_width))) 135 struct TouchOffloadData1d { 136 struct TouchOffloadChannelHeader header; 137 union { 138 __u16 tx_size; 139 __u16 heatmap_width; 140 }; 141 union { 142 __u16 rx_size; 143 __u16 heatmap_height; 144 }; 145 __u8 reserved1[16]; 146 __u8 data[1]; 147 } __attribute__((packed)); 148 #define TOUCH_OFFLOAD_DATA_SIZE_1D(heatmap_height,heatmap_width) (sizeof(__u16) * ((heatmap_height) + (heatmap_width))) 149 #define TOUCH_OFFLOAD_FRAME_SIZE_1D(heatmap_height,heatmap_width) (sizeof(struct TouchOffloadData1d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_1D((heatmap_height), (heatmap_width))) 150 struct TouchOffloadDriverStatus { 151 struct TouchOffloadChannelHeader header; 152 struct { 153 __u32 screen_state : 1; 154 __u32 display_refresh_rate : 1; 155 __u32 touch_report_rate : 1; 156 __u32 noise_state : 1; 157 __u32 water_mode : 1; 158 __u32 charger_state : 1; 159 __u32 hinge_angle : 1; 160 __u32 offload_timestamp : 1; 161 } contents; 162 __u8 reserved1[8]; 163 __u8 screen_state; 164 __u8 display_refresh_rate; 165 __u8 touch_report_rate; 166 __u8 noise_state; 167 __u8 water_mode; 168 __u8 charger_state; 169 __s16 hinge_angle; 170 __u64 offload_timestamp; 171 __u8 reserved2[32]; 172 } __attribute__((packed)); 173 #define TOUCH_OFFLOAD_FRAME_SIZE_DRIVER_STATUS (sizeof(struct TouchOffloadDriverStatus)) 174 struct TouchOffloadStylusStatus { 175 struct TouchOffloadChannelHeader header; 176 struct { 177 __u32 coords : 1; 178 __u32 coords_timestamp : 1; 179 __u32 pen_paired : 1; 180 __u32 pen_active : 1; 181 } contents; 182 __u8 reserved1[8]; 183 struct TouchOffloadCoord coords[MAX_COORDS]; 184 __u64 coords_timestamp; 185 __u8 reserved2[16]; 186 __u8 pen_paired; 187 __u8 pen_active; 188 __u8 reserved3[16]; 189 } __attribute__((packed)); 190 #define TOUCH_OFFLOAD_FRAME_SIZE_STYLUS_STATUS (sizeof(struct TouchOffloadStylusStatus)) 191 struct TouchOffloadIocGetCaps { 192 struct TouchOffloadCaps caps; 193 __u8 reserved1[16]; 194 } __attribute__((packed)); 195 struct TouchOffloadIocConfigure { 196 struct TouchOffloadConfig config; 197 __u8 reserved1[16]; 198 } __attribute__((packed)); 199 struct TouchOffloadIocReport { 200 __u64 index; 201 __u64 timestamp; 202 __u8 num_coords; 203 __u8 reserved1[16]; 204 struct TouchOffloadCoord coords[MAX_COORDS]; 205 } __attribute__((packed)); 206 #define TOUCH_OFFLOAD_IOC_RD_GETCAPS _IOR(TOUCH_OFFLOAD_MAGIC, 0, struct TouchOffloadIocGetCaps) 207 #define TOUCH_OFFLOAD_IOC_WR_CONFIGURE _IOW(TOUCH_OFFLOAD_MAGIC, 1, struct TouchOffloadIocConfigure) 208 #define TOUCH_OFFLOAD_IOC_START _IOC(TOUCH_OFFLOAD_MAGIC, 2) 209 #define TOUCH_OFFLOAD_IOC_WR_REPORT _IOW(TOUCH_OFFLOAD_MAGIC, 3, struct TouchOffloadIocReport) 210 #define TOUCH_OFFLOAD_IOC_STOP _IOC(TOUCH_OFFLOAD_MAGIC, 4) 211 #endif 212