mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-23 09:36:30 +01:00
f9e6010d5e
Add Intel nhlt acpi table encoder plugin into topology2.0 processing. Nhlt internal structure is defined in: https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf Nhlt acpi table contain vendor specific binary data blobs that are used in some Intel dsp platforms for configuring the dmic and ssp hardware. The function of this code is mainly to generate the vendor specific binary blobs, but as there is existing nhlt parser code and header in kernel there's no point of re-inventing the container: just use the existing nhlt acpi table format. Basically this code is creating similar nhlt acpi table that you would get from: cat /sys/firmware/acpi/tables/NHLT This code will have implementation for dmic and ssp endpoints. Thus the code will translate the topology dai tokens into vendor specific binary blobs and pack them into nhlt acpi table. Ssp and dmic code is lifted from Sound Open Firmware (sof) code base, thus it will have BSD-3 license. This plugin can be enabled from command line with: alsatplg -DPREPROCESS_PLUGINS="nhlt" -c foo.conf -p -o bar.tplg You can also dump the nhlt binary into a file with additional define: -DNHLT_BIN="nhlt.bin" Link: https://github.com/alsa-project/alsa-utils/pull/129 Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
// SPDX-License-Identifier: BSD-3-Clause
|
|
//
|
|
// Copyright(c) 2021 Intel Corporation. All rights reserved.
|
|
//
|
|
// Author: Jaska Uimonen <jaska.uimonen@linux.intel.com>
|
|
|
|
#ifndef __INTEL_NHLT_H
|
|
#define __INTEL_NHLT_H
|
|
|
|
#include <stdint.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <alsa/input.h>
|
|
#include <alsa/output.h>
|
|
#include <alsa/conf.h>
|
|
#include <alsa/error.h>
|
|
|
|
#define MIN(a, b) ({ \
|
|
typeof(a) __a = (a); \
|
|
typeof(b) __b = (b); \
|
|
__a > __b ? __b : __a; \
|
|
})
|
|
#define MAX(a, b) ({ \
|
|
typeof(a) __a = (a); \
|
|
typeof(b) __b = (b); \
|
|
__a < __b ? __b : __a; \
|
|
})
|
|
|
|
#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a)[0])
|
|
|
|
#define BIT(b) (1UL << (b))
|
|
#define MASK(b_hi, b_lo) (((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))
|
|
#define SET_BIT(b, x) (((x) & 1) << (b))
|
|
#define SET_BITS(b_hi, b_lo, x) (((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo))
|
|
|
|
struct intel_nhlt_params {
|
|
void *dmic_params;
|
|
void *ssp_params;
|
|
};
|
|
|
|
struct dai_values {
|
|
char name[32];
|
|
snd_config_type_t type;
|
|
snd_config_t *data;
|
|
long *int_val;
|
|
const char **string_val;
|
|
};
|
|
|
|
int find_set_values(struct dai_values *values, int size, snd_config_t *dai_cfg,
|
|
snd_config_t *top, const char *class_name);
|
|
|
|
#endif /* __INTEL_NHLT_H */
|