ALSA: hda - Allow user to give hints for codec parser behavior
authorTakashi Iwai <tiwai@suse.de>
Fri, 11 Jan 2013 16:48:22 +0000 (17:48 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 12 Jan 2013 07:44:48 +0000 (08:44 +0100)
Through the hints via sysfs or patch, user can set specific behavior
flags for the generic parser now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_auto_parser.c
sound/pci/hda/hda_generic.c

index 55ed857a7922ff14437ec966b4d90fc28cc71a95..33b3ece224c6917e39a24ab033eb76782e8e3c18 100644 (file)
@@ -126,6 +126,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
        struct auto_out_pin hp_out[ARRAY_SIZE(cfg->hp_pins)];
        int i;
 
+       if (!snd_hda_get_int_hint(codec, "parser_flags", &i))
+               cond_flags = i;
+
        memset(cfg, 0, sizeof(*cfg));
 
        memset(line_out, 0, sizeof(line_out));
index 55b7897444a0d575c22067c0066b09abe25db8dd..4bc4cd9338664ffee03ff1257d50708b8355fdbd 100644 (file)
@@ -83,6 +83,74 @@ void snd_hda_gen_spec_free(struct hda_gen_spec *spec)
 }
 EXPORT_SYMBOL_HDA(snd_hda_gen_spec_free);
 
+/*
+ * store user hints
+ */
+static void parse_user_hints(struct hda_codec *codec)
+{
+       struct hda_gen_spec *spec = codec->spec;
+       int val;
+
+       val = snd_hda_get_bool_hint(codec, "jack_detect");
+       if (val >= 0)
+               codec->no_jack_detect = !val;
+       val = snd_hda_get_bool_hint(codec, "inv_jack_detect");
+       if (val >= 0)
+               codec->inv_jack_detect = !!val;
+       val = snd_hda_get_bool_hint(codec, "trigger_sense");
+       if (val >= 0)
+               codec->no_trigger_sense = !val;
+       val = snd_hda_get_bool_hint(codec, "inv_eapd");
+       if (val >= 0)
+               codec->inv_eapd = !!val;
+       val = snd_hda_get_bool_hint(codec, "pcm_format_first");
+       if (val >= 0)
+               codec->pcm_format_first = !!val;
+       val = snd_hda_get_bool_hint(codec, "sticky_stream");
+       if (val >= 0)
+               codec->no_sticky_stream = !val;
+       val = snd_hda_get_bool_hint(codec, "spdif_status_reset");
+       if (val >= 0)
+               codec->spdif_status_reset = !!val;
+       val = snd_hda_get_bool_hint(codec, "pin_amp_workaround");
+       if (val >= 0)
+               codec->pin_amp_workaround = !!val;
+       val = snd_hda_get_bool_hint(codec, "single_adc_amp");
+       if (val >= 0)
+               codec->single_adc_amp = !!val;
+
+       val = snd_hda_get_bool_hint(codec, "auto_mic");
+       if (val >= 0)
+               spec->suppress_auto_mic = !val;
+       val = snd_hda_get_bool_hint(codec, "line_in_auto_switch");
+       if (val >= 0)
+               spec->line_in_auto_switch = !!val;
+       val = snd_hda_get_bool_hint(codec, "need_dac_fix");
+       if (val >= 0)
+               spec->need_dac_fix = !!val;
+       val = snd_hda_get_bool_hint(codec, "primary_hp");
+       if (val >= 0)
+               spec->no_primary_hp = !val;
+       val = snd_hda_get_bool_hint(codec, "multi_cap_vol");
+       if (val >= 0)
+               spec->multi_cap_vol = !!val;
+       val = snd_hda_get_bool_hint(codec, "inv_dmic_split");
+       if (val >= 0)
+               spec->inv_dmic_split = !!val;
+       val = snd_hda_get_bool_hint(codec, "indep_hp");
+       if (val >= 0)
+               spec->indep_hp = !!val;
+       val = snd_hda_get_bool_hint(codec, "add_stereo_mix_input");
+       if (val >= 0)
+               spec->add_stereo_mix_input = !!val;
+       val = snd_hda_get_bool_hint(codec, "add_out_jack_modes");
+       if (val >= 0)
+               spec->add_out_jack_modes = !!val;
+
+       if (!snd_hda_get_int_hint(codec, "mixer_nid", &val))
+               spec->mixer_nid = val;
+}
+
 /*
  * pin control value accesses
  */
@@ -3304,6 +3372,8 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
        struct hda_gen_spec *spec = codec->spec;
        int err;
 
+       parse_user_hints(codec);
+
        if (cfg != &spec->autocfg) {
                spec->autocfg = *cfg;
                cfg = &spec->autocfg;