--- /dev/null
+From cbd209f41ea5f39394de5c1fe2dd9aa54a9c5744 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 13 Jan 2014 12:40:07 +0100
+Subject: ALSA: hda - Don't set indep_hp flag for old AD codecs
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit cbd209f41ea5f39394de5c1fe2dd9aa54a9c5744 upstream.
+
+Some old AD codecs don't like the independent HP handling, either it
+contains a single DAC (AD1981) or it mandates the mixer routing
+(AD1986A). This patch removes the indep_hp flag for such codecs.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=68081
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_analog.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -171,7 +171,7 @@ static const struct hda_codec_ops ad198x
+ };
+
+
+-static int ad198x_parse_auto_config(struct hda_codec *codec)
++static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
+ {
+ struct ad198x_spec *spec = codec->spec;
+ struct auto_pin_cfg *cfg = &spec->gen.autocfg;
+@@ -181,7 +181,7 @@ static int ad198x_parse_auto_config(stru
+ codec->no_trigger_sense = 1;
+ codec->no_sticky_stream = 1;
+
+- spec->gen.indep_hp = 1;
++ spec->gen.indep_hp = indep_hp;
+
+ err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
+ if (err < 0)
+@@ -362,7 +362,7 @@ static int patch_ad1986a(struct hda_code
+ ad1986a_fixups);
+ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
+
+- err = ad198x_parse_auto_config(codec);
++ err = ad198x_parse_auto_config(codec, false);
+ if (err < 0) {
+ snd_hda_gen_free(codec);
+ return err;
+@@ -464,7 +464,7 @@ static int patch_ad1983(struct hda_codec
+
+ spec->gen.beep_nid = 0x10;
+ set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
+- err = ad198x_parse_auto_config(codec);
++ err = ad198x_parse_auto_config(codec, false);
+ if (err < 0)
+ goto error;
+ err = ad1983_add_spdif_mux_ctl(codec);
+@@ -564,7 +564,7 @@ static int patch_ad1981(struct hda_codec
+ snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups);
+ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
+
+- err = ad198x_parse_auto_config(codec);
++ err = ad198x_parse_auto_config(codec, false);
+ if (err < 0)
+ goto error;
+ err = ad1983_add_spdif_mux_ctl(codec);
+@@ -890,7 +890,7 @@ static int patch_ad1988(struct hda_codec
+ snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups);
+ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
+
+- err = ad198x_parse_auto_config(codec);
++ err = ad198x_parse_auto_config(codec, true);
+ if (err < 0)
+ goto error;
+ err = ad1988_add_spdif_mux_ctl(codec);
+@@ -1064,7 +1064,7 @@ static int patch_ad1884(struct hda_codec
+ snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups);
+ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
+
+- err = ad198x_parse_auto_config(codec);
++ err = ad198x_parse_auto_config(codec, true);
+ if (err < 0)
+ goto error;
+ err = ad1983_add_spdif_mux_ctl(codec);
+@@ -1106,7 +1106,7 @@ static int patch_ad1882(struct hda_codec
+ spec->gen.mixer_merge_nid = 0x21;
+ spec->gen.beep_nid = 0x10;
+ set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
+- err = ad198x_parse_auto_config(codec);
++ err = ad198x_parse_auto_config(codec, true);
+ if (err < 0)
+ goto error;
+ err = ad1988_add_spdif_mux_ctl(codec);
--- /dev/null
+From swarren@wwwdotorg.org Tue Feb 4 09:58:00 2014
+From: Stephen Warren <swarren@wwwdotorg.org>
+Date: Mon, 3 Feb 2014 16:54:04 -0700
+Subject: ALSA: hda/hdmi - allow PIN_OUT to be dynamically enabled
+To: stable@vger.kernel.org
+Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>, Anssi Hannula <anssi.hannula@iki.fi>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Stephen Warren <swarren@nvidia.com>
+Message-ID: <1391471644-16256-2-git-send-email-swarren@wwwdotorg.org>
+
+From: Stephen Warren <swarren@nvidia.com>
+
+(This is upstream 75fae117a5db "ALSA: hda/hdmi - allow PIN_OUT to be
+dynamically enabled", backported to stable 3.10 through 3.12. 3.13 and
+later can take the original patch.)
+
+Commit 384a48d71520 "ALSA: hda: HDMI: Support codecs with fewer cvts
+than pins" dynamically enabled each pin widget's PIN_OUT only when the
+pin was actively in use. This was required on certain NVIDIA CODECs for
+correct operation. Specifically, if multiple pin widgets each had their
+mux input select the same audio converter widget and each pin widget had
+PIN_OUT enabled, then only one of the pin widgets would actually receive
+the audio, and often not the one the user wanted!
+
+However, this apparently broke some Intel systems, and commit
+6169b673618b "ALSA: hda - Always turn on pins for HDMI/DP" reverted the
+dynamic setting of PIN_OUT. This in turn broke the afore-mentioned NVIDIA
+CODECs.
+
+This change supports either dynamic or static handling of PIN_OUT,
+selected by a flag set up during CODEC initialization. This flag is
+enabled for all recent NVIDIA GPUs.
+
+Reported-by: Uosis <uosisl@gmail.com>
+Signed-off-by: Stephen Warren <swarren@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_hdmi.c | 40 ++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 36 insertions(+), 4 deletions(-)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -88,6 +88,9 @@ struct hdmi_spec {
+ unsigned int channels_max; /* max over all cvts */
+
+ struct hdmi_eld temp_eld;
++
++ bool dyn_pin_out;
++
+ /*
+ * Non-generic ATI/NVIDIA specific
+ */
+@@ -452,15 +455,25 @@ static void hdmi_write_dip_byte(struct h
+
+ static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid)
+ {
++ struct hdmi_spec *spec = codec->spec;
++ int pin_out;
++
+ /* Unmute */
+ if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP)
+ snd_hda_codec_write(codec, pin_nid, 0,
+ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+- /* Enable pin out: some machines with GM965 gets broken output when
+- * the pin is disabled or changed while using with HDMI
+- */
++
++ if (spec->dyn_pin_out)
++ /* Disable pin out until stream is active */
++ pin_out = 0;
++ else
++ /* Enable pin out: some machines with GM965 gets broken output
++ * when the pin is disabled or changed while using with HDMI
++ */
++ pin_out = PIN_OUT;
++
+ snd_hda_codec_write(codec, pin_nid, 0,
+- AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++ AC_VERB_SET_PIN_WIDGET_CONTROL, pin_out);
+ }
+
+ static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid)
+@@ -1535,6 +1548,7 @@ static int generic_hdmi_playback_pcm_pre
+ struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
+ hda_nid_t pin_nid = per_pin->pin_nid;
+ bool non_pcm;
++ int pinctl;
+
+ non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
+ per_pin->channels = substream->runtime->channels;
+@@ -1544,6 +1558,14 @@ static int generic_hdmi_playback_pcm_pre
+
+ hdmi_setup_audio_infoframe(codec, per_pin, non_pcm);
+
++ if (spec->dyn_pin_out) {
++ pinctl = snd_hda_codec_read(codec, pin_nid, 0,
++ AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
++ snd_hda_codec_write(codec, pin_nid, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL,
++ pinctl | PIN_OUT);
++ }
++
+ return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
+ }
+
+@@ -1563,6 +1585,7 @@ static int hdmi_pcm_close(struct hda_pcm
+ int cvt_idx, pin_idx;
+ struct hdmi_spec_per_cvt *per_cvt;
+ struct hdmi_spec_per_pin *per_pin;
++ int pinctl;
+
+ if (hinfo->nid) {
+ cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid);
+@@ -1579,6 +1602,14 @@ static int hdmi_pcm_close(struct hda_pcm
+ return -EINVAL;
+ per_pin = get_pin(spec, pin_idx);
+
++ if (spec->dyn_pin_out) {
++ pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
++ AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
++ snd_hda_codec_write(codec, per_pin->pin_nid, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL,
++ pinctl & ~PIN_OUT);
++ }
++
+ snd_hda_spdif_ctls_unassign(codec, pin_idx);
+ per_pin->chmap_set = false;
+ memset(per_pin->chmap, 0, sizeof(per_pin->chmap));
+@@ -2570,6 +2601,7 @@ static int patch_nvhdmi(struct hda_codec
+ return err;
+
+ spec = codec->spec;
++ spec->dyn_pin_out = true;
+
+ return 0;
+ }
--- /dev/null
+From swarren@wwwdotorg.org Tue Feb 4 09:57:00 2014
+From: Stephen Warren <swarren@wwwdotorg.org>
+Date: Mon, 3 Feb 2014 16:54:03 -0700
+Subject: ALSA: hda - hdmi: introduce patch_nvhdmi()
+To: stable@vger.kernel.org
+Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>, Anssi Hannula <anssi.hannula@iki.fi>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Stephen Warren <swarren@nvidia.com>
+Message-ID: <1391471644-16256-1-git-send-email-swarren@wwwdotorg.org>
+
+From: Anssi Hannula <anssi.hannula@iki.fi>
+
+(This is a backport of *part* of upstream 611885bc963a "ALSA: hda -
+hdmi: Disallow unsupported 2ch remapping on NVIDIA codecs" to stable
+3.10 through 3.12. Later stable already contain all of the original
+patch.)
+
+Mainline commit 611885bc963a "ALSA: hda - hdmi: Disallow unsupported 2ch
+remapping on NVIDIA codecs" introduces function patch_nvhdmi(). That
+function is edited by 75fae117a5db "ALSA: hda/hdmi - allow PIN_OUT to be
+dynamically enabled". In order to backport the PIN_OUT patch, I am first
+back-porting just the addition of function patch_nvhdmi(), so that the
+conflicts applying the PIN_OUT patch are simplified.
+
+Ideally, one might backport all of 611885bc963a. However, that commit
+doesn't apply to stable kernels, since it relies on a chain of other
+patches which implement new features.
+
+Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+[swarren, extracted just a small part of the original patch]
+Signed-off-by: Stephen Warren <swarren@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_hdmi.c | 60 +++++++++++++++++++++++++++------------------
+ 1 file changed, 37 insertions(+), 23 deletions(-)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2560,6 +2560,20 @@ static int patch_nvhdmi_8ch_7x(struct hd
+ return 0;
+ }
+
++static int patch_nvhdmi(struct hda_codec *codec)
++{
++ struct hdmi_spec *spec;
++ int err;
++
++ err = patch_generic_hdmi(codec);
++ if (err)
++ return err;
++
++ spec = codec->spec;
++
++ return 0;
++}
++
+ /*
+ * ATI-specific implementations
+ *
+@@ -2632,30 +2646,30 @@ static const struct hda_codec_preset snd
+ { .id = 0x10de0005, .name = "MCP77/78 HDMI", .patch = patch_nvhdmi_8ch_7x },
+ { .id = 0x10de0006, .name = "MCP77/78 HDMI", .patch = patch_nvhdmi_8ch_7x },
+ { .id = 0x10de0007, .name = "MCP79/7A HDMI", .patch = patch_nvhdmi_8ch_7x },
+-{ .id = 0x10de000a, .name = "GPU 0a HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de000b, .name = "GPU 0b HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de000c, .name = "MCP89 HDMI", .patch = patch_generic_hdmi },
+-{ .id = 0x10de000d, .name = "GPU 0d HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0010, .name = "GPU 10 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0011, .name = "GPU 11 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0012, .name = "GPU 12 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0013, .name = "GPU 13 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0014, .name = "GPU 14 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0015, .name = "GPU 15 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0016, .name = "GPU 16 HDMI/DP", .patch = patch_generic_hdmi },
++{ .id = 0x10de000a, .name = "GPU 0a HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de000b, .name = "GPU 0b HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de000c, .name = "MCP89 HDMI", .patch = patch_nvhdmi },
++{ .id = 0x10de000d, .name = "GPU 0d HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0010, .name = "GPU 10 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0011, .name = "GPU 11 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0012, .name = "GPU 12 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0013, .name = "GPU 13 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0014, .name = "GPU 14 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0015, .name = "GPU 15 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0016, .name = "GPU 16 HDMI/DP", .patch = patch_nvhdmi },
+ /* 17 is known to be absent */
+-{ .id = 0x10de0018, .name = "GPU 18 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0019, .name = "GPU 19 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0043, .name = "GPU 43 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0044, .name = "GPU 44 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_generic_hdmi },
+-{ .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_generic_hdmi },
++{ .id = 0x10de0018, .name = "GPU 18 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0019, .name = "GPU 19 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0043, .name = "GPU 43 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0044, .name = "GPU 44 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_nvhdmi },
++{ .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_nvhdmi },
+ { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch },
+ { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch },
+ { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
parisc-fix-cache-flushing.patch
kvm-ppc-book3s-hv-use-xics_wake_cpu-only-when-defined.patch
kvm-ppc-e500-fix-bad-address-type-in-deliver_tlb_misss.patch
+alsa-hda-don-t-set-indep_hp-flag-for-old-ad-codecs.patch
+alsa-hda-hdmi-introduce-patch_nvhdmi.patch
+alsa-hda-hdmi-allow-pin_out-to-be-dynamically-enabled.patch