]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ALSA: hda/realtek - Fix lose hp_pins for disable auto mute
authorKailang Yang <kailang@realtek.com>
Fri, 1 Feb 2019 08:51:10 +0000 (16:51 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837664
commit d561aa0a70bb2e1dd85fde98b6a5561e4175ac3e upstream.

When auto_mute = no or spec->suppress_auto_mute = 1, cfg->hp_pins will
lose value.

Add this patch to find hp_pins value.
I add fixed for ALC282 ALC225 ALC256 ALC294 and alc_default_init()
alc_default_shutup().

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
sound/pci/hda/patch_realtek.c

index 1ddc7302f5ee4de95e1fa851c179a3f5d7d4b117..59571efd53338207a740415416baea9058d055dd 100644 (file)
@@ -2973,6 +2973,11 @@ static void alc282_init(struct hda_codec *codec)
        bool hp_pin_sense;
        int coef78;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        alc282_restore_default_value(codec);
 
        if (!hp_pin)
@@ -3010,6 +3015,11 @@ static void alc282_shutup(struct hda_codec *codec)
        bool hp_pin_sense;
        int coef78;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin) {
                alc269_shutup(codec);
                return;
@@ -3161,6 +3171,11 @@ static void alc256_init(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp_pin_sense;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin)
                return;
 
@@ -3197,6 +3212,11 @@ static void alc256_shutup(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp_pin_sense;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin) {
                alc269_shutup(codec);
                return;
@@ -3234,6 +3254,11 @@ static void alc225_init(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp1_pin_sense, hp2_pin_sense;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin)
                return;
 
@@ -3277,6 +3302,11 @@ static void alc225_shutup(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp1_pin_sense, hp2_pin_sense;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin) {
                alc269_shutup(codec);
                return;
@@ -3321,6 +3351,11 @@ static void alc_default_init(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp_pin_sense;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin)
                return;
 
@@ -3350,6 +3385,11 @@ static void alc_default_shutup(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp_pin_sense;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin) {
                alc269_shutup(codec);
                return;
@@ -3383,6 +3423,11 @@ static void alc294_hp_init(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        int i, val;
 
+       if (!spec->gen.autocfg.hp_outs && spec->gen.suppress_auto_mute) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin)
                return;