diff --git a/src/drivers/intel/cavs/dmic.c b/src/drivers/intel/cavs/dmic.c index 05074921806d..7b2352126012 100644 --- a/src/drivers/intel/cavs/dmic.c +++ b/src/drivers/intel/cavs/dmic.c @@ -1147,9 +1147,7 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) * "prm" is initialized with default params for all HW controllers */ if (!dmic_prm[0]) { - size = sizeof(struct sof_ipc_dai_dmic_params) - + DMIC_HW_CONTROLLERS - * sizeof(struct sof_ipc_dai_dmic_pdm_ctrl); + size = sizeof(struct sof_ipc_dai_dmic_params); dmic_prm[0] = rzalloc(SOF_MEM_ZONE_SYS_RUNTIME, 0, SOF_MEM_CAPS_RAM, DMIC_HW_FIFOS * size); @@ -1162,11 +1160,11 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) ((uint8_t *)dmic_prm[i - 1] + size); } - /* Copy the new DMIC params to persistent. The last request - * determines the parameters. + /* Copy the new DMIC params header (all but not pdm[]) to persistent. + * The last arrived request determines the parameters. */ ret = memcpy_s(dmic_prm[di], sizeof(*dmic_prm[di]), &config->dmic, - sizeof(struct sof_ipc_dai_dmic_params)); + offsetof(struct sof_ipc_dai_dmic_params, pdm)); assert(!ret); /* copy the pdm controller params from ipc */ diff --git a/src/include/ipc/dai-intel.h b/src/include/ipc/dai-intel.h index e57afd09d1c6..a9628b820071 100644 --- a/src/include/ipc/dai-intel.h +++ b/src/include/ipc/dai-intel.h @@ -57,6 +57,9 @@ /* bclk idle */ #define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_IDLE_HIGH BIT(5) +/* DMIC max. four controllers for eight microphone channels */ +#define SOF_DAI_INTEL_DMIC_NUM_CTRL 4 + /* SSP Configuration Request - SOF_IPC_DAI_SSP_CONFIG */ struct sof_ipc_dai_ssp_params { uint32_t reserved0; @@ -143,7 +146,7 @@ struct sof_ipc_dai_dmic_pdm_ctrl { * version number used in configuration data is checked vs. version used by * device driver src/drivers/dmic.c need to match. It is incremented from * initial value 1 if updates done for the to driver would alter the operation - * of the microhone. + * of the microphone. * * Note: The microphone clock (pdmclk_min, pdmclk_max, duty_min, duty_max) * parameters need to be set as defined in microphone data sheet. E.g. clock @@ -168,6 +171,7 @@ struct sof_ipc_dai_dmic_pdm_ctrl { * met. The unit for both is microseconds (us). Exceed of 100 ms will be * treated as an error. */ + struct sof_ipc_dai_dmic_params { uint32_t reserved0; uint32_t driver_ipc_version; /**< Version (1..N) */ @@ -178,12 +182,13 @@ struct sof_ipc_dai_dmic_params { uint32_t fifo_fs; /**< FIFO sample rate in Hz (8000..96000) */ uint32_t reserved_1; /**< Reserved */ uint16_t fifo_bits; /**< FIFO word length (16 or 32) */ - uint16_t reserved_2; /**< Reserved */ + uint16_t fifo_bits_b; /**< Deprecated since firmware ABI 3.0.1 */ uint16_t duty_min; /**< Min. mic clock duty cycle in % (20..80) */ uint16_t duty_max; /**< Max. mic clock duty cycle in % (min..80) */ - uint32_t num_pdm_active; /**< Number of active pdm controllers */ + uint32_t num_pdm_active; /**< Number of active pdm controllers. */ + /**< Range is 1..SOF_DAI_INTEL_DMIC_NUM_CTRL */ uint32_t wake_up_time; /**< Time from clock start to data (us) */ uint32_t min_clock_on_time; /**< Min. time that clk is kept on (us) */ @@ -192,8 +197,8 @@ struct sof_ipc_dai_dmic_params { /* reserved for future use */ uint32_t reserved[5]; - /**< variable number of pdm controller config */ - struct sof_ipc_dai_dmic_pdm_ctrl pdm[0]; + /**< PDM controllers configuration */ + struct sof_ipc_dai_dmic_pdm_ctrl pdm[SOF_DAI_INTEL_DMIC_NUM_CTRL]; } __attribute__((packed)); #endif /* __IPC_DAI_INTEL_H__ */