Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

Loopback mode kcontrol support #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xiulipan
Copy link
Contributor

@xiulipan xiulipan commented Jun 28, 2018

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

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.

These changes make this generic enough so that it will be easy to do liekwise for DMIC, HDA, SDW etc

@@ -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"
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do

@@ -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'")
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 probably better to

  1. define some SSP specific data macro in SSP.m4 like SSP_CONFIG_DATA i.e. SSP_BESPOKE_DATA
  2. Add an extra parameter to W_DAI_IN/OUT to take any bespoke DAI data
  3. in pipe-dai-playback.m4 and friends pass in DAI_BESPOKE_DATA as last param to W_DAI_OUT
  4. in PIPELINE_PCM_DAI_ADD() add param to pass in any BESPOKE data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will follow that.

Copy link
Contributor Author

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.

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 share the patch so I can check.

@xiulipan
Copy link
Contributor Author

xiulipan commented Jul 3, 2018

@lgirdwood
Update the patch set for topology.
Need to pass through the config value.

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.

The idea is the we can pass vendor tuples/data or an empty macro as the last param.

@@ -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)
Copy link
Member

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"'
`}'

Copy link
Contributor Author

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?

Copy link
Member

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.

xiulipan added 2 commits July 4, 2018 10:48
Add DAI bespoke config data for dai_in widget, bind DAI bespoke config
to DAI comp.

Signed-off-by: Pan Xiuli <[email protected]>
@xiulipan
Copy link
Contributor Author

xiulipan commented Jul 4, 2018

@lgirdwood
New version with vendor data and tuples.

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.

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))
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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,

Copy link
Member

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

@xiulipan
Copy link
Contributor Author

xiulipan commented Jul 6, 2018

@lgirdwood
SOF_TKN_INTEL_SSP_MCLK_KEEP_ACTIVE is setting mclk_keep_active in sof_ipc_dai_ssp_params.
This token is in SectionBE and the LBM token is in SectionWidget, should they be in the same Section if we want they both in same structure?

Let me have some clarify for other issues:

  1. we will not use bit filed flag now, a token in the tuple is needed now.
  2. should we create a new token filed called sof_ssp_bespoke_tokens or just merge it into sof_ssp_tokens?
  3. If we really need a new token tuple date to contain these tokens? The kernel seems did not care it.

@lgirdwood
Copy link
Member

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

  1. yes.
  2. We need a new token for every bespoke configuration option that is not in ALSA topology format.
  3. The kernel does not care for most of the bespoke tokens, we pass the data directly to the FW in this case. The kernel should ignore tokens it does not care about i.e. ignore SSP_ENABLE_CLOCK_REQ_A, but dont ignore SSP_CREATE_LBM_KCONTROL

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants