-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
topology2: Mod cfg ibs obs cpc addition #7348
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 pls review
} | ||
Object.Widget.gain.1 { | ||
Object.Control.mixer.1 { | ||
name '2 Main Playback Volume' | ||
} | ||
Object.Base.mod_cfg.1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to use the .1
here, is it possible to use ."48k2cS16LE"
instead to describe the contents is a more human readable way ?
obs 3145 | ||
cpc 3178 | ||
} | ||
num_mod_cfgs 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this, the CC should count this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I was actually wondering why some widgets have explicitly set num_audio_formats and some doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some widgets support only 1 format, so they're set in teh class definition. Others support variable number of format based on tplg, so they're set in the top-level file
@ranj063 can help me out here? |
@jsarha the tplg is fine. but what you are missing is the parsing bits in the kernel. Take a look at how we parset multiple audio formats here: https://github.com/thesofproject/linux/blob/bef9852fe3228ce83717dada3ebcb7ad07c6099b/sound/soc/sof/topology.c#L1238 You need to allocate memory for "n" number of token sets first. And then parse the number of sets you're expecting like https://github.com/thesofproject/linux/blob/bef9852fe3228ce83717dada3ebcb7ad07c6099b/sound/soc/sof/ipc4-topology.c#L221 and then finally parse the tokens like https://github.com/thesofproject/linux/blob/bef9852fe3228ce83717dada3ebcb7ad07c6099b/sound/soc/sof/ipc4-topology.c#L257. Hope this helps |
e8ca6ee
to
8c7b123
Compare
8c7b123
to
5696d10
Compare
This should now be good. This introduces the mod_cfg class for all relevant widgets. However, this pr does not set any mod_cfg:s as such. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood, I have my own variant of this (looks similar and I think @jsarha based this on my wip). diff --git a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dai-copier-playback.conf b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dai-copier-playback.conf
index 48a9d62938c2..ec2e31a72d76 100644
--- a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dai-copier-playback.conf
+++ b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-dai-copier-playback.conf
@@ -17,6 +17,7 @@
#
<include/common/audio_format.conf>
+<include/common/mod_cfg.conf>
<include/components/copier.conf>
<include/components/gain.conf>
<include/components/mixout.conf>
@@ -76,6 +77,7 @@ Class.Pipeline."mixout-gain-dai-copier-playback" {
num_audio_formats 2
num_input_audio_formats 2
num_output_audio_formats 2
+ num_mod_cfgs 3
# 32-bit 48KHz 2ch
Object.Base.audio_format.1 {
@@ -91,6 +93,24 @@ Class.Pipeline."mixout-gain-dai-copier-playback" {
out_bit_depth 32
out_valid_bit_depth 32
}
+
+ Object.Base.mod_cfg.1 {
+ ibs 192
+ obs 256
+ cpc 1456
+ }
+
+ Object.Base.mod_cfg.2 {
+ ibs 384
+ obs 384
+ cpc 4242
+ }
+
+ Object.Base.mod_cfg.3 {
+ ibs 432
+ obs 256
+ cpc 2566
+ }
}
pipeline."1" { |
I still have some trouble in understanding the best ways to implement things in topology2, but I would like much more to have one place were we can define ibs/obs/cpc configurations for different platforms, than duplicating the module definitions for it. Could we have something like this: Class.Widget."copier" {
I have no idea if this would work, but it would be nice if it did 😅. @ranj063 can say if this approach could be made to work? |
Can one of the admins verify this patch? |
@jsarha Status? Please mark as draft if this is not intended for merging... |
This PR is good as such, but it does not contain the structures requested here: #7348 (comment) They could be implemented as separate PR. But maybe I'll mark this as draft as you requested and try to put all the pieces together. Then again I have no idea of any mod_cfg settings for any platform, so in the end there will not be any settings in the later PR either, just places for different platforms to put them. |
@jsarha So ack, so maybe we need to push this forward then. thesofproject/linux#4315 is close to merging on driver side, so adding @ujfalusi and @ranj063 to review. |
@jsarha yes adding it to the widget class definitions where they will be instantaited and used is probably better |
5696d10
to
5b6ef5b
Compare
New version pushed. This version should have what was requested in #7348 (comment) . Please check that I have added the placeholder and included it in actual component widgets. I already removed pipeline from them, but for many of them I have no idea what those entities are. |
Add mod_cfg class for ibs, obs, and cpc configuration triplets, and num_mod_cfg to indicate the number of configurations. The num_mod_cfg attribute is added to common widget attributes. Signed-off-by: Jyri Sarha <[email protected]>
Add widget-common-inc.conf as a common place to add include files for all components. Unlike widget-common.conf, this is included before the class definition starts. The initial content for the widget-common-inc.conf is <include/common/mod_cfg.conf> for adding mod_cfg class definition before to be used as a member in all component files or in widget-common.conf. The commit also adds <include/components/widget-common-inc.conf> in the beginning of the all component includes. Signed-off-by: Jyri Sarha <[email protected]>
Adds empty include files for all modules and platforms to place their mod_cfg objects in and includes them in the relevant widget class files. Only thing found in the files is a comment telling what these files are for. Signed-off-by: Jyri Sarha <[email protected]>
Hmm. The last commit does not work. I do not know if there is a way to instantiate mod_cfg objects already in widget class definition. |
Nope, this indeed does work. But only for targets that have PLATFROM variable set at compiler line. Generic targets, like sof-hda-generic.tplg, do not have any mod_cfg settings, but how could they, if the platform is not know at compile time. So, AFAICT this PR should be good. |
@jsarha conflicts? |
5b6ef5b
to
c3bd46e
Compare
Solved now. |
@@ -29,6 +29,12 @@ Class.Widget."asrc" { | |||
#include common component definition | |||
<include/components/widget-common.conf> | |||
|
|||
#include platform specific module configs for the asrc module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsarha is there value in this commit just yet? Can we not add the files as and when needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure we can. Just drop the last commit. It is all about interpreting this request #7348 (comment) .
Whether "Can we have?" is interpreted as if we can in theory or if the files should actually be added in practice. If it means in theory, then consider the last commit as a proof of concept.
Then again, adding them here and now would make it more likely that platform and component specific mod_cfgs files will be added in uniform way, following the same naming scheme for all the components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood Can you ack as this was an ask from you? I.e. to have the placeholders or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I agree add on demand.
- if want to add in this patch, I would suggest there is a folder to cover all component instead of directly under platform/intel/mod_cfg/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what is more likely, need to override values per platform, or per specific product, but in any case, this PR provides the necessary building blocks for both needs, so seems good.
@@ -29,6 +29,12 @@ Class.Widget."asrc" { | |||
#include common component definition | |||
<include/components/widget-common.conf> | |||
|
|||
#include platform specific module configs for the asrc module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood Can you ack as this was an ask from you? I.e. to have the placeholders or not.
Pushed forwards, and changes requested in mail, so turning to draft again. Girdwood, Liam R:
|
@jsarha now that the manifest and kernel CPC parts are working we should add the overide option for v2.7. |
We need to agree on the definition of 'working'. I still routinely see messages telling me that CPC is not set ? |
There are still a lot of holes in the manifest CPC data for each module and (format, rate, channels) configuration. @aiChaoSONG will be working on populating this prior to v2.7. This should fix the kernel warning messages for all tested configs. The toplogy part will use the same CPC schema and kernel logic/IPC, but will allow
|
I'd like to reach the point where all CPC data is valid in the manifest and used for something meaningful, before we plan work on overriding stuff. |
Need to do both in parallel, to be ready for mistakes in manifest CPC. |
we can't afford to hedge our bets for every single feature. The firmware team is responsible for providing correct CPC values, if they don't it's a bug and they fix it. |
CPC architecture is based on a single module unit test with no upstream/downstream module I$/D$ impact taken into consideration for module CPC performance delta when different pipeline topologies are used. This is not a big item and will be painful to modify/fix in manifest. |
In draft status, pushing to v2.9. |
# Object.Base.mod_cfg."0" { | ||
# ibs 384 | ||
# obs 384 | ||
# cpc 4600 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add comments here:
for ibs/obs, it is initialized as: 48 * 2 * 4 = 384, it is 48k LL with 2 channel 32 bit format.
for cpc, I am not sure how CPC figured out as instantiated value?
DefineAttribute."instance" { | ||
} | ||
|
||
# input buffer size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's give comments like:
ibs = (sample rate / (1000000/period)) * channels * valid_sample_width
# This file is for include files needed for widget-common.conf | ||
# | ||
<include/common/mod_cfg.conf> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not directly include mod_cfg.conf?
@@ -29,6 +29,12 @@ Class.Widget."asrc" { | |||
#include common component definition | |||
<include/components/widget-common.conf> | |||
|
|||
#include platform specific module configs for the asrc module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I agree add on demand.
- if want to add in this patch, I would suggest there is a folder to cover all component instead of directly under platform/intel/mod_cfg/
Stable-v2.9 branched, this didn't make the cut, bumping forward. @jsarha is this still valid (given bumps over multiple releases)? |
No activity in 2.7...2.9, clearing the milestone. |
I am feeling quite clueless here, so even if this does not work, I push this out in hope someone can spot the problem.
For some reason the widget tuple array only contains the first instance of mod_cfg objects in the topology2 conf file. I am trying to read the array out with this code: https://github.com/jsarha/linux-sof/tree/peter-cpc-test