soc-acpi-intel-rpl-match.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * soc-apci-intel-rpl-match.c - tables and support for RPL ACPI enumeration.
  4. *
  5. * Copyright (c) 2022 Intel Corporation.
  6. */
  7. #include <sound/soc-acpi.h>
  8. #include <sound/soc-acpi-intel-match.h>
  9. #include <sound/soc-acpi-intel-ssp-common.h>
  10. static const struct snd_soc_acpi_endpoint single_endpoint = {
  11. .num = 0,
  12. .aggregated = 0,
  13. .group_position = 0,
  14. .group_id = 0,
  15. };
  16. static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
  17. .num = 0,
  18. .aggregated = 1,
  19. .group_position = 0,
  20. .group_id = 1,
  21. };
  22. static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
  23. .num = 0,
  24. .aggregated = 1,
  25. .group_position = 1,
  26. .group_id = 1,
  27. };
  28. static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
  29. { /* Jack Playback Endpoint */
  30. .num = 0,
  31. .aggregated = 0,
  32. .group_position = 0,
  33. .group_id = 0,
  34. },
  35. { /* DMIC Capture Endpoint */
  36. .num = 1,
  37. .aggregated = 0,
  38. .group_position = 0,
  39. .group_id = 0,
  40. },
  41. { /* Jack Capture Endpoint */
  42. .num = 2,
  43. .aggregated = 0,
  44. .group_position = 0,
  45. .group_id = 0,
  46. },
  47. { /* Speaker Playback Endpoint */
  48. .num = 3,
  49. .aggregated = 0,
  50. .group_position = 0,
  51. .group_id = 0,
  52. },
  53. };
  54. static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
  55. {
  56. .adr = 0x00003001FA424301ull,
  57. .num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
  58. .endpoints = cs42l43_endpoints,
  59. .name_prefix = "cs42l43"
  60. }
  61. };
  62. static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
  63. {
  64. .adr = 0x000020025D071100ull,
  65. .num_endpoints = 1,
  66. .endpoints = &single_endpoint,
  67. .name_prefix = "rt711"
  68. }
  69. };
  70. static const struct snd_soc_acpi_link_adr rpl_rvp[] = {
  71. {
  72. .mask = BIT(0),
  73. .num_adr = ARRAY_SIZE(rt711_0_adr),
  74. .adr_d = rt711_0_adr,
  75. },
  76. {}
  77. };
  78. static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
  79. {
  80. .adr = 0x000030025D071101ull,
  81. .num_endpoints = 1,
  82. .endpoints = &single_endpoint,
  83. .name_prefix = "rt711"
  84. }
  85. };
  86. static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = {
  87. {
  88. .adr = 0x000230025D071101ull,
  89. .num_endpoints = 1,
  90. .endpoints = &single_endpoint,
  91. .name_prefix = "rt711"
  92. }
  93. };
  94. static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
  95. {
  96. .adr = 0x000131025D131601ull, /* unique ID is set for some reason */
  97. .num_endpoints = 1,
  98. .endpoints = &spk_l_endpoint,
  99. .name_prefix = "rt1316-1"
  100. }
  101. };
  102. static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
  103. {
  104. .adr = 0x000230025D131601ull,
  105. .num_endpoints = 1,
  106. .endpoints = &spk_r_endpoint,
  107. .name_prefix = "rt1316-2"
  108. }
  109. };
  110. static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
  111. {
  112. .adr = 0x000330025D131601ull,
  113. .num_endpoints = 1,
  114. .endpoints = &spk_r_endpoint,
  115. .name_prefix = "rt1316-2"
  116. }
  117. };
  118. static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = {
  119. {
  120. .adr = 0x000030025D131601ull,
  121. .num_endpoints = 1,
  122. .endpoints = &spk_l_endpoint,
  123. .name_prefix = "rt1316-1"
  124. }
  125. };
  126. static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
  127. {
  128. .adr = 0x000131025D131601ull,
  129. .num_endpoints = 1,
  130. .endpoints = &spk_r_endpoint,
  131. .name_prefix = "rt1316-2"
  132. }
  133. };
  134. static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = {
  135. {
  136. .adr = 0x000132025D131801ull,
  137. .num_endpoints = 1,
  138. .endpoints = &spk_l_endpoint,
  139. .name_prefix = "rt1318-1"
  140. }
  141. };
  142. static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
  143. {
  144. .adr = 0x000230025D131801ull,
  145. .num_endpoints = 1,
  146. .endpoints = &spk_r_endpoint,
  147. .name_prefix = "rt1318-2"
  148. }
  149. };
  150. static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
  151. {
  152. .adr = 0x000030025D071401ull,
  153. .num_endpoints = 1,
  154. .endpoints = &single_endpoint,
  155. .name_prefix = "rt714"
  156. }
  157. };
  158. static const struct snd_soc_acpi_adr_device rt714_2_adr[] = {
  159. {
  160. .adr = 0x000230025D071401ull,
  161. .num_endpoints = 1,
  162. .endpoints = &single_endpoint,
  163. .name_prefix = "rt714"
  164. }
  165. };
  166. static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
  167. {
  168. .adr = 0x000330025D071401ull,
  169. .num_endpoints = 1,
  170. .endpoints = &single_endpoint,
  171. .name_prefix = "rt714"
  172. }
  173. };
  174. static const struct snd_soc_acpi_link_adr rpl_cs42l43_l0[] = {
  175. {
  176. .mask = BIT(0),
  177. .num_adr = ARRAY_SIZE(cs42l43_0_adr),
  178. .adr_d = cs42l43_0_adr,
  179. },
  180. {}
  181. };
  182. static const struct snd_soc_acpi_link_adr rpl_sdca_3_in_1[] = {
  183. {
  184. .mask = BIT(0),
  185. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  186. .adr_d = rt711_sdca_0_adr,
  187. },
  188. {
  189. .mask = BIT(1),
  190. .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
  191. .adr_d = rt1316_1_group1_adr,
  192. },
  193. {
  194. .mask = BIT(2),
  195. .num_adr = ARRAY_SIZE(rt714_2_adr),
  196. .adr_d = rt714_2_adr,
  197. },
  198. {
  199. .mask = BIT(3),
  200. .num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
  201. .adr_d = rt1316_3_group1_adr,
  202. },
  203. {}
  204. };
  205. static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1316_link12_rt714_link3[] = {
  206. {
  207. .mask = BIT(0),
  208. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  209. .adr_d = rt711_sdca_0_adr,
  210. },
  211. {
  212. .mask = BIT(1),
  213. .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
  214. .adr_d = rt1316_1_group1_adr,
  215. },
  216. {
  217. .mask = BIT(2),
  218. .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
  219. .adr_d = rt1316_2_group1_adr,
  220. },
  221. {
  222. .mask = BIT(3),
  223. .num_adr = ARRAY_SIZE(rt714_3_adr),
  224. .adr_d = rt714_3_adr,
  225. },
  226. {}
  227. };
  228. static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = {
  229. {
  230. .mask = BIT(2),
  231. .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
  232. .adr_d = rt711_sdca_2_adr,
  233. },
  234. {
  235. .mask = BIT(0),
  236. .num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
  237. .adr_d = rt1316_0_group2_adr,
  238. },
  239. {
  240. .mask = BIT(1),
  241. .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
  242. .adr_d = rt1316_1_group2_adr,
  243. },
  244. {
  245. .mask = BIT(3),
  246. .num_adr = ARRAY_SIZE(rt714_3_adr),
  247. .adr_d = rt714_3_adr,
  248. },
  249. {}
  250. };
  251. static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01[] = {
  252. {
  253. .mask = BIT(2),
  254. .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
  255. .adr_d = rt711_sdca_2_adr,
  256. },
  257. {
  258. .mask = BIT(0),
  259. .num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
  260. .adr_d = rt1316_0_group2_adr,
  261. },
  262. {
  263. .mask = BIT(1),
  264. .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
  265. .adr_d = rt1316_1_group2_adr,
  266. },
  267. {}
  268. };
  269. static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1316_link12[] = {
  270. {
  271. .mask = BIT(0),
  272. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  273. .adr_d = rt711_sdca_0_adr,
  274. },
  275. {
  276. .mask = BIT(1),
  277. .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
  278. .adr_d = rt1316_1_group1_adr,
  279. },
  280. {
  281. .mask = BIT(2),
  282. .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
  283. .adr_d = rt1316_2_group1_adr,
  284. },
  285. {}
  286. };
  287. static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt714_link3[] = {
  288. {
  289. .mask = BIT(0),
  290. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  291. .adr_d = rt711_sdca_0_adr,
  292. },
  293. {
  294. .mask = BIT(1),
  295. .num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
  296. .adr_d = rt1318_1_group1_adr,
  297. },
  298. {
  299. .mask = BIT(2),
  300. .num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
  301. .adr_d = rt1318_2_group1_adr,
  302. },
  303. {
  304. .mask = BIT(3),
  305. .num_adr = ARRAY_SIZE(rt714_3_adr),
  306. .adr_d = rt714_3_adr,
  307. },
  308. {}
  309. };
  310. static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12[] = {
  311. {
  312. .mask = BIT(0),
  313. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  314. .adr_d = rt711_sdca_0_adr,
  315. },
  316. {
  317. .mask = BIT(1),
  318. .num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
  319. .adr_d = rt1318_1_group1_adr,
  320. },
  321. {
  322. .mask = BIT(2),
  323. .num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
  324. .adr_d = rt1318_2_group1_adr,
  325. },
  326. {}
  327. };
  328. static const struct snd_soc_acpi_link_adr rpl_sdw_rt1316_link12_rt714_link0[] = {
  329. {
  330. .mask = BIT(1),
  331. .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
  332. .adr_d = rt1316_1_group1_adr,
  333. },
  334. {
  335. .mask = BIT(2),
  336. .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
  337. .adr_d = rt1316_2_group1_adr,
  338. },
  339. {
  340. .mask = BIT(0),
  341. .num_adr = ARRAY_SIZE(rt714_0_adr),
  342. .adr_d = rt714_0_adr,
  343. },
  344. {}
  345. };
  346. static const struct snd_soc_acpi_link_adr rpl_sdca_rvp[] = {
  347. {
  348. .mask = BIT(0),
  349. .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
  350. .adr_d = rt711_sdca_0_adr,
  351. },
  352. {}
  353. };
  354. static const struct snd_soc_acpi_link_adr rplp_crb[] = {
  355. {
  356. .mask = BIT(2),
  357. .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
  358. .adr_d = rt711_sdca_2_adr,
  359. },
  360. {}
  361. };
  362. static const struct snd_soc_acpi_codecs rpl_rt5682_hp = {
  363. .num_codecs = 2,
  364. .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
  365. };
  366. static const struct snd_soc_acpi_codecs rpl_essx_83x6 = {
  367. .num_codecs = 3,
  368. .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
  369. };
  370. static const struct snd_soc_acpi_codecs rpl_max98357a_amp = {
  371. .num_codecs = 1,
  372. .codecs = {"MX98357A"}
  373. };
  374. static const struct snd_soc_acpi_codecs rpl_lt6911_hdmi = {
  375. .num_codecs = 1,
  376. .codecs = {"INTC10B0"}
  377. };
  378. struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
  379. {
  380. .comp_ids = &rpl_rt5682_hp,
  381. .drv_name = "rpl_mx98357_rt5682",
  382. .machine_quirk = snd_soc_acpi_codec_list,
  383. .quirk_data = &rpl_max98357a_amp,
  384. .sof_tplg_filename = "sof-rpl-max98357a-rt5682.tplg",
  385. },
  386. {
  387. .comp_ids = &rpl_rt5682_hp,
  388. .drv_name = "rpl_rt5682_c1_h02",
  389. .machine_quirk = snd_soc_acpi_codec_list,
  390. .quirk_data = &rpl_lt6911_hdmi,
  391. .sof_tplg_filename = "sof-rpl-rt5682-ssp1-hdmi-ssp02.tplg",
  392. },
  393. {
  394. .comp_ids = &rpl_essx_83x6,
  395. .drv_name = "rpl_es83x6_c1_h02",
  396. .machine_quirk = snd_soc_acpi_codec_list,
  397. .quirk_data = &rpl_lt6911_hdmi,
  398. .sof_tplg_filename = "sof-rpl-es83x6-ssp1-hdmi-ssp02.tplg",
  399. },
  400. {
  401. .comp_ids = &rpl_essx_83x6,
  402. .drv_name = "sof-essx8336",
  403. .sof_tplg_filename = "sof-rpl-es83x6", /* the tplg suffix is added at run time */
  404. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
  405. SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
  406. SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
  407. },
  408. /* place boards for each headphone codec: sof driver will complete the
  409. * tplg name and machine driver will detect the amp type
  410. */
  411. {
  412. .id = CS42L42_ACPI_HID,
  413. .drv_name = "rpl_cs42l42_def",
  414. .sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
  415. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
  416. SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
  417. },
  418. {
  419. .id = DA7219_ACPI_HID,
  420. .drv_name = "rpl_da7219_def",
  421. .sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
  422. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
  423. SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
  424. },
  425. {
  426. .id = NAU8825_ACPI_HID,
  427. .drv_name = "rpl_nau8825_def",
  428. .sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
  429. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
  430. SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
  431. },
  432. {
  433. .id = RT5650_ACPI_HID,
  434. .drv_name = "rpl_rt5682_def",
  435. .sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
  436. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
  437. SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
  438. },
  439. {
  440. .comp_ids = &rpl_rt5682_hp,
  441. .drv_name = "rpl_rt5682_def",
  442. .sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
  443. .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
  444. SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
  445. },
  446. /* place amp-only boards in the end of table */
  447. {
  448. .id = "INTC10B0",
  449. .drv_name = "rpl_lt6911_hdmi_ssp",
  450. .sof_tplg_filename = "sof-rpl-nocodec-hdmi-ssp02.tplg"
  451. },
  452. {},
  453. };
  454. EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_machines);
  455. /* this table is used when there is no I2S codec present */
  456. struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = {
  457. {
  458. .link_mask = BIT(0),
  459. .links = rpl_cs42l43_l0,
  460. .drv_name = "sof_sdw",
  461. .sof_tplg_filename = "sof-rpl-cs42l43-l0.tplg",
  462. },
  463. {
  464. .link_mask = 0xF, /* 4 active links required */
  465. .links = rpl_sdca_3_in_1,
  466. .drv_name = "sof_sdw",
  467. .sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l13-rt714-l2.tplg",
  468. },
  469. {
  470. .link_mask = 0xF, /* 4 active links required */
  471. .links = rpl_sdw_rt711_link2_rt1316_link01_rt714_link3,
  472. .drv_name = "sof_sdw",
  473. .sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01-rt714-l3.tplg",
  474. },
  475. {
  476. .link_mask = 0xF, /* 4 active links required */
  477. .links = rpl_sdw_rt711_link0_rt1316_link12_rt714_link3,
  478. .drv_name = "sof_sdw",
  479. .sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l12-rt714-l3.tplg",
  480. },
  481. {
  482. .link_mask = 0xF, /* 4 active links required */
  483. .links = rpl_sdw_rt711_link0_rt1318_link12_rt714_link3,
  484. .drv_name = "sof_sdw",
  485. .sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12-rt714-l3.tplg",
  486. },
  487. {
  488. .link_mask = 0x7, /* rt711 on link0 & two rt1316s on link1 and link2 */
  489. .links = rpl_sdw_rt711_link0_rt1316_link12,
  490. .drv_name = "sof_sdw",
  491. .sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l12.tplg",
  492. },
  493. {
  494. .link_mask = 0x7, /* rt711 on link0 & two rt1318s on link1 and link2 */
  495. .links = rpl_sdw_rt711_link0_rt1318_link12,
  496. .drv_name = "sof_sdw",
  497. .sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12.tplg",
  498. },
  499. {
  500. .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
  501. .links = rpl_sdw_rt1316_link12_rt714_link0,
  502. .drv_name = "sof_sdw",
  503. .sof_tplg_filename = "sof-rpl-rt1316-l12-rt714-l0.tplg",
  504. },
  505. {
  506. .link_mask = 0x7, /* rt711 on link2 & two rt1316s on link0 and link1 */
  507. .links = rpl_sdw_rt711_link2_rt1316_link01,
  508. .drv_name = "sof_sdw",
  509. .sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01.tplg",
  510. },
  511. {
  512. .link_mask = 0x1, /* link0 required */
  513. .links = rpl_rvp,
  514. .drv_name = "sof_sdw",
  515. .sof_tplg_filename = "sof-rpl-rt711-l0.tplg",
  516. },
  517. {
  518. .link_mask = 0x1, /* link0 required */
  519. .links = rpl_sdca_rvp,
  520. .drv_name = "sof_sdw",
  521. .sof_tplg_filename = "sof-rpl-rt711-l0.tplg",
  522. },
  523. {
  524. .link_mask = 0x4, /* link2 required */
  525. .links = rplp_crb,
  526. .drv_name = "sof_sdw",
  527. .sof_tplg_filename = "sof-rpl-rt711-l2.tplg",
  528. },
  529. {},
  530. };
  531. EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_sdw_machines);