Skip to content

DMIC: Support capture from different microphones for DAI 0 and 1 - #1432

Merged
jajanusz merged 2 commits into
thesofproject:masterfrom
singalsu:dmic_allow_different_dai_channels
May 16, 2019
Merged

jajanusz merged 2 commits into
thesofproject:masterfrom
singalsu:dmic_allow_different_dai_channels

Conversation

@singalsu

@singalsu singalsu commented May 14, 2019 •

Copy link
Copy Markdown
Collaborator

This patch allows to configure the two DMIC DAIs for different
used microphones, e.g. DAI 0 for 4ch and DAI 1 for 2ch capture.

The common decimator core is programmed for combined max. request
and the FIFOs are configured to match the desired microphones. In
case of not a possible configuration an error is returned.

Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com

@singalsu
singalsu requested a review from keyonjie May 14, 2019 16:50
@singalsu

singalsu commented May 14, 2019 •

Copy link
Copy Markdown
Collaborator Author

@keyonjie Can you please test this feature add for issue #1412. I've set this as [RFC][Do not merge] because I haven't completed all tests. I've also found one bug.

The bug in overlapping capture is such that if new capture uses less microphones than ongoing capture, the ongoing capture gets an error because the filter engine part to feed them date gets stopped. I need to improve the logic of dmic_start() function to be aware of shared decimator blocks.

Capture from e.g. 4ch FIFO A and 2 ch FIFO B should work with this if the capture tasks do not overlap.

Comment thread src/drivers/intel/cavs/dmic.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seppo, something like this?
swap[i] = (dmic_prm[0]->pdm[i].enable_mic_b || dmic_prm[1]->pdm[i].enable_mic_b) && !cnt;

@singalsu singalsu May 15, 2019 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's tricky but I'm leaning towards your proposal. I need to test these mono microphone scenarios to see which one is right. The FIR processes mono signal in left channel slot so right channel mono must be swapped to left channel. The swap is common for FIFO A and B paths so need to fail a conflicting request from topology.

@singalsu singalsu May 16, 2019 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this but I'm not able to test mono capture (created a mono dmic topology for it). The arecord -c 1 attempt fails in kernel driver before any request arrives to firmware. Could the new mux component convert captured mono to double-mono in a test topology to work around the apparent SOF ASoC limitation?

But since we do not have mono use case requirements I think it's safe to keep this as open.

@singalsu
singalsu force-pushed the dmic_allow_different_dai_channels branch from bea8320 to 0f04b7a Compare May 15, 2019 13:41
@singalsu

Copy link
Copy Markdown
Collaborator Author

I just updated this PR. This version survives my overlapping captures test, so there's no bugs known at the moment.

@wenqingfu

Copy link
Copy Markdown

I just updated this PR. This version survives my overlapping captures test, so there's no bugs known at the moment.

can you please update the title? it sounds not a RFC and DNM any more.

Comment thread src/drivers/intel/cavs/dmic.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace 4 with define?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it belongs then to dmic.h where the registers details are defined.

Comment thread src/drivers/intel/cavs/dmic.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break the loop?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would leave the stereo and swap arrays processing incomplete and add complexity & code size. I'd keep it as is since it's in most platforms just two iterations.

Comment thread src/drivers/intel/cavs/dmic.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also replace magic number.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep will be in dmic.h.

Comment thread src/drivers/intel/cavs/dmic.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally doesn't change anything, but better to check for ret < 0 for the error sake.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it's not increasing code size to do so.

@singalsu
singalsu force-pushed the dmic_allow_different_dai_channels branch from 0f04b7a to 221bac3 Compare May 16, 2019 10:29
@singalsu singalsu changed the title [RFC][Do not merge]DMIC: Support capture from different microphones f… DMIC: Support capture from different microphones for DAI 0 and 1 May 16, 2019
@singalsu

Copy link
Copy Markdown
Collaborator Author

I pushed an update after surviving my first tests. I'm continuing testing with variations of topology (correct and intentionally faulty ones) and will update this PR if I find issues.

@singalsu
singalsu requested review from keyonjie, lgirdwood and tlauda May 16, 2019 10:47
@singalsu

Copy link
Copy Markdown
Collaborator Author

Test topology "sof-apl-dmic-a2ch-b4ch.tplg" is a duplicate of other. I need to fix it to test such configuration. New PR coming...

@singalsu
singalsu force-pushed the dmic_allow_different_dai_channels branch from 221bac3 to bb33436 Compare May 16, 2019 11:11
@singalsu

Copy link
Copy Markdown
Collaborator Author

The wrong topology is now updated. I completed OK the tests with the topologies that this PR added.

@jajanusz jajanusz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'd preffer to have it in 2 commits, where 1 is adding new feature to FW and another is adding topologies that use it (if it's possible).

@singalsu

Copy link
Copy Markdown
Collaborator Author

@jajanusz I'll do the update, it's fast to do.

singalsu added 2 commits May 16, 2019 18:12
This patch allows to configure the two DMIC DAIs for different
used microphones, e.g. DAI 0 for 4ch and DAI 1 for 2ch capture.

The common decimator core is programmed for combined max. request
and the FIFOs are configured to match the desired microphones. In
case of not a possible configuration an error is returned.

The patch also cleans up the magic value of four that was used in
determining IPM bit fields setting.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The example and test topologies demonstrate new non-symmetrical
microphones/channels setup for capture via FIFOs A and B.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu force-pushed the dmic_allow_different_dai_channels branch from bb33436 to 89f947f Compare May 16, 2019 15:14
@jajanusz
jajanusz merged commit 6951af2 into thesofproject:master May 16, 2019
@singalsu
singalsu deleted the dmic_allow_different_dai_channels branch January 27, 2021 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants