silead_dmi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. /*
  2. * Silead 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. #include <linux/acpi.h>
  15. #include <linux/device.h>
  16. #include <linux/dmi.h>
  17. #include <linux/i2c.h>
  18. #include <linux/notifier.h>
  19. #include <linux/property.h>
  20. #include <linux/string.h>
  21. struct silead_ts_dmi_data {
  22. const char *acpi_name;
  23. const struct property_entry *properties;
  24. };
  25. static const struct property_entry cube_iwork8_air_props[] = {
  26. PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
  27. PROPERTY_ENTRY_U32("touchscreen-size-y", 900),
  28. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  29. PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-cube-iwork8-air.fw"),
  30. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  31. { }
  32. };
  33. static const struct silead_ts_dmi_data cube_iwork8_air_data = {
  34. .acpi_name = "MSSL1680:00",
  35. .properties = cube_iwork8_air_props,
  36. };
  37. static const struct property_entry jumper_ezpad_mini3_props[] = {
  38. PROPERTY_ENTRY_U32("touchscreen-size-x", 1700),
  39. PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
  40. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  41. PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-jumper-ezpad-mini3.fw"),
  42. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  43. { }
  44. };
  45. static const struct silead_ts_dmi_data jumper_ezpad_mini3_data = {
  46. .acpi_name = "MSSL1680:00",
  47. .properties = jumper_ezpad_mini3_props,
  48. };
  49. static const struct property_entry dexp_ursus_7w_props[] = {
  50. PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
  51. PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
  52. PROPERTY_ENTRY_STRING("firmware-name", "gsl1686-dexp-ursus-7w.fw"),
  53. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  54. PROPERTY_ENTRY_BOOL("silead,home-button"),
  55. { }
  56. };
  57. static const struct silead_ts_dmi_data dexp_ursus_7w_data = {
  58. .acpi_name = "MSSL1680:00",
  59. .properties = dexp_ursus_7w_props,
  60. };
  61. static const struct property_entry surftab_twin_10_1_st10432_8_props[] = {
  62. PROPERTY_ENTRY_U32("touchscreen-size-x", 1900),
  63. PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
  64. PROPERTY_ENTRY_U32("touchscreen-inverted-y", 1),
  65. PROPERTY_ENTRY_STRING("firmware-name",
  66. "gsl3670-surftab-twin-10-1-st10432-8.fw"),
  67. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  68. { }
  69. };
  70. static const struct silead_ts_dmi_data surftab_twin_10_1_st10432_8_data = {
  71. .acpi_name = "MSSL1680:00",
  72. .properties = surftab_twin_10_1_st10432_8_props,
  73. };
  74. static const struct property_entry surftab_wintron70_st70416_6_props[] = {
  75. PROPERTY_ENTRY_U32("touchscreen-size-x", 884),
  76. PROPERTY_ENTRY_U32("touchscreen-size-y", 632),
  77. PROPERTY_ENTRY_STRING("firmware-name",
  78. "gsl1686-surftab-wintron70-st70416-6.fw"),
  79. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  80. PROPERTY_ENTRY_BOOL("silead,home-button"),
  81. { }
  82. };
  83. static const struct silead_ts_dmi_data surftab_wintron70_st70416_6_data = {
  84. .acpi_name = "MSSL1680:00",
  85. .properties = surftab_wintron70_st70416_6_props,
  86. };
  87. static const struct property_entry gp_electronic_t701_props[] = {
  88. PROPERTY_ENTRY_U32("touchscreen-size-x", 960),
  89. PROPERTY_ENTRY_U32("touchscreen-size-y", 640),
  90. PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
  91. PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
  92. PROPERTY_ENTRY_STRING("firmware-name",
  93. "gsl1680-gp-electronic-t701.fw"),
  94. { }
  95. };
  96. static const struct silead_ts_dmi_data gp_electronic_t701_data = {
  97. .acpi_name = "MSSL1680:00",
  98. .properties = gp_electronic_t701_props,
  99. };
  100. static const struct property_entry pipo_w2s_props[] = {
  101. PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
  102. PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
  103. PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
  104. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  105. PROPERTY_ENTRY_STRING("firmware-name",
  106. "gsl1680-pipo-w2s.fw"),
  107. { }
  108. };
  109. static const struct silead_ts_dmi_data pipo_w2s_data = {
  110. .acpi_name = "MSSL1680:00",
  111. .properties = pipo_w2s_props,
  112. };
  113. static const struct property_entry pov_mobii_wintab_p800w_props[] = {
  114. PROPERTY_ENTRY_U32("touchscreen-size-x", 1800),
  115. PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
  116. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  117. PROPERTY_ENTRY_STRING("firmware-name",
  118. "gsl3692-pov-mobii-wintab-p800w.fw"),
  119. PROPERTY_ENTRY_BOOL("silead,home-button"),
  120. { }
  121. };
  122. static const struct silead_ts_dmi_data pov_mobii_wintab_p800w_data = {
  123. .acpi_name = "MSSL1680:00",
  124. .properties = pov_mobii_wintab_p800w_props,
  125. };
  126. static const struct property_entry itworks_tw891_props[] = {
  127. PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
  128. PROPERTY_ENTRY_U32("touchscreen-size-y", 890),
  129. PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
  130. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  131. PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-itworks-tw891.fw"),
  132. { }
  133. };
  134. static const struct silead_ts_dmi_data itworks_tw891_data = {
  135. .acpi_name = "MSSL1680:00",
  136. .properties = itworks_tw891_props,
  137. };
  138. static const struct property_entry chuwi_hi8_pro_props[] = {
  139. PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
  140. PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
  141. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  142. PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hi8-pro.fw"),
  143. PROPERTY_ENTRY_BOOL("silead,home-button"),
  144. { }
  145. };
  146. static const struct silead_ts_dmi_data chuwi_hi8_pro_data = {
  147. .acpi_name = "MSSL1680:00",
  148. .properties = chuwi_hi8_pro_props,
  149. };
  150. static const struct property_entry digma_citi_e200_props[] = {
  151. PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
  152. PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
  153. PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
  154. PROPERTY_ENTRY_STRING("firmware-name",
  155. "gsl1686-digma_citi_e200.fw"),
  156. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  157. PROPERTY_ENTRY_BOOL("silead,home-button"),
  158. { }
  159. };
  160. static const struct silead_ts_dmi_data digma_citi_e200_data = {
  161. .acpi_name = "MSSL1680:00",
  162. .properties = digma_citi_e200_props,
  163. };
  164. static const struct property_entry onda_obook_20_plus_props[] = {
  165. PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
  166. PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
  167. PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
  168. PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
  169. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  170. PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-onda-obook-20-plus.fw"),
  171. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  172. PROPERTY_ENTRY_BOOL("silead,home-button"),
  173. { }
  174. };
  175. static const struct silead_ts_dmi_data onda_obook_20_plus_data = {
  176. .acpi_name = "MSSL1680:00",
  177. .properties = onda_obook_20_plus_props,
  178. };
  179. static const struct property_entry chuwi_hi8_props[] = {
  180. PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
  181. PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
  182. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  183. PROPERTY_ENTRY_BOOL("silead,home-button"),
  184. PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi8.fw"),
  185. { }
  186. };
  187. static const struct silead_ts_dmi_data chuwi_hi8_data = {
  188. .acpi_name = "MSSL0001:00",
  189. .properties = chuwi_hi8_props,
  190. };
  191. static const struct property_entry chuwi_vi8_props[] = {
  192. PROPERTY_ENTRY_U32("touchscreen-size-x", 1724),
  193. PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
  194. PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
  195. PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-chuwi-vi8.fw"),
  196. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  197. PROPERTY_ENTRY_BOOL("silead,home-button"),
  198. { }
  199. };
  200. static const struct silead_ts_dmi_data chuwi_vi8_data = {
  201. .acpi_name = "MSSL1680:00",
  202. .properties = chuwi_vi8_props,
  203. };
  204. static const struct property_entry trekstor_primebook_c13_props[] = {
  205. PROPERTY_ENTRY_U32("touchscreen-size-x", 2624),
  206. PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
  207. PROPERTY_ENTRY_STRING("firmware-name",
  208. "gsl1680-trekstor-primebook-c13.fw"),
  209. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  210. PROPERTY_ENTRY_BOOL("silead,home-button"),
  211. { }
  212. };
  213. static const struct silead_ts_dmi_data trekstor_primebook_c13_data = {
  214. .acpi_name = "MSSL1680:00",
  215. .properties = trekstor_primebook_c13_props,
  216. };
  217. static const struct property_entry teclast_x98plus2_props[] = {
  218. PROPERTY_ENTRY_U32("touchscreen-size-x", 2048),
  219. PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
  220. PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
  221. PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
  222. PROPERTY_ENTRY_STRING("firmware-name",
  223. "gsl1686-teclast_x98plus2.fw"),
  224. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  225. { }
  226. };
  227. static const struct silead_ts_dmi_data teclast_x98plus2_data = {
  228. .acpi_name = "MSSL1680:00",
  229. .properties = teclast_x98plus2_props,
  230. };
  231. static const struct property_entry teclast_x3_plus_props[] = {
  232. PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
  233. PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
  234. PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-teclast-x3-plus.fw"),
  235. PROPERTY_ENTRY_U32("silead,max-fingers", 10),
  236. PROPERTY_ENTRY_BOOL("silead,home-button"),
  237. { }
  238. };
  239. static const struct silead_ts_dmi_data teclast_x3_plus_data = {
  240. .acpi_name = "MSSL1680:00",
  241. .properties = teclast_x3_plus_props,
  242. };
  243. static const struct dmi_system_id silead_ts_dmi_table[] = {
  244. {
  245. /* CUBE iwork8 Air */
  246. .driver_data = (void *)&cube_iwork8_air_data,
  247. .matches = {
  248. DMI_MATCH(DMI_SYS_VENDOR, "cube"),
  249. DMI_MATCH(DMI_PRODUCT_NAME, "i1-TF"),
  250. DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
  251. },
  252. },
  253. {
  254. /* Jumper EZpad mini3 */
  255. .driver_data = (void *)&jumper_ezpad_mini3_data,
  256. .matches = {
  257. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  258. /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
  259. DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
  260. },
  261. },
  262. {
  263. /* DEXP Ursus 7W */
  264. .driver_data = (void *)&dexp_ursus_7w_data,
  265. .matches = {
  266. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  267. DMI_MATCH(DMI_PRODUCT_NAME, "7W"),
  268. },
  269. },
  270. {
  271. /* TrekStor SurfTab twin 10.1 ST10432-8 */
  272. .driver_data = (void *)&surftab_twin_10_1_st10432_8_data,
  273. .matches = {
  274. DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
  275. DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab twin 10.1"),
  276. },
  277. },
  278. {
  279. /* Trekstor Surftab Wintron 7.0 ST70416-6 */
  280. .driver_data = (void *)&surftab_wintron70_st70416_6_data,
  281. .matches = {
  282. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  283. DMI_MATCH(DMI_PRODUCT_NAME, "ST70416-6"),
  284. /* Exact match, different versions need different fw */
  285. DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA04"),
  286. },
  287. },
  288. {
  289. /* Trekstor Surftab Wintron 7.0 ST70416-6, newer BIOS */
  290. .driver_data = (void *)&surftab_wintron70_st70416_6_data,
  291. .matches = {
  292. DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
  293. DMI_MATCH(DMI_PRODUCT_NAME,
  294. "SurfTab wintron 7.0 ST70416-6"),
  295. /* Exact match, different versions need different fw */
  296. DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA05"),
  297. },
  298. },
  299. {
  300. /* Ployer Momo7w (same hardware as the Trekstor ST70416-6) */
  301. .driver_data = (void *)&surftab_wintron70_st70416_6_data,
  302. .matches = {
  303. DMI_MATCH(DMI_SYS_VENDOR, "Shenzhen PLOYER"),
  304. DMI_MATCH(DMI_PRODUCT_NAME, "MOMO7W"),
  305. /* Exact match, different versions need different fw */
  306. DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"),
  307. },
  308. },
  309. {
  310. /* GP-electronic T701 */
  311. .driver_data = (void *)&gp_electronic_t701_data,
  312. .matches = {
  313. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  314. DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
  315. DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
  316. },
  317. },
  318. {
  319. /* Pipo W2S */
  320. .driver_data = (void *)&pipo_w2s_data,
  321. .matches = {
  322. DMI_MATCH(DMI_SYS_VENDOR, "PIPO"),
  323. DMI_MATCH(DMI_PRODUCT_NAME, "W2S"),
  324. },
  325. },
  326. {
  327. /* Point of View mobii wintab p800w */
  328. .driver_data = (void *)&pov_mobii_wintab_p800w_data,
  329. .matches = {
  330. DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
  331. DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
  332. DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
  333. /* Above matches are too generic, add bios-date match */
  334. DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
  335. },
  336. },
  337. {
  338. /* I.T.Works TW891 */
  339. .driver_data = (void *)&itworks_tw891_data,
  340. .matches = {
  341. DMI_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
  342. DMI_MATCH(DMI_PRODUCT_NAME, "TW891"),
  343. },
  344. },
  345. {
  346. /* Chuwi Hi8 Pro */
  347. .driver_data = (void *)&chuwi_hi8_pro_data,
  348. .matches = {
  349. DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
  350. DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
  351. },
  352. },
  353. {
  354. /* Digma Citi E200 */
  355. .driver_data = (void *)&digma_citi_e200_data,
  356. .matches = {
  357. DMI_MATCH(DMI_SYS_VENDOR, "Digma"),
  358. DMI_MATCH(DMI_PRODUCT_NAME, "CITI E200"),
  359. DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
  360. },
  361. },
  362. {
  363. /* Onda oBook 20 Plus */
  364. .driver_data = (void *)&onda_obook_20_plus_data,
  365. .matches = {
  366. DMI_MATCH(DMI_SYS_VENDOR, "ONDA"),
  367. DMI_MATCH(DMI_PRODUCT_NAME, "OBOOK 20 PLUS"),
  368. },
  369. },
  370. {
  371. /* Chuwi Hi8 */
  372. .driver_data = (void *)&chuwi_hi8_data,
  373. .matches = {
  374. DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
  375. DMI_MATCH(DMI_PRODUCT_NAME, "S806"),
  376. },
  377. },
  378. {
  379. /* Chuwi Vi8 (CWI506) */
  380. .driver_data = (void *)&chuwi_vi8_data,
  381. .matches = {
  382. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  383. DMI_MATCH(DMI_PRODUCT_NAME, "i86"),
  384. DMI_MATCH(DMI_BIOS_VERSION, "CHUWI.D86JLBNR"),
  385. },
  386. },
  387. {
  388. /* Trekstor Primebook C13 */
  389. .driver_data = (void *)&trekstor_primebook_c13_data,
  390. .matches = {
  391. DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
  392. DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
  393. },
  394. },
  395. {
  396. /* Teclast X98 Plus II */
  397. .driver_data = (void *)&teclast_x98plus2_data,
  398. .matches = {
  399. DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
  400. DMI_MATCH(DMI_PRODUCT_NAME, "X98 Plus II"),
  401. },
  402. },
  403. {
  404. /* Teclast X3 Plus */
  405. .driver_data = (void *)&teclast_x3_plus_data,
  406. .matches = {
  407. DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
  408. DMI_MATCH(DMI_PRODUCT_NAME, "X3 Plus"),
  409. DMI_MATCH(DMI_BOARD_NAME, "X3 Plus"),
  410. },
  411. },
  412. {
  413. /* I.T.Works TW701 */
  414. .driver_data = (void *)&surftab_wintron70_st70416_6_data,
  415. .matches = {
  416. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  417. DMI_MATCH(DMI_PRODUCT_NAME, "i71c"),
  418. DMI_MATCH(DMI_BIOS_VERSION, "itWORKS.G.WI71C.JGBMRB"),
  419. },
  420. },
  421. {
  422. /* Yours Y8W81, same case and touchscreen as Chuwi Vi8 */
  423. .driver_data = (void *)&chuwi_vi8_data,
  424. .matches = {
  425. DMI_MATCH(DMI_SYS_VENDOR, "YOURS"),
  426. DMI_MATCH(DMI_PRODUCT_NAME, "Y8W81"),
  427. },
  428. },
  429. { },
  430. };
  431. static const struct silead_ts_dmi_data *silead_ts_data;
  432. static void silead_ts_dmi_add_props(struct i2c_client *client)
  433. {
  434. struct device *dev = &client->dev;
  435. int error;
  436. if (has_acpi_companion(dev) &&
  437. !strncmp(silead_ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
  438. error = device_add_properties(dev, silead_ts_data->properties);
  439. if (error)
  440. dev_err(dev, "failed to add properties: %d\n", error);
  441. }
  442. }
  443. static int silead_ts_dmi_notifier_call(struct notifier_block *nb,
  444. unsigned long action, void *data)
  445. {
  446. struct device *dev = data;
  447. struct i2c_client *client;
  448. switch (action) {
  449. case BUS_NOTIFY_ADD_DEVICE:
  450. client = i2c_verify_client(dev);
  451. if (client)
  452. silead_ts_dmi_add_props(client);
  453. break;
  454. default:
  455. break;
  456. }
  457. return 0;
  458. }
  459. static struct notifier_block silead_ts_dmi_notifier = {
  460. .notifier_call = silead_ts_dmi_notifier_call,
  461. };
  462. static int __init silead_ts_dmi_init(void)
  463. {
  464. const struct dmi_system_id *dmi_id;
  465. int error;
  466. dmi_id = dmi_first_match(silead_ts_dmi_table);
  467. if (!dmi_id)
  468. return 0; /* Not an error */
  469. silead_ts_data = dmi_id->driver_data;
  470. error = bus_register_notifier(&i2c_bus_type, &silead_ts_dmi_notifier);
  471. if (error)
  472. pr_err("%s: failed to register i2c bus notifier: %d\n",
  473. __func__, error);
  474. return error;
  475. }
  476. /*
  477. * We are registering out notifier after i2c core is initialized and i2c bus
  478. * itself is ready (which happens at postcore initcall level), but before
  479. * ACPI starts enumerating devices (at subsys initcall level).
  480. */
  481. arch_initcall(silead_ts_dmi_init);