aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-02 08:38:35 -0500
committerTakashi Iwai <tiwai@suse.de>2009-03-02 11:30:00 -0500
commit6565e4faca257fc51a4c55199d72e2701ba7e819 (patch)
tree580d4c74537ccc6ca794e508585087ff09c6029f /sound/pci/hda/patch_sigmatel.c
parentd78d7a90adf793943cc29a414b6f4364a700aad5 (diff)
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>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7381325b98ff..e9331561a484 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)
3949static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, 3949static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3950 int enable); 3950 int enable);
3951 3951
3952/* override some hints from the hwdep entry */
3953static void stac_store_hints(struct hda_codec *codec)
3954{
3955 struct sigmatel_spec *spec = codec->spec;
3956 const char *p;
3957 int val;
3958
3959 val = snd_hda_get_bool_hint(codec, "hp_detect");
3960 if (val >= 0)
3961 spec->hp_detect = val;
3962 p = snd_hda_get_hint(codec, "gpio_mask");
3963 if (p) {
3964 spec->gpio_mask = simple_strtoul(p, NULL, 0);
3965 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
3966 spec->gpio_mask;
3967 }
3968 p = snd_hda_get_hint(codec, "gpio_dir");
3969 if (p)
3970 spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
3971 p = snd_hda_get_hint(codec, "gpio_data");
3972 if (p)
3973 spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
3974 p = snd_hda_get_hint(codec, "eapd_mask");
3975 if (p)
3976 spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
3977 val = snd_hda_get_bool_hint(codec, "eapd_switch");
3978 if (val >= 0)
3979 spec->eapd_switch = val;
3980}
3981
3952static int stac92xx_init(struct hda_codec *codec) 3982static int stac92xx_init(struct hda_codec *codec)
3953{ 3983{
3954 struct sigmatel_spec *spec = codec->spec; 3984 struct sigmatel_spec *spec = codec->spec;
@@ -3965,6 +3995,9 @@ static int stac92xx_init(struct hda_codec *codec)
3965 spec->adc_nids[i], 0, 3995 spec->adc_nids[i], 0,
3966 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3996 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3967 3997
3998 /* override some hints */
3999 stac_store_hints(codec);
4000
3968 /* set up GPIO */ 4001 /* set up GPIO */
3969 gpio = spec->gpio_data; 4002 gpio = spec->gpio_data;
3970 /* turn on EAPD statically when spec->eapd_switch isn't set. 4003 /* turn on EAPD statically when spec->eapd_switch isn't set.