diff options
-rw-r--r-- | include/sound/pcm.h | 8 | ||||
-rw-r--r-- | sound/core/Kconfig | 13 | ||||
-rw-r--r-- | sound/core/Makefile | 3 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 2 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 36 |
5 files changed, 39 insertions, 23 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index a4fcc9456194..2882dddfc91c 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -1111,10 +1111,16 @@ static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substrea | |||
1111 | * Timer interface | 1111 | * Timer interface |
1112 | */ | 1112 | */ |
1113 | 1113 | ||
1114 | #ifdef CONFIG_SND_PCM_TIMER | ||
1114 | void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); | 1115 | void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); |
1115 | void snd_pcm_timer_init(struct snd_pcm_substream *substream); | 1116 | void snd_pcm_timer_init(struct snd_pcm_substream *substream); |
1116 | void snd_pcm_timer_done(struct snd_pcm_substream *substream); | 1117 | void snd_pcm_timer_done(struct snd_pcm_substream *substream); |
1117 | 1118 | #else | |
1119 | static inline void | ||
1120 | snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {} | ||
1121 | static inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {} | ||
1122 | static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {} | ||
1123 | #endif | ||
1118 | /** | 1124 | /** |
1119 | * snd_pcm_gettime - Fill the timespec depending on the timestamp mode | 1125 | * snd_pcm_gettime - Fill the timespec depending on the timestamp mode |
1120 | * @runtime: PCM runtime instance | 1126 | * @runtime: PCM runtime instance |
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 6c96feeaf01e..e3e949126a56 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig | |||
@@ -4,7 +4,7 @@ config SND_TIMER | |||
4 | 4 | ||
5 | config SND_PCM | 5 | config SND_PCM |
6 | tristate | 6 | tristate |
7 | select SND_TIMER | 7 | select SND_TIMER if SND_PCM_TIMER |
8 | 8 | ||
9 | config SND_PCM_ELD | 9 | config SND_PCM_ELD |
10 | bool | 10 | bool |
@@ -93,6 +93,17 @@ config SND_PCM_OSS_PLUGINS | |||
93 | support conversion of channels, formats and rates. It will | 93 | support conversion of channels, formats and rates. It will |
94 | behave like most of new OSS/Free drivers in 2.4/2.6 kernels. | 94 | behave like most of new OSS/Free drivers in 2.4/2.6 kernels. |
95 | 95 | ||
96 | config SND_PCM_TIMER | ||
97 | bool "PCM timer interface" if EXPERT | ||
98 | default y | ||
99 | help | ||
100 | If you disable this option, pcm timer will be inavailable, so | ||
101 | those stubs used pcm timer (e.g. dmix, dsnoop & co) may work | ||
102 | incorrectlly. | ||
103 | |||
104 | For some embedded device, we may disable it to reduce memory | ||
105 | footprint, about 20KB on x86_64 platform. | ||
106 | |||
96 | config SND_SEQUENCER_OSS | 107 | config SND_SEQUENCER_OSS |
97 | bool "OSS Sequencer API" | 108 | bool "OSS Sequencer API" |
98 | depends on SND_SEQUENCER | 109 | depends on SND_SEQUENCER |
diff --git a/sound/core/Makefile b/sound/core/Makefile index 3354f91e003a..48ab4b8f8279 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile | |||
@@ -13,8 +13,9 @@ snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o | |||
13 | snd-$(CONFIG_SND_VMASTER) += vmaster.o | 13 | snd-$(CONFIG_SND_VMASTER) += vmaster.o |
14 | snd-$(CONFIG_SND_JACK) += ctljack.o jack.o | 14 | snd-$(CONFIG_SND_JACK) += ctljack.o jack.o |
15 | 15 | ||
16 | snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \ | 16 | snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_misc.o \ |
17 | pcm_memory.o memalloc.o | 17 | pcm_memory.o memalloc.o |
18 | snd-pcm-$(CONFIG_SND_PCM_TIMER) += pcm_timer.o | ||
18 | snd-pcm-$(CONFIG_SND_DMA_SGBUF) += sgbuf.o | 19 | snd-pcm-$(CONFIG_SND_DMA_SGBUF) += sgbuf.o |
19 | snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o | 20 | snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o |
20 | snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o | 21 | snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 7d45645f10ba..6dc4277937b8 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1883,8 +1883,10 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) | |||
1883 | snd_pcm_update_hw_ptr0(substream, 1) < 0) | 1883 | snd_pcm_update_hw_ptr0(substream, 1) < 0) |
1884 | goto _end; | 1884 | goto _end; |
1885 | 1885 | ||
1886 | #ifdef CONFIG_SND_PCM_TIMER | ||
1886 | if (substream->timer_running) | 1887 | if (substream->timer_running) |
1887 | snd_timer_interrupt(substream->timer, 1); | 1888 | snd_timer_interrupt(substream->timer, 1); |
1889 | #endif | ||
1888 | _end: | 1890 | _end: |
1889 | snd_pcm_stream_unlock_irqrestore(substream, flags); | 1891 | snd_pcm_stream_unlock_irqrestore(substream, flags); |
1890 | if (runtime->transfer_ack_end) | 1892 | if (runtime->transfer_ack_end) |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 139887011ba2..a8b27cdc2844 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -486,6 +486,16 @@ static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state) | |||
486 | snd_pcm_stream_unlock_irq(substream); | 486 | snd_pcm_stream_unlock_irq(substream); |
487 | } | 487 | } |
488 | 488 | ||
489 | static inline void snd_pcm_timer_notify(struct snd_pcm_substream *substream, | ||
490 | int event) | ||
491 | { | ||
492 | #ifdef CONFIG_SND_PCM_TIMER | ||
493 | if (substream->timer) | ||
494 | snd_timer_notify(substream->timer, event, | ||
495 | &substream->runtime->trigger_tstamp); | ||
496 | #endif | ||
497 | } | ||
498 | |||
489 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | 499 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
490 | struct snd_pcm_hw_params *params) | 500 | struct snd_pcm_hw_params *params) |
491 | { | 501 | { |
@@ -1043,9 +1053,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) | |||
1043 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 1053 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
1044 | runtime->silence_size > 0) | 1054 | runtime->silence_size > 0) |
1045 | snd_pcm_playback_silence(substream, ULONG_MAX); | 1055 | snd_pcm_playback_silence(substream, ULONG_MAX); |
1046 | if (substream->timer) | 1056 | snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTART); |
1047 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, | ||
1048 | &runtime->trigger_tstamp); | ||
1049 | } | 1057 | } |
1050 | 1058 | ||
1051 | static struct action_ops snd_pcm_action_start = { | 1059 | static struct action_ops snd_pcm_action_start = { |
@@ -1093,9 +1101,7 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) | |||
1093 | if (runtime->status->state != state) { | 1101 | if (runtime->status->state != state) { |
1094 | snd_pcm_trigger_tstamp(substream); | 1102 | snd_pcm_trigger_tstamp(substream); |
1095 | runtime->status->state = state; | 1103 | runtime->status->state = state; |
1096 | if (substream->timer) | 1104 | snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTOP); |
1097 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, | ||
1098 | &runtime->trigger_tstamp); | ||
1099 | } | 1105 | } |
1100 | wake_up(&runtime->sleep); | 1106 | wake_up(&runtime->sleep); |
1101 | wake_up(&runtime->tsleep); | 1107 | wake_up(&runtime->tsleep); |
@@ -1209,18 +1215,12 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) | |||
1209 | snd_pcm_trigger_tstamp(substream); | 1215 | snd_pcm_trigger_tstamp(substream); |
1210 | if (push) { | 1216 | if (push) { |
1211 | runtime->status->state = SNDRV_PCM_STATE_PAUSED; | 1217 | runtime->status->state = SNDRV_PCM_STATE_PAUSED; |
1212 | if (substream->timer) | 1218 | snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MPAUSE); |
1213 | snd_timer_notify(substream->timer, | ||
1214 | SNDRV_TIMER_EVENT_MPAUSE, | ||
1215 | &runtime->trigger_tstamp); | ||
1216 | wake_up(&runtime->sleep); | 1219 | wake_up(&runtime->sleep); |
1217 | wake_up(&runtime->tsleep); | 1220 | wake_up(&runtime->tsleep); |
1218 | } else { | 1221 | } else { |
1219 | runtime->status->state = SNDRV_PCM_STATE_RUNNING; | 1222 | runtime->status->state = SNDRV_PCM_STATE_RUNNING; |
1220 | if (substream->timer) | 1223 | snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MCONTINUE); |
1221 | snd_timer_notify(substream->timer, | ||
1222 | SNDRV_TIMER_EVENT_MCONTINUE, | ||
1223 | &runtime->trigger_tstamp); | ||
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | 1226 | ||
@@ -1268,9 +1268,7 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) | |||
1268 | snd_pcm_trigger_tstamp(substream); | 1268 | snd_pcm_trigger_tstamp(substream); |
1269 | runtime->status->suspended_state = runtime->status->state; | 1269 | runtime->status->suspended_state = runtime->status->state; |
1270 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1270 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1271 | if (substream->timer) | 1271 | snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSUSPEND); |
1272 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, | ||
1273 | &runtime->trigger_tstamp); | ||
1274 | wake_up(&runtime->sleep); | 1272 | wake_up(&runtime->sleep); |
1275 | wake_up(&runtime->tsleep); | 1273 | wake_up(&runtime->tsleep); |
1276 | } | 1274 | } |
@@ -1374,9 +1372,7 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) | |||
1374 | struct snd_pcm_runtime *runtime = substream->runtime; | 1372 | struct snd_pcm_runtime *runtime = substream->runtime; |
1375 | snd_pcm_trigger_tstamp(substream); | 1373 | snd_pcm_trigger_tstamp(substream); |
1376 | runtime->status->state = runtime->status->suspended_state; | 1374 | runtime->status->state = runtime->status->suspended_state; |
1377 | if (substream->timer) | 1375 | snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MRESUME); |
1378 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, | ||
1379 | &runtime->trigger_tstamp); | ||
1380 | } | 1376 | } |
1381 | 1377 | ||
1382 | static struct action_ops snd_pcm_action_resume = { | 1378 | static struct action_ops snd_pcm_action_resume = { |