/* find max number of channels based on format_configuration */ if (fmt_configs->fmt_count) { struct nhlt_fmt_cfg *fmt_cfg = fmt_configs->fmt_config;
dev_dbg(dev, "found %d format definitions\n",
fmt_configs->fmt_count);
for (i = 0; i < fmt_configs->fmt_count; i++) { struct wav_fmt_ext *fmt_ext;
fmt_ext = &fmt_cfg->fmt_ext;
if (fmt_ext->fmt.channels > max_ch)
max_ch = fmt_ext->fmt.channels;
/* Move to the next nhlt_fmt_cfg */
fmt_cfg = (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps +
fmt_cfg->config.size);
}
dev_dbg(dev, "max channels found %d\n", max_ch);
} else {
dev_dbg(dev, "No format information found\n");
}
if (cfg->device_config.config_type != NHLT_CONFIG_TYPE_MIC_ARRAY) {
dmic_geo = max_ch;
} else { switch (cfg->array_type) { case NHLT_MIC_ARRAY_2CH_SMALL: case NHLT_MIC_ARRAY_2CH_BIG:
dmic_geo = MIC_ARRAY_2CH; break;
case NHLT_MIC_ARRAY_4CH_1ST_GEOM: case NHLT_MIC_ARRAY_4CH_L_SHAPED: case NHLT_MIC_ARRAY_4CH_2ND_GEOM:
dmic_geo = MIC_ARRAY_4CH; break; case NHLT_MIC_ARRAY_VENDOR_DEFINED:
cfg_vendor = (struct nhlt_vendor_dmic_array_config *)cfg;
dmic_geo = cfg_vendor->nb_mics; break; default:
dev_warn(dev, "%s: undefined DMIC array_type 0x%0x\n",
__func__, cfg->array_type);
}
if (dmic_geo > 0) {
dev_dbg(dev, "Array with %d dmics\n", dmic_geo);
} if (max_ch > dmic_geo) {
dev_dbg(dev, "max channels %d exceed dmic number %d\n",
max_ch, dmic_geo);
}
}
}
dev_dbg(dev, "dmic number %d max_ch %d\n", dmic_geo, max_ch);
epnt = (struct nhlt_endpoint *)nhlt->desc; for (i = 0; i < nhlt->endpoint_count; i++) { if (epnt->linktype == NHLT_LINK_SSP && epnt->device_type == device_type) { /* for SSP the virtual bus id is the SSP port */
ssp_mask |= BIT(epnt->virtual_bus_id);
}
epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
}
int intel_nhlt_ssp_mclk_mask(struct nhlt_acpi_table *nhlt, int ssp_num)
{ struct nhlt_endpoint *epnt; struct nhlt_fmt *fmt; struct nhlt_fmt_cfg *cfg; int mclk_mask = 0; int i, j;
if (!nhlt) return 0;
epnt = (struct nhlt_endpoint *)nhlt->desc; for (i = 0; i < nhlt->endpoint_count; i++) {
/* we only care about endpoints connected to an audio codec over SSP */ if (epnt->linktype == NHLT_LINK_SSP &&
epnt->device_type == NHLT_DEVICE_I2S &&
epnt->virtual_bus_id == ssp_num) {
/* * In theory all formats should use the same MCLK but it doesn't hurt to * double-check that the configuration is consistent
*/ for (j = 0; j < fmt->fmt_count; j++) {
u32 *blob; int mdivc_offset; int size;
/* first check we have enough data to read the blob type */ if (cfg->config.size < 8) return -EINVAL;
/* * When looking for exact match of configuration ignore the vbps * from NHLT table when ignore_vbps is true
*/ if (wfmt->channels == num_ch && wfmt->samples_per_sec == rate &&
(ignore_vbps || vbps == _vbps) && bps == _bps) return &cfg->config;
dev_dbg(dev, "Looking for configuration:\n");
dev_dbg(dev, " vbus_id=%d link_type=%d dir=%d, dev_type=%d\n",
bus_id, link_type, dir, dev_type); if (link_type == NHLT_LINK_DMIC && bps == 32 && (vbps == 24 || vbps == 32)) { /* * The DMIC hardware supports only one type of 32 bits sample * size, which is 24 bit sampling on the MSB side and bits[1:0] * are used for indicating the channel number. * It has been observed that some NHLT tables have the vbps * specified as 32 while some uses 24. * The format these variations describe are identical, the * hardware is configured and behaves the same way. * Note: when the samples assumed to be vbps=32 then the 'noise' * introduced by the lower two bits (channel number) have no * real life implication on audio quality.
*/
dev_dbg(dev, " ch=%d fmt=%d rate=%d (vbps is ignored for DMIC 32bit format)\n",
num_ch, bps, rate);
ignore_vbps = true;
} else {
dev_dbg(dev, " ch=%d fmt=%d/%d rate=%d\n", num_ch, vbps, bps, rate);
}
dev_dbg(dev, "Endpoint count=%d\n", nhlt->endpoint_count);
epnt = (struct nhlt_endpoint *)nhlt->desc;
for (i = 0; i < nhlt->endpoint_count; i++) { if (nhlt_check_ep_match(dev, epnt, bus_id, link_type, dir, dev_type)) {
fmt = (struct nhlt_fmt *)(epnt->config.caps + epnt->config.size);
int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt,
u8 virtual_bus_id)
{ struct nhlt_endpoint *epnt; int i;
if (!nhlt) {
dev_err(dev, "%s: NHLT table is missing (query for SSP%d)\n",
__func__, virtual_bus_id); return -EINVAL;
}
epnt = (struct nhlt_endpoint *)nhlt->desc; for (i = 0; i < nhlt->endpoint_count; i++) { /* for SSP link the virtual bus id is the SSP port number */ if (epnt->linktype == NHLT_LINK_SSP &&
epnt->virtual_bus_id == virtual_bus_id) {
dev_dbg(dev, "SSP%d: dev_type=%d\n", virtual_bus_id,
epnt->device_type); return epnt->device_type;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.