- 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
130 lines
4.8 KiB
Diff
130 lines
4.8 KiB
Diff
From 6ec2464f397ff401c251057499abea77fd80b60b Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
|
Date: Wed, 1 Jul 2015 15:40:55 -0500
|
|
Subject: [PATCH 29/49] pcm: add support for get/set_audio_htstamp_config
|
|
|
|
Enable kernel-side functionality by letting user select what sort of
|
|
timestamp it desires
|
|
|
|
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
---
|
|
include/pcm.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
|
src/pcm/pcm.c | 38 ++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 82 insertions(+)
|
|
|
|
diff --git a/include/pcm.h b/include/pcm.h
|
|
index 2aa1eff36be3..a1d14a989a47 100644
|
|
--- a/include/pcm.h
|
|
+++ b/include/pcm.h
|
|
@@ -330,6 +330,26 @@ typedef enum _snd_pcm_tstamp_type {
|
|
SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
|
|
} snd_pcm_tstamp_type_t;
|
|
|
|
+typedef struct _snd_pcm_audio_tstamp_config {
|
|
+ /* 5 of max 16 bits used */
|
|
+ unsigned int type_requested:4;
|
|
+ unsigned int report_delay:1; /* add total delay to A/D or D/A */
|
|
+} snd_pcm_audio_tstamp_config_t;
|
|
+
|
|
+typedef struct _snd_pcm_audio_tstamp_report {
|
|
+ /* 6 of max 16 bits used for bit-fields */
|
|
+
|
|
+ /* for backwards compatibility */
|
|
+ unsigned int valid:1;
|
|
+
|
|
+ /* actual type if hardware could not support requested timestamp */
|
|
+ unsigned int actual_type:4;
|
|
+
|
|
+ /* accuracy represented in ns units */
|
|
+ unsigned int accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
|
|
+ unsigned int accuracy; /* up to 4.29s, will be packed in separate field */
|
|
+} snd_pcm_audio_tstamp_report_t;
|
|
+
|
|
/** Unsigned frames quantity */
|
|
typedef unsigned long snd_pcm_uframes_t;
|
|
/** Signed frames quantity */
|
|
@@ -981,6 +1001,30 @@ void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimest
|
|
void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
|
|
void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
|
|
void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
|
|
+void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
|
|
+void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
|
|
+ snd_pcm_audio_tstamp_report_t *audio_tstamp_report);
|
|
+void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj,
|
|
+ snd_pcm_audio_tstamp_config_t *audio_tstamp_config);
|
|
+
|
|
+static inline void snd_pcm_pack_audio_tstamp_config(unsigned int *data,
|
|
+ snd_pcm_audio_tstamp_config_t *config)
|
|
+{
|
|
+ *data = config->report_delay;
|
|
+ *data <<= 4;
|
|
+ *data |= config->type_requested;
|
|
+}
|
|
+
|
|
+static inline void snd_pcm_unpack_audio_tstamp_report(unsigned int data, unsigned int accuracy,
|
|
+ snd_pcm_audio_tstamp_report_t *report)
|
|
+{
|
|
+ data >>= 16;
|
|
+ report->valid = data & 1;
|
|
+ report->actual_type = (data >> 1) & 0xF;
|
|
+ report->accuracy_report = (data >> 5) & 1;
|
|
+ report->accuracy = accuracy;
|
|
+}
|
|
+
|
|
snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
|
|
snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
|
|
snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
|
|
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
|
|
index 846d502a6cb1..bae1d1653904 100644
|
|
--- a/src/pcm/pcm.c
|
|
+++ b/src/pcm/pcm.c
|
|
@@ -6367,6 +6367,44 @@ void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestam
|
|
}
|
|
|
|
/**
|
|
+ * \brief Get "now" hi-res driver timestamp from a PCM status container. Defines when the status
|
|
+ * was generated by driver, may differ from normal timestamp.
|
|
+ * \param obj pointer to #snd_pcm_status_t
|
|
+ * \param ptr Pointer to returned timestamp
|
|
+ */
|
|
+void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
|
|
+{
|
|
+ assert(obj && ptr);
|
|
+ *ptr = obj->driver_tstamp;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Get audio_tstamp_report from a PCM status container
|
|
+ * \param obj pointer to #snd_pcm_status_t
|
|
+ * \param ptr Pointer to returned report (valid fields are accuracy and type)
|
|
+ */
|
|
+void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
|
|
+ snd_pcm_audio_tstamp_report_t *audio_tstamp_report)
|
|
+{
|
|
+ assert(obj && audio_tstamp_report);
|
|
+ snd_pcm_unpack_audio_tstamp_report(obj->audio_tstamp_data,
|
|
+ obj->audio_tstamp_accuracy,
|
|
+ audio_tstamp_report);
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief set audio_tstamp_config from a PCM status container
|
|
+ * \param obj pointer to #snd_pcm_status_t
|
|
+ * \param ptr Pointer to config (valid fields are type and report_analog_delay)
|
|
+ */
|
|
+void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj,
|
|
+ snd_pcm_audio_tstamp_config_t *audio_tstamp_config)
|
|
+{
|
|
+ assert(obj && audio_tstamp_config);
|
|
+ snd_pcm_pack_audio_tstamp_config(&obj->audio_tstamp_data, audio_tstamp_config);
|
|
+}
|
|
+
|
|
+/**
|
|
* \brief Get delay from a PCM status container (see #snd_pcm_delay)
|
|
* \return Delay in frames
|
|
*
|
|
--
|
|
2.5.0
|
|
|