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", "gsl1680-chuwi-hi8.fw"),
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-min-x", 6),
46 	PROPERTY_ENTRY_U32("touchscreen-min-y", 3),
47 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
48 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
49 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
50 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hi8-pro.fw"),
51 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
52 	PROPERTY_ENTRY_BOOL("silead,home-button"),
53 	{ }
54 };
55 
56 static const struct ts_dmi_data chuwi_hi8_pro_data = {
57 	.acpi_name	= "MSSL1680:00",
58 	.properties	= chuwi_hi8_pro_props,
59 };
60 
61 static const struct property_entry chuwi_vi8_props[] = {
62 	PROPERTY_ENTRY_U32("touchscreen-min-x", 4),
63 	PROPERTY_ENTRY_U32("touchscreen-min-y", 6),
64 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1724),
65 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
66 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
67 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-chuwi-vi8.fw"),
68 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
69 	PROPERTY_ENTRY_BOOL("silead,home-button"),
70 	{ }
71 };
72 
73 static const struct ts_dmi_data chuwi_vi8_data = {
74 	.acpi_name      = "MSSL1680:00",
75 	.properties     = chuwi_vi8_props,
76 };
77 
78 static const struct property_entry chuwi_vi10_props[] = {
79 	PROPERTY_ENTRY_U32("touchscreen-min-x", 0),
80 	PROPERTY_ENTRY_U32("touchscreen-min-y", 4),
81 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1858),
82 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
83 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-vi10.fw"),
84 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
85 	PROPERTY_ENTRY_BOOL("silead,home-button"),
86 	{ }
87 };
88 
89 static const struct ts_dmi_data chuwi_vi10_data = {
90 	.acpi_name      = "MSSL0002:00",
91 	.properties     = chuwi_vi10_props,
92 };
93 
94 static const struct property_entry connect_tablet9_props[] = {
95 	PROPERTY_ENTRY_U32("touchscreen-min-x", 9),
96 	PROPERTY_ENTRY_U32("touchscreen-min-y", 10),
97 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1664),
98 	PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
99 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
100 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
101 	PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-connect-tablet9.fw"),
102 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
103 	{ }
104 };
105 
106 static const struct ts_dmi_data connect_tablet9_data = {
107 	.acpi_name      = "MSSL1680:00",
108 	.properties     = connect_tablet9_props,
109 };
110 
111 static const struct property_entry cube_iwork8_air_props[] = {
112 	PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
113 	PROPERTY_ENTRY_U32("touchscreen-min-y", 3),
114 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1664),
115 	PROPERTY_ENTRY_U32("touchscreen-size-y", 896),
116 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
117 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-cube-iwork8-air.fw"),
118 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
119 	{ }
120 };
121 
122 static const struct ts_dmi_data cube_iwork8_air_data = {
123 	.acpi_name	= "MSSL1680:00",
124 	.properties	= cube_iwork8_air_props,
125 };
126 
127 static const struct property_entry cube_knote_i1101_props[] = {
128 	PROPERTY_ENTRY_U32("touchscreen-min-x", 20),
129 	PROPERTY_ENTRY_U32("touchscreen-min-y",  22),
130 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1961),
131 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1513),
132 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3692-cube-knote-i1101.fw"),
133 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
134 	PROPERTY_ENTRY_BOOL("silead,home-button"),
135 	{ }
136 };
137 
138 static const struct ts_dmi_data cube_knote_i1101_data = {
139 	.acpi_name	= "MSSL1680:00",
140 	.properties	= cube_knote_i1101_props,
141 };
142 
143 static const struct property_entry dexp_ursus_7w_props[] = {
144 	PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
145 	PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
146 	PROPERTY_ENTRY_STRING("firmware-name", "gsl1686-dexp-ursus-7w.fw"),
147 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
148 	PROPERTY_ENTRY_BOOL("silead,home-button"),
149 	{ }
150 };
151 
152 static const struct ts_dmi_data dexp_ursus_7w_data = {
153 	.acpi_name	= "MSSL1680:00",
154 	.properties	= dexp_ursus_7w_props,
155 };
156 
157 static const struct property_entry digma_citi_e200_props[] = {
158 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
159 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
160 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
161 	PROPERTY_ENTRY_STRING("firmware-name",
162 			      "gsl1686-digma_citi_e200.fw"),
163 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
164 	PROPERTY_ENTRY_BOOL("silead,home-button"),
165 	{ }
166 };
167 
168 static const struct ts_dmi_data digma_citi_e200_data = {
169 	.acpi_name	= "MSSL1680:00",
170 	.properties	= digma_citi_e200_props,
171 };
172 
173 static const struct property_entry gp_electronic_t701_props[] = {
174 	PROPERTY_ENTRY_U32("touchscreen-size-x", 960),
175 	PROPERTY_ENTRY_U32("touchscreen-size-y", 640),
176 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
177 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
178 	PROPERTY_ENTRY_STRING("firmware-name",
179 			      "gsl1680-gp-electronic-t701.fw"),
180 	{ }
181 };
182 
183 static const struct ts_dmi_data gp_electronic_t701_data = {
184 	.acpi_name	= "MSSL1680:00",
185 	.properties	= gp_electronic_t701_props,
186 };
187 
188 static const struct property_entry itworks_tw891_props[] = {
189 	PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
190 	PROPERTY_ENTRY_U32("touchscreen-min-y", 5),
191 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
192 	PROPERTY_ENTRY_U32("touchscreen-size-y", 896),
193 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
194 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
195 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-itworks-tw891.fw"),
196 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
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", "gsl3692-jumper-ezpad-6-pro.fw"),
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-min-x", 23),
221 	PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
222 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1700),
223 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1138),
224 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
225 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-jumper-ezpad-mini3.fw"),
226 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
227 	{ }
228 };
229 
230 static const struct ts_dmi_data jumper_ezpad_mini3_data = {
231 	.acpi_name	= "MSSL1680:00",
232 	.properties	= jumper_ezpad_mini3_props,
233 };
234 
235 static const struct property_entry onda_obook_20_plus_props[] = {
236 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
237 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
238 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
239 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
240 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
241 	PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-onda-obook-20-plus.fw"),
242 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
243 	PROPERTY_ENTRY_BOOL("silead,home-button"),
244 	{ }
245 };
246 
247 static const struct ts_dmi_data onda_obook_20_plus_data = {
248 	.acpi_name	= "MSSL1680:00",
249 	.properties	= onda_obook_20_plus_props,
250 };
251 
252 static const struct property_entry onda_v80_plus_v3_props[] = {
253 	PROPERTY_ENTRY_U32("touchscreen-min-x", 22),
254 	PROPERTY_ENTRY_U32("touchscreen-min-y", 15),
255 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1698),
256 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
257 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
258 	PROPERTY_ENTRY_STRING("firmware-name",
259 			      "gsl3676-onda-v80-plus-v3.fw"),
260 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
261 	PROPERTY_ENTRY_BOOL("silead,home-button"),
262 	{ }
263 };
264 
265 static const struct ts_dmi_data onda_v80_plus_v3_data = {
266 	.acpi_name	= "MSSL1680:00",
267 	.properties	= onda_v80_plus_v3_props,
268 };
269 
270 static const struct property_entry onda_v820w_32g_props[] = {
271 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
272 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
273 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
274 	PROPERTY_ENTRY_STRING("firmware-name",
275 			      "gsl1680-onda-v820w-32g.fw"),
276 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
277 	PROPERTY_ENTRY_BOOL("silead,home-button"),
278 	{ }
279 };
280 
281 static const struct ts_dmi_data onda_v820w_32g_data = {
282 	.acpi_name	= "MSSL1680:00",
283 	.properties	= onda_v820w_32g_props,
284 };
285 
286 static const struct property_entry onda_v891w_v1_props[] = {
287 	PROPERTY_ENTRY_U32("touchscreen-min-x", 46),
288 	PROPERTY_ENTRY_U32("touchscreen-min-y",  8),
289 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1676),
290 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1130),
291 	PROPERTY_ENTRY_STRING("firmware-name",
292 			      "gsl3680-onda-v891w-v1.fw"),
293 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
294 	PROPERTY_ENTRY_BOOL("silead,home-button"),
295 	{ }
296 };
297 
298 static const struct ts_dmi_data onda_v891w_v1_data = {
299 	.acpi_name	= "MSSL1680:00",
300 	.properties	= onda_v891w_v1_props,
301 };
302 
303 static const struct property_entry onda_v891w_v3_props[] = {
304 	PROPERTY_ENTRY_U32("touchscreen-min-x", 35),
305 	PROPERTY_ENTRY_U32("touchscreen-min-y", 15),
306 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1625),
307 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1135),
308 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
309 	PROPERTY_ENTRY_STRING("firmware-name",
310 			      "gsl3676-onda-v891w-v3.fw"),
311 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
312 	PROPERTY_ENTRY_BOOL("silead,home-button"),
313 	{ }
314 };
315 
316 static const struct ts_dmi_data onda_v891w_v3_data = {
317 	.acpi_name	= "MSSL1680:00",
318 	.properties	= onda_v891w_v3_props,
319 };
320 
321 static const struct property_entry pipo_w2s_props[] = {
322 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
323 	PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
324 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
325 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
326 	PROPERTY_ENTRY_STRING("firmware-name",
327 			      "gsl1680-pipo-w2s.fw"),
328 	{ }
329 };
330 
331 static const struct ts_dmi_data pipo_w2s_data = {
332 	.acpi_name	= "MSSL1680:00",
333 	.properties	= pipo_w2s_props,
334 };
335 
336 static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = {
337 	PROPERTY_ENTRY_U32("touchscreen-min-x", 32),
338 	PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
339 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1692),
340 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1146),
341 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
342 	PROPERTY_ENTRY_STRING("firmware-name",
343 			      "gsl3680-pov-mobii-wintab-p800w-v20.fw"),
344 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
345 	PROPERTY_ENTRY_BOOL("silead,home-button"),
346 	{ }
347 };
348 
349 static const struct ts_dmi_data pov_mobii_wintab_p800w_v20_data = {
350 	.acpi_name	= "MSSL1680:00",
351 	.properties	= pov_mobii_wintab_p800w_v20_props,
352 };
353 
354 static const struct property_entry pov_mobii_wintab_p800w_v21_props[] = {
355 	PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
356 	PROPERTY_ENTRY_U32("touchscreen-min-y", 8),
357 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1794),
358 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
359 	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
360 	PROPERTY_ENTRY_STRING("firmware-name",
361 			      "gsl3692-pov-mobii-wintab-p800w.fw"),
362 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
363 	PROPERTY_ENTRY_BOOL("silead,home-button"),
364 	{ }
365 };
366 
367 static const struct ts_dmi_data pov_mobii_wintab_p800w_v21_data = {
368 	.acpi_name	= "MSSL1680:00",
369 	.properties	= pov_mobii_wintab_p800w_v21_props,
370 };
371 
372 static const struct property_entry teclast_x3_plus_props[] = {
373 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
374 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
375 	PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-teclast-x3-plus.fw"),
376 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
377 	PROPERTY_ENTRY_BOOL("silead,home-button"),
378 	{ }
379 };
380 
381 static const struct ts_dmi_data teclast_x3_plus_data = {
382 	.acpi_name	= "MSSL1680:00",
383 	.properties	= teclast_x3_plus_props,
384 };
385 
386 static const struct property_entry teclast_x98plus2_props[] = {
387 	PROPERTY_ENTRY_U32("touchscreen-size-x", 2048),
388 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
389 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
390 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
391 	PROPERTY_ENTRY_STRING("firmware-name",
392 			      "gsl1686-teclast_x98plus2.fw"),
393 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
394 	{ }
395 };
396 
397 static const struct ts_dmi_data teclast_x98plus2_data = {
398 	.acpi_name	= "MSSL1680:00",
399 	.properties	= teclast_x98plus2_props,
400 };
401 
402 static const struct property_entry trekstor_primebook_c11_props[] = {
403 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1970),
404 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1530),
405 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
406 	PROPERTY_ENTRY_STRING("firmware-name",
407 			      "gsl1680-trekstor-primebook-c11.fw"),
408 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
409 	PROPERTY_ENTRY_BOOL("silead,home-button"),
410 	{ }
411 };
412 
413 static const struct ts_dmi_data trekstor_primebook_c11_data = {
414 	.acpi_name	= "MSSL1680:00",
415 	.properties	= trekstor_primebook_c11_props,
416 };
417 
418 static const struct property_entry trekstor_primebook_c13_props[] = {
419 	PROPERTY_ENTRY_U32("touchscreen-size-x", 2624),
420 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
421 	PROPERTY_ENTRY_STRING("firmware-name",
422 			      "gsl1680-trekstor-primebook-c13.fw"),
423 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
424 	PROPERTY_ENTRY_BOOL("silead,home-button"),
425 	{ }
426 };
427 
428 static const struct ts_dmi_data trekstor_primebook_c13_data = {
429 	.acpi_name	= "MSSL1680:00",
430 	.properties	= trekstor_primebook_c13_props,
431 };
432 
433 static const struct property_entry trekstor_primetab_t13b_props[] = {
434 	PROPERTY_ENTRY_U32("touchscreen-size-x", 2500),
435 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1900),
436 	PROPERTY_ENTRY_STRING("firmware-name",
437 			      "gsl1680-trekstor-primetab-t13b.fw"),
438 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
439 	PROPERTY_ENTRY_BOOL("silead,home-button"),
440 	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
441 	{ }
442 };
443 
444 static const struct ts_dmi_data trekstor_primetab_t13b_data = {
445 	.acpi_name  = "MSSL1680:00",
446 	.properties = trekstor_primetab_t13b_props,
447 };
448 
449 static const struct property_entry trekstor_surftab_twin_10_1_props[] = {
450 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1900),
451 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
452 	PROPERTY_ENTRY_U32("touchscreen-inverted-y", 1),
453 	PROPERTY_ENTRY_STRING("firmware-name",
454 			      "gsl3670-surftab-twin-10-1-st10432-8.fw"),
455 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
456 	{ }
457 };
458 
459 static const struct ts_dmi_data trekstor_surftab_twin_10_1_data = {
460 	.acpi_name	= "MSSL1680:00",
461 	.properties	= trekstor_surftab_twin_10_1_props,
462 };
463 
464 static const struct property_entry trekstor_surftab_wintron70_props[] = {
465 	PROPERTY_ENTRY_U32("touchscreen-min-x", 12),
466 	PROPERTY_ENTRY_U32("touchscreen-min-y", 8),
467 	PROPERTY_ENTRY_U32("touchscreen-size-x", 884),
468 	PROPERTY_ENTRY_U32("touchscreen-size-y", 632),
469 	PROPERTY_ENTRY_STRING("firmware-name",
470 			      "gsl1686-surftab-wintron70-st70416-6.fw"),
471 	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
472 	PROPERTY_ENTRY_BOOL("silead,home-button"),
473 	{ }
474 };
475 
476 static const struct ts_dmi_data trekstor_surftab_wintron70_data = {
477 	.acpi_name	= "MSSL1680:00",
478 	.properties	= trekstor_surftab_wintron70_props,
479 };
480 
481 /* NOTE: Please keep this table sorted alphabetically */
482 static const struct dmi_system_id touchscreen_dmi_table[] = {
483 	{
484 		/* Chuwi Hi8 */
485 		.driver_data = (void *)&chuwi_hi8_data,
486 		.matches = {
487 			DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
488 			DMI_MATCH(DMI_PRODUCT_NAME, "S806"),
489 		},
490 	},
491 	{
492 		/* Chuwi Hi8 (H1D_S806_206) */
493 		.driver_data = (void *)&chuwi_hi8_data,
494 		.matches = {
495 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
496 			DMI_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
497 			DMI_MATCH(DMI_BIOS_VERSION, "H1D_S806_206"),
498 		},
499 	},
500 	{
501 		/* Chuwi Hi8 Pro (CWI513) */
502 		.driver_data = (void *)&chuwi_hi8_pro_data,
503 		.matches = {
504 			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
505 			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
506 		},
507 	},
508 	{
509 		/* Chuwi Vi8 (CWI506) */
510 		.driver_data = (void *)&chuwi_vi8_data,
511 		.matches = {
512 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
513 			DMI_MATCH(DMI_PRODUCT_NAME, "i86"),
514 			DMI_MATCH(DMI_BIOS_VERSION, "CHUWI.D86JLBNR"),
515 		},
516 	},
517 	{
518 		/* Chuwi Vi10 (CWI505) */
519 		.driver_data = (void *)&chuwi_vi10_data,
520 		.matches = {
521 			DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
522 			DMI_MATCH(DMI_BOARD_NAME, "BYT-PF02"),
523 			DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
524 			DMI_MATCH(DMI_PRODUCT_NAME, "S165"),
525 		},
526 	},
527 	{
528 		/* Connect Tablet 9 */
529 		.driver_data = (void *)&connect_tablet9_data,
530 		.matches = {
531 			DMI_MATCH(DMI_SYS_VENDOR, "Connect"),
532 			DMI_MATCH(DMI_PRODUCT_NAME, "Tablet 9"),
533 		},
534 	},
535 	{
536 		/* CUBE iwork8 Air */
537 		.driver_data = (void *)&cube_iwork8_air_data,
538 		.matches = {
539 			DMI_MATCH(DMI_SYS_VENDOR, "cube"),
540 			DMI_MATCH(DMI_PRODUCT_NAME, "i1-TF"),
541 			DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
542 		},
543 	},
544 	{
545 		/* Cube KNote i1101 */
546 		.driver_data = (void *)&cube_knote_i1101_data,
547 		.matches = {
548 			DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
549 			DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
550 			DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
551 			DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
552 		},
553 	},
554 	{
555 		/* DEXP Ursus 7W */
556 		.driver_data = (void *)&dexp_ursus_7w_data,
557 		.matches = {
558 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
559 			DMI_MATCH(DMI_PRODUCT_NAME, "7W"),
560 		},
561 	},
562 	{
563 		/* Digma Citi E200 */
564 		.driver_data = (void *)&digma_citi_e200_data,
565 		.matches = {
566 			DMI_MATCH(DMI_SYS_VENDOR, "Digma"),
567 			DMI_MATCH(DMI_PRODUCT_NAME, "CITI E200"),
568 			DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
569 		},
570 	},
571 	{
572 		/* GP-electronic T701 */
573 		.driver_data = (void *)&gp_electronic_t701_data,
574 		.matches = {
575 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
576 			DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
577 			DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
578 		},
579 	},
580 	{
581 		/* I.T.Works TW701 (same hardware as the Trekstor ST70416-6) */
582 		.driver_data = (void *)&trekstor_surftab_wintron70_data,
583 		.matches = {
584 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
585 			DMI_MATCH(DMI_PRODUCT_NAME, "i71c"),
586 			DMI_MATCH(DMI_BIOS_VERSION, "itWORKS.G.WI71C.JGBMRB"),
587 		},
588 	},
589 	{
590 		/* I.T.Works TW891 */
591 		.driver_data = (void *)&itworks_tw891_data,
592 		.matches = {
593 			DMI_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
594 			DMI_MATCH(DMI_PRODUCT_NAME, "TW891"),
595 		},
596 	},
597 	{
598 		/* Jumper EZpad 6 Pro */
599 		.driver_data = (void *)&jumper_ezpad_6_pro_data,
600 		.matches = {
601 			DMI_MATCH(DMI_SYS_VENDOR, "Jumper"),
602 			DMI_MATCH(DMI_PRODUCT_NAME, "EZpad"),
603 			DMI_MATCH(DMI_BIOS_VERSION, "5.12"),
604 			/* Above matches are too generic, add bios-date match */
605 			DMI_MATCH(DMI_BIOS_DATE, "08/18/2017"),
606 		},
607 	},
608 	{
609 		/* Jumper EZpad mini3 */
610 		.driver_data = (void *)&jumper_ezpad_mini3_data,
611 		.matches = {
612 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
613 			/* jumperx.T87.KFBNEEA02 with the version-nr dropped */
614 			DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
615 		},
616 	},
617 	{
618 		/* Mediacom Flexbook Edge 11 (same hw as TS Primebook C11) */
619 		.driver_data = (void *)&trekstor_primebook_c11_data,
620 		.matches = {
621 			DMI_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
622 			DMI_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
623 		},
624 	},
625 	{
626 		/* Onda oBook 20 Plus */
627 		.driver_data = (void *)&onda_obook_20_plus_data,
628 		.matches = {
629 			DMI_MATCH(DMI_SYS_VENDOR, "ONDA"),
630 			DMI_MATCH(DMI_PRODUCT_NAME, "OBOOK 20 PLUS"),
631 		},
632 	},
633 	{
634 		/* ONDA V80 plus v3 (P80PSBG9V3A01501) */
635 		.driver_data = (void *)&onda_v80_plus_v3_data,
636 		.matches = {
637 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONDA"),
638 			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V80 PLUS")
639 		},
640 	},
641 	{
642 		/* ONDA V820w DualOS */
643 		.driver_data = (void *)&onda_v820w_32g_data,
644 		.matches = {
645 			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
646 			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V820w DualOS")
647 		},
648 	},
649 	{
650 		/* ONDA V891w revision P891WBEBV1B00 aka v1 */
651 		.driver_data = (void *)&onda_v891w_v1_data,
652 		.matches = {
653 			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
654 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONDA Tablet"),
655 			DMI_EXACT_MATCH(DMI_BOARD_VERSION, "V001"),
656 			/* Exact match, different versions need different fw */
657 			DMI_EXACT_MATCH(DMI_BIOS_VERSION, "ONDA.W89EBBN08"),
658 		},
659 	},
660 	{
661 		/* ONDA V891w Dual OS P891DCF2V1A01274 64GB */
662 		.driver_data = (void *)&onda_v891w_v3_data,
663 		.matches = {
664 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
665 			DMI_MATCH(DMI_PRODUCT_NAME, "ONDA Tablet"),
666 			DMI_MATCH(DMI_BIOS_VERSION, "ONDA.D890HBBNR0A"),
667 		},
668 	},
669 	{
670 		/* Pipo W2S */
671 		.driver_data = (void *)&pipo_w2s_data,
672 		.matches = {
673 			DMI_MATCH(DMI_SYS_VENDOR, "PIPO"),
674 			DMI_MATCH(DMI_PRODUCT_NAME, "W2S"),
675 		},
676 	},
677 	{
678 		/* Ployer Momo7w (same hardware as the Trekstor ST70416-6) */
679 		.driver_data = (void *)&trekstor_surftab_wintron70_data,
680 		.matches = {
681 			DMI_MATCH(DMI_SYS_VENDOR, "Shenzhen PLOYER"),
682 			DMI_MATCH(DMI_PRODUCT_NAME, "MOMO7W"),
683 			/* Exact match, different versions need different fw */
684 			DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"),
685 		},
686 	},
687 	{
688 		/* Point of View mobii wintab p800w (v2.0) */
689 		.driver_data = (void *)&pov_mobii_wintab_p800w_v20_data,
690 		.matches = {
691 			DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
692 			DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
693 			DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1014"),
694 			/* Above matches are too generic, add bios-date match */
695 			DMI_MATCH(DMI_BIOS_DATE, "10/24/2014"),
696 		},
697 	},
698 	{
699 		/* Point of View mobii wintab p800w (v2.1) */
700 		.driver_data = (void *)&pov_mobii_wintab_p800w_v21_data,
701 		.matches = {
702 			DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
703 			DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
704 			DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
705 			/* Above matches are too generic, add bios-date match */
706 			DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
707 		},
708 	},
709 	{
710 		/* Teclast X3 Plus */
711 		.driver_data = (void *)&teclast_x3_plus_data,
712 		.matches = {
713 			DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
714 			DMI_MATCH(DMI_PRODUCT_NAME, "X3 Plus"),
715 			DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"),
716 		},
717 	},
718 	{
719 		/* Teclast X98 Plus II */
720 		.driver_data = (void *)&teclast_x98plus2_data,
721 		.matches = {
722 			DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
723 			DMI_MATCH(DMI_PRODUCT_NAME, "X98 Plus II"),
724 		},
725 	},
726 	{
727 		/* Trekstor Primebook C11 */
728 		.driver_data = (void *)&trekstor_primebook_c11_data,
729 		.matches = {
730 			DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
731 			DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C11"),
732 		},
733 	},
734 	{
735 		/* Trekstor Primebook C13 */
736 		.driver_data = (void *)&trekstor_primebook_c13_data,
737 		.matches = {
738 			DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
739 			DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
740 		},
741 	},
742 	{
743 		/* Trekstor Primetab T13B */
744 		.driver_data = (void *)&trekstor_primetab_t13b_data,
745 		.matches = {
746 			DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
747 			DMI_MATCH(DMI_PRODUCT_NAME, "Primetab T13B"),
748 		},
749 	},
750 	{
751 		/* TrekStor SurfTab twin 10.1 ST10432-8 */
752 		.driver_data = (void *)&trekstor_surftab_twin_10_1_data,
753 		.matches = {
754 			DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
755 			DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab twin 10.1"),
756 		},
757 	},
758 	{
759 		/* Trekstor Surftab Wintron 7.0 ST70416-6 */
760 		.driver_data = (void *)&trekstor_surftab_wintron70_data,
761 		.matches = {
762 			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
763 			DMI_MATCH(DMI_PRODUCT_NAME, "ST70416-6"),
764 			/* Exact match, different versions need different fw */
765 			DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA04"),
766 		},
767 	},
768 	{
769 		/* Trekstor Surftab Wintron 7.0 ST70416-6, newer BIOS */
770 		.driver_data = (void *)&trekstor_surftab_wintron70_data,
771 		.matches = {
772 			DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
773 			DMI_MATCH(DMI_PRODUCT_NAME,
774 					     "SurfTab wintron 7.0 ST70416-6"),
775 			/* Exact match, different versions need different fw */
776 			DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA05"),
777 		},
778 	},
779 	{
780 		/* Yours Y8W81, same case and touchscreen as Chuwi Vi8 */
781 		.driver_data = (void *)&chuwi_vi8_data,
782 		.matches = {
783 			DMI_MATCH(DMI_SYS_VENDOR, "YOURS"),
784 			DMI_MATCH(DMI_PRODUCT_NAME, "Y8W81"),
785 		},
786 	},
787 	{ },
788 };
789 
790 static const struct ts_dmi_data *ts_data;
791 
792 static void ts_dmi_add_props(struct i2c_client *client)
793 {
794 	struct device *dev = &client->dev;
795 	int error;
796 
797 	if (has_acpi_companion(dev) &&
798 	    !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
799 		error = device_add_properties(dev, ts_data->properties);
800 		if (error)
801 			dev_err(dev, "failed to add properties: %d\n", error);
802 	}
803 }
804 
805 static int ts_dmi_notifier_call(struct notifier_block *nb,
806 				       unsigned long action, void *data)
807 {
808 	struct device *dev = data;
809 	struct i2c_client *client;
810 
811 	switch (action) {
812 	case BUS_NOTIFY_ADD_DEVICE:
813 		client = i2c_verify_client(dev);
814 		if (client)
815 			ts_dmi_add_props(client);
816 		break;
817 
818 	default:
819 		break;
820 	}
821 
822 	return 0;
823 }
824 
825 static struct notifier_block ts_dmi_notifier = {
826 	.notifier_call = ts_dmi_notifier_call,
827 };
828 
829 static int __init ts_dmi_init(void)
830 {
831 	const struct dmi_system_id *dmi_id;
832 	int error;
833 
834 	dmi_id = dmi_first_match(touchscreen_dmi_table);
835 	if (!dmi_id)
836 		return 0; /* Not an error */
837 
838 	ts_data = dmi_id->driver_data;
839 
840 	error = bus_register_notifier(&i2c_bus_type, &ts_dmi_notifier);
841 	if (error)
842 		pr_err("%s: failed to register i2c bus notifier: %d\n",
843 			__func__, error);
844 
845 	return error;
846 }
847 
848 /*
849  * We are registering out notifier after i2c core is initialized and i2c bus
850  * itself is ready (which happens at postcore initcall level), but before
851  * ACPI starts enumerating devices (at subsys initcall level).
852  */
853 arch_initcall(ts_dmi_init);
854