Skip to content

Conversation

@juimonen
Copy link

Currently all process (effect) component parameters are set with binary
blobs. This makes sense with eq's and such where parameters are highly
varying in size and readability. So make sof mux/demux component to use
tuples as an example of a component having complex parameter structure.
This makes it easier to setup new mux parameters from topology.

Signed-off-by: Jaska Uimonen jaska.uimonen@linux.intel.com

@juimonen
Copy link
Author

driver counterpart: thesofproject/linux#1758

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

Good find, btw how do we deal with backwards compatibility ?

@juimonen
Copy link
Author

juimonen commented Feb 1, 2020

@lgirdwood If I understand my own code correctly (which is not the case always), this PR and and driver counterpart should be "transparent" to old binary blob and new tuples way at least with demux. So kernel is parsing the tuples but sending it as binary blob to FW. So currently there isn't a particular ipc struct for mux, it is still sent with process (effect) ipc struct.

@lgirdwood
Copy link
Member

@juimonen ok. CI also looks good.
@ranj063 @jajanusz any inputs ?

@juimonen
Copy link
Author

juimonen commented Feb 3, 2020

@lgirdwood let's keep this still as RFC for a while...I'd like yours and others comments about the current mux/demux structs, which would be replicated in kernel side... There are now arrays, of which the size is varying depending on platform. Also there are uint8_t for channels and uint32_t for pipeline_id's. Are we going to have like 2 million pipelines?. In kernel/driver side we have ready parsing mostly for uint16 and uint32. So could we just fix the array sizes with max channel count and streamline the variable sizes to uint16 and uin32?

@lgirdwood
Copy link
Member

@juimonen pipe and comp id needs the headroom afforded by 32bits, since we will be using the large size to partition the DSP into logical zones, say for different VM guests, safety critical, multi clients, etc

@ranj063
Copy link
Collaborator

ranj063 commented Feb 3, 2020

@juimonen sorry it took me a while to understand the problem here. The general direction is correct here but there's a more elegant way to add the mux_stream_data_1/2. Please take a look at the PDM_CONFIG() macro used for DMIC_CONFIG. If you look at the conf file, what you'll see is that you have 2 sets of PDM tuples as below. Can you please follow that example?

SectionVendorTuples."DAICONFIG.DMIC0_pdm_tuples" {
        tokens "sof_dmic_pdm_tokens"
        tuples."short.pdm0" {
                SOF_TKN_INTEL_DMIC_PDM_CTRL_ID          "0"
                SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable     "1"
                SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable     "1"
                SOF_TKN_INTEL_DMIC_PDM_POLARITY_A       "0"
                SOF_TKN_INTEL_DMIC_PDM_POLARITY_B       "0"
                SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE "0"
                SOF_TKN_INTEL_DMIC_PDM_SKEW             "0"
        }

        tuples."short.pdm1" {
                SOF_TKN_INTEL_DMIC_PDM_CTRL_ID          "1"
                SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable     "1"
                SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable     "1"
                SOF_TKN_INTEL_DMIC_PDM_POLARITY_A       "0"
                SOF_TKN_INTEL_DMIC_PDM_POLARITY_B       "0"
                SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE "0"
                SOF_TKN_INTEL_DMIC_PDM_SKEW             "0"
        }


}

@juimonen
Copy link
Author

juimonen commented Feb 4, 2020

@ranj063 yes if you look at muxdemux.m4 in this PR, at least to me it looks exactly like the method used in dmic, so using list to add variable amount of tuples arrays. Did you meant something else?

@lgirdwood yes the 32 bit pipeline_id is fine, I meant streamlining the struct so that other members are also uin16 or uint32 so that parsing is easier and we avoid most packing issues. I don't think we help the ipc by defining all types as small as possible? Also I don't like the variable array length based on platform, will look really ugly if exported to kernel side...

@juimonen
Copy link
Author

juimonen commented Feb 4, 2020

@lgirdwood ok, seems that the demux interface is about to change with other current sof PR's, so my rant about the types in demux structs can be ignored. I can modify this PR when the new interface is clear so we would have good topology support.

@ranj063
Copy link
Collaborator

ranj063 commented Feb 4, 2020

@ranj063 yes if you look at muxdemux.m4 in this PR, at least to me it looks exactly like the method used in dmic, so using list to add variable amount of tuples arrays. Did you meant something else?

@juimonen yes your PR does something similar to the DMIC but in the case of DMIC, you can clearly tell that there are 2 sets of PDM tuple arrays because they are right next to each other with pdm0 and pdm1. Whereas in your case, its hard to tell if there one or more.

@juimonen
Copy link
Author

