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 {
32 u32 avg_bytes_per_sec;
41 u16 valid_bits_per_sample;
42 u16 samples_per_block;
49 struct nhlt_specific_cfg {
55 struct wav_fmt_ext fmt_ext;
56 struct nhlt_specific_cfg config;
61 struct nhlt_fmt_cfg fmt_config[];
64 struct nhlt_endpoint {
75 struct nhlt_specific_cfg config;
78 struct nhlt_acpi_table {
79 struct acpi_table_header header;
81 struct nhlt_endpoint desc[];
84 struct nhlt_resource_desc {
90 u64 addr_trans_offset;
94 #define MIC_ARRAY_2CH 2
95 #define MIC_ARRAY_4CH 4
97 struct nhlt_device_specific_config {
102 struct nhlt_dmic_array_config {
103 struct nhlt_device_specific_config device_config;
107 struct nhlt_vendor_dmic_array_config {
108 struct nhlt_dmic_array_config dmic_config;
110 /* TODO add vendor mic config */
114 NHLT_CONFIG_TYPE_GENERIC = 0,
115 NHLT_CONFIG_TYPE_MIC_ARRAY = 1
119 NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
120 NHLT_MIC_ARRAY_2CH_BIG = 0xb,
121 NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
122 NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
123 NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
124 NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
127 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
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 int intel_nhlt_ssp_mclk_mask(struct nhlt_acpi_table *nhlt, int ssp_num);
141 struct nhlt_specific_cfg *
142 intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
143 u32 bus_id, u8 link_type, u8 vbps, u8 bps,
144 u8 num_ch, u32 rate, u8 dir, u8 dev_type);
146 int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt,
151 static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev)
156 static inline void intel_nhlt_free(struct nhlt_acpi_table *addr)
160 static inline int intel_nhlt_get_dmic_geo(struct device *dev,
161 struct nhlt_acpi_table *nhlt)
166 static inline bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt,
172 static inline int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 device_type)
177 static inline int intel_nhlt_ssp_mclk_mask(struct nhlt_acpi_table *nhlt, int ssp_num)
182 static inline struct nhlt_specific_cfg *
183 intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
184 u32 bus_id, u8 link_type, u8 vbps, u8 bps,
185 u8 num_ch, u32 rate, u8 dir, u8 dev_type)
190 static inline int intel_nhlt_ssp_device_type(struct device *dev,
191 struct nhlt_acpi_table *nhlt,