soc-acpi-intel-cht-match.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * soc-acpi-intel-cht-match.c - tables and support for CHT ACPI enumeration.
  4. *
  5. * Copyright (c) 2017, Intel Corporation.
  6. */
  7. #include <linux/dmi.h>
  8. #include <sound/soc-acpi.h>
  9. #include <sound/soc-acpi-intel-match.h>
  10. static unsigned long cht_machine_id;
  11. #define CHT_SURFACE_MACH 1
  12. static int cht_surface_quirk_cb(const struct dmi_system_id *id)
  13. {
  14. cht_machine_id = CHT_SURFACE_MACH;
  15. return 1;
  16. }
  17. static const struct dmi_system_id cht_table[] = {
  18. {
  19. .callback = cht_surface_quirk_cb,
  20. .matches = {
  21. DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
  22. DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
  23. },
  24. },
  25. { }
  26. };
  27. static struct snd_soc_acpi_mach cht_surface_mach = {
  28. .id = "10EC5640",
  29. .drv_name = "cht-bsw-rt5645",
  30. .fw_filename = "intel/fw_sst_22a8.bin",
  31. .board = "cht-bsw",
  32. .sof_tplg_filename = "sof-cht-rt5645.tplg",
  33. };
  34. static struct snd_soc_acpi_mach *cht_quirk(void *arg)
  35. {
  36. struct snd_soc_acpi_mach *mach = arg;
  37. dmi_check_system(cht_table);
  38. if (cht_machine_id == CHT_SURFACE_MACH)
  39. return &cht_surface_mach;
  40. else
  41. return mach;
  42. }
  43. /*
  44. * Some tablets with Android factory OS have buggy DSDTs with an ESSX8316 device
  45. * in the ACPI tables. While they are not using an ESS8316 codec. These DSDTs
  46. * also have an ACPI device for the correct codec, ignore the ESSX8316.
  47. */
  48. static const struct dmi_system_id cht_ess8316_not_present_table[] = {
  49. {
  50. /* Nextbook Ares 8A */
  51. .matches = {
  52. DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
  53. DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),
  54. DMI_MATCH(DMI_BIOS_VERSION, "M882"),
  55. },
  56. },
  57. { }
  58. };
  59. static struct snd_soc_acpi_mach *cht_ess8316_quirk(void *arg)
  60. {
  61. if (dmi_check_system(cht_ess8316_not_present_table))
  62. return NULL;
  63. return arg;
  64. }
  65. /*
  66. * The Lenovo Yoga Tab 3 Pro YT3-X90, with Android factory OS has a buggy DSDT
  67. * with the coded not being listed at all.
  68. */
  69. static const struct dmi_system_id lenovo_yoga_tab3_x90[] = {
  70. {
  71. /* Lenovo Yoga Tab 3 Pro YT3-X90, codec missing from DSDT */
  72. .matches = {
  73. DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
  74. DMI_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
  75. DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
  76. },
  77. },
  78. { }
  79. };
  80. static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach = {
  81. .id = "10WM5102",
  82. .drv_name = "bytcr_wm5102",
  83. .fw_filename = "intel/fw_sst_22a8.bin",
  84. .board = "bytcr_wm5102",
  85. .sof_tplg_filename = "sof-cht-wm5102.tplg",
  86. };
  87. static struct snd_soc_acpi_mach *lenovo_yt3_x90_quirk(void *arg)
  88. {
  89. if (dmi_check_system(lenovo_yoga_tab3_x90))
  90. return &cht_lenovo_yoga_tab3_x90_mach;
  91. /* Skip wildcard match snd_soc_acpi_intel_cherrytrail_machines[] entry */
  92. return NULL;
  93. }
  94. static const struct snd_soc_acpi_codecs rt5640_comp_ids = {
  95. .num_codecs = 2,
  96. .codecs = { "10EC5640", "10EC3276" },
  97. };
  98. static const struct snd_soc_acpi_codecs rt5670_comp_ids = {
  99. .num_codecs = 2,
  100. .codecs = { "10EC5670", "10EC5672" },
  101. };
  102. static const struct snd_soc_acpi_codecs rt5645_comp_ids = {
  103. .num_codecs = 3,
  104. .codecs = { "10EC5645", "10EC5650", "10EC3270" },
  105. };
  106. static const struct snd_soc_acpi_codecs da7213_comp_ids = {
  107. .num_codecs = 2,
  108. .codecs = { "DGLS7212", "DGLS7213"},
  109. };
  110. /* Cherryview-based platforms: CherryTrail and Braswell */
  111. struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[] = {
  112. {
  113. .comp_ids = &rt5670_comp_ids,
  114. .drv_name = "cht-bsw-rt5672",
  115. .fw_filename = "intel/fw_sst_22a8.bin",
  116. .board = "cht-bsw",
  117. .sof_tplg_filename = "sof-cht-rt5670.tplg",
  118. },
  119. {
  120. .comp_ids = &rt5645_comp_ids,
  121. .drv_name = "cht-bsw-rt5645",
  122. .fw_filename = "intel/fw_sst_22a8.bin",
  123. .board = "cht-bsw",
  124. .sof_tplg_filename = "sof-cht-rt5645.tplg",
  125. },
  126. {
  127. .id = "193C9890",
  128. .drv_name = "cht-bsw-max98090",
  129. .fw_filename = "intel/fw_sst_22a8.bin",
  130. .board = "cht-bsw",
  131. .sof_tplg_filename = "sof-cht-max98090.tplg",
  132. },
  133. {
  134. .id = "10508824",
  135. .drv_name = "cht-bsw-nau8824",
  136. .fw_filename = "intel/fw_sst_22a8.bin",
  137. .board = "cht-bsw",
  138. .sof_tplg_filename = "sof-cht-nau8824.tplg",
  139. },
  140. {
  141. .comp_ids = &da7213_comp_ids,
  142. .drv_name = "bytcht_da7213",
  143. .fw_filename = "intel/fw_sst_22a8.bin",
  144. .board = "bytcht_da7213",
  145. .sof_tplg_filename = "sof-cht-da7213.tplg",
  146. },
  147. {
  148. .id = "ESSX8316",
  149. .drv_name = "bytcht_es8316",
  150. .fw_filename = "intel/fw_sst_22a8.bin",
  151. .board = "bytcht_es8316",
  152. .machine_quirk = cht_ess8316_quirk,
  153. .sof_tplg_filename = "sof-cht-es8316.tplg",
  154. },
  155. /* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
  156. {
  157. .comp_ids = &rt5640_comp_ids,
  158. .drv_name = "bytcr_rt5640",
  159. .fw_filename = "intel/fw_sst_22a8.bin",
  160. .board = "bytcr_rt5640",
  161. .machine_quirk = cht_quirk,
  162. .sof_tplg_filename = "sof-cht-rt5640.tplg",
  163. },
  164. {
  165. .id = "10EC5682",
  166. .drv_name = "sof_rt5682",
  167. .sof_tplg_filename = "sof-cht-rt5682.tplg",
  168. },
  169. /* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
  170. {
  171. .id = "10EC5651",
  172. .drv_name = "bytcr_rt5651",
  173. .fw_filename = "intel/fw_sst_22a8.bin",
  174. .board = "bytcr_rt5651",
  175. .sof_tplg_filename = "sof-cht-rt5651.tplg",
  176. },
  177. {
  178. .id = "14F10720",
  179. .drv_name = "bytcht_cx2072x",
  180. .fw_filename = "intel/fw_sst_22a8.bin",
  181. .board = "bytcht_cx2072x",
  182. .sof_tplg_filename = "sof-cht-cx2072x.tplg",
  183. },
  184. {
  185. .id = "104C5122",
  186. .drv_name = "sof_pcm512x",
  187. .sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg",
  188. },
  189. /*
  190. * Special case for the Lenovo Yoga Tab 3 Pro YT3-X90 where the DSDT
  191. * misses the codec. Match on the SST id instead, lenovo_yt3_x90_quirk()
  192. * will return a YT3 specific mach or NULL when called on other hw,
  193. * skipping this entry.
  194. */
  195. {
  196. .id = "808622A8",
  197. .machine_quirk = lenovo_yt3_x90_quirk,
  198. },
  199. #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
  200. /*
  201. * This is always last in the table so that it is selected only when
  202. * enabled explicitly and there is no codec-related information in SSDT
  203. */
  204. {
  205. .id = "808622A8",
  206. .drv_name = "bytcht_nocodec",
  207. .fw_filename = "intel/fw_sst_22a8.bin",
  208. .board = "bytcht_nocodec",
  209. },
  210. #endif
  211. {},
  212. };
  213. EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines);