Lines Matching refs:substream
64 static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
66 static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
98 void snd_pcm_stream_lock(struct snd_pcm_substream *substream) in snd_pcm_stream_lock() argument
100 if (substream->pcm->nonatomic) { in snd_pcm_stream_lock()
102 mutex_lock(&substream->self_group.mutex); in snd_pcm_stream_lock()
105 spin_lock(&substream->self_group.lock); in snd_pcm_stream_lock()
116 void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) in snd_pcm_stream_unlock() argument
118 if (substream->pcm->nonatomic) { in snd_pcm_stream_unlock()
119 mutex_unlock(&substream->self_group.mutex); in snd_pcm_stream_unlock()
122 spin_unlock(&substream->self_group.lock); in snd_pcm_stream_unlock()
136 void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) in snd_pcm_stream_lock_irq() argument
138 if (!substream->pcm->nonatomic) in snd_pcm_stream_lock_irq()
140 snd_pcm_stream_lock(substream); in snd_pcm_stream_lock_irq()
150 void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) in snd_pcm_stream_unlock_irq() argument
152 snd_pcm_stream_unlock(substream); in snd_pcm_stream_unlock_irq()
153 if (!substream->pcm->nonatomic) in snd_pcm_stream_unlock_irq()
158 unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream) in _snd_pcm_stream_lock_irqsave() argument
161 if (!substream->pcm->nonatomic) in _snd_pcm_stream_lock_irqsave()
163 snd_pcm_stream_lock(substream); in _snd_pcm_stream_lock_irqsave()
175 void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, in snd_pcm_stream_unlock_irqrestore() argument
178 snd_pcm_stream_unlock(substream); in snd_pcm_stream_unlock_irqrestore()
179 if (!substream->pcm->nonatomic) in snd_pcm_stream_unlock_irqrestore()
198 int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info) in snd_pcm_info() argument
201 struct snd_pcm *pcm = substream->pcm; in snd_pcm_info()
202 struct snd_pcm_str *pstr = substream->pstr; in snd_pcm_info()
207 info->stream = substream->stream; in snd_pcm_info()
208 info->subdevice = substream->number; in snd_pcm_info()
215 strlcpy(info->subname, substream->name, sizeof(info->subname)); in snd_pcm_info()
216 runtime = substream->runtime; in snd_pcm_info()
221 int snd_pcm_info_user(struct snd_pcm_substream *substream, in snd_pcm_info_user() argument
230 err = snd_pcm_info(substream, info); in snd_pcm_info_user()
239 static bool hw_support_mmap(struct snd_pcm_substream *substream) in hw_support_mmap() argument
241 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) in hw_support_mmap()
247 if (!substream->ops->mmap && in hw_support_mmap()
248 substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) in hw_support_mmap()
277 int snd_pcm_hw_refine(struct snd_pcm_substream *substream, in snd_pcm_hw_refine() argument
284 struct snd_pcm_hw_constraints *constrs = &substream->runtime->hw_constraints; in snd_pcm_hw_refine()
430 hw = &substream->runtime->hw; in snd_pcm_hw_refine()
434 if (!hw_support_mmap(substream)) in snd_pcm_hw_refine()
443 changed = substream->ops->ioctl(substream, in snd_pcm_hw_refine()
455 static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream, in snd_pcm_hw_refine_user() argument
465 err = snd_pcm_hw_refine(substream, params); in snd_pcm_hw_refine_user()
490 static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state) in snd_pcm_set_state() argument
492 snd_pcm_stream_lock_irq(substream); in snd_pcm_set_state()
493 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) in snd_pcm_set_state()
494 substream->runtime->status->state = state; in snd_pcm_set_state()
495 snd_pcm_stream_unlock_irq(substream); in snd_pcm_set_state()
498 static inline void snd_pcm_timer_notify(struct snd_pcm_substream *substream, in snd_pcm_timer_notify() argument
502 if (substream->timer) in snd_pcm_timer_notify()
503 snd_timer_notify(substream->timer, event, in snd_pcm_timer_notify()
504 &substream->runtime->trigger_tstamp); in snd_pcm_timer_notify()
508 static int snd_pcm_hw_params(struct snd_pcm_substream *substream, in snd_pcm_hw_params() argument
516 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_hw_params()
518 runtime = substream->runtime; in snd_pcm_hw_params()
519 snd_pcm_stream_lock_irq(substream); in snd_pcm_hw_params()
526 snd_pcm_stream_unlock_irq(substream); in snd_pcm_hw_params()
529 snd_pcm_stream_unlock_irq(substream); in snd_pcm_hw_params()
531 if (!substream->oss.oss) in snd_pcm_hw_params()
533 if (atomic_read(&substream->mmap_count)) in snd_pcm_hw_params()
537 err = snd_pcm_hw_refine(substream, params); in snd_pcm_hw_params()
541 err = snd_pcm_hw_params_choose(substream, params); in snd_pcm_hw_params()
545 if (substream->ops->hw_params != NULL) { in snd_pcm_hw_params()
546 err = substream->ops->hw_params(substream, params); in snd_pcm_hw_params()
591 if (runtime->dma_area && !substream->ops->copy) in snd_pcm_hw_params()
594 snd_pcm_timer_resolution_change(substream); in snd_pcm_hw_params()
595 snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP); in snd_pcm_hw_params()
597 if (pm_qos_request_active(&substream->latency_pm_qos_req)) in snd_pcm_hw_params()
598 pm_qos_remove_request(&substream->latency_pm_qos_req); in snd_pcm_hw_params()
600 pm_qos_add_request(&substream->latency_pm_qos_req, in snd_pcm_hw_params()
607 snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); in snd_pcm_hw_params()
608 if (substream->ops->hw_free != NULL) in snd_pcm_hw_params()
609 substream->ops->hw_free(substream); in snd_pcm_hw_params()
613 static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream, in snd_pcm_hw_params_user() argument
623 err = snd_pcm_hw_params(substream, params); in snd_pcm_hw_params_user()
633 static int snd_pcm_hw_free(struct snd_pcm_substream *substream) in snd_pcm_hw_free() argument
638 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_hw_free()
640 runtime = substream->runtime; in snd_pcm_hw_free()
641 snd_pcm_stream_lock_irq(substream); in snd_pcm_hw_free()
647 snd_pcm_stream_unlock_irq(substream); in snd_pcm_hw_free()
650 snd_pcm_stream_unlock_irq(substream); in snd_pcm_hw_free()
651 if (atomic_read(&substream->mmap_count)) in snd_pcm_hw_free()
653 if (substream->ops->hw_free) in snd_pcm_hw_free()
654 result = substream->ops->hw_free(substream); in snd_pcm_hw_free()
655 snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); in snd_pcm_hw_free()
656 pm_qos_remove_request(&substream->latency_pm_qos_req); in snd_pcm_hw_free()
660 static int snd_pcm_sw_params(struct snd_pcm_substream *substream, in snd_pcm_sw_params() argument
666 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_sw_params()
668 runtime = substream->runtime; in snd_pcm_sw_params()
669 snd_pcm_stream_lock_irq(substream); in snd_pcm_sw_params()
671 snd_pcm_stream_unlock_irq(substream); in snd_pcm_sw_params()
674 snd_pcm_stream_unlock_irq(substream); in snd_pcm_sw_params()
694 snd_pcm_stream_lock_irq(substream); in snd_pcm_sw_params()
705 if (snd_pcm_running(substream)) { in snd_pcm_sw_params()
706 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in snd_pcm_sw_params()
708 snd_pcm_playback_silence(substream, ULONG_MAX); in snd_pcm_sw_params()
709 err = snd_pcm_update_state(substream, runtime); in snd_pcm_sw_params()
711 snd_pcm_stream_unlock_irq(substream); in snd_pcm_sw_params()
715 static int snd_pcm_sw_params_user(struct snd_pcm_substream *substream, in snd_pcm_sw_params_user() argument
722 err = snd_pcm_sw_params(substream, ¶ms); in snd_pcm_sw_params_user()
728 int snd_pcm_status(struct snd_pcm_substream *substream, in snd_pcm_status() argument
731 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_status()
733 snd_pcm_stream_lock_irq(substream); in snd_pcm_status()
756 if (snd_pcm_running(substream)) { in snd_pcm_status()
757 snd_pcm_update_hw_ptr(substream); in snd_pcm_status()
779 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_status()
799 snd_pcm_stream_unlock_irq(substream); in snd_pcm_status()
803 static int snd_pcm_status_user(struct snd_pcm_substream *substream, in snd_pcm_status_user() argument
819 res = snd_pcm_status(substream, &status); in snd_pcm_status_user()
827 static int snd_pcm_channel_info(struct snd_pcm_substream *substream, in snd_pcm_channel_info() argument
834 runtime = substream->runtime; in snd_pcm_channel_info()
835 snd_pcm_stream_lock_irq(substream); in snd_pcm_channel_info()
837 snd_pcm_stream_unlock_irq(substream); in snd_pcm_channel_info()
840 snd_pcm_stream_unlock_irq(substream); in snd_pcm_channel_info()
845 return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info); in snd_pcm_channel_info()
848 static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, in snd_pcm_channel_info_user() argument
856 res = snd_pcm_channel_info(substream, &info); in snd_pcm_channel_info_user()
864 static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream) in snd_pcm_trigger_tstamp() argument
866 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_trigger_tstamp()
869 if (runtime->trigger_master == substream) { in snd_pcm_trigger_tstamp()
880 int (*pre_action)(struct snd_pcm_substream *substream, int state);
881 int (*do_action)(struct snd_pcm_substream *substream, int state);
882 void (*undo_action)(struct snd_pcm_substream *substream, int state);
883 void (*post_action)(struct snd_pcm_substream *substream, int state);
892 struct snd_pcm_substream *substream, in snd_pcm_action_group() argument
899 snd_pcm_group_for_each_entry(s, substream) { in snd_pcm_action_group()
900 if (do_lock && s != substream) { in snd_pcm_action_group()
911 snd_pcm_group_for_each_entry(s, substream) { in snd_pcm_action_group()
915 snd_pcm_group_for_each_entry(s1, substream) { in snd_pcm_action_group()
925 snd_pcm_group_for_each_entry(s, substream) { in snd_pcm_action_group()
931 snd_pcm_group_for_each_entry(s1, substream) { in snd_pcm_action_group()
932 if (s1 != substream) { in snd_pcm_action_group()
949 struct snd_pcm_substream *substream, in snd_pcm_action_single() argument
954 res = ops->pre_action(substream, state); in snd_pcm_action_single()
957 res = ops->do_action(substream, state); in snd_pcm_action_single()
959 ops->post_action(substream, state); in snd_pcm_action_single()
961 ops->undo_action(substream, state); in snd_pcm_action_single()
969 struct snd_pcm_substream *substream, in snd_pcm_action() argument
974 if (!snd_pcm_stream_linked(substream)) in snd_pcm_action()
975 return snd_pcm_action_single(ops, substream, state); in snd_pcm_action()
977 if (substream->pcm->nonatomic) { in snd_pcm_action()
978 if (!mutex_trylock(&substream->group->mutex)) { in snd_pcm_action()
979 mutex_unlock(&substream->self_group.mutex); in snd_pcm_action()
980 mutex_lock(&substream->group->mutex); in snd_pcm_action()
981 mutex_lock(&substream->self_group.mutex); in snd_pcm_action()
983 res = snd_pcm_action_group(ops, substream, state, 1); in snd_pcm_action()
984 mutex_unlock(&substream->group->mutex); in snd_pcm_action()
986 if (!spin_trylock(&substream->group->lock)) { in snd_pcm_action()
987 spin_unlock(&substream->self_group.lock); in snd_pcm_action()
988 spin_lock(&substream->group->lock); in snd_pcm_action()
989 spin_lock(&substream->self_group.lock); in snd_pcm_action()
991 res = snd_pcm_action_group(ops, substream, state, 1); in snd_pcm_action()
992 spin_unlock(&substream->group->lock); in snd_pcm_action()
1001 struct snd_pcm_substream *substream, in snd_pcm_action_lock_irq() argument
1006 snd_pcm_stream_lock_irq(substream); in snd_pcm_action_lock_irq()
1007 res = snd_pcm_action(ops, substream, state); in snd_pcm_action_lock_irq()
1008 snd_pcm_stream_unlock_irq(substream); in snd_pcm_action_lock_irq()
1015 struct snd_pcm_substream *substream, in snd_pcm_action_nonatomic() argument
1021 if (snd_pcm_stream_linked(substream)) in snd_pcm_action_nonatomic()
1022 res = snd_pcm_action_group(ops, substream, state, 0); in snd_pcm_action_nonatomic()
1024 res = snd_pcm_action_single(ops, substream, state); in snd_pcm_action_nonatomic()
1032 static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state) in snd_pcm_pre_start() argument
1034 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_start()
1037 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in snd_pcm_pre_start()
1038 !snd_pcm_playback_data(substream)) in snd_pcm_pre_start()
1041 runtime->trigger_master = substream; in snd_pcm_pre_start()
1045 static int snd_pcm_do_start(struct snd_pcm_substream *substream, int state) in snd_pcm_do_start() argument
1047 if (substream->runtime->trigger_master != substream) in snd_pcm_do_start()
1049 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START); in snd_pcm_do_start()
1052 static void snd_pcm_undo_start(struct snd_pcm_substream *substream, int state) in snd_pcm_undo_start() argument
1054 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_start()
1055 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); in snd_pcm_undo_start()
1058 static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) in snd_pcm_post_start() argument
1060 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_start()
1061 snd_pcm_trigger_tstamp(substream); in snd_pcm_post_start()
1066 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in snd_pcm_post_start()
1068 snd_pcm_playback_silence(substream, ULONG_MAX); in snd_pcm_post_start()
1069 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTART); in snd_pcm_post_start()
1085 int snd_pcm_start(struct snd_pcm_substream *substream) in snd_pcm_start() argument
1087 return snd_pcm_action(&snd_pcm_action_start, substream, in snd_pcm_start()
1094 static int snd_pcm_pre_stop(struct snd_pcm_substream *substream, int state) in snd_pcm_pre_stop() argument
1096 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_stop()
1099 runtime->trigger_master = substream; in snd_pcm_pre_stop()
1103 static int snd_pcm_do_stop(struct snd_pcm_substream *substream, int state) in snd_pcm_do_stop() argument
1105 if (substream->runtime->trigger_master == substream && in snd_pcm_do_stop()
1106 snd_pcm_running(substream)) in snd_pcm_do_stop()
1107 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); in snd_pcm_do_stop()
1111 static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) in snd_pcm_post_stop() argument
1113 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_stop()
1115 snd_pcm_trigger_tstamp(substream); in snd_pcm_post_stop()
1117 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTOP); in snd_pcm_post_stop()
1138 int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t state) in snd_pcm_stop() argument
1140 return snd_pcm_action(&snd_pcm_action_stop, substream, state); in snd_pcm_stop()
1154 int snd_pcm_drain_done(struct snd_pcm_substream *substream) in snd_pcm_drain_done() argument
1156 return snd_pcm_action_single(&snd_pcm_action_stop, substream, in snd_pcm_drain_done()
1169 int snd_pcm_stop_xrun(struct snd_pcm_substream *substream) in snd_pcm_stop_xrun() argument
1174 snd_pcm_stream_lock_irqsave(substream, flags); in snd_pcm_stop_xrun()
1175 if (snd_pcm_running(substream)) in snd_pcm_stop_xrun()
1176 ret = snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); in snd_pcm_stop_xrun()
1177 snd_pcm_stream_unlock_irqrestore(substream, flags); in snd_pcm_stop_xrun()
1185 static int snd_pcm_pre_pause(struct snd_pcm_substream *substream, int push) in snd_pcm_pre_pause() argument
1187 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_pause()
1195 runtime->trigger_master = substream; in snd_pcm_pre_pause()
1199 static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push) in snd_pcm_do_pause() argument
1201 if (substream->runtime->trigger_master != substream) in snd_pcm_do_pause()
1206 snd_pcm_update_hw_ptr(substream); in snd_pcm_do_pause()
1211 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; in snd_pcm_do_pause()
1212 return substream->ops->trigger(substream, in snd_pcm_do_pause()
1217 static void snd_pcm_undo_pause(struct snd_pcm_substream *substream, int push) in snd_pcm_undo_pause() argument
1219 if (substream->runtime->trigger_master == substream) in snd_pcm_undo_pause()
1220 substream->ops->trigger(substream, in snd_pcm_undo_pause()
1225 static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) in snd_pcm_post_pause() argument
1227 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_pause()
1228 snd_pcm_trigger_tstamp(substream); in snd_pcm_post_pause()
1231 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MPAUSE); in snd_pcm_post_pause()
1236 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MCONTINUE); in snd_pcm_post_pause()
1250 static int snd_pcm_pause(struct snd_pcm_substream *substream, int push) in snd_pcm_pause() argument
1252 return snd_pcm_action(&snd_pcm_action_pause, substream, push); in snd_pcm_pause()
1258 static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state) in snd_pcm_pre_suspend() argument
1260 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_suspend()
1270 runtime->trigger_master = substream; in snd_pcm_pre_suspend()
1274 static int snd_pcm_do_suspend(struct snd_pcm_substream *substream, int state) in snd_pcm_do_suspend() argument
1276 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_suspend()
1277 if (runtime->trigger_master != substream) in snd_pcm_do_suspend()
1279 if (! snd_pcm_running(substream)) in snd_pcm_do_suspend()
1281 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); in snd_pcm_do_suspend()
1285 static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) in snd_pcm_post_suspend() argument
1287 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_suspend()
1288 snd_pcm_trigger_tstamp(substream); in snd_pcm_post_suspend()
1291 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSUSPEND); in snd_pcm_post_suspend()
1311 int snd_pcm_suspend(struct snd_pcm_substream *substream) in snd_pcm_suspend() argument
1316 if (! substream) in snd_pcm_suspend()
1319 snd_pcm_stream_lock_irqsave(substream, flags); in snd_pcm_suspend()
1320 err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0); in snd_pcm_suspend()
1321 snd_pcm_stream_unlock_irqrestore(substream, flags); in snd_pcm_suspend()
1337 struct snd_pcm_substream *substream; in snd_pcm_suspend_all() local
1344 for (substream = pcm->streams[stream].substream; in snd_pcm_suspend_all()
1345 substream; substream = substream->next) { in snd_pcm_suspend_all()
1347 if (substream->runtime == NULL) in snd_pcm_suspend_all()
1354 if (!substream->ops) in snd_pcm_suspend_all()
1357 err = snd_pcm_suspend(substream); in snd_pcm_suspend_all()
1369 static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, int state) in snd_pcm_pre_resume() argument
1371 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_resume()
1374 runtime->trigger_master = substream; in snd_pcm_pre_resume()
1378 static int snd_pcm_do_resume(struct snd_pcm_substream *substream, int state) in snd_pcm_do_resume() argument
1380 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_resume()
1381 if (runtime->trigger_master != substream) in snd_pcm_do_resume()
1386 substream->stream != SNDRV_PCM_STREAM_PLAYBACK)) in snd_pcm_do_resume()
1388 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME); in snd_pcm_do_resume()
1391 static void snd_pcm_undo_resume(struct snd_pcm_substream *substream, int state) in snd_pcm_undo_resume() argument
1393 if (substream->runtime->trigger_master == substream && in snd_pcm_undo_resume()
1394 snd_pcm_running(substream)) in snd_pcm_undo_resume()
1395 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); in snd_pcm_undo_resume()
1398 static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) in snd_pcm_post_resume() argument
1400 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_resume()
1401 snd_pcm_trigger_tstamp(substream); in snd_pcm_post_resume()
1403 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MRESUME); in snd_pcm_post_resume()
1413 static int snd_pcm_resume(struct snd_pcm_substream *substream) in snd_pcm_resume() argument
1415 struct snd_card *card = substream->pcm->card; in snd_pcm_resume()
1420 res = snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0); in snd_pcm_resume()
1427 static int snd_pcm_resume(struct snd_pcm_substream *substream) in snd_pcm_resume() argument
1439 static int snd_pcm_xrun(struct snd_pcm_substream *substream) in snd_pcm_xrun() argument
1441 struct snd_card *card = substream->pcm->card; in snd_pcm_xrun()
1442 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_xrun()
1452 snd_pcm_stream_lock_irq(substream); in snd_pcm_xrun()
1458 result = snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); in snd_pcm_xrun()
1463 snd_pcm_stream_unlock_irq(substream); in snd_pcm_xrun()
1472 static int snd_pcm_pre_reset(struct snd_pcm_substream *substream, int state) in snd_pcm_pre_reset() argument
1474 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_reset()
1486 static int snd_pcm_do_reset(struct snd_pcm_substream *substream, int state) in snd_pcm_do_reset() argument
1488 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_reset()
1489 int err = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL); in snd_pcm_do_reset()
1500 static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state) in snd_pcm_post_reset() argument
1502 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_reset()
1504 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in snd_pcm_post_reset()
1506 snd_pcm_playback_silence(substream, ULONG_MAX); in snd_pcm_post_reset()
1515 static int snd_pcm_reset(struct snd_pcm_substream *substream) in snd_pcm_reset() argument
1517 return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0); in snd_pcm_reset()
1524 static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, in snd_pcm_pre_prepare() argument
1527 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_prepare()
1531 if (snd_pcm_running(substream)) in snd_pcm_pre_prepare()
1533 substream->f_flags = f_flags; in snd_pcm_pre_prepare()
1537 static int snd_pcm_do_prepare(struct snd_pcm_substream *substream, int state) in snd_pcm_do_prepare() argument
1540 err = substream->ops->prepare(substream); in snd_pcm_do_prepare()
1543 return snd_pcm_do_reset(substream, 0); in snd_pcm_do_prepare()
1546 static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) in snd_pcm_post_prepare() argument
1548 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_post_prepare()
1550 snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED); in snd_pcm_post_prepare()
1566 static int snd_pcm_prepare(struct snd_pcm_substream *substream, in snd_pcm_prepare() argument
1570 struct snd_card *card = substream->pcm->card; in snd_pcm_prepare()
1576 f_flags = substream->f_flags; in snd_pcm_prepare()
1581 substream, f_flags); in snd_pcm_prepare()
1590 static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, int state) in snd_pcm_pre_drain_init() argument
1592 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_pre_drain_init()
1599 runtime->trigger_master = substream; in snd_pcm_pre_drain_init()
1603 static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) in snd_pcm_do_drain_init() argument
1605 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_do_drain_init()
1606 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_do_drain_init()
1610 if (! snd_pcm_playback_empty(substream)) { in snd_pcm_do_drain_init()
1611 snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); in snd_pcm_do_drain_init()
1612 snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); in snd_pcm_do_drain_init()
1631 snd_pcm_do_stop(substream, new_state); in snd_pcm_do_drain_init()
1632 snd_pcm_post_stop(substream, new_state); in snd_pcm_do_drain_init()
1637 runtime->trigger_master == substream && in snd_pcm_do_drain_init()
1639 return substream->ops->trigger(substream, in snd_pcm_do_drain_init()
1645 static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int state) in snd_pcm_post_drain_init() argument
1655 static int snd_pcm_drop(struct snd_pcm_substream *substream);
1664 static int snd_pcm_drain(struct snd_pcm_substream *substream, in snd_pcm_drain() argument
1674 card = substream->pcm->card; in snd_pcm_drain()
1675 runtime = substream->runtime; in snd_pcm_drain()
1692 } else if (substream->f_flags & O_NONBLOCK) in snd_pcm_drain()
1696 snd_pcm_stream_lock_irq(substream); in snd_pcm_drain()
1699 snd_pcm_pause(substream, 0); in snd_pcm_drain()
1702 result = snd_pcm_action(&snd_pcm_action_drain_init, substream, 0); in snd_pcm_drain()
1720 snd_pcm_group_for_each_entry(s, substream) { in snd_pcm_drain()
1733 snd_pcm_stream_unlock_irq(substream); in snd_pcm_drain()
1749 snd_pcm_stream_lock_irq(substream); in snd_pcm_drain()
1756 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) in snd_pcm_drain()
1759 dev_dbg(substream->pcm->card->dev, in snd_pcm_drain()
1761 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); in snd_pcm_drain()
1769 snd_pcm_stream_unlock_irq(substream); in snd_pcm_drain()
1781 static int snd_pcm_drop(struct snd_pcm_substream *substream) in snd_pcm_drop() argument
1786 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_drop()
1788 runtime = substream->runtime; in snd_pcm_drop()
1795 snd_pcm_stream_lock_irq(substream); in snd_pcm_drop()
1798 snd_pcm_pause(substream, 0); in snd_pcm_drop()
1800 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); in snd_pcm_drop()
1802 snd_pcm_stream_unlock_irq(substream); in snd_pcm_drop()
1823 static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) in snd_pcm_link() argument
1838 substream1 = pcm_file->substream; in snd_pcm_link()
1839 if (substream == substream1) { in snd_pcm_link()
1851 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || in snd_pcm_link()
1852 substream->runtime->status->state != substream1->runtime->status->state || in snd_pcm_link()
1853 substream->pcm->nonatomic != substream1->pcm->nonatomic) { in snd_pcm_link()
1861 if (!snd_pcm_stream_linked(substream)) { in snd_pcm_link()
1862 substream->group = group; in snd_pcm_link()
1864 spin_lock_init(&substream->group->lock); in snd_pcm_link()
1865 mutex_init(&substream->group->mutex); in snd_pcm_link()
1866 INIT_LIST_HEAD(&substream->group->substreams); in snd_pcm_link()
1867 list_add_tail(&substream->link_list, &substream->group->substreams); in snd_pcm_link()
1868 substream->group->count = 1; in snd_pcm_link()
1870 list_add_tail(&substream1->link_list, &substream->group->substreams); in snd_pcm_link()
1871 substream->group->count++; in snd_pcm_link()
1872 substream1->group = substream->group; in snd_pcm_link()
1884 static void relink_to_local(struct snd_pcm_substream *substream) in relink_to_local() argument
1886 substream->group = &substream->self_group; in relink_to_local()
1887 INIT_LIST_HEAD(&substream->self_group.substreams); in relink_to_local()
1888 list_add_tail(&substream->link_list, &substream->self_group.substreams); in relink_to_local()
1891 static int snd_pcm_unlink(struct snd_pcm_substream *substream) in snd_pcm_unlink() argument
1898 if (!snd_pcm_stream_linked(substream)) { in snd_pcm_unlink()
1902 list_del(&substream->link_list); in snd_pcm_unlink()
1903 substream->group->count--; in snd_pcm_unlink()
1904 if (substream->group->count == 1) { /* detach the last stream, too */ in snd_pcm_unlink()
1905 snd_pcm_group_for_each_entry(s, substream) { in snd_pcm_unlink()
1909 kfree(substream->group); in snd_pcm_unlink()
1911 relink_to_local(substream); in snd_pcm_unlink()
2030 struct snd_pcm_substream *substream = rule->private; in snd_pcm_hw_rule_buffer_bytes_max() local
2032 t.max = substream->buffer_bytes_max; in snd_pcm_hw_rule_buffer_bytes_max()
2039 int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) in snd_pcm_hw_constraints_init() argument
2041 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_init()
2163 int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) in snd_pcm_hw_constraints_complete() argument
2165 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hw_constraints_complete()
2174 if (hw_support_mmap(substream)) { in snd_pcm_hw_constraints_complete()
2220 snd_pcm_hw_rule_buffer_bytes_max, substream, in snd_pcm_hw_constraints_complete()
2246 static void pcm_release_private(struct snd_pcm_substream *substream) in pcm_release_private() argument
2248 if (snd_pcm_stream_linked(substream)) in pcm_release_private()
2249 snd_pcm_unlink(substream); in pcm_release_private()
2252 void snd_pcm_release_substream(struct snd_pcm_substream *substream) in snd_pcm_release_substream() argument
2254 substream->ref_count--; in snd_pcm_release_substream()
2255 if (substream->ref_count > 0) in snd_pcm_release_substream()
2258 snd_pcm_drop(substream); in snd_pcm_release_substream()
2259 if (substream->hw_opened) { in snd_pcm_release_substream()
2260 if (substream->ops->hw_free && in snd_pcm_release_substream()
2261 substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) in snd_pcm_release_substream()
2262 substream->ops->hw_free(substream); in snd_pcm_release_substream()
2263 substream->ops->close(substream); in snd_pcm_release_substream()
2264 substream->hw_opened = 0; in snd_pcm_release_substream()
2266 if (pm_qos_request_active(&substream->latency_pm_qos_req)) in snd_pcm_release_substream()
2267 pm_qos_remove_request(&substream->latency_pm_qos_req); in snd_pcm_release_substream()
2268 if (substream->pcm_release) { in snd_pcm_release_substream()
2269 substream->pcm_release(substream); in snd_pcm_release_substream()
2270 substream->pcm_release = NULL; in snd_pcm_release_substream()
2272 snd_pcm_detach_substream(substream); in snd_pcm_release_substream()
2281 struct snd_pcm_substream *substream; in snd_pcm_open_substream() local
2284 err = snd_pcm_attach_substream(pcm, stream, file, &substream); in snd_pcm_open_substream()
2287 if (substream->ref_count > 1) { in snd_pcm_open_substream()
2288 *rsubstream = substream; in snd_pcm_open_substream()
2292 err = snd_pcm_hw_constraints_init(substream); in snd_pcm_open_substream()
2298 if ((err = substream->ops->open(substream)) < 0) in snd_pcm_open_substream()
2301 substream->hw_opened = 1; in snd_pcm_open_substream()
2303 err = snd_pcm_hw_constraints_complete(substream); in snd_pcm_open_substream()
2309 *rsubstream = substream; in snd_pcm_open_substream()
2313 snd_pcm_release_substream(substream); in snd_pcm_open_substream()
2324 struct snd_pcm_substream *substream; in snd_pcm_open_file() local
2327 err = snd_pcm_open_substream(pcm, stream, file, &substream); in snd_pcm_open_file()
2333 snd_pcm_release_substream(substream); in snd_pcm_open_file()
2336 pcm_file->substream = substream; in snd_pcm_open_file()
2337 if (substream->ref_count == 1) { in snd_pcm_open_file()
2338 substream->file = pcm_file; in snd_pcm_open_file()
2339 substream->pcm_release = pcm_release_private; in snd_pcm_open_file()
2434 struct snd_pcm_substream *substream; in snd_pcm_release() local
2438 substream = pcm_file->substream; in snd_pcm_release()
2439 if (snd_BUG_ON(!substream)) in snd_pcm_release()
2441 pcm = substream->pcm; in snd_pcm_release()
2443 snd_pcm_release_substream(substream); in snd_pcm_release()
2452 static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *substream, in snd_pcm_playback_rewind() argument
2455 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_rewind()
2463 snd_pcm_stream_lock_irq(substream); in snd_pcm_playback_rewind()
2469 if (snd_pcm_update_hw_ptr(substream) >= 0) in snd_pcm_playback_rewind()
2496 snd_pcm_stream_unlock_irq(substream); in snd_pcm_playback_rewind()
2500 static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substream, in snd_pcm_capture_rewind() argument
2503 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_rewind()
2511 snd_pcm_stream_lock_irq(substream); in snd_pcm_capture_rewind()
2517 if (snd_pcm_update_hw_ptr(substream) >= 0) in snd_pcm_capture_rewind()
2544 snd_pcm_stream_unlock_irq(substream); in snd_pcm_capture_rewind()
2548 static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *substream, in snd_pcm_playback_forward() argument
2551 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_forward()
2559 snd_pcm_stream_lock_irq(substream); in snd_pcm_playback_forward()
2566 if (snd_pcm_update_hw_ptr(substream) >= 0) in snd_pcm_playback_forward()
2593 snd_pcm_stream_unlock_irq(substream); in snd_pcm_playback_forward()
2597 static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *substream, in snd_pcm_capture_forward() argument
2600 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_forward()
2608 snd_pcm_stream_lock_irq(substream); in snd_pcm_capture_forward()
2615 if (snd_pcm_update_hw_ptr(substream) >= 0) in snd_pcm_capture_forward()
2642 snd_pcm_stream_unlock_irq(substream); in snd_pcm_capture_forward()
2646 static int snd_pcm_hwsync(struct snd_pcm_substream *substream) in snd_pcm_hwsync() argument
2648 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_hwsync()
2651 snd_pcm_stream_lock_irq(substream); in snd_pcm_hwsync()
2654 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_hwsync()
2658 if ((err = snd_pcm_update_hw_ptr(substream)) < 0) in snd_pcm_hwsync()
2673 snd_pcm_stream_unlock_irq(substream); in snd_pcm_hwsync()
2677 static int snd_pcm_delay(struct snd_pcm_substream *substream, in snd_pcm_delay() argument
2680 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_delay()
2684 snd_pcm_stream_lock_irq(substream); in snd_pcm_delay()
2687 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in snd_pcm_delay()
2691 if ((err = snd_pcm_update_hw_ptr(substream)) < 0) in snd_pcm_delay()
2697 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_delay()
2711 snd_pcm_stream_unlock_irq(substream); in snd_pcm_delay()
2718 static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, in snd_pcm_sync_ptr() argument
2721 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_sync_ptr()
2735 err = snd_pcm_hwsync(substream); in snd_pcm_sync_ptr()
2739 snd_pcm_stream_lock_irq(substream); in snd_pcm_sync_ptr()
2753 snd_pcm_stream_unlock_irq(substream); in snd_pcm_sync_ptr()
2759 static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) in snd_pcm_tstamp() argument
2761 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_tstamp()
2773 struct snd_pcm_substream *substream, in snd_pcm_common_ioctl1() argument
2780 return snd_pcm_info_user(substream, arg); in snd_pcm_common_ioctl1()
2784 return snd_pcm_tstamp(substream, arg); in snd_pcm_common_ioctl1()
2786 return snd_pcm_hw_refine_user(substream, arg); in snd_pcm_common_ioctl1()
2788 return snd_pcm_hw_params_user(substream, arg); in snd_pcm_common_ioctl1()
2790 return snd_pcm_hw_free(substream); in snd_pcm_common_ioctl1()
2792 return snd_pcm_sw_params_user(substream, arg); in snd_pcm_common_ioctl1()
2794 return snd_pcm_status_user(substream, arg, false); in snd_pcm_common_ioctl1()
2796 return snd_pcm_status_user(substream, arg, true); in snd_pcm_common_ioctl1()
2798 return snd_pcm_channel_info_user(substream, arg); in snd_pcm_common_ioctl1()
2800 return snd_pcm_prepare(substream, file); in snd_pcm_common_ioctl1()
2802 return snd_pcm_reset(substream); in snd_pcm_common_ioctl1()
2804 return snd_pcm_action_lock_irq(&snd_pcm_action_start, substream, SNDRV_PCM_STATE_RUNNING); in snd_pcm_common_ioctl1()
2806 return snd_pcm_link(substream, (int)(unsigned long) arg); in snd_pcm_common_ioctl1()
2808 return snd_pcm_unlink(substream); in snd_pcm_common_ioctl1()
2810 return snd_pcm_resume(substream); in snd_pcm_common_ioctl1()
2812 return snd_pcm_xrun(substream); in snd_pcm_common_ioctl1()
2814 return snd_pcm_hwsync(substream); in snd_pcm_common_ioctl1()
2816 return snd_pcm_delay(substream, arg); in snd_pcm_common_ioctl1()
2818 return snd_pcm_sync_ptr(substream, arg); in snd_pcm_common_ioctl1()
2821 return snd_pcm_hw_refine_old_user(substream, arg); in snd_pcm_common_ioctl1()
2823 return snd_pcm_hw_params_old_user(substream, arg); in snd_pcm_common_ioctl1()
2826 return snd_pcm_drain(substream, file); in snd_pcm_common_ioctl1()
2828 return snd_pcm_drop(substream); in snd_pcm_common_ioctl1()
2832 snd_pcm_stream_lock_irq(substream); in snd_pcm_common_ioctl1()
2833 res = snd_pcm_pause(substream, (int)(unsigned long)arg); in snd_pcm_common_ioctl1()
2834 snd_pcm_stream_unlock_irq(substream); in snd_pcm_common_ioctl1()
2838 pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd); in snd_pcm_common_ioctl1()
2843 struct snd_pcm_substream *substream, in snd_pcm_playback_ioctl1() argument
2846 if (snd_BUG_ON(!substream)) in snd_pcm_playback_ioctl1()
2848 if (snd_BUG_ON(substream->stream != SNDRV_PCM_STREAM_PLAYBACK)) in snd_pcm_playback_ioctl1()
2855 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_ioctl1()
2863 result = snd_pcm_lib_write(substream, xferi.buf, xferi.frames); in snd_pcm_playback_ioctl1()
2871 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_playback_ioctl1()
2887 result = snd_pcm_lib_writev(substream, bufs, xfern.frames); in snd_pcm_playback_ioctl1()
2901 result = snd_pcm_playback_rewind(substream, frames); in snd_pcm_playback_ioctl1()
2914 result = snd_pcm_playback_forward(substream, frames); in snd_pcm_playback_ioctl1()
2919 return snd_pcm_common_ioctl1(file, substream, cmd, arg); in snd_pcm_playback_ioctl1()
2923 struct snd_pcm_substream *substream, in snd_pcm_capture_ioctl1() argument
2926 if (snd_BUG_ON(!substream)) in snd_pcm_capture_ioctl1()
2928 if (snd_BUG_ON(substream->stream != SNDRV_PCM_STREAM_CAPTURE)) in snd_pcm_capture_ioctl1()
2935 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_ioctl1()
2943 result = snd_pcm_lib_read(substream, xferi.buf, xferi.frames); in snd_pcm_capture_ioctl1()
2951 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_capture_ioctl1()
2967 result = snd_pcm_lib_readv(substream, bufs, xfern.frames); in snd_pcm_capture_ioctl1()
2981 result = snd_pcm_capture_rewind(substream, frames); in snd_pcm_capture_ioctl1()
2994 result = snd_pcm_capture_forward(substream, frames); in snd_pcm_capture_ioctl1()
2999 return snd_pcm_common_ioctl1(file, substream, cmd, arg); in snd_pcm_capture_ioctl1()
3012 return snd_pcm_playback_ioctl1(file, pcm_file->substream, cmd, in snd_pcm_playback_ioctl()
3026 return snd_pcm_capture_ioctl1(file, pcm_file->substream, cmd, in snd_pcm_capture_ioctl()
3030 int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, in snd_pcm_kernel_ioctl() argument
3037 switch (substream->stream) { in snd_pcm_kernel_ioctl()
3039 result = snd_pcm_playback_ioctl1(NULL, substream, cmd, in snd_pcm_kernel_ioctl()
3043 result = snd_pcm_capture_ioctl1(NULL, substream, cmd, in snd_pcm_kernel_ioctl()
3060 struct snd_pcm_substream *substream; in snd_pcm_read() local
3065 substream = pcm_file->substream; in snd_pcm_read()
3066 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_read()
3068 runtime = substream->runtime; in snd_pcm_read()
3074 result = snd_pcm_lib_read(substream, buf, count); in snd_pcm_read()
3084 struct snd_pcm_substream *substream; in snd_pcm_write() local
3089 substream = pcm_file->substream; in snd_pcm_write()
3090 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_write()
3092 runtime = substream->runtime; in snd_pcm_write()
3098 result = snd_pcm_lib_write(substream, buf, count); in snd_pcm_write()
3107 struct snd_pcm_substream *substream; in snd_pcm_readv() local
3115 substream = pcm_file->substream; in snd_pcm_readv()
3116 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_readv()
3118 runtime = substream->runtime; in snd_pcm_readv()
3133 result = snd_pcm_lib_readv(substream, bufs, frames); in snd_pcm_readv()
3143 struct snd_pcm_substream *substream; in snd_pcm_writev() local
3151 substream = pcm_file->substream; in snd_pcm_writev()
3152 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_writev()
3154 runtime = substream->runtime; in snd_pcm_writev()
3168 result = snd_pcm_lib_writev(substream, bufs, frames); in snd_pcm_writev()
3178 struct snd_pcm_substream *substream; in snd_pcm_playback_poll() local
3185 substream = pcm_file->substream; in snd_pcm_playback_poll()
3186 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_playback_poll()
3188 runtime = substream->runtime; in snd_pcm_playback_poll()
3192 snd_pcm_stream_lock_irq(substream); in snd_pcm_playback_poll()
3210 snd_pcm_stream_unlock_irq(substream); in snd_pcm_playback_poll()
3217 struct snd_pcm_substream *substream; in snd_pcm_capture_poll() local
3224 substream = pcm_file->substream; in snd_pcm_capture_poll()
3225 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_capture_poll()
3227 runtime = substream->runtime; in snd_pcm_capture_poll()
3231 snd_pcm_stream_lock_irq(substream); in snd_pcm_capture_poll()
3253 snd_pcm_stream_unlock_irq(substream); in snd_pcm_capture_poll()
3272 struct snd_pcm_substream *substream = area->vm_private_data; in snd_pcm_mmap_status_fault() local
3275 if (substream == NULL) in snd_pcm_mmap_status_fault()
3277 runtime = substream->runtime; in snd_pcm_mmap_status_fault()
3288 static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file, in snd_pcm_mmap_status() argument
3298 area->vm_private_data = substream; in snd_pcm_mmap_status()
3309 struct snd_pcm_substream *substream = area->vm_private_data; in snd_pcm_mmap_control_fault() local
3312 if (substream == NULL) in snd_pcm_mmap_control_fault()
3314 runtime = substream->runtime; in snd_pcm_mmap_control_fault()
3325 static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file, in snd_pcm_mmap_control() argument
3335 area->vm_private_data = substream; in snd_pcm_mmap_control()
3343 static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file, in snd_pcm_mmap_status() argument
3348 static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file, in snd_pcm_mmap_control() argument
3356 snd_pcm_default_page_ops(struct snd_pcm_substream *substream, unsigned long ofs) in snd_pcm_default_page_ops() argument
3358 void *vaddr = substream->runtime->dma_area + ofs; in snd_pcm_default_page_ops()
3368 struct snd_pcm_substream *substream = area->vm_private_data; in snd_pcm_mmap_data_fault() local
3374 if (substream == NULL) in snd_pcm_mmap_data_fault()
3376 runtime = substream->runtime; in snd_pcm_mmap_data_fault()
3381 if (substream->ops->page) in snd_pcm_mmap_data_fault()
3382 page = substream->ops->page(substream, offset); in snd_pcm_mmap_data_fault()
3384 page = snd_pcm_default_page_ops(substream, offset); in snd_pcm_mmap_data_fault()
3415 int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, in snd_pcm_lib_default_mmap() argument
3420 if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV_IRAM) { in snd_pcm_lib_default_mmap()
3423 substream->dma_buffer.addr >> PAGE_SHIFT, in snd_pcm_lib_default_mmap()
3428 if (!substream->ops->page && in snd_pcm_lib_default_mmap()
3429 substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) in snd_pcm_lib_default_mmap()
3430 return dma_mmap_coherent(substream->dma_buffer.dev.dev, in snd_pcm_lib_default_mmap()
3432 substream->runtime->dma_area, in snd_pcm_lib_default_mmap()
3433 substream->runtime->dma_addr, in snd_pcm_lib_default_mmap()
3434 substream->runtime->dma_bytes); in snd_pcm_lib_default_mmap()
3455 int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, in snd_pcm_lib_mmap_iomem() argument
3458 struct snd_pcm_runtime *runtime = substream->runtime;; in snd_pcm_lib_mmap_iomem()
3470 int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, in snd_pcm_mmap_data() argument
3479 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_mmap_data()
3486 runtime = substream->runtime; in snd_pcm_mmap_data()
3503 area->vm_private_data = substream; in snd_pcm_mmap_data()
3504 if (substream->ops->mmap) in snd_pcm_mmap_data()
3505 err = substream->ops->mmap(substream, area); in snd_pcm_mmap_data()
3507 err = snd_pcm_lib_default_mmap(substream, area); in snd_pcm_mmap_data()
3509 atomic_inc(&substream->mmap_count); in snd_pcm_mmap_data()
3518 struct snd_pcm_substream *substream; in snd_pcm_mmap() local
3522 substream = pcm_file->substream; in snd_pcm_mmap()
3523 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_mmap()
3531 return snd_pcm_mmap_status(substream, file, area); in snd_pcm_mmap()
3535 return snd_pcm_mmap_control(substream, file, area); in snd_pcm_mmap()
3537 return snd_pcm_mmap_data(substream, file, area); in snd_pcm_mmap()
3545 struct snd_pcm_substream *substream; in snd_pcm_fasync() local
3549 substream = pcm_file->substream; in snd_pcm_fasync()
3550 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_fasync()
3552 runtime = substream->runtime; in snd_pcm_fasync()
3611 static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, in snd_pcm_hw_refine_old_user() argument
3628 err = snd_pcm_hw_refine(substream, params); in snd_pcm_hw_refine_old_user()
3641 static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, in snd_pcm_hw_params_old_user() argument
3658 err = snd_pcm_hw_params(substream, params); in snd_pcm_hw_params_old_user()
3680 struct snd_pcm_substream *substream = pcm_file->substream; in snd_pcm_get_unmapped_area() local
3681 struct snd_pcm_runtime *runtime = substream->runtime; in snd_pcm_get_unmapped_area()