diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-01-21 08:27:14 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-01-21 08:27:14 -0500 |
commit | 8b296c8f9f660b70e958e6e6b9b4293e6ae854f2 (patch) | |
tree | 44835f43c998fded6cf13c624032e788611369f9 /sound/core | |
parent | 88501ce18eaaf1273e024d26926134972f4644ea (diff) | |
parent | c91a988dc6551c66418690e36b2a23cdb0255da8 (diff) |
Merge remote branch 'alsa/devel' into topic/misc
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm.c | 1 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 20 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index df57a0e30bf2..0d428d0896db 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -894,6 +894,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | |||
894 | memset((void*)runtime->control, 0, size); | 894 | memset((void*)runtime->control, 0, size); |
895 | 895 | ||
896 | init_waitqueue_head(&runtime->sleep); | 896 | init_waitqueue_head(&runtime->sleep); |
897 | init_waitqueue_head(&runtime->tsleep); | ||
897 | 898 | ||
898 | runtime->status->state = SNDRV_PCM_STATE_OPEN; | 899 | runtime->status->state = SNDRV_PCM_STATE_OPEN; |
899 | 900 | ||
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 720019560794..272f15d19017 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -285,8 +285,8 @@ int snd_pcm_update_state(struct snd_pcm_substream *substream, | |||
285 | return -EPIPE; | 285 | return -EPIPE; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | if (!runtime->nowake && avail >= runtime->control->avail_min) | 288 | if (avail >= runtime->control->avail_min) |
289 | wake_up(&runtime->sleep); | 289 | wake_up(runtime->twake ? &runtime->tsleep : &runtime->sleep); |
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
@@ -1706,7 +1706,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream, | |||
1706 | long tout; | 1706 | long tout; |
1707 | 1707 | ||
1708 | init_waitqueue_entry(&wait, current); | 1708 | init_waitqueue_entry(&wait, current); |
1709 | add_wait_queue(&runtime->sleep, &wait); | 1709 | add_wait_queue(&runtime->tsleep, &wait); |
1710 | for (;;) { | 1710 | for (;;) { |
1711 | if (signal_pending(current)) { | 1711 | if (signal_pending(current)) { |
1712 | err = -ERESTARTSYS; | 1712 | err = -ERESTARTSYS; |
@@ -1749,7 +1749,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream, | |||
1749 | break; | 1749 | break; |
1750 | } | 1750 | } |
1751 | _endloop: | 1751 | _endloop: |
1752 | remove_wait_queue(&runtime->sleep, &wait); | 1752 | remove_wait_queue(&runtime->tsleep, &wait); |
1753 | *availp = avail; | 1753 | *availp = avail; |
1754 | return err; | 1754 | return err; |
1755 | } | 1755 | } |
@@ -1808,7 +1808,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1808 | goto _end_unlock; | 1808 | goto _end_unlock; |
1809 | } | 1809 | } |
1810 | 1810 | ||
1811 | runtime->nowake = 1; | 1811 | runtime->twake = 1; |
1812 | while (size > 0) { | 1812 | while (size > 0) { |
1813 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; | 1813 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; |
1814 | snd_pcm_uframes_t avail; | 1814 | snd_pcm_uframes_t avail; |
@@ -1830,7 +1830,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1830 | if (frames > cont) | 1830 | if (frames > cont) |
1831 | frames = cont; | 1831 | frames = cont; |
1832 | if (snd_BUG_ON(!frames)) { | 1832 | if (snd_BUG_ON(!frames)) { |
1833 | runtime->nowake = 0; | 1833 | runtime->twake = 0; |
1834 | snd_pcm_stream_unlock_irq(substream); | 1834 | snd_pcm_stream_unlock_irq(substream); |
1835 | return -EINVAL; | 1835 | return -EINVAL; |
1836 | } | 1836 | } |
@@ -1869,7 +1869,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1869 | } | 1869 | } |
1870 | } | 1870 | } |
1871 | _end_unlock: | 1871 | _end_unlock: |
1872 | runtime->nowake = 0; | 1872 | runtime->twake = 0; |
1873 | if (xfer > 0 && err >= 0) | 1873 | if (xfer > 0 && err >= 0) |
1874 | snd_pcm_update_state(substream, runtime); | 1874 | snd_pcm_update_state(substream, runtime); |
1875 | snd_pcm_stream_unlock_irq(substream); | 1875 | snd_pcm_stream_unlock_irq(substream); |
@@ -2030,7 +2030,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
2030 | goto _end_unlock; | 2030 | goto _end_unlock; |
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | runtime->nowake = 1; | 2033 | runtime->twake = 1; |
2034 | while (size > 0) { | 2034 | while (size > 0) { |
2035 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; | 2035 | snd_pcm_uframes_t frames, appl_ptr, appl_ofs; |
2036 | snd_pcm_uframes_t avail; | 2036 | snd_pcm_uframes_t avail; |
@@ -2059,7 +2059,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
2059 | if (frames > cont) | 2059 | if (frames > cont) |
2060 | frames = cont; | 2060 | frames = cont; |
2061 | if (snd_BUG_ON(!frames)) { | 2061 | if (snd_BUG_ON(!frames)) { |
2062 | runtime->nowake = 0; | 2062 | runtime->twake = 0; |
2063 | snd_pcm_stream_unlock_irq(substream); | 2063 | snd_pcm_stream_unlock_irq(substream); |
2064 | return -EINVAL; | 2064 | return -EINVAL; |
2065 | } | 2065 | } |
@@ -2092,7 +2092,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
2092 | xfer += frames; | 2092 | xfer += frames; |
2093 | } | 2093 | } |
2094 | _end_unlock: | 2094 | _end_unlock: |
2095 | runtime->nowake = 0; | 2095 | runtime->twake = 0; |
2096 | if (xfer > 0 && err >= 0) | 2096 | if (xfer > 0 && err >= 0) |
2097 | snd_pcm_update_state(substream, runtime); | 2097 | snd_pcm_update_state(substream, runtime); |
2098 | snd_pcm_stream_unlock_irq(substream); | 2098 | snd_pcm_stream_unlock_irq(substream); |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index a870fe696578..43552fd73d24 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -919,6 +919,7 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) | |||
919 | runtime->status->state = state; | 919 | runtime->status->state = state; |
920 | } | 920 | } |
921 | wake_up(&runtime->sleep); | 921 | wake_up(&runtime->sleep); |
922 | wake_up(&runtime->tsleep); | ||
922 | } | 923 | } |
923 | 924 | ||
924 | static struct action_ops snd_pcm_action_stop = { | 925 | static struct action_ops snd_pcm_action_stop = { |
@@ -1004,6 +1005,7 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) | |||
1004 | SNDRV_TIMER_EVENT_MPAUSE, | 1005 | SNDRV_TIMER_EVENT_MPAUSE, |
1005 | &runtime->trigger_tstamp); | 1006 | &runtime->trigger_tstamp); |
1006 | wake_up(&runtime->sleep); | 1007 | wake_up(&runtime->sleep); |
1008 | wake_up(&runtime->tsleep); | ||
1007 | } else { | 1009 | } else { |
1008 | runtime->status->state = SNDRV_PCM_STATE_RUNNING; | 1010 | runtime->status->state = SNDRV_PCM_STATE_RUNNING; |
1009 | if (substream->timer) | 1011 | if (substream->timer) |
@@ -1061,6 +1063,7 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) | |||
1061 | runtime->status->suspended_state = runtime->status->state; | 1063 | runtime->status->suspended_state = runtime->status->state; |
1062 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1064 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1063 | wake_up(&runtime->sleep); | 1065 | wake_up(&runtime->sleep); |
1066 | wake_up(&runtime->tsleep); | ||
1064 | } | 1067 | } |
1065 | 1068 | ||
1066 | static struct action_ops snd_pcm_action_suspend = { | 1069 | static struct action_ops snd_pcm_action_suspend = { |