soc-acpi-intel-cml-match.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * soc-acpi-intel-cml-match.c - tables and support for CML ACPI enumeration.
  4. *
  5. * Copyright (c) 2019, Intel Corporation.
  6. *
  7. */
  8. #include <sound/soc-acpi.h>
  9. #include <sound/soc-acpi-intel-match.h>
  10. static const struct snd_soc_acpi_codecs essx_83x6 = {
  11. .num_codecs = 3,
  12. .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
  13. };
  14. static const struct snd_soc_acpi_codecs rt1011_spk_codecs = {
  15. .num_codecs = 1,
  16. .codecs = {"10EC1011"}
  17. };
  18. static const struct snd_soc_acpi_codecs rt1015_spk_codecs = {
  19. .num_codecs = 1,
  20. .codecs = {"10EC1015"}
  21. };
  22. static const struct snd_soc_acpi_codecs max98357a_spk_codecs = {
  23. .num_codecs = 1,
  24. .codecs = {"MX98357A"}
  25. };
  26. static const struct snd_soc_acpi_codecs max98390_spk_codecs = {
  27. .num_codecs = 1,
  28. .codecs = {"MX98390"}
  29. };
  30. /*
  31. * The order of the three entries with .id = "10EC5682" matters
  32. * here, because DSDT tables expose an ACPI HID for the MAX98357A
  33. * speaker amplifier which is not populated on the board.
  34. */
  35. struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
  36. {
  37. .id = "10EC5682",
  38. .drv_name = "cml_rt1011_rt5682",
  39. .machine_quirk = snd_soc_acpi_codec_list,
  40. .quirk_data = &rt1011_spk_codecs,
  41. .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
  42. },
  43. {
  44. .id = "10EC5682",
  45. .drv_name = "cml_rt1015_rt5682",
  46. .machine_quirk = snd_soc_acpi_codec_list,
  47. .quirk_data = &rt1015_spk_codecs,
  48. .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
  49. },
  50. {
  51. .id = "10EC5682",
  52. .drv_name = "sof_rt5682",
  53. .machine_quirk = snd_soc_acpi_codec_list,
  54. .quirk_data = &max98357a_spk_codecs,
  55. .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg",
  56. },
  57. {
  58. .id = "10EC5682",
  59. .drv_name = "sof_rt5682",
  60. .sof_tplg_filename = "sof-cml-rt5682.tplg",
  61. },
  62. {
  63. .id = "DLGS7219",
  64. .drv_name = "cml_da7219_mx98357a",
  65. .machine_quirk = snd_soc_acpi_codec_list,
  66. .quirk_data = &max98357a_spk_codecs,
  67. .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
  68. },
  69. {
  70. .id = "DLGS7219",
  71. .drv_name = "cml_da7219_mx98357a",
  72. .machine_quirk = snd_soc_acpi_codec_list,
  73. .quirk_data = &max98390_spk_codecs,
  74. .sof_tplg_filename = "sof-cml-da7219-max98390.tplg",
  75. },
  76. {
  77. .comp_ids = &essx_83x6,
  78. .drv_name = "sof-essx8336",
  79. .sof_tplg_filename = "sof-cml-es8336", /* the tplg suffix is added at run time */
  80. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
  81. SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
  82. SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
  83. },
  84. {},
  85. };
  86. EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines);
  87. static const struct snd_soc_acpi_endpoint single_endpoint = {
  88. .num = 0,
  89. .aggregated = 0,
  90. .group_position = 0,
  91. .group_id = 0,
  92. };
  93. static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
  94. .num = 0,
  95. .aggregated = 1,
  96. .group_position = 0,
  97. .group_id = 1,
  98. };
  99. static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
  100. .num = 0,
  101. .aggregated = 1,
  102. .group_position = 1,
  103. .group_id = 1,
  104. };
  105. static const struct snd_soc_acpi_adr_device rt700_1_adr[] = {
  106. {
  107. .adr = 0x000110025D070000ull,
  108. .num_endpoints = 1,
  109. .endpoints = &single_endpoint,
  110. .name_prefix = "rt700"
  111. }
  112. };
  113. static const struct snd_soc_acpi_link_adr cml_rvp[] = {
  114. {
  115. .mask = BIT(1),
  116. .num_adr = ARRAY_SIZE(rt700_1_adr),
  117. .adr_d = rt700_1_adr,
  118. },
  119. {}
  120. };
  121. static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
  122. {
  123. .adr = 0x000020025D071100ull,
  124. .num_endpoints = 1,
  125. .endpoints = &single_endpoint,
  126. .name_prefix = "rt711"
  127. }
  128. };
  129. static const struct snd_soc_acpi_adr_device rt1308_1_single_adr[] = {
  130. {
  131. .adr = 0x000120025D130800ull,
  132. .num_endpoints = 1,
  133. .endpoints = &single_endpoint,
  134. .name_prefix = "rt1308-1"
  135. }
  136. };
  137. static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
  138. {
  139. .adr = 0x000120025D130800ull,
  140. .num_endpoints = 1,
  141. .endpoints = &spk_l_endpoint,
  142. .name_prefix = "rt1308-1"
  143. }
  144. };
  145. static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
  146. {
  147. .adr = 0x000220025D130800ull,
  148. .num_endpoints = 1,
  149. .endpoints = &spk_r_endpoint,
  150. .name_prefix = "rt1308-2"
  151. }
  152. };
  153. static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
  154. {
  155. .adr = 0x000320025D071500ull,
  156. .num_endpoints = 1,
  157. .endpoints = &single_endpoint,
  158. .name_prefix = "rt715"
  159. }
  160. };
  161. static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
  162. {
  163. .adr = 0x000030025D071101ull,
  164. .num_endpoints = 1,
  165. .endpoints = &single_endpoint,
  166. .name_prefix = "rt711"
  167. }
  168. };
  169. static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
  170. {
  171. .adr = 0x000131025D131601ull, /* unique ID is set for some reason */
  172. .num_endpoints = 1,
  173. .endpoints = &spk_l_endpoint,
  174. .name_prefix = "rt1316-1"
  175. }
  176. };
  177. static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
  178. {
  179. .adr = 0x000230025D131601ull,
  180. .num_endpoints = 1,
  181. .endpoints = &spk_r_endpoint,
  182. .name_prefix = "rt1316-2"
  183. }
  184. };
  185. static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
  186. {
  187. .adr = 0x000330025D071401ull,
  188. .num_endpoints = 1,
  189. .endpoints = &single_endpoint,
  190. .name_prefix = "rt714"
  191. }
  192. };
  193. static const struct snd_soc_acpi_link_adr cml_3_in_1_default[] = {
  194. {
  195. .mask = BIT(0),
  196. .num_adr = ARRAY_SIZE(rt711_0_adr),
  197. .adr_d = rt711_0_adr,
  198. },
  199. {
  200. .mask = BIT(1),
  201. .num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
  202. .adr_d = rt1308_1_group1_adr,
  203. },
  204. {
  205. .mask = BIT(2),
  206. .num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
  207. .adr_d = rt1308_2_group1_adr,
  208. },
  209. {
  210. .mask = BIT(3),
  211. .num_adr = ARRAY_SIZE(rt715_3_adr),
  212. .adr_d = rt715_3_adr,
  213. },
  214. {}
  215. };
  216. static const struct snd_soc_acpi_link_adr cml_3_in_1_mono_amp[] = {
  217. {
  218. .mask = BIT(0),
  219. .num_adr = ARRAY_SIZE(rt711_0_adr),
  220. .adr_d = rt711_0_adr,
  221. },
  222. {
  223. .mask = BIT(1),
  224. .num_adr = ARRAY_SIZE(rt1308_1_single_adr),
  225. .adr_d = rt1308_1_single_adr,
  226. },
  227. {
  228. .mask = BIT(3),
  229. .num_adr = ARRAY_SIZE(rt715_3_adr),
  230. .adr_d = rt715_3_adr,
  231. },
  232. {}
  233. };
  234. static const struct snd_soc_acpi_link_adr cml_3_in_1_sdca[] = {
  235. {
  236. .mask = BIT(0),
  237. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  238. .adr_d = rt711_sdca_0_adr,
  239. },
  240. {
  241. .mask = BIT(1),
  242. .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
  243. .adr_d = rt1316_1_group1_adr,
  244. },
  245. {
  246. .mask = BIT(2),
  247. .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
  248. .adr_d = rt1316_2_group1_adr,
  249. },
  250. {
  251. .mask = BIT(3),
  252. .num_adr = ARRAY_SIZE(rt714_3_adr),
  253. .adr_d = rt714_3_adr,
  254. },
  255. {}
  256. };
  257. struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_sdw_machines[] = {
  258. {
  259. .link_mask = 0xF, /* 4 active links required */
  260. .links = cml_3_in_1_default,
  261. .drv_name = "sof_sdw",
  262. .sof_tplg_filename = "sof-cml-rt711-rt1308-rt715.tplg",
  263. },
  264. {
  265. .link_mask = 0xF, /* 4 active links required */
  266. .links = cml_3_in_1_sdca,
  267. .drv_name = "sof_sdw",
  268. .sof_tplg_filename = "sof-cml-rt711-rt1316-rt714.tplg",
  269. },
  270. {
  271. /*
  272. * link_mask should be 0xB, but all links are enabled by BIOS.
  273. * This entry will be selected if there is no rt1308 exposed
  274. * on link2 since it will fail to match the above entry.
  275. */
  276. .link_mask = 0xF,
  277. .links = cml_3_in_1_mono_amp,
  278. .drv_name = "sof_sdw",
  279. .sof_tplg_filename = "sof-cml-rt711-rt1308-mono-rt715.tplg",
  280. },
  281. {
  282. .link_mask = 0x2, /* RT700 connected on Link1 */
  283. .links = cml_rvp,
  284. .drv_name = "sof_sdw",
  285. .sof_tplg_filename = "sof-cml-rt700.tplg",
  286. },
  287. {}
  288. };
  289. EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_sdw_machines);