Skip to content

ERS DAI: Echo Reference Signal DAI and DMA implementation. - #1652

Closed
akloniex wants to merge 2 commits into
thesofproject:masterfrom
akloniex:ERS
Closed

akloniex wants to merge 2 commits into
thesofproject:masterfrom
akloniex:ERS

Conversation

@akloniex

Copy link
Copy Markdown
Member

Implementation of virtual DAI and DMA dedicated for echo reference signal capture.

@akloniex akloniex added the ABI ABI change involved label Jul 18, 2019
@akloniex
akloniex requested review from a team, bardliao, bkokoszx and xiulipan as code owners July 18, 2019 13:26
@jajanusz

Copy link
Copy Markdown
Contributor

Needs #1635

@jajanusz

Copy link
Copy Markdown
Contributor

@akloniex Assigning to ABI MINOR 9 atm

@tlauda

tlauda commented Jul 18, 2019

Copy link
Copy Markdown
Contributor

@akloniex Could you describe how should the pipeline look like, what exactly does this dai do, why do we need additional DMA etc?

In order to allow multiple callbacks registered to single buffer
component, buffer_callback structure is created and list of callbacks
nested into comp_buffer.

Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
@akloniex
akloniex force-pushed the ERS branch 2 times, most recently from 828c159 to a483656 Compare July 19, 2019 07:56
@akloniex

Copy link
Copy Markdown
Member Author

@tlauda The main reason for creation of new DMA type is to provide continuous signal as echo reference, even when there is no playback running. In such case, ers-dma generates zeros at steady rate and pushed ers dai forward.
With previous implementation of echo reference, based on demux component, 2 pipelines were connected together, with echo pipe being dailess, which rendered it impossible to generate silence as output.

Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
@tlauda

tlauda commented Jul 22, 2019

Copy link
Copy Markdown
Contributor

@akloniex @mmaka1 @lbetlej
I have concerns about adding the new DAI and DMA. DAI isn't really doing anything and DMA is "fake", but it's on the same list of platform's DMAs. Also it's not really flexible, because the naming suggests usage only for echo reference and the whole scheduling logic is inside DMA.
In my opinion adding additional "Virtual DAI" as audio component would be a better idea. The functionality would be the same. Scheduling would be set to timer, so no additional work here. Such component could be easily used in any other scenario e.g. probe with no additional implementations needed.

@akloniex

Copy link
Copy Markdown
Member Author

@tlauda
My intention was to make DAI reusable for probes and possibly other future features, but I ran short on names for things up my sleeve, so went the easy route of naming it as feature it was initially developed for. And naming it 'virtual' sounded very vague for me, so didn't decide to go with that name.
Nevertheless, if I understand correctly, your concern about DAI is mostly about it's name, not it's behaviour.
As for DMA, I believe that having it along with 'real' DMAs adds to consistency of the code, and in the long run should do more good than harm. Even though it doesn't represent any hardware behind it, from user point of view it behaves like one. Also, it shouldn't be able to choose by mistake, as it has unique supported device to connect to, which excludes it from dma_get() calls which don't request this type explicitly.

@tlauda

tlauda commented Jul 23, 2019

Copy link
Copy Markdown
Contributor

@akloniex I haven't yet checked the DMA implementation itself. Wanted to start with the most basic thing, which is the structure and the location of the code. I fully understand the reasoning behind reusing DAI component and extracting the new functionality to DMA layer, but I just don't think it's the way to go in this particular case. There is nothing outstanding you need from the DAI's implementation and I would even say, that it adds complexity to your code, since you need to call different type of callbacks, take dma_sg_array etc.

@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.

This should be split up into a patch per change/feature with commit messages. I've no idea what this is trying to achieve.

* of the callback.
*
* BUFF_CB_TYPE_PRODUCE - uint32_t* pointing to amount of bytes produced
* BUFF_CB_TYPE_CONSUME - uint32_t* pointing to amount of bytes consumed

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.

I've just reviewed this in another PR ???

