Lines Matching +full:mic +full:- +full:cfg
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright(c) 2023-2024 Intel Corporation
28 * acpi_nhlt_get_gbl_table - Retrieve a pointer to the first NHLT table.
47 * acpi_nhlt_put_gbl_table - Release the global NHLT table.
56 * acpi_nhlt_endpoint_match - Verify if an endpoint matches criteria.
72 (link_type < 0 || ep->link_type == link_type) && in acpi_nhlt_endpoint_match()
73 (dev_type < 0 || ep->device_type == dev_type) && in acpi_nhlt_endpoint_match()
74 (bus_id < 0 || ep->virtual_bus_id == bus_id) && in acpi_nhlt_endpoint_match()
75 (dir < 0 || ep->direction == dir); in acpi_nhlt_endpoint_match()
80 * acpi_nhlt_tb_find_endpoint - Search a NHLT table for an endpoint.
107 * acpi_nhlt_find_endpoint - Search all NHLT tables for an endpoint.
128 * acpi_nhlt_endpoint_find_fmtcfg - Search endpoint's formats configuration space
147 wav = &fmt->format; in acpi_nhlt_endpoint_find_fmtcfg()
149 if (wav->valid_bits_per_sample == vbps && in acpi_nhlt_endpoint_find_fmtcfg()
150 wav->samples_per_sec == rate && in acpi_nhlt_endpoint_find_fmtcfg()
151 wav->bits_per_sample == bps && in acpi_nhlt_endpoint_find_fmtcfg()
152 wav->channel_count == ch) in acpi_nhlt_endpoint_find_fmtcfg()
161 * acpi_nhlt_tb_find_fmtcfg - Search a NHLT table for a specific format.
201 * acpi_nhlt_find_fmtcfg - Search all NHLT tables for a specific format.
228 static bool acpi_nhlt_config_is_micdevice(struct acpi_nhlt_config *cfg) in acpi_nhlt_config_is_micdevice() argument
230 return cfg->capabilities_size >= sizeof(struct acpi_nhlt_micdevice_config); in acpi_nhlt_config_is_micdevice()
233 static bool acpi_nhlt_config_is_vendor_micdevice(struct acpi_nhlt_config *cfg) in acpi_nhlt_config_is_vendor_micdevice() argument
235 struct acpi_nhlt_vendor_micdevice_config *devcfg = __acpi_nhlt_config_caps(cfg); in acpi_nhlt_config_is_vendor_micdevice()
237 return cfg->capabilities_size >= sizeof(*devcfg) && in acpi_nhlt_config_is_vendor_micdevice()
238 cfg->capabilities_size == struct_size(devcfg, mics, devcfg->mics_count); in acpi_nhlt_config_is_vendor_micdevice()
242 * acpi_nhlt_endpoint_mic_count - Retrieve number of digital microphones for a PDM endpoint.
251 struct acpi_nhlt_config *cfg; in acpi_nhlt_endpoint_mic_count() local
254 if (!ep || ep->link_type != ACPI_NHLT_LINKTYPE_PDM) in acpi_nhlt_endpoint_mic_count()
255 return -EINVAL; in acpi_nhlt_endpoint_mic_count()
259 max_ch = max(fmt->format.channel_count, max_ch); in acpi_nhlt_endpoint_mic_count()
261 cfg = __acpi_nhlt_endpoint_config(ep); in acpi_nhlt_endpoint_mic_count()
262 devcfg = __acpi_nhlt_config_caps(cfg); in acpi_nhlt_endpoint_mic_count()
264 /* If @ep is not a mic array, fallback to channels count. */ in acpi_nhlt_endpoint_mic_count()
265 if (!acpi_nhlt_config_is_micdevice(cfg) || in acpi_nhlt_endpoint_mic_count()
266 devcfg->gen.config_type != ACPI_NHLT_CONFIGTYPE_MICARRAY) in acpi_nhlt_endpoint_mic_count()
269 switch (devcfg->mic.array_type) { in acpi_nhlt_endpoint_mic_count()
280 if (!acpi_nhlt_config_is_vendor_micdevice(cfg)) in acpi_nhlt_endpoint_mic_count()
281 return -EINVAL; in acpi_nhlt_endpoint_mic_count()
282 return devcfg->vendor_mic.mics_count; in acpi_nhlt_endpoint_mic_count()
285 pr_warn("undefined mic array type: %#x\n", devcfg->mic.array_type); in acpi_nhlt_endpoint_mic_count()