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 VIA 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_via.model=foobar or snd_hda_codec_via.model=1043:13f7 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@suse.de --- sound/pci/hda/patch_via.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index aea7fae2ca4b..a60900525d8c 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -37,6 +37,7 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <sound/core.h> #include <sound/asoundef.h> #include <sound/hda_codec.h> @@ -45,6 +46,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."); + /* Pin Widget NID */ #define VT1708_HP_PIN_NID 0x20 #define VT1708_CD_PIN_NID 0x24 @@ -119,6 +125,11 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) codec->power_save_node = 1; spec->gen.power_down_unused = 1; codec->patch_ops = via_patch_ops; + + /* assign optional modelname; freed at snd_hda_codec_dev_release() */ + if (!codec->modelname && codec_model) + codec->modelname = kstrdup(codec_model, GFP_KERNEL); + return spec; }