From: Greg Kroah-Hartman Date: Wed, 18 Dec 2013 01:31:13 +0000 (-0800) Subject: 3.10-stable patches X-Git-Tag: v3.4.75~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bda5325f3e8fb1d350f8b918ac71ec5385504ce;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: alsa-compress-fix-64bit-abi-incompatibility.patch alsa-hda-add-static-dac-pin-mapping-for-ad1986a-codec.patch alsa-hda-hdmi-fix-iec958-ctl-indexes-for-some-simple-hdmi-devices.patch alsa-hda-mute-all-aamix-inputs-as-default.patch alsa-memalloc.h-fix-wrong-truncation-of-dma_addr_t.patch --- diff --git a/queue-3.10/alsa-compress-fix-64bit-abi-incompatibility.patch b/queue-3.10/alsa-compress-fix-64bit-abi-incompatibility.patch new file mode 100644 index 00000000000..43603474e3b --- /dev/null +++ b/queue-3.10/alsa-compress-fix-64bit-abi-incompatibility.patch @@ -0,0 +1,46 @@ +From 6733cf572a9e20db2b7580a5dd39d5782d571eec Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 10 Dec 2013 12:15:52 +0100 +Subject: ALSA: compress: Fix 64bit ABI incompatibility + +From: Takashi Iwai + +commit 6733cf572a9e20db2b7580a5dd39d5782d571eec upstream. + +snd_pcm_uframes_t is defined as unsigned long so it would take +different sizes depending on 32 or 64bit architectures. As we don't +want this ABI incompatibility, and there is no real 64bit user yet, +let's make it the fixed size with __u32. + +Also bump the protocol version number to 0.1.2. + +Acked-by: Vinod Koul +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + include/uapi/sound/compress_offload.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/include/uapi/sound/compress_offload.h ++++ b/include/uapi/sound/compress_offload.h +@@ -30,7 +30,7 @@ + #include + + +-#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1) ++#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2) + /** + * struct snd_compressed_buffer: compressed buffer + * @fragment_size: size of buffer fragment in bytes +@@ -67,8 +67,8 @@ struct snd_compr_params { + struct snd_compr_tstamp { + __u32 byte_offset; + __u32 copied_total; +- snd_pcm_uframes_t pcm_frames; +- snd_pcm_uframes_t pcm_io_frames; ++ __u32 pcm_frames; ++ __u32 pcm_io_frames; + __u32 sampling_rate; + }; + diff --git a/queue-3.10/alsa-hda-add-static-dac-pin-mapping-for-ad1986a-codec.patch b/queue-3.10/alsa-hda-add-static-dac-pin-mapping-for-ad1986a-codec.patch new file mode 100644 index 00000000000..e86a05be1f8 --- /dev/null +++ b/queue-3.10/alsa-hda-add-static-dac-pin-mapping-for-ad1986a-codec.patch @@ -0,0 +1,110 @@ +From 3690739b013504d33fe9348dd45f6b126aa370fb Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 10 Dec 2013 17:29:26 +0100 +Subject: ALSA: hda - Add static DAC/pin mapping for AD1986A codec + +From: Takashi Iwai + +commit 3690739b013504d33fe9348dd45f6b126aa370fb upstream. + +AD1986A codec is a pretty old codec and has really many hidden +restrictions. One of such is that each DAC is dedicated to certain +pin although there are possible connections. Currently, the generic +parser tries to assign individual DACs as much as possible, and this +lead to two bad situations: connections where the sound actually +doesn't work, and connections conflicting other channels. + +We may fix this by trying to find the best connections more harder, +but as of now, it's easier to give some hints for paired DAC/pin +connections and honor them if available, since such a hint is needed +only for specific codecs (right now only AD1986A, and there will be +unlikely any others in future). + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64971 +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66621 +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_generic.c | 23 ++++++++++++++++++++++- + sound/pci/hda/hda_generic.h | 3 +++ + sound/pci/hda/patch_analog.c | 10 ++++++++++ + 3 files changed, 35 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/hda_generic.c ++++ b/sound/pci/hda/hda_generic.c +@@ -468,6 +468,20 @@ static void invalidate_nid_path(struct h + memset(path, 0, sizeof(*path)); + } + ++/* return a DAC if paired to the given pin by codec driver */ ++static hda_nid_t get_preferred_dac(struct hda_codec *codec, hda_nid_t pin) ++{ ++ struct hda_gen_spec *spec = codec->spec; ++ const hda_nid_t *list = spec->preferred_dacs; ++ ++ if (!list) ++ return 0; ++ for (; *list; list += 2) ++ if (*list == pin) ++ return list[1]; ++ return 0; ++} ++ + /* look for an empty DAC slot */ + static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, + bool is_digital) +@@ -1134,7 +1148,14 @@ static int try_assign_dacs(struct hda_co + continue; + } + +- dacs[i] = look_for_dac(codec, pin, false); ++ dacs[i] = get_preferred_dac(codec, pin); ++ if (dacs[i]) { ++ if (is_dac_already_used(codec, dacs[i])) ++ badness += bad->shared_primary; ++ } ++ ++ if (!dacs[i]) ++ dacs[i] = look_for_dac(codec, pin, false); + if (!dacs[i] && !i) { + /* try to steal the DAC of surrounds for the front */ + for (j = 1; j < num_outs; j++) { +--- a/sound/pci/hda/hda_generic.h ++++ b/sound/pci/hda/hda_generic.h +@@ -241,6 +241,9 @@ struct hda_gen_spec { + const struct badness_table *main_out_badness; + const struct badness_table *extra_out_badness; + ++ /* preferred pin/DAC pairs; an array of paired NIDs */ ++ const hda_nid_t *preferred_dacs; ++ + /* loopback mixing mode */ + bool aamix_mode; + +--- a/sound/pci/hda/patch_analog.c ++++ b/sound/pci/hda/patch_analog.c +@@ -1227,6 +1227,14 @@ static int ad1986a_parse_auto_config(str + { + int err; + struct ad198x_spec *spec; ++ static hda_nid_t preferred_pairs[] = { ++ 0x1a, 0x03, ++ 0x1b, 0x03, ++ 0x1c, 0x04, ++ 0x1d, 0x05, ++ 0x1e, 0x03, ++ 0 ++ }; + + err = alloc_ad_spec(codec); + if (err < 0) +@@ -1247,6 +1255,8 @@ static int ad1986a_parse_auto_config(str + * So, let's disable the shared stream. + */ + spec->gen.multiout.no_share_stream = 1; ++ /* give fixed DAC/pin pairs */ ++ spec->gen.preferred_dacs = preferred_pairs; + + snd_hda_pick_fixup(codec, NULL, ad1986a_fixup_tbl, ad1986a_fixups); + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); diff --git a/queue-3.10/alsa-hda-hdmi-fix-iec958-ctl-indexes-for-some-simple-hdmi-devices.patch b/queue-3.10/alsa-hda-hdmi-fix-iec958-ctl-indexes-for-some-simple-hdmi-devices.patch new file mode 100644 index 00000000000..6b072a40afc --- /dev/null +++ b/queue-3.10/alsa-hda-hdmi-fix-iec958-ctl-indexes-for-some-simple-hdmi-devices.patch @@ -0,0 +1,53 @@ +From c9a6338aecdb92f9d015ecc26d203e54250bebbb Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Tue, 10 Dec 2013 22:46:34 +0200 +Subject: ALSA: hda - hdmi: Fix IEC958 ctl indexes for some simple HDMI devices + +From: Anssi Hannula + +commit c9a6338aecdb92f9d015ecc26d203e54250bebbb upstream. + +In case a single HDA card has both HDMI and S/PDIF outputs, the S/PDIF +outputs will have their IEC958 controls created starting from index 16 +and the HDMI controls will be created starting from index 0. + +However, HDMI simple_playback_build_controls() as used by old VIA and +NVIDIA codecs incorrectly requests the IEC958 controls to be created +with an S/PDIF type instead of HDMI. +In case the card has other codecs that have HDMI outputs, the controls +will be created with wrong index=16, causing them to e.g. be unreachable +by the ALSA "hdmi" alias. + +Fix that by making simple_playback_build_controls() request controls +with HDMI indexes. + +Not many cards have an affected configuration, but e.g. ASUS M3N78-VM +contains an integrated NVIDIA HDA "card" with: +- a VIA codec that has, among others, an S/PDIF pin incorrectly + labelled as an HDMI pin, and +- an NVIDIA MCP7x HDMI codec. + +Reported-by: MysterX on #openelec +Tested-by: MysterX on #openelec +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_hdmi.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -2001,8 +2001,9 @@ static int simple_playback_build_control + int err; + + per_cvt = get_cvt(spec, 0); +- err = snd_hda_create_spdif_out_ctls(codec, per_cvt->cvt_nid, +- per_cvt->cvt_nid); ++ err = snd_hda_create_dig_out_ctls(codec, per_cvt->cvt_nid, ++ per_cvt->cvt_nid, ++ HDA_PCM_TYPE_HDMI); + if (err < 0) + return err; + return simple_hdmi_build_jack(codec, 0); diff --git a/queue-3.10/alsa-hda-mute-all-aamix-inputs-as-default.patch b/queue-3.10/alsa-hda-mute-all-aamix-inputs-as-default.patch new file mode 100644 index 00000000000..35c110e6889 --- /dev/null +++ b/queue-3.10/alsa-hda-mute-all-aamix-inputs-as-default.patch @@ -0,0 +1,61 @@ +From ebb93c057dda376414fbc499ad6ace9b527dff5a Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 10 Dec 2013 17:33:49 +0100 +Subject: ALSA: hda - Mute all aamix inputs as default + +From: Takashi Iwai + +commit ebb93c057dda376414fbc499ad6ace9b527dff5a upstream. + +Not all channels have been initialized, so far, especially when aamix +NID itself doesn't have amps but its leaves have. This patch fixes +these holes. Otherwise you might get unexpected loopback inputs, +e.g. from surround channels. + +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_generic.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/sound/pci/hda/hda_generic.c ++++ b/sound/pci/hda/hda_generic.c +@@ -4222,6 +4222,26 @@ static unsigned int snd_hda_gen_path_pow + return AC_PWRST_D3; + } + ++/* mute all aamix inputs initially; parse up to the first leaves */ ++static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) ++{ ++ int i, nums; ++ const hda_nid_t *conn; ++ bool has_amp; ++ ++ nums = snd_hda_get_conn_list(codec, mix, &conn); ++ has_amp = nid_has_mute(codec, mix, HDA_INPUT); ++ for (i = 0; i < nums; i++) { ++ if (has_amp) ++ snd_hda_codec_amp_stereo(codec, mix, ++ HDA_INPUT, i, ++ 0xff, HDA_AMP_MUTE); ++ else if (nid_has_volume(codec, conn[i], HDA_OUTPUT)) ++ snd_hda_codec_amp_stereo(codec, conn[i], ++ HDA_OUTPUT, 0, ++ 0xff, HDA_AMP_MUTE); ++ } ++} + + /* + * Parse the given BIOS configuration and set up the hda_gen_spec +@@ -4360,6 +4380,10 @@ int snd_hda_gen_parse_auto_config(struct + } + } + ++ /* mute all aamix input initially */ ++ if (spec->mixer_nid) ++ mute_all_mixer_nid(codec, spec->mixer_nid); ++ + dig_only: + parse_digital(codec); + diff --git a/queue-3.10/alsa-memalloc.h-fix-wrong-truncation-of-dma_addr_t.patch b/queue-3.10/alsa-memalloc.h-fix-wrong-truncation-of-dma_addr_t.patch new file mode 100644 index 00000000000..8fbc1328740 --- /dev/null +++ b/queue-3.10/alsa-memalloc.h-fix-wrong-truncation-of-dma_addr_t.patch @@ -0,0 +1,68 @@ +From 932e9dec380c67ec15ac3eb073bb55797d8b4801 Mon Sep 17 00:00:00 2001 +From: Stefano Panella +Date: Tue, 10 Dec 2013 14:20:28 +0000 +Subject: ALSA: memalloc.h - fix wrong truncation of dma_addr_t + +From: Stefano Panella + +commit 932e9dec380c67ec15ac3eb073bb55797d8b4801 upstream. + +When running a 32bit kernel the hda_intel driver is still reporting +a 64bit dma_mask if the HW supports it. + +From sound/pci/hda/hda_intel.c: + + /* allow 64bit DMA address if supported by H/W */ + if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); + else { + pci_set_dma_mask(pci, DMA_BIT_MASK(32)); + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); + } + +which means when there is a call to dma_alloc_coherent from +snd_malloc_dev_pages a machine address bigger than 32bit can be returned. +This can be true in particular if running the 32bit kernel as a pv dom0 +under the Xen Hypervisor or PAE on bare metal. + +The problem is that when calling setup_bdle to program the BLE the +dma_addr_t returned from the dma_alloc_coherent is wrongly truncated +from snd_sgbuf_get_addr if running a 32bit kernel: + +static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, + size_t offset) +{ + struct snd_sg_buf *sgbuf = dmab->private_data; + dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; + addr &= PAGE_MASK; + return addr + offset % PAGE_SIZE; +} + +where PAGE_MASK in a 32bit kernel is zeroing the upper 32bit af addr. + +Without this patch the HW will fetch the 32bit truncated address, +which is not the one obtained from dma_alloc_coherent and will result +to a non working audio but can corrupt host memory at a random location. + +The current patch apply to v3.13-rc3-74-g6c843f5 + +Signed-off-by: Stefano Panella +Reviewed-by: Frediano Ziglio +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + include/sound/memalloc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/sound/memalloc.h ++++ b/include/sound/memalloc.h +@@ -103,7 +103,7 @@ static inline dma_addr_t snd_sgbuf_get_a + { + struct snd_sg_buf *sgbuf = dmab->private_data; + dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; +- addr &= PAGE_MASK; ++ addr &= ~((dma_addr_t)PAGE_SIZE - 1); + return addr + offset % PAGE_SIZE; + } + diff --git a/queue-3.10/series b/queue-3.10/series index 09d1d0b124d..94539ae28bd 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -1,2 +1,7 @@ mips-dma-for-bmips5000-cores-flush-region-just-like-non-coherent-r10000.patch input-xpad-add-signature-for-razer-onza-classic-edition.patch +alsa-compress-fix-64bit-abi-incompatibility.patch +alsa-memalloc.h-fix-wrong-truncation-of-dma_addr_t.patch +alsa-hda-add-static-dac-pin-mapping-for-ad1986a-codec.patch +alsa-hda-mute-all-aamix-inputs-as-default.patch +alsa-hda-hdmi-fix-iec958-ctl-indexes-for-some-simple-hdmi-devices.patch