Skip to content

Commit 4e06d57

Browse files
committed
DMIC: Fix mistake in comment and add check for supported word lengths
This patch fixes the mistake in uapi/ipc.h text comments that falsely claims that 24 bit data is supported. The supported PCM formats are 16 and 32 bits only. A check is added to DMIC set config function to return error if anything else is requested. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent a2cfd8c commit 4e06d57

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/drivers/dmic.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,18 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config)
11501150
goto finish;
11511151
}
11521152

1153+
if (prm->fifo_bits_a != 16 && prm->fifo_bits_a != 32) {
1154+
trace_dmic_error("fba");
1155+
ret = -EINVAL;
1156+
goto finish;
1157+
}
1158+
1159+
if (prm->fifo_bits_b != 16 && prm->fifo_bits_b != 32) {
1160+
trace_dmic_error("fbb");
1161+
ret = -EINVAL;
1162+
goto finish;
1163+
}
1164+
11531165
/* Match and select optimal decimators configuration for FIFOs A and B
11541166
* paths. This setup phase is still abstract. Successful completion
11551167
* points struct cfg to FIR coefficients and contains the scale value

src/include/uapi/ipc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ struct sof_ipc_dai_dmic_params {
329329
uint32_t fifo_fs_a; /* FIFO A sample rate in Hz (8000..96000) */
330330
uint32_t fifo_fs_b; /* FIFO B sample rate in Hz (8000..96000) */
331331
/* TODO: FIFO word lengths can be retrieved from SOF_DAI_FMT */
332-
uint16_t fifo_bits_a; /* FIFO A word length (16 or 24) */
333-
uint16_t fifo_bits_b; /* FIFO B word length (16 or 24) */
332+
uint16_t fifo_bits_a; /* FIFO A word length (16 or 32) */
333+
uint16_t fifo_bits_b; /* FIFO B word length (16 or 32) */
334334
uint16_t duty_min; /* Min. mic clock duty cycle in % (20..80) */
335335
uint16_t duty_max; /* Max. mic clock duty cycle in % (min..80) */
336336
uint32_t num_pdm_active; /* Number of active controllers */

0 commit comments

Comments
 (0)