Commit 3657e4cb authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

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: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 0e7d82cb ("ASoC: wm_adsp: Add support for loading bin files without wmfw")
Link: https://msgid.link/r/20240129162737.497-2-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 41bccc98
...@@ -823,23 +823,8 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, ...@@ -823,23 +823,8 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,
} }
} }
if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, /* Check system-specific bin without wmfw before falling back to generic */
"", NULL, NULL, "wmfw")) { if (dsp->wmfw_optional && system_name) {
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
"", NULL, NULL, "bin");
return 0;
}
ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
cirrus_dir, NULL, NULL, "wmfw");
if (!ret) {
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
cirrus_dir, NULL, NULL, "bin");
return 0;
}
if (dsp->wmfw_optional) {
if (system_name) {
if (asoc_component_prefix) if (asoc_component_prefix)
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
cirrus_dir, system_name, cirrus_dir, system_name,
...@@ -849,16 +834,25 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, ...@@ -849,16 +834,25 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
cirrus_dir, system_name, cirrus_dir, system_name,
NULL, "bin"); NULL, "bin");
if (*coeff_firmware)
return 0;
} }
if (!*coeff_firmware) /* Check legacy location */
if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
"", NULL, NULL, "wmfw")) {
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
"", NULL, NULL, "bin"); "", NULL, NULL, "bin");
return 0;
}
if (!*coeff_firmware) /* Fall back to generic wmfw and optional matching bin */
ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
cirrus_dir, NULL, NULL, "wmfw");
if (!ret || dsp->wmfw_optional) {
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
cirrus_dir, NULL, NULL, "bin"); cirrus_dir, NULL, NULL, "bin");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment