DMIC: Set DAI parameters from topology parameters instead of hardwired

This patch enables the 1, 2, and 4ch topologies usage with S32_LE and
S16_LE sample formats. The DMA burst length is also changed to maximum
(8) to fully utilize the DMIC FIFO.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2018-06-20 19:07:58 +03:00 committed by Liam Girdwood
parent 860280d115
commit be4bf56169
2 changed files with 34 additions and 4 deletions

View File

@ -645,9 +645,39 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
}
break;
case SOF_DAI_INTEL_DMIC:
/* TODO: No hardwired values here. */
dd->config.burst_elems = 2;
dev->frame_bytes = 8;
/* The frame bytes setting follows only FIFO A setting in
* this DMIC driver version.
*/
trace_dai("did");
/* We can use always the largest burst length. */
dd->config.burst_elems = 8;
/* Set frame size in bytes to match the configuration. */
if (config->dmic.num_pdm_active > 1) {
/* For two or more controllers capture from each
* controller must be stereo.
*/
dev->frame_bytes = 2 * config->dmic.num_pdm_active *
config->dmic.fifo_bits_a >> 3;
} else {
/* For one controller the capture can be mono or
* stereo. In mono configuration only one of mic A or B
* is enabled.
*/
if (config->dmic.pdm[0].enable_mic_a +
config->dmic.pdm[0].enable_mic_b == 1)
dev->frame_bytes =
config->dmic.fifo_bits_a >> 3;
else
dev->frame_bytes = 2 *
config->dmic.fifo_bits_a >> 3;
}
trace_value(config->dmic.fifo_bits_a);
trace_value(config->dmic.num_pdm_active);
trace_value(config->dmic.pdm[0].enable_mic_a);
trace_value(config->dmic.pdm[0].enable_mic_b);
trace_value(dev->frame_bytes);
break;
default:
/* other types of DAIs not handled for now */

View File

@ -828,7 +828,7 @@ static int configure_registers(struct dai *dai, struct dmic_configuration *cfg,
int array_b = 0;
int cic_mute = 1;
int fir_mute = 1;
int bfth = 1; /* Should be 3 for 8 entries, 1 is 2 entries */
int bfth = 3; /* Should be 3 for 8 entries, 1 is 2 entries */
int th = 0; /* Used with TIE=1 */
/* Normal start sequence */