juimonen commented Feb 4, 2020

@ranj063 yes as I understand how the mux/demux works, you can have 1-8 stream configs so variable amount. It should be clear from sof-demux-pcm521x that we are using 2 arrays for this case. Compared to dmic, the arrays are just defined 1 level up, as it can be something between 1-8 (or actually varying from 1-4 or 1-8 depending on platform) depending how you are connecting the mux.

Currently all process (effect) component parameters are set with binary
blobs. This makes sense with eq's and such where parameters are highly
varying in size and readability. So make sof mux/demux component to use
tuples as an example of a component having complex parameter structure.
This makes it easier to setup new mux parameters from topology.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
@juimonen
Copy link
Author

updated to use channel map, driver counterpart thesofproject/linux#1800
some channel map values are bogus, but you can see how to use tokens for this...and from driver side PR you can see how painful it is to parse these in kernel.

@lgirdwood
Copy link
Member

@ranj063 @bkokoszx any comments on this ?

@juimonen
Copy link
Author

@lgirdwood I think @plbossart has an effort to change all ipc structs with var arrays to non-var arrays... So not sure what will happen to the channel_map struct used here. I wanted to made this PR to show how to do the multiple arrays with topology as this is even more complicated as dmic pdm.

Anyway if @ranj063 checks this out we could polish the topology parts. Also the bit mask value in channel_map and the Q-format coeffs make the topology still quite "mysterious" as there's no very nice way of describing them.

@lgirdwood
Copy link
Member

@juimonen lets collate all these IPC problems and add to the feature request for IPC2.0. This will allow us to track all the opens we have and align on how to fix.

define(`N_MUXDEMUX', `MUXDEMUX'PIPELINE_ID`.'$1)

dnl W_MUXDEMUX(name, mux/demux, format, periods_sink, periods_source, kcontrol_list)
dnl CH_MAP_COEFF(coeff)
Copy link
Collaborator

Choose a reason for hiding this comment

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

id, coeff?

Copy link
Author

Choose a reason for hiding this comment

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

yes


dnl CH_MAP(name, id, ext_id, mask)
define(`CH_MAP',
` tuples."word.$1" {'
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you mean $1 here? or $2?

Copy link
Author

Choose a reason for hiding this comment

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

so as I understand the $1 is like "name". So it should be the same "name" meaning in both CH_MAP and CHMAP_COEFF as we have actual "id" token member in the other... goes quite confusing otherwise. I'm not totally sure what is actually the meaning of this "word.xxx" syntax, can we actually parse/see that in driver/kernel side? So I copied this from your dmic pdm...

SOF_TKN_CHANNEL_MAP_INDEX "1401"
SOF_TKN_CHANNEL_MAP_EXT_ID "1402"
SOF_TKN_CHANNEL_MAP_MASK "1403"
SOF_TKN_CHANNEL_MAP_COEFF "1404"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am confused by this too. This suggests that sof_ch_map_tokens contains exactly one channel_map_coeff but there could be multiple ones no?

Copy link
Author

Choose a reason for hiding this comment

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

well it is just the token id for coeff. Yes there can be var array of coeffs in var array of ch_maps (which are in stream map struct). I made an example in sof side with 2 ch_maps with 2 coeffs each...

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will also split the coeff into a separate set of tokens just like you've done in your linux PR

Copy link
Author

Choose a reason for hiding this comment

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

sorry I didn't get what you mean here..?

Copy link
Member

Choose a reason for hiding this comment

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

Can you comment the tokens too - we should really be doing this for all tokens.


dnl CH_MAP(name, id, ext_id, mask)
define(`CH_MAP',
` tuples."word.$1" {'
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing tokens "sof_chmap_tokens"?

Copy link
Author

Choose a reason for hiding this comment

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

it is included in _mux_data_tuples_w which has the tokens "sof_chmap_tokens"... should I do it somehow differently?

}

SectionVendorTokens."sof_chmap_tokens" {
SOF_TKN_STREAM_MAP_NUM_CH_MAPS "1400"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this has to be split into a separate token maybe called sof_mux_demux_token

Copy link
Author

Choose a reason for hiding this comment

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

I mean sure... So what is the reasoning for this? It could be that the channel maps etc are used elsewhere also than demux only. I mean maybe it would be somehow more clear, but basically we are defining the "parse unit" in the kernel side tuples array definitions, so that could easily combine tuple id's all over and no one would notice...

@lgirdwood lgirdwood closed this Mar 28, 2021
@lgirdwood lgirdwood deleted the branch thesofproject:master March 28, 2021 13:44
@paulstelian97
Copy link
Collaborator

Please resubmit with "main" as PR base branch.

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