summaryrefslogtreecommitdiff
path: root/src/include/nhlt.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-06-28 14:59:21 -0500
committerAaron Durbin <adurbin@chromium.org>2016-06-29 23:13:54 +0200
commited0f6d7cb762b40d282101cf847f3d45209a5f26 (patch)
tree6e99d1ee5fe1c5e234bb7d670ddb10fbac8c7f89 /src/include/nhlt.h
parent78461a9d55de07f3187b48dfd6abca48db90e906 (diff)
downloadcoreboot-ed0f6d7cb762b40d282101cf847f3d45209a5f26.tar.xz
lib/nhlt: add helper functions for adding endpoints
In order to ease the porting of supporting NHLT endpoints introduce a nhlt_endpoint_descriptor structure as well as corresponding helper functions. Change-Id: I68edaf681b4e60502f6ddbbd04de21d8aa072296 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/15486 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/include/nhlt.h')
-rw-r--r--src/include/nhlt.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/include/nhlt.h b/src/include/nhlt.h
index f0b3b6f5e7..3300d43d5d 100644
--- a/src/include/nhlt.h
+++ b/src/include/nhlt.h
@@ -58,6 +58,43 @@ struct nhlt *nhlt_init(void);
size_t nhlt_current_size(struct nhlt *nhlt);
/*
+ * Helper functions for adding NHLT devices utilizing an nhlt_endp_descriptor
+ * to drive the logic.
+ */
+
+struct nhlt_endp_descriptor {
+ /* NHLT endpoint types. */
+ int link;
+ int device;
+ int direction;
+ uint16_t vid;
+ uint16_t did;
+ /* Optional endpoint specific configuration data. */
+ const void *cfg;
+ size_t cfg_size;
+ /* Formats supported for endpoint. */
+ const struct nhlt_format_config *formats;
+ size_t num_formats;
+};
+
+/*
+ * Add the number of endpoints described by each descriptor. The virtual bus
+ * id for each descriptor is the default value of 0.
+ * Returns < 0 on error, 0 on success.
+ */
+int nhlt_add_endpoints(struct nhlt *nhlt,
+ const struct nhlt_endp_descriptor *epds,
+ size_t num_epds);
+
+/*
+ * Add the number of endpoints associated with a single NHLT SSP instance id.
+ * Each endpoint described in the endpoint descriptor array uses the provided
+ * virtual bus id. Returns < 0 on error, 0 on success.
+ */
+int nhlt_add_ssp_endpoints(struct nhlt *nhlt, int virtual_bus_id,
+ const struct nhlt_endp_descriptor *epds, size_t num_epds);
+
+/*
* Add endpoint to NHLT object. Returns NULL on error.
*
* Note that the SoC variant uses SoC-specifc types for the hardware interface