Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'sound-fix-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"Just a few HD-audio fixes, most of which are specific to Realtek
codecs"

* tag 'sound-fix-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: hda/realtek - Fix for Lenovo B50-70 inverted internal microphone bug
ALSA: hda: Fix race between creating and refreshing sysfs entries
ALSA: hda/realtek - Corrected fixup for System76 Gazelle (gaze14)
ALSA: hda/realtek - Avoid superfluous COEF EAPD setups
ALSA: hda/realtek - Fixup headphone noise via runtime suspend

+80 -27
+1
include/sound/hdaudio.h
··· 81 81 atomic_t in_pm; /* suspend/resume being performed */ 82 82 83 83 /* sysfs */ 84 + struct mutex widget_lock; 84 85 struct hdac_widget_tree *widgets; 85 86 86 87 /* regmap */
+7
sound/hda/hdac_device.c
··· 55 55 codec->bus = bus; 56 56 codec->addr = addr; 57 57 codec->type = HDA_DEV_CORE; 58 + mutex_init(&codec->widget_lock); 58 59 pm_runtime_set_active(&codec->dev); 59 60 pm_runtime_get_noresume(&codec->dev); 60 61 atomic_set(&codec->in_pm, 0); ··· 142 141 err = device_add(&codec->dev); 143 142 if (err < 0) 144 143 return err; 144 + mutex_lock(&codec->widget_lock); 145 145 err = hda_widget_sysfs_init(codec); 146 + mutex_unlock(&codec->widget_lock); 146 147 if (err < 0) { 147 148 device_del(&codec->dev); 148 149 return err; ··· 161 158 void snd_hdac_device_unregister(struct hdac_device *codec) 162 159 { 163 160 if (device_is_registered(&codec->dev)) { 161 + mutex_lock(&codec->widget_lock); 164 162 hda_widget_sysfs_exit(codec); 163 + mutex_unlock(&codec->widget_lock); 165 164 device_del(&codec->dev); 166 165 snd_hdac_bus_remove_device(codec->bus, codec); 167 166 } ··· 409 404 } 410 405 411 406 if (sysfs) { 407 + mutex_lock(&codec->widget_lock); 412 408 err = hda_widget_sysfs_reinit(codec, start_nid, nums); 409 + mutex_unlock(&codec->widget_lock); 413 410 if (err < 0) 414 411 return err; 415 412 }
+3
sound/hda/hdac_sysfs.c
··· 395 395 return 0; 396 396 } 397 397 398 + /* call with codec->widget_lock held */ 398 399 int hda_widget_sysfs_init(struct hdac_device *codec) 399 400 { 400 401 int err; ··· 412 411 return 0; 413 412 } 414 413 414 + /* call with codec->widget_lock held */ 415 415 void hda_widget_sysfs_exit(struct hdac_device *codec) 416 416 { 417 417 widget_tree_free(codec); 418 418 } 419 419 420 + /* call with codec->widget_lock held */ 420 421 int hda_widget_sysfs_reinit(struct hdac_device *codec, 421 422 hda_nid_t start_nid, int num_nodes) 422 423 {
+69 -27
sound/pci/hda/patch_realtek.c
··· 478 478 set_eapd(codec, *p, on); 479 479 } 480 480 481 + static int find_ext_mic_pin(struct hda_codec *codec); 482 + 483 + static void alc_headset_mic_no_shutup(struct hda_codec *codec) 484 + { 485 + const struct hda_pincfg *pin; 486 + int mic_pin = find_ext_mic_pin(codec); 487 + int i; 488 + 489 + /* don't shut up pins when unloading the driver; otherwise it breaks 490 + * the default pin setup at the next load of the driver 491 + */ 492 + if (codec->bus->shutdown) 493 + return; 494 + 495 + snd_array_for_each(&codec->init_pins, i, pin) { 496 + /* use read here for syncing after issuing each verb */ 497 + if (pin->nid != mic_pin) 498 + snd_hda_codec_read(codec, pin->nid, 0, 499 + AC_VERB_SET_PIN_WIDGET_CONTROL, 0); 500 + } 501 + 502 + codec->pins_shutup = 1; 503 + } 504 + 481 505 static void alc_shutup_pins(struct hda_codec *codec) 482 506 { 483 507 struct alc_spec *spec = codec->spec; 484 508 485 - if (!spec->no_shutup_pins) 486 - snd_hda_shutup_pins(codec); 509 + switch (codec->core.vendor_id) { 510 + case 0x10ec0286: 511 + case 0x10ec0288: 512 + case 0x10ec0298: 513 + alc_headset_mic_no_shutup(codec); 514 + break; 515 + default: 516 + if (!spec->no_shutup_pins) 517 + snd_hda_shutup_pins(codec); 518 + break; 519 + } 487 520 } 488 521 489 522 /* generic shutup callback; ··· 535 502 /* generic EAPD initialization */ 536 503 static void alc_auto_init_amp(struct hda_codec *codec, int type) 537 504 { 538 - alc_fill_eapd_coef(codec); 539 505 alc_auto_setup_eapd(codec, true); 540 506 alc_write_gpio(codec); 541 507 switch (type) { ··· 829 797 * Common callbacks 830 798 */ 831 799 800 + static void alc_pre_init(struct hda_codec *codec) 801 + { 802 + alc_fill_eapd_coef(codec); 803 + } 804 + 805 + #define is_s4_resume(codec) \ 806 + ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE) 807 + 832 808 static int alc_init(struct hda_codec *codec) 833 809 { 834 810 struct alc_spec *spec = codec->spec; 811 + 812 + /* hibernation resume needs the full chip initialization */ 813 + if (is_s4_resume(codec)) 814 + alc_pre_init(codec); 835 815 836 816 if (spec->init_hook) 837 817 spec->init_hook(codec); ··· 1582 1538 1583 1539 codec->patch_ops.unsol_event = alc880_unsol_event; 1584 1540 1541 + alc_pre_init(codec); 1542 + 1585 1543 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, 1586 1544 alc880_fixups); 1587 1545 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ··· 1834 1788 spec->gen.beep_nid = 0x01; 1835 1789 1836 1790 spec->shutup = alc_eapd_shutup; 1791 + 1792 + alc_pre_init(codec); 1837 1793 1838 1794 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, 1839 1795 alc260_fixups); ··· 2540 2492 break; 2541 2493 } 2542 2494 2495 + alc_pre_init(codec); 2496 + 2543 2497 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, 2544 2498 alc882_fixups); 2545 2499 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ··· 2716 2666 #endif 2717 2667 alc_fix_pll_init(codec, 0x20, 0x0a, 10); 2718 2668 2669 + alc_pre_init(codec); 2670 + 2719 2671 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, 2720 2672 alc262_fixups); 2721 2673 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ··· 2862 2810 2863 2811 spec->shutup = alc_eapd_shutup; 2864 2812 2813 + alc_pre_init(codec); 2814 + 2865 2815 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); 2866 2816 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 2867 2817 ··· 2976 2922 } 2977 2923 2978 2924 return alc_parse_auto_config(codec, alc269_ignore, ssids); 2979 - } 2980 - 2981 - static int find_ext_mic_pin(struct hda_codec *codec); 2982 - 2983 - static void alc286_shutup(struct hda_codec *codec) 2984 - { 2985 - const struct hda_pincfg *pin; 2986 - int i; 2987 - int mic_pin = find_ext_mic_pin(codec); 2988 - /* don't shut up pins when unloading the driver; otherwise it breaks 2989 - * the default pin setup at the next load of the driver 2990 - */ 2991 - if (codec->bus->shutdown) 2992 - return; 2993 - snd_array_for_each(&codec->init_pins, i, pin) { 2994 - /* use read here for syncing after issuing each verb */ 2995 - if (pin->nid != mic_pin) 2996 - snd_hda_codec_read(codec, pin->nid, 0, 2997 - AC_VERB_SET_PIN_WIDGET_CONTROL, 0); 2998 - } 2999 - codec->pins_shutup = 1; 3000 2925 } 3001 2926 3002 2927 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) ··· 6997 6964 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), 6998 6965 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 6999 6966 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 7000 - SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 6967 + SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 6968 + SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), 6969 + SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), 7001 6970 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS), 7002 6971 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 7003 6972 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), ··· 7042 7007 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), 7043 7008 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), 7044 7009 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), 7045 - SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 7010 + SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI), 7046 7011 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 7047 7012 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), 7048 7013 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK), ··· 7771 7736 case 0x10ec0286: 7772 7737 case 0x10ec0288: 7773 7738 spec->codec_variant = ALC269_TYPE_ALC286; 7774 - spec->shutup = alc286_shutup; 7775 7739 break; 7776 7740 case 0x10ec0298: 7777 7741 spec->codec_variant = ALC269_TYPE_ALC298; ··· 7838 7804 spec->has_alc5505_dsp = 1; 7839 7805 spec->init_hook = alc5505_dsp_init; 7840 7806 } 7807 + 7808 + alc_pre_init(codec); 7841 7809 7842 7810 snd_hda_pick_fixup(codec, alc269_fixup_models, 7843 7811 alc269_fixup_tbl, alc269_fixups); ··· 7983 7947 spec->power_hook = alc_power_eapd; 7984 7948 #endif 7985 7949 7950 + alc_pre_init(codec); 7951 + 7986 7952 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); 7987 7953 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 7988 7954 ··· 8081 8043 spec->gen.beep_nid = 0x23; 8082 8044 8083 8045 spec->shutup = alc_eapd_shutup; 8046 + 8047 + alc_pre_init(codec); 8084 8048 8085 8049 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); 8086 8050 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ··· 8818 8778 spec->init_hook = alc668_restore_default_value; 8819 8779 break; 8820 8780 } 8781 + 8782 + alc_pre_init(codec); 8821 8783 8822 8784 snd_hda_pick_fixup(codec, alc662_fixup_models, 8823 8785 alc662_fixup_tbl, alc662_fixups);