Skip to content

Commit 3657e4c

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: wm_adsp: Fix firmware file search order
Check for the cases of system-specific bin file without a wmfw before falling back to looking for a generic wmfw. All system-specific options should be tried before falling back to loading a generic wmfw/bin. With the original code, the presence of a fallback generic wmfw on the filesystem would prevent using a system-specific tuning with a ROM firmware. Signed-off-by: Richard Fitzgerald <[email protected]> Fixes: 0e7d82c ("ASoC: wm_adsp: Add support for loading bin files without wmfw") Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 41bccc9 commit 3657e4c

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -823,45 +823,39 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,
823823
}
824824
}
825825

826+
/* Check system-specific bin without wmfw before falling back to generic */
827+
if (dsp->wmfw_optional && system_name) {
828+
if (asoc_component_prefix)
829+
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
830+
cirrus_dir, system_name,
831+
asoc_component_prefix, "bin");
832+
833+
if (!*coeff_firmware)
834+
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
835+
cirrus_dir, system_name,
836+
NULL, "bin");
837+
838+
if (*coeff_firmware)
839+
return 0;
840+
}
841+
842+
/* Check legacy location */
826843
if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
827844
"", NULL, NULL, "wmfw")) {
828845
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
829846
"", NULL, NULL, "bin");
830847
return 0;
831848
}
832849

850+
/* Fall back to generic wmfw and optional matching bin */
833851
ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
834852
cirrus_dir, NULL, NULL, "wmfw");
835-
if (!ret) {
853+
if (!ret || dsp->wmfw_optional) {
836854
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
837855
cirrus_dir, NULL, NULL, "bin");
838856
return 0;
839857
}
840858

841-
if (dsp->wmfw_optional) {
842-
if (system_name) {
843-
if (asoc_component_prefix)
844-
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
845-
cirrus_dir, system_name,
846-
asoc_component_prefix, "bin");
847-
848-
if (!*coeff_firmware)
849-
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
850-
cirrus_dir, system_name,
851-
NULL, "bin");
852-
}
853-
854-
if (!*coeff_firmware)
855-
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
856-
"", NULL, NULL, "bin");
857-
858-
if (!*coeff_firmware)
859-
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
860-
cirrus_dir, NULL, NULL, "bin");
861-
862-
return 0;
863-
}
864-
865859
adsp_err(dsp, "Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n",
866860
cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file,
867861
system_name, asoc_component_prefix);

0 commit comments

Comments
 (0)