Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * soc-acpi-intel-cml-match.c - tables and support for CML ACPI enumeration.
0004  *
0005  * Copyright (c) 2019, Intel Corporation.
0006  *
0007  */
0008 
0009 #include <sound/soc-acpi.h>
0010 #include <sound/soc-acpi-intel-match.h>
0011 
0012 static const struct snd_soc_acpi_codecs essx_83x6 = {
0013     .num_codecs = 3,
0014     .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
0015 };
0016 
0017 static const struct snd_soc_acpi_codecs rt1011_spk_codecs = {
0018     .num_codecs = 1,
0019     .codecs = {"10EC1011"}
0020 };
0021 
0022 static const struct snd_soc_acpi_codecs rt1015_spk_codecs = {
0023     .num_codecs = 1,
0024     .codecs = {"10EC1015"}
0025 };
0026 
0027 static const struct snd_soc_acpi_codecs max98357a_spk_codecs = {
0028     .num_codecs = 1,
0029     .codecs = {"MX98357A"}
0030 };
0031 
0032 static const struct snd_soc_acpi_codecs max98390_spk_codecs = {
0033     .num_codecs = 1,
0034     .codecs = {"MX98390"}
0035 };
0036 
0037 /*
0038  * The order of the three entries with .id = "10EC5682" matters
0039  * here, because DSDT tables expose an ACPI HID for the MAX98357A
0040  * speaker amplifier which is not populated on the board.
0041  */
0042 struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
0043     {
0044         .id = "10EC5682",
0045         .drv_name = "cml_rt1011_rt5682",
0046         .machine_quirk = snd_soc_acpi_codec_list,
0047         .quirk_data = &rt1011_spk_codecs,
0048         .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
0049     },
0050     {
0051         .id = "10EC5682",
0052         .drv_name = "cml_rt1015_rt5682",
0053         .machine_quirk = snd_soc_acpi_codec_list,
0054         .quirk_data = &rt1015_spk_codecs,
0055         .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
0056     },
0057     {
0058         .id = "10EC5682",
0059         .drv_name = "sof_rt5682",
0060         .machine_quirk = snd_soc_acpi_codec_list,
0061         .quirk_data = &max98357a_spk_codecs,
0062         .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg",
0063     },
0064     {
0065         .id = "10EC5682",
0066         .drv_name = "sof_rt5682",
0067         .sof_tplg_filename = "sof-cml-rt5682.tplg",
0068     },
0069     {
0070         .id = "DLGS7219",
0071         .drv_name = "cml_da7219_mx98357a",
0072         .machine_quirk = snd_soc_acpi_codec_list,
0073         .quirk_data = &max98357a_spk_codecs,
0074         .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
0075     },
0076     {
0077         .id = "DLGS7219",
0078         .drv_name = "cml_da7219_mx98357a",
0079         .machine_quirk = snd_soc_acpi_codec_list,
0080         .quirk_data = &max98390_spk_codecs,
0081         .sof_tplg_filename = "sof-cml-da7219-max98390.tplg",
0082     },
0083     {
0084         .comp_ids = &essx_83x6,
0085         .drv_name = "sof-essx8336",
0086         .sof_tplg_filename = "sof-cml-es8336", /* the tplg suffix is added at run time */
0087         .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
0088                     SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
0089                     SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
0090     },
0091     {},
0092 };
0093 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines);
0094 
0095 static const struct snd_soc_acpi_endpoint single_endpoint = {
0096     .num = 0,
0097     .aggregated = 0,
0098     .group_position = 0,
0099     .group_id = 0,
0100 };
0101 
0102 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
0103     .num = 0,
0104     .aggregated = 1,
0105     .group_position = 0,
0106     .group_id = 1,
0107 };
0108 
0109 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
0110     .num = 0,
0111     .aggregated = 1,
0112     .group_position = 1,
0113     .group_id = 1,
0114 };
0115 
0116 static const struct snd_soc_acpi_adr_device rt700_1_adr[] = {
0117     {
0118         .adr = 0x000110025D070000ull,
0119         .num_endpoints = 1,
0120         .endpoints = &single_endpoint,
0121         .name_prefix = "rt700"
0122     }
0123 };
0124 
0125 static const struct snd_soc_acpi_link_adr cml_rvp[] = {
0126     {
0127         .mask = BIT(1),
0128         .num_adr = ARRAY_SIZE(rt700_1_adr),
0129         .adr_d = rt700_1_adr,
0130     },
0131     {}
0132 };
0133 
0134 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
0135     {
0136         .adr = 0x000020025D071100ull,
0137         .num_endpoints = 1,
0138         .endpoints = &single_endpoint,
0139         .name_prefix = "rt711"
0140     }
0141 };
0142 
0143 static const struct snd_soc_acpi_adr_device rt1308_1_single_adr[] = {
0144     {
0145         .adr = 0x000120025D130800ull,
0146         .num_endpoints = 1,
0147         .endpoints = &single_endpoint,
0148         .name_prefix = "rt1308-1"
0149     }
0150 };
0151 
0152 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
0153     {
0154         .adr = 0x000120025D130800ull,
0155         .num_endpoints = 1,
0156         .endpoints = &spk_l_endpoint,
0157         .name_prefix = "rt1308-1"
0158     }
0159 };
0160 
0161 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
0162     {
0163         .adr = 0x000220025D130800ull,
0164         .num_endpoints = 1,
0165         .endpoints = &spk_r_endpoint,
0166         .name_prefix = "rt1308-2"
0167     }
0168 };
0169 
0170 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
0171     {
0172         .adr = 0x000320025D071500ull,
0173         .num_endpoints = 1,
0174         .endpoints = &single_endpoint,
0175         .name_prefix = "rt715"
0176     }
0177 };
0178 
0179 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
0180     {
0181         .adr = 0x000030025D071101ull,
0182         .num_endpoints = 1,
0183         .endpoints = &single_endpoint,
0184         .name_prefix = "rt711"
0185     }
0186 };
0187 
0188 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
0189     {
0190         .adr = 0x000131025D131601ull, /* unique ID is set for some reason */
0191         .num_endpoints = 1,
0192         .endpoints = &spk_l_endpoint,
0193         .name_prefix = "rt1316-1"
0194     }
0195 };
0196 
0197 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
0198     {
0199         .adr = 0x000230025D131601ull,
0200         .num_endpoints = 1,
0201         .endpoints = &spk_r_endpoint,
0202         .name_prefix = "rt1316-2"
0203     }
0204 };
0205 
0206 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
0207     {
0208         .adr = 0x000330025D071401ull,
0209         .num_endpoints = 1,
0210         .endpoints = &single_endpoint,
0211         .name_prefix = "rt714"
0212     }
0213 };
0214 
0215 static const struct snd_soc_acpi_link_adr cml_3_in_1_default[] = {
0216     {
0217         .mask = BIT(0),
0218         .num_adr = ARRAY_SIZE(rt711_0_adr),
0219         .adr_d = rt711_0_adr,
0220     },
0221     {
0222         .mask = BIT(1),
0223         .num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
0224         .adr_d = rt1308_1_group1_adr,
0225     },
0226     {
0227         .mask = BIT(2),
0228         .num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
0229         .adr_d = rt1308_2_group1_adr,
0230     },
0231     {
0232         .mask = BIT(3),
0233         .num_adr = ARRAY_SIZE(rt715_3_adr),
0234         .adr_d = rt715_3_adr,
0235     },
0236     {}
0237 };
0238 
0239 static const struct snd_soc_acpi_link_adr cml_3_in_1_mono_amp[] = {
0240     {
0241         .mask = BIT(0),
0242         .num_adr = ARRAY_SIZE(rt711_0_adr),
0243         .adr_d = rt711_0_adr,
0244     },
0245     {
0246         .mask = BIT(1),
0247         .num_adr = ARRAY_SIZE(rt1308_1_single_adr),
0248         .adr_d = rt1308_1_single_adr,
0249     },
0250     {
0251         .mask = BIT(3),
0252         .num_adr = ARRAY_SIZE(rt715_3_adr),
0253         .adr_d = rt715_3_adr,
0254     },
0255     {}
0256 };
0257 
0258 static const struct snd_soc_acpi_link_adr cml_3_in_1_sdca[] = {
0259     {
0260         .mask = BIT(0),
0261         .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
0262         .adr_d = rt711_sdca_0_adr,
0263     },
0264     {
0265         .mask = BIT(1),
0266         .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
0267         .adr_d = rt1316_1_group1_adr,
0268     },
0269     {
0270         .mask = BIT(2),
0271         .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
0272         .adr_d = rt1316_2_group1_adr,
0273     },
0274     {
0275         .mask = BIT(3),
0276         .num_adr = ARRAY_SIZE(rt714_3_adr),
0277         .adr_d = rt714_3_adr,
0278     },
0279     {}
0280 };
0281 
0282 struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_sdw_machines[] = {
0283     {
0284         .link_mask = 0xF, /* 4 active links required */
0285         .links = cml_3_in_1_default,
0286         .drv_name = "sof_sdw",
0287         .sof_tplg_filename = "sof-cml-rt711-rt1308-rt715.tplg",
0288     },
0289     {
0290         .link_mask = 0xF, /* 4 active links required */
0291         .links = cml_3_in_1_sdca,
0292         .drv_name = "sof_sdw",
0293         .sof_tplg_filename = "sof-cml-rt711-rt1316-rt714.tplg",
0294     },
0295     {
0296         /*
0297          * link_mask should be 0xB, but all links are enabled by BIOS.
0298          * This entry will be selected if there is no rt1308 exposed
0299          * on link2 since it will fail to match the above entry.
0300          */
0301         .link_mask = 0xF,
0302         .links = cml_3_in_1_mono_amp,
0303         .drv_name = "sof_sdw",
0304         .sof_tplg_filename = "sof-cml-rt711-rt1308-mono-rt715.tplg",
0305     },
0306     {
0307         .link_mask = 0x2, /* RT700 connected on Link1 */
0308         .links = cml_rvp,
0309         .drv_name = "sof_sdw",
0310         .sof_tplg_filename = "sof-cml-rt700.tplg",
0311     },
0312     {}
0313 };
0314 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_sdw_machines);