dmi-quirks.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
  2. // Copyright(c) 2021 Intel Corporation.
  3. /*
  4. * Soundwire DMI quirks
  5. */
  6. #include <linux/device.h>
  7. #include <linux/dmi.h>
  8. #include <linux/soundwire/sdw.h>
  9. #include "bus.h"
  10. struct adr_remap {
  11. u64 adr;
  12. u64 remapped_adr;
  13. };
  14. /*
  15. * Some TigerLake devices based on an initial Intel BIOS do not expose
  16. * the correct _ADR in the DSDT.
  17. * Remap the bad _ADR values to the ones reported by hardware
  18. */
  19. static const struct adr_remap intel_tgl_bios[] = {
  20. {
  21. 0x000010025D070100ull,
  22. 0x000020025D071100ull
  23. },
  24. {
  25. 0x000110025d070100ull,
  26. 0x000120025D130800ull
  27. },
  28. {}
  29. };
  30. /*
  31. * The initial version of the Dell SKU 0A3E did not expose the devices
  32. * on the correct links.
  33. */
  34. static const struct adr_remap dell_sku_0A3E[] = {
  35. /* rt715 on link0 */
  36. {
  37. 0x00020025d071100ull,
  38. 0x00021025d071500ull
  39. },
  40. /* rt711 on link1 */
  41. {
  42. 0x000120025d130800ull,
  43. 0x000120025d071100ull,
  44. },
  45. /* rt1308 on link2 */
  46. {
  47. 0x000220025d071500ull,
  48. 0x000220025d130800ull
  49. },
  50. {}
  51. };
  52. /*
  53. * The HP Omen 16-k0005TX does not expose the correct version of RT711 on link0
  54. * and does not expose a RT1316 on link3
  55. */
  56. static const struct adr_remap hp_omen_16[] = {
  57. /* rt711-sdca on link0 */
  58. {
  59. 0x000020025d071100ull,
  60. 0x000030025d071101ull
  61. },
  62. /* rt1316-sdca on link3 */
  63. {
  64. 0x000120025d071100ull,
  65. 0x000330025d131601ull
  66. },
  67. {}
  68. };
  69. /*
  70. * Intel NUC M15 LAPRC510 and LAPRC710
  71. */
  72. static const struct adr_remap intel_rooks_county[] = {
  73. /* rt711-sdca on link0 */
  74. {
  75. 0x000020025d071100ull,
  76. 0x000030025d071101ull
  77. },
  78. /* rt1316-sdca on link2 */
  79. {
  80. 0x000120025d071100ull,
  81. 0x000230025d131601ull
  82. },
  83. {}
  84. };
  85. static const struct dmi_system_id adr_remap_quirk_table[] = {
  86. /* TGL devices */
  87. {
  88. .matches = {
  89. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  90. DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Conv"),
  91. },
  92. .driver_data = (void *)intel_tgl_bios,
  93. },
  94. {
  95. .matches = {
  96. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  97. DMI_MATCH(DMI_BOARD_NAME, "8709"),
  98. },
  99. .driver_data = (void *)intel_tgl_bios,
  100. },
  101. {
  102. /* quirk used for NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
  103. .matches = {
  104. DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
  105. DMI_MATCH(DMI_PRODUCT_NAME, "LAPBC"),
  106. },
  107. .driver_data = (void *)intel_tgl_bios,
  108. },
  109. {
  110. /* quirk used for NUC15 LAPBC710 skew */
  111. .matches = {
  112. DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
  113. DMI_MATCH(DMI_BOARD_NAME, "LAPBC710"),
  114. },
  115. .driver_data = (void *)intel_tgl_bios,
  116. },
  117. {
  118. /* quirk used for NUC15 'Rooks County' LAPRC510 and LAPRC710 skews */
  119. .matches = {
  120. DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
  121. DMI_MATCH(DMI_PRODUCT_NAME, "LAPRC"),
  122. },
  123. .driver_data = (void *)intel_rooks_county,
  124. },
  125. {
  126. .matches = {
  127. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
  128. DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E")
  129. },
  130. .driver_data = (void *)dell_sku_0A3E,
  131. },
  132. /* ADL devices */
  133. {
  134. .matches = {
  135. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  136. DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16"),
  137. },
  138. .driver_data = (void *)hp_omen_16,
  139. },
  140. {}
  141. };
  142. u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr)
  143. {
  144. const struct dmi_system_id *dmi_id;
  145. /* check if any address remap quirk applies */
  146. dmi_id = dmi_first_match(adr_remap_quirk_table);
  147. if (dmi_id) {
  148. struct adr_remap *map;
  149. for (map = dmi_id->driver_data; map->adr; map++) {
  150. if (map->adr == addr) {
  151. dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n",
  152. addr, map->remapped_adr);
  153. addr = map->remapped_adr;
  154. break;
  155. }
  156. }
  157. }
  158. return addr;
  159. }