-
Notifications
You must be signed in to change notification settings - Fork 19
Loopback mode kcontrol support #13
base: master
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.
These changes make this generic enough so that it will be easy to do liekwise for DMIC, HDA, SDW etc
topology/sof/tokens.m4
Outdated
@@ -18,6 +18,7 @@ SectionVendorTokens."sof_dai_tokens" { | |||
SOF_TKN_DAI_DMAC_CONFIG "153" | |||
SOF_TKN_DAI_TYPE "154" | |||
SOF_TKN_DAI_INDEX "155" | |||
SOF_TKN_DAI_EXT_CONFIG "157" |
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.
Is this for bespoke data ? If so, please change EXT -> BESPOKE
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.
will do
topology/m4/dai.m4
Outdated
@@ -24,6 +24,7 @@ define(`W_DAI_OUT', | |||
` tokens "sof_dai_tokens"' | |||
` tuples."word" {' | |||
` SOF_TKN_DAI_INDEX' $2 | |||
` SOF_TKN_DAI_EXT_CONFIG' ifelse(`DAI_EXTRA_CONFIG', DAI_EXTRA_CONFIG, "0", "`DAI_EXTRA_CONFIG'") |
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.
It's probably better to
- define some SSP specific data macro in SSP.m4 like SSP_CONFIG_DATA i.e. SSP_BESPOKE_DATA
- Add an extra parameter to W_DAI_IN/OUT to take any bespoke DAI data
- in pipe-dai-playback.m4 and friends pass in DAI_BESPOKE_DATA as last param to W_DAI_OUT
- in PIPELINE_PCM_DAI_ADD() add param to pass in any BESPOKE data
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, will follow that.
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.
@lrgirdwo
I tried to follow the suggestion and found that add some macro like SSP_CONFIG_DATA in SSP.m4 won't be helpful. If W_DAI_OUT got SSP specific data, then DMIC and other DAIs will also need the same tuples actually this filed is not specific but the config value is specific.
I think it is better to have the token be merged in existing DAI tuples as the token. Or to have some DAI generic macro to generate that filed for all DAIs and we can pass different value form the SSP.m4 or DMIC.m4.
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 you share the patch so I can check.
@lgirdwood |
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.
The idea is the we can pass vendor tuples/data or an empty macro as the last param.
topology/platform/common/ssp.m4
Outdated
@@ -43,4 +43,8 @@ define(`SSP_CONFIG_DATA', | |||
`}' | |||
) | |||
|
|||
dnl SSP dai have loopback mode so set the SSP_BESPOKEN to 1 | |||
|
|||
define(`SSP_BESPOKEN_CONFIG', 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.
This should be SSP_BESPOKE_CONFIG and should define vendor tuples and vendor data e.g
define(SSP_BESPOKE_CONFIG',
SectionVendorTuples."'N_DAI_OUT($2)_tuples_w_comp" {'
tokens "sof_comp_tokens"'
tuples."word" {'
SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($5)
SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($6)
SOF_TKN_COMP_PRELOAD_COUNT' STR($7)
}'
}'
SectionData."'N_DAI_OUT($2)
_data_w_comp" {'
tuples "'N_DAI_OUT($2)
_tuples_w_comp"'
`}'
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.
Yes, the idea is good. The SectionData and SectionVendorTuples is easy to create.
If we need to add SectionData into the SectionWidget, it will need more ifelse to check if we have such SectionData.
Is it OK to have more ifelse?
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.
yes or you could define an empty data section that can be passed for DAIs with no bespoke data, that way you dont need any conditional code.
Signed-off-by: Pan Xiuli <[email protected]>
Add DAI bespoke config data for dai_in widget, bind DAI bespoke config to DAI comp. Signed-off-by: Pan Xiuli <[email protected]>
@lgirdwood |
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.
Very good, but some minor changes can make this even more useful and mean it would be easy to additionally add SSP expert mode
`SectionVendorTuples."$1$2.OUT_tuples_bespoke_w" {' | ||
` tokens "sof_dai_tokens"' | ||
` tuples."word" {' | ||
` SOF_TKN_DAI_BESPOKE_CONFIG' ifelse($3, `', "0", STR($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.
The presence of this data implies that there a bespoke config data available so there is no need for a token that says bespoke data available. I'd expect to see tokens in here things that are not generic and specific to SSP only like SSP clock source, M/N dividers, etc
You could even additionally create an advance mode SSP_BESPOKE_REGS macro that has a token for each register so that register values can be assigned here.
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.
The user could then decide if he was using export mode or normal bespoke data, since we are always passing a macro to the DAI macro to expand.
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
This DATA is bind to the SectionWidget for DAI COMP.
We already had some DATA for SectionBE for BE DAI to config SSP clock and other things.
Do you mean we may have other run-time reconfigurable setting to SSP?
That we can use the topology to create kcontrol for some debug use config,
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.
Yes, the intention is that we can bind multiple data objects to the widget each containing multiple tuples (but lets start with just 1 data object today).
he "create loopback kcontrol" flag will be a boolean token in this object and so will any member of the following structure that cant be defined in the standard ALSA topology structure for BE/DAI.
struct sof_ipc_dai_ssp_params {
uint16_t mode; // FIXME: do we need this?
uint16_t mclk_id;
uint32_t mclk_rate; /* mclk frequency in Hz */
uint32_t fsync_rate; /* fsync frequency in Hz */
uint32_t bclk_rate; /* bclk frequency in Hz */
/* TDM */
uint32_t tdm_slots;
uint32_t rx_slots;
uint32_t tx_slots;
/* data */
uint32_t sample_valid_bits;
uint16_t tdm_slot_width;
uint16_t reserved2; /* alignment */
/* MCLK */
uint32_t mclk_direction;
uint32_t mclk_keep_active;
uint32_t bclk_keep_active;
uint32_t fs_keep_active;
//uint32_t quirks; // FIXME: is 32 bits enough ?
/* private data, e.g. for quirks */
//uint32_t pdata[10]; // FIXME: would really need ~16 u32
} attribute((packed));
e.g. checking the driver I can see we parse for SOF_TKN_INTEL_SSP_MCLK_KEEP_ACTIVE but we don't set this in any private data yet in topology. This token and any others specific to SSP should be added to this data object alongside the "create lbm kcontrol".
@lgirdwood Let me have some clarify for other issues:
|
The bespoke configuration options only need to be added to the bespoke macro if they are not in any ALSA topology structure (as there is no other way to to load them).
|
This patch add a bit field token config contains loopback mode kcontrol bit for topology.
Should work with sof and kernel PR.
work with
thesofproject/sof#26
thesofproject/linux#10