Merge branch 'fix/hda' into for-linus

+71 -48
+34 -23
sound/pci/hda/hda_codec.c
··· 1919 1919 } 1920 1920 EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); 1921 1921 1922 + static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name) 1923 + { 1924 + int idx; 1925 + for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */ 1926 + if (!_snd_hda_find_mixer_ctl(codec, name, idx)) 1927 + return idx; 1928 + } 1929 + return -EBUSY; 1930 + } 1931 + 1922 1932 /** 1923 1933 * snd_hda_ctl_add - Add a control element and assign to the codec 1924 1934 * @codec: HD-audio codec ··· 2664 2654 { } /* end */ 2665 2655 }; 2666 2656 2667 - #define SPDIF_MAX_IDX 4 /* 4 instances should be enough to probe */ 2668 - 2669 2657 /** 2670 2658 * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls 2671 2659 * @codec: the HDA codec ··· 2681 2673 struct snd_kcontrol_new *dig_mix; 2682 2674 int idx; 2683 2675 2684 - for (idx = 0; idx < SPDIF_MAX_IDX; idx++) { 2685 - if (!_snd_hda_find_mixer_ctl(codec, "IEC958 Playback Switch", 2686 - idx)) 2687 - break; 2688 - } 2689 - if (idx >= SPDIF_MAX_IDX) { 2676 + idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch"); 2677 + if (idx < 0) { 2690 2678 printk(KERN_ERR "hda_codec: too many IEC958 outputs\n"); 2691 2679 return -EBUSY; 2692 2680 } ··· 2833 2829 struct snd_kcontrol_new *dig_mix; 2834 2830 int idx; 2835 2831 2836 - for (idx = 0; idx < SPDIF_MAX_IDX; idx++) { 2837 - if (!_snd_hda_find_mixer_ctl(codec, "IEC958 Capture Switch", 2838 - idx)) 2839 - break; 2840 - } 2841 - if (idx >= SPDIF_MAX_IDX) { 2832 + idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch"); 2833 + if (idx < 0) { 2842 2834 printk(KERN_ERR "hda_codec: too many IEC958 inputs\n"); 2843 2835 return -EBUSY; 2844 2836 } ··· 3808 3808 3809 3809 for (; knew->name; knew++) { 3810 3810 struct snd_kcontrol *kctl; 3811 + int addr = 0, idx = 0; 3811 3812 if (knew->iface == -1) /* skip this codec private value */ 3812 3813 continue; 3813 - kctl = snd_ctl_new1(knew, codec); 3814 - if (!kctl) 3815 - return -ENOMEM; 3816 - err = snd_hda_ctl_add(codec, 0, kctl); 3817 - if (err < 0) { 3818 - if (!codec->addr) 3819 - return err; 3814 + for (;;) { 3820 3815 kctl = snd_ctl_new1(knew, codec); 3821 3816 if (!kctl) 3822 3817 return -ENOMEM; 3823 - kctl->id.device = codec->addr; 3818 + if (addr > 0) 3819 + kctl->id.device = addr; 3820 + if (idx > 0) 3821 + kctl->id.index = idx; 3824 3822 err = snd_hda_ctl_add(codec, 0, kctl); 3825 - if (err < 0) 3823 + if (!err) 3824 + break; 3825 + /* try first with another device index corresponding to 3826 + * the codec addr; if it still fails (or it's the 3827 + * primary codec), then try another control index 3828 + */ 3829 + if (!addr && codec->addr) 3830 + addr = codec->addr; 3831 + else if (!idx && !knew->index) { 3832 + idx = find_empty_mixer_ctl_idx(codec, 3833 + knew->name); 3834 + if (idx <= 0) 3835 + return err; 3836 + } else 3826 3837 return err; 3827 3838 } 3828 3839 }
+35 -22
sound/pci/hda/patch_realtek.c
··· 14806 14806 14807 14807 enum { 14808 14808 ALC269_FIXUP_SONY_VAIO, 14809 + ALC275_FIX_SONY_VAIO_GPIO2, 14809 14810 ALC269_FIXUP_DELL_M101Z, 14810 14811 ALC269_FIXUP_SKU_IGNORE, 14811 14812 ALC269_FIXUP_ASUS_G73JW, ··· 14817 14816 .verbs = (const struct hda_verb[]) { 14818 14817 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, 14819 14818 {} 14819 + } 14820 + }, 14821 + [ALC275_FIX_SONY_VAIO_GPIO2] = { 14822 + .verbs = (const struct hda_verb[]) { 14823 + {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14824 + {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14825 + {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 14826 + { } 14820 14827 } 14821 14828 }, 14822 14829 [ALC269_FIXUP_DELL_M101Z] = { ··· 14847 14838 }; 14848 14839 14849 14840 static struct snd_pci_quirk alc269_fixup_tbl[] = { 14841 + SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), 14842 + SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), 14843 + SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), 14850 14844 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14851 14845 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 14852 14846 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), ··· 15104 15092 15105 15093 alc_auto_parse_customize_define(codec); 15106 15094 15107 - coef = alc_read_coef_idx(codec, 0); 15108 - if ((coef & 0x00f0) == 0x0010) { 15109 - if (codec->bus->pci->subsystem_vendor == 0x1025 && 15110 - spec->cdefine.platform_type == 1) { 15111 - alc_codec_rename(codec, "ALC271X"); 15112 - spec->codec_variant = ALC269_TYPE_ALC271X; 15113 - } else if ((coef & 0xf000) == 0x1000) { 15114 - spec->codec_variant = ALC269_TYPE_ALC270; 15115 - } else if ((coef & 0xf000) == 0x2000) { 15116 - alc_codec_rename(codec, "ALC259"); 15117 - spec->codec_variant = ALC269_TYPE_ALC259; 15118 - } else if ((coef & 0xf000) == 0x3000) { 15119 - alc_codec_rename(codec, "ALC258"); 15120 - spec->codec_variant = ALC269_TYPE_ALC258; 15121 - } else { 15122 - alc_codec_rename(codec, "ALC269VB"); 15123 - spec->codec_variant = ALC269_TYPE_ALC269VB; 15124 - } 15125 - } else 15126 - alc_fix_pll_init(codec, 0x20, 0x04, 15); 15127 - 15128 - alc269_fill_coef(codec); 15095 + if (codec->vendor_id == 0x10ec0269) { 15096 + coef = alc_read_coef_idx(codec, 0); 15097 + if ((coef & 0x00f0) == 0x0010) { 15098 + if (codec->bus->pci->subsystem_vendor == 0x1025 && 15099 + spec->cdefine.platform_type == 1) { 15100 + alc_codec_rename(codec, "ALC271X"); 15101 + spec->codec_variant = ALC269_TYPE_ALC271X; 15102 + } else if ((coef & 0xf000) == 0x1000) { 15103 + spec->codec_variant = ALC269_TYPE_ALC270; 15104 + } else if ((coef & 0xf000) == 0x2000) { 15105 + alc_codec_rename(codec, "ALC259"); 15106 + spec->codec_variant = ALC269_TYPE_ALC259; 15107 + } else if ((coef & 0xf000) == 0x3000) { 15108 + alc_codec_rename(codec, "ALC258"); 15109 + spec->codec_variant = ALC269_TYPE_ALC258; 15110 + } else { 15111 + alc_codec_rename(codec, "ALC269VB"); 15112 + spec->codec_variant = ALC269_TYPE_ALC269VB; 15113 + } 15114 + } else 15115 + alc_fix_pll_init(codec, 0x20, 0x04, 15); 15116 + alc269_fill_coef(codec); 15117 + } 15129 15118 15130 15119 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, 15131 15120 alc269_models,
+2 -3
sound/pci/hda/patch_sigmatel.c
··· 3481 3481 3482 3482 label = hda_get_input_pin_label(codec, nid, 1); 3483 3483 snd_hda_add_imux_item(dimux, label, index, &type_idx); 3484 + if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) 3485 + snd_hda_add_imux_item(imux, label, index, &type_idx); 3484 3486 3485 3487 err = create_elem_capture_vol(codec, nid, label, type_idx, 3486 3488 HDA_INPUT); ··· 3494 3492 if (err < 0) 3495 3493 return err; 3496 3494 } 3497 - 3498 - if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) 3499 - snd_hda_add_imux_item(imux, label, index, NULL); 3500 3495 } 3501 3496 3502 3497 return 0;