GNU Linux-libre 4.19.245-gnu1
[releases.git] / drivers / platform / x86 / touchscreen_dmi.c
1 /*
2  * Touchscreen driver DMI based configuration code
3  *
4  * Copyright (c) 2017 Red Hat Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Red Hat authors:
12  * Hans de Goede <hdegoede@redhat.com>
13  */
14
15 #include <linux/acpi.h>
16 #include <linux/device.h>
17 #include <linux/dmi.h>
18 #include <linux/i2c.h>
19 #include <linux/notifier.h>
20 #include <linux/property.h>
21 #include <linux/string.h>
22
23 struct ts_dmi_data {
24         const char *acpi_name;
25         const struct property_entry *properties;
26 };
27
28 /* NOTE: Please keep all entries sorted alphabetically */
29
30 static const struct property_entry chuwi_hi8_props[] = {
31         PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
32         PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
33         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
34         PROPERTY_ENTRY_BOOL("silead,home-button"),
35         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
36         { }
37 };
38
39 static const struct ts_dmi_data chuwi_hi8_data = {
40         .acpi_name      = "MSSL0001:00",
41         .properties     = chuwi_hi8_props,
42 };
43
44 static const struct property_entry chuwi_hi8_pro_props[] = {
45         PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
46         PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
47         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
48         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
49         PROPERTY_ENTRY_BOOL("silead,home-button"),
50         { }
51 };
52
53 static const struct ts_dmi_data chuwi_hi8_pro_data = {
54         .acpi_name      = "MSSL1680:00",
55         .properties     = chuwi_hi8_pro_props,
56 };
57
58 static const struct property_entry chuwi_vi8_props[] = {
59         PROPERTY_ENTRY_U32("touchscreen-size-x", 1724),
60         PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
61         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
62         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
63         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
64         PROPERTY_ENTRY_BOOL("silead,home-button"),
65         { }
66 };
67
68 static const struct ts_dmi_data chuwi_vi8_data = {
69         .acpi_name      = "MSSL1680:00",
70         .properties     = chuwi_vi8_props,
71 };
72
73 static const struct property_entry chuwi_vi10_props[] = {
74         PROPERTY_ENTRY_U32("touchscreen-min-x", 0),
75         PROPERTY_ENTRY_U32("touchscreen-min-y", 4),
76         PROPERTY_ENTRY_U32("touchscreen-size-x", 1858),
77         PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
78         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
79         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
80         PROPERTY_ENTRY_BOOL("silead,home-button"),
81         { }
82 };
83
84 static const struct ts_dmi_data chuwi_vi10_data = {
85         .acpi_name      = "MSSL0002:00",
86         .properties     = chuwi_vi10_props,
87 };
88
89 static const struct property_entry connect_tablet9_props[] = {
90         PROPERTY_ENTRY_U32("touchscreen-min-x", 9),
91         PROPERTY_ENTRY_U32("touchscreen-min-y", 8),
92         PROPERTY_ENTRY_U32("touchscreen-size-x", 1664),
93         PROPERTY_ENTRY_U32("touchscreen-size-y", 878),
94         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
95         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
96         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
97         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
98         { }
99 };
100
101 static const struct ts_dmi_data connect_tablet9_data = {
102         .acpi_name      = "MSSL1680:00",
103         .properties     = connect_tablet9_props,
104 };
105
106 static const struct property_entry cube_iwork8_air_props[] = {
107         PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
108         PROPERTY_ENTRY_U32("touchscreen-size-y", 900),
109         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
110         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
111         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
112         { }
113 };
114
115 static const struct ts_dmi_data cube_iwork8_air_data = {
116         .acpi_name      = "MSSL1680:00",
117         .properties     = cube_iwork8_air_props,
118 };
119
120 static const struct property_entry cube_knote_i1101_props[] = {
121         PROPERTY_ENTRY_U32("touchscreen-min-x", 20),
122         PROPERTY_ENTRY_U32("touchscreen-min-y",  22),
123         PROPERTY_ENTRY_U32("touchscreen-size-x", 1961),
124         PROPERTY_ENTRY_U32("touchscreen-size-y", 1513),
125         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
126         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
127         PROPERTY_ENTRY_BOOL("silead,home-button"),
128         { }
129 };
130
131 static const struct ts_dmi_data cube_knote_i1101_data = {
132         .acpi_name      = "MSSL1680:00",
133         .properties     = cube_knote_i1101_props,
134 };
135
136 static const struct property_entry dexp_ursus_7w_props[] = {
137         PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
138         PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
139         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
140         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
141         PROPERTY_ENTRY_BOOL("silead,home-button"),
142         { }
143 };
144
145 static const struct ts_dmi_data dexp_ursus_7w_data = {
146         .acpi_name      = "MSSL1680:00",
147         .properties     = dexp_ursus_7w_props,
148 };
149
150 static const struct property_entry digma_citi_e200_props[] = {
151         PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
152         PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
153         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
154         PROPERTY_ENTRY_STRING("firmware-name",
155                               "/*(DEBLOBBED)*/"),
156         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
157         PROPERTY_ENTRY_BOOL("silead,home-button"),
158         { }
159 };
160
161 static const struct ts_dmi_data digma_citi_e200_data = {
162         .acpi_name      = "MSSL1680:00",
163         .properties     = digma_citi_e200_props,
164 };
165
166 static const struct property_entry estar_beauty_hd_props[] = {
167         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
168         { }
169 };
170
171 static const struct ts_dmi_data estar_beauty_hd_data = {
172         .acpi_name      = "GDIX1001:00",
173         .properties     = estar_beauty_hd_props,
174 };
175
176 static const struct property_entry gp_electronic_t701_props[] = {
177         PROPERTY_ENTRY_U32("touchscreen-size-x", 960),
178         PROPERTY_ENTRY_U32("touchscreen-size-y", 640),
179         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
180         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
181         PROPERTY_ENTRY_STRING("firmware-name",
182                               "/*(DEBLOBBED)*/"),
183         { }
184 };
185
186 static const struct ts_dmi_data gp_electronic_t701_data = {
187         .acpi_name      = "MSSL1680:00",
188         .properties     = gp_electronic_t701_props,
189 };
190
191 static const struct property_entry itworks_tw891_props[] = {
192         PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
193         PROPERTY_ENTRY_U32("touchscreen-size-y", 890),
194         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
195         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
196         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
197         { }
198 };
199
200 static const struct ts_dmi_data itworks_tw891_data = {
201         .acpi_name      = "MSSL1680:00",
202         .properties     = itworks_tw891_props,
203 };
204
205 static const struct property_entry jumper_ezpad_6_pro_props[] = {
206         PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
207         PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
208         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
209         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
210         PROPERTY_ENTRY_BOOL("silead,home-button"),
211         { }
212 };
213
214 static const struct ts_dmi_data jumper_ezpad_6_pro_data = {
215         .acpi_name      = "MSSL1680:00",
216         .properties     = jumper_ezpad_6_pro_props,
217 };
218
219 static const struct property_entry jumper_ezpad_mini3_props[] = {
220         PROPERTY_ENTRY_U32("touchscreen-size-x", 1700),
221         PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
222         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
223         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
224         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
225         { }
226 };
227
228 static const struct ts_dmi_data jumper_ezpad_mini3_data = {
229         .acpi_name      = "MSSL1680:00",
230         .properties     = jumper_ezpad_mini3_props,
231 };
232
233 static const struct property_entry onda_obook_20_plus_props[] = {
234         PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
235         PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
236         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
237         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
238         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
239         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
240         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
241         PROPERTY_ENTRY_BOOL("silead,home-button"),
242         { }
243 };
244
245 static const struct ts_dmi_data onda_obook_20_plus_data = {
246         .acpi_name      = "MSSL1680:00",
247         .properties     = onda_obook_20_plus_props,
248 };
249
250 static const struct property_entry onda_v820w_32g_props[] = {
251         PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
252         PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
253         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
254         PROPERTY_ENTRY_STRING("firmware-name",
255                               "/*(DEBLOBBED)*/"),
256         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
257         PROPERTY_ENTRY_BOOL("silead,home-button"),
258         { }
259 };
260
261 static const struct ts_dmi_data onda_v820w_32g_data = {
262         .acpi_name      = "MSSL1680:00",
263         .properties     = onda_v820w_32g_props,
264 };
265
266 static const struct property_entry onda_v891w_v1_props[] = {
267         PROPERTY_ENTRY_U32("touchscreen-min-x", 46),
268         PROPERTY_ENTRY_U32("touchscreen-min-y",  8),
269         PROPERTY_ENTRY_U32("touchscreen-size-x", 1676),
270         PROPERTY_ENTRY_U32("touchscreen-size-y", 1130),
271         PROPERTY_ENTRY_STRING("firmware-name",
272                               "/*(DEBLOBBED)*/"),
273         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
274         PROPERTY_ENTRY_BOOL("silead,home-button"),
275         { }
276 };
277
278 static const struct ts_dmi_data onda_v891w_v1_data = {
279         .acpi_name      = "MSSL1680:00",
280         .properties     = onda_v891w_v1_props,
281 };
282
283 static const struct property_entry onda_v891w_v3_props[] = {
284         PROPERTY_ENTRY_U32("touchscreen-min-x", 35),
285         PROPERTY_ENTRY_U32("touchscreen-min-y", 15),
286         PROPERTY_ENTRY_U32("touchscreen-size-x", 1625),
287         PROPERTY_ENTRY_U32("touchscreen-size-y", 1135),
288         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
289         PROPERTY_ENTRY_STRING("firmware-name",
290                               "/*(DEBLOBBED)*/"),
291         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
292         PROPERTY_ENTRY_BOOL("silead,home-button"),
293         { }
294 };
295
296 static const struct ts_dmi_data onda_v891w_v3_data = {
297         .acpi_name      = "MSSL1680:00",
298         .properties     = onda_v891w_v3_props,
299 };
300
301 static const struct property_entry pipo_w2s_props[] = {
302         PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
303         PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
304         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
305         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
306         PROPERTY_ENTRY_STRING("firmware-name",
307                               "/*(DEBLOBBED)*/"),
308         { }
309 };
310
311 static const struct ts_dmi_data pipo_w2s_data = {
312         .acpi_name      = "MSSL1680:00",
313         .properties     = pipo_w2s_props,
314 };
315
316 static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = {
317         PROPERTY_ENTRY_U32("touchscreen-min-x", 32),
318         PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
319         PROPERTY_ENTRY_U32("touchscreen-size-x", 1692),
320         PROPERTY_ENTRY_U32("touchscreen-size-y", 1146),
321         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
322         PROPERTY_ENTRY_STRING("firmware-name",
323                               "/*(DEBLOBBED)*/"),
324         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
325         PROPERTY_ENTRY_BOOL("silead,home-button"),
326         { }
327 };
328
329 static const struct ts_dmi_data pov_mobii_wintab_p800w_v20_data = {
330         .acpi_name      = "MSSL1680:00",
331         .properties     = pov_mobii_wintab_p800w_v20_props,
332 };
333
334 static const struct property_entry pov_mobii_wintab_p800w_v21_props[] = {
335         PROPERTY_ENTRY_U32("touchscreen-size-x", 1800),
336         PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
337         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
338         PROPERTY_ENTRY_STRING("firmware-name",
339                               "/*(DEBLOBBED)*/"),
340         PROPERTY_ENTRY_BOOL("silead,home-button"),
341         { }
342 };
343
344 static const struct ts_dmi_data pov_mobii_wintab_p800w_v21_data = {
345         .acpi_name      = "MSSL1680:00",
346         .properties     = pov_mobii_wintab_p800w_v21_props,
347 };
348
349 static const struct property_entry teclast_x3_plus_props[] = {
350         PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
351         PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
352         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
353         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
354         PROPERTY_ENTRY_BOOL("silead,home-button"),
355         { }
356 };
357
358 static const struct ts_dmi_data teclast_x3_plus_data = {
359         .acpi_name      = "MSSL1680:00",
360         .properties     = teclast_x3_plus_props,
361 };
362
363 static const struct property_entry teclast_x98plus2_props[] = {
364         PROPERTY_ENTRY_U32("touchscreen-size-x", 2048),
365         PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
366         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
367         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
368         PROPERTY_ENTRY_STRING("firmware-name",
369                               "/*(DEBLOBBED)*/"),
370         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
371         { }
372 };
373
374 static const struct ts_dmi_data teclast_x98plus2_data = {
375         .acpi_name      = "MSSL1680:00",
376         .properties     = teclast_x98plus2_props,
377 };
378
379 static const struct property_entry trekstor_primebook_c13_props[] = {
380         PROPERTY_ENTRY_U32("touchscreen-size-x", 2624),
381         PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
382         PROPERTY_ENTRY_STRING("firmware-name",
383                               "/*(DEBLOBBED)*/"),
384         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
385         PROPERTY_ENTRY_BOOL("silead,home-button"),
386         { }
387 };
388
389 static const struct ts_dmi_data trekstor_primebook_c13_data = {
390         .acpi_name      = "MSSL1680:00",
391         .properties     = trekstor_primebook_c13_props,
392 };
393
394 static const struct property_entry trekstor_surftab_twin_10_1_props[] = {
395         PROPERTY_ENTRY_U32("touchscreen-size-x", 1900),
396         PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
397         PROPERTY_ENTRY_U32("touchscreen-inverted-y", 1),
398         PROPERTY_ENTRY_STRING("firmware-name",
399                               "/*(DEBLOBBED)*/"),
400         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
401         { }
402 };
403
404 static const struct ts_dmi_data trekstor_surftab_twin_10_1_data = {
405         .acpi_name      = "MSSL1680:00",
406         .properties     = trekstor_surftab_twin_10_1_props,
407 };
408
409 static const struct property_entry trekstor_surftab_wintron70_props[] = {
410         PROPERTY_ENTRY_U32("touchscreen-size-x", 884),
411         PROPERTY_ENTRY_U32("touchscreen-size-y", 632),
412         PROPERTY_ENTRY_STRING("firmware-name",
413                               "/*(DEBLOBBED)*/"),
414         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
415         PROPERTY_ENTRY_BOOL("silead,home-button"),
416         { }
417 };
418
419 static const struct ts_dmi_data trekstor_surftab_wintron70_data = {
420         .acpi_name      = "MSSL1680:00",
421         .properties     = trekstor_surftab_wintron70_props,
422 };
423
424 /* NOTE: Please keep this table sorted alphabetically */
425 static const struct dmi_system_id touchscreen_dmi_table[] = {
426         {
427                 /* Chuwi Hi8 */
428                 .driver_data = (void *)&chuwi_hi8_data,
429                 .matches = {
430                         DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
431                         DMI_MATCH(DMI_PRODUCT_NAME, "S806"),
432                 },
433         },
434         {
435                 /* Chuwi Hi8 (H1D_S806_206) */
436                 .driver_data = (void *)&chuwi_hi8_data,
437                 .matches = {
438                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
439                         DMI_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
440                         DMI_MATCH(DMI_BIOS_VERSION, "H1D_S806_206"),
441                 },
442         },
443         {
444                 /* Chuwi Hi8 Pro (CWI513) */
445                 .driver_data = (void *)&chuwi_hi8_pro_data,
446                 .matches = {
447                         DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
448                         DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
449                 },
450         },
451         {
452                 /* Chuwi Vi8 (CWI506) */
453                 .driver_data = (void *)&chuwi_vi8_data,
454                 .matches = {
455                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
456                         DMI_MATCH(DMI_PRODUCT_NAME, "i86"),
457                         DMI_MATCH(DMI_BIOS_VERSION, "CHUWI.D86JLBNR"),
458                 },
459         },
460         {
461                 /* Chuwi Vi10 (CWI505) */
462                 .driver_data = (void *)&chuwi_vi10_data,
463                 .matches = {
464                         DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
465                         DMI_MATCH(DMI_BOARD_NAME, "BYT-PF02"),
466                         DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
467                         DMI_MATCH(DMI_PRODUCT_NAME, "S165"),
468                 },
469         },
470         {
471                 /* Connect Tablet 9 */
472                 .driver_data = (void *)&connect_tablet9_data,
473                 .matches = {
474                         DMI_MATCH(DMI_SYS_VENDOR, "Connect"),
475                         DMI_MATCH(DMI_PRODUCT_NAME, "Tablet 9"),
476                 },
477         },
478         {
479                 /* CUBE iwork8 Air */
480                 .driver_data = (void *)&cube_iwork8_air_data,
481                 .matches = {
482                         DMI_MATCH(DMI_SYS_VENDOR, "cube"),
483                         DMI_MATCH(DMI_PRODUCT_NAME, "i1-TF"),
484                         DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
485                 },
486         },
487         {
488                 /* Cube KNote i1101 */
489                 .driver_data = (void *)&cube_knote_i1101_data,
490                 .matches = {
491                         DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
492                         DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
493                         DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
494                         DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
495                 },
496         },
497         {
498                 /* DEXP Ursus 7W */
499                 .driver_data = (void *)&dexp_ursus_7w_data,
500                 .matches = {
501                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
502                         DMI_MATCH(DMI_PRODUCT_NAME, "7W"),
503                 },
504         },
505         {
506                 /* Digma Citi E200 */
507                 .driver_data = (void *)&digma_citi_e200_data,
508                 .matches = {
509                         DMI_MATCH(DMI_SYS_VENDOR, "Digma"),
510                         DMI_MATCH(DMI_PRODUCT_NAME, "CITI E200"),
511                         DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
512                 },
513         },
514         {
515                 /* Estar Beauty HD (MID 7316R) */
516                 .driver_data = (void *)&estar_beauty_hd_data,
517                 .matches = {
518                         DMI_MATCH(DMI_SYS_VENDOR, "Estar"),
519                         DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"),
520                 },
521         },
522         {
523                 /* GP-electronic T701 */
524                 .driver_data = (void *)&gp_electronic_t701_data,
525                 .matches = {
526                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
527                         DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
528                         DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
529                 },
530         },
531         {
532                 /* I.T.Works TW701 (same hardware as the Trekstor ST70416-6) */
533                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
534                 .matches = {
535                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
536                         DMI_MATCH(DMI_PRODUCT_NAME, "i71c"),
537                         DMI_MATCH(DMI_BIOS_VERSION, "itWORKS.G.WI71C.JGBMRB"),
538                 },
539         },
540         {
541                 /* I.T.Works TW891 */
542                 .driver_data = (void *)&itworks_tw891_data,
543                 .matches = {
544                         DMI_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
545                         DMI_MATCH(DMI_PRODUCT_NAME, "TW891"),
546                 },
547         },
548         {
549                 /* Jumper EZpad 6 Pro */
550                 .driver_data = (void *)&jumper_ezpad_6_pro_data,
551                 .matches = {
552                         DMI_MATCH(DMI_SYS_VENDOR, "Jumper"),
553                         DMI_MATCH(DMI_PRODUCT_NAME, "EZpad"),
554                         DMI_MATCH(DMI_BIOS_VERSION, "5.12"),
555                         /* Above matches are too generic, add bios-date match */
556                         DMI_MATCH(DMI_BIOS_DATE, "08/18/2017"),
557                 },
558         },
559         {
560                 /* Jumper EZpad mini3 */
561                 .driver_data = (void *)&jumper_ezpad_mini3_data,
562                 .matches = {
563                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
564                         /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
565                         DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
566                 },
567         },
568         {
569                 /* Onda oBook 20 Plus */
570                 .driver_data = (void *)&onda_obook_20_plus_data,
571                 .matches = {
572                         DMI_MATCH(DMI_SYS_VENDOR, "ONDA"),
573                         DMI_MATCH(DMI_PRODUCT_NAME, "OBOOK 20 PLUS"),
574                 },
575         },
576         {
577                 /* ONDA V820w DualOS */
578                 .driver_data = (void *)&onda_v820w_32g_data,
579                 .matches = {
580                         DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
581                         DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V820w DualOS")
582                 },
583         },
584         {
585                 /* ONDA V891w revision P891WBEBV1B00 aka v1 */
586                 .driver_data = (void *)&onda_v891w_v1_data,
587                 .matches = {
588                         DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
589                         DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONDA Tablet"),
590                         DMI_EXACT_MATCH(DMI_BOARD_VERSION, "V001"),
591                         /* Exact match, different versions need different fw */
592                         DMI_EXACT_MATCH(DMI_BIOS_VERSION, "ONDA.W89EBBN08"),
593                 },
594         },
595         {
596                 /* ONDA V891w Dual OS P891DCF2V1A01274 64GB */
597                 .driver_data = (void *)&onda_v891w_v3_data,
598                 .matches = {
599                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
600                         DMI_MATCH(DMI_PRODUCT_NAME, "ONDA Tablet"),
601                         DMI_MATCH(DMI_BIOS_VERSION, "ONDA.D890HBBNR0A"),
602                 },
603         },
604         {
605                 /* Pipo W2S */
606                 .driver_data = (void *)&pipo_w2s_data,
607                 .matches = {
608                         DMI_MATCH(DMI_SYS_VENDOR, "PIPO"),
609                         DMI_MATCH(DMI_PRODUCT_NAME, "W2S"),
610                 },
611         },
612         {
613                 /* Ployer Momo7w (same hardware as the Trekstor ST70416-6) */
614                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
615                 .matches = {
616                         DMI_MATCH(DMI_SYS_VENDOR, "Shenzhen PLOYER"),
617                         DMI_MATCH(DMI_PRODUCT_NAME, "MOMO7W"),
618                         /* Exact match, different versions need different fw */
619                         DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"),
620                 },
621         },
622         {
623                 /* Point of View mobii wintab p800w (v2.0) */
624                 .driver_data = (void *)&pov_mobii_wintab_p800w_v20_data,
625                 .matches = {
626                         DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
627                         DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
628                         DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1014"),
629                         /* Above matches are too generic, add bios-date match */
630                         DMI_MATCH(DMI_BIOS_DATE, "10/24/2014"),
631                 },
632         },
633         {
634                 /* Point of View mobii wintab p800w (v2.1) */
635                 .driver_data = (void *)&pov_mobii_wintab_p800w_v21_data,
636                 .matches = {
637                         DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
638                         DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
639                         DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
640                         /* Above matches are too generic, add bios-date match */
641                         DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
642                 },
643         },
644         {
645                 /* Teclast X3 Plus */
646                 .driver_data = (void *)&teclast_x3_plus_data,
647                 .matches = {
648                         DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
649                         DMI_MATCH(DMI_PRODUCT_NAME, "X3 Plus"),
650                         DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"),
651                 },
652         },
653         {
654                 /* Teclast X98 Plus II */
655                 .driver_data = (void *)&teclast_x98plus2_data,
656                 .matches = {
657                         DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
658                         DMI_MATCH(DMI_PRODUCT_NAME, "X98 Plus II"),
659                 },
660         },
661         {
662                 /* Trekstor Primebook C13 */
663                 .driver_data = (void *)&trekstor_primebook_c13_data,
664                 .matches = {
665                         DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
666                         DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
667                 },
668         },
669         {
670                 /* TrekStor SurfTab twin 10.1 ST10432-8 */
671                 .driver_data = (void *)&trekstor_surftab_twin_10_1_data,
672                 .matches = {
673                         DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
674                         DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab twin 10.1"),
675                 },
676         },
677         {
678                 /* Trekstor Surftab Wintron 7.0 ST70416-6 */
679                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
680                 .matches = {
681                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
682                         DMI_MATCH(DMI_PRODUCT_NAME, "ST70416-6"),
683                         /* Exact match, different versions need different fw */
684                         DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA04"),
685                 },
686         },
687         {
688                 /* Trekstor Surftab Wintron 7.0 ST70416-6, newer BIOS */
689                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
690                 .matches = {
691                         DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
692                         DMI_MATCH(DMI_PRODUCT_NAME,
693                                              "SurfTab wintron 7.0 ST70416-6"),
694                         /* Exact match, different versions need different fw */
695                         DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA05"),
696                 },
697         },
698         {
699                 /* Yours Y8W81, same case and touchscreen as Chuwi Vi8 */
700                 .driver_data = (void *)&chuwi_vi8_data,
701                 .matches = {
702                         DMI_MATCH(DMI_SYS_VENDOR, "YOURS"),
703                         DMI_MATCH(DMI_PRODUCT_NAME, "Y8W81"),
704                 },
705         },
706         { },
707 };
708
709 static const struct ts_dmi_data *ts_data;
710
711 static void ts_dmi_add_props(struct i2c_client *client)
712 {
713         struct device *dev = &client->dev;
714         int error;
715
716         if (has_acpi_companion(dev) &&
717             !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
718                 error = device_add_properties(dev, ts_data->properties);
719                 if (error)
720                         dev_err(dev, "failed to add properties: %d\n", error);
721         }
722 }
723
724 static int ts_dmi_notifier_call(struct notifier_block *nb,
725                                        unsigned long action, void *data)
726 {
727         struct device *dev = data;
728         struct i2c_client *client;
729
730         switch (action) {
731         case BUS_NOTIFY_ADD_DEVICE:
732                 client = i2c_verify_client(dev);
733                 if (client)
734                         ts_dmi_add_props(client);
735                 break;
736
737         default:
738                 break;
739         }
740
741         return 0;
742 }
743
744 static struct notifier_block ts_dmi_notifier = {
745         .notifier_call = ts_dmi_notifier_call,
746 };
747
748 static int __init ts_dmi_init(void)
749 {
750         const struct dmi_system_id *dmi_id;
751         int error;
752
753         dmi_id = dmi_first_match(touchscreen_dmi_table);
754         if (!dmi_id)
755                 return 0; /* Not an error */
756
757         ts_data = dmi_id->driver_data;
758
759         error = bus_register_notifier(&i2c_bus_type, &ts_dmi_notifier);
760         if (error)
761                 pr_err("%s: failed to register i2c bus notifier: %d\n",
762                         __func__, error);
763
764         return error;
765 }
766
767 /*
768  * We are registering out notifier after i2c core is initialized and i2c bus
769  * itself is ready (which happens at postcore initcall level), but before
770  * ACPI starts enumerating devices (at subsys initcall level).
771  */
772 arch_initcall(ts_dmi_init);