All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 2/8] ALSA: hda/cirrus: Add model option to codec driver, too
Date: Thu, 29 Sep 2022 09:35:39 +0200	[thread overview]
Message-ID: <20220929073545.1085-3-tiwai@suse.de> (raw)
In-Reply-To: <20220929073545.1085-1-tiwai@suse.de>

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 Cirrus 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_cirrus.model=foobar
or
  snd_hda_codec_cirrus.model=106b:5e00
for applying a quirk.

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_cirrus.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 6807b4708a17..c70c72c85831 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -8,6 +8,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <linux/pci.h>
 #include <sound/tlv.h>
@@ -17,6 +18,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.");
+
 /*
  */
 
@@ -581,6 +587,10 @@ static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid)
 	codec->power_save_node = 1;
 	snd_hda_gen_spec_init(&spec->gen);
 
+	/* assign optional modelname; freed at snd_hda_codec_dev_release() */
+	if (!codec->modelname && codec_model)
+		codec->modelname = kstrdup(codec_model, GFP_KERNEL);
+
 	return spec;
 }
 
-- 
2.35.3


  parent reply	other threads:[~2022-09-29  7:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  7:35 [PATCH 0/8] ALSA: hda: Add model option to codec drivers, too Takashi Iwai
2022-09-29  7:35 ` [PATCH 1/8] ALSA: hda/realtek: Add model option to codec driver, too Takashi Iwai
2022-09-29  7:35 ` Takashi Iwai [this message]
2022-09-29  7:35 ` [PATCH 3/8] ALSA: hda/conexant: " Takashi Iwai
2022-09-29  7:35 ` [PATCH 4/8] ALSA: hda/cs8409: " Takashi Iwai
2022-09-29  7:35 ` [PATCH 5/8] ALSA: hda/analog: " Takashi Iwai
2022-09-29  7:35 ` [PATCH 6/8] ALSA: hda/sigmatel: " Takashi Iwai
2022-09-29  7:35 ` [PATCH 7/8] ALSA: hda/via: " Takashi Iwai
2022-09-29  7:35 ` [PATCH 8/8] ALSA: doc: Explain more about model option Takashi Iwai
2022-09-29  7:46 ` [PATCH 0/8] ALSA: hda: Add model option to codec drivers, too Jaroslav Kysela
2022-09-29  8:25   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929073545.1085-3-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.