acp-config.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
  2. //
  3. // This file is provided under a dual BSD/GPLv2 license. When using or
  4. // redistributing this file, you may do so under either license.
  5. //
  6. // Copyright(c) 2021 Advanced Micro Devices, Inc.
  7. //
  8. // Authors: Ajit Kumar Pandey <[email protected]>
  9. //
  10. /* ACP machine configuration module */
  11. #include <linux/acpi.h>
  12. #include <linux/bits.h>
  13. #include <linux/dmi.h>
  14. #include <linux/module.h>
  15. #include <linux/pci.h>
  16. #include "../sof/amd/acp.h"
  17. #include "mach-config.h"
  18. static int acp_quirk_data;
  19. static const struct config_entry config_table[] = {
  20. {
  21. .flags = FLAG_AMD_SOF,
  22. .device = ACP_PCI_DEV_ID,
  23. .dmi_table = (const struct dmi_system_id []) {
  24. {
  25. .matches = {
  26. DMI_MATCH(DMI_SYS_VENDOR, "AMD"),
  27. DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"),
  28. },
  29. },
  30. {}
  31. },
  32. },
  33. {
  34. .flags = FLAG_AMD_SOF,
  35. .device = ACP_PCI_DEV_ID,
  36. .dmi_table = (const struct dmi_system_id []) {
  37. {
  38. .matches = {
  39. DMI_MATCH(DMI_SYS_VENDOR, "Google"),
  40. },
  41. },
  42. {}
  43. },
  44. },
  45. };
  46. int snd_amd_acp_find_config(struct pci_dev *pci)
  47. {
  48. const struct config_entry *table = config_table;
  49. u16 device = pci->device;
  50. int i;
  51. /* Do not enable FLAGS on older platforms with Rev id zero */
  52. if (!pci->revision)
  53. return 0;
  54. for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) {
  55. if (table->device != device)
  56. continue;
  57. if (table->dmi_table && !dmi_check_system(table->dmi_table))
  58. continue;
  59. acp_quirk_data = table->flags;
  60. return table->flags;
  61. }
  62. return 0;
  63. }
  64. EXPORT_SYMBOL(snd_amd_acp_find_config);
  65. static struct snd_soc_acpi_codecs amp_rt1019 = {
  66. .num_codecs = 1,
  67. .codecs = {"10EC1019"}
  68. };
  69. static struct snd_soc_acpi_codecs amp_max = {
  70. .num_codecs = 1,
  71. .codecs = {"MX98360A"}
  72. };
  73. struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
  74. {
  75. .id = "10EC5682",
  76. .drv_name = "rt5682-rt1019",
  77. .pdata = (void *)&acp_quirk_data,
  78. .machine_quirk = snd_soc_acpi_codec_list,
  79. .quirk_data = &amp_rt1019,
  80. .fw_filename = "sof-rn.ri",
  81. .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
  82. },
  83. {
  84. .id = "10EC5682",
  85. .drv_name = "rt5682-max",
  86. .pdata = (void *)&acp_quirk_data,
  87. .machine_quirk = snd_soc_acpi_codec_list,
  88. .quirk_data = &amp_max,
  89. .fw_filename = "sof-rn.ri",
  90. .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
  91. },
  92. {
  93. .id = "RTL5682",
  94. .drv_name = "rt5682s-max",
  95. .pdata = (void *)&acp_quirk_data,
  96. .machine_quirk = snd_soc_acpi_codec_list,
  97. .quirk_data = &amp_max,
  98. .fw_filename = "sof-rn.ri",
  99. .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
  100. },
  101. {
  102. .id = "RTL5682",
  103. .drv_name = "rt5682s-rt1019",
  104. .pdata = (void *)&acp_quirk_data,
  105. .machine_quirk = snd_soc_acpi_codec_list,
  106. .quirk_data = &amp_rt1019,
  107. .fw_filename = "sof-rn.ri",
  108. .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
  109. },
  110. {
  111. .id = "AMDI1019",
  112. .drv_name = "renoir-dsp",
  113. .pdata = (void *)&acp_quirk_data,
  114. .fw_filename = "sof-rn.ri",
  115. .sof_tplg_filename = "sof-acp.tplg",
  116. },
  117. {},
  118. };
  119. EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
  120. struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
  121. {
  122. .id = "AMDI1019",
  123. .drv_name = "rmb-dsp",
  124. .pdata = &acp_quirk_data,
  125. .fw_filename = "sof-rmb.ri",
  126. .sof_tplg_filename = "sof-acp-rmb.tplg",
  127. },
  128. {
  129. .id = "10508825",
  130. .drv_name = "nau8825-max",
  131. .pdata = &acp_quirk_data,
  132. .machine_quirk = snd_soc_acpi_codec_list,
  133. .quirk_data = &amp_max,
  134. .fw_filename = "sof-rmb.ri",
  135. .sof_tplg_filename = "sof-rmb-nau8825-max98360.tplg",
  136. },
  137. {
  138. .id = "RTL5682",
  139. .drv_name = "rt5682s-hs-rt1019",
  140. .pdata = &acp_quirk_data,
  141. .machine_quirk = snd_soc_acpi_codec_list,
  142. .quirk_data = &amp_rt1019,
  143. .fw_filename = "sof-rmb.ri",
  144. .sof_tplg_filename = "sof-rmb-rt5682s-rt1019.tplg",
  145. },
  146. {},
  147. };
  148. EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
  149. MODULE_LICENSE("Dual BSD/GPL");