Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect SSP port number from NHLT table - 2 #4524

Closed

Conversation

brentlu
Copy link

@brentlu brentlu commented Aug 15, 2023

It's second version of #4492

The difference is the NHLT comes from BIOS/coreboot so the change is much smaller.

  1. check_nhlt_ssp_masks() prepares three masks in snd_soc_acpi_mach_params which will be passed to machine driver:
  • nhlt_bt_mask: SSP port mask of BT Sideband device type
  • nhlt_render_mask: SSP port mask which supports render direction
  • nhlt_capture_mask: same as above but capture direction
  1. machine driver overwrites the port number defined in quirk data if NHLT suggests new port number

We could use config type to determine if the capture endpoint is for smartamp or FW-generated echo reference, The nhlt_capture_mask will exclude endpoints of smartamp.

enum eIntcConfigType
{
eIntcConfigTypeGeneric = 0,
eIntcConfigTypeMicArray = 1,
eIntcConfigTypeRenderWithLoopback = 2, //not supported in Windows
eIntcConfigTypeRenderFeedback = 3, //in case of endpoint capture direction means feedback for render
}

[ 17.057319] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=0 link_type=2, dev_type=0, dir=1, vbus_id=0
[ 17.057320] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=1 link_type=3, dev_type=4, dir=0, vbus_id=0
[ 17.057321] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=2 link_type=3, dev_type=4, dir=1, vbus_id=0
[ 17.057323] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: config_type=0
=> config type is 0, mostly for headset
[ 17.057324] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=3 link_type=3, dev_type=4, dir=0, vbus_id=1
[ 17.057325] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=4 link_type=3, dev_type=4, dir=1, vbus_id=1
[ 17.057326] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: config_type=3
=> config type is 3, it's render feedback endpoint which is for smartamp
[ 17.057327] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=5 link_type=3, dev_type=0, dir=0, vbus_id=2
[ 17.057328] sof-audio-pci-intel-tgl 0000:00:1f.3: intel_nhlt_ssp_dir_mask: ep=6 link_type=3, dev_type=0, dir=1, vbus_id=2

This helper function returns bitmask of SSP ports which support
specific direction according to endpoint descriptors. Smart
amplifier's render feedback does not count when finding SSP ports with
capture direction so caller could use this function to find out which
port is for headset(both render and capture) and which port is for
speakers(render only).

Signed-off-by: Brent Lu <[email protected]>
Add new fields to snd_soc_acpi_mach_params structure to provide
machine drivers SSP port mask of BT sideband device, render device,
and capture device. Machine driver could use the information to
detect the port number of headset, speaker, and BT offload devices.

Signed-off-by: Brent Lu <[email protected]>
With bitmasks from NHLT table, we could detect the port number of
headset, speakers, and bt offload. Here we assume a headset supports
both render and capture direction and speakers support render
direction only. BT offload has its own device type so we don't need to
check direction field in the NHLT endpoint descriptor.

Signed-off-by: Brent Lu <[email protected]>
@plbossart plbossart added the Unclear No agreement on problem statement and resolution label Nov 21, 2023
@brentlu brentlu closed this Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unclear No agreement on problem statement and resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants