Skip to contentSkip to conversation

hda - Support rereading widgets under the function group

PATCH Applied [email protected] 2 participants 2 messages Feb 8, 2013 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 hda - Support rereading widgets under the function group

From: Mengdong Lin <[email protected]>

A codec may allow software to hide some unused pin/cvt widgets.

Sometimes BIOS does not enable the hidden widgets properly although they are needed for the board. Thus the driver need to enable them as a board-specific fixup and the whole tree will change.

This patch implements a common code for rereading codec widgets. So the fixup code can call it after enabling the hidden widgets.

sound/pci/hda/hda_codec.c +24 -0
index 3c92514..e80f835 100644
@@ -1441,6 +1441,30 @@ int snd_hda_codec_new(struct hda_bus *bus,
 }
 EXPORT_SYMBOL_HDA(snd_hda_codec_new);
 
+int snd_hda_codec_update_widgets(struct hda_codec *codec)
+{
+	hda_nid_t fg;
+	int err;
+
+	/* Assume the function group node does not change,
+	 * only the widget nodes may change.
+	 */
+	kfree(codec->wcaps);
+	fg = codec->afg ? codec->afg : codec->mfg;
+	err = read_widget_caps(codec, fg);
+	if (err < 0) {
+		snd_printk(KERN_ERR "hda_codec: cannot malloc\n");
+		return err;
+	}
+
+	snd_array_free(&codec->init_pins);
+	err = read_pin_defaults(codec);
+
+	return err;
+}
+EXPORT_SYMBOL_HDA(snd_hda_codec_update_widgets);
+
+
 /**
  * snd_hda_codec_configure - (Re-)configure the HD-audio codec
  * @codec: the HDA codec
sound/pci/hda/hda_codec.h +1 -0
index 0be1826..e8c9442 100644
@@ -935,6 +935,7 @@ int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
 int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
 		      struct hda_codec **codecp);
 int snd_hda_codec_configure(struct hda_codec *codec);
+int snd_hda_codec_update_widgets(struct hda_codec *codec);
 
 /*
  * low level functions
Signature · 1 line
1.7.10.4
Applied
#1 lore raw

At Fri, 8 Feb 2013 17:09:31 -0500,

Quoted 5 lines · [email protected] wrote:

From: Mengdong Lin <[email protected]>

A codec may allow software to hide some unused pin/cvt widgets.

Quoted 8 lines

Sometimes BIOS does not enable the hidden widgets properly although they are needed for the board. Thus the driver need to enable them as a board-specific fixup and the whole tree will change.

This patch implements a common code for rereading codec widgets. So the fixup code can call it after enabling the hidden widgets.

Applied all three patches. Thanks.

Takashi

Quoted 56 lines
sound/pci/hda/hda_codec.c +24 -0
index 3c92514..e80f835 100644
@@ -1441,6 +1441,30 @@ int snd_hda_codec_new(struct hda_bus *bus,
 }
 EXPORT_SYMBOL_HDA(snd_hda_codec_new);
 
+int snd_hda_codec_update_widgets(struct hda_codec *codec)
+{
+	hda_nid_t fg;
+	int err;
+
+	/* Assume the function group node does not change,
+	 * only the widget nodes may change.
+	 */
+	kfree(codec->wcaps);
+	fg = codec->afg ? codec->afg : codec->mfg;
+	err = read_widget_caps(codec, fg);
+	if (err < 0) {
+		snd_printk(KERN_ERR "hda_codec: cannot malloc\n");
+		return err;
+	}
+
+	snd_array_free(&codec->init_pins);
+	err = read_pin_defaults(codec);
+
+	return err;
+}
+EXPORT_SYMBOL_HDA(snd_hda_codec_update_widgets);
+
+
 /**
  * snd_hda_codec_configure - (Re-)configure the HD-audio codec
  * @codec: the HDA codec
sound/pci/hda/hda_codec.h +1 -0
index 0be1826..e8c9442 100644
@@ -935,6 +935,7 @@ int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
 int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
 		      struct hda_codec **codecp);
 int snd_hda_codec_configure(struct hda_codec *codec);
+int snd_hda_codec_update_widgets(struct hda_codec *codec);
 
 /*
  * low level functions
Signature · 6 lines
1.7.10.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel