xref: /aosp_15_r20/external/coreboot/src/soc/intel/skylake/nhlt/ssm4567.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <commonlib/bsd/helpers.h>
4 #include <soc/nhlt.h>
5 
6 static const struct nhlt_format_config ssm4567_render_formats[] = {
7 	/* 48 KHz 24-bits per sample. */
8 	{
9 		.num_channels = 2,
10 		.sample_freq_khz = 48,
11 		.container_bits_per_sample = 32,
12 		.valid_bits_per_sample = 24,
13 		.speaker_mask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT,
14 		.settings_file = "ssm4567-render-2ch-48khz-24b.bin",
15 	},
16 };
17 
18 /* Capture Blob used for IV feedback for Speaker Protection Algorithm */
19 static const struct nhlt_format_config ssm4567_capture_formats[] = {
20 	/* 48 KHz 32-bits per sample. */
21 	{
22 		.num_channels = 4,
23 		.sample_freq_khz = 48,
24 		.container_bits_per_sample = 32,
25 		.valid_bits_per_sample = 32,
26 		.settings_file = "ssm4567-capture-4ch-48khz-32b.bin",
27 	},
28 };
29 
30 static const struct nhlt_endp_descriptor ssm4567_descriptors[] = {
31 	/* Render Endpoint */
32 	{
33 		.link = NHLT_LINK_SSP,
34 		.device = NHLT_SSP_DEV_I2S,
35 		.direction = NHLT_DIR_RENDER,
36 		.vid = NHLT_VID,
37 		.did = NHLT_DID_SSP,
38 		.formats = ssm4567_render_formats,
39 		.num_formats = ARRAY_SIZE(ssm4567_render_formats),
40 	},
41 	/* Capture Endpoint */
42 	{
43 		.link = NHLT_LINK_SSP,
44 		.device = NHLT_SSP_DEV_I2S,
45 		.direction = NHLT_DIR_CAPTURE,
46 		.vid = NHLT_VID,
47 		.did = NHLT_DID_SSP,
48 		.formats = ssm4567_capture_formats,
49 		.num_formats = ARRAY_SIZE(ssm4567_capture_formats),
50 	},
51 };
52 
nhlt_soc_add_ssm4567(struct nhlt * nhlt,int hwlink)53 int nhlt_soc_add_ssm4567(struct nhlt *nhlt, int hwlink)
54 {
55 	/* Virtual bus id of SSP links are the hardware port ids proper. */
56 	return nhlt_add_ssp_endpoints(nhlt, hwlink, ssm4567_descriptors,
57 					ARRAY_SIZE(ssm4567_descriptors));
58 }
59