Hello community, here is the log from the commit of package alsa for openSUSE:Factory checked in at 2014-10-25 08:32:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/alsa (Old) and /work/SRC/openSUSE:Factory/.alsa.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "alsa" Changes: -------- --- /work/SRC/openSUSE:Factory/alsa/alsa.changes 2014-08-28 21:05:08.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.alsa.new/alsa.changes 2014-10-25 08:32:57.000000000 +0200 @@ -1,0 +2,35 @@ +Fri Oct 17 11:48:23 CEST 2014 - [email protected] + +- Backport upstream fixes / enhancements: mostly small fixes + spotted by coccinelle and oethers, the fixes for proper rewind + support, a new DSD format support, hwdep definitions sync, and + addition of PAZ00 UCM configs. + 0022-pcm-fix-snd_pcm_mmap_hw_avail-near-the-boundary.patch + 0023-pcm-fix-return-value-of-snd_pcm_share_slave_avail.patch + 0024-pcm-add-new-32-bit-DSD-sample-format.patch + 0025-dmix-actually-rewind-when-running-or-being-drained.patch + 0026-pcm-express-the-rewind-size-limitation-logic-better.patch + 0027-pcm-handle-negative-values-from-snd_pcm_mmap_hw_avai.patch + 0028-pcm-rate-use-the-snd_pcm_mmap_hw_avail-function.patch + 0029-pcm-null-use-the-snd_pcm_mmap_avail-function.patch + 0030-rate-handle-negative-values-from-snd_pcm_mmap_playba.patch + 0031-dsnoop-rewindable-and-forwardable-logic-was-swapped.patch + 0033-pcm-file-don-t-recurse-in-the-rewindable-and-forward.patch + 0034-pcm-route-Fix-the-bad-condition-always-false.patch + 0035-pcm-rate-hw_avail-must-not-be-negative-before-starti.patch + 0036-hwdep-add-missing-declaration-for-snd_hwdep_poll_des.patch + 0037-mixer-fixed-double-free.patch + 0038-pcm_file-fixed-missing-free.patch + 0039-sbase-fixed-missing-free.patch + 0040-rawmidi-close-handle-h.patch + 0041-pcm_share-fixing-missing-mutex-unlock.patch + 0042-simple_abst-null-check-for-lib.patch + 0043-socket-missing-socket-close.patch + 0044-pcm_hooks-null-check-for-h.patch + 0045-conf-return-negative-value-in-case-of-error.patch + 0046-control-return-negative-value-in-case-of-error.patch + 0047-pcm-return-negative-value-in-case-of-error.patch + 0048-mixer-Fix-missing-hctl-handle-free-in-snd_mixer_atta.patch + 0049-conf-ucm-PAZ00-add-Toshiba-AC100-Dynabook-AZ-new-con.patch + +------------------------------------------------------------------- New: ---- 0022-pcm-fix-snd_pcm_mmap_hw_avail-near-the-boundary.patch 0023-pcm-fix-return-value-of-snd_pcm_share_slave_avail.patch 0024-pcm-add-new-32-bit-DSD-sample-format.patch 0025-dmix-actually-rewind-when-running-or-being-drained.patch 0026-pcm-express-the-rewind-size-limitation-logic-better.patch 0027-pcm-handle-negative-values-from-snd_pcm_mmap_hw_avai.patch 0028-pcm-rate-use-the-snd_pcm_mmap_hw_avail-function.patch 0029-pcm-null-use-the-snd_pcm_mmap_avail-function.patch 0030-rate-handle-negative-values-from-snd_pcm_mmap_playba.patch 0031-dsnoop-rewindable-and-forwardable-logic-was-swapped.patch 0033-pcm-file-don-t-recurse-in-the-rewindable-and-forward.patch 0034-pcm-route-Fix-the-bad-condition-always-false.patch 0035-pcm-rate-hw_avail-must-not-be-negative-before-starti.patch 0036-hwdep-add-missing-declaration-for-snd_hwdep_poll_des.patch 0037-mixer-fixed-double-free.patch 0038-pcm_file-fixed-missing-free.patch 0039-sbase-fixed-missing-free.patch 0040-rawmidi-close-handle-h.patch 0041-pcm_share-fixing-missing-mutex-unlock.patch 0042-simple_abst-null-check-for-lib.patch 0043-socket-missing-socket-close.patch 0044-pcm_hooks-null-check-for-h.patch 0045-conf-return-negative-value-in-case-of-error.patch 0046-control-return-negative-value-in-case-of-error.patch 0047-pcm-return-negative-value-in-case-of-error.patch 0048-mixer-Fix-missing-hctl-handle-free-in-snd_mixer_atta.patch 0049-conf-ucm-PAZ00-add-Toshiba-AC100-Dynabook-AZ-new-con.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ alsa.spec ++++++ --- /var/tmp/diff_new_pack.fkOwBi/_old 2014-10-25 08:32:58.000000000 +0200 +++ /var/tmp/diff_new_pack.fkOwBi/_new 2014-10-25 08:32:58.000000000 +0200 @@ -70,6 +70,33 @@ Patch19: 0019-Sync-enum-snd_hwdep_iface_t-with-include-asound-asou.patch Patch20: 0020-pcm-2nd-round-of-pcm_misc-DSD-fixes.patch Patch21: 0021-doc-fix-cross-compiling-example.patch +Patch22: 0022-pcm-fix-snd_pcm_mmap_hw_avail-near-the-boundary.patch +Patch23: 0023-pcm-fix-return-value-of-snd_pcm_share_slave_avail.patch +Patch24: 0024-pcm-add-new-32-bit-DSD-sample-format.patch +Patch25: 0025-dmix-actually-rewind-when-running-or-being-drained.patch +Patch26: 0026-pcm-express-the-rewind-size-limitation-logic-better.patch +Patch27: 0027-pcm-handle-negative-values-from-snd_pcm_mmap_hw_avai.patch +Patch28: 0028-pcm-rate-use-the-snd_pcm_mmap_hw_avail-function.patch +Patch29: 0029-pcm-null-use-the-snd_pcm_mmap_avail-function.patch +Patch30: 0030-rate-handle-negative-values-from-snd_pcm_mmap_playba.patch +Patch31: 0031-dsnoop-rewindable-and-forwardable-logic-was-swapped.patch +Patch33: 0033-pcm-file-don-t-recurse-in-the-rewindable-and-forward.patch +Patch34: 0034-pcm-route-Fix-the-bad-condition-always-false.patch +Patch35: 0035-pcm-rate-hw_avail-must-not-be-negative-before-starti.patch +Patch36: 0036-hwdep-add-missing-declaration-for-snd_hwdep_poll_des.patch +Patch37: 0037-mixer-fixed-double-free.patch +Patch38: 0038-pcm_file-fixed-missing-free.patch +Patch39: 0039-sbase-fixed-missing-free.patch +Patch40: 0040-rawmidi-close-handle-h.patch +Patch41: 0041-pcm_share-fixing-missing-mutex-unlock.patch +Patch42: 0042-simple_abst-null-check-for-lib.patch +Patch43: 0043-socket-missing-socket-close.patch +Patch44: 0044-pcm_hooks-null-check-for-h.patch +Patch45: 0045-conf-return-negative-value-in-case-of-error.patch +Patch46: 0046-control-return-negative-value-in-case-of-error.patch +Patch47: 0047-pcm-return-negative-value-in-case-of-error.patch +Patch48: 0048-mixer-Fix-missing-hctl-handle-free-in-snd_mixer_atta.patch +Patch49: 0049-conf-ucm-PAZ00-add-Toshiba-AC100-Dynabook-AZ-new-con.patch # rest suse patches Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff BuildRequires: doxygen @@ -159,6 +186,33 @@ %patch19 -p1 %patch20 -p1 %patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 %if 0%{?suse_version} == 1130 %patch99 -p1 %endif ++++++ 0022-pcm-fix-snd_pcm_mmap_hw_avail-near-the-boundary.patch ++++++ >From 99a2254f5f2a085b81efcc80950033a2b6110ecd Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 31 Aug 2014 22:23:47 +0600 Subject: [PATCH] pcm: fix snd_pcm_mmap_hw_avail() near the boundary This function returned incorrect results when hw.ptr was near the boundary and hw.appl_ptr was near zero. Here "incorrect" means "greater than the boundary". The result was incorrect, because it was used as a return value of various *_rewindable() functions and also as the delay for ioplug. Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/pcm/pcm_local.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 80bbe5973bdb..74ebd609334a 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -461,13 +461,7 @@ static inline snd_pcm_sframes_t snd_pcm_mmap_capture_hw_avail(snd_pcm_t *pcm) static inline snd_pcm_sframes_t snd_pcm_mmap_hw_avail(snd_pcm_t *pcm) { - snd_pcm_sframes_t avail; - avail = *pcm->hw.ptr - *pcm->appl.ptr; - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) - avail += pcm->buffer_size; - if (avail < 0) - avail += pcm->boundary; - return pcm->buffer_size - avail; + return pcm->buffer_size - snd_pcm_mmap_avail(pcm); } static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm) -- 2.1.2 ++++++ 0023-pcm-fix-return-value-of-snd_pcm_share_slave_avail.patch ++++++ >From 622b1b6bdbb34baca885b65643d4796057574eb7 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Tue, 2 Sep 2014 01:29:36 +0600 Subject: [PATCH] pcm: fix return value of snd_pcm_share_slave_avail The return value was wrong for playback if slave->hw_ptr was near the boundary and *pcm->appl.ptr was near zero. The wrong result was greater than the boundary. Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/pcm/pcm_share.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index 97705447dd6d..c301c7af799a 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -128,6 +128,8 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave) avail += pcm->buffer_size; if (avail < 0) avail += pcm->boundary; + else if ((snd_pcm_uframes_t) avail >= pcm->boundary) + avail -= pcm->boundary; return avail; } -- 2.1.2 ++++++ 0024-pcm-add-new-32-bit-DSD-sample-format.patch ++++++ >From e59ffbf30ec13f7f1615ba266ec2f3e770801d6f Mon Sep 17 00:00:00 2001 From: Jurgen Kramer <[email protected]> Date: Wed, 10 Sep 2014 09:00:28 +0200 Subject: [PATCH] pcm: add new 32-bit DSD sample format Add the new DSD_U32_LE sample format to alsa-lib. NB include/pcm.h and include/sound/asound.h are updated so a new sync with the kernel headers is not needed Signed-off-by: Jurgen Kramer <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- include/pcm.h | 4 +++- include/sound/asound.h | 3 ++- src/pcm/pcm.c | 2 ++ src/pcm/pcm_misc.c | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/pcm.h b/include/pcm.h index 11e9f0dfba13..db88ad5ee41a 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -211,7 +211,9 @@ typedef enum _snd_pcm_format { SND_PCM_FORMAT_DSD_U8, /* Direct Stream Digital (DSD) in 2-byte samples (x16) */ SND_PCM_FORMAT_DSD_U16_LE, - SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U16_LE, + /* Direct Stream Digital (DSD) in 4-byte samples (x32) */ + SND_PCM_FORMAT_DSD_U32_LE, + SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_LE, #if __BYTE_ORDER == __LITTLE_ENDIAN /** Signed 16 bit CPU endian */ diff --git a/include/sound/asound.h b/include/sound/asound.h index 32168f7ffce3..6ee586728df9 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -219,7 +219,8 @@ typedef int __bitwise snd_pcm_format_t; #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ -#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U16_LE +#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ +#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE #ifdef SNDRV_LITTLE_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 1399a5b2e671..2e2433829016 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -1565,6 +1565,7 @@ static const char *const snd_pcm_format_names[] = { FORMAT(G723_40_1B), FORMAT(DSD_U8), FORMAT(DSD_U16_LE), + FORMAT(DSD_U32_LE), }; static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = { @@ -1624,6 +1625,7 @@ static const char *const snd_pcm_format_descriptions[] = { FORMATD(G723_40_1B, "G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte"), FORMATD(DSD_U8, "Direct Stream Digital, 1-byte (x8), oldest bit in MSB"), FORMATD(DSD_U16_LE, "Direct Stream Digital, 2-byte (x16), little endian, oldest bits in MSB"), + FORMATD(DSD_U32_LE, "Direct Stream Digital, 4-byte (x32), little endian, oldest bits in MSB"), }; static const char *const snd_pcm_type_names[] = { diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c index 46fc7719978e..92721796aa1f 100644 --- a/src/pcm/pcm_misc.c +++ b/src/pcm/pcm_misc.c @@ -64,6 +64,7 @@ int snd_pcm_format_signed(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U18_3BE: case SNDRV_PCM_FORMAT_DSD_U8: case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return 0; default: return -EINVAL; @@ -154,6 +155,7 @@ int snd_pcm_format_little_endian(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U18_3BE: case SNDRV_PCM_FORMAT_DSD_U8: case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return 0; default: return -EINVAL; @@ -232,6 +234,7 @@ int snd_pcm_format_width(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U32_BE: case SNDRV_PCM_FORMAT_FLOAT_LE: case SNDRV_PCM_FORMAT_FLOAT_BE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return 32; case SNDRV_PCM_FORMAT_FLOAT64_LE: case SNDRV_PCM_FORMAT_FLOAT64_BE: @@ -292,6 +295,7 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_FLOAT_BE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return 32; case SNDRV_PCM_FORMAT_FLOAT64_LE: case SNDRV_PCM_FORMAT_FLOAT64_BE: @@ -348,6 +352,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples) case SNDRV_PCM_FORMAT_U32_BE: case SNDRV_PCM_FORMAT_FLOAT_LE: case SNDRV_PCM_FORMAT_FLOAT_BE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return samples * 4; case SNDRV_PCM_FORMAT_FLOAT64_LE: case SNDRV_PCM_FORMAT_FLOAT64_BE: @@ -394,6 +399,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) return 0x8080808080808080ULL; case SNDRV_PCM_FORMAT_DSD_U8: case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return 0x6969696969696969ULL; #ifdef SNDRV_LITTLE_ENDIAN case SNDRV_PCM_FORMAT_U16_LE: -- 2.1.2 ++++++ 0025-dmix-actually-rewind-when-running-or-being-drained.patch ++++++ >From 9a56a673a6cd7343a9345921e2b1cbbb43fb725f Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:13 +0600 Subject: [PATCH] dmix: actually rewind when running or being drained Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_dmix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 7c535093ea0f..73cbe3f8d0b2 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -669,11 +669,15 @@ static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_uframes_t slave_appl_ptr, slave_size; snd_pcm_uframes_t appl_ptr, size, transfer, result; + int err; const snd_pcm_channel_area_t *src_areas, *dst_areas; if (dmix->state == SND_PCM_STATE_RUNNING || - dmix->state == SND_PCM_STATE_DRAINING) - return snd_pcm_dmix_hwsync(pcm); + dmix->state == SND_PCM_STATE_DRAINING) { + err = snd_pcm_dmix_hwsync(pcm); + if (err < 0) + return err; + } if (dmix->last_appl_ptr < dmix->appl_ptr) size = dmix->appl_ptr - dmix->last_appl_ptr; -- 2.1.2 ++++++ 0026-pcm-express-the-rewind-size-limitation-logic-better.patch ++++++ >From 9a43dc15b2979ed6d8850b033b594fbef829c991 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:14 +0600 Subject: [PATCH] pcm: express the rewind size limitation logic better There are a few places where the argument of the .rewind or .forward callback is checked against the same value as returned by .rewindable or .forwardable. Express this "don't rewind more than rewindable" logic explicitly, so that the future fixes to the rewindable size can go to one function instead of two. While at it, take advantage of the fact that snd_pcm_mmap_avail() cannot return negative values (except due to integer overflow, which is AFAICS impossible given the current boundary choice). Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_dmix.c | 4 +--- src/pcm/pcm_dshare.c | 6 ++---- src/pcm/pcm_dsnoop.c | 6 ++---- src/pcm/pcm_plugin.c | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 73cbe3f8d0b2..ffde12a1a46c 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -751,9 +751,7 @@ static snd_pcm_sframes_t snd_pcm_dmix_forward(snd_pcm_t *pcm, snd_pcm_uframes_t { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_playback_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dmix_forwardable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index b985172825e7..f1a1a1d75229 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -419,7 +419,7 @@ static snd_pcm_sframes_t snd_pcm_dshare_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_playback_hw_avail(pcm); + avail = snd_pcm_dshare_rewindable(pcm); if (avail < 0) return 0; if (frames > (snd_pcm_uframes_t)avail) @@ -437,9 +437,7 @@ static snd_pcm_sframes_t snd_pcm_dshare_forward(snd_pcm_t *pcm, snd_pcm_uframes_ { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_playback_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dshare_forwardable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 0f9c9df481bc..e56e4022becf 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -342,9 +342,7 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_capture_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dsnoop_rewindable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_backward(pcm, frames); @@ -360,7 +358,7 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_forward(snd_pcm_t *pcm, snd_pcm_uframes_ { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_capture_hw_avail(pcm); + avail = snd_pcm_dsnoop_forwardable(pcm); if (avail < 0) return 0; if (frames > (snd_pcm_uframes_t)avail) diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 4ddf10c1989e..a607ccfe27de 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -204,7 +204,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewindable(snd_pcm_t *pcm) snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_plugin_t *plugin = pcm->private_data; - snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm); + snd_pcm_sframes_t n = snd_pcm_plugin_rewindable(pcm); snd_pcm_sframes_t sframes; if ((snd_pcm_uframes_t)n < frames) @@ -232,7 +232,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm) snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_plugin_t *plugin = pcm->private_data; - snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm); + snd_pcm_sframes_t n = snd_pcm_plugin_forwardable(pcm); snd_pcm_sframes_t sframes; if ((snd_pcm_uframes_t)n < frames) -- 2.1.2 ++++++ 0027-pcm-handle-negative-values-from-snd_pcm_mmap_hw_avai.patch ++++++ >From 78c804fc9348e4c29f1c77dd4b6ad586393aa628 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:15 +0600 Subject: [PATCH] pcm: handle negative values from snd_pcm_mmap_hw_avail Such negative values can happen when an underrun happens and xrun detection is disabled. Another situation is if the device updated the pointer before alsa-lib has a chance to detect the xrun. The problem is that these negative values could propagate to the snd_pcm_rewindable return value, where it is specified that negative returns must be interpreted as error codes and not as negative amount of samples. Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_dmix.c | 2 +- src/pcm/pcm_dshare.c | 4 +--- src/pcm/pcm_hw.c | 2 +- src/pcm/pcm_ioplug.c | 2 +- src/pcm/pcm_local.h | 18 ++++++++++++++++++ src/pcm/pcm_plugin.c | 2 +- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index ffde12a1a46c..babde6a15efe 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -661,7 +661,7 @@ static int snd_pcm_dmix_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIB static snd_pcm_sframes_t snd_pcm_dmix_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_playback_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index f1a1a1d75229..020e6f7d9307 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -412,7 +412,7 @@ static int snd_pcm_dshare_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTR static snd_pcm_sframes_t snd_pcm_dshare_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_playback_hw_avail(pcm); + return snd_pcm_mmap_playback_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_dshare_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) @@ -420,8 +420,6 @@ static snd_pcm_sframes_t snd_pcm_dshare_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t snd_pcm_sframes_t avail; avail = snd_pcm_dshare_rewindable(pcm); - if (avail < 0) - return 0; if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_backward(pcm, frames); diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 74cff672a0c1..c34b766ee035 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -659,7 +659,7 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable) static snd_pcm_sframes_t snd_pcm_hw_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index 85a88911eafc..fe9347c835d5 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -503,7 +503,7 @@ static int snd_pcm_ioplug_pause(snd_pcm_t *pcm, int enable) static snd_pcm_sframes_t snd_pcm_ioplug_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_ioplug_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 74ebd609334a..394505f978ac 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -464,6 +464,24 @@ static inline snd_pcm_sframes_t snd_pcm_mmap_hw_avail(snd_pcm_t *pcm) return pcm->buffer_size - snd_pcm_mmap_avail(pcm); } +static inline snd_pcm_sframes_t snd_pcm_mmap_playback_hw_rewindable(snd_pcm_t *pcm) +{ + snd_pcm_sframes_t ret = snd_pcm_mmap_playback_hw_avail(pcm); + return (ret >= 0) ? ret : 0; +} + +static inline snd_pcm_sframes_t snd_pcm_mmap_capture_hw_rewindable(snd_pcm_t *pcm) +{ + snd_pcm_sframes_t ret = snd_pcm_mmap_capture_hw_avail(pcm); + return (ret >= 0) ? ret : 0; +} + +static inline snd_pcm_uframes_t snd_pcm_mmap_hw_rewindable(snd_pcm_t *pcm) +{ + snd_pcm_sframes_t ret = snd_pcm_mmap_hw_avail(pcm); + return (ret >= 0) ? ret : 0; +} + static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm) { if (pcm->stopped_areas && diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index a607ccfe27de..c19e2f17a730 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -198,7 +198,7 @@ static int snd_pcm_plugin_reset(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_plugin_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_hw_rewindable(pcm); } snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) -- 2.1.2 ++++++ 0028-pcm-rate-use-the-snd_pcm_mmap_hw_avail-function.patch ++++++ >From 0889e9470667dd68d5a0ce47a10a8c6d61b7bc79 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:16 +0600 Subject: [PATCH] pcm, rate: use the snd_pcm_mmap_hw_avail function instead of the open-coded equivalent Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_rate.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 5e811bb7192a..b436a8ea65ba 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -593,10 +593,7 @@ static int snd_pcm_rate_hwsync(snd_pcm_t *pcm) static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { snd_pcm_rate_hwsync(pcm); - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) - *delayp = snd_pcm_mmap_playback_hw_avail(pcm); - else - *delayp = snd_pcm_mmap_capture_hw_avail(pcm); + *delayp = snd_pcm_mmap_hw_avail(pcm); return 0; } -- 2.1.2 ++++++ 0029-pcm-null-use-the-snd_pcm_mmap_avail-function.patch ++++++ >From 4fafa468d4bb4618cfde7183f820d8fdd373dcb1 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:17 +0600 Subject: [PATCH] pcm, null: use the snd_pcm_mmap_avail function instead of the open-coded equivalent Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_null.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c index f11a1020f7e3..05298200ac0a 100644 --- a/src/pcm/pcm_null.c +++ b/src/pcm/pcm_null.c @@ -86,10 +86,7 @@ static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm) if (null->state == SND_PCM_STATE_PREPARED) { /* it is required to return the correct avail count for */ /* the prepared stream, otherwise the start is not called */ - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) - return snd_pcm_mmap_playback_avail(pcm); - else - return snd_pcm_mmap_capture_avail(pcm); + return snd_pcm_mmap_avail(pcm); } return pcm->buffer_size; } -- 2.1.2 ++++++ 0030-rate-handle-negative-values-from-snd_pcm_mmap_playba.patch ++++++ >From ff9d213ff80f6fe0456565d4f524366443217174 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:18 +0600 Subject: [PATCH] rate: handle negative values from snd_pcm_mmap_playback_hw_avail Such negative returns are possible during an underrun if xrun detection is disabled. So, don't store the result in an unsigned variable (where it will overflow), and postpone the trigger in such case, too. Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_rate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index b436a8ea65ba..736d5583cd4c 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1058,7 +1058,7 @@ static snd_pcm_state_t snd_pcm_rate_state(snd_pcm_t *pcm) static int snd_pcm_rate_start(snd_pcm_t *pcm) { snd_pcm_rate_t *rate = pcm->private_data; - snd_pcm_uframes_t avail; + snd_pcm_sframes_t avail; if (pcm->stream == SND_PCM_STREAM_CAPTURE) return snd_pcm_start(rate->gen.slave); @@ -1069,7 +1069,7 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm) gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type); avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave); - if (avail == 0) { + if (avail <= 0) { /* postpone the trigger since we have no data committed yet */ rate->start_pending = 1; return 0; -- 2.1.2 ++++++ 0031-dsnoop-rewindable-and-forwardable-logic-was-swapped.patch ++++++ >From e5e1af83881e4dbe20749a314703db7d0fd091c7 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:19 +0600 Subject: [PATCH] dsnoop: rewindable and forwardable logic was swapped Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_dsnoop.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index e56e4022becf..8333eefdaf4c 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -335,7 +335,7 @@ static int snd_pcm_dsnoop_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTR static snd_pcm_sframes_t snd_pcm_dsnoop_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_capture_avail(pcm); + return snd_pcm_mmap_capture_hw_avail(pcm); } static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) @@ -351,7 +351,7 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t static snd_pcm_sframes_t snd_pcm_dsnoop_forwardable(snd_pcm_t *pcm) { - return snd_pcm_mmap_capture_hw_avail(pcm); + return snd_pcm_mmap_capture_avail(pcm); } static snd_pcm_sframes_t snd_pcm_dsnoop_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) @@ -359,8 +359,6 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_forward(snd_pcm_t *pcm, snd_pcm_uframes_ snd_pcm_sframes_t avail; avail = snd_pcm_dsnoop_forwardable(pcm); - if (avail < 0) - return 0; if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); -- 2.1.2 ++++++ 0033-pcm-file-don-t-recurse-in-the-rewindable-and-forward.patch ++++++ >From f803a3394a7b7390087be3cc192b2895f9e960ea Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Sun, 14 Sep 2014 00:30:21 +0600 Subject: [PATCH] pcm, file: don't recurse in the rewindable and forwardable callbacks Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index a0b8bf41bf5b..5541a9395027 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -454,7 +454,7 @@ static int snd_pcm_file_drain(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_file_rewindable(snd_pcm_t *pcm) { snd_pcm_file_t *file = pcm->private_data; - snd_pcm_sframes_t res = snd_pcm_rewindable(pcm); + snd_pcm_sframes_t res = snd_pcm_rewindable(file->gen.slave); snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); if (res > n) res = n; @@ -482,7 +482,7 @@ static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f static snd_pcm_sframes_t snd_pcm_file_forwardable(snd_pcm_t *pcm) { snd_pcm_file_t *file = pcm->private_data; - snd_pcm_sframes_t res = snd_pcm_forwardable(pcm); + snd_pcm_sframes_t res = snd_pcm_forwardable(file->gen.slave); snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes); if (res > n) res = n; -- 2.1.2 ++++++ 0034-pcm-route-Fix-the-bad-condition-always-false.patch ++++++ >From 650b8c975cd5c3f7dca6e78e74db587b57bcdfd8 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela <[email protected]> Date: Tue, 16 Sep 2014 09:00:39 +0200 Subject: [PATCH] pcm route: Fix the bad condition (always false) --- src/pcm/pcm_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index e7de9b51f1fc..2a437e88b93c 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -1147,7 +1147,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent snd_config_iterator_t j, jnext; long cchannel; const char *id; - if (!snd_config_get_id(in, &id) < 0) + if (snd_config_get_id(in, &id) < 0) continue; err = safe_strtol(id, &cchannel); if (err < 0 || -- 2.1.2 ++++++ 0035-pcm-rate-hw_avail-must-not-be-negative-before-starti.patch ++++++ >From 048568bbea700dfd9921b40321f8d5aa7e5ef417 Mon Sep 17 00:00:00 2001 From: "Alexander E. Patrakov" <[email protected]> Date: Mon, 15 Sep 2014 20:17:47 +0600 Subject: [PATCH] pcm, rate: hw_avail must not be negative before starting the stream If it is, then it means most likely the driver problem, so we should return error immediately instead. Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> --- src/pcm/pcm_rate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 736d5583cd4c..c76db25b1183 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1069,7 +1069,10 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm) gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type); avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave); - if (avail <= 0) { + if (avail < 0) /* can't happen on healthy drivers */ + return -EBADFD; + + if (avail == 0) { /* postpone the trigger since we have no data committed yet */ rate->start_pending = 1; return 0; -- 2.1.2 ++++++ 0036-hwdep-add-missing-declaration-for-snd_hwdep_poll_des.patch ++++++ >From 9ab3c4a66952c3ae4277624152da675050c7d2ad Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto <[email protected]> Date: Wed, 17 Sep 2014 07:07:03 +0900 Subject: [PATCH] hwdep: add missing declaration for snd_hwdep_poll_descriptors_count() The alsa-lib has 'snd_hwdep_poll_descriptors_count()' but hwdep.h has no declaration for the function. No applications can call the function just by including the header. This commit adds a line to the file for this function. Signed-off-by: Takashi Sakamoto <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- include/hwdep.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hwdep.h b/include/hwdep.h index 6496fa2d7d87..ad8bb4972818 100644 --- a/include/hwdep.h +++ b/include/hwdep.h @@ -102,6 +102,7 @@ typedef struct _snd_hwdep snd_hwdep_t; int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode); int snd_hwdep_close(snd_hwdep_t *hwdep); int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space); +int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep); int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock); int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info); -- 2.1.2 ++++++ 0037-mixer-fixed-double-free.patch ++++++ >From 020bb3018ad6febbb0ae9650c4a4ca2b016f7d52 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:01:36 +0200 Subject: [PATCH] mixer: fixed double free Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/mixer/mixer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index 56e023dbe7a9..eee9875b44fb 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -204,10 +204,8 @@ int snd_mixer_attach(snd_mixer_t *mixer, const char *name) if (err < 0) return err; err = snd_mixer_attach_hctl(mixer, hctl); - if (err < 0) { - snd_hctl_close(hctl); + if (err < 0) return err; - } return 0; } -- 2.1.2 ++++++ 0038-pcm_file-fixed-missing-free.patch ++++++ >From d37f9187956cc0a58bdd129a807e3fdd1f5286b8 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:04:19 +0200 Subject: [PATCH] pcm_file: fixed missing free Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/pcm/pcm_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 5541a9395027..9ab6964d3520 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -758,6 +758,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */ if (ifd < 0) { SYSERR("open %s for reading failed", ifname); + free(file->fname); free(file); return -errno; } @@ -772,6 +773,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode); if (err < 0) { free(file->fname); + free(file->ifname); free(file); return err; } -- 2.1.2 ++++++ 0039-sbase-fixed-missing-free.patch ++++++ >From 0ee46280f3e3e52ed2c0af45c9a446a5a9dc5f83 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:04:26 +0200 Subject: [PATCH] sbase: fixed missing free Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- modules/mixer/simple/sbase.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mixer/simple/sbase.c b/modules/mixer/simple/sbase.c index 97feee8905a6..bb2f59d8a18a 100644 --- a/modules/mixer/simple/sbase.c +++ b/modules/mixer/simple/sbase.c @@ -377,6 +377,7 @@ static int simple_event_add1(snd_mixer_class_t *class, if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) { __invalid_type: snd_mixer_selem_id_free(id); + free(hsimple); return -EINVAL; } break; -- 2.1.2 ++++++ 0040-rawmidi-close-handle-h.patch ++++++ >From 09f5c75e9cd7869353a4f6c8da72df43dc2c8e22 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:05:27 +0200 Subject: [PATCH] rawmidi: close handle h Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/rawmidi/rawmidi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c index b835b472b361..ac699b439b11 100644 --- a/src/rawmidi/rawmidi.c +++ b/src/rawmidi/rawmidi.c @@ -256,8 +256,11 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp snd_config_delete(type_conf); if (err >= 0) err = open_func(inputp, outputp, name, rawmidi_root, rawmidi_conf, mode); - if (err < 0) + if (err < 0) { + if (h) + snd_dlclose(h); return err; + } if (inputp) { (*inputp)->dl_handle = h; h = NULL; snd_rawmidi_params_default(*inputp, ¶ms); -- 2.1.2 ++++++ 0041-pcm_share-fixing-missing-mutex-unlock.patch ++++++ >From 30f289a8a38006a937ca9189bc666b0bd90cab3c Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:05:39 +0200 Subject: [PATCH] pcm_share: fixing missing mutex unlock Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/pcm/pcm_share.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index c301c7af799a..4b68f1f00fe3 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -369,6 +369,7 @@ static void *snd_pcm_share_thread(void *data) err = pipe(slave->poll); if (err < 0) { SYSERR("can't create a pipe"); + Pthread_mutex_unlock(&slave->mutex); return NULL; } while (slave->open_count > 0) { @@ -395,6 +396,7 @@ static void *snd_pcm_share_thread(void *data) err = snd_pcm_sw_params(spcm, &slave->sw_params); if (err < 0) { SYSERR("snd_pcm_sw_params error"); + Pthread_mutex_unlock(&slave->mutex); return NULL; } } -- 2.1.2 ++++++ 0042-simple_abst-null-check-for-lib.patch ++++++ >From f3f568e3db5fccdf5cfb7053c04fde6272974faa Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:06:28 +0200 Subject: [PATCH] simple_abst: null check for lib Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/mixer/simple_abst.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mixer/simple_abst.c b/src/mixer/simple_abst.c index 9e9aaf55c535..5297472a6d26 100644 --- a/src/mixer/simple_abst.c +++ b/src/mixer/simple_abst.c @@ -70,6 +70,8 @@ static int try_open(snd_mixer_class_t *class, const char *lib) void *h; int err = 0; + if (!lib) + return -ENXIO; path = getenv("ALSA_MIXER_SIMPLE_MODULES"); if (!path) path = SO_PATH; -- 2.1.2 ++++++ 0043-socket-missing-socket-close.patch ++++++ >From bd0b008c0d8ff08cd541dc608ce78478de7c9d12 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:06:36 +0200 Subject: [PATCH] socket: missing socket close Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/socket.c b/src/socket.c index 97c919f74876..16979b520ae6 100644 --- a/src/socket.c +++ b/src/socket.c @@ -124,12 +124,15 @@ int snd_is_local(struct hostent *hent) conf.ifc_len = numreqs * sizeof(struct ifreq); conf.ifc_buf = malloc((unsigned int) conf.ifc_len); - if (! conf.ifc_buf) + if (! conf.ifc_buf) { + close(s); return -ENOMEM; + } while (1) { err = ioctl(s, SIOCGIFCONF, &conf); if (err < 0) { SYSERR("SIOCGIFCONF failed"); + close(s); return -errno; } if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq)) @@ -137,8 +140,10 @@ int snd_is_local(struct hostent *hent) numreqs *= 2; conf.ifc_len = numreqs * sizeof(struct ifreq); conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len); - if (! conf.ifc_buf) + if (! conf.ifc_buf) { + close(s); return -ENOMEM; + } } numreqs = conf.ifc_len / sizeof(struct ifreq); for (i = 0; i < numreqs; ++i) { -- 2.1.2 ++++++ 0044-pcm_hooks-null-check-for-h.patch ++++++ >From 69e0aaa569912c2162908f168291490301b72322 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:07:13 +0200 Subject: [PATCH] pcm_hooks: null check for h Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/pcm/pcm_hooks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pcm/pcm_hooks.c b/src/pcm/pcm_hooks.c index 0b93c641daaa..ce1cf361e74b 100644 --- a/src/pcm/pcm_hooks.c +++ b/src/pcm/pcm_hooks.c @@ -457,7 +457,8 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_ err = hook_add_dlobj(pcm, h); if (err < 0) { - snd_dlclose(h); + if(h) + snd_dlclose(h); return err; } return 0; -- 2.1.2 ++++++ 0045-conf-return-negative-value-in-case-of-error.patch ++++++ >From b356cd29f975e53ae050a672aff81a71535c412b Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:07:20 +0200 Subject: [PATCH] conf: return negative value in case of error Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf.c b/src/conf.c index 5ccc8e1a53e5..bb256e7ae443 100644 --- a/src/conf.c +++ b/src/conf.c @@ -4198,6 +4198,7 @@ static int _snd_config_evaluate(snd_config_t *src, snd_config_iterator_t i, next; if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for func %s definition", str); + err = -EINVAL; goto _err; } snd_config_for_each(i, next, func_conf) { -- 2.1.2 ++++++ 0046-control-return-negative-value-in-case-of-error.patch ++++++ >From 5a0b992548778e063dbafb6737658be9b5e1e2a9 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:08:09 +0200 Subject: [PATCH] control: return negative value in case of error Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/control/control.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/control/control.c b/src/control/control.c index d66ed755356f..dd428a1501b4 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -864,6 +864,7 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, if (err >= 0) { if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for CTL type %s definition", str); + err = -EINVAL; goto _err; } snd_config_for_each(i, next, type_conf) { -- 2.1.2 ++++++ 0047-pcm-return-negative-value-in-case-of-error.patch ++++++ >From f78ba070b38c0711308d14ce642e78bc2a1a8fc6 Mon Sep 17 00:00:00 2001 From: Renu Tyagi <[email protected]> Date: Tue, 23 Sep 2014 09:08:23 +0200 Subject: [PATCH] pcm: return negative value in case of error Signed-off-by: renu tyagi <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- src/pcm/pcm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 2e2433829016..4a7be6c1a55f 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -2145,6 +2145,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, if (err >= 0) { if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for PCM type %s definition", str); + err = -EINVAL; goto _err; } snd_config_for_each(i, next, type_conf) { -- 2.1.2 ++++++ 0048-mixer-Fix-missing-hctl-handle-free-in-snd_mixer_atta.patch ++++++ >From 7c1f36dbcbe8d60c6f90cbcf7e2e801cacbcd535 Mon Sep 17 00:00:00 2001 From: Takashi Iwai <[email protected]> Date: Tue, 23 Sep 2014 09:11:27 +0200 Subject: [PATCH] mixer: Fix missing hctl handle free in snd_mixer_attach_hctl() Yet another missing piece. Also, update the function document to warn about the behavior at error. Signed-off-by: Takashi Iwai <[email protected]> --- src/mixer/mixer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index eee9875b44fb..3a79c8e91efb 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -214,6 +214,8 @@ int snd_mixer_attach(snd_mixer_t *mixer, const char *name) * \param mixer Mixer handle * \param hctl the HCTL to be attached * \return 0 on success otherwise a negative error code + * + * Upon error, this function closes the given hctl handle automatically. */ int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl) { @@ -222,8 +224,10 @@ int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl) assert(hctl); slave = calloc(1, sizeof(*slave)); - if (slave == NULL) + if (slave == NULL) { + snd_hctl_close(hctl); return -ENOMEM; + } err = snd_hctl_nonblock(hctl, 1); if (err < 0) { snd_hctl_close(hctl); -- 2.1.2 ++++++ 0049-conf-ucm-PAZ00-add-Toshiba-AC100-Dynabook-AZ-new-con.patch ++++++ >From 24b4e86ddc512acb6b26f97cb958d59586482fb7 Mon Sep 17 00:00:00 2001 From: zombah <[email protected]> Date: Tue, 23 Sep 2014 19:53:43 +0400 Subject: [PATCH] conf/ucm: PAZ00: add Toshiba AC100/Dynabook AZ new config Recent mainline kernels threat Toshiba AC100 audio hardware as hw:PAZ00 vs old hw:tegraalc5632. This patch adds config files for new hw name and include them to makefiles. Signed-off-by: zombah <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- configure.ac | 1 + src/conf/ucm/Makefile.am | 2 +- src/conf/ucm/PAZ00/HiFi.conf | 45 +++++++++++++++++++++++++++++ src/conf/ucm/PAZ00/Makefile.am | 4 +++ src/conf/ucm/PAZ00/PAZ00.conf | 39 +++++++++++++++++++++++++ src/conf/ucm/PAZ00/Record.conf | 65 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 src/conf/ucm/PAZ00/HiFi.conf create mode 100644 src/conf/ucm/PAZ00/Makefile.am create mode 100644 src/conf/ucm/PAZ00/PAZ00.conf create mode 100644 src/conf/ucm/PAZ00/Record.conf diff --git a/configure.ac b/configure.ac index b8353a09f0d9..734163c8c321 100644 --- a/configure.ac +++ b/configure.ac @@ -653,6 +653,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ src/conf/ucm/PandaBoardES/Makefile \ src/conf/ucm/SDP4430/Makefile \ src/conf/ucm/tegraalc5632/Makefile \ + src/conf/ucm/PAZ00/Makefile \ modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \ alsalisp/Makefile aserver/Makefile \ test/Makefile test/lsb/Makefile \ diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am index e089dde73b32..bde89dfea440 100644 --- a/src/conf/ucm/Makefile.am +++ b/src/conf/ucm/Makefile.am @@ -1 +1 @@ -SUBDIRS=DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 +SUBDIRS=DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 PAZ00 diff --git a/src/conf/ucm/PAZ00/HiFi.conf b/src/conf/ucm/PAZ00/HiFi.conf new file mode 100644 index 000000000000..275516d6eb70 --- /dev/null +++ b/src/conf/ucm/PAZ00/HiFi.conf @@ -0,0 +1,45 @@ +SectionVerb { + EnableSequence [ + cdev "hw:PAZ00" + + cset "name='Speaker Playback Switch' on" + cset "name='Int Spk Switch' on" + cset "name='Speaker Mix DAC2SPK Playback Switch' on" + ] + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Int Spk Switch' off" + cset "name='Speaker Mix DAC2SPK Playback Switch' off" + ] +} + +SectionDevice."Headset".0 { + Comment "3.5mm Headset" + + Value { + JackName "Paz00 Headset Jack" + } + + EnableSequence [ + cdev "hw:PAZ00" + + # Internal speaker + cset "name='Int Spk Switch' off" + + # Headphones + cset "name='Headphone Playback Switch' on" + cset "name='HPL Mix DACL2HP Playback Switch' on" + cset "name='HPR Mix DACR2HP Playback Switch' on" + ] + DisableSequence [ + cdev "hw:PAZ00" + + # Headphones + cset "name='Headphone Playback Switch' off" + cset "name='HPL Mix DACL2HP Playback Switch' off" + cset "name='HPR Mix DACR2HP Playback Switch' off" + + # Internal speaker + cset "name='Int Spk Switch' on" + ] +} diff --git a/src/conf/ucm/PAZ00/Makefile.am b/src/conf/ucm/PAZ00/Makefile.am new file mode 100644 index 000000000000..1bf98a67515f --- /dev/null +++ b/src/conf/ucm/PAZ00/Makefile.am @@ -0,0 +1,4 @@ +alsaconfigdir = @ALSA_CONFIG_DIR@ +ucmdir = $(alsaconfigdir)/ucm/PAZ00 +ucm_DATA = PAZ00.conf HiFi.conf Record.conf +EXTRA_DIST = $(ucm_DATA) diff --git a/src/conf/ucm/PAZ00/PAZ00.conf b/src/conf/ucm/PAZ00/PAZ00.conf new file mode 100644 index 000000000000..8b9d90435ba1 --- /dev/null +++ b/src/conf/ucm/PAZ00/PAZ00.conf @@ -0,0 +1,39 @@ +Comment "PAZ00 alc5632" + +ValueDefaults { + PlaybackCTL "hw:0" + CaptureCTL "hw:0" +} + +SectionDefaults [ + cdev "hw:PAZ00" + + cset "name='Master Playback Switch' on" + cset "name='Master Playback Volume' 44,44" + cset "name='Headphone Playback Volume' 21,21" + cset "name='Speaker Playback Volume' 21,21" + cset "name='SpeakerOut Mux' 2" + cset "name='SpeakerOut N Mux' LN/-R" + cset "name='AB-D Amp Mux' 0" + cset "name='Left Headphone Mux' 1" + cset "name='Right Headphone Mux' 1" + cset "name='DMIC Boost Capture Volume' 4" + cset "name='Rec Capture Volume' 24" + + # Fix external mic record volumes + cset "name='Mic 1 Boost Volume' 0" + cset "name='Mic 2 Boost Volume' 0" + cset "name='Mic1 Playback Volume' 0" + cset "name='Mic2 Playback Volume' 0" + cset "name='Rec Capture Volume' 0" +] + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Music playback" +} + +SectionUseCase."Record" { + File "Record.conf" + Comment "Playback and capture" +} diff --git a/src/conf/ucm/PAZ00/Record.conf b/src/conf/ucm/PAZ00/Record.conf new file mode 100644 index 000000000000..568e2fbdf051 --- /dev/null +++ b/src/conf/ucm/PAZ00/Record.conf @@ -0,0 +1,65 @@ +SectionVerb { + EnableSequence [ + cdev "hw:PAZ00" + + cset "name='Speaker Playback Switch' on" + cset "name='Int Spk Switch' on" + cset "name='Speaker Mix DAC2SPK Playback Switch' on" + + cset "name='DMICL Mix DMICL2ADC Capture Switch' on" + cset "name='DMIC En Capture Switch' on" + cset "name='DMIC PreFilter Capture Switch' on" + ] + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Int Spk Switch' off" + cset "name='Speaker Mix DAC2SPK Playback Switch' off" + + cset "name='DMICL Mix DMICL2ADC Capture Switch' off" + cset "name='DMIC En Capture Switch' off" + cset "name='DMIC PreFilter Capture Switch' off" + ] +} + +SectionDevice."Headset".0 { + Comment "3.5mm Headset" + + Value { + JackName "Paz00 Headset Jack" + } + + EnableSequence [ + cdev "hw:PAZ00" + + # Internal speaker + cset "name='Int Spk Switch' off" + + # Internal mic + cset "name='DMIC En Capture Switch' off" + + # Headphones + cset "name='Headphone Playback Switch' on" + cset "name='HPL Mix DACL2HP Playback Switch' on" + cset "name='HPR Mix DACR2HP Playback Switch' on" + + # External min + cset "name='Left Capture Mix MIC12REC_L Capture Switch' on" + ] + DisableSequence [ + cdev "hw:PAZ00" + + # Headphones + cset "name='Headphone Playback Switch' off" + cset "name='HPL Mix DACL2HP Playback Switch' off" + cset "name='HPR Mix DACR2HP Playback Switch' off" + + # External mic + cset "name='Left Capture Mix MIC12REC_L Capture Switch' on" + + # Internal speaker + cset "name='Int Spk Switch' on" + + # Internal mic + cset "name='DMIC En Capture Switch' on" + ] +} -- 2.1.2 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
