Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: hdac_hda: add HDA patch loader support

HDA patch loader is supported by legacy HDA driver. Implement it on
ASoC HDA driver, too.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230919083209.1919921-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Bard Liao and committed by
Mark Brown
842a62a7 88e20c1f

+34
+28
sound/soc/codecs/hdac_hda.c
··· 7 7 * codec drivers using hdac_ext_bus_ops ops. 8 8 */ 9 9 10 + #include <linux/firmware.h> 10 11 #include <linux/init.h> 11 12 #include <linux/delay.h> 12 13 #include <linux/module.h> ··· 35 34 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |\ 36 35 SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\ 37 36 SNDRV_PCM_RATE_192000) 37 + 38 + #ifdef CONFIG_SND_HDA_PATCH_LOADER 39 + static char *loadable_patch[SNDRV_CARDS]; 40 + 41 + module_param_array_named(patch, loadable_patch, charp, NULL, 0444); 42 + MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface."); 43 + #endif 38 44 39 45 static int hdac_hda_dai_open(struct snd_pcm_substream *substream, 40 46 struct snd_soc_dai *dai); ··· 431 423 dev_err(&hdev->dev, "failed to create hda codec %d\n", ret); 432 424 goto error_no_pm; 433 425 } 426 + 427 + #ifdef CONFIG_SND_HDA_PATCH_LOADER 428 + if (loadable_patch[hda_pvt->dev_index] && *loadable_patch[hda_pvt->dev_index]) { 429 + dev_info(&hdev->dev, "Applying patch firmware '%s'\n", 430 + loadable_patch[hda_pvt->dev_index]); 431 + ret = request_firmware(&hda_pvt->fw, loadable_patch[hda_pvt->dev_index], 432 + &hdev->dev); 433 + if (ret < 0) 434 + goto error_no_pm; 435 + if (hda_pvt->fw) { 436 + ret = snd_hda_load_patch(hcodec->bus, hda_pvt->fw->size, hda_pvt->fw->data); 437 + if (ret < 0) { 438 + dev_err(&hdev->dev, "failed to load hda patch %d\n", ret); 439 + goto error_no_pm; 440 + } 441 + release_firmware(hda_pvt->fw); 442 + hda_pvt->fw = NULL; 443 + } 444 + } 445 + #endif 434 446 /* 435 447 * Overwrite type to HDA_DEV_ASOC since it is a ASoC driver 436 448 * hda_codec.c will check this flag to determine if unregister
+4
sound/soc/codecs/hdac_hda.h
··· 26 26 struct hda_codec *codec; 27 27 struct hdac_hda_pcm pcm[HDAC_DAI_ID_NUM]; 28 28 bool need_display_power; 29 + int dev_index; 30 + #ifdef CONFIG_SND_HDA_PATCH_LOADER 31 + const struct firmware *fw; 32 + #endif 29 33 }; 30 34 31 35 struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void);
+1
sound/soc/intel/skylake/skl.c
··· 736 736 return PTR_ERR(codec); 737 737 738 738 hda_codec->codec = codec; 739 + hda_codec->dev_index = addr; 739 740 dev_set_drvdata(&codec->core.dev, hda_codec); 740 741 741 742 /* use legacy bus only for HDA codecs, idisp uses ext bus */
+1
sound/soc/sof/intel/hda-codec.c
··· 169 169 return ret; 170 170 171 171 hda_priv->codec = codec; 172 + hda_priv->dev_index = address; 172 173 dev_set_drvdata(&codec->core.dev, hda_priv); 173 174 174 175 if ((resp & 0xFFFF0000) == IDISP_VID_INTEL) {