Skip to content

Drivers: Intel: DMIC: Fix FW panic with multiple DAI capture, pausing, stopping and resuming - #4313

Merged
lgirdwood merged 3 commits into
thesofproject:mainfrom
singalsu:dmic_add_pause_tracking
Jun 8, 2021
Merged

lgirdwood merged 3 commits into
thesofproject:mainfrom
singalsu:dmic_add_pause_tracking

Conversation

@singalsu

@singalsu singalsu commented Jun 8, 2021

Copy link
Copy Markdown
Collaborator

No description provided.

This patch does not change any functionality. The mask is no more
signed value and cache_to_uncache() needs a multiple of 32 bit type.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu requested review from kv2019i, lyakh and ranj063 June 8, 2021 11:26

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some notes inline, but actual patch content looks good!

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is really problematic. There's no actual reference counting in cavs_pm_runtime_dis_dmic_clk_gating() and the "dai->index" passed to pm_runtime_put_sync() is just printed out.

The problem is that if we switch to pm_runtime_put_sync() that actual does refcounting, this code will break. FYI @lgirdwood @lyakh @marc-hb

Oh well, this goes beyond this PR's scope.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets get the ref counting in the PM code. This PM code should also be able to transfer to Zephyr with minimal refactoring.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it looks like we may need some locking around the mask manipulations .

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 added 3rd commit about spinlocks. I was testing spinlock add in dmic_remove() but it froze. It turned out that dai_put() had already applied spinlock. I also found out that the registers write function was already covered by spinlock in set_config() so the patch adds only comments about spinlocks applied.

singalsu added 2 commits June 8, 2021 19:30
This patch fixes an FW panic that could be triggered by multiple
DMIC DAI capture when pausing, stopping, and resuming. A sequence like
this crashed in last operation

start capture on dmic0, dmic1
pause 0
stop 1
resume 0

It was caused by dmic_remove() for dmic1 that issued pm_runtime_put_sync()
for DMIC clock and power, and freed the dmic_prm[] that resume for 0
needed.

commit 282fe22 ("dmic: fix pause/release error leading to invalid
dmic_active_fifos") solved the panic but left the HW start/stop sequence
details incorrect.

commit 73e6a6f ("Driver: Intel: DMIC: Remove state check from
active FIFO mask update") re-introduced the FW panic issue in multiple
DAI capture.

This should be a proper quick fix for pause handling. A successive
patch will clean up the DMIC component data and do this in a nicer
looking way.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds comments to code parts about spinlocks applied
elsewhere to avoid confusion.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu force-pushed the dmic_add_pause_tracking branch from 7002534 to 96e144e Compare June 8, 2021 17:12
@singalsu

singalsu commented Jun 8, 2021

Copy link
Copy Markdown
Collaborator Author

I just updated the PR: Added pause_mask clear to dmic_stop() in case it was called to stop without pause. A typo was fixed. Also added comments about spinlocks applied. Thanks for help with these @ranj063!

@singalsu
singalsu requested review from kv2019i and ranj063 June 8, 2021 17:20
@ranj063

ranj063 commented Jun 8, 2021

Copy link
Copy Markdown
Collaborator

looks good. Thanks @singalsu

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets fix the PM reference counting incrementally.

@lgirdwood
lgirdwood merged commit b634aeb into thesofproject:main Jun 8, 2021
@singalsu
singalsu deleted the dmic_add_pause_tracking branch June 15, 2021 08:14
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.

4 participants