Skip to content

Commit d457a6a

Browse files
singalsukartben
authored andcommitted
Drivers: DAI: Intel: DMIC: Program start symmetrically for PDMx
This change is assumed to fix the random corruption of 4ch capture for PDM1 channels 3-4 in PTL platform. There are no solid facts behind this change but assumption that PDMx controllers are not in sync if the start sequence for PDM1 is further away from PDM0. The PDM0 internal state may be different from PDM1 The single for loop to handle the CIC and FIR start sequence is split into two for loops to handle same registers update tasks symmetrically for all stereo PDM controllers. E.g. two PDMs for four microphones. First loop programs the CIC_CONTROL and MIC_CONTROL registers of the PDMx controllers. These features belong to the CIC block in DMIC IP. Second loop programs the FIR_CONTROL registers of the PDMx controllers. In a stress test of 100 times repeated commands: arecord -Dhw:0,6 -fS32_LE -r48000 -c4 -d 10 dmic_test_1.wav; \ sleep 0.5; \ arecord -Dhw:0,6 -fS32_LE -r48000 -c4 -d 10 dmic_test_2.wav; \ sleep 1 The corruption occurrence with xt-clang build was e.g. 87/200 fails in one of wav files giving 43.5% occurrence. The test was done with Zephyr commit fe29c40 ("llext: add inspection API test suite"). In a gcc build the occurrence of corruption is lower, around 6% but it is seen that the channels 3-4 pdm1 are swapping randomly. With this fix the corruption occurred zero times in xt-clang and gcc builds with same 100 repeats. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent cb07e99 commit d457a6a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/dai/intel/dmic/dmic.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ static void dai_dmic_start(struct dai_intel_dmic *dmic)
552552
for (i = 0; i < CONFIG_DAI_DMIC_HW_CONTROLLERS; i++) {
553553
mic_a = dmic->enable[i] & 1;
554554
mic_b = (dmic->enable[i] & 2) >> 1;
555-
start_fir = dmic->enable[i] > 0;
556555

557556
/* If both microphones are needed start them simultaneously
558557
* to start them in sync. The reset may be cleared for another
@@ -585,7 +584,10 @@ static void dai_dmic_start(struct dai_intel_dmic *dmic)
585584
MIC_CONTROL_PDM_EN_B,
586585
FIELD_PREP(MIC_CONTROL_PDM_EN_B, 1));
587586
}
587+
}
588588

589+
for (i = 0; i < CONFIG_DAI_DMIC_HW_CONTROLLERS; i++) {
590+
start_fir = dmic->enable[i] > 0;
589591
dai_dmic_update_bits(dmic, dmic_base[i] + FIR_CHANNEL_REGS_SIZE *
590592
dmic->dai_config_params.dai_index + FIR_CONTROL,
591593
FIR_CONTROL_START,

0 commit comments

Comments
 (0)