aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-22 04:50:19 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-22 05:06:05 -0400
commit0169b6b33b2b4d9e66e98afc56272e5fbd350df4 (patch)
tree6546cd6de863ff09b4b1ca0cbb8ef8bd40981332 /sound/pci/hda/patch_realtek.c
parent376b508ffde3b17e105265f89b83bdb044b1c1ae (diff)
ALSA: hda - Fix check of input source type for realtek codecs
Fix the check of the input-source type by checking the widget type of each capture-source item. Since some codecs can have both the mixer and selector types depending on the ADC, alc_mux_enum_put() needs to check each widget. With this change, spec->capture_style gets unneeded, so it's removed, too. 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.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d20168494dd7..28a587353b11 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -250,13 +250,6 @@ enum {
250 ALC883_MODEL_LAST, 250 ALC883_MODEL_LAST,
251}; 251};
252 252
253/* styles of capture selection */
254enum {
255 CAPT_MUX = 0, /* only mux based */
256 CAPT_MIX, /* only mixer based */
257 CAPT_1MUX_MIX, /* first mux and other mixers */
258};
259
260/* for GPIO Poll */ 253/* for GPIO Poll */
261#define GPIO_MASK 0x03 254#define GPIO_MASK 0x03
262 255
@@ -306,7 +299,6 @@ struct alc_spec {
306 hda_nid_t *adc_nids; 299 hda_nid_t *adc_nids;
307 hda_nid_t *capsrc_nids; 300 hda_nid_t *capsrc_nids;
308 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 301 hda_nid_t dig_in_nid; /* digital-in NID; optional */
309 int capture_style; /* capture style (CAPT_*) */
310 302
311 /* capture source */ 303 /* capture source */
312 unsigned int num_mux_defs; 304 unsigned int num_mux_defs;
@@ -420,12 +412,13 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
420 unsigned int mux_idx; 412 unsigned int mux_idx;
421 hda_nid_t nid = spec->capsrc_nids ? 413 hda_nid_t nid = spec->capsrc_nids ?
422 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 414 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
415 unsigned int type;
423 416
424 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 417 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
425 imux = &spec->input_mux[mux_idx]; 418 imux = &spec->input_mux[mux_idx];
426 419
427 if (spec->capture_style && 420 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
428 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { 421 if (type == AC_WID_AUD_MIX) {
429 /* Matrix-mixer style (e.g. ALC882) */ 422 /* Matrix-mixer style (e.g. ALC882) */
430 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 423 unsigned int *cur_val = &spec->cur_mux[adc_idx];
431 unsigned int i, idx; 424 unsigned int i, idx;
@@ -7557,7 +7550,6 @@ static int patch_alc882(struct hda_codec *codec)
7557 spec->stream_digital_playback = &alc882_pcm_digital_playback; 7550 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7558 spec->stream_digital_capture = &alc882_pcm_digital_capture; 7551 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7559 7552
7560 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7561 if (!spec->adc_nids && spec->input_mux) { 7553 if (!spec->adc_nids && spec->input_mux) {
7562 /* check whether NID 0x07 is valid */ 7554 /* check whether NID 0x07 is valid */
7563 unsigned int wcap = get_wcaps(codec, 0x07); 7555 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -9781,7 +9773,6 @@ static int patch_alc883(struct hda_codec *codec)
9781 } 9773 }
9782 if (!spec->capsrc_nids) 9774 if (!spec->capsrc_nids)
9783 spec->capsrc_nids = alc883_capsrc_nids; 9775 spec->capsrc_nids = alc883_capsrc_nids;
9784 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9785 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ 9776 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9786 break; 9777 break;
9787 case 0x10ec0889: 9778 case 0x10ec0889:
@@ -9791,8 +9782,6 @@ static int patch_alc883(struct hda_codec *codec)
9791 } 9782 }
9792 if (!spec->capsrc_nids) 9783 if (!spec->capsrc_nids)
9793 spec->capsrc_nids = alc889_capsrc_nids; 9784 spec->capsrc_nids = alc889_capsrc_nids;
9794 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9795 capture */
9796 break; 9785 break;
9797 default: 9786 default:
9798 if (!spec->num_adc_nids) { 9787 if (!spec->num_adc_nids) {
@@ -9801,7 +9790,6 @@ static int patch_alc883(struct hda_codec *codec)
9801 } 9790 }
9802 if (!spec->capsrc_nids) 9791 if (!spec->capsrc_nids)
9803 spec->capsrc_nids = alc883_capsrc_nids; 9792 spec->capsrc_nids = alc883_capsrc_nids;
9804 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9805 break; 9793 break;
9806 } 9794 }
9807 9795
@@ -11642,7 +11630,6 @@ static int patch_alc262(struct hda_codec *codec)
11642 spec->stream_digital_playback = &alc262_pcm_digital_playback; 11630 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11643 spec->stream_digital_capture = &alc262_pcm_digital_capture; 11631 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11644 11632
11645 spec->capture_style = CAPT_MIX;
11646 if (!spec->adc_nids && spec->input_mux) { 11633 if (!spec->adc_nids && spec->input_mux) {
11647 /* check whether NID 0x07 is valid */ 11634 /* check whether NID 0x07 is valid */
11648 unsigned int wcap = get_wcaps(codec, 0x07); 11635 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -15556,7 +15543,6 @@ static int patch_alc861vd(struct hda_codec *codec)
15556 spec->adc_nids = alc861vd_adc_nids; 15543 spec->adc_nids = alc861vd_adc_nids;
15557 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 15544 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15558 spec->capsrc_nids = alc861vd_capsrc_nids; 15545 spec->capsrc_nids = alc861vd_capsrc_nids;
15559 spec->capture_style = CAPT_MIX;
15560 15546
15561 set_capture_mixer(spec); 15547 set_capture_mixer(spec);
15562 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 15548 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
@@ -17476,7 +17462,6 @@ static int patch_alc662(struct hda_codec *codec)
17476 spec->adc_nids = alc662_adc_nids; 17462 spec->adc_nids = alc662_adc_nids;
17477 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 17463 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17478 spec->capsrc_nids = alc662_capsrc_nids; 17464 spec->capsrc_nids = alc662_capsrc_nids;
17479 spec->capture_style = CAPT_MIX;
17480 17465
17481 if (!spec->cap_mixer) 17466 if (!spec->cap_mixer)
17482 set_capture_mixer(spec); 17467 set_capture_mixer(spec);