ALSA: hda - Allow user to give hints for codec parser behavior

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>
This commit is contained in:
Takashi Iwai 2013-01-11 17:48:22 +01:00
parent bc759721fb
commit 1c70a58341
2 changed files with 73 additions and 0 deletions

View 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));

View 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;