Skip to content
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

Test for [PATCH v3 00/23] ASoC: Replace dpcm_playback/capture to playback/capture_assertion #4937

Closed

Conversation

plbossart
Copy link
Member

No description provided.

@plbossart
Copy link
Member Author

https://sof-ci.01.org/linuxpr/PR4937/build2357/devicetest/index.html
bad results for CML and no results for GLK, let's redo the tests and hope for a different answer.

@plbossart
Copy link
Member Author

SOFCI TEST

@plbossart
Copy link
Member Author

Looks like https://sof-ci.01.org/linuxpr/PR4937/build2361/devicetest/index.html still has a problem on Helios, @marc-hb @fredoh9 do you know if we can get the logs?

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 22, 2024

I'm working on fixing thesofproject/sof-test#1112 and I made some progress but it's not done yet, so for now you need ssh when the firmware does not load :-(

So I did use ssh and here it the regression below.

I found that error 8 times and every time it was with this PR and kernel merge.

Commit: Merge 9be6af3a99f4 into 4dc32018572e
b32bc69645c4

sudo journalctl --since '2024-04-18'  -g 'cml_rt5682_def.*create|Linux'
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:ipc3_log_header: sof-audio-pci-intel-cnl 0000:00:1f.3: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:sof_ipc3_complete_pipeline: sof-audio-pci-intel-cnl 0000:00:1f.3: tplg: complete pipeline PIPELINE.3.DMIC0.IN id 15
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:ipc3_log_header: sof-audio-pci-intel-cnl 0000:00:1f.3: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:sof_ipc3_complete_pipeline: sof-audio-pci-intel-cnl 0000:00:1f.3: tplg: complete pipeline PIPELINE.2.SSP0.IN id 11
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:ipc3_log_header: sof-audio-pci-intel-cnl 0000:00:1f.3: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:sof_ipc3_complete_pipeline: sof-audio-pci-intel-cnl 0000:00:1f.3: tplg: complete pipeline PIPELINE.1.SSP0.OUT id 5
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: snd_sof:ipc3_log_header: sof-audio-pci-intel-cnl 0000:00:1f.3: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:00: ADC offset=0x0
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:00: Gain0 offset=0x247
Apr 19 14:01:13 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:00: Gain1 offset=0xd7
Apr 19 14:01:15 jf-cml-hel-rt5682-07 kernel: asix 1-2.1.1:1.0 enx000ec6706ff5: Link is Up - 100Mbps/Full - flow control off
Apr 19 14:01:15 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:00: r0 resistance about 7.09 ohm, reg=0x240C96
Apr 19 14:01:15 jf-cml-hel-rt5682-07 kernel: rfkill: input handler disabled
Apr 19 14:01:15 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:01: ADC offset=0x0
Apr 19 14:01:15 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:01: Gain0 offset=0x6f
Apr 19 14:01:15 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:01: Gain1 offset=0x1ffeea
Apr 19 14:01:17 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:01: r0 resistance about 7.16 ohm, reg=0x23B53E
Apr 19 14:01:18 jf-cml-hel-rt5682-07 kernel:  SSP0-Codec: enable ASRC
Apr 19 14:01:18 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:02: ADC offset=0x0
Apr 19 14:01:18 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:02: Gain0 offset=0xc3
Apr 19 14:01:18 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:02: Gain1 offset=0x1c
Apr 19 14:01:20 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:02: r0 resistance about 6.15 ohm, reg=0x29915E
Apr 19 14:01:20 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:03: ADC offset=0x0
Apr 19 14:01:20 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:03: Gain0 offset=0x26c
Apr 19 14:01:20 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:03: Gain1 offset=0x225
Apr 19 14:01:22 jf-cml-hel-rt5682-07 kernel: rt1011 i2c-10EC1011:03: r0 resistance about 5.78 ohm, reg=0x2C3527
Apr 19 14:01:22 jf-cml-hel-rt5682-07 kernel:  SSP1-Codec: SSP1-Codec capture assertion check error
Apr 19 14:01:22 jf-cml-hel-rt5682-07 kernel: sof_rt5682 cml_rt5682_def: ASoC: can't create pcm SSP1-Codec :-22
Apr 19 14:01:22 jf-cml-hel-rt5682-07 kernel: sof_rt5682 cml_rt5682_def: probe with driver sof_rt5682 failed with error -22

``

@plbossart
Copy link
Member Author

ok this is clearly a problem with this PR, thanks @marc-hb, will report upstream.

Apr 19 14:01:22 jf-cml-hel-rt5682-07 kernel:  SSP1-Codec: SSP1-Codec capture assertion check error
Apr 19 14:01:22 jf-cml-hel-rt5682-07 kernel: sof_rt5682 cml_rt5682_def: ASoC: can't create pcm SSP1-Codec :-22

morimoto and others added 24 commits April 25, 2024 11:13
Current soc_get_playback_capture() (A) is checking playback/capture
availability for DPCM (X) / Normal (Y) / Codec2Codec (Z) connections.

(A)	static int soc_get_playback_capture(...)
	{
		...
 ^		if (dai_link->dynamic || dai_link->no_pcm) {
 |			...
 |(a)			if (dai_link->dpcm_playback) {
 |				...
 | ^				for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
 |(*)					...
 | v				}
 |				...
(X)			}
 |(b)			if (dai_link->dpcm_capture) {
 |				...
 | ^				for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
 |(*)					...
 | v				}
 |				...
 v			}
		} else {
 ^ ^			/* Adapt stream for codec2codec links */
 |(Z)			int cpu_capture = ...
 | v			int cpu_playback = ...
(Y)
 | ^			for_each_rtd_ch_maps(rtd, i, ch_maps) {
 |(*)				...
 v v			}
		}
		...
	}

