alsa/0028-pcm-add-helper-functions-to-query-timestamping-capab.patch
OBS User mrdocs 37a7c30e09 Accepting request 320429 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes: surround41/50 chmap fix, UCM documents,
  config string fix, PCM timestamp query API, replacement of list.h
  with LGPL:
  0023-surround41-50.conf-Use-chmap-syntax-for-better-flexi.patch
  0024-ucm-docs-fix-doxygen-exclude-patch-for-UCM-local-hea.patch
  0025-ucm-docs-Fix-doxygen-formatting-for-UCM-main-page.patch
  0026-docs-Add-UCM-link-to-main-doxygen-page.patch
  0027-Replace-unsafe-characters-with-_-in-card-name.patch
  0028-pcm-add-helper-functions-to-query-timestamping-capab.patch
  0029-pcm-add-support-for-get-set_audio_htstamp_config.patch
  0030-pcm-add-support-for-new-STATUS_EXT-ioctl.patch
  0031-test-fix-audio_time-with-new-get-set-audio_tstamp_co.patch
  0032-test-audio_time-show-report-validity-and-accuracy.patch
  0033-pcm-restore-hw-params-on-set-latency-failed.patch
  0034-Replace-list.h-with-its-own-version.patch
- Backport topology API addition patches:
  0035-topology-uapi-Add-UAPI-headers-for-topology-ABI.patch
  0036-topology-Add-topology-core-parser.patch
  0037-topology-Add-text-section-parser.patch
  0038-topology-Add-PCM-parser.patch
  0039-topology-Add-operations-parser.patch
  0040-topology-Add-private-data-parser.patch
  0041-topology-Add-DAPM-object-parser.patch
  0042-topology-Add-CTL-parser.patch
  0043-topology-Add-Channel-map-parser.patch
  0044-topology-Add-binary-file-builder.patch
  0045-topology-autotools-Add-build-support-for-topology-co.patch
  0046-topology-doxygen-Add-doxygen-support-for-topology-co.patch
  0047-conf-topology-Add-topology-file-for-broadwell-audio-.patch
  0048-topology-Fix-missing-inclusion-of-ctype.h.patch

OBS-URL: https://build.opensuse.org/request/show/320429
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=186
2015-08-05 05:28:10 +00:00

85 lines
3.4 KiB
Diff

From 6cb31b444442f8ebca939cd78b80993f2ac85350 Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Date: Wed, 1 Jul 2015 15:40:54 -0500
Subject: [PATCH 28/49] pcm: add helper functions to query timestamping
capabilities
extend support to link, link_estimated and link_synchronized
timestamp. wall-clock is deprecated
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/pcm.h | 3 ++-
src/pcm/pcm.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/include/pcm.h b/include/pcm.h
index 0655e7f43ef6..2aa1eff36be3 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -668,7 +668,8 @@ int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params);
-int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); /* deprecated, use audio_ts_type */
+int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type);
int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
unsigned int *rate_num,
unsigned int *rate_den);
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index bc18954b92da..846d502a6cb1 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -3190,12 +3190,45 @@ int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *param
*/
int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params)
{
+ /* deprecated */
+ return snd_pcm_hw_params_supports_audio_ts_type(params,
+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT);
+}
+
+/**
+ * \brief Check if hardware supports type of audio timestamps
+ * \param params Configuration space
+ * \param type Audio timestamp type
+ * \retval 0 Hardware doesn't support type of audio timestamps
+ * \retval 1 Hardware supports type of audio timestamps
+ *
+ * This function should only be called when the configuration space
+ * contains a single configuration. Call #snd_pcm_hw_params to choose
+ * a single configuration from the configuration space.
+ */
+int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type)
+{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
- return !!(params->info & SNDRV_PCM_INFO_HAS_WALL_CLOCK);
+ switch (type) {
+ case SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT:
+ return !!(params->info & SNDRV_PCM_INFO_HAS_WALL_CLOCK); /* deprecated */
+ case SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT:
+ return 1; /* always supported, based on hw_ptr */
+ case SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK:
+ return !!(params->info & SNDRV_PCM_INFO_HAS_LINK_ATIME);
+ case SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE:
+ return !!(params->info & SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME);
+ case SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED:
+ return !!(params->info & SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME);
+ case SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED:
+ return !!(params->info & SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME);
+ default:
+ return 0;
+ }
}
/**
--
2.5.0