All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH v2 11/12] ASoC: SOF: Add userspace ABI support
Date: Fri, 31 Aug 2018 16:19:09 +0100	[thread overview]
Message-ID: <20180831151910.16122-12-liam.r.girdwood@linux.intel.com> (raw)
In-Reply-To: <20180831151910.16122-1-liam.r.girdwood@linux.intel.com>

Add userspace ABI for audio userspace application IO outside of regular
ALSA PCM and kcontrols. This is intended to be used to format
coefficients and data for custom processing components.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 include/uapi/sound/sof-abi.h  |  29 ++++++++++
 include/uapi/sound/sof-eq.h   | 102 ++++++++++++++++++++++++++++++++++
 include/uapi/sound/sof-fw.h   |  67 ++++++++++++++++++++++
 include/uapi/sound/sof-tone.h |  27 +++++++++
 4 files changed, 225 insertions(+)
 create mode 100644 include/uapi/sound/sof-abi.h
 create mode 100644 include/uapi/sound/sof-eq.h
 create mode 100644 include/uapi/sound/sof-fw.h
 create mode 100644 include/uapi/sound/sof-tone.h

diff --git a/include/uapi/sound/sof-abi.h b/include/uapi/sound/sof-abi.h
new file mode 100644
index 000000000000..ff208d2f7573
--- /dev/null
+++ b/include/uapi/sound/sof-abi.h
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause)
+//
+// This file is provided under a dual BSD/GPLv2 license.  When using or
+// redistributing this file, you may do so under either license.
+//
+// Copyright(c) 2018 Intel Corporation. All rights reserved.
+//
+
+#ifndef __INCLUDE_UAPI_ABI_H__
+#define __INCLUDE_UAPI_ABI_H__
+
+#define SOF_ABI_VERSION		1
+#define SOF_ABI_MAGIC		0x00464F53	/* "SOF\0" */
+
+/*
+ * Header for all non IPC ABI data. Identifies data type, size and ABI.
+ * Used by any bespoke component data structures or binary blobs.
+ */
+
+struct sof_abi_hdr {
+	uint32_t magic;		/* 'S', 'O', 'F', '\0' */
+	uint32_t type;		/* component specific type */
+	uint32_t size;		/* size in bytes of data excluding this struct */
+	uint32_t abi;		/* SOF ABI version */
+	uint32_t comp_abi;	/* component specific ABI version */
+	char data[0];
+}  __attribute__((packed));
+
+#endif
diff --git a/include/uapi/sound/sof-eq.h b/include/uapi/sound/sof-eq.h
new file mode 100644
index 000000000000..02607a89c492
--- /dev/null
+++ b/include/uapi/sound/sof-eq.h
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause)
+//
+// This file is provided under a dual BSD/GPLv2 license.  When using or
+// redistributing this file, you may do so under either license.
+//
+// Copyright(c) 2018 Intel Corporation. All rights reserved.
+//
+// Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
+//
+
+#ifndef EQ_H
+#define EQ_H
+
+/* FIR EQ type */
+
+/* Component will reject non-matching configuration. The version number need
+ * to be incremented with any ABI changes in function fir_cmd().
+ */
+#define SOF_EQ_FIR_ABI_VERSION  1
+
+#define SOF_EQ_FIR_IDX_SWITCH	0
+
+#define SOF_EQ_FIR_MAX_SIZE 4096 /* Max size allowed for coef data in bytes */
+
+/*
+ * eq_fir_configuration data structure contains this information
+ *     uint16_t channels_in_config
+ *         This describes the number of channels in this EQ config data. It
+ *         can be different from PLATFORM_MAX_CHANNELS.
+ *     uint16_t number_of_responses
+ *         0=no responses, 1=one response defined, 2=two responses defined, etc.
+ *     int16_t data[]
+ *         assign_response[STREAM_MAX_CHANNELS]
+ *             -1 = not defined, 0 = use first response, 1 = use 2nd response, etc.
+ *             E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the
+ *	       same first defined response and leave channels 4-7 unequalized.
+ *         coef_data[]
+ *             Repeated data { filter_length, input_shift, output_shift, h[] }
+ *	       for every EQ response defined where vector h has filter_length
+ *             number of coefficients. Coefficients in h[] are in Q1.15 format.
+ *             E.g. 16384 (Q1.15) = 0.5. The shifts are number of right shifts.
+ */
+
+struct sof_eq_fir_config {
+	uint16_t channels_in_config;
+	uint16_t number_of_responses;
+	int16_t data[];
+} __attribute__((packed));
+
+/* IIR EQ type */
+
+/* Component will reject non-matching configuration. The version number need
+ * to be incremented with any ABI changes in function fir_cmd().
+ */
+#define SOF_EQ_FIR_ABI_VERSION  1
+
+#define SOF_EQ_IIR_IDX_SWITCH   0
+
+#define SOF_EQ_IIR_MAX_SIZE 1024 /* Max size allowed for coef data in bytes */
+
+/* eq_iir_configuration
+ *     uint32_t channels_in_config
+ *         This describes the number of channels in this EQ config data. It
+ *         can be different from PLATFORM_MAX_CHANNELS.
+ *     uint32_t number_of_responses_defined
+ *         0=no responses, 1=one response defined, 2=two responses defined, etc.
+ *     int32_t data[]
+ *         Data consist of two parts. First is the response assign vector that
+ *	   has length of channels_in_config. The latter part is coefficient
+ *         data.
+ *         uint32_t assign_response[channels_in_config]
+ *             -1 = not defined, 0 = use first response, 1 = use 2nd, etc.
+ *             E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the
+ *             same first defined response and leave channels 4-7 unequalized.
+ *         coefficient_data[]
+ *             <1st EQ>
+ *             uint32_t num_biquads
+ *             uint32_t num_biquads_in_series
+ *             <1st biquad>
+ *             int32_t coef_a2       Q2.30 format
+ *             int32_t coef_a1       Q2.30 format
+ *             int32_t coef_b2       Q2.30 format
+ *             int32_t coef_b1       Q2.30 format
+ *             int32_t coef_b0       Q2.30 format
+ *             int32_t output_shift  number of shifts right, shift left is negative
+ *             int32_t output_gain   Q2.14 format
+ *             <2nd biquad>
+ *             ...
+ *             <2nd EQ>
+ *
+ *         Note: A flat response biquad can be made with a section set to
+ *         b0 = 1.0, gain = 1.0, and other parameters set to 0
+ *         {0, 0, 0, 0, 1073741824, 0, 16484}
+ */
+
+struct sof_eq_iir_config {
+	uint32_t channels_in_config;
+	uint32_t number_of_responses;
+	int32_t data[];
+} __attribute__((packed));
+
+#endif /* EQ_H */
diff --git a/include/uapi/sound/sof-fw.h b/include/uapi/sound/sof-fw.h
new file mode 100644
index 000000000000..3bf86ce00f93
--- /dev/null
+++ b/include/uapi/sound/sof-fw.h
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause)
+//
+// This file is provided under a dual BSD/GPLv2 license.  When using or
+// redistributing this file, you may do so under either license.
+//
+// Copyright(c) 2018 Intel Corporation. All rights reserved.
+//
+
+/*
+ * Firmware file format .
+ */
+
+#ifndef __INCLUDE_UAPI_SOF_FW_H__
+#define __INCLUDE_UAPI_SOF_FW_H__
+
+#define SND_SOF_FW_SIG_SIZE	4
+#define SND_SOF_FW_ABI		1
+#define SND_SOF_FW_SIG		"Reef"
+
+/*
+ * Firmware module is made up of 1 . N blocks of different types. The
+ * Block header is used to determine where and how block is to be copied in the
+ * DSP/host memory space.
+ */
+enum snd_sof_fw_blk_type {
+	SOF_BLK_IMAGE	= 0,	/* whole image - parsed by ROMs */
+	SOF_BLK_TEXT	= 1,
+	SOF_BLK_DATA	= 2,
+	SOF_BLK_CACHE	= 3,
+	SOF_BLK_REGS	= 4,
+	SOF_BLK_SIG	= 5,
+	SOF_BLK_ROM	= 6,
+	/* add new block types here */
+};
+
+struct snd_sof_blk_hdr {
+	enum snd_sof_fw_blk_type type;
+	uint32_t size;		/* bytes minus this header */
+	uint32_t offset;	/* offset from base */
+} __attribute__((packed));
+
+/*
+ * Firmware file is made up of 1 .. N different modules types. The module
+ * type is used to determine how to load and parse the module.
+ */
+enum snd_sof_fw_mod_type {
+	SOF_FW_BASE	= 0,	/* base firmware image */
+	SOF_FW_MODULE	= 1,	/* firmware module */
+};
+
+struct snd_sof_mod_hdr {
+	enum snd_sof_fw_mod_type type;
+	uint32_t size;		/* bytes minus this header */
+	uint32_t num_blocks;	/* number of blocks */
+} __attribute__((packed));
+
+/*
+ * Firmware file header.
+ */
+struct snd_sof_fw_header {
+	unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */
+	uint32_t file_size;	/* size of file minus this header */
+	uint32_t num_modules;	/* number of modules */
+	uint32_t abi;		/* version of header format */
+} __attribute__((packed));
+
+#endif
diff --git a/include/uapi/sound/sof-tone.h b/include/uapi/sound/sof-tone.h
new file mode 100644
index 000000000000..81f7bc1eca8e
--- /dev/null
+++ b/include/uapi/sound/sof-tone.h
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause)
+//
+// This file is provided under a dual BSD/GPLv2 license.  When using or
+// redistributing this file, you may do so under either license.
+//
+// Copyright(c) 2018 Intel Corporation. All rights reserved.
+// Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
+//
+
+#ifndef TONE_H
+#define TONE_H
+
+/* Component will reject non-matching configuration. The version number need
+ * to be incremented with any ABI changes in function fir_cmd().
+ */
+#define SOF_TONE_ABI_VERSION		1
+
+#define SOF_TONE_IDX_FREQUENCY		0
+#define SOF_TONE_IDX_AMPLITUDE		1
+#define SOF_TONE_IDX_FREQ_MULT		2
+#define SOF_TONE_IDX_AMPL_MULT		3
+#define SOF_TONE_IDX_LENGTH		4
+#define SOF_TONE_IDX_PERIOD		5
+#define SOF_TONE_IDX_REPEATS		6
+#define SOF_TONE_IDX_LIN_RAMP_STEP	7
+
+#endif /* TONE_ABI_H */
-- 
2.17.1

  parent reply	other threads:[~2018-08-31 15:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 15:18 [PATCH v2 00/12] Sound Open Firmware Core Liam Girdwood
2018-08-31 15:18 ` [PATCH v2 01/12] ASoC: SOF: Add Sound Open Firmware driver core Liam Girdwood
2018-09-03 15:07   ` Mark Brown
2018-08-31 15:19 ` [PATCH v2 02/12] ASoC: SOF: Add Sound Open Firmware KControl support Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 03/12] ASoC: SOF: Add driver debug support Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 04/12] ASoC: SOF: Add support for IPC IO between DSP and Host Liam Girdwood
2018-09-03 15:53   ` Mark Brown
2018-09-04 13:15     ` Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 05/12] ASoC: SOF: Add PCM operations support Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 06/12] ASoC: SOF: Add support for loading topologies Liam Girdwood
2018-09-03 16:19   ` Mark Brown
2018-08-31 15:19 ` [PATCH v2 07/12] ASoC: SOF: Add DSP firmware trace event support Liam Girdwood
2018-09-03 16:25   ` Mark Brown
2018-09-04 13:21     ` Liam Girdwood
2018-09-04 15:03       ` Mark Brown
2018-09-04 15:28         ` Liam Girdwood
2018-09-04 15:46           ` Mark Brown
2018-09-20 16:02             ` Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 08/12] ASoC: SOF: Add DSP HW abstraction operations Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 09/12] ASoC: SOF: Add firmware loader support Liam Girdwood
2018-08-31 15:19 ` [PATCH v2 10/12] ASoC: SOF: Add PM support Liam Girdwood
2018-08-31 15:19 ` Liam Girdwood [this message]
2018-08-31 15:19 ` [PATCH v2 12/12] ASoC: SOF: Add Build support for SOF core Liam Girdwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180831151910.16122-12-liam.r.girdwood@linux.intel.com \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.