aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 20:07:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 20:07:31 -0400
commitfaa38b5e0e092914764cdba9f83d31a3f794d182 (patch)
treeb3e5921bdc36378033b4910eb4f29cb0dfc486e0 /sound/core
parent78417334b5cb6e1f915b8fdcc4fce3f1a1b4420c (diff)
parent74bf40f0793fed9e01eb6164c2ce63e8c27ca205 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (214 commits) ALSA: hda - Add pin-fix for HP dc5750 ALSA: als4000: Fix potentially invalid DMA mode setup ALSA: als4000: enable burst mode ALSA: hda - Fix initial capsrc selection in patch_alc269() ASoC: TWL4030: Capture route runtime DAPM ordering fix ALSA: hda - Add PC-beep whitelist for an Intel board ALSA: hda - More relax for pending period handling ALSA: hda - Define AC_FMT_* constants ALSA: hda - Fix beep frequency on IDT 92HD73xx and 92HD71Bxx codecs ALSA: hda - Add support for HDMI HBR passthrough ALSA: hda - Set Stream Type in Stream Format according to AES0 ALSA: hda - Fix Thinkpad X300 so SPDIF is not exposed ALSA: hda - FIX to not expose SPDIF on Thinkpad X301, since it does not have the ability to use SPDIF ASoC: wm9081: fix resource reclaim in wm9081_register error path ASoC: wm8978: fix a memory leak if a wm8978_register fail ASoC: wm8974: fix a memory leak if another WM8974 is registered ASoC: wm8961: fix resource reclaim in wm8961_register error path ASoC: wm8955: fix resource reclaim in wm8955_register error path ASoC: wm8940: fix a memory leak if wm8940_register return error ASoC: wm8904: fix resource reclaim in wm8904_register error path ...
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_lib.c25
-rw-r--r--sound/core/pcm_misc.c16
2 files changed, 33 insertions, 8 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index e9d98be190c..e23e0e7ab26 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -67,6 +67,8 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
67 } else { 67 } else {
68 if (new_hw_ptr == ULONG_MAX) { /* initialization */ 68 if (new_hw_ptr == ULONG_MAX) { /* initialization */
69 snd_pcm_sframes_t avail = snd_pcm_playback_hw_avail(runtime); 69 snd_pcm_sframes_t avail = snd_pcm_playback_hw_avail(runtime);
70 if (avail > runtime->buffer_size)
71 avail = runtime->buffer_size;
70 runtime->silence_filled = avail > 0 ? avail : 0; 72 runtime->silence_filled = avail > 0 ? avail : 0;
71 runtime->silence_start = (runtime->status->hw_ptr + 73 runtime->silence_start = (runtime->status->hw_ptr +
72 runtime->silence_filled) % 74 runtime->silence_filled) %
@@ -287,8 +289,11 @@ int snd_pcm_update_state(struct snd_pcm_substream *substream,
287 return -EPIPE; 289 return -EPIPE;
288 } 290 }
289 } 291 }
290 if (avail >= runtime->control->avail_min) 292 if (runtime->twake) {
291 wake_up(runtime->twake ? &runtime->tsleep : &runtime->sleep); 293 if (avail >= runtime->twake)
294 wake_up(&runtime->tsleep);
295 } else if (avail >= runtime->control->avail_min)
296 wake_up(&runtime->sleep);
292 return 0; 297 return 0;
293} 298}
294 299
@@ -1707,7 +1712,7 @@ EXPORT_SYMBOL(snd_pcm_period_elapsed);
1707 * The available space is stored on availp. When err = 0 and avail = 0 1712 * The available space is stored on availp. When err = 0 and avail = 0
1708 * on the capture stream, it indicates the stream is in DRAINING state. 1713 * on the capture stream, it indicates the stream is in DRAINING state.
1709 */ 1714 */
1710static int wait_for_avail_min(struct snd_pcm_substream *substream, 1715static int wait_for_avail(struct snd_pcm_substream *substream,
1711 snd_pcm_uframes_t *availp) 1716 snd_pcm_uframes_t *availp)
1712{ 1717{
1713 struct snd_pcm_runtime *runtime = substream->runtime; 1718 struct snd_pcm_runtime *runtime = substream->runtime;
@@ -1757,7 +1762,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream,
1757 avail = snd_pcm_playback_avail(runtime); 1762 avail = snd_pcm_playback_avail(runtime);
1758 else 1763 else
1759 avail = snd_pcm_capture_avail(runtime); 1764 avail = snd_pcm_capture_avail(runtime);
1760 if (avail >= runtime->control->avail_min) 1765 if (avail >= runtime->twake)
1761 break; 1766 break;
1762 } 1767 }
1763 _endloop: 1768 _endloop:
@@ -1820,7 +1825,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream,
1820 goto _end_unlock; 1825 goto _end_unlock;
1821 } 1826 }
1822 1827
1823 runtime->twake = 1; 1828 runtime->twake = runtime->control->avail_min ? : 1;
1824 while (size > 0) { 1829 while (size > 0) {
1825 snd_pcm_uframes_t frames, appl_ptr, appl_ofs; 1830 snd_pcm_uframes_t frames, appl_ptr, appl_ofs;
1826 snd_pcm_uframes_t avail; 1831 snd_pcm_uframes_t avail;
@@ -1833,7 +1838,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream,
1833 err = -EAGAIN; 1838 err = -EAGAIN;
1834 goto _end_unlock; 1839 goto _end_unlock;
1835 } 1840 }
1836 err = wait_for_avail_min(substream, &avail); 1841 runtime->twake = min_t(snd_pcm_uframes_t, size,
1842 runtime->control->avail_min ? : 1);
1843 err = wait_for_avail(substream, &avail);
1837 if (err < 0) 1844 if (err < 0)
1838 goto _end_unlock; 1845 goto _end_unlock;
1839 } 1846 }
@@ -2042,7 +2049,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream,
2042 goto _end_unlock; 2049 goto _end_unlock;
2043 } 2050 }
2044 2051
2045 runtime->twake = 1; 2052 runtime->twake = runtime->control->avail_min ? : 1;
2046 while (size > 0) { 2053 while (size > 0) {
2047 snd_pcm_uframes_t frames, appl_ptr, appl_ofs; 2054 snd_pcm_uframes_t frames, appl_ptr, appl_ofs;
2048 snd_pcm_uframes_t avail; 2055 snd_pcm_uframes_t avail;
@@ -2060,7 +2067,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream,
2060 err = -EAGAIN; 2067 err = -EAGAIN;
2061 goto _end_unlock; 2068 goto _end_unlock;
2062 } 2069 }
2063 err = wait_for_avail_min(substream, &avail); 2070 runtime->twake = min_t(snd_pcm_uframes_t, size,
2071 runtime->control->avail_min ? : 1);
2072 err = wait_for_avail(substream, &avail);
2064 if (err < 0) 2073 if (err < 0)
2065 goto _end_unlock; 2074 goto _end_unlock;
2066 if (!avail) 2075 if (!avail)
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index ea2bf82c937..434af3c56d5 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -128,6 +128,14 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
128 .width = 4, .phys = 4, .le = -1, .signd = -1, 128 .width = 4, .phys = 4, .le = -1, .signd = -1,
129 .silence = {}, 129 .silence = {},
130 }, 130 },
131 [SNDRV_PCM_FORMAT_G723_24] = {
132 .width = 3, .phys = 3, .le = -1, .signd = -1,
133 .silence = {},
134 },
135 [SNDRV_PCM_FORMAT_G723_40] = {
136 .width = 5, .phys = 5, .le = -1, .signd = -1,
137 .silence = {},
138 },
131 /* FIXME: the following three formats are not defined properly yet */ 139 /* FIXME: the following three formats are not defined properly yet */
132 [SNDRV_PCM_FORMAT_MPEG] = { 140 [SNDRV_PCM_FORMAT_MPEG] = {
133 .le = -1, .signd = -1, 141 .le = -1, .signd = -1,
@@ -186,6 +194,14 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
186 .width = 18, .phys = 24, .le = 0, .signd = 0, 194 .width = 18, .phys = 24, .le = 0, .signd = 0,
187 .silence = { 0x02, 0x00, 0x00 }, 195 .silence = { 0x02, 0x00, 0x00 },
188 }, 196 },
197 [SNDRV_PCM_FORMAT_G723_24_1B] = {
198 .width = 3, .phys = 8, .le = -1, .signd = -1,
199 .silence = {},
200 },
201 [SNDRV_PCM_FORMAT_G723_40_1B] = {
202 .width = 5, .phys = 8, .le = -1, .signd = -1,
203 .silence = {},
204 },
189}; 205};
190 206
191 207