Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * soc-apci-intel-adl-match.c - tables and support for ADL ACPI enumeration.
0004  *
0005  * Copyright (c) 2020, Intel Corporation.
0006  */
0007 
0008 #include <sound/soc-acpi.h>
0009 #include <sound/soc-acpi-intel-match.h>
0010 
0011 static const struct snd_soc_acpi_codecs essx_83x6 = {
0012     .num_codecs = 3,
0013     .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
0014 };
0015 
0016 static const struct snd_soc_acpi_endpoint single_endpoint = {
0017     .num = 0,
0018     .aggregated = 0,
0019     .group_position = 0,
0020     .group_id = 0,
0021 };
0022 
0023 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
0024     .num = 0,
0025     .aggregated = 1,
0026     .group_position = 0,
0027     .group_id = 1,
0028 };
0029 
0030 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
0031     .num = 0,
0032     .aggregated = 1,
0033     .group_position = 1,
0034     .group_id = 1,
0035 };
0036 
0037 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
0038     {
0039         .adr = 0x000020025D071100ull,
0040         .num_endpoints = 1,
0041         .endpoints = &single_endpoint,
0042         .name_prefix = "rt711"
0043     }
0044 };
0045 
0046 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
0047     {
0048         .adr = 0x000120025D130800ull,
0049         .num_endpoints = 1,
0050         .endpoints = &spk_l_endpoint,
0051         .name_prefix = "rt1308-1"
0052     }
0053 };
0054 
0055 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
0056     {
0057         .adr = 0x000220025D130800ull,
0058         .num_endpoints = 1,
0059         .endpoints = &spk_r_endpoint,
0060         .name_prefix = "rt1308-2"
0061     }
0062 };
0063 
0064 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
0065     {
0066         .adr = 0x000320025D071500ull,
0067         .num_endpoints = 1,
0068         .endpoints = &single_endpoint,
0069         .name_prefix = "rt715"
0070     }
0071 };
0072 
0073 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
0074     {
0075         .adr = 0x000030025D071101ull,
0076         .num_endpoints = 1,
0077         .endpoints = &single_endpoint,
0078         .name_prefix = "rt711"
0079     }
0080 };
0081 
0082 static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = {
0083     {
0084         .adr = 0x000230025D071101ull,
0085         .num_endpoints = 1,
0086         .endpoints = &single_endpoint,
0087         .name_prefix = "rt711"
0088     }
0089 };
0090 
0091 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
0092     {
0093         .adr = 0x000131025D131601ull, /* unique ID is set for some reason */
0094         .num_endpoints = 1,
0095         .endpoints = &spk_l_endpoint,
0096         .name_prefix = "rt1316-1"
0097     }
0098 };
0099 
0100 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
0101     {
0102         .adr = 0x000230025D131601ull,
0103         .num_endpoints = 1,
0104         .endpoints = &spk_r_endpoint,
0105         .name_prefix = "rt1316-2"
0106     }
0107 };
0108 
0109 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
0110     {
0111         .adr = 0x000330025D131601ull,
0112         .num_endpoints = 1,
0113         .endpoints = &spk_r_endpoint,
0114         .name_prefix = "rt1316-2"
0115     }
0116 };
0117 
0118 static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = {
0119     {
0120         .adr = 0x000031025D131601ull,
0121         .num_endpoints = 1,
0122         .endpoints = &spk_l_endpoint,
0123         .name_prefix = "rt1316-1"
0124     }
0125 };
0126 
0127 static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
0128     {
0129         .adr = 0x000130025D131601ull,
0130         .num_endpoints = 1,
0131         .endpoints = &spk_r_endpoint,
0132         .name_prefix = "rt1316-2"
0133     }
0134 };
0135 
0136 static const struct snd_soc_acpi_adr_device rt1316_2_single_adr[] = {
0137     {
0138         .adr = 0x000230025D131601ull,
0139         .num_endpoints = 1,
0140         .endpoints = &single_endpoint,
0141         .name_prefix = "rt1316-1"
0142     }
0143 };
0144 
0145 static const struct snd_soc_acpi_adr_device rt1316_3_single_adr[] = {
0146     {
0147         .adr = 0x000330025D131601ull,
0148         .num_endpoints = 1,
0149         .endpoints = &single_endpoint,
0150         .name_prefix = "rt1316-1"
0151     }
0152 };
0153 
0154 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
0155     {
0156         .adr = 0x000030025D071401ull,
0157         .num_endpoints = 1,
0158         .endpoints = &single_endpoint,
0159         .name_prefix = "rt714"
0160     }
0161 };
0162 
0163 static const struct snd_soc_acpi_adr_device rt714_2_adr[] = {
0164     {
0165         .adr = 0x000230025D071401ull,
0166         .num_endpoints = 1,
0167         .endpoints = &single_endpoint,
0168         .name_prefix = "rt714"
0169     }
0170 };
0171 
0172 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
0173     {
0174         .adr = 0x000330025D071401ull,
0175         .num_endpoints = 1,
0176         .endpoints = &single_endpoint,
0177         .name_prefix = "rt714"
0178     }
0179 };
0180 
0181 static const struct snd_soc_acpi_link_adr adl_default[] = {
0182     {
0183         .mask = BIT(0),
0184         .num_adr = ARRAY_SIZE(rt711_0_adr),
0185         .adr_d = rt711_0_adr,
0186     },
0187     {
0188         .mask = BIT(1),
0189         .num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
0190         .adr_d = rt1308_1_group1_adr,
0191     },
0192     {
0193         .mask = BIT(2),
0194         .num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
0195         .adr_d = rt1308_2_group1_adr,
0196     },
0197     {
0198         .mask = BIT(3),
0199         .num_adr = ARRAY_SIZE(rt715_3_adr),
0200         .adr_d = rt715_3_adr,
0201     },
0202     {}
0203 };
0204 
0205 static const struct snd_soc_acpi_link_adr adl_sdca_default[] = {
0206     {
0207         .mask = BIT(0),
0208         .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
0209         .adr_d = rt711_sdca_0_adr,
0210     },
0211     {
0212         .mask = BIT(1),
0213         .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
0214         .adr_d = rt1316_1_group1_adr,
0215     },
0216     {
0217         .mask = BIT(2),
0218         .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
0219         .adr_d = rt1316_2_group1_adr,
0220     },
0221     {
0222         .mask = BIT(3),
0223         .num_adr = ARRAY_SIZE(rt714_3_adr),
0224         .adr_d = rt714_3_adr,
0225     },
0226     {}
0227 };
0228 
0229 static const struct snd_soc_acpi_link_adr adl_sdca_3_in_1[] = {
0230     {
0231         .mask = BIT(0),
0232         .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
0233         .adr_d = rt711_sdca_0_adr,
0234     },
0235     {
0236         .mask = BIT(1),
0237         .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
0238         .adr_d = rt1316_1_group1_adr,
0239     },
0240     {
0241         .mask = BIT(2),
0242         .num_adr = ARRAY_SIZE(rt714_2_adr),
0243         .adr_d = rt714_2_adr,
0244     },
0245     {
0246         .mask = BIT(3),
0247         .num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
0248         .adr_d = rt1316_3_group1_adr,
0249     },
0250     {}
0251 };
0252 
0253 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = {
0254     {
0255         .mask = BIT(2),
0256         .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
0257         .adr_d = rt711_sdca_2_adr,
0258     },
0259     {
0260         .mask = BIT(0),
0261         .num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
0262         .adr_d = rt1316_0_group2_adr,
0263     },
0264     {
0265         .mask = BIT(1),
0266         .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
0267         .adr_d = rt1316_1_group2_adr,
0268     },
0269     {
0270         .mask = BIT(3),
0271         .num_adr = ARRAY_SIZE(rt714_3_adr),
0272         .adr_d = rt714_3_adr,
0273     },
0274     {}
0275 };
0276 
0277 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01[] = {
0278     {
0279         .mask = BIT(2),
0280         .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
0281         .adr_d = rt711_sdca_2_adr,
0282     },
0283     {
0284         .mask = BIT(0),
0285         .num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
0286         .adr_d = rt1316_0_group2_adr,
0287     },
0288     {
0289         .mask = BIT(1),
0290         .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
0291         .adr_d = rt1316_1_group2_adr,
0292     },
0293     {}
0294 };
0295 
0296 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link12_rt714_link0[] = {
0297     {
0298         .mask = BIT(1),
0299         .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
0300         .adr_d = rt1316_1_group1_adr,
0301     },
0302     {
0303         .mask = BIT(2),
0304         .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
0305         .adr_d = rt1316_2_group1_adr,
0306     },
0307     {
0308         .mask = BIT(0),
0309         .num_adr = ARRAY_SIZE(rt714_0_adr),
0310         .adr_d = rt714_0_adr,
0311     },
0312     {}
0313 };
0314 
0315 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link3[] = {
0316     {
0317         .mask = BIT(2),
0318         .num_adr = ARRAY_SIZE(rt1316_2_single_adr),
0319         .adr_d = rt1316_2_single_adr,
0320     },
0321     {
0322         .mask = BIT(3),
0323         .num_adr = ARRAY_SIZE(rt714_3_adr),
0324         .adr_d = rt714_3_adr,
0325     },
0326     {}
0327 };
0328 
0329 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link0[] = {
0330     {
0331         .mask = BIT(2),
0332         .num_adr = ARRAY_SIZE(rt1316_2_single_adr),
0333         .adr_d = rt1316_2_single_adr,
0334     },
0335     {
0336         .mask = BIT(0),
0337         .num_adr = ARRAY_SIZE(rt714_0_adr),
0338         .adr_d = rt714_0_adr,
0339     },
0340     {}
0341 };
0342 
0343 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link0_rt1316_link3[] = {
0344     {
0345         .mask = BIT(0),
0346         .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
0347         .adr_d = rt711_sdca_0_adr,
0348     },
0349     {
0350         .mask = BIT(3),
0351         .num_adr = ARRAY_SIZE(rt1316_3_single_adr),
0352         .adr_d = rt1316_3_single_adr,
0353     },
0354     {}
0355 };
0356 
0357 static const struct snd_soc_acpi_adr_device mx8373_2_adr[] = {
0358     {
0359         .adr = 0x000223019F837300ull,
0360         .num_endpoints = 1,
0361         .endpoints = &spk_l_endpoint,
0362         .name_prefix = "Left"
0363     },
0364     {
0365         .adr = 0x000227019F837300ull,
0366         .num_endpoints = 1,
0367         .endpoints = &spk_r_endpoint,
0368         .name_prefix = "Right"
0369     }
0370 };
0371 
0372 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = {
0373     {
0374         .adr = 0x000021025D568200ull,
0375         .num_endpoints = 1,
0376         .endpoints = &single_endpoint,
0377         .name_prefix = "rt5682"
0378     }
0379 };
0380 
0381 static const struct snd_soc_acpi_link_adr adl_rvp[] = {
0382     {
0383         .mask = BIT(0),
0384         .num_adr = ARRAY_SIZE(rt711_0_adr),
0385         .adr_d = rt711_0_adr,
0386     },
0387     {}
0388 };
0389 
0390 static const struct snd_soc_acpi_link_adr adlps_rvp[] = {
0391     {
0392         .mask = BIT(0),
0393         .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
0394         .adr_d = rt711_sdca_0_adr,
0395     },
0396     {}
0397 };
0398 
0399 static const struct snd_soc_acpi_link_adr adl_chromebook_base[] = {
0400     {
0401         .mask = BIT(0),
0402         .num_adr = ARRAY_SIZE(rt5682_0_adr),
0403         .adr_d = rt5682_0_adr,
0404     },
0405     {
0406         .mask = BIT(2),
0407         .num_adr = ARRAY_SIZE(mx8373_2_adr),
0408         .adr_d = mx8373_2_adr,
0409     },
0410     {}
0411 };
0412 
0413 static const struct snd_soc_acpi_codecs adl_max98373_amp = {
0414     .num_codecs = 1,
0415     .codecs = {"MX98373"}
0416 };
0417 
0418 static const struct snd_soc_acpi_codecs adl_max98357a_amp = {
0419     .num_codecs = 1,
0420     .codecs = {"MX98357A"}
0421 };
0422 
0423 static const struct snd_soc_acpi_codecs adl_max98360a_amp = {
0424     .num_codecs = 1,
0425     .codecs = {"MX98360A"}
0426 };
0427 
0428 static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = {
0429     .num_codecs = 2,
0430     .codecs = {"10EC5682", "RTL5682"},
0431 };
0432 
0433 static const struct snd_soc_acpi_codecs adl_rt1019p_amp = {
0434     .num_codecs = 1,
0435     .codecs = {"RTL1019"}
0436 };
0437 
0438 static const struct snd_soc_acpi_codecs adl_max98390_amp = {
0439     .num_codecs = 1,
0440     .codecs = {"MX98390"}
0441 };
0442 
0443 static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = {
0444     .num_codecs = 1,
0445     .codecs = {"INTC10B0"}
0446 };
0447 
0448 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
0449     {
0450         .comp_ids = &adl_rt5682_rt5682s_hp,
0451         .drv_name = "adl_mx98373_rt5682",
0452         .machine_quirk = snd_soc_acpi_codec_list,
0453         .quirk_data = &adl_max98373_amp,
0454         .sof_tplg_filename = "sof-adl-max98373-rt5682.tplg",
0455     },
0456     {
0457         .comp_ids = &adl_rt5682_rt5682s_hp,
0458         .drv_name = "adl_mx98357_rt5682",
0459         .machine_quirk = snd_soc_acpi_codec_list,
0460         .quirk_data = &adl_max98357a_amp,
0461         .sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg",
0462     },
0463     {
0464         .comp_ids = &adl_rt5682_rt5682s_hp,
0465         .drv_name = "adl_mx98360_rt5682",
0466         .machine_quirk = snd_soc_acpi_codec_list,
0467         .quirk_data = &adl_max98360a_amp,
0468         .sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg",
0469     },
0470     {
0471         .id = "10508825",
0472         .drv_name = "adl_rt1019p_nau8825",
0473         .machine_quirk = snd_soc_acpi_codec_list,
0474         .quirk_data = &adl_rt1019p_amp,
0475         .sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg",
0476     },
0477     {
0478         .id = "10508825",
0479         .drv_name = "adl_max98373_nau8825",
0480         .machine_quirk = snd_soc_acpi_codec_list,
0481         .quirk_data = &adl_max98373_amp,
0482         .sof_tplg_filename = "sof-adl-max98373-nau8825.tplg",
0483     },
0484     {
0485         .id = "10508825",
0486         .drv_name = "adl_mx98360a_nau8825",
0487         .machine_quirk = snd_soc_acpi_codec_list,
0488         .quirk_data = &adl_max98360a_amp,
0489         .sof_tplg_filename = "sof-adl-max98360a-nau8825.tplg",
0490     },
0491     {
0492         .id = "RTL5682",
0493         .drv_name = "adl_rt1019_rt5682s",
0494         .machine_quirk = snd_soc_acpi_codec_list,
0495         .quirk_data = &adl_rt1019p_amp,
0496         .sof_tplg_filename = "sof-adl-rt1019-rt5682.tplg",
0497     },
0498     {
0499         .id = "10508825",
0500         .drv_name = "sof_nau8825",
0501         .sof_tplg_filename = "sof-adl-nau8825.tplg",
0502     },
0503     {
0504         .comp_ids = &adl_rt5682_rt5682s_hp,
0505         .drv_name = "adl_max98390_rt5682",
0506         .machine_quirk = snd_soc_acpi_codec_list,
0507         .quirk_data = &adl_max98390_amp,
0508         .sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
0509     },
0510     {
0511         .comp_ids = &adl_rt5682_rt5682s_hp,
0512         .drv_name = "adl_rt5682",
0513         .sof_tplg_filename = "sof-adl-rt5682.tplg",
0514     },
0515     {
0516         .id = "10134242",
0517         .drv_name = "adl_mx98360a_cs4242",
0518         .machine_quirk = snd_soc_acpi_codec_list,
0519         .quirk_data = &adl_max98360a_amp,
0520         .sof_tplg_filename = "sof-adl-max98360a-cs42l42.tplg",
0521     },
0522     /* place amp-only boards in the end of table */
0523     {
0524         .id = "CSC3541",
0525         .drv_name = "adl_cs35l41",
0526         .sof_tplg_filename = "sof-adl-cs35l41.tplg",
0527     },
0528     {
0529         .comp_ids = &essx_83x6,
0530         .drv_name = "adl_es83x6_c1_h02",
0531         .machine_quirk = snd_soc_acpi_codec_list,
0532         .quirk_data = &adl_lt6911_hdmi,
0533         .sof_tplg_filename = "sof-adl-es83x6-ssp1-hdmi-ssp02.tplg",
0534     },
0535     {
0536         .comp_ids = &essx_83x6,
0537         .drv_name = "sof-essx8336",
0538         .sof_tplg_filename = "sof-adl-es83x6", /* the tplg suffix is added at run time */
0539         .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
0540                     SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
0541                     SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
0542     },
0543     {},
0544 };
0545 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines);
0546 
0547 /* this table is used when there is no I2S codec present */
0548 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
0549     {
0550         .link_mask = 0xF, /* 4 active links required */
0551         .links = adl_default,
0552         .drv_name = "sof_sdw",
0553         .sof_tplg_filename = "sof-adl-rt711-l0-rt1308-l12-rt715-l3.tplg",
0554     },
0555     {
0556         .link_mask = 0xF, /* 4 active links required */
0557         .links = adl_sdca_default,
0558         .drv_name = "sof_sdw",
0559         .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l12-rt714-l3.tplg",
0560     },
0561     {
0562         .link_mask = 0xF, /* 4 active links required */
0563         .links = adl_sdca_3_in_1,
0564         .drv_name = "sof_sdw",
0565         .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l13-rt714-l2.tplg",
0566     },
0567     {
0568         .link_mask = 0xF, /* 4 active links required */
0569         .links = adl_sdw_rt711_link2_rt1316_link01_rt714_link3,
0570         .drv_name = "sof_sdw",
0571         .sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01-rt714-l3.tplg",
0572     },
0573     {
0574         .link_mask = 0x7, /* rt1316 on link0 and link1 & rt711 on link2*/
0575         .links = adl_sdw_rt711_link2_rt1316_link01,
0576         .drv_name = "sof_sdw",
0577         .sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01.tplg",
0578     },
0579     {
0580         .link_mask = 0xC, /* rt1316 on link2 & rt714 on link3 */
0581         .links = adl_sdw_rt1316_link2_rt714_link3,
0582         .drv_name = "sof_sdw",
0583         .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg",
0584     },
0585     {
0586         .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
0587         .links = adl_sdw_rt1316_link12_rt714_link0,
0588         .drv_name = "sof_sdw",
0589         .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg",
0590     },
0591     {
0592         .link_mask = 0x5, /* 2 active links required */
0593         .links = adl_sdw_rt1316_link2_rt714_link0,
0594         .drv_name = "sof_sdw",
0595         .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l0.tplg",
0596     },
0597     {
0598         .link_mask = 0x9, /* 2 active links required */
0599         .links = adl_sdw_rt711_link0_rt1316_link3,
0600         .drv_name = "sof_sdw",
0601         .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l3.tplg",
0602     },
0603     {
0604         .link_mask = 0x1, /* link0 required */
0605         .links = adl_rvp,
0606         .drv_name = "sof_sdw",
0607         .sof_tplg_filename = "sof-adl-rt711.tplg",
0608     },
0609     {
0610         .link_mask = 0x1, /* link0 required */
0611         .links = adlps_rvp,
0612         .drv_name = "sof_sdw",
0613         .sof_tplg_filename = "sof-adl-rt711.tplg",
0614     },
0615     {
0616         .link_mask = 0x5, /* rt5682 on link0 & 2xmax98373 on link 2 */
0617         .links = adl_chromebook_base,
0618         .drv_name = "sof_sdw",
0619         .sof_tplg_filename = "sof-adl-sdw-max98373-rt5682.tplg",
0620     },
0621     {},
0622 };
0623 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_sdw_machines);