[PATCH 3/8] ALSA: hda/conexant: Add model option to codec driver, too
Takashi Iwai
tiwai at suse.de
Thu Sep 29 09:35:40 CEST 2022
The model option of snd-hda-intel or SOF driver is useful for testing
/ debugging quirks. Since many devices have multiple codecs and the
quirk is rather codec-specific, it's often difficult to pass the model
to the proper target.
This patch adds the equivalent model option to Conexant codec driver,
so that user can optionally specify the option for the codec instead
of snd-hda-intel or SOF drivers.
That is, you can pass the boot option like
snd_hda_codec_conexant.model=foobar
or
snd_hda_codec_conexant.model=17aa:3905
for applying a quirk no matter whether you use snd-hda-intel or SOF.
The model option of snd-hda-intel or SOF is still effective. When the
option is given for both, the option for the controller driver wins.
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
sound/pci/hda/patch_conexant.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 7b1a30a551f6..8a4a793740f3 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -11,6 +11,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/jack.h>
@@ -21,6 +22,11 @@
#include "hda_jack.h"
#include "hda_generic.h"
+/* codec-specific model option -- equivalent with snd-hda-intel.model option */
+static char *codec_model;
+module_param_named(model, codec_model, charp, 0444);
+MODULE_PARM_DESC(model, "Use the given board model.");
+
struct conexant_spec {
struct hda_gen_spec gen;
@@ -1038,6 +1044,10 @@ static int patch_conexant_auto(struct hda_codec *codec)
codec->spec = spec;
codec->patch_ops = cx_auto_patch_ops;
+ /* assign optional modelname; freed at snd_hda_codec_dev_release() */
+ if (!codec->modelname && codec_model)
+ codec->modelname = kstrdup(codec_model, GFP_KERNEL);
+
cx_auto_parse_eapd(codec);
spec->gen.own_eapd_ctl = 1;
--
2.35.3
More information about the Alsa-devel
mailing list