[PATCH] ASoC: hdac_hda: fix HDA patch loader support
The array size is irrelevant with SNDRV_CARDS. dev_index is from codec address and the available codec number is HDA_MAX_CODECS. Also, hda_pvt->fw is for a temporary use, no need to add a new extra field in hdac_hda_priv{}.
Fixes: 842a62a75e70 ("ASoC: hdac_hda: add HDA patch loader support") Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- sound/soc/codecs/hdac_hda.c | 15 ++++++++------- sound/soc/codecs/hdac_hda.h | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c index 8f5d97949d3d..355f30779a34 100644 --- a/sound/soc/codecs/hdac_hda.c +++ b/sound/soc/codecs/hdac_hda.c @@ -37,10 +37,10 @@ SNDRV_PCM_RATE_192000)
#ifdef CONFIG_SND_HDA_PATCH_LOADER -static char *loadable_patch[SNDRV_CARDS]; +static char *loadable_patch[HDA_MAX_CODECS];
module_param_array_named(patch, loadable_patch, charp, NULL, 0444); -MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface."); +MODULE_PARM_DESC(patch, "Patch file array for Intel HD audio interface. The array index is the codec address."); #endif
static int hdac_hda_dai_open(struct snd_pcm_substream *substream, @@ -434,20 +434,21 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
#ifdef CONFIG_SND_HDA_PATCH_LOADER if (loadable_patch[hda_pvt->dev_index] && *loadable_patch[hda_pvt->dev_index]) { + const struct firmware *fw; + dev_info(&hdev->dev, "Applying patch firmware '%s'\n", loadable_patch[hda_pvt->dev_index]); - ret = request_firmware(&hda_pvt->fw, loadable_patch[hda_pvt->dev_index], + ret = request_firmware(&fw, loadable_patch[hda_pvt->dev_index], &hdev->dev); if (ret < 0) goto error_no_pm; - if (hda_pvt->fw) { - ret = snd_hda_load_patch(hcodec->bus, hda_pvt->fw->size, hda_pvt->fw->data); + if (fw) { + ret = snd_hda_load_patch(hcodec->bus, fw->size, fw->data); if (ret < 0) { dev_err(&hdev->dev, "failed to load hda patch %d\n", ret); goto error_no_pm; } - release_firmware(hda_pvt->fw); - hda_pvt->fw = NULL; + release_firmware(fw); } } #endif diff --git a/sound/soc/codecs/hdac_hda.h b/sound/soc/codecs/hdac_hda.h index b7a12aea8d32..d03a5d4e7288 100644 --- a/sound/soc/codecs/hdac_hda.h +++ b/sound/soc/codecs/hdac_hda.h @@ -27,9 +27,6 @@ struct hdac_hda_priv { struct hdac_hda_pcm pcm[HDAC_DAI_ID_NUM]; bool need_display_power; int dev_index; -#ifdef CONFIG_SND_HDA_PATCH_LOADER - const struct firmware *fw; -#endif };
struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void);
On Thu, 21 Sep 2023 08:43:17 +0200, Bard Liao wrote:
The array size is irrelevant with SNDRV_CARDS. dev_index is from codec address and the available codec number is HDA_MAX_CODECS. Also, hda_pvt->fw is for a temporary use, no need to add a new extra field in hdac_hda_priv{}.
Fixes: 842a62a75e70 ("ASoC: hdac_hda: add HDA patch loader support") Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
Reviewed-by: Takashi Iwai tiwai@suse.de
thanks,
Takashi
sound/soc/codecs/hdac_hda.c | 15 ++++++++------- sound/soc/codecs/hdac_hda.h | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c index 8f5d97949d3d..355f30779a34 100644 --- a/sound/soc/codecs/hdac_hda.c +++ b/sound/soc/codecs/hdac_hda.c @@ -37,10 +37,10 @@ SNDRV_PCM_RATE_192000)
#ifdef CONFIG_SND_HDA_PATCH_LOADER -static char *loadable_patch[SNDRV_CARDS]; +static char *loadable_patch[HDA_MAX_CODECS];
module_param_array_named(patch, loadable_patch, charp, NULL, 0444); -MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface."); +MODULE_PARM_DESC(patch, "Patch file array for Intel HD audio interface. The array index is the codec address."); #endif
static int hdac_hda_dai_open(struct snd_pcm_substream *substream, @@ -434,20 +434,21 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
#ifdef CONFIG_SND_HDA_PATCH_LOADER if (loadable_patch[hda_pvt->dev_index] && *loadable_patch[hda_pvt->dev_index]) {
const struct firmware *fw;
- dev_info(&hdev->dev, "Applying patch firmware '%s'\n", loadable_patch[hda_pvt->dev_index]);
ret = request_firmware(&hda_pvt->fw, loadable_patch[hda_pvt->dev_index],
if (ret < 0) goto error_no_pm;ret = request_firmware(&fw, loadable_patch[hda_pvt->dev_index], &hdev->dev);
if (hda_pvt->fw) {
ret = snd_hda_load_patch(hcodec->bus, hda_pvt->fw->size, hda_pvt->fw->data);
if (fw) {
ret = snd_hda_load_patch(hcodec->bus, fw->size, fw->data); if (ret < 0) { dev_err(&hdev->dev, "failed to load hda patch %d\n", ret); goto error_no_pm; }
release_firmware(hda_pvt->fw);
hda_pvt->fw = NULL;
} }release_firmware(fw);
#endif diff --git a/sound/soc/codecs/hdac_hda.h b/sound/soc/codecs/hdac_hda.h index b7a12aea8d32..d03a5d4e7288 100644 --- a/sound/soc/codecs/hdac_hda.h +++ b/sound/soc/codecs/hdac_hda.h @@ -27,9 +27,6 @@ struct hdac_hda_priv { struct hdac_hda_pcm pcm[HDAC_DAI_ID_NUM]; bool need_display_power; int dev_index; -#ifdef CONFIG_SND_HDA_PATCH_LOADER
- const struct firmware *fw;
-#endif };
struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void);
2.25.1
On Thu, 21 Sep 2023 14:43:17 +0800, Bard Liao wrote:
The array size is irrelevant with SNDRV_CARDS. dev_index is from codec address and the available codec number is HDA_MAX_CODECS. Also, hda_pvt->fw is for a temporary use, no need to add a new extra field in hdac_hda_priv{}.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: hdac_hda: fix HDA patch loader support commit: 2f3fb85b258334a4247af5c92b4a21480ca5634e
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Bard Liao
-
Mark Brown
-
Takashi Iwai