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_MAGIC '7' 22 #define BUS_TYPE_I2C 0 23 #define BUS_TYPE_SPI 1 24 #define BUS_TYPE_I3C 2 25 #define HEATMAP_SIZE_PARTIAL 0 26 #define HEATMAP_SIZE_FULL 1 27 #define TOUCH_DATA_TYPE_COORD 0x01 28 #define TOUCH_DATA_TYPE_RAW 0x02 29 #define TOUCH_DATA_TYPE_FILTERED 0x04 30 #define TOUCH_DATA_TYPE_BASELINE 0x08 31 #define TOUCH_DATA_TYPE_STRENGTH 0x10 32 #define TOUCH_SCAN_TYPE_MUTUAL 0x40 33 #define TOUCH_SCAN_TYPE_SELF 0x80 34 struct TouchOffloadCaps { 35 __u32 touch_offload_major_version; 36 __u32 touch_offload_minor_version; 37 __u8 reserved1[8]; 38 __u32 device_id; 39 __u16 display_width; 40 __u16 display_height; 41 __u16 tx_size; 42 __u16 rx_size; 43 __u8 bus_type; 44 __u32 bus_speed_hz; 45 __u8 reserved2[16]; 46 __u8 heatmap_size; 47 __u16 touch_data_types; 48 __u16 touch_scan_types; 49 __u8 reserved3[16]; 50 __u8 continuous_reporting; 51 __u8 noise_reporting; 52 __u8 cancel_reporting; 53 __u8 size_reporting; 54 __u8 filter_grip; 55 __u8 filter_palm; 56 __u8 num_sensitivity_settings; 57 __u8 reserved4[32]; 58 }; 59 struct TouchOffloadConfig { 60 __u8 continuous_reporting; 61 __u8 noise_reporting; 62 __u8 cancel_reporting; 63 __u8 filter_grip; 64 __u8 filter_palm; 65 __u8 sensitivity_setting; 66 __u8 reserved1[16]; 67 __u8 read_coords; 68 __u16 mutual_data_types; 69 __u16 self_data_types; 70 __u8 reserved2[16]; 71 }; 72 struct TouchOffloadFrameHeader { 73 __u32 frame_size; 74 __u64 index; 75 __u64 timestamp; 76 __u8 num_channels; 77 } __attribute__((packed)); 78 struct TouchOffloadChannelHeader { 79 __u8 channel_type; 80 __u32 channel_size; 81 } __attribute__((packed)); 82 enum CoordStatus { 83 COORD_STATUS_INACTIVE = 0x00, 84 COORD_STATUS_FINGER = 0x01, 85 COORD_STATUS_EDGE = 0x02, 86 COORD_STATUS_PALM = 0x03, 87 COORD_STATUS_CANCEL = 0x04 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 __u8 reserved1[16]; 98 } __attribute__((packed)); 99 struct TouchOffloadDataCoord { 100 struct TouchOffloadChannelHeader header; 101 struct TouchOffloadCoord coords[MAX_COORDS]; 102 __u8 reserved1[16]; 103 } __attribute__((packed)); 104 #define TOUCH_OFFLOAD_FRAME_SIZE_COORD (sizeof(struct TouchOffloadDataCoord)) 105 struct TouchOffloadData2d { 106 struct TouchOffloadChannelHeader header; 107 __u16 tx_size; 108 __u16 rx_size; 109 __u8 reserved1[16]; 110 __u8 data[1]; 111 } __attribute__((packed)); 112 #define TOUCH_OFFLOAD_DATA_SIZE_2D(rx,tx) (sizeof(__u16) * (rx) * (tx)) 113 #define TOUCH_OFFLOAD_FRAME_SIZE_2D(rx,tx) (sizeof(struct TouchOffloadData2d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_2D((rx), (tx))) 114 struct TouchOffloadData1d { 115 struct TouchOffloadChannelHeader header; 116 __u16 tx_size; 117 __u16 rx_size; 118 __u8 reserved1[16]; 119 __u8 data[1]; 120 } __attribute__((packed)); 121 #define TOUCH_OFFLOAD_DATA_SIZE_1D(rx,tx) (sizeof(__u16) * ((rx) + (tx))) 122 #define TOUCH_OFFLOAD_FRAME_SIZE_1D(rx,tx) (sizeof(struct TouchOffloadData1d) - 1 + TOUCH_OFFLOAD_DATA_SIZE_1D((rx), (tx))) 123 struct TouchOffloadIocGetCaps { 124 struct TouchOffloadCaps caps; 125 __u8 reserved1[16]; 126 }; 127 struct TouchOffloadIocConfigure { 128 struct TouchOffloadConfig config; 129 __u8 reserved1[16]; 130 }; 131 struct TouchOffloadIocReport { 132 __u64 index; 133 __u64 timestamp; 134 __u8 num_coords; 135 __u8 reserved1[16]; 136 struct TouchOffloadCoord coords[MAX_COORDS]; 137 }; 138 #define TOUCH_OFFLOAD_IOC_RD_GETCAPS _IOR(TOUCH_OFFLOAD_MAGIC, 0, struct TouchOffloadIocGetCaps) 139 #define TOUCH_OFFLOAD_IOC_WR_CONFIGURE _IOW(TOUCH_OFFLOAD_MAGIC, 1, struct TouchOffloadIocConfigure) 140 #define TOUCH_OFFLOAD_IOC_START _IOC(TOUCH_OFFLOAD_MAGIC, 2) 141 #define TOUCH_OFFLOAD_IOC_WR_REPORT _IOW(TOUCH_OFFLOAD_MAGIC, 3, struct TouchOffloadIocReport) 142 #define TOUCH_OFFLOAD_IOC_STOP _IOC(TOUCH_OFFLOAD_MAGIC, 4) 143 #endif 144