Merge tag 'csky-for-linus-4.20-fixup-dtb' of https://github.com/c-sky/csky-linux
[linux-block.git] / drivers / platform / x86 / touchscreen_dmi.c
CommitLineData
cef9dd85 1/*
74421786 2 * Touchscreen driver DMI based configuration code
cef9dd85
HG
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
74421786 23struct ts_dmi_data {
cef9dd85 24 const char *acpi_name;
ae311158 25 const struct property_entry *properties;
cef9dd85
HG
26};
27
6a655a0d
HG
28/* NOTE: Please keep all entries sorted alphabetically */
29
30static const struct property_entry chuwi_hi8_props[] = {
31 PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
32 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
cef9dd85 33 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d
HG
34 PROPERTY_ENTRY_BOOL("silead,home-button"),
35 PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi8.fw"),
cef9dd85
HG
36 { }
37};
38
74421786 39static const struct ts_dmi_data chuwi_hi8_data = {
6a655a0d
HG
40 .acpi_name = "MSSL0001:00",
41 .properties = chuwi_hi8_props,
cef9dd85
HG
42};
43
6a655a0d 44static const struct property_entry chuwi_hi8_pro_props[] = {
4104916d
HG
45 PROPERTY_ENTRY_U32("touchscreen-min-x", 6),
46 PROPERTY_ENTRY_U32("touchscreen-min-y", 3),
6a655a0d
HG
47 PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
48 PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
cef9dd85 49 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d 50 PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hi8-pro.fw"),
4104916d 51 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
6a655a0d 52 PROPERTY_ENTRY_BOOL("silead,home-button"),
cef9dd85
HG
53 { }
54};
55
74421786 56static const struct ts_dmi_data chuwi_hi8_pro_data = {
cef9dd85 57 .acpi_name = "MSSL1680:00",
6a655a0d 58 .properties = chuwi_hi8_pro_props,
cef9dd85
HG
59};
60
6a655a0d 61static const struct property_entry chuwi_vi8_props[] = {
4104916d
HG
62 PROPERTY_ENTRY_U32("touchscreen-min-x", 4),
63 PROPERTY_ENTRY_U32("touchscreen-min-y", 6),
6a655a0d
HG
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"),
828615f8
HG
68 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
69 PROPERTY_ENTRY_BOOL("silead,home-button"),
70 { }
71};
72
74421786 73static const struct ts_dmi_data chuwi_vi8_data = {
6a655a0d
HG
74 .acpi_name = "MSSL1680:00",
75 .properties = chuwi_vi8_props,
76};
77
b4c86811
HG
78static 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
74421786 89static const struct ts_dmi_data chuwi_vi10_data = {
b4c86811
HG
90 .acpi_name = "MSSL0002:00",
91 .properties = chuwi_vi10_props,
92};
93
c72d95e5
HG
94static const struct property_entry connect_tablet9_props[] = {
95 PROPERTY_ENTRY_U32("touchscreen-min-x", 9),
4104916d 96 PROPERTY_ENTRY_U32("touchscreen-min-y", 10),
c72d95e5 97 PROPERTY_ENTRY_U32("touchscreen-size-x", 1664),
4104916d 98 PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
c72d95e5
HG
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
106static const struct ts_dmi_data connect_tablet9_data = {
107 .acpi_name = "MSSL1680:00",
108 .properties = connect_tablet9_props,
109};
110
6a655a0d 111static const struct property_entry cube_iwork8_air_props[] = {
4104916d
HG
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),
6a655a0d
HG
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
74421786 122static const struct ts_dmi_data cube_iwork8_air_data = {
828615f8 123 .acpi_name = "MSSL1680:00",
6a655a0d 124 .properties = cube_iwork8_air_props,
828615f8
HG
125};
126
cda5915d 127static 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
138static const struct ts_dmi_data cube_knote_i1101_data = {
139 .acpi_name = "MSSL1680:00",
140 .properties = cube_knote_i1101_props,
141};
142
6b8e7d8f
HG
143static 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),
aaa40965 148 PROPERTY_ENTRY_BOOL("silead,home-button"),
6b8e7d8f
HG
149 { }
150};
151
74421786 152static const struct ts_dmi_data dexp_ursus_7w_data = {
6b8e7d8f
HG
153 .acpi_name = "MSSL1680:00",
154 .properties = dexp_ursus_7w_props,
155};
156
6a655a0d
HG
157static 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"),
5b7bb3a7 161 PROPERTY_ENTRY_STRING("firmware-name",
6a655a0d 162 "gsl1686-digma_citi_e200.fw"),
5b7bb3a7 163 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
aaa40965 164 PROPERTY_ENTRY_BOOL("silead,home-button"),
5b7bb3a7
HG
165 { }
166};
167
74421786 168static const struct ts_dmi_data digma_citi_e200_data = {
5b7bb3a7 169 .acpi_name = "MSSL1680:00",
6a655a0d 170 .properties = digma_citi_e200_props,
5b7bb3a7
HG
171};
172
d9ca30b8
HG
173static const struct property_entry gp_electronic_t701_props[] = {
174 PROPERTY_ENTRY_U32("touchscreen-size-x", 960),
175 PROPERTY_ENTRY_U32("touchscreen-size-y", 640),
5c24c05e
HG
176 PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
177 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
d9ca30b8
HG
178 PROPERTY_ENTRY_STRING("firmware-name",
179 "gsl1680-gp-electronic-t701.fw"),
180 { }
181};
182
74421786 183static const struct ts_dmi_data gp_electronic_t701_data = {
d9ca30b8
HG
184 .acpi_name = "MSSL1680:00",
185 .properties = gp_electronic_t701_props,
186};
187
6a655a0d 188static const struct property_entry itworks_tw891_props[] = {
4104916d
HG
189 PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
190 PROPERTY_ENTRY_U32("touchscreen-min-y", 5),
6a655a0d 191 PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
4104916d 192 PROPERTY_ENTRY_U32("touchscreen-size-y", 896),
6a655a0d 193 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
13fadfa7 194 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d 195 PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-itworks-tw891.fw"),
4104916d 196 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
13fadfa7
HG
197 { }
198};
199
74421786 200static const struct ts_dmi_data itworks_tw891_data = {
13fadfa7 201 .acpi_name = "MSSL1680:00",
6a655a0d 202 .properties = itworks_tw891_props,
13fadfa7
HG
203};
204
6a655a0d
HG
205static 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"),
3cd33db8
HG
209 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
210 PROPERTY_ENTRY_BOOL("silead,home-button"),
211 { }
212};
213
74421786 214static const struct ts_dmi_data jumper_ezpad_6_pro_data = {
3cd33db8 215 .acpi_name = "MSSL1680:00",
6a655a0d 216 .properties = jumper_ezpad_6_pro_props,
3cd33db8
HG
217};
218
6a655a0d 219static const struct property_entry jumper_ezpad_mini3_props[] = {
4104916d
HG
220 PROPERTY_ENTRY_U32("touchscreen-min-x", 23),
221 PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
6a655a0d 222 PROPERTY_ENTRY_U32("touchscreen-size-x", 1700),
4104916d 223 PROPERTY_ENTRY_U32("touchscreen-size-y", 1138),
f4d342cf 224 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d
HG
225 PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-jumper-ezpad-mini3.fw"),
226 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
4edfc540
HG
227 { }
228};
229
74421786 230static const struct ts_dmi_data jumper_ezpad_mini3_data = {
4edfc540 231 .acpi_name = "MSSL1680:00",
6a655a0d 232 .properties = jumper_ezpad_mini3_props,
4edfc540
HG
233};
234
6a655a0d 235static const struct property_entry onda_obook_20_plus_props[] = {
485f2a58
HG
236 PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
237 PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
6a655a0d
HG
238 PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
239 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
485f2a58 240 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d
HG
241 PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-onda-obook-20-plus.fw"),
242 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
aaa40965 243 PROPERTY_ENTRY_BOOL("silead,home-button"),
485f2a58
HG
244 { }
245};
246
74421786 247static const struct ts_dmi_data onda_obook_20_plus_data = {
485f2a58 248 .acpi_name = "MSSL1680:00",
6a655a0d 249 .properties = onda_obook_20_plus_props,
485f2a58
HG
250};
251
01b6b7e6
HG
252static 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
265static const struct ts_dmi_data onda_v80_plus_v3_data = {
266 .acpi_name = "MSSL1680:00",
267 .properties = onda_v80_plus_v3_props,
268};
269
ee08f578
JBB
270static 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
281static const struct ts_dmi_data onda_v820w_32g_data = {
282 .acpi_name = "MSSL1680:00",
283 .properties = onda_v820w_32g_props,
284};
285
6a655a0d
HG
286static 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),
3fcf2b2a 291 PROPERTY_ENTRY_STRING("firmware-name",
6a655a0d 292 "gsl3680-onda-v891w-v1.fw"),
3fcf2b2a
ST
293 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
294 PROPERTY_ENTRY_BOOL("silead,home-button"),
295 { }
296};
297
74421786 298static const struct ts_dmi_data onda_v891w_v1_data = {
3fcf2b2a 299 .acpi_name = "MSSL1680:00",
6a655a0d 300 .properties = onda_v891w_v1_props,
3fcf2b2a
ST
301};
302
c0d73088 303static 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
316static const struct ts_dmi_data onda_v891w_v3_data = {
317 .acpi_name = "MSSL1680:00",
318 .properties = onda_v891w_v3_props,
319};
320
6a655a0d
HG
321static const struct property_entry pipo_w2s_props[] = {
322 PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
323 PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
170e9a53 324 PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
170e9a53 325 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d
HG
326 PROPERTY_ENTRY_STRING("firmware-name",
327 "gsl1680-pipo-w2s.fw"),
170e9a53
NB
328 { }
329};
330
74421786 331static const struct ts_dmi_data pipo_w2s_data = {
170e9a53 332 .acpi_name = "MSSL1680:00",
6a655a0d 333 .properties = pipo_w2s_props,
170e9a53
NB
334};
335
6a655a0d
HG
336static 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),
d2d541e8 341 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d
HG
342 PROPERTY_ENTRY_STRING("firmware-name",
343 "gsl3680-pov-mobii-wintab-p800w-v20.fw"),
344 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
d2d541e8 345 PROPERTY_ENTRY_BOOL("silead,home-button"),
d2d541e8
MS
346 { }
347};
348
74421786 349static const struct ts_dmi_data pov_mobii_wintab_p800w_v20_data = {
6a655a0d
HG
350 .acpi_name = "MSSL1680:00",
351 .properties = pov_mobii_wintab_p800w_v20_props,
d2d541e8
MS
352};
353
6a655a0d 354static const struct property_entry pov_mobii_wintab_p800w_v21_props[] = {
4104916d
HG
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),
f1905b98 359 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
6a655a0d
HG
360 PROPERTY_ENTRY_STRING("firmware-name",
361 "gsl3692-pov-mobii-wintab-p800w.fw"),
4104916d 362 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
f1905b98
HG
363 PROPERTY_ENTRY_BOOL("silead,home-button"),
364 { }
365};
366
74421786 367static const struct ts_dmi_data pov_mobii_wintab_p800w_v21_data = {
6a655a0d
HG
368 .acpi_name = "MSSL1680:00",
369 .properties = pov_mobii_wintab_p800w_v21_props,
f1905b98
HG
370};
371
6a655a0d
HG
372static 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"),
2aeb2c3a
HG
376 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
377 PROPERTY_ENTRY_BOOL("silead,home-button"),
378 { }
379};
380
74421786 381static const struct ts_dmi_data teclast_x3_plus_data = {
2aeb2c3a 382 .acpi_name = "MSSL1680:00",
6a655a0d 383 .properties = teclast_x3_plus_props,
2aeb2c3a
HG
384};
385
a346aa20
PC
386static 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
74421786 397static const struct ts_dmi_data teclast_x98plus2_data = {
a346aa20
PC
398 .acpi_name = "MSSL1680:00",
399 .properties = teclast_x98plus2_props,
400};
401
cacad0b2
HG
402static 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
413static const struct ts_dmi_data trekstor_primebook_c11_data = {
414 .acpi_name = "MSSL1680:00",
415 .properties = trekstor_primebook_c11_props,
416};
417
6a655a0d
HG
418static 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"),
c58a4f22
AP
423 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
424 PROPERTY_ENTRY_BOOL("silead,home-button"),
425 { }
426};
427
74421786 428static const struct ts_dmi_data trekstor_primebook_c13_data = {
c58a4f22 429 .acpi_name = "MSSL1680:00",
6a655a0d 430 .properties = trekstor_primebook_c13_props,
c58a4f22
AP
431};
432
30394a8e
MC
433static 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
444static const struct ts_dmi_data trekstor_primetab_t13b_data = {
445 .acpi_name = "MSSL1680:00",
446 .properties = trekstor_primetab_t13b_props,
447};
448
6a655a0d
HG
449static 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),
adf762dc 453 PROPERTY_ENTRY_STRING("firmware-name",
6a655a0d
HG
454 "gsl3670-surftab-twin-10-1-st10432-8.fw"),
455 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
456 { }
457};
458
74421786 459static const struct ts_dmi_data trekstor_surftab_twin_10_1_data = {
6a655a0d
HG
460 .acpi_name = "MSSL1680:00",
461 .properties = trekstor_surftab_twin_10_1_props,
462};
463
464static const struct property_entry trekstor_surftab_wintron70_props[] = {
4104916d
HG
465 PROPERTY_ENTRY_U32("touchscreen-min-x", 12),
466 PROPERTY_ENTRY_U32("touchscreen-min-y", 8),
6a655a0d
HG
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"),
adf762dc
HG
471 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
472 PROPERTY_ENTRY_BOOL("silead,home-button"),
473 { }
474};
475
74421786 476static const struct ts_dmi_data trekstor_surftab_wintron70_data = {
adf762dc 477 .acpi_name = "MSSL1680:00",
6a655a0d 478 .properties = trekstor_surftab_wintron70_props,
adf762dc
HG
479};
480
6a655a0d 481/* NOTE: Please keep this table sorted alphabetically */
74421786 482static const struct dmi_system_id touchscreen_dmi_table[] = {
6a655a0d
HG
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 },
b4c86811
HG
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 },
c72d95e5
HG
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 },
cef9dd85
HG
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 },
cda5915d 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 },
cef9dd85 554 {
6a655a0d
HG
555 /* DEXP Ursus 7W */
556 .driver_data = (void *)&dexp_ursus_7w_data,
cef9dd85
HG
557 .matches = {
558 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
6a655a0d
HG
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"),
cef9dd85
HG
595 },
596 },
828615f8
HG
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 },
6b8e7d8f 608 {
6a655a0d
HG
609 /* Jumper EZpad mini3 */
610 .driver_data = (void *)&jumper_ezpad_mini3_data,
6b8e7d8f
HG
611 .matches = {
612 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
6a655a0d
HG
613 /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
614 DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
6b8e7d8f
HG
615 },
616 },
f4c12d4d 617 {
6a655a0d
HG
618 /* Onda oBook 20 Plus */
619 .driver_data = (void *)&onda_obook_20_plus_data,
f4c12d4d 620 .matches = {
6a655a0d
HG
621 DMI_MATCH(DMI_SYS_VENDOR, "ONDA"),
622 DMI_MATCH(DMI_PRODUCT_NAME, "OBOOK 20 PLUS"),
f4c12d4d
BÜ
623 },
624 },
01b6b7e6
HG
625 {
626 /* ONDA V80 plus v3 (P80PSBG9V3A01501) */
627 .driver_data = (void *)&onda_v80_plus_v3_data,
628 .matches = {
629 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONDA"),
630 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V80 PLUS")
631 },
632 },
ee08f578
JBB
633 {
634 /* ONDA V820w DualOS */
635 .driver_data = (void *)&onda_v820w_32g_data,
636 .matches = {
637 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
638 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V820w DualOS")
639 },
640 },
5b7bb3a7 641 {
6a655a0d
HG
642 /* ONDA V891w revision P891WBEBV1B00 aka v1 */
643 .driver_data = (void *)&onda_v891w_v1_data,
5b7bb3a7 644 .matches = {
6a655a0d
HG
645 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "ONDA"),
646 DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONDA Tablet"),
647 DMI_EXACT_MATCH(DMI_BOARD_VERSION, "V001"),
5b7bb3a7 648 /* Exact match, different versions need different fw */
6a655a0d 649 DMI_EXACT_MATCH(DMI_BIOS_VERSION, "ONDA.W89EBBN08"),
5b7bb3a7
HG
650 },
651 },
c0d73088 652 {
653 /* ONDA V891w Dual OS P891DCF2V1A01274 64GB */
654 .driver_data = (void *)&onda_v891w_v3_data,
655 .matches = {
656 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
657 DMI_MATCH(DMI_PRODUCT_NAME, "ONDA Tablet"),
658 DMI_MATCH(DMI_BIOS_VERSION, "ONDA.D890HBBNR0A"),
659 },
660 },
4245c155 661 {
6a655a0d
HG
662 /* Pipo W2S */
663 .driver_data = (void *)&pipo_w2s_data,
4245c155 664 .matches = {
6a655a0d
HG
665 DMI_MATCH(DMI_SYS_VENDOR, "PIPO"),
666 DMI_MATCH(DMI_PRODUCT_NAME, "W2S"),
4245c155
HG
667 },
668 },
c3a73ed8
HG
669 {
670 /* Ployer Momo7w (same hardware as the Trekstor ST70416-6) */
d6b0d7d8 671 .driver_data = (void *)&trekstor_surftab_wintron70_data,
c3a73ed8
HG
672 .matches = {
673 DMI_MATCH(DMI_SYS_VENDOR, "Shenzhen PLOYER"),
674 DMI_MATCH(DMI_PRODUCT_NAME, "MOMO7W"),
675 /* Exact match, different versions need different fw */
676 DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"),
677 },
678 },
f4d342cf 679 {
3cd33db8
HG
680 /* Point of View mobii wintab p800w (v2.0) */
681 .driver_data = (void *)&pov_mobii_wintab_p800w_v20_data,
682 .matches = {
683 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
684 DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
685 DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1014"),
686 /* Above matches are too generic, add bios-date match */
687 DMI_MATCH(DMI_BIOS_DATE, "10/24/2014"),
688 },
689 },
690 {
691 /* Point of View mobii wintab p800w (v2.1) */
692 .driver_data = (void *)&pov_mobii_wintab_p800w_v21_data,
f4d342cf
HG
693 .matches = {
694 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
695 DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
696 DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
697 /* Above matches are too generic, add bios-date match */
698 DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
699 },
700 },
4edfc540 701 {
6a655a0d
HG
702 /* Teclast X3 Plus */
703 .driver_data = (void *)&teclast_x3_plus_data,
26ed9d1c 704 .matches = {
6a655a0d
HG
705 DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
706 DMI_MATCH(DMI_PRODUCT_NAME, "X3 Plus"),
707 DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"),
26ed9d1c 708 },
709 },
f1905b98 710 {
6a655a0d
HG
711 /* Teclast X98 Plus II */
712 .driver_data = (void *)&teclast_x98plus2_data,
f1905b98 713 .matches = {
6a655a0d
HG
714 DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
715 DMI_MATCH(DMI_PRODUCT_NAME, "X98 Plus II"),
f1905b98
HG
716 },
717 },
cacad0b2
HG
718 {
719 /* Trekstor Primebook C11 */
720 .driver_data = (void *)&trekstor_primebook_c11_data,
721 .matches = {
722 DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
723 DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C11"),
724 },
725 },
2aeb2c3a
HG
726 {
727 /* Trekstor Primebook C13 */
728 .driver_data = (void *)&trekstor_primebook_c13_data,
729 .matches = {
730 DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
731 DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
732 },
733 },
30394a8e
MC
734 {
735 /* Trekstor Primetab T13B */
736 .driver_data = (void *)&trekstor_primetab_t13b_data,
737 .matches = {
738 DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
739 DMI_MATCH(DMI_PRODUCT_NAME, "Primetab T13B"),
740 },
741 },
a346aa20 742 {
6a655a0d
HG
743 /* TrekStor SurfTab twin 10.1 ST10432-8 */
744 .driver_data = (void *)&trekstor_surftab_twin_10_1_data,
a346aa20 745 .matches = {
6a655a0d
HG
746 DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
747 DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab twin 10.1"),
a346aa20
PC
748 },
749 },
c58a4f22 750 {
6a655a0d
HG
751 /* Trekstor Surftab Wintron 7.0 ST70416-6 */
752 .driver_data = (void *)&trekstor_surftab_wintron70_data,
c58a4f22 753 .matches = {
6a655a0d
HG
754 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
755 DMI_MATCH(DMI_PRODUCT_NAME, "ST70416-6"),
756 /* Exact match, different versions need different fw */
757 DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA04"),
c58a4f22
AP
758 },
759 },
5488bfdf 760 {
6a655a0d 761 /* Trekstor Surftab Wintron 7.0 ST70416-6, newer BIOS */
d6b0d7d8 762 .driver_data = (void *)&trekstor_surftab_wintron70_data,
5488bfdf 763 .matches = {
6a655a0d
HG
764 DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
765 DMI_MATCH(DMI_PRODUCT_NAME,
766 "SurfTab wintron 7.0 ST70416-6"),
767 /* Exact match, different versions need different fw */
768 DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA05"),
5488bfdf
HG
769 },
770 },
24e2bb31
HG
771 {
772 /* Yours Y8W81, same case and touchscreen as Chuwi Vi8 */
773 .driver_data = (void *)&chuwi_vi8_data,
774 .matches = {
775 DMI_MATCH(DMI_SYS_VENDOR, "YOURS"),
776 DMI_MATCH(DMI_PRODUCT_NAME, "Y8W81"),
777 },
778 },
cef9dd85
HG
779 { },
780};
781
74421786 782static const struct ts_dmi_data *ts_data;
f22265b6 783
74421786 784static void ts_dmi_add_props(struct i2c_client *client)
cef9dd85 785{
e1053963 786 struct device *dev = &client->dev;
cef9dd85
HG
787 int error;
788
cef9dd85 789 if (has_acpi_companion(dev) &&
74421786
HG
790 !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
791 error = device_add_properties(dev, ts_data->properties);
cef9dd85
HG
792 if (error)
793 dev_err(dev, "failed to add properties: %d\n", error);
794 }
795}
796
74421786 797static int ts_dmi_notifier_call(struct notifier_block *nb,
cef9dd85
HG
798 unsigned long action, void *data)
799{
800 struct device *dev = data;
e1053963 801 struct i2c_client *client;
cef9dd85
HG
802
803 switch (action) {
804 case BUS_NOTIFY_ADD_DEVICE:
e1053963
DT
805 client = i2c_verify_client(dev);
806 if (client)
74421786 807 ts_dmi_add_props(client);
cef9dd85
HG
808 break;
809
810 default:
811 break;
812 }
813
814 return 0;
815}
816
74421786
HG
817static struct notifier_block ts_dmi_notifier = {
818 .notifier_call = ts_dmi_notifier_call,
cef9dd85
HG
819};
820
74421786 821static int __init ts_dmi_init(void)
cef9dd85 822{
f22265b6 823 const struct dmi_system_id *dmi_id;
cef9dd85
HG
824 int error;
825
74421786 826 dmi_id = dmi_first_match(touchscreen_dmi_table);
f22265b6
DT
827 if (!dmi_id)
828 return 0; /* Not an error */
829
74421786 830 ts_data = dmi_id->driver_data;
f22265b6 831
74421786 832 error = bus_register_notifier(&i2c_bus_type, &ts_dmi_notifier);
cef9dd85
HG
833 if (error)
834 pr_err("%s: failed to register i2c bus notifier: %d\n",
835 __func__, error);
836
837 return error;
838}
839
840/*
841 * We are registering out notifier after i2c core is initialized and i2c bus
842 * itself is ready (which happens at postcore initcall level), but before
843 * ACPI starts enumerating devices (at subsys initcall level).
844 */
74421786 845arch_initcall(ts_dmi_init);