(*) part is checking each DAI's availability.

(X) part is for DPCM, and it checks playback/capture availability
if dai_link has dpcm_playback/capture flag (a)(b).
This availability check should be available not only for DPCM, but for
all connections. But it is not mandatory option. Let's name it as
assertion.

In case of having assertion flag, non specific side will be disabled.
For example if it has playback_assertion but not have capture_assertion,
capture will be force disabled.

	dpcm_playback -> playabck_assertion = 1

	dpcm_capture  -> capture_assertion  = 1

	playback_only -> playback_assertion = 1
	                 capture_assertion  = 0

	capture_only  -> playback_assertion = 0
	                 capture_assertion  = 1

By expanding this assertion to all connections, we can use same code
for all connections, this means code can be more cleanup.

Here, current CPU / Codec validation check relationship is like this

	DPCM
		[CPU/xxxx]-[yyyy/Codec]
		^^^^        ^^^^
	non DPCM
		[CPU/Codec]
		^^^^^^^^^^^

DPCM     part (X) is checking only CPU       DAI, and
non DPCM part (Y) is checking both CPU/Codec DAI

Current validation check on DPCM ignores Codec DAI, but there is no
reason to do it.  We should check both CPU/Codec in all connection.
This patch expands validation check to all cases.

	[CPU/xxxx]-[yyyy/Codec]
	                 *****

In many case (not all case), above [xxxx][yyyy] part are "dummy" DAI
which is always valid for both playback/capture.
But unfortunately DPCM BE Codec (**** part) had been no validation
check before, and some Codec driver doesn't have necessary settings for
it. This means all cases validation check breaks compatibility on some
vender's drivers. Thus this patch temporary uses dummy DAI at BPCM BE
Codec part, and avoid compatibility error. But it should be removed in
the future.

Signed-off-by: Kuninori Morimoto <[email protected]>
Historically, ASoC doesn't have validation check for DPCM BE Codec,
but it should have. Current ASoC is ignoring it same as before,
but let's indicate the warning about that.

