ALSA: hda - Add more hint options for IDT/Sigmatel codecs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:15 pm

Gitweb:     http://git.kernel.org/linus/6565e4faca257fc51a4c55199d72e2701ba7e819
Commit:     6565e4faca257fc51a4c55199d72e2701ba7e819
Parent:     d78d7a90adf793943cc29a414b6f4364a700aad5
Author:     Takashi Iwai <tiwai@suse.de>
AuthorDate: Mon Mar 2 14:38:35 2009 +0100
Committer:  Takashi Iwai <tiwai@suse.de>
CommitDate: Mon Mar 2 17:30:00 2009 +0100

    ALSA: hda - Add more hint options for IDT/Sigmatel codecs
    
    Allow more options to be set/reset via hwdep hint entry.
    hp_detect, gpio_mask, gpio_dir, gpio_data, eapd_mask and eapd_switch
    can be checked.
    
    For example, to disable hp_detect on the fly,
    	# echo "hp_detect=0" > /sys/class/sound/hwC0D0/hints
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_sigmatel.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7381325..e933156 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3949,6 +3949,36 @@ static void stac92xx_power_down(struct hda_codec *codec)
 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
 				  int enable);
 
+/* override some hints from the hwdep entry */
+static void stac_store_hints(struct hda_codec *codec)
+{
+	struct sigmatel_spec *spec = codec->spec;
+	const char *p;
+	int val;
+
+	val = snd_hda_get_bool_hint(codec, "hp_detect");
+	if (val >= 0)
+		spec->hp_detect = val;
+	p = snd_hda_get_hint(codec, "gpio_mask");
+	if (p) {
+		spec->gpio_mask = simple_strtoul(p, NULL, 0);
+		spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
+			spec->gpio_mask;
+	}
+	p = snd_hda_get_hint(codec, "gpio_dir");
+	if (p)
+		spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
+	p = snd_hda_get_hint(codec, "gpio_data");
+	if (p)
+		spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
+	p = snd_hda_get_hint(codec, "eapd_mask");
+	if (p)
+		spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
+	val = snd_hda_get_bool_hint(codec, "eapd_switch");
+	if (val >= 0)
+		spec->eapd_switch = val;
+}
+
 static int stac92xx_init(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec = codec->spec;
@@ -3965,6 +3995,9 @@ static int stac92xx_init(struct hda_codec *codec)
 				spec->adc_nids[i], 0,
 				AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
 
+	/* override some hints */
+	stac_store_hints(codec);
+
 	/* set up GPIO */
 	gpio = spec->gpio_data;
 	/* turn on EAPD statically when spec->eapd_switch isn't set.
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ALSA: hda - Add more hint options for IDT/Sigmatel codecs, Linux Kernel Mailing ..., (Thu Mar 26, 12:15 pm)