@@ -558,7 +558,7 @@ static int check_nhlt_ssp_mclk_mask(struct snd_sof_dev *sdev, int ssp_num)
558
558
return intel_nhlt_ssp_mclk_mask (nhlt , ssp_num );
559
559
}
560
560
561
- #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC ) || IS_ENABLED ( CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE )
561
+ #if IS_ENABLED (CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE )
562
562
563
563
static const char * fixup_tplg_name (struct snd_sof_dev * sdev ,
564
564
const char * sof_tplg_filename ,
@@ -1045,10 +1045,7 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev,
1045
1045
struct snd_soc_acpi_mach * hda_mach ;
1046
1046
struct snd_sof_pdata * pdata = sdev -> pdata ;
1047
1047
const char * tplg_filename ;
1048
- const char * idisp_str ;
1049
- int dmic_num = 0 ;
1050
1048
int codec_num = 0 ;
1051
- int ret ;
1052
1049
int i ;
1053
1050
1054
1051
/* codec detection */
@@ -1071,33 +1068,30 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev,
1071
1068
* - one external HDAudio codec
1072
1069
*/
1073
1070
if (!* mach && codec_num <= 2 ) {
1074
- bool tplg_fixup ;
1071
+ bool tplg_fixup = false ;
1075
1072
1076
1073
hda_mach = snd_soc_acpi_intel_hda_machines ;
1077
1074
1078
1075
dev_info (bus -> dev , "using HDA machine driver %s now\n" ,
1079
1076
hda_mach -> drv_name );
1080
1077
1081
- if (codec_num == 1 && HDA_IDISP_CODEC (bus -> codec_mask ))
1082
- idisp_str = "-idisp" ;
1083
- else
1084
- idisp_str = "" ;
1085
-
1086
- /* topology: use the info from hda_machines */
1087
- if (pdata -> tplg_filename ) {
1088
- tplg_fixup = false;
1089
- tplg_filename = pdata -> tplg_filename ;
1090
- } else {
1078
+ /*
1079
+ * topology: use the info from hda_machines since tplg file name
1080
+ * is not overwritten
1081
+ */
1082
+ if (!pdata -> tplg_filename )
1091
1083
tplg_fixup = true;
1092
- tplg_filename = hda_mach -> sof_tplg_filename ;
1093
- }
1094
- ret = dmic_detect_topology_fixup (sdev , & tplg_filename , idisp_str , & dmic_num ,
1095
- tplg_fixup );
1096
- if (ret < 0 )
1097
- return ;
1098
1084
1099
- hda_mach -> mach_params .dmic_num = dmic_num ;
1100
- pdata -> tplg_filename = tplg_filename ;
1085
+ if (tplg_fixup &&
1086
+ codec_num == 1 && HDA_IDISP_CODEC (bus -> codec_mask )) {
1087
+ tplg_filename = devm_kasprintf (sdev -> dev , GFP_KERNEL ,
1088
+ "%s-idisp" ,
1089
+ hda_mach -> sof_tplg_filename );
1090
+ if (!tplg_filename )
1091
+ return ;
1092
+
1093
+ hda_mach -> sof_tplg_filename = tplg_filename ;
1094
+ }
1101
1095
1102
1096
if (codec_num == 2 ||
1103
1097
(codec_num == 1 && !HDA_IDISP_CODEC (bus -> codec_mask ))) {
@@ -1311,11 +1305,35 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
1311
1305
const char * tplg_filename ;
1312
1306
const char * tplg_suffix ;
1313
1307
bool amp_name_valid ;
1308
+ bool i2s_mach_found = false;
1314
1309
1315
1310
/* Try I2S or DMIC if it is supported */
1316
- if (interface_mask & (BIT (SOF_DAI_INTEL_SSP ) | BIT (SOF_DAI_INTEL_DMIC )))
1311
+ if (interface_mask & (BIT (SOF_DAI_INTEL_SSP ) | BIT (SOF_DAI_INTEL_DMIC ))) {
1317
1312
mach = snd_soc_acpi_find_machine (desc -> machines );
1313
+ if (mach )
1314
+ i2s_mach_found = true;
1315
+ }
1316
+
1317
+ /*
1318
+ * If I2S fails and no external HDaudio codec is detected,
1319
+ * try SoundWire if it is supported
1320
+ */
1321
+ if (!mach && !HDA_EXT_CODEC (bus -> codec_mask ) &&
1322
+ (interface_mask & BIT (SOF_DAI_INTEL_ALH )))
1323
+ mach = hda_sdw_machine_select (sdev );
1318
1324
1325
+ /*
1326
+ * Choose HDA generic machine driver if mach is NULL.
1327
+ * Otherwise, set certain mach params.
1328
+ */
1329
+ hda_generic_machine_select (sdev , & mach );
1330
+ if (!mach )
1331
+ dev_warn (sdev -> dev , "warning: No matching ASoC machine driver found\n" );
1332
+
1333
+ /*
1334
+ * Fixup tplg file name by appending dmic num, ssp num, codec/amplifier
1335
+ * name string if quirk flag is set.
1336
+ */
1319
1337
if (mach ) {
1320
1338
bool add_extension = false;
1321
1339
bool tplg_fixup = false;
@@ -1349,7 +1367,7 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
1349
1367
tplg_filename = devm_kasprintf (sdev -> dev , GFP_KERNEL ,
1350
1368
"%s%s%d%s" ,
1351
1369
sof_pdata -> tplg_filename ,
1352
- "-dmic" ,
1370
+ i2s_mach_found ? "-dmic" : "- " ,
1353
1371
mach -> mach_params .dmic_num ,
1354
1372
"ch" );
1355
1373
if (!tplg_filename )
@@ -1479,22 +1497,6 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
1479
1497
}
1480
1498
}
1481
1499
1482
- /*
1483
- * If I2S fails and no external HDaudio codec is detected,
1484
- * try SoundWire if it is supported
1485
- */
1486
- if (!mach && !HDA_EXT_CODEC (bus -> codec_mask ) &&
1487
- (interface_mask & BIT (SOF_DAI_INTEL_ALH )))
1488
- mach = hda_sdw_machine_select (sdev );
1489
-
1490
- /*
1491
- * Choose HDA generic machine driver if mach is NULL.
1492
- * Otherwise, set certain mach params.
1493
- */
1494
- hda_generic_machine_select (sdev , & mach );
1495
- if (!mach )
1496
- dev_warn (sdev -> dev , "warning: No matching ASoC machine driver found\n" );
1497
-
1498
1500
return mach ;
1499
1501
}
1500
1502
0 commit comments