diff options
author | Brent Lu <brent.lu@intel.com> | 2023-11-27 13:06:56 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-03-22 12:40:46 +0100 |
commit | 02545bc57512b7660625e454e60e3fb0d07f660d (patch) | |
tree | b8a7a6fa6741674d4424037888404b12d83fe061 /sound/hda | |
parent | Merge tag 'asoc-fix-v6.9-merge-window' of https://git.kernel.org/pub/scm/linu... (diff) | |
download | linux-02545bc57512b7660625e454e60e3fb0d07f660d.tar.xz linux-02545bc57512b7660625e454e60e3fb0d07f660d.zip |
ALSA: hda: intel-nhlt: add intel_nhlt_ssp_device_type() function
Add a helper function intel_nhlt_ssp_device_type() to detect the type
of specific SSP port. The result is nhlt_device_type enum type which
could be NHLT_DEVICE_BT or NHLT_DEVICE_I2S.
Signed-off-by: Brent Lu <brent.lu@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20231127120657.19764-2-peter.ujfalusi@linux.intel.com>
Diffstat (limited to 'sound/hda')
-rw-r--r-- | sound/hda/intel-nhlt.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c index 696a958d93e9..088cff799e0b 100644 --- a/sound/hda/intel-nhlt.c +++ b/sound/hda/intel-nhlt.c @@ -343,3 +343,29 @@ 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) + 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); + } + + return -EINVAL; +} +EXPORT_SYMBOL(intel_nhlt_ssp_device_type); |