diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-03-10 06:51:11 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-03-14 10:02:14 -0400 |
commit | 584c0c4c359bdac37d94157f8d7fc513d26c8328 (patch) | |
tree | aecf2c4a8f6a21427bc9f136f6e840494ae00051 /sound/pci/hda/patch_realtek.c | |
parent | a09e89f67ca56d6fa7634bd0738d64fa61bc3c39 (diff) |
ALSA: hda - Initialize special cases for input src in init phase
Currently some special handling for the unusual case like dual-ADCs
or a single-input-src is done in the tree-parse time in
set_capture_mixer(). But this setup could be overwritten by static
init verbs.
This patch moves the initialization into the init phase so that
such input-src setup won't be lost.
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d403ee825ef6..dcc455f098a9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -385,6 +385,7 @@ struct alc_spec { | |||
385 | /* other flags */ | 385 | /* other flags */ |
386 | unsigned int no_analog :1; /* digital I/O only */ | 386 | unsigned int no_analog :1; /* digital I/O only */ |
387 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ | 387 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
388 | unsigned int single_input_src:1; | ||
388 | int init_amp; | 389 | int init_amp; |
389 | int codec_variant; /* flag for other variants */ | 390 | int codec_variant; /* flag for other variants */ |
390 | 391 | ||
@@ -3847,6 +3848,8 @@ static struct hda_amp_list alc880_lg_loopbacks[] = { | |||
3847 | * Common callbacks | 3848 | * Common callbacks |
3848 | */ | 3849 | */ |
3849 | 3850 | ||
3851 | static void alc_init_special_input_src(struct hda_codec *codec); | ||
3852 | |||
3850 | static int alc_init(struct hda_codec *codec) | 3853 | static int alc_init(struct hda_codec *codec) |
3851 | { | 3854 | { |
3852 | struct alc_spec *spec = codec->spec; | 3855 | struct alc_spec *spec = codec->spec; |
@@ -3857,6 +3860,7 @@ static int alc_init(struct hda_codec *codec) | |||
3857 | 3860 | ||
3858 | for (i = 0; i < spec->num_init_verbs; i++) | 3861 | for (i = 0; i < spec->num_init_verbs; i++) |
3859 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | 3862 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
3863 | alc_init_special_input_src(codec); | ||
3860 | 3864 | ||
3861 | if (spec->init_hook) | 3865 | if (spec->init_hook) |
3862 | spec->init_hook(codec); | 3866 | spec->init_hook(codec); |
@@ -5519,6 +5523,7 @@ static void fixup_single_adc(struct hda_codec *codec) | |||
5519 | spec->capsrc_nids += i; | 5523 | spec->capsrc_nids += i; |
5520 | spec->adc_nids += i; | 5524 | spec->adc_nids += i; |
5521 | spec->num_adc_nids = 1; | 5525 | spec->num_adc_nids = 1; |
5526 | spec->single_input_src = 1; | ||
5522 | } | 5527 | } |
5523 | } | 5528 | } |
5524 | 5529 | ||
@@ -5530,6 +5535,16 @@ static void fixup_dual_adc_switch(struct hda_codec *codec) | |||
5530 | init_capsrc_for_pin(codec, spec->int_mic.pin); | 5535 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
5531 | } | 5536 | } |
5532 | 5537 | ||
5538 | /* initialize some special cases for input sources */ | ||
5539 | static void alc_init_special_input_src(struct hda_codec *codec) | ||
5540 | { | ||
5541 | struct alc_spec *spec = codec->spec; | ||
5542 | if (spec->dual_adc_switch) | ||
5543 | fixup_dual_adc_switch(codec); | ||
5544 | else if (spec->single_input_src) | ||
5545 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); | ||
5546 | } | ||
5547 | |||
5533 | static void set_capture_mixer(struct hda_codec *codec) | 5548 | static void set_capture_mixer(struct hda_codec *codec) |
5534 | { | 5549 | { |
5535 | struct alc_spec *spec = codec->spec; | 5550 | struct alc_spec *spec = codec->spec; |
@@ -5545,7 +5560,7 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
5545 | int mux = 0; | 5560 | int mux = 0; |
5546 | int num_adcs = spec->num_adc_nids; | 5561 | int num_adcs = spec->num_adc_nids; |
5547 | if (spec->dual_adc_switch) | 5562 | if (spec->dual_adc_switch) |
5548 | fixup_dual_adc_switch(codec); | 5563 | num_adcs = 1; |
5549 | else if (spec->auto_mic) | 5564 | else if (spec->auto_mic) |
5550 | fixup_automic_adc(codec); | 5565 | fixup_automic_adc(codec); |
5551 | else if (spec->input_mux) { | 5566 | else if (spec->input_mux) { |
@@ -5554,8 +5569,6 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
5554 | else if (spec->input_mux->num_items == 1) | 5569 | else if (spec->input_mux->num_items == 1) |
5555 | fixup_single_adc(codec); | 5570 | fixup_single_adc(codec); |
5556 | } | 5571 | } |
5557 | if (spec->dual_adc_switch) | ||
5558 | num_adcs = 1; | ||
5559 | spec->cap_mixer = caps[mux][num_adcs - 1]; | 5572 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
5560 | } | 5573 | } |
5561 | } | 5574 | } |