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