Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 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 | |
| 9 | #include <sound/soc-acpi.h> |
| 10 | #include <sound/soc-acpi-intel-match.h> |
| 11 | |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 12 | static struct snd_soc_acpi_codecs rt1011_spk_codecs = { |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 13 | .num_codecs = 1, |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 14 | .codecs = {"10EC1011"} |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 15 | }; |
| 16 | |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 17 | static struct snd_soc_acpi_codecs max98357a_spk_codecs = { |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 18 | .num_codecs = 1, |
| 19 | .codecs = {"MX98357A"} |
| 20 | }; |
| 21 | |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 22 | /* |
| 23 | * The order of the three entries with .id = "10EC5682" matters |
| 24 | * here, because DSDT tables expose an ACPI HID for the MAX98357A |
| 25 | * speaker amplifier which is not populated on the board. |
| 26 | */ |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 27 | struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = { |
| 28 | { |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 29 | .id = "10EC5682", |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 30 | .drv_name = "cml_rt1011_rt5682", |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 31 | .machine_quirk = snd_soc_acpi_codec_list, |
| 32 | .quirk_data = &rt1011_spk_codecs, |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 33 | .sof_fw_filename = "sof-cml.ri", |
| 34 | .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg", |
| 35 | }, |
| 36 | { |
| 37 | .id = "10EC5682", |
| 38 | .drv_name = "sof_rt5682", |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 39 | .machine_quirk = snd_soc_acpi_codec_list, |
| 40 | .quirk_data = &max98357a_spk_codecs, |
| 41 | .sof_fw_filename = "sof-cml.ri", |
| 42 | .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg", |
| 43 | }, |
| 44 | { |
| 45 | .id = "10EC5682", |
| 46 | .drv_name = "sof_rt5682", |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 47 | .sof_fw_filename = "sof-cml.ri", |
| 48 | .sof_tplg_filename = "sof-cml-rt5682.tplg", |
| 49 | }, |
Amery Song | 4e64ba3 | 2019-12-09 18:48:54 -0600 | [diff] [blame] | 50 | { |
| 51 | .id = "DLGS7219", |
| 52 | .drv_name = "cml_da7219_max98357a", |
| 53 | .machine_quirk = snd_soc_acpi_codec_list, |
| 54 | .quirk_data = &max98357a_spk_codecs, |
| 55 | .sof_fw_filename = "sof-cml.ri", |
| 56 | .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg", |
| 57 | }, |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 58 | {}, |
| 59 | }; |
| 60 | EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines); |
| 61 | |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 62 | static const struct snd_soc_acpi_endpoint single_endpoint = { |
| 63 | .num = 0, |
| 64 | .aggregated = 0, |
| 65 | .group_position = 0, |
| 66 | .group_id = 0, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 67 | }; |
| 68 | |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 69 | static const struct snd_soc_acpi_endpoint spk_l_endpoint = { |
| 70 | .num = 0, |
| 71 | .aggregated = 1, |
| 72 | .group_position = 0, |
| 73 | .group_id = 1, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 74 | }; |
| 75 | |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 76 | static const struct snd_soc_acpi_endpoint spk_r_endpoint = { |
| 77 | .num = 0, |
| 78 | .aggregated = 1, |
| 79 | .group_position = 1, |
| 80 | .group_id = 1, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 81 | }; |
| 82 | |
Rander Wang | ba762e6 | 2020-03-25 17:07:43 -0500 | [diff] [blame] | 83 | static const struct snd_soc_acpi_adr_device rt700_1_adr[] = { |
| 84 | { |
| 85 | .adr = 0x000110025D070000, |
| 86 | .num_endpoints = 1, |
| 87 | .endpoints = &single_endpoint, |
| 88 | } |
| 89 | }; |
| 90 | |
| 91 | static const struct snd_soc_acpi_link_adr cml_rvp[] = { |
| 92 | { |
| 93 | .mask = BIT(1), |
| 94 | .num_adr = ARRAY_SIZE(rt700_1_adr), |
| 95 | .adr_d = rt700_1_adr, |
| 96 | }, |
| 97 | {} |
| 98 | }; |
| 99 | |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 100 | static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { |
| 101 | { |
| 102 | .adr = 0x000010025D071100, |
| 103 | .num_endpoints = 1, |
| 104 | .endpoints = &single_endpoint, |
| 105 | } |
| 106 | }; |
| 107 | |
| 108 | static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = { |
| 109 | { |
| 110 | .adr = 0x000110025D130800, |
| 111 | .num_endpoints = 1, |
| 112 | .endpoints = &single_endpoint, |
| 113 | } |
| 114 | }; |
| 115 | |
| 116 | static const struct snd_soc_acpi_adr_device rt1308_2_adr[] = { |
| 117 | { |
| 118 | .adr = 0x000210025D130800, |
| 119 | .num_endpoints = 1, |
| 120 | .endpoints = &single_endpoint, |
| 121 | } |
| 122 | }; |
| 123 | |
| 124 | static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = { |
| 125 | { |
| 126 | .adr = 0x000110025D130800, |
| 127 | .num_endpoints = 1, |
| 128 | .endpoints = &spk_l_endpoint, |
| 129 | } |
| 130 | }; |
| 131 | |
| 132 | static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = { |
| 133 | { |
| 134 | .adr = 0x000210025D130800, |
| 135 | .num_endpoints = 1, |
| 136 | .endpoints = &spk_r_endpoint, |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | static const struct snd_soc_acpi_adr_device rt715_3_adr[] = { |
| 141 | { |
| 142 | .adr = 0x000310025D071500, |
| 143 | .num_endpoints = 1, |
| 144 | .endpoints = &single_endpoint, |
| 145 | } |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | static const struct snd_soc_acpi_link_adr cml_3_in_1_default[] = { |
| 149 | { |
| 150 | .mask = BIT(0), |
| 151 | .num_adr = ARRAY_SIZE(rt711_0_adr), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 152 | .adr_d = rt711_0_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 153 | }, |
| 154 | { |
| 155 | .mask = BIT(1), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 156 | .num_adr = ARRAY_SIZE(rt1308_1_group1_adr), |
| 157 | .adr_d = rt1308_1_group1_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 158 | }, |
| 159 | { |
| 160 | .mask = BIT(2), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 161 | .num_adr = ARRAY_SIZE(rt1308_2_group1_adr), |
| 162 | .adr_d = rt1308_2_group1_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 163 | }, |
| 164 | { |
| 165 | .mask = BIT(3), |
| 166 | .num_adr = ARRAY_SIZE(rt715_3_adr), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 167 | .adr_d = rt715_3_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 168 | }, |
| 169 | {} |
| 170 | }; |
| 171 | |
| 172 | static const struct snd_soc_acpi_link_adr cml_3_in_1_mono_amp[] = { |
| 173 | { |
| 174 | .mask = BIT(0), |
| 175 | .num_adr = ARRAY_SIZE(rt711_0_adr), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 176 | .adr_d = rt711_0_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 177 | }, |
| 178 | { |
| 179 | .mask = BIT(1), |
| 180 | .num_adr = ARRAY_SIZE(rt1308_1_adr), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 181 | .adr_d = rt1308_1_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 182 | }, |
| 183 | { |
| 184 | .mask = BIT(3), |
| 185 | .num_adr = ARRAY_SIZE(rt715_3_adr), |
Pierre-Louis Bossart | 004bd41 | 2020-03-25 16:50:17 -0500 | [diff] [blame] | 186 | .adr_d = rt715_3_adr, |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 187 | }, |
| 188 | {} |
| 189 | }; |
| 190 | |
| 191 | struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_sdw_machines[] = { |
| 192 | { |
| 193 | .link_mask = 0xF, /* 4 active links required */ |
| 194 | .links = cml_3_in_1_default, |
Rander Wang | ba762e6 | 2020-03-25 17:07:43 -0500 | [diff] [blame] | 195 | .drv_name = "sof_sdw", |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 196 | .sof_fw_filename = "sof-cml.ri", |
| 197 | .sof_tplg_filename = "sof-cml-rt711-rt1308-rt715.tplg", |
| 198 | }, |
| 199 | { |
| 200 | /* |
| 201 | * link_mask should be 0xB, but all links are enabled by BIOS. |
| 202 | * This entry will be selected if there is no rt1308 exposed |
| 203 | * on link2 since it will fail to match the above entry. |
| 204 | */ |
| 205 | .link_mask = 0xF, |
| 206 | .links = cml_3_in_1_mono_amp, |
Rander Wang | ba762e6 | 2020-03-25 17:07:43 -0500 | [diff] [blame] | 207 | .drv_name = "sof_sdw", |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 208 | .sof_fw_filename = "sof-cml.ri", |
| 209 | .sof_tplg_filename = "sof-cml-rt711-rt1308-mono-rt715.tplg", |
| 210 | }, |
| 211 | { |
| 212 | .link_mask = 0x2, /* RT700 connected on Link1 */ |
Rander Wang | ba762e6 | 2020-03-25 17:07:43 -0500 | [diff] [blame] | 213 | .links = cml_rvp, |
| 214 | .drv_name = "sof_sdw", |
Rander Wang | db0b9ef | 2020-01-10 16:25:28 -0600 | [diff] [blame] | 215 | .sof_fw_filename = "sof-cml.ri", |
| 216 | .sof_tplg_filename = "sof-cml-rt700.tplg", |
| 217 | }, |
| 218 | {} |
| 219 | }; |
| 220 | EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_sdw_machines); |
| 221 | |
Pierre-Louis Bossart | 1f24d93 | 2019-11-11 16:28:59 -0600 | [diff] [blame] | 222 | MODULE_LICENSE("GPL v2"); |
| 223 | MODULE_DESCRIPTION("Intel Common ACPI Match module"); |