1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <commonlib/bsd/helpers.h>
4 #include <soc/nhlt.h>
5
6 /* The same DSP firmware settings are used for both the capture and
7 * render endpoints. */
8 static const struct nhlt_format_config nau88l25_formats[] = {
9 /* 48 KHz 24-bits per sample. */
10 {
11 .num_channels = 2,
12 .sample_freq_khz = 48,
13 .container_bits_per_sample = 32,
14 .valid_bits_per_sample = 24,
15 .speaker_mask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT,
16 .settings_file = "nau88l25-2ch-48khz-24b.bin",
17 },
18 };
19
20 /* The nau88l25 just has headphones and a mic. Both the capture and render
21 * endpoints occupy the same virtual slot. */
22 static const struct nhlt_tdm_config tdm_config = {
23 .virtual_slot = 0,
24 .config_type = NHLT_TDM_BASIC,
25 };
26
27 static const struct nhlt_endp_descriptor nau88l25_descriptors[] = {
28 /* Render Endpoint */
29 {
30 .link = NHLT_LINK_SSP,
31 .device = NHLT_SSP_DEV_I2S,
32 .direction = NHLT_DIR_RENDER,
33 .vid = NHLT_VID,
34 .did = NHLT_DID_SSP,
35 .cfg = &tdm_config,
36 .cfg_size = sizeof(tdm_config),
37 .formats = nau88l25_formats,
38 .num_formats = ARRAY_SIZE(nau88l25_formats),
39 },
40 /* Capture Endpoint */
41 {
42 .link = NHLT_LINK_SSP,
43 .device = NHLT_SSP_DEV_I2S,
44 .direction = NHLT_DIR_CAPTURE,
45 .vid = NHLT_VID,
46 .did = NHLT_DID_SSP,
47 .cfg = &tdm_config,
48 .cfg_size = sizeof(tdm_config),
49 .formats = nau88l25_formats,
50 .num_formats = ARRAY_SIZE(nau88l25_formats),
51 },
52 };
53
nhlt_soc_add_nau88l25(struct nhlt * nhlt,int hwlink)54 int nhlt_soc_add_nau88l25(struct nhlt *nhlt, int hwlink)
55 {
56 /* Virtual bus id of SSP links are the hardware port ids proper. */
57 return nhlt_add_ssp_endpoints(nhlt, hwlink, nau88l25_descriptors,
58 ARRAY_SIZE(nau88l25_descriptors));
59 }
60