diff options
Diffstat (limited to 'sound/hda/intel-nhlt.c')
-rw-r--r-- | sound/hda/intel-nhlt.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c index 696a958d93e9..6d72a871bda0 100644 --- a/sound/hda/intel-nhlt.c +++ b/sound/hda/intel-nhlt.c @@ -343,3 +343,46 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt, return NULL; } EXPORT_SYMBOL(intel_nhlt_get_endpoint_blob); + +int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt, + u8 virtual_bus_id) +{ + struct nhlt_endpoint *epnt; + int i; + + if (!nhlt) { + dev_err(dev, "%s: NHLT table is missing (query for SSP%d)\n", + __func__, virtual_bus_id); + return -EINVAL; + } + + epnt = (struct nhlt_endpoint *)nhlt->desc; + for (i = 0; i < nhlt->endpoint_count; i++) { + /* for SSP link the virtual bus id is the SSP port number */ + if (epnt->linktype == NHLT_LINK_SSP && + epnt->virtual_bus_id == virtual_bus_id) { + dev_dbg(dev, "SSP%d: dev_type=%d\n", virtual_bus_id, + epnt->device_type); + return epnt->device_type; + } + + epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length); + } + + dev_err(dev, "%s: No match for SSP%d in NHLT table\n", __func__, + virtual_bus_id); + + dev_dbg(dev, "Available endpoints:\n"); + epnt = (struct nhlt_endpoint *)nhlt->desc; + for (i = 0; i < nhlt->endpoint_count; i++) { + dev_dbg(dev, + "%d: link_type: %d, vbus_id: %d, dir: %d, dev_type: %d\n", + i, epnt->linktype, epnt->virtual_bus_id, + epnt->direction, epnt->device_type); + + epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length); + } + + return -EINVAL; +} +EXPORT_SYMBOL(intel_nhlt_ssp_device_type); |