Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Allow for codec model selection with module param
@ 2026-09-14 10:22 Cezary Rojewski
  2026-09-14 16:01 ` Takashi Iwai
  0 siblings, 1 reply; 12+ messages in thread
From: Cezary Rojewski @ 2026-09-14 10:22 UTC (permalink / raw)
  To: tiwai; +Cc: broonie, perex, amade, linux-sound, Cezary Rojewski

Model selection allows for customization of codec behaviour and thus
dealing with various problems on very specific configurations. The
parameter already exists but is part of snd_hda_intel specifically.
Non-Intel HDAudio controllers and DSP-capable drivers cannot benefit
from it.

The common place for all the bus drivers is snd_hda_codec. Add modelname
parameter there and honor it when initializing codec->modelname field.

Link: https://github.com/thesofproject/linux/issues/5683
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/hda/common/codec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index 7d17d773cfbf..73b0009a0395 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -32,6 +32,10 @@
 #define codec_has_clkstop(codec) \
 	((codec)->core.power_caps & AC_PWRST_CLKSTOP)
 
+static char *modelname[HDA_MAX_CODEC_ADDRESS];
+module_param_array_named(model, modelname, charp, NULL, 0444);
+MODULE_PARM_DESC(model, "Use the given board model.");
+
 static int call_exec_verb(struct hda_bus *bus, struct hda_codec *codec,
 			  unsigned int cmd, unsigned int flags,
 			  unsigned int *res)
@@ -966,6 +970,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
 			bool snddev_managed)
 {
 	char component[31];
+	const char *mname;
 	hda_nid_t fg;
 	int err;
 	static const struct snd_device_ops dev_ops = {
@@ -988,8 +993,9 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
 
 	snd_hda_sysfs_init(codec);
 
-	if (codec->bus->modelname) {
-		codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
+	mname = bus->modelname ? bus->modelname : modelname[codec_addr];
+	if (mname && strlen(mname)) {
+		codec->modelname = kstrdup(mname, GFP_KERNEL);
 		if (!codec->modelname)
 			return -ENOMEM;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-09-28 11:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 10:22 [PATCH] ALSA: hda: Allow for codec model selection with module param Cezary Rojewski
2026-09-14 16:01 ` Takashi Iwai
2026-09-14 16:29   ` Cezary Rojewski
2026-09-14 16:44     ` Takashi Iwai
2026-09-14 17:58       ` Cezary Rojewski
2026-09-15 11:14         ` Takashi Iwai
2026-09-15 11:26           ` Cezary Rojewski
2026-09-15 16:02             ` Takashi Iwai
2026-09-16  8:29               ` Cezary Rojewski
2026-09-16 10:57                 ` Takashi Iwai
2026-09-18  8:33                   ` Cezary Rojewski
2026-09-28 11:02                     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox