From: Vitaly Rodionov <vitalyr@opensource.cirrus.com> To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org> Cc: <alsa-devel@alsa-project.org>, <patches@opensource.cirrus.com>, <linux-kernel@vger.kernel.org>, Stefan Binding <sbinding@opensource.cirrus.com> Subject: [PATCH v8 07/14] ALSA: hda: cs35l41: Support multiple load paths for firmware Date: Thu, 30 Jun 2022 01:23:28 +0100 [thread overview] Message-ID: <20220630002335.366545-8-vitalyr@opensource.cirrus.com> (raw) In-Reply-To: <20220630002335.366545-1-vitalyr@opensource.cirrus.com> From: Stefan Binding <sbinding@opensource.cirrus.com> To be able to support different firmwares and tuning for different models, the driver needs to be able to load a different firmware and coefficient file based on its Subsystem ID. The driver attempts to load the firmware in the following order: /lib/firmware/cirrus/cs35l41-dsp1-<fw-type>-<ssid>-dev<#>.wmfw /lib/firmware/cirrus/cs35l41-dsp1-<fw-type>-<ssid>.wmfw /lib/firmware/cirrus/cs35l41-dsp1-<fw-type>.wmfw Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> --- sound/pci/hda/cs35l41_hda.c | 52 ++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 2af3bb5ea1fb..b3561d72df2a 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -85,14 +85,23 @@ static const struct cs_dsp_client_ops client_ops = { static int cs35l41_request_firmware_file(struct cs35l41_hda *cs35l41, const struct firmware **firmware, char **filename, - const char *dir, const char *filetype) + const char *dir, const char *ssid, const char *amp_name, + const char *filetype) { const char * const dsp_name = cs35l41->cs_dsp.name; char *s, c; int ret = 0; - *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, CS35L41_PART, dsp_name, "spk-prot", - filetype); + if (ssid && amp_name) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, "spk-prot", ssid, amp_name, + filetype); + else if (ssid) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, "spk-prot", ssid, filetype); + else + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, "spk-prot", filetype); if (*filename == NULL) return -ENOMEM; @@ -129,12 +138,43 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, { int ret; - /* cirrus/part-dspN-fwtype.wmfw */ + /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, "bin"); + return 0; + } + + /* try cirrus/part-dspN-fwtype-sub.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + NULL, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + cs35l41->amp_name, "bin"); + if (ret) + /* try cirrus/part-dspN-fwtype-sub.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, NULL, "bin"); + return 0; + } + + /* fallback try cirrus/part-dspN-fwtype.wmfw */ ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, - CS35L41_FIRMWARE_ROOT, "wmfw"); + CS35L41_FIRMWARE_ROOT, NULL, NULL, "wmfw"); if (!ret) { + /* fallback try cirrus/part-dspN-fwtype.bin */ cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, "bin"); + CS35L41_FIRMWARE_ROOT, NULL, NULL, "bin"); return 0; } -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Rodionov <vitalyr@opensource.cirrus.com> To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org> Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Stefan Binding <sbinding@opensource.cirrus.com> Subject: [PATCH v8 07/14] ALSA: hda: cs35l41: Support multiple load paths for firmware Date: Thu, 30 Jun 2022 01:23:28 +0100 [thread overview] Message-ID: <20220630002335.366545-8-vitalyr@opensource.cirrus.com> (raw) In-Reply-To: <20220630002335.366545-1-vitalyr@opensource.cirrus.com> From: Stefan Binding <sbinding@opensource.cirrus.com> To be able to support different firmwares and tuning for different models, the driver needs to be able to load a different firmware and coefficient file based on its Subsystem ID. The driver attempts to load the firmware in the following order: /lib/firmware/cirrus/cs35l41-dsp1-<fw-type>-<ssid>-dev<#>.wmfw /lib/firmware/cirrus/cs35l41-dsp1-<fw-type>-<ssid>.wmfw /lib/firmware/cirrus/cs35l41-dsp1-<fw-type>.wmfw Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> --- sound/pci/hda/cs35l41_hda.c | 52 ++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 2af3bb5ea1fb..b3561d72df2a 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -85,14 +85,23 @@ static const struct cs_dsp_client_ops client_ops = { static int cs35l41_request_firmware_file(struct cs35l41_hda *cs35l41, const struct firmware **firmware, char **filename, - const char *dir, const char *filetype) + const char *dir, const char *ssid, const char *amp_name, + const char *filetype) { const char * const dsp_name = cs35l41->cs_dsp.name; char *s, c; int ret = 0; - *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, CS35L41_PART, dsp_name, "spk-prot", - filetype); + if (ssid && amp_name) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, "spk-prot", ssid, amp_name, + filetype); + else if (ssid) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, "spk-prot", ssid, filetype); + else + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, "spk-prot", filetype); if (*filename == NULL) return -ENOMEM; @@ -129,12 +138,43 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, { int ret; - /* cirrus/part-dspN-fwtype.wmfw */ + /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, "bin"); + return 0; + } + + /* try cirrus/part-dspN-fwtype-sub.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + NULL, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + cs35l41->amp_name, "bin"); + if (ret) + /* try cirrus/part-dspN-fwtype-sub.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, NULL, "bin"); + return 0; + } + + /* fallback try cirrus/part-dspN-fwtype.wmfw */ ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, - CS35L41_FIRMWARE_ROOT, "wmfw"); + CS35L41_FIRMWARE_ROOT, NULL, NULL, "wmfw"); if (!ret) { + /* fallback try cirrus/part-dspN-fwtype.bin */ cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, "bin"); + CS35L41_FIRMWARE_ROOT, NULL, NULL, "bin"); return 0; } -- 2.34.1
next prev parent reply other threads:[~2022-06-30 0:24 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-30 0:23 [PATCH v8 00/14] ALSA: hda: cirrus: Add initial DSP support and firmware loading Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 01/14] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-07-14 9:03 ` Takashi Iwai 2022-07-14 9:03 ` Takashi Iwai 2022-07-14 9:06 ` Takashi Iwai 2022-07-14 9:06 ` Takashi Iwai 2022-07-14 9:26 ` Takashi Iwai 2022-07-14 9:26 ` Takashi Iwai 2022-06-30 0:23 ` [PATCH v8 02/14] ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 03/14] ALSA: hda: cs35l41: Save codec object inside component struct Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 04/14] ALSA: hda: cs35l41: Add initial DSP support and firmware loading Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 05/14] ALSA: hda: cs35l41: Save Subsystem ID inside CS35L41 Driver Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 06/14] ALSA: hda: cs35l41: Support reading subsystem id from ACPI Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov [this message] 2022-06-30 0:23 ` [PATCH v8 07/14] ALSA: hda: cs35l41: Support multiple load paths for firmware Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 08/14] ALSA: hda: cs35l41: Support Speaker ID for laptops Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 09/14] ALSA: hda: cs35l41: Support Hibernation during Suspend Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 10/14] ALSA: hda: cs35l41: Read Speaker Calibration data from UEFI variables Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 11/14] ALSA: hda: hda_cs_dsp_ctl: Add fw id strings Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 12/14] ALSA: hda: cs35l41: Add defaulted values into dsp bypass config sequence Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 13/14] ALSA: hda: cs35l41: Support Firmware switching and reloading Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-06-30 0:23 ` [PATCH v8 14/14] ALSA: hda: cs35l41: Add module parameter to control firmware load Vitaly Rodionov 2022-06-30 0:23 ` Vitaly Rodionov 2022-07-04 12:50 ` [PATCH v8 00/14] ALSA: hda: cirrus: Add initial DSP support and firmware loading Takashi Iwai 2022-07-04 12:50 ` Takashi Iwai 2022-07-06 10:40 ` Vitaly Rodionov 2022-07-15 14:25 ` Takashi Iwai 2022-07-15 14:25 ` Takashi Iwai 2022-07-09 16:27 ` Takashi Iwai 2022-07-09 16:27 ` Takashi Iwai 2022-07-13 11:41 ` Takashi Iwai 2022-07-13 11:41 ` Takashi Iwai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220630002335.366545-8-vitalyr@opensource.cirrus.com \ --to=vitalyr@opensource.cirrus.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=patches@opensource.cirrus.com \ --cc=perex@perex.cz \ --cc=sbinding@opensource.cirrus.com \ --cc=tiwai@suse.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.