Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented May 5, 2023

Link: #7548

@kv2019i kv2019i requested review from juimonen, ranj063 and ujfalusi May 5, 2023 13:02
kv2019i added 2 commits May 5, 2023 16:48
If DMA is active, do not read data directly from the SSP
RX fifo.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
If DMA transaction is ongoing when RX enabled, this leads
to stuck communication between DMA and SSP.

To avoid this, flush the RX fifo before enabling SSP RX.

Link: thesofproject#7548
Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

for (i = 0; read_ssdr && i < entries + 1; i++)
/* read to try empty fifo */
ssp_read(dai, SSDR);
Copy link
Contributor

Choose a reason for hiding this comment

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

for readability I would be more explicit:

if (read_ssdr) {
	/* read to try empty fifo */
	for (i = 0; i < entries + 1; i++)
		ssp_read(dai, SSDR);
}

Copy link
Member

Choose a reason for hiding this comment

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

it's not just readability, there's no reason to test read_ssdr at every loop - though the compiler might be smart enough to move this up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in the mainline version #7577 -- will resubmit to stable-2.2 once merged.

@lgirdwood
Copy link
Member

@kv2019i still needed ?

@kv2019i kv2019i closed this Jul 12, 2023
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