1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * intel-nhlt.h - Intel HDA Platform NHLT header
5 * Copyright (c) 2015-2019 Intel Corporation
8 #ifndef __INTEL_NHLT_H__
9 #define __INTEL_NHLT_H__
11 #include <linux/acpi.h>
21 enum nhlt_device_type {
28 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
34 u32 avg_bytes_per_sec;
43 u16 valid_bits_per_sample;
44 u16 samples_per_block;
51 struct nhlt_specific_cfg {
57 struct wav_fmt_ext fmt_ext;
58 struct nhlt_specific_cfg config;
63 struct nhlt_fmt_cfg fmt_config[];
66 struct nhlt_endpoint {
77 struct nhlt_specific_cfg config;
80 struct nhlt_acpi_table {
81 struct acpi_table_header header;
83 struct nhlt_endpoint desc[];
86 struct nhlt_resource_desc {
92 u64 addr_trans_offset;
96 #define MIC_ARRAY_2CH 2
97 #define MIC_ARRAY_4CH 4
99 struct nhlt_device_specific_config {
104 struct nhlt_dmic_array_config {
105 struct nhlt_device_specific_config device_config;
109 struct nhlt_vendor_dmic_array_config {
110 struct nhlt_dmic_array_config dmic_config;
112 /* TODO add vendor mic config */
116 NHLT_CONFIG_TYPE_GENERIC = 0,
117 NHLT_CONFIG_TYPE_MIC_ARRAY = 1
121 NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
122 NHLT_MIC_ARRAY_2CH_BIG = 0xb,
123 NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
124 NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
125 NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
126 NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
129 struct nhlt_acpi_table *intel_nhlt_init(struct device *dev);
131 void intel_nhlt_free(struct nhlt_acpi_table *addr);
133 int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt);
135 bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt, u8 link_type);
137 int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 device_type);
139 struct nhlt_specific_cfg *
140 intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
141 u32 bus_id, u8 link_type, u8 vbps, u8 bps,
142 u8 num_ch, u32 rate, u8 dir, u8 dev_type);
146 struct nhlt_acpi_table;
148 static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev)
153 static inline void intel_nhlt_free(struct nhlt_acpi_table *addr)
157 static inline int intel_nhlt_get_dmic_geo(struct device *dev,
158 struct nhlt_acpi_table *nhlt)
163 static inline bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt,
169 static inline int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 device_type)
174 static inline struct nhlt_specific_cfg *
175 intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
176 u32 bus_id, u8 link_type, u8 vbps, u8 bps,
177 u8 num_ch, u32 rate, u8 dir, u8 dev_type)