diff options
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 279e24f61305..abe1e811e660 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -707,6 +707,23 @@ int snd_pcm_status(struct snd_pcm_substream *substream, | |||
707 | struct snd_pcm_runtime *runtime = substream->runtime; | 707 | struct snd_pcm_runtime *runtime = substream->runtime; |
708 | 708 | ||
709 | snd_pcm_stream_lock_irq(substream); | 709 | snd_pcm_stream_lock_irq(substream); |
710 | |||
711 | snd_pcm_unpack_audio_tstamp_config(status->audio_tstamp_data, | ||
712 | &runtime->audio_tstamp_config); | ||
713 | |||
714 | /* backwards compatible behavior */ | ||
715 | if (runtime->audio_tstamp_config.type_requested == | ||
716 | SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT) { | ||
717 | if (runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) | ||
718 | runtime->audio_tstamp_config.type_requested = | ||
719 | SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK; | ||
720 | else | ||
721 | runtime->audio_tstamp_config.type_requested = | ||
722 | SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT; | ||
723 | runtime->audio_tstamp_report.valid = 0; | ||
724 | } else | ||
725 | runtime->audio_tstamp_report.valid = 1; | ||
726 | |||
710 | status->state = runtime->status->state; | 727 | status->state = runtime->status->state; |
711 | status->suspended_state = runtime->status->suspended_state; | 728 | status->suspended_state = runtime->status->suspended_state; |
712 | if (status->state == SNDRV_PCM_STATE_OPEN) | 729 | if (status->state == SNDRV_PCM_STATE_OPEN) |
@@ -716,8 +733,15 @@ int snd_pcm_status(struct snd_pcm_substream *substream, | |||
716 | snd_pcm_update_hw_ptr(substream); | 733 | snd_pcm_update_hw_ptr(substream); |
717 | if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { | 734 | if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { |
718 | status->tstamp = runtime->status->tstamp; | 735 | status->tstamp = runtime->status->tstamp; |
736 | status->driver_tstamp = runtime->driver_tstamp; | ||
719 | status->audio_tstamp = | 737 | status->audio_tstamp = |
720 | runtime->status->audio_tstamp; | 738 | runtime->status->audio_tstamp; |
739 | if (runtime->audio_tstamp_report.valid == 1) | ||
740 | /* backwards compatibility, no report provided in COMPAT mode */ | ||
741 | snd_pcm_pack_audio_tstamp_report(&status->audio_tstamp_data, | ||
742 | &status->audio_tstamp_accuracy, | ||
743 | &runtime->audio_tstamp_report); | ||
744 | |||
721 | goto _tstamp_end; | 745 | goto _tstamp_end; |
722 | } | 746 | } |
723 | } else { | 747 | } else { |
@@ -753,12 +777,21 @@ int snd_pcm_status(struct snd_pcm_substream *substream, | |||
753 | } | 777 | } |
754 | 778 | ||
755 | static int snd_pcm_status_user(struct snd_pcm_substream *substream, | 779 | static int snd_pcm_status_user(struct snd_pcm_substream *substream, |
756 | struct snd_pcm_status __user * _status) | 780 | struct snd_pcm_status __user * _status, |
781 | bool ext) | ||
757 | { | 782 | { |
758 | struct snd_pcm_status status; | 783 | struct snd_pcm_status status; |
759 | int res; | 784 | int res; |
760 | 785 | ||
761 | memset(&status, 0, sizeof(status)); | 786 | memset(&status, 0, sizeof(status)); |
787 | /* | ||
788 | * with extension, parameters are read/write, | ||
789 | * get audio_tstamp_data from user, | ||
790 | * ignore rest of status structure | ||
791 | */ | ||
792 | if (ext && get_user(status.audio_tstamp_data, | ||
793 | (u32 __user *)(&_status->audio_tstamp_data))) | ||
794 | return -EFAULT; | ||
762 | res = snd_pcm_status(substream, &status); | 795 | res = snd_pcm_status(substream, &status); |
763 | if (res < 0) | 796 | if (res < 0) |
764 | return res; | 797 | return res; |
@@ -2725,7 +2758,9 @@ static int snd_pcm_common_ioctl1(struct file *file, | |||
2725 | case SNDRV_PCM_IOCTL_SW_PARAMS: | 2758 | case SNDRV_PCM_IOCTL_SW_PARAMS: |
2726 | return snd_pcm_sw_params_user(substream, arg); | 2759 | return snd_pcm_sw_params_user(substream, arg); |
2727 | case SNDRV_PCM_IOCTL_STATUS: | 2760 | case SNDRV_PCM_IOCTL_STATUS: |
2728 | return snd_pcm_status_user(substream, arg); | 2761 | return snd_pcm_status_user(substream, arg, false); |
2762 | case SNDRV_PCM_IOCTL_STATUS_EXT: | ||
2763 | return snd_pcm_status_user(substream, arg, true); | ||
2729 | case SNDRV_PCM_IOCTL_CHANNEL_INFO: | 2764 | case SNDRV_PCM_IOCTL_CHANNEL_INFO: |
2730 | return snd_pcm_channel_info_user(substream, arg); | 2765 | return snd_pcm_channel_info_user(substream, arg); |
2731 | case SNDRV_PCM_IOCTL_PREPARE: | 2766 | case SNDRV_PCM_IOCTL_PREPARE: |