xref: /aosp_15_r20/external/coreboot/src/soc/intel/skylake/nhlt/max98357.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 max98357_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 = "max98357-render-2ch-48khz-24b.bin",
15 	},
16 };
17 
18 static const struct nhlt_endp_descriptor max98357_descriptors[] = {
19 	{
20 		.link = NHLT_LINK_SSP,
21 		.device = NHLT_SSP_DEV_I2S,
22 		.direction = NHLT_DIR_RENDER,
23 		.vid = NHLT_VID,
24 		.did = NHLT_DID_SSP,
25 		.formats = max98357_render_formats,
26 		.num_formats = ARRAY_SIZE(max98357_render_formats),
27 	},
28 };
29 
nhlt_soc_add_max98357(struct nhlt * nhlt,int hwlink)30 int nhlt_soc_add_max98357(struct nhlt *nhlt, int hwlink)
31 {
32 	/* Virtual bus id of SSP links are the hardware port ids proper. */
33 	return nhlt_add_ssp_endpoints(nhlt, hwlink, max98357_descriptors,
34 					ARRAY_SIZE(max98357_descriptors));
35 }
36