[coreboot-gerrit] New patch to review for coreboot: lib/nhlt: Extend NHLT function library
Saurabh Satija (saurabh.satija@intel.com)
gerrit at coreboot.org
Tue Jun 28 10:04:49 CEST 2016
Saurabh Satija (saurabh.satija at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15464
-gerrit
commit dc55345849936db925696bbb01b9a5ce4fa54ea1
Author: Saurabh Satija <saurabh.satija at intel.com>
Date: Tue Jun 28 00:35:14 2016 -0700
lib/nhlt: Extend NHLT function library
Add NHLT library function defintions to lib/nhlt.c. This adds
nhlt_soc_add_endpoint(), nhlt_soc_serialiaze() and
nhlt_soc_serialize_oem_overrides(). These functions are used by
NHLT helper functions to add dmic and different audio codecs for
an SoC/mainboard.
Change-Id: I96b7369eb7ca2ac2edacf3d942a201b92a5363f4
Signed-off-by: Saurabh Satija <saurabh.satija at intel.com>
---
src/lib/nhlt.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/src/lib/nhlt.c b/src/lib/nhlt.c
index e31803d..348c08e 100644
--- a/src/lib/nhlt.c
+++ b/src/lib/nhlt.c
@@ -524,3 +524,69 @@ int nhlt_add_codec_on_ssp(struct nhlt *nhlt, int hwlink,
return 0;
}
+
+struct nhlt_endpoint *nhlt_soc_add_endpoint(struct nhlt *nhlt, int soc_hwintf,
+ int soc_devtype, int dir)
+{
+ int nhlt_link_type;
+ int nhlt_dev_type;
+ uint16_t did;
+ struct nhlt_endpoint *endp;
+
+ nhlt_link_type = nhlt_soc_get_link_type(soc_hwintf, soc_devtype);
+
+ if (nhlt_link_type == -1)
+ return NULL;
+
+ switch (soc_devtype) {
+ case AUDIO_DEV_I2S:
+ nhlt_dev_type = NHLT_SSP_DEV_I2S;
+ did = NHLT_DID_SSP;
+ break;
+ case AUDIO_DEV_DMIC:
+ nhlt_dev_type = NHLT_PDM_DEV;
+ did = NHLT_DID_DMIC;
+ break;
+ case AUDIO_DEV_BT:
+ nhlt_dev_type = NHLT_SSP_DEV_BT;
+ did = NHLT_DID_BT;
+ break;
+ default:
+ return NULL;
+ }
+
+ endp = nhlt_add_endpoint(nhlt, nhlt_link_type, nhlt_dev_type, dir,
+ NHLT_VID, did);
+
+ if (endp == NULL)
+ return NULL;
+
+ /* Virtual bus id of SSP link is the hardware port id. */
+ if (nhlt_link_type == NHLT_LINK_SSP)
+ endp->virtual_bus_id = soc_hwintf;
+
+ return endp;
+}
+
+uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
+{
+ return nhlt_soc_serialize_oem_overrides(nhlt, acpi_addr, NULL, NULL);
+}
+
+uintptr_t nhlt_soc_serialize_oem_overrides(struct nhlt *nhlt,
+ uintptr_t acpi_addr, const char *oem_id, const char *oem_table_id)
+{
+ struct global_nvs_t *gnvs;
+
+ gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
+
+ if (gnvs == NULL)
+ return acpi_addr;
+
+ /* Update NHLT GNVS Data */
+ gnvs->nhla = (uintptr_t)acpi_addr;
+ gnvs->nhll = nhlt_current_size(nhlt);
+
+ return nhlt_serialize_oem_overrides(nhlt, acpi_addr, oem_id,
+ oem_table_id);
+}
More information about the coreboot-gerrit
mailing list