Comment thread src/audio/dai.c
dd->chan = DMA_CHAN_INVALID;
}
break;
case SOF_DAI_INTEL_ERS:

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.

I dont think echo reference has anything Intel specific about it so it should be SOF_DAI_ECHO_REF

add_local_sources(sof
hda-dma.c
hda.c
ers.c

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.

ers -> echo_ref makes it easier to find and search.

pdata->cb(pdata->cb_data, DMA_CB_TYPE_IRQ, NULL);

// reschedule
return 1000;

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.

This seem hard coded to 1ms ?

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.

oh and C style comment please


/* if we're falling behind too much, attempt to catch up */
if (pdata->src_data_size >= *avail * pdata->elem_array->count)
*avail *= 2;

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.

Shouldn't we tell the user here via some trace ?

return -ENODEV;
}

dai->plat_data.fifo[1].handshake = (uintptr_t)comp->cb;

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.

are we casting a callback pointer to a handshake ? Please find a better way of doing this, it's a HACK.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@lgirdwood comp in this context is ipc_comp_dev*, so comp->cb refers to comp_buffer pointer, not callback function. In this case buffer component is being passed as src_dev to dma, during dma_set_config call.
If you think that it's still too hacky, then I could try to find a better way to pass this pointer to dma.

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.

yep, too hacky. please find a better way.

pm_runtime_put_sync(SSP_CLK, dai->index);

rfree(dma_get_drvdata(dai));
rfree(dai_get_drvdata(dai));

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.

Looks like a separate PR is needed for this bug fix. Good find. May also need done on other SSP drivers.

Comment thread src/include/sof/lib/dma.h
#define DMA_CAP_HDA BIT(0) /**< HDA DMA */
#define DMA_CAP_GP_LP BIT(1) /**< GP LP DMA */
#define DMA_CAP_GP_HP BIT(2) /**< GP HP DMA */
#define DMA_CAP_BUF_CP BIT(3) /**< Buffer copier DMA */

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.

Why is this special and needs it's own CAP ?

Comment thread src/include/user/trace.h
#define TRACE_CLASS_SCHEDULE_LL (31 << 24)
#define TRACE_CLASS_SOUNDWIRE (32 << 24)
#define TRACE_CLASS_KEYWORD (33 << 24)
#define TRACE_CLASS_ERS (34 << 24)

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.

This looks like it should be a separate patch.

#define DMA_HOST_OUT_DMAC 5
#define DMA_LINK_IN_DMAC 6
#define DMA_LINK_OUT_DMAC 7
#define DMA_ERS_DMAC 8

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.

I'm really not following why this needs it's own DMAC ?

@jajanusz

jajanusz commented Aug 1, 2019 •

Copy link
Copy Markdown
Contributor

@akloniex Please resolve conflicts. Also there came at least 1 new dma ops that you need to add - get_attribute.

@lgirdwood

Copy link
Copy Markdown
Member

@akloniex any update ?

@lbetlej

lbetlej commented Jan 27, 2020

Copy link
Copy Markdown
Collaborator

@akloniex What are your plans regarding PR ? Do you agree to close it ?

@akloniex

Copy link
Copy Markdown
Member Author

@lgirdwood @lbetlej I'm currently working on rebasing these changes and getting them back and running, but on a 2nd priority, after Probes. We could close this PR and open new one once I get it up, or we can keep it open and I'll just update it.

@lgirdwood

Copy link
Copy Markdown
Member

@akloniex lets say v1.6 then. We can leave it open to keep it in ABI tracker

@jajanusz

Copy link
Copy Markdown
Contributor

@akloniex Looks like stalled PR. Can I close it?

@paulstelian97

Copy link
Copy Markdown
Collaborator

@akloniex Looks like stalled PR. Can I close it?

Activity in related PRs today (the optional Xrun things)

@akloniex akloniex closed this Mar 26, 2020
@akloniex
akloniex deleted the ERS branch May 27, 2020 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ABI ABI change involved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants