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 0 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 __u16 display_width; 34 __u16 display_height; 35 __u16 tx_size; 36 __u16 rx_size; 37 __u8 bus_type; 38 __u32 bus_speed_hz; 39 __u8 reserved2[16]; 40 __u8 heatmap_size; 41 __u16 touch_data_types; 42 __u16 touch_scan_types; 43 __u16 context_channel_types; 44 __u8 reserved3[16]; 45 __u8 continuous_reporting; 46 __u8 noise_reporting; 47 __u8 cancel_reporting; 48 __u8 size_reporting; 49 __u8 rotation_reporting; 50 __u8 filter_grip; 51 __u8 filter_palm; 52 __u8 num_sensitivity_settings; 53 __u8 auto_reporting; 54 __u8 reserved4[32]; 55 } __attribute__((packed)); 56 struct TouchOffloadConfig { 57 __u8 continuous_reporting; 58 __u8 noise_reporting; 59 __u8 cancel_reporting; 60 __u8 filter_grip; 61 __u8 filter_palm; 62 __u8 sensitivity_setting; 63 __u8 auto_reporting; 64 __u8 reserved1[16]; 65 __u8 read_coords; 66 __u16 mutual_data_types; 67 __u16 self_data_types; 68 __u16 context_channel_types; 69 __u8 reserved2[16]; 70 } __attribute__((packed)); 71 struct TouchOffloadFrameHeader { 72 __u32 frame_size; 73 __u64 index; 74 __u64 timestamp; 75 __u8 num_channels; 76 } __attribute__((packed)); 77 struct TouchOffloadChannelHeader { 78 __u32 channel_type; 79 __u32 channel_size; 80 } __attribute__((packed)); 81 enum CoordStatus { 82 COORD_STATUS_INACTIVE = 0x00, 83 COORD_STATUS_FINGER = 0x01, 84 COORD_STATUS_EDGE = 0x02, 85 COORD_STATUS_PALM = 0x03, 86 COORD_STATUS_CANCEL = 0x04, 87 COORD_STATUS_PEN = 0x05 88 }; 89 #define MAX_COORDS 10 90 struct TouchOffloadCoord { 91 __u16 x; 92 __u16 y; 93 enum CoordStatus status; 94 __u32 major; 95 __u32 minor; 96 __u32 pressure; 97 __s16 rotation; 98 __u8 reserved1[16]; 99 } __attribute__((packed)); 100 struct TouchOffloadDataCoord { 101 struct TouchOffloadChannelHeader header; 102 struct TouchOffloadCoord coords[MAX_COORDS]; 103 __u8 reserved1[16]; 104 } __attribute__((packed)); 105 #define TOUCH_OFFLOAD_FRAME_SIZE_COORD (sizeof(struct TouchOffloadDataCoord)) 106 struct TouchOffloadData2d { 107 struct TouchOffloadChannelHeader header; 108 __u16 tx_size; 109 __u16 rx_size; 110 __u8 reserved1[16]; 111 __u8 data[1]; 112 } __attribute__((packed)); 113 #define TOUCH_OFFLOAD_DATA_SIZE_2D(rx,tx) (sizeof(__u16) * (rx) * (tx)) 114 #define TOUCH_OFFLOAD_FRAME_SIZE_2D(rx,tx) (sizeof(struct TouchOffloadData2d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_2D((rx), (tx))) 115 struct TouchOffloadData1d { 116 struct TouchOffloadChannelHeader header; 117 __u16 tx_size; 118 __u16 rx_size; 119 __u8 reserved1[16]; 120 __u8 data[1]; 121 } __attribute__((packed)); 122 #define TOUCH_OFFLOAD_DATA_SIZE_1D(rx,tx) (sizeof(__u16) * ((rx) + (tx))) 123 #define TOUCH_OFFLOAD_FRAME_SIZE_1D(rx,tx) (sizeof(struct TouchOffloadData1d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_1D((rx), (tx))) 124 struct TouchOffloadDriverStatus { 125 struct TouchOffloadChannelHeader header; 126 struct { 127 __u32 screen_state : 1; 128 __u32 display_refresh_rate : 1; 129 __u32 touch_report_rate : 1; 130 __u32 noise_state : 1; 131 __u32 water_mode : 1; 132 __u32 charger_state : 1; 133 __u32 hinge_angle : 1; 134 __u32 offload_timestamp : 1; 135 } contents; 136 __u8 reserved1[8]; 137 __u8 screen_state; 138 __u8 display_refresh_rate; 139 __u8 touch_report_rate; 140 __u8 noise_state; 141 __u8 water_mode; 142 __u8 charger_state; 143 __s16 hinge_angle; 144 __u64 offload_timestamp; 145 __u8 reserved2[32]; 146 } __attribute__((packed)); 147 #define TOUCH_OFFLOAD_FRAME_SIZE_DRIVER_STATUS (sizeof(struct TouchOffloadDriverStatus)) 148 struct TouchOffloadStylusStatus { 149 struct TouchOffloadChannelHeader header; 150 struct { 151 __u32 coords : 1; 152 __u32 coords_timestamp : 1; 153 __u32 pen_paired : 1; 154 __u32 pen_active : 1; 155 } contents; 156 __u8 reserved1[8]; 157 struct TouchOffloadCoord coords[MAX_COORDS]; 158 __u64 coords_timestamp; 159 __u8 reserved2[16]; 160 __u8 pen_paired; 161 __u8 pen_active; 162 __u8 reserved3[16]; 163 } __attribute__((packed)); 164 #define TOUCH_OFFLOAD_FRAME_SIZE_STYLUS_STATUS (sizeof(struct TouchOffloadStylusStatus)) 165 struct TouchOffloadIocGetCaps { 166 struct TouchOffloadCaps caps; 167 __u8 reserved1[16]; 168 } __attribute__((packed)); 169 struct TouchOffloadIocConfigure { 170 struct TouchOffloadConfig config; 171 __u8 reserved1[16]; 172 } __attribute__((packed)); 173 struct TouchOffloadIocReport { 174 __u64 index; 175 __u64 timestamp; 176 __u8 num_coords; 177 __u8 reserved1[16]; 178 struct TouchOffloadCoord coords[MAX_COORDS]; 179 } __attribute__((packed)); 180 #define TOUCH_OFFLOAD_IOC_RD_GETCAPS _IOR(TOUCH_OFFLOAD_MAGIC, 0, struct TouchOffloadIocGetCaps) 181 #define TOUCH_OFFLOAD_IOC_WR_CONFIGURE _IOW(TOUCH_OFFLOAD_MAGIC, 1, struct TouchOffloadIocConfigure) 182 #define TOUCH_OFFLOAD_IOC_START _IOC(TOUCH_OFFLOAD_MAGIC, 2) 183 #define TOUCH_OFFLOAD_IOC_WR_REPORT _IOW(TOUCH_OFFLOAD_MAGIC, 3, struct TouchOffloadIocReport) 184 #define TOUCH_OFFLOAD_IOC_STOP _IOC(TOUCH_OFFLOAD_MAGIC, 4) 185 #endif 186