GNU Linux-libre 4.19.304-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 dexp_ursus_kx210i_props[] = {
151         PROPERTY_ENTRY_U32("touchscreen-min-x", 5),
152         PROPERTY_ENTRY_U32("touchscreen-min-y",  2),
153         PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
154         PROPERTY_ENTRY_U32("touchscreen-size-y", 1137),
155         PROPERTY_ENTRY_STRING("firmware-name", "/*(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 dexp_ursus_kx210i_data = {
162         .acpi_name      = "MSSL1680:00",
163         .properties     = dexp_ursus_kx210i_props,
164 };
165
166 static const struct property_entry digma_citi_e200_props[] = {
167         PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
168         PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
169         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
170         PROPERTY_ENTRY_STRING("firmware-name",
171                               "/*(DEBLOBBED)*/"),
172         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
173         PROPERTY_ENTRY_BOOL("silead,home-button"),
174         { }
175 };
176
177 static const struct ts_dmi_data digma_citi_e200_data = {
178         .acpi_name      = "MSSL1680:00",
179         .properties     = digma_citi_e200_props,
180 };
181
182 static const struct property_entry estar_beauty_hd_props[] = {
183         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
184         { }
185 };
186
187 static const struct ts_dmi_data estar_beauty_hd_data = {
188         .acpi_name      = "GDIX1001:00",
189         .properties     = estar_beauty_hd_props,
190 };
191
192 static const struct property_entry gp_electronic_t701_props[] = {
193         PROPERTY_ENTRY_U32("touchscreen-size-x", 960),
194         PROPERTY_ENTRY_U32("touchscreen-size-y", 640),
195         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
196         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
197         PROPERTY_ENTRY_STRING("firmware-name",
198                               "/*(DEBLOBBED)*/"),
199         { }
200 };
201
202 static const struct ts_dmi_data gp_electronic_t701_data = {
203         .acpi_name      = "MSSL1680:00",
204         .properties     = gp_electronic_t701_props,
205 };
206
207 static const struct property_entry itworks_tw891_props[] = {
208         PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
209         PROPERTY_ENTRY_U32("touchscreen-size-y", 890),
210         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
211         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
212         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
213         { }
214 };
215
216 static const struct ts_dmi_data itworks_tw891_data = {
217         .acpi_name      = "MSSL1680:00",
218         .properties     = itworks_tw891_props,
219 };
220
221 static const struct property_entry jumper_ezpad_6_pro_props[] = {
222         PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
223         PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
224         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
225         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
226         PROPERTY_ENTRY_BOOL("silead,home-button"),
227         { }
228 };
229
230 static const struct ts_dmi_data jumper_ezpad_6_pro_data = {
231         .acpi_name      = "MSSL1680:00",
232         .properties     = jumper_ezpad_6_pro_props,
233 };
234
235 static const struct property_entry jumper_ezpad_mini3_props[] = {
236         PROPERTY_ENTRY_U32("touchscreen-size-x", 1700),
237         PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
238         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
239         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
240         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
241         { }
242 };
243
244 static const struct ts_dmi_data jumper_ezpad_mini3_data = {
245         .acpi_name      = "MSSL1680:00",
246         .properties     = jumper_ezpad_mini3_props,
247 };
248
249 static const struct property_entry onda_obook_20_plus_props[] = {
250         PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
251         PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
252         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
253         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
254         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
255         PROPERTY_ENTRY_STRING("firmware-name", "/*(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_obook_20_plus_data = {
262         .acpi_name      = "MSSL1680:00",
263         .properties     = onda_obook_20_plus_props,
264 };
265
266 static const struct property_entry onda_v820w_32g_props[] = {
267         PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
268         PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
269         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
270         PROPERTY_ENTRY_STRING("firmware-name",
271                               "/*(DEBLOBBED)*/"),
272         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
273         PROPERTY_ENTRY_BOOL("silead,home-button"),
274         { }
275 };
276
277 static const struct ts_dmi_data onda_v820w_32g_data = {
278         .acpi_name      = "MSSL1680:00",
279         .properties     = onda_v820w_32g_props,
280 };
281
282 static const struct property_entry onda_v891w_v1_props[] = {
283         PROPERTY_ENTRY_U32("touchscreen-min-x", 46),
284         PROPERTY_ENTRY_U32("touchscreen-min-y",  8),
285         PROPERTY_ENTRY_U32("touchscreen-size-x", 1676),
286         PROPERTY_ENTRY_U32("touchscreen-size-y", 1130),
287         PROPERTY_ENTRY_STRING("firmware-name",
288                               "/*(DEBLOBBED)*/"),
289         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
290         PROPERTY_ENTRY_BOOL("silead,home-button"),
291         { }
292 };
293
294 static const struct ts_dmi_data onda_v891w_v1_data = {
295         .acpi_name      = "MSSL1680:00",
296         .properties     = onda_v891w_v1_props,
297 };
298
299 static const struct property_entry onda_v891w_v3_props[] = {
300         PROPERTY_ENTRY_U32("touchscreen-min-x", 35),
301         PROPERTY_ENTRY_U32("touchscreen-min-y", 15),
302         PROPERTY_ENTRY_U32("touchscreen-size-x", 1625),
303         PROPERTY_ENTRY_U32("touchscreen-size-y", 1135),
304         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
305         PROPERTY_ENTRY_STRING("firmware-name",
306                               "/*(DEBLOBBED)*/"),
307         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
308         PROPERTY_ENTRY_BOOL("silead,home-button"),
309         { }
310 };
311
312 static const struct ts_dmi_data onda_v891w_v3_data = {
313         .acpi_name      = "MSSL1680:00",
314         .properties     = onda_v891w_v3_props,
315 };
316
317 static const struct property_entry pipo_w2s_props[] = {
318         PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
319         PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
320         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
321         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
322         PROPERTY_ENTRY_STRING("firmware-name",
323                               "/*(DEBLOBBED)*/"),
324         { }
325 };
326
327 static const struct ts_dmi_data pipo_w2s_data = {
328         .acpi_name      = "MSSL1680:00",
329         .properties     = pipo_w2s_props,
330 };
331
332 static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = {
333         PROPERTY_ENTRY_U32("touchscreen-min-x", 32),
334         PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
335         PROPERTY_ENTRY_U32("touchscreen-size-x", 1692),
336         PROPERTY_ENTRY_U32("touchscreen-size-y", 1146),
337         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
338         PROPERTY_ENTRY_STRING("firmware-name",
339                               "/*(DEBLOBBED)*/"),
340         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
341         PROPERTY_ENTRY_BOOL("silead,home-button"),
342         { }
343 };
344
345 static const struct ts_dmi_data pov_mobii_wintab_p800w_v20_data = {
346         .acpi_name      = "MSSL1680:00",
347         .properties     = pov_mobii_wintab_p800w_v20_props,
348 };
349
350 static const struct property_entry pov_mobii_wintab_p800w_v21_props[] = {
351         PROPERTY_ENTRY_U32("touchscreen-size-x", 1800),
352         PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
353         PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
354         PROPERTY_ENTRY_STRING("firmware-name",
355                               "/*(DEBLOBBED)*/"),
356         PROPERTY_ENTRY_BOOL("silead,home-button"),
357         { }
358 };
359
360 static const struct ts_dmi_data pov_mobii_wintab_p800w_v21_data = {
361         .acpi_name      = "MSSL1680:00",
362         .properties     = pov_mobii_wintab_p800w_v21_props,
363 };
364
365 static const struct property_entry teclast_x3_plus_props[] = {
366         PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
367         PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
368         PROPERTY_ENTRY_STRING("firmware-name", "/*(DEBLOBBED)*/"),
369         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
370         PROPERTY_ENTRY_BOOL("silead,home-button"),
371         { }
372 };
373
374 static const struct ts_dmi_data teclast_x3_plus_data = {
375         .acpi_name      = "MSSL1680:00",
376         .properties     = teclast_x3_plus_props,
377 };
378
379 static const struct property_entry teclast_x98plus2_props[] = {
380         PROPERTY_ENTRY_U32("touchscreen-size-x", 2048),
381         PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
382         PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
383         PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
384         PROPERTY_ENTRY_STRING("firmware-name",
385                               "/*(DEBLOBBED)*/"),
386         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
387         { }
388 };
389
390 static const struct ts_dmi_data teclast_x98plus2_data = {
391         .acpi_name      = "MSSL1680:00",
392         .properties     = teclast_x98plus2_props,
393 };
394
395 static const struct property_entry trekstor_primebook_c13_props[] = {
396         PROPERTY_ENTRY_U32("touchscreen-size-x", 2624),
397         PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
398         PROPERTY_ENTRY_STRING("firmware-name",
399                               "/*(DEBLOBBED)*/"),
400         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
401         PROPERTY_ENTRY_BOOL("silead,home-button"),
402         { }
403 };
404
405 static const struct ts_dmi_data trekstor_primebook_c13_data = {
406         .acpi_name      = "MSSL1680:00",
407         .properties     = trekstor_primebook_c13_props,
408 };
409
410 static const struct property_entry trekstor_surftab_twin_10_1_props[] = {
411         PROPERTY_ENTRY_U32("touchscreen-size-x", 1900),
412         PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
413         PROPERTY_ENTRY_U32("touchscreen-inverted-y", 1),
414         PROPERTY_ENTRY_STRING("firmware-name",
415                               "/*(DEBLOBBED)*/"),
416         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
417         { }
418 };
419
420 static const struct ts_dmi_data trekstor_surftab_twin_10_1_data = {
421         .acpi_name      = "MSSL1680:00",
422         .properties     = trekstor_surftab_twin_10_1_props,
423 };
424
425 static const struct property_entry trekstor_surftab_wintron70_props[] = {
426         PROPERTY_ENTRY_U32("touchscreen-size-x", 884),
427         PROPERTY_ENTRY_U32("touchscreen-size-y", 632),
428         PROPERTY_ENTRY_STRING("firmware-name",
429                               "/*(DEBLOBBED)*/"),
430         PROPERTY_ENTRY_U32("silead,max-fingers", 10),
431         PROPERTY_ENTRY_BOOL("silead,home-button"),
432         { }
433 };
434
435 static const struct ts_dmi_data trekstor_surftab_wintron70_data = {
436         .acpi_name      = "MSSL1680:00",
437         .properties     = trekstor_surftab_wintron70_props,
438 };
439
440 /* NOTE: Please keep this table sorted alphabetically */
441 static const struct dmi_system_id touchscreen_dmi_table[] = {
442         {
443                 /* Chuwi Hi8 */
444                 .driver_data = (void *)&chuwi_hi8_data,
445                 .matches = {
446                         DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
447                         DMI_MATCH(DMI_PRODUCT_NAME, "S806"),
448                 },
449         },
450         {
451                 /* Chuwi Hi8 (H1D_S806_206) */
452                 .driver_data = (void *)&chuwi_hi8_data,
453                 .matches = {
454                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
455                         DMI_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
456                         DMI_MATCH(DMI_BIOS_VERSION, "H1D_S806_206"),
457                 },
458         },
459         {
460                 /* Chuwi Hi8 Pro (CWI513) */
461                 .driver_data = (void *)&chuwi_hi8_pro_data,
462                 .matches = {
463                         DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
464                         DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
465                 },
466         },
467         {
468                 /* Chuwi Vi8 (CWI506) */
469                 .driver_data = (void *)&chuwi_vi8_data,
470                 .matches = {
471                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
472                         DMI_MATCH(DMI_PRODUCT_NAME, "i86"),
473                         DMI_MATCH(DMI_BIOS_VERSION, "CHUWI.D86JLBNR"),
474                 },
475         },
476         {
477                 /* Chuwi Vi10 (CWI505) */
478                 .driver_data = (void *)&chuwi_vi10_data,
479                 .matches = {
480                         DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
481                         DMI_MATCH(DMI_BOARD_NAME, "BYT-PF02"),
482                         DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
483                         DMI_MATCH(DMI_PRODUCT_NAME, "S165"),
484                 },
485         },
486         {
487                 /* Connect Tablet 9 */
488                 .driver_data = (void *)&connect_tablet9_data,
489                 .matches = {
490                         DMI_MATCH(DMI_SYS_VENDOR, "Connect"),
491                         DMI_MATCH(DMI_PRODUCT_NAME, "Tablet 9"),
492                 },
493         },
494         {
495                 /* CUBE iwork8 Air */
496                 .driver_data = (void *)&cube_iwork8_air_data,
497                 .matches = {
498                         DMI_MATCH(DMI_SYS_VENDOR, "cube"),
499                         DMI_MATCH(DMI_PRODUCT_NAME, "i1-TF"),
500                         DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
501                 },
502         },
503         {
504                 /* Cube KNote i1101 */
505                 .driver_data = (void *)&cube_knote_i1101_data,
506                 .matches = {
507                         DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
508                         DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
509                         DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
510                         DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
511                 },
512         },
513         {
514                 /* DEXP Ursus 7W */
515                 .driver_data = (void *)&dexp_ursus_7w_data,
516                 .matches = {
517                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
518                         DMI_MATCH(DMI_PRODUCT_NAME, "7W"),
519                 },
520         },
521         {
522                 /* DEXP Ursus KX210i */
523                 .driver_data = (void *)&dexp_ursus_kx210i_data,
524                 .matches = {
525                         DMI_MATCH(DMI_SYS_VENDOR, "INSYDE Corp."),
526                         DMI_MATCH(DMI_PRODUCT_NAME, "S107I"),
527                 },
528         },
529         {
530                 /* Digma Citi E200 */
531                 .driver_data = (void *)&digma_citi_e200_data,
532                 .matches = {
533                         DMI_MATCH(DMI_SYS_VENDOR, "Digma"),
534                         DMI_MATCH(DMI_PRODUCT_NAME, "CITI E200"),
535                         DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
536                 },
537         },
538         {
539                 /* Estar Beauty HD (MID 7316R) */
540                 .driver_data = (void *)&estar_beauty_hd_data,
541                 .matches = {
542                         DMI_MATCH(DMI_SYS_VENDOR, "Estar"),
543                         DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"),
544                 },
545         },
546         {
547                 /* GP-electronic T701 */
548                 .driver_data = (void *)&gp_electronic_t701_data,
549                 .matches = {
550                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
551                         DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
552                         DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
553                 },
554         },
555         {
556                 /* I.T.Works TW701 (same hardware as the Trekstor ST70416-6) */
557                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
558                 .matches = {
559                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
560                         DMI_MATCH(DMI_PRODUCT_NAME, "i71c"),
561                         DMI_MATCH(DMI_BIOS_VERSION, "itWORKS.G.WI71C.JGBMRB"),
562                 },
563         },
564         {
565                 /* I.T.Works TW891 */
566                 .driver_data = (void *)&itworks_tw891_data,
567                 .matches = {
568                         DMI_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
569                         DMI_MATCH(DMI_PRODUCT_NAME, "TW891"),
570                 },
571         },
572         {
573                 /* Jumper EZpad 6 Pro */
574                 .driver_data = (void *)&jumper_ezpad_6_pro_data,
575                 .matches = {
576                         DMI_MATCH(DMI_SYS_VENDOR, "Jumper"),
577                         DMI_MATCH(DMI_PRODUCT_NAME, "EZpad"),
578                         DMI_MATCH(DMI_BIOS_VERSION, "5.12"),
579                         /* Above matches are too generic, add bios-date match */
580                         DMI_MATCH(DMI_BIOS_DATE, "08/18/2017"),
581                 },
582         },
583         {
584                 /* Jumper EZpad mini3 */
585                 .driver_data = (void *)&jumper_ezpad_mini3_data,
586                 .matches = {
587                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
588                         /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
589                         DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
590                 },
591         },
592         {
593                 /* Onda oBook 20 Plus */
594                 .driver_data = (void *)&onda_obook_20_plus_data,
595                 .matches = {
596                         DMI_MATCH(DMI_SYS_VENDOR, "ONDA"),
597                         DMI_MATCH(DMI_PRODUCT_NAME, "OBOOK 20 PLUS"),
598                 },
599         },
600         {
601                 /* ONDA V820w DualOS */
602                 .driver_data = (void *)&onda_v820w_32g_data,
603                 .matches = {
604                         DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
605                         DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V820w DualOS")
606                 },
607         },
608         {
609                 /* ONDA V891w revision P891WBEBV1B00 aka v1 */
610                 .driver_data = (void *)&onda_v891w_v1_data,
611                 .matches = {
612                         DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
613                         DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONDA Tablet"),
614                         DMI_EXACT_MATCH(DMI_BOARD_VERSION, "V001"),
615                         /* Exact match, different versions need different fw */
616                         DMI_EXACT_MATCH(DMI_BIOS_VERSION, "ONDA.W89EBBN08"),
617                 },
618         },
619         {
620                 /* ONDA V891w Dual OS P891DCF2V1A01274 64GB */
621                 .driver_data = (void *)&onda_v891w_v3_data,
622                 .matches = {
623                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
624                         DMI_MATCH(DMI_PRODUCT_NAME, "ONDA Tablet"),
625                         DMI_MATCH(DMI_BIOS_VERSION, "ONDA.D890HBBNR0A"),
626                 },
627         },
628         {
629                 /* Pipo W2S */
630                 .driver_data = (void *)&pipo_w2s_data,
631                 .matches = {
632                         DMI_MATCH(DMI_SYS_VENDOR, "PIPO"),
633                         DMI_MATCH(DMI_PRODUCT_NAME, "W2S"),
634                 },
635         },
636         {
637                 /* Ployer Momo7w (same hardware as the Trekstor ST70416-6) */
638                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
639                 .matches = {
640                         DMI_MATCH(DMI_SYS_VENDOR, "Shenzhen PLOYER"),
641                         DMI_MATCH(DMI_PRODUCT_NAME, "MOMO7W"),
642                         /* Exact match, different versions need different fw */
643                         DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"),
644                 },
645         },
646         {
647                 /* Point of View mobii wintab p800w (v2.0) */
648                 .driver_data = (void *)&pov_mobii_wintab_p800w_v20_data,
649                 .matches = {
650                         DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
651                         DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
652                         DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1014"),
653                         /* Above matches are too generic, add bios-date match */
654                         DMI_MATCH(DMI_BIOS_DATE, "10/24/2014"),
655                 },
656         },
657         {
658                 /* Point of View mobii wintab p800w (v2.1) */
659                 .driver_data = (void *)&pov_mobii_wintab_p800w_v21_data,
660                 .matches = {
661                         DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
662                         DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
663                         DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
664                         /* Above matches are too generic, add bios-date match */
665                         DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
666                 },
667         },
668         {
669                 /* Teclast X3 Plus */
670                 .driver_data = (void *)&teclast_x3_plus_data,
671                 .matches = {
672                         DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
673                         DMI_MATCH(DMI_PRODUCT_NAME, "X3 Plus"),
674                         DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"),
675                 },
676         },
677         {
678                 /* Teclast X98 Plus II */
679                 .driver_data = (void *)&teclast_x98plus2_data,
680                 .matches = {
681                         DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
682                         DMI_MATCH(DMI_PRODUCT_NAME, "X98 Plus II"),
683                 },
684         },
685         {
686                 /* Trekstor Primebook C13 */
687                 .driver_data = (void *)&trekstor_primebook_c13_data,
688                 .matches = {
689                         DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
690                         DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
691                 },
692         },
693         {
694                 /* TrekStor SurfTab twin 10.1 ST10432-8 */
695                 .driver_data = (void *)&trekstor_surftab_twin_10_1_data,
696                 .matches = {
697                         DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
698                         DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab twin 10.1"),
699                 },
700         },
701         {
702                 /* Trekstor Surftab Wintron 7.0 ST70416-6 */
703                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
704                 .matches = {
705                         DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
706                         DMI_MATCH(DMI_PRODUCT_NAME, "ST70416-6"),
707                         /* Exact match, different versions need different fw */
708                         DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA04"),
709                 },
710         },
711         {
712                 /* Trekstor Surftab Wintron 7.0 ST70416-6, newer BIOS */
713                 .driver_data = (void *)&trekstor_surftab_wintron70_data,
714                 .matches = {
715                         DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
716                         DMI_MATCH(DMI_PRODUCT_NAME,
717                                              "SurfTab wintron 7.0 ST70416-6"),
718                         /* Exact match, different versions need different fw */
719                         DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA05"),
720                 },
721         },
722         {
723                 /* Yours Y8W81, same case and touchscreen as Chuwi Vi8 */
724                 .driver_data = (void *)&chuwi_vi8_data,
725                 .matches = {
726                         DMI_MATCH(DMI_SYS_VENDOR, "YOURS"),
727                         DMI_MATCH(DMI_PRODUCT_NAME, "Y8W81"),
728                 },
729         },
730         { },
731 };
732
733 static const struct ts_dmi_data *ts_data;
734
735 static void ts_dmi_add_props(struct i2c_client *client)
736 {
737         struct device *dev = &client->dev;
738         int error;
739
740         if (has_acpi_companion(dev) &&
741             !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
742                 error = device_add_properties(dev, ts_data->properties);
743                 if (error)
744                         dev_err(dev, "failed to add properties: %d\n", error);
745         }
746 }
747
748 static int ts_dmi_notifier_call(struct notifier_block *nb,
749                                        unsigned long action, void *data)
750 {
751         struct device *dev = data;
752         struct i2c_client *client;
753
754         switch (action) {
755         case BUS_NOTIFY_ADD_DEVICE:
756                 client = i2c_verify_client(dev);
757                 if (client)
758                         ts_dmi_add_props(client);
759                 break;
760
761         default:
762                 break;
763         }
764
765         return 0;
766 }
767
768 static struct notifier_block ts_dmi_notifier = {
769         .notifier_call = ts_dmi_notifier_call,
770 };
771
772 static int __init ts_dmi_init(void)
773 {
774         const struct dmi_system_id *dmi_id;
775         int error;
776
777         dmi_id = dmi_first_match(touchscreen_dmi_table);
778         if (!dmi_id)
779                 return 0; /* Not an error */
780
781         ts_data = dmi_id->driver_data;
782
783         error = bus_register_notifier(&i2c_bus_type, &ts_dmi_notifier);
784         if (error)
785                 pr_err("%s: failed to register i2c bus notifier: %d\n",
786                         __func__, error);
787
788         return error;
789 }
790
791 /*
792  * We are registering out notifier after i2c core is initialized and i2c bus
793  * itself is ready (which happens at postcore initcall level), but before
794  * ACPI starts enumerating devices (at subsys initcall level).
795  */
796 arch_initcall(ts_dmi_init);