This warning and code should be removed and cleaned if all DPCM BE
Codec driver has necessary settings in the future.
One of the big user which doesn't have it is Intel.
Below is at least already known settings missing driver.

	--- sound/soc/codecs/hda.c ---

	static struct snd_soc_dai_driver card_binder_dai = {
		.id = -1,
		.name = "codec-probing-DAI",
+		.capture.channels_min = 1,
+		.playback.channels_min = 1,
	};

	--- sound/pci/hda/patch_hdmi.c ---

	static int generic_hdmi_build_pcms(...)
	{
		...
		for (...) {
			...
+			pstr->channels_min = 1;
		}

		return 0;
	}

Link: https://lore.kernel.org/r/[email protected]
Cc: Amadeusz Sławiński <[email protected]>
Signed-off-by: Kuninori Morimoto <[email protected]>
snd_soc_dai_link_set_capabilities() checks all CPU/Codec DAI (Y)(Z)
for Playback/Capture (X) and checks its validation (A), and setup
dpcm_playback/capture flags (a).

	void snd_soc_dai_link_set_capabilities(...)
	{
		...
(X)		for_each_pcm_streams(direction) {
			...
(Y)			for_each_link_cpus(dai_link, i, cpu) {
				...
(A)				if (... snd_soc_dai_stream_valid(...)) {
					...
				}
			}
(Z)			for_each_link_codecs(dai_link, i, codec) {
				...
(A)				if (... snd_soc_dai_stream_valid(...)) {
					...
				}
			}
			...
		}

(a)		dai_link->dpcm_playback = supported[...];
(a)		dai_link->dpcm_capture  = supported[...];
	}

This validation check will be automatically done on new
soc_get_playback_capture(). snd_soc_dai_link_set_capabilities() is no
longer needed. Let's remove it.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…ertion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…ertion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…_assertion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…_assertion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…apture_assertion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts dpcm_xxx flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…rtion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
…rtion

soc_get_playback_capture() is now handling DPCM and normal
comprehensively for playback/capture stream in same code.
This patch converts xxx_only flag to xxx_assertion.

Signed-off-by: Kuninori Morimoto <[email protected]>
No driver is using dpcm_playback/capture and playback/capture_only flag,
let's remove these.

Signed-off-by: Kuninori Morimoto <[email protected]>
.dpcm_playback/capture flags are converted to playback/capture_assertion
flag. Let's follow it on Documentation.

Signed-off-by: Kuninori Morimoto <[email protected]>
The patches added a requirement that the cpu and codec dais support the direction set by the dailink.

One some Intel platform, we "cheat" when the echo reference is
generated. The dailink is marked as supporting capture even though the
amplifier cannot generate the echo reference; the echo reference is
actually generated in the firmware and the DAI not used for capture proper.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
@plbossart plbossart force-pushed the morimoto/dpcm-cleanup branch from b237412 to c102f11 Compare April 25, 2024 16:14
@plbossart
Copy link
Member Author

I think I know the issue: these patches added a stricter check that both cpu and codec dais support a direction. That is not true when we have an echo reference generated in the firmware: the codec dai does not support capture at all.

@plbossart
Copy link
Member Author

3 hours and the build is not complete?

@plbossart
Copy link
Member Author

SOFCI TEST

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 25, 2024

These look relevant:
https://sof-ci.01.org/linuxpr/PR4937/build2507/devicetest/index.html

[  807.304740] kernel:  SSP1-Codec: CPU dai SSP1 Pin supports capture but codec DAI rt1011-aif does not
[  807.304825] kernel:  SSP1-Codec: CPU dai SSP1 Pin supports capture but codec DAI rt1011-aif does not
[  807.304881] kernel:  SSP1-Codec: CPU dai SSP1 Pin supports capture but codec DAI rt1011-aif does not
[  807.304935] kernel:  SSP1-Codec: CPU dai SSP1 Pin supports capture but codec DAI rt1011-aif does not

@plbossart
Copy link
Member Author

Yeah, the errors above validate my theory that the new criteria are too strict. The Helios machine driver have a capture dailink that's connected to SSP1, even though the amplifiers don't support capture.

@plbossart plbossart closed this Apr 29, 2024
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.

3 participants