diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-10 05:17:12 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-10 05:17:12 -0400 |
commit | 3ae30796663cc8e144e5b586198b10bc97f1ec38 (patch) | |
tree | d401b84bedfec3022fb90f7278979ff502886953 | |
parent | f371f12f3e9840771026aa6a9312b554c5bfd6ec (diff) | |
parent | 005b10769c05fb16db70f7689ffb5ba17e3fc324 (diff) |
Merge branch 'fix/hda' into for-linus
* fix/hda:
ALSA: hda - targa and targa-2ch fix
ALSA: hda - fix beep tone calculation for IDT/STAC codecs
ALSA: hda - Missing volume controls for Intel HDA (ALC269/EeePC)
ALSA: hda - Disable AMD SB600 64bit address support only
ALSA: hda - Check widget types while parsing capture source in patch_via.c
ALSA: hda - Fix capture source selection in patch_via.c
ALSA: hda - Add missing EAPD initialization for VIA codecs
ALSA: hda - Clean up VT170x dig-in initialization code
ALSA: hda - Fix error path in the sanity check in azx_pcm_open()
ALSA: hda - move 8086:fb30 quirk (stac9205) to the proper section
-rw-r--r-- | sound/pci/hda/hda_beep.c | 11 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 34 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 16 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 89 |
5 files changed, 92 insertions, 62 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 29272f2e95a0..b0275a050870 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -50,19 +50,22 @@ static void snd_hda_generate_beep(struct work_struct *work) | |||
50 | * The tone frequency of beep generator on IDT/STAC codecs is | 50 | * The tone frequency of beep generator on IDT/STAC codecs is |
51 | * defined from the 8bit tone parameter, in Hz, | 51 | * defined from the 8bit tone parameter, in Hz, |
52 | * freq = 48000 * (257 - tone) / 1024 | 52 | * freq = 48000 * (257 - tone) / 1024 |
53 | * that is from 12kHz to 93.75kHz in step of 46.875 hz | 53 | * that is from 12kHz to 93.75Hz in steps of 46.875 Hz |
54 | */ | 54 | */ |
55 | static int beep_linear_tone(struct hda_beep *beep, int hz) | 55 | static int beep_linear_tone(struct hda_beep *beep, int hz) |
56 | { | 56 | { |
57 | if (hz <= 0) | ||
58 | return 0; | ||
57 | hz *= 1000; /* fixed point */ | 59 | hz *= 1000; /* fixed point */ |
58 | hz = hz - DIGBEEP_HZ_MIN; | 60 | hz = hz - DIGBEEP_HZ_MIN |
61 | + DIGBEEP_HZ_STEP / 2; /* round to nearest step */ | ||
59 | if (hz < 0) | 62 | if (hz < 0) |
60 | hz = 0; /* turn off PC beep*/ | 63 | hz = 0; /* turn off PC beep*/ |
61 | else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) | 64 | else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) |
62 | hz = 0xff; | 65 | hz = 1; /* max frequency */ |
63 | else { | 66 | else { |
64 | hz /= DIGBEEP_HZ_STEP; | 67 | hz /= DIGBEEP_HZ_STEP; |
65 | hz++; | 68 | hz = 255 - hz; |
66 | } | 69 | } |
67 | return hz; | 70 | return hz; |
68 | } | 71 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 1877d95d4aa6..77c1b840ca8b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1455,6 +1455,17 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1455 | return err; | 1455 | return err; |
1456 | } | 1456 | } |
1457 | snd_pcm_limit_hw_rates(runtime); | 1457 | snd_pcm_limit_hw_rates(runtime); |
1458 | /* sanity check */ | ||
1459 | if (snd_BUG_ON(!runtime->hw.channels_min) || | ||
1460 | snd_BUG_ON(!runtime->hw.channels_max) || | ||
1461 | snd_BUG_ON(!runtime->hw.formats) || | ||
1462 | snd_BUG_ON(!runtime->hw.rates)) { | ||
1463 | azx_release_device(azx_dev); | ||
1464 | hinfo->ops.close(hinfo, apcm->codec, substream); | ||
1465 | snd_hda_power_down(apcm->codec); | ||
1466 | mutex_unlock(&chip->open_mutex); | ||
1467 | return -EINVAL; | ||
1468 | } | ||
1458 | spin_lock_irqsave(&chip->reg_lock, flags); | 1469 | spin_lock_irqsave(&chip->reg_lock, flags); |
1459 | azx_dev->substream = substream; | 1470 | azx_dev->substream = substream; |
1460 | azx_dev->running = 0; | 1471 | azx_dev->running = 0; |
@@ -1463,13 +1474,6 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1463 | runtime->private_data = azx_dev; | 1474 | runtime->private_data = azx_dev; |
1464 | snd_pcm_set_sync(substream); | 1475 | snd_pcm_set_sync(substream); |
1465 | mutex_unlock(&chip->open_mutex); | 1476 | mutex_unlock(&chip->open_mutex); |
1466 | |||
1467 | if (snd_BUG_ON(!runtime->hw.channels_min || !runtime->hw.channels_max)) | ||
1468 | return -EINVAL; | ||
1469 | if (snd_BUG_ON(!runtime->hw.formats)) | ||
1470 | return -EINVAL; | ||
1471 | if (snd_BUG_ON(!runtime->hw.rates)) | ||
1472 | return -EINVAL; | ||
1473 | return 0; | 1477 | return 0; |
1474 | } | 1478 | } |
1475 | 1479 | ||
@@ -2329,9 +2333,19 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2329 | gcap = azx_readw(chip, GCAP); | 2333 | gcap = azx_readw(chip, GCAP); |
2330 | snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap); | 2334 | snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap); |
2331 | 2335 | ||
2332 | /* ATI chips seems buggy about 64bit DMA addresses */ | 2336 | /* disable SB600 64bit support for safety */ |
2333 | if (chip->driver_type == AZX_DRIVER_ATI) | 2337 | if ((chip->driver_type == AZX_DRIVER_ATI) || |
2334 | gcap &= ~ICH6_GCAP_64OK; | 2338 | (chip->driver_type == AZX_DRIVER_ATIHDMI)) { |
2339 | struct pci_dev *p_smbus; | ||
2340 | p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, | ||
2341 | PCI_DEVICE_ID_ATI_SBX00_SMBUS, | ||
2342 | NULL); | ||
2343 | if (p_smbus) { | ||
2344 | if (p_smbus->revision < 0x30) | ||
2345 | gcap &= ~ICH6_GCAP_64OK; | ||
2346 | pci_dev_put(p_smbus); | ||
2347 | } | ||
2348 | } | ||
2335 | 2349 | ||
2336 | /* allow 64bit DMA address if supported by H/W */ | 2350 | /* allow 64bit DMA address if supported by H/W */ |
2337 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) | 2351 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e661b21354be..bbb9b42e2604 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -6919,9 +6919,6 @@ static struct hda_verb alc882_targa_verbs[] = { | |||
6919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
6920 | 6920 | ||
6921 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 6921 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
6922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | ||
6923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | ||
6924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | ||
6925 | { } /* end */ | 6922 | { } /* end */ |
6926 | }; | 6923 | }; |
6927 | 6924 | ||
@@ -7241,7 +7238,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
7241 | }, | 7238 | }, |
7242 | [ALC882_TARGA] = { | 7239 | [ALC882_TARGA] = { |
7243 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | 7240 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
7244 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, | 7241 | .init_verbs = { alc882_init_verbs, alc880_gpio3_init_verbs, |
7242 | alc882_targa_verbs}, | ||
7245 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | 7243 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
7246 | .dac_nids = alc882_dac_nids, | 7244 | .dac_nids = alc882_dac_nids, |
7247 | .dig_out_nid = ALC882_DIGOUT_NID, | 7245 | .dig_out_nid = ALC882_DIGOUT_NID, |
@@ -9238,7 +9236,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9238 | }, | 9236 | }, |
9239 | [ALC883_TARGA_DIG] = { | 9237 | [ALC883_TARGA_DIG] = { |
9240 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | 9238 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
9241 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, | 9239 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
9240 | alc883_targa_verbs}, | ||
9242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9241 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9243 | .dac_nids = alc883_dac_nids, | 9242 | .dac_nids = alc883_dac_nids, |
9244 | .dig_out_nid = ALC883_DIGOUT_NID, | 9243 | .dig_out_nid = ALC883_DIGOUT_NID, |
@@ -9251,7 +9250,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9251 | }, | 9250 | }, |
9252 | [ALC883_TARGA_2ch_DIG] = { | 9251 | [ALC883_TARGA_2ch_DIG] = { |
9253 | .mixers = { alc883_targa_2ch_mixer}, | 9252 | .mixers = { alc883_targa_2ch_mixer}, |
9254 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, | 9253 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
9254 | alc883_targa_verbs}, | ||
9255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9256 | .dac_nids = alc883_dac_nids, | 9256 | .dac_nids = alc883_dac_nids, |
9257 | .adc_nids = alc883_adc_nids_alt, | 9257 | .adc_nids = alc883_adc_nids_alt, |
@@ -12878,9 +12878,9 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |||
12878 | 12878 | ||
12879 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { | 12879 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
12880 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 12880 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
12881 | HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 12881 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | 12882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
12883 | HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 12883 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
12884 | { } /* end */ | 12884 | { } /* end */ |
12885 | }; | 12885 | }; |
12886 | 12886 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 14f3c3e0f62d..41b5b3a18c1e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1590,8 +1590,6 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
1590 | /* SigmaTel reference board */ | 1590 | /* SigmaTel reference board */ |
1591 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1591 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1592 | "DFI LanParty", STAC_REF), | 1592 | "DFI LanParty", STAC_REF), |
1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, | ||
1594 | "SigmaTel",STAC_9205_REF), | ||
1595 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | 1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
1596 | "DFI LanParty", STAC_REF), | 1594 | "DFI LanParty", STAC_REF), |
1597 | /* Dell laptops have BIOS problem */ | 1595 | /* Dell laptops have BIOS problem */ |
@@ -2344,6 +2342,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { | |||
2344 | /* SigmaTel reference board */ | 2342 | /* SigmaTel reference board */ |
2345 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 2343 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
2346 | "DFI LanParty", STAC_9205_REF), | 2344 | "DFI LanParty", STAC_9205_REF), |
2345 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, | ||
2346 | "SigmaTel", STAC_9205_REF), | ||
2347 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | 2347 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
2348 | "DFI LanParty", STAC_9205_REF), | 2348 | "DFI LanParty", STAC_9205_REF), |
2349 | /* Dell */ | 2349 | /* Dell */ |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 8e004fb6961a..9008b4b013aa 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -210,7 +210,9 @@ struct via_spec { | |||
210 | /* capture */ | 210 | /* capture */ |
211 | unsigned int num_adc_nids; | 211 | unsigned int num_adc_nids; |
212 | hda_nid_t *adc_nids; | 212 | hda_nid_t *adc_nids; |
213 | hda_nid_t mux_nids[3]; | ||
213 | hda_nid_t dig_in_nid; | 214 | hda_nid_t dig_in_nid; |
215 | hda_nid_t dig_in_pin; | ||
214 | 216 | ||
215 | /* capture source */ | 217 | /* capture source */ |
216 | const struct hda_input_mux *input_mux; | 218 | const struct hda_input_mux *input_mux; |
@@ -319,6 +321,9 @@ static void via_auto_set_output_and_unmute(struct hda_codec *codec, | |||
319 | pin_type); | 321 | pin_type); |
320 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 322 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
321 | AMP_OUT_UNMUTE); | 323 | AMP_OUT_UNMUTE); |
324 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | ||
325 | snd_hda_codec_write(codec, nid, 0, | ||
326 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | ||
322 | } | 327 | } |
323 | 328 | ||
324 | 329 | ||
@@ -387,27 +392,12 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
387 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 392 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
388 | struct via_spec *spec = codec->spec; | 393 | struct via_spec *spec = codec->spec; |
389 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 394 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
390 | unsigned int vendor_id = codec->vendor_id; | 395 | |
391 | 396 | if (!spec->mux_nids[adc_idx]) | |
392 | /* AIW0 lydia 060801 add for correct sw0 input select */ | 397 | return -EINVAL; |
393 | if (IS_VT1708_VENDORID(vendor_id) && (adc_idx == 0)) | 398 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
394 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 399 | spec->mux_nids[adc_idx], |
395 | 0x18, &spec->cur_mux[adc_idx]); | 400 | &spec->cur_mux[adc_idx]); |
396 | else if ((IS_VT1709_10CH_VENDORID(vendor_id) || | ||
397 | IS_VT1709_6CH_VENDORID(vendor_id)) && (adc_idx == 0)) | ||
398 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
399 | 0x19, &spec->cur_mux[adc_idx]); | ||
400 | else if ((IS_VT1708B_8CH_VENDORID(vendor_id) || | ||
401 | IS_VT1708B_4CH_VENDORID(vendor_id)) && (adc_idx == 0)) | ||
402 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
403 | 0x17, &spec->cur_mux[adc_idx]); | ||
404 | else if (IS_VT1702_VENDORID(vendor_id) && (adc_idx == 0)) | ||
405 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
406 | 0x13, &spec->cur_mux[adc_idx]); | ||
407 | else | ||
408 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
409 | spec->adc_nids[adc_idx], | ||
410 | &spec->cur_mux[adc_idx]); | ||
411 | } | 401 | } |
412 | 402 | ||
413 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, | 403 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, |
@@ -998,25 +988,11 @@ static int via_init(struct hda_codec *codec) | |||
998 | 988 | ||
999 | /* Lydia Add for EAPD enable */ | 989 | /* Lydia Add for EAPD enable */ |
1000 | if (!spec->dig_in_nid) { /* No Digital In connection */ | 990 | if (!spec->dig_in_nid) { /* No Digital In connection */ |
1001 | if (IS_VT1708_VENDORID(codec->vendor_id)) { | 991 | if (spec->dig_in_pin) { |
1002 | snd_hda_codec_write(codec, VT1708_DIGIN_PIN, 0, | 992 | snd_hda_codec_write(codec, spec->dig_in_pin, 0, |
1003 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1004 | PIN_OUT); | ||
1005 | snd_hda_codec_write(codec, VT1708_DIGIN_PIN, 0, | ||
1006 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | ||
1007 | } else if (IS_VT1709_10CH_VENDORID(codec->vendor_id) || | ||
1008 | IS_VT1709_6CH_VENDORID(codec->vendor_id)) { | ||
1009 | snd_hda_codec_write(codec, VT1709_DIGIN_PIN, 0, | ||
1010 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 993 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
1011 | PIN_OUT); | 994 | PIN_OUT); |
1012 | snd_hda_codec_write(codec, VT1709_DIGIN_PIN, 0, | 995 | snd_hda_codec_write(codec, spec->dig_in_pin, 0, |
1013 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | ||
1014 | } else if (IS_VT1708B_8CH_VENDORID(codec->vendor_id) || | ||
1015 | IS_VT1708B_4CH_VENDORID(codec->vendor_id)) { | ||
1016 | snd_hda_codec_write(codec, VT1708B_DIGIN_PIN, 0, | ||
1017 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1018 | PIN_OUT); | ||
1019 | snd_hda_codec_write(codec, VT1708B_DIGIN_PIN, 0, | ||
1020 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | 996 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); |
1021 | } | 997 | } |
1022 | } else /* enable SPDIF-input pin */ | 998 | } else /* enable SPDIF-input pin */ |
@@ -1326,6 +1302,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) | |||
1326 | 1302 | ||
1327 | if (spec->autocfg.dig_outs) | 1303 | if (spec->autocfg.dig_outs) |
1328 | spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; | 1304 | spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; |
1305 | spec->dig_in_pin = VT1708_DIGIN_PIN; | ||
1329 | if (spec->autocfg.dig_in_pin) | 1306 | if (spec->autocfg.dig_in_pin) |
1330 | spec->dig_in_nid = VT1708_DIGIN_NID; | 1307 | spec->dig_in_nid = VT1708_DIGIN_NID; |
1331 | 1308 | ||
@@ -1352,6 +1329,34 @@ static int via_auto_init(struct hda_codec *codec) | |||
1352 | return 0; | 1329 | return 0; |
1353 | } | 1330 | } |
1354 | 1331 | ||
1332 | static int get_mux_nids(struct hda_codec *codec) | ||
1333 | { | ||
1334 | struct via_spec *spec = codec->spec; | ||
1335 | hda_nid_t nid, conn[8]; | ||
1336 | unsigned int type; | ||
1337 | int i, n; | ||
1338 | |||
1339 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
1340 | nid = spec->adc_nids[i]; | ||
1341 | while (nid) { | ||
1342 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) | ||
1343 | >> AC_WCAP_TYPE_SHIFT; | ||
1344 | if (type == AC_WID_PIN) | ||
1345 | break; | ||
1346 | n = snd_hda_get_connections(codec, nid, conn, | ||
1347 | ARRAY_SIZE(conn)); | ||
1348 | if (n <= 0) | ||
1349 | break; | ||
1350 | if (n > 1) { | ||
1351 | spec->mux_nids[i] = nid; | ||
1352 | break; | ||
1353 | } | ||
1354 | nid = conn[0]; | ||
1355 | } | ||
1356 | } | ||
1357 | return 0; | ||
1358 | } | ||
1359 | |||
1355 | static int patch_vt1708(struct hda_codec *codec) | 1360 | static int patch_vt1708(struct hda_codec *codec) |
1356 | { | 1361 | { |
1357 | struct via_spec *spec; | 1362 | struct via_spec *spec; |
@@ -1799,6 +1804,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) | |||
1799 | 1804 | ||
1800 | if (spec->autocfg.dig_outs) | 1805 | if (spec->autocfg.dig_outs) |
1801 | spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; | 1806 | spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; |
1807 | spec->dig_in_pin = VT1709_DIGIN_PIN; | ||
1802 | if (spec->autocfg.dig_in_pin) | 1808 | if (spec->autocfg.dig_in_pin) |
1803 | spec->dig_in_nid = VT1709_DIGIN_NID; | 1809 | spec->dig_in_nid = VT1709_DIGIN_NID; |
1804 | 1810 | ||
@@ -1859,6 +1865,7 @@ static int patch_vt1709_10ch(struct hda_codec *codec) | |||
1859 | if (!spec->adc_nids && spec->input_mux) { | 1865 | if (!spec->adc_nids && spec->input_mux) { |
1860 | spec->adc_nids = vt1709_adc_nids; | 1866 | spec->adc_nids = vt1709_adc_nids; |
1861 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); | 1867 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); |
1868 | get_mux_nids(codec); | ||
1862 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; | 1869 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; |
1863 | spec->num_mixers++; | 1870 | spec->num_mixers++; |
1864 | } | 1871 | } |
@@ -1952,6 +1959,7 @@ static int patch_vt1709_6ch(struct hda_codec *codec) | |||
1952 | if (!spec->adc_nids && spec->input_mux) { | 1959 | if (!spec->adc_nids && spec->input_mux) { |
1953 | spec->adc_nids = vt1709_adc_nids; | 1960 | spec->adc_nids = vt1709_adc_nids; |
1954 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); | 1961 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); |
1962 | get_mux_nids(codec); | ||
1955 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; | 1963 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; |
1956 | spec->num_mixers++; | 1964 | spec->num_mixers++; |
1957 | } | 1965 | } |
@@ -2344,6 +2352,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) | |||
2344 | 2352 | ||
2345 | if (spec->autocfg.dig_outs) | 2353 | if (spec->autocfg.dig_outs) |
2346 | spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; | 2354 | spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; |
2355 | spec->dig_in_pin = VT1708B_DIGIN_PIN; | ||
2347 | if (spec->autocfg.dig_in_pin) | 2356 | if (spec->autocfg.dig_in_pin) |
2348 | spec->dig_in_nid = VT1708B_DIGIN_NID; | 2357 | spec->dig_in_nid = VT1708B_DIGIN_NID; |
2349 | 2358 | ||
@@ -2404,6 +2413,7 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) | |||
2404 | if (!spec->adc_nids && spec->input_mux) { | 2413 | if (!spec->adc_nids && spec->input_mux) { |
2405 | spec->adc_nids = vt1708B_adc_nids; | 2414 | spec->adc_nids = vt1708B_adc_nids; |
2406 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); | 2415 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); |
2416 | get_mux_nids(codec); | ||
2407 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; | 2417 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; |
2408 | spec->num_mixers++; | 2418 | spec->num_mixers++; |
2409 | } | 2419 | } |
@@ -2455,6 +2465,7 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
2455 | if (!spec->adc_nids && spec->input_mux) { | 2465 | if (!spec->adc_nids && spec->input_mux) { |
2456 | spec->adc_nids = vt1708B_adc_nids; | 2466 | spec->adc_nids = vt1708B_adc_nids; |
2457 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); | 2467 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); |
2468 | get_mux_nids(codec); | ||
2458 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; | 2469 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; |
2459 | spec->num_mixers++; | 2470 | spec->num_mixers++; |
2460 | } | 2471 | } |
@@ -2889,6 +2900,7 @@ static int patch_vt1708S(struct hda_codec *codec) | |||
2889 | if (!spec->adc_nids && spec->input_mux) { | 2900 | if (!spec->adc_nids && spec->input_mux) { |
2890 | spec->adc_nids = vt1708S_adc_nids; | 2901 | spec->adc_nids = vt1708S_adc_nids; |
2891 | spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids); | 2902 | spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids); |
2903 | get_mux_nids(codec); | ||
2892 | spec->mixers[spec->num_mixers] = vt1708S_capture_mixer; | 2904 | spec->mixers[spec->num_mixers] = vt1708S_capture_mixer; |
2893 | spec->num_mixers++; | 2905 | spec->num_mixers++; |
2894 | } | 2906 | } |
@@ -3206,6 +3218,7 @@ static int patch_vt1702(struct hda_codec *codec) | |||
3206 | if (!spec->adc_nids && spec->input_mux) { | 3218 | if (!spec->adc_nids && spec->input_mux) { |
3207 | spec->adc_nids = vt1702_adc_nids; | 3219 | spec->adc_nids = vt1702_adc_nids; |
3208 | spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids); | 3220 | spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids); |
3221 | get_mux_nids(codec); | ||
3209 | spec->mixers[spec->num_mixers] = vt1702_capture_mixer; | 3222 | spec->mixers[spec->num_mixers] = vt1702_capture_mixer; |
3210 | spec->num_mixers++; | 3223 | spec->num_mixers++; |
3211 | } | 3224 | } |