Repository navigation
SSP bclk refining series - #3622
Conversation
abonislawski
left a comment
There was a problem hiding this comment.
This is more like w/a which should be applied to release branch if needed but not to master.
In CAVS it is possible to fully release M/N div source
No I implement this aimed to make it a generic solution, we can add any runtime SSP configuration (e.g. mclk, sample_rate, channel number, sample format, ...) to this pre_start/post_stop. |
There was a problem hiding this comment.
I think that was intentional. Removing this case will result in the MCLK rate being an exact integer division of the SSP clock, which completely defeats the purpose of the M/N dividers?
There was a problem hiding this comment.
I think that was intentional. Removing this case will result in the MCLK rate being an exact integer division of the SSP clock, which completely defeats the purpose of the M/N dividers?
nope, here we are looking for the most suitable mclk source and the divisible (src_freq % clk_rate == 0) source will be the preferred one, non-1 M/N dividers is not our intention.
We should not stop the searching here at 'mclk_rate > ssp_freq[i].freq', imagine this case:
we have ssp_freq[] = {19.2M, 24.576M, 96M}, and we are asking for 'mclk_rate = 24.576M', without my change, we will stop at 'i = 0' and lose the chance to use 24.576M source and non-1 M/N will be used (which is actually not necessary).
There was a problem hiding this comment.
You are maybe fixing an issue by adding a new one. that's not cool.
There was a problem hiding this comment.
You are maybe fixing an issue by adding a new one. that's not cool.
Adding what new issue?
There was a problem hiding this comment.
@keyonjie I think that @plbossart means we are enabling M/N when we dont need to in the case where we have an exact integer division i.e. we could use the SSP MDIV bits here for an integer divide to save power.
There was a problem hiding this comment.
@lgirdwood @plbossart let me clarify things here:
- for mclk, there is actually no M/N divider concepts, mclk output = mclk source / M_DIV Ratio, see the register definition of MN_MDIVR for detail. Translate it to M/N concept, the M is always 1, and N = 2, 3, ..., 8.
- the reason why I am removing 'if (mclk_rate > ssp_freq[i].freq)' check here is that the check here is totally logic wrong, the original check will return fail and report "MCLK xxx, no valid source" when we actually have higher frequency mclk source to be used, the higher frequency one is not even iterated with it...
There was a problem hiding this comment.
@keyonjie can you remind me which cases are currently broken? I don't think we use an MCLK of 24.576MHz in any real product. on APL the mclk does not go out on the connector.
sof-apl-asrc-pcm512x.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-asrc-wm8804.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-demux-pcm512x.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-nocodec.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-nocodec.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-nocodec.m4:# SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-nocodec.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-nocodec.m4:# SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-nocodec.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-pcm512x-nohdmi.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-pcm512x.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-pcm512x.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-rt298.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-src-pcm512x.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-tdf8532.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-tdf8532.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-tdf8532.m4: SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-tdf8532.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-tdf8532.m4: SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-tdf8532.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
sof-apl-wm8804.m4: SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
I would also recommend you split fixes from functionality change, I find this series complicated to review.
There was a problem hiding this comment.
@plbossart as you found, the finding for 24.576MHz mclk source here fail for those .m4 files you listed above, though they are not connected out actually, the logic fix here at least no harm. There is no mclk broken reported up to now I think, but let's fix the logic wrong here before it become to a real problem to us.
Yes, let me split those MCLK fixes and talk about them there, thanks for your suggestion.
There was a problem hiding this comment.
@plbossart the MCLK fixes are split and put here: #3672
There was a problem hiding this comment.
I think that's incorrect. There are platforms where we can have different sources for BCLK and MCLK, but other where there's a single source.
There was a problem hiding this comment.
M/N comes after selecting a source, and yes it's possible to apply it there as well IIRC.
There was a problem hiding this comment.
@plbossart we have MNDSS and MCDSS for all cAVS, at least I am seeing them in spec for APL/CNL/TGL. This driver is for cAVS platforms only, so no need to take care BYT/BDW ones here.
@ranj063 yes, please see the definition and block diagram for MNDSS(for BCLK) and MCDSS(for MCLK). We have M/N for BCLK, but only divider (similar to N) for MCLK, which means we can only set the MCLK frequency as 1/N of the MCLK source frequency.
There was a problem hiding this comment.
@keyonjie I am 100% positive that there was a change in the clock tree somewhere between APL and TGL. In fact here it is:
see commit 0a97c1a
drivers: intel: mn: bclk sources
All BCLKs that use M/N share the same source clock, so we need to
track sources for each BCLK to prevent case in which next SSP config
would override source clock for previous SSP config.
Since cAVS 2.0, all clocks go through M/N, bypassing XTAL is
no longer supported.
For earlier version MN driver checks if XTAL can be used if it
would result in more efficient settings.
As a result it fixes ECS-related code for cAVS 2.0+ and is backwards
compatible with previous logic when there is only SSP0 used.
Previously topologies that used more than 1 SSP could override
source clock for previously configured SSP ports, now it will try
to use current clock with M/N or report error.
There was a problem hiding this comment.
@plbossart Yes, M/N can not be bypassed on cAVS2.x but we can set both M and N to 1.
There was a problem hiding this comment.
You should have a first patch that moves all the code from ssp_set_config() to ssp_pre_start(), and then add the M/N changes.
There was a problem hiding this comment.
do we want to do this for pause/release as well?
There was a problem hiding this comment.
You should have a first patch that moves all the code from ssp_set_config() to ssp_pre_start(), and then add the M/N changes.
Do you mean split this commit to 2? I thought about that, but compiler may complaint for the first commit that "function defined but not used".
There was a problem hiding this comment.
do we want to do this for pause/release as well?
It will be called when ssp_start/stop is called with this change applied, so it will not be applied at ssp_pause() at the moment. For this pause/release scenario, it could be tricky as we don't release clear the RXEN bit at the moment, so forcing to release the bclk might lead to jitter (samples lost), but we are good with this series as we don't do this for pause.
You called this reset/release but this is just something like low power mode with selected specific clock and a true release is never possible. |
There was a problem hiding this comment.
is this a copy/paste error ? we're not really searching for the smallest here?
There was a problem hiding this comment.
is this a copy/paste error ? we're not really searching for the smallest here?
yep, let me correct it.
The reset value of MNDSS is 00b (XTAL), it is not any arbitrary specific clock. I think our LPRO (or WOVCRO on cAVS 2.x) frequency is designed to be multiple of XTAL, which means we can always keep XTAL OSCILLATOR active in low power mode (so as in the reset mode). For sure, We can reset MNDSS to be 11b (Reserved) if we want to release this request to the clock source, but that is not necessary unless we are powering off the whole DSP (D3)?
|
No, WoVCRO is different clock which allow to disable XTAL and get much better power results.
MNDSS 11 means MCLK input so not sure why reset? MDE bit with enable/disable divider |
Oh, this is changed from cAVS 2.x. MDE bit can disable the MCLK output only, we don't have an easy way to disable BCLK source fully so switching it back to the reset value 00b (XTAL) is what we can do, except powering down the whole I2S link as what you do in #3615 |
lgirdwood
left a comment
There was a problem hiding this comment.
The good news is the code passes CI, but there are still a few questions to be resolved.
There was a problem hiding this comment.
@keyonjie I think that @plbossart means we are enabling M/N when we dont need to in the case where we have an exact integer division i.e. we could use the SSP MDIV bits here for an integer divide to save power.
There was a problem hiding this comment.
There must be an errno for "not found".
There was a problem hiding this comment.
This needs to be quite verbose explaining why we need to do this and things to take care about.
|
@lgirdwood @plbossart comments addressed. |
|
@keyonjie can you check CI, looks like issues with ICL SSP. Jenkins has a DUT failing to boot. |
|
SOFCI TEST |
6dd27da to
edd5211
Compare
|
SOFCI TEST |
|
@lgirdwood the TGLU_RVP_SDW on device test failure is unrelated, and I can't get any useful information for the Internal Intel CI 06_01_TestHdaLoopbackVolume48000hz24b32b2ch on the WHL_HDA. |
Add a helper to get SSP clock index from the clock source encoded index for cAVS platforms. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add a helper to reset the bclk M/N source (MNDSS), which will help to release the clock source when it is not needed. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
During mn_release_bclk(), check if there is still any SSP which is holding the M/N clock source, if no, release the clock source for power saving. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Create ssp_pre_start/stop() helpers to do kinds of runtime configuration, and do the bclk request/release there to make sure the bclk source is hold only when the DAI is active, this will help for power saving at SSP idle. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
To reduce the power consumption, we should request the clock source for bclk only when SSP is active. This means we need to postpone the clock request from ssp_set_config() to ssp_pre_start() and release it at ssp_post_stop(). Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
|
Both Travis and Jenkins showing timeouts but tests pass. |
This is a small series to refine the SSP bclk request/release sequence,
to reduce the power consumption when SSP is inactive.
To reduce the power consumption, we should request the clock source for
bclk only when SSP is active. This means we need to postpone the clock
request from ssp_set_config() to ssp_start() and release it at
ssp_stop().
Create ssp_pre_start/stop() helpers to do this kind of runtime
configuration, and do the bclk request/release inside them.