summaryrefslogtreecommitdiff
path: root/src/include/acpi/acpi_soundwire.h
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2020-04-29 12:09:32 -0700
committerDuncan Laurie <dlaurie@chromium.org>2020-05-21 08:04:02 +0000
commite8189b74261f28293b650fd9a45e7b3a225990a9 (patch)
treef49012daf9c99d0719899fe81757604b80776fe5 /src/include/acpi/acpi_soundwire.h
parentebf1932f23dcacf995064cf1c790568b6914f99a (diff)
acpi/soundwire: Add functions to generate SoundWire properties
This change uses the previously added SoundWire definitions to provide functions that generate ACPI Device Properties for SoundWire controllers and codecs. A SoundWire controller driver should populate `struct soundwire_controller` and pass it to soundwire_gen_controller(). This will add all of the defined master links provided by the controller. A SoundWire codec driver should populate the necessary members in struct soundwire_codec and pass it to soundwire_gen_codec(). Several properties are optional and depend on whether the codec itself supports certain features and behaviors. The goal of this interface is to handle all of the properties defined in the SoundWire Discovery and Configuration Specification Version 1.0 so that controller and codec drivers do not need to all have code for writing standard properties. Both of these functions also provide a callback method for adding custom properties that are not defined by the SoundWire DisCo Specification. These properties may be required by OS drivers but are outside of the scope of the SoundWire specification itself. This code is tested with controller, codec, and mainboard implementations in subsequent commits. BUG=b:146482091 Signed-off-by: Duncan Laurie <dlaurie@google.com> Change-Id: Ib185eaacf3c4914087497ed65479a772c155502b Reviewed-on: https://review.coreboot.org/c/coreboot/+/40884 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/include/acpi/acpi_soundwire.h')
-rw-r--r--src/include/acpi/acpi_soundwire.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/include/acpi/acpi_soundwire.h b/src/include/acpi/acpi_soundwire.h
new file mode 100644
index 0000000000..50c088afce
--- /dev/null
+++ b/src/include/acpi/acpi_soundwire.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ACPI_ACPI_SOUNDWIRE_H__
+#define __ACPI_ACPI_SOUNDWIRE_H__
+
+#include <acpi/acpi_device.h>
+#include <device/soundwire.h>
+
+/**
+ * soundwire_dp_prop_cb() - Callback to add custom data port properties.
+ * @dsd: ACPI Device Property handle for this data port.
+ * @port_id: Data Port ID from 0-14.
+ * @codec: Properties that were passed to soundwire_gen_codec().
+ */
+typedef void soundwire_dp_prop_cb(struct acpi_dp *dsd, unsigned int port_id,
+ const struct soundwire_codec *codec);
+
+/**
+ * soundwire_gen_codec() - Generate SoundWire properties for codec device.
+ * @dsd: ACPI Device Property handle.
+ * @prop: Properties for codec which includes all other properties.
+ * @dp_prop_cb: Callback to allow custom codec properties.
+ */
+void soundwire_gen_codec(struct acpi_dp *dsd, const struct soundwire_codec *codec,
+ soundwire_dp_prop_cb dp_prop_cb);
+
+/**
+ * soundwire_link_prop_cb() - Callback to add custom link properties.
+ * @dsd: ACPI Device Property handle for master link.
+ * @link_id: Link number for this master.
+ * @controller: Properties that were passed to soundwire_gen_controller().
+ */
+typedef void soundwire_link_prop_cb(struct acpi_dp *dsd, unsigned int link_id,
+ const struct soundwire_controller *controller);
+
+/**
+ * soundwire_gen_controller() - Generate SoundWire properties for master links.
+ * @dsd: ACPI Device Property handle for controller.
+ * @prop: Properties for controller which includes all other properties.
+ * @link_prop_cb: Callback to allow custom link properties.
+ */
+void soundwire_gen_controller(struct acpi_dp *dsd, const struct soundwire_controller *prop,
+ soundwire_link_prop_cb link_prop_cb);
+
+#endif /* __ACPI_ACPI_SOUNDWIRE_H__ */