|
| 1 | +/* |
| 2 | + * Copyright (c) 2023 Framework Computer |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | +#ifndef __CROS_EC_TOUCHPAD_DESCRIPTOR_H |
| 7 | +#define __CROS_EC_TOUCHPAD_DESCRIPTOR_H |
| 8 | + |
| 9 | +#include "hid_device.h" |
| 10 | + |
| 11 | +/* This exactly mimics the touchpad when it is not physically connected */ |
| 12 | +static const uint8_t touchpad_report_desc[] = { |
| 13 | + 0x05, 0x01, /* USAGE_PAGE () */ |
| 14 | + 0x09, 0x02, |
| 15 | + 0xA1, 0x01, |
| 16 | + 0x85, 0x01, |
| 17 | + 0x05, 0x01, |
| 18 | + 0x09, 0x01, |
| 19 | + 0xA1, 0x00, |
| 20 | + 0x05, 0x09, |
| 21 | + 0x19, 0x01, |
| 22 | + 0x29, 0x02, |
| 23 | + 0x15, 0x00, |
| 24 | + 0x25, 0x01, |
| 25 | + 0x75, 0x01, |
| 26 | + 0x95, 0x02, |
| 27 | + 0x81, 0x02, |
| 28 | + 0x95, 0x06, |
| 29 | + 0x81, 0x03, |
| 30 | + 0x05, 0x01, |
| 31 | + 0x09, 0x30, |
| 32 | + 0x09, 0x31, |
| 33 | + 0x09, 0x38, |
| 34 | + 0x15, 0x81, |
| 35 | + 0x25, 0x7F, |
| 36 | + 0x75, 0x08, |
| 37 | + 0x95, 0x03, |
| 38 | + 0x81, 0x26, |
| 39 | + 0x05, 0x0C, |
| 40 | + 0x0A, 0x38, |
| 41 | + 0x02, 0x95, |
| 42 | + 0x01, 0x81, |
| 43 | + 0x06, 0x75, |
| 44 | + 0x08, 0x95, |
| 45 | + 0x03, 0x81, |
| 46 | + 0x03, 0xC0, |
| 47 | + 0xC0, 0x05, |
| 48 | + 0x0D, 0x09, |
| 49 | + 0x05, 0xA1, |
| 50 | + 0x01, 0x85, |
| 51 | + 0x04, 0x05, |
| 52 | + 0x09, 0x09, |
| 53 | + 0x01, 0x15, |
| 54 | + 0x00, 0x25, |
| 55 | + 0x01, 0x75, |
| 56 | + 0x01, 0x95, |
| 57 | + 0x01, 0x81, |
| 58 | + 0x02, 0x95, |
| 59 | + 0x02, 0x81, |
| 60 | + 0x03, 0x06, |
| 61 | + 0x01, 0xFF, |
| 62 | + 0x09, 0x01, |
| 63 | + 0x95, 0x01, |
| 64 | + 0x81, 0x02, |
| 65 | + 0x05, 0x0D, |
| 66 | + 0x09, 0x54, |
| 67 | + 0x25, 0x05, |
| 68 | + 0x75, 0x04, |
| 69 | + 0x95, 0x01, |
| 70 | + 0x81, 0x02, |
| 71 | + 0x09, 0x56, |
| 72 | + 0x55, 0x0C, |
| 73 | + 0x66, 0x01, |
| 74 | + 0x10, 0x47, |
| 75 | + 0xFF, 0xFF, |
| 76 | + 0x00, 0x00, |
| 77 | + 0x27, 0xFF, |
| 78 | + 0xFF, 0x00, |
| 79 | + 0x00, 0x75, |
| 80 | + 0x10, 0x95, |
| 81 | + 0x01, 0x81, |
| 82 | + 0x02, 0x05, |
| 83 | + 0x0D, 0x09, |
| 84 | + 0x22, 0xA1, |
| 85 | + 0x02, 0x09, |
| 86 | + 0x47, 0x09, |
| 87 | + 0x42, 0x15, |
| 88 | + 0x00, 0x25, |
| 89 | + 0x01, 0x75, |
| 90 | + 0x01, 0x95, |
| 91 | + 0x02, 0x81, |
| 92 | + 0x02, 0x95, |
| 93 | + 0x02, 0x81, |
| 94 | + 0x03, 0x09, |
| 95 | + 0x51, 0x25, |
| 96 | + 0x0A, 0x75, |
| 97 | + 0x04, 0x95, |
| 98 | + 0x01, 0x81, |
| 99 | + 0x02, 0x05, |
| 100 | + 0x01, 0x09, |
| 101 | + 0x30, 0x35, |
| 102 | + 0x00, 0x46, |
| 103 | + 0xC4, 0x04, |
| 104 | + 0x26, 0x01, |
| 105 | + 0x0F, 0x55, |
| 106 | + 0x0E, 0x65, |
| 107 | + 0x11, 0x75, |
| 108 | + 0x10, 0x95, |
| 109 | + 0x01, 0x81, |
| 110 | + 0x02, 0x09, |
| 111 | + 0x31, 0x46, |
| 112 | + 0xF8, 0x02, |
| 113 | + 0x26, 0x58, |
| 114 | + 0x09, 0x81, |
| 115 | + 0x02, 0xC0, |
| 116 | + 0x05, 0x0D, |
| 117 | + 0x09, 0x22, |
| 118 | + 0xA1, 0x02, |
| 119 | + 0x09, 0x47, |
| 120 | + 0x09, 0x42, |
| 121 | + 0x15, 0x00, |
| 122 | + 0x25, 0x01, |
| 123 | + 0x75, 0x01, |
| 124 | + 0x95, 0x02, |
| 125 | + 0x81, 0x02, |
| 126 | + 0x95, 0x02, |
| 127 | + 0x81, 0x03, |
| 128 | + 0x09, 0x51, |
| 129 | + 0x25, 0x0A, |
| 130 | + 0x75, 0x04, |
| 131 | + 0x95, 0x01, |
| 132 | + 0x81, 0x02, |
| 133 | + 0x05, 0x01, |
| 134 | + 0x09, 0x30, |
| 135 | + 0x35, 0x00, |
| 136 | + 0x46, 0xC4, |
| 137 | + 0x04, 0x26, |
| 138 | + 0x01, 0x0F, |
| 139 | + 0x55, 0x0E, |
| 140 | + 0x65, 0x11, |
| 141 | + 0x75, 0x10, |
| 142 | + 0x95, 0x01, |
| 143 | + 0x81, 0x02, |
| 144 | + 0x09, 0x31, |
| 145 | + 0x46, 0xF8, |
| 146 | + 0x02, 0x26, |
| 147 | + 0x58, 0x09, |
| 148 | + 0x81, 0x02, |
| 149 | + 0xC0, 0x05, |
| 150 | + 0x0D, 0x09, |
| 151 | + 0x22, 0xA1, |
| 152 | + 0x02, 0x09, |
| 153 | + 0x47, 0x09, |
| 154 | + 0x42, 0x15, |
| 155 | + 0x00, 0x25, |
| 156 | + 0x01, 0x75, |
| 157 | + 0x01, 0x95, |
| 158 | + 0x02, 0x81, |
| 159 | + 0x02, 0x95, |
| 160 | + 0x02, 0x81, |
| 161 | + 0x03, 0x09, |
| 162 | + 0x51, 0x25, |
| 163 | + 0x0A, 0x75, |
| 164 | + 0x04, 0x95, |
| 165 | + 0x01, 0x81, |
| 166 | + 0x02, 0x05, |
| 167 | + 0x01, 0x09, |
| 168 | + 0x30, 0x35, |
| 169 | + 0x00, 0x46, |
| 170 | + 0xC4, 0x04, |
| 171 | + 0x26, 0x01, |
| 172 | + 0x0F, 0x55, |
| 173 | + 0x0E, 0x65, |
| 174 | + 0x11, 0x75, |
| 175 | + 0x10, 0x95, |
| 176 | + 0x01, 0x81, |
| 177 | + 0x02, 0x09, |
| 178 | + 0x31, 0x46, |
| 179 | + 0xF8, 0x02, |
| 180 | + 0x26, 0x58, |
| 181 | + 0x09, 0x81, |
| 182 | + 0x02, 0xC0, |
| 183 | + 0x05, 0x0D, |
| 184 | + 0x09, 0x22, |
| 185 | + 0xA1, 0x02, |
| 186 | + 0x09, 0x47, |
| 187 | + 0x09, 0x42, |
| 188 | + 0x15, 0x00, |
| 189 | + 0x25, 0x01, |
| 190 | + 0x75, 0x01, |
| 191 | + 0x95, 0x02, |
| 192 | + 0x81, 0x02, |
| 193 | + 0x95, 0x02, |
| 194 | + 0x81, 0x03, |
| 195 | + 0x09, 0x51, |
| 196 | + 0x25, 0x0A, |
| 197 | + 0x75, 0x04, |
| 198 | + 0x95, 0x01, |
| 199 | + 0x81, 0x02, |
| 200 | + 0x05, 0x01, |
| 201 | + 0x09, 0x30, |
| 202 | + 0x35, 0x00, |
| 203 | + 0x46, 0xC4, |
| 204 | + 0x04, 0x26, |
| 205 | + 0x01, 0x0F, |
| 206 | + 0x55, 0x0E, |
| 207 | + 0x65, 0x11, |
| 208 | + 0x75, 0x10, |
| 209 | + 0x95, 0x01, |
| 210 | + 0x81, 0x02, |
| 211 | + 0x09, 0x31, |
| 212 | + 0x46, 0xF8, |
| 213 | + 0x02, 0x26, |
| 214 | + 0x58, 0x09, |
| 215 | + 0x81, 0x02, |
| 216 | + 0xC0, 0x05, |
| 217 | + 0x0D, 0x09, |
| 218 | + 0x22, 0xA1, |
| 219 | + 0x02, 0x09, |
| 220 | + 0x47, 0x09, |
| 221 | + 0x42, 0x15, |
| 222 | + 0x00, 0x25, |
| 223 | + 0x01, 0x75, |
| 224 | + 0x01, 0x95, |
| 225 | + 0x02, 0x81, |
| 226 | + 0x02, 0x95, |
| 227 | + 0x02, 0x81, |
| 228 | + 0x03, 0x09, |
| 229 | + 0x51, 0x25, |
| 230 | + 0x0A, 0x75, |
| 231 | + 0x04, 0x95, |
| 232 | + 0x01, 0x81, |
| 233 | + 0x02, 0x05, |
| 234 | + 0x01, 0x09, |
| 235 | + 0x30, 0x35, |
| 236 | + 0x00, 0x46, |
| 237 | + 0xC4, 0x04, |
| 238 | + 0x26, 0x01, |
| 239 | + 0x0F, 0x55, |
| 240 | + 0x0E, 0x65, |
| 241 | + 0x11, 0x75, |
| 242 | + 0x10, 0x95, |
| 243 | + 0x01, 0x81, |
| 244 | + 0x02, 0x09, |
| 245 | + 0x31, 0x46, |
| 246 | + 0xF8, 0x02, |
| 247 | + 0x26, 0x58, |
| 248 | + 0x09, 0x81, |
| 249 | + 0x02, 0xC0, |
| 250 | + 0x05, 0x0D, |
| 251 | + 0x85, 0x02, |
| 252 | + 0x09, 0x55, |
| 253 | + 0x15, 0x00, |
| 254 | + 0x25, 0x05, |
| 255 | + 0x75, 0x08, |
| 256 | + 0x95, 0x01, |
| 257 | + 0xB1, 0x02, |
| 258 | + 0x05, 0x0D, |
| 259 | + 0x85, 0x06, |
| 260 | + 0x09, 0x59, |
| 261 | + 0x15, 0x00, |
| 262 | + 0x25, 0x0F, |
| 263 | + 0x75, 0x08, |
| 264 | + 0x95, 0x01, |
| 265 | + 0xB1, 0x02, |
| 266 | + 0x05, 0x0D, |
| 267 | + 0x85, 0x07, |
| 268 | + 0x09, 0x60, |
| 269 | + 0x15, 0x00, |
| 270 | + 0x25, 0x01, |
| 271 | + 0x75, 0x01, |
| 272 | + 0x95, 0x01, |
| 273 | + 0xB1, 0x02, |
| 274 | + 0x95, 0x0F, |
| 275 | + 0xB1, 0x03, |
| 276 | + 0x06, 0x00, |
| 277 | + 0xFF, 0x85, |
| 278 | + 0x0B, 0x09, |
| 279 | + 0xC5, 0x15, |
| 280 | + 0x00, 0x26, |
| 281 | + 0xFF, 0x00, |
| 282 | + 0x75, 0x08, |
| 283 | + 0x96, 0x00, |
| 284 | + 0x01, 0xB1, |
| 285 | + 0x02, 0xC0, |
| 286 | + 0x05, 0x0D, |
| 287 | + 0x09, 0x0E, |
| 288 | + 0xA1, 0x01, |
| 289 | + 0x05, 0x0D, |
| 290 | + 0x09, 0x22, |
| 291 | + 0xA1, 0x02, |
| 292 | + 0x85, 0x03, |
| 293 | + 0x09, 0x52, |
| 294 | + 0x15, 0x00, |
| 295 | + 0x25, 0x0A, |
| 296 | + 0x75, 0x08, |
| 297 | + 0x95, 0x01, |
| 298 | + 0xB1, 0x02, |
| 299 | + 0xC0, 0x05, |
| 300 | + 0x0D, 0x09, |
| 301 | + 0x22, 0xA1, |
| 302 | + 0x00, 0x85, |
| 303 | + 0x05, 0x09, |
| 304 | + 0x57, 0x09, |
| 305 | + 0x58, 0x15, |
| 306 | + 0x00, 0x25, |
| 307 | + 0x01, 0x75, |
| 308 | + 0x01, 0x95, |
| 309 | + 0x02, 0xB1, |
| 310 | + 0x02, 0x95, |
| 311 | + 0x06, 0xB1, |
| 312 | + 0x03, 0xC0, |
| 313 | + 0xC0, 0x06, |
| 314 | + 0x00, 0xFF, |
| 315 | + 0x09, 0x01, |
| 316 | + 0xA1, 0x01, |
| 317 | + 0x85, 0x42, |
| 318 | + 0x09, 0x06, |
| 319 | + 0x15, 0x00, |
| 320 | + 0x26, 0xFF, |
| 321 | + 0x00, 0x75, |
| 322 | + 0x08, 0x95, |
| 323 | + 0x03, 0xB1, |
| 324 | + 0x02, 0x85, |
| 325 | + 0x43, 0x09, |
| 326 | + 0x06, 0x15, |
| 327 | + 0x00, 0x26, |
| 328 | + 0xFF, 0x00, |
| 329 | + 0x75, 0x08, |
| 330 | + 0x95, 0x03, |
| 331 | + 0xB1, 0x02, |
| 332 | + 0x06, 0x00, |
| 333 | + 0xFF, 0x85, |
| 334 | + 0x41, 0x09, |
| 335 | + 0x05, 0x15, |
| 336 | + 0x00, 0x26, |
| 337 | + 0xFF, 0x00, |
| 338 | + 0x75, 0x08, |
| 339 | + 0x96, 0x00, |
| 340 | + 0x01, 0xB1, |
| 341 | + 0x02, |
| 342 | + 0xC0 /* END_COLLECTION */ |
| 343 | +}; |
| 344 | +#define I2C_TOUCHPAD_HID_DESC_REGISTER 0x0020 |
| 345 | +#define I2C_TOUCHPAD_HID_REPORT_DESC_REGISTER 0x0021 |
| 346 | +#define I2C_TOUCHPAD_HID_INPUT_REPORT_REGISTER 0x0024 |
| 347 | +#define I2C_TOUCHPAD_HID_OUTPUT_REPORT_REGISTER 0x0025 |
| 348 | +#define I2C_TOUCHPAD_HID_COMMAND_REGISTER 0x0022 |
| 349 | +#define I2C_TOUCHPAD_HID_DATA_REGISTER 0x0023 |
| 350 | +static struct i2c_hid_descriptor touchpad_hid_desc = { |
| 351 | + .wHIDDescLength = I2C_HID_DESC_LENGTH, |
| 352 | + .bcdVersion = I2C_HID_BCD_VERSION, |
| 353 | + .wReportDescLength = sizeof(touchpad_report_desc), |
| 354 | + .wReportDescRegister = I2C_TOUCHPAD_HID_REPORT_DESC_REGISTER, |
| 355 | + .wInputRegister = I2C_TOUCHPAD_HID_INPUT_REPORT_REGISTER, |
| 356 | + /*Note if there are multiple reports wMaxInputLength has to be max*/ |
| 357 | + .wMaxInputLength = 0x1F, |
| 358 | + .wOutputRegister = I2C_TOUCHPAD_HID_OUTPUT_REPORT_REGISTER, |
| 359 | + .wMaxOutputLength = 0, |
| 360 | + .wCommandRegister = I2C_TOUCHPAD_HID_COMMAND_REGISTER, |
| 361 | + .wDataRegister = I2C_TOUCHPAD_HID_DATA_REGISTER, |
| 362 | + .wVendorID = 0x093A, |
| 363 | + .wProductID = 0x0274, |
| 364 | + .wVersionID = 0x0905, |
| 365 | +}; |
| 366 | + |
| 367 | + |
| 368 | + |
| 369 | +#endif /* __CROS_EC_TOUCHPAD_DESCRIPTOR_H */ |
0 commit comments