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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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_VERSION, "Blade3-10A-001"),
  75. },
  76. },
  77. { }
  78. };
  79. static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach = {
  80. .id = "10WM5102",
  81. .drv_name = "bytcr_wm5102",
  82. .fw_filename = "intel/fw_sst_22a8.bin",
  83. .board = "bytcr_wm5102",
  84. .sof_tplg_filename = "sof-cht-wm5102.tplg",
  85. };
  86. static struct snd_soc_acpi_mach *lenovo_yt3_x90_quirk(void *arg)
  87. {
  88. if (dmi_check_system(lenovo_yoga_tab3_x90))
  89. return &cht_lenovo_yoga_tab3_x90_mach;
  90. /* Skip wildcard match snd_soc_acpi_intel_cherrytrail_machines[] entry */
  91. return NULL;
  92. }
  93. static const struct snd_soc_acpi_codecs rt5640_comp_ids = {
  94. .num_codecs = 2,
  95. .codecs = { "10EC5640", "10EC3276" },
  96. };
  97. static const struct snd_soc_acpi_codecs rt5670_comp_ids = {
  98. .num_codecs = 2,
  99. .codecs = { "10EC5670", "10EC5672" },
  100. };
  101. static const struct snd_soc_acpi_codecs rt5645_comp_ids = {
  102. .num_codecs = 3,
  103. .codecs = { "10EC5645", "10EC5650", "10EC3270" },
  104. };
  105. static const struct snd_soc_acpi_codecs da7213_comp_ids = {
  106. .num_codecs = 2,
  107. .codecs = { "DGLS7212", "DGLS7213"},
  108. };
  109. /* Cherryview-based platforms: CherryTrail and Braswell */
  110. struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[] = {
  111. {
  112. .comp_ids = &rt5670_comp_ids,
  113. .drv_name = "cht-bsw-rt5672",
  114. .fw_filename = "intel/fw_sst_22a8.bin",
  115. .board = "cht-bsw",
  116. .sof_tplg_filename = "sof-cht-rt5670.tplg",
  117. },
  118. {
  119. .comp_ids = &rt5645_comp_ids,
  120. .drv_name = "cht-bsw-rt5645",
  121. .fw_filename = "intel/fw_sst_22a8.bin",
  122. .board = "cht-bsw",
  123. .sof_tplg_filename = "sof-cht-rt5645.tplg",
  124. },
  125. {
  126. .id = "193C9890",
  127. .drv_name = "cht-bsw-max98090",
  128. .fw_filename = "intel/fw_sst_22a8.bin",
  129. .board = "cht-bsw",
  130. .sof_tplg_filename = "sof-cht-max98090.tplg",
  131. },
  132. {
  133. .id = "10508824",
  134. .drv_name = "cht-bsw-nau8824",
  135. .fw_filename = "intel/fw_sst_22a8.bin",
  136. .board = "cht-bsw",
  137. .sof_tplg_filename = "sof-cht-nau8824.tplg",
  138. },
  139. {
  140. .comp_ids = &da7213_comp_ids,
  141. .drv_name = "bytcht_da7213",
  142. .fw_filename = "intel/fw_sst_22a8.bin",
  143. .board = "bytcht_da7213",
  144. .sof_tplg_filename = "sof-cht-da7213.tplg",
  145. },
  146. {
  147. .id = "ESSX8316",
  148. .drv_name = "bytcht_es8316",
  149. .fw_filename = "intel/fw_sst_22a8.bin",
  150. .board = "bytcht_es8316",
  151. .machine_quirk = cht_ess8316_quirk,
  152. .sof_tplg_filename = "sof-cht-es8316.tplg",
  153. },
  154. /* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
  155. {
  156. .comp_ids = &rt5640_comp_ids,
  157. .drv_name = "bytcr_rt5640",
  158. .fw_filename = "intel/fw_sst_22a8.bin",
  159. .board = "bytcr_rt5640",
  160. .machine_quirk = cht_quirk,
  161. .sof_tplg_filename = "sof-cht-rt5640.tplg",
  162. },
  163. {
  164. .id = "10EC5682",
  165. .drv_name = "sof_rt5682",
  166. .sof_tplg_filename = "sof-cht-rt5682.tplg",
  167. },
  168. /* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
  169. {
  170. .id = "10EC5651",
  171. .drv_name = "bytcr_rt5651",
  172. .fw_filename = "intel/fw_sst_22a8.bin",
  173. .board = "bytcr_rt5651",
  174. .sof_tplg_filename = "sof-cht-rt5651.tplg",
  175. },
  176. {
  177. .id = "14F10720",
  178. .drv_name = "bytcht_cx2072x",
  179. .fw_filename = "intel/fw_sst_22a8.bin",
  180. .board = "bytcht_cx2072x",
  181. .sof_tplg_filename = "sof-cht-cx2072x.tplg",
  182. },
  183. {
  184. .id = "104C5122",
  185. .drv_name = "sof_pcm512x",
  186. .sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg",
  187. },
  188. /*
  189. * Special case for the Lenovo Yoga Tab 3 Pro YT3-X90 where the DSDT
  190. * misses the codec. Match on the SST id instead, lenovo_yt3_x90_quirk()
  191. * will return a YT3 specific mach or NULL when called on other hw,
  192. * skipping this entry.
  193. */
  194. {
  195. .id = "808622A8",
  196. .machine_quirk = lenovo_yt3_x90_quirk,
  197. },
  198. #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
  199. /*
  200. * This is always last in the table so that it is selected only when
  201. * enabled explicitly and there is no codec-related information in SSDT
  202. */
  203. {
  204. .id = "808622A8",
  205. .drv_name = "bytcht_nocodec",
  206. .fw_filename = "intel/fw_sst_22a8.bin",
  207. .board = "bytcht_nocodec",
  208. },
  209. #endif
  210. {},
  211. };
  212. EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines);