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

topology PCM configurations are inconsistent - limited to 48kHz #60

Open
plbossart opened this issue Aug 23, 2018 · 1 comment
Open
Assignees
Labels
bug Something isn't working P2 Critical bugs or normal features

Comments

@plbossart
Copy link
Member

plbossart commented Aug 23, 2018

When I tried to support 192kHz on the Hifiberry with the following diff

diff --git a/topology/sof-apl-pcm512x.m4 b/topology/sof-apl-pcm512x.m4
index cf85337..b043da7 100644
--- a/topology/sof-apl-pcm512x.m4
+++ b/topology/sof-apl-pcm512x.m4
@@ -24,21 +24,21 @@ include(`platform/intel/bxt.m4')
 #
 
 # Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s32le.
-# Schedule 48 frames per 1000us deadline on core 0 with priority 0
+# Schedule 192 frames per 1000us deadline on core 0 with priority 0
 PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
        1, 0, 2, s32le,
-       48, 1000, 0, 0)
+       192, 1000, 0, 0)
 
 #
 # DAIs configuration
 #
 
 # playback DAI is SSP5 using 2 periods
-# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
+# Buffers use s24le format, with 192 frame per 1000us on core 0 with priority 0
 DAI_ADD(sof/pipe-dai-playback.m4,
        1, SSP, 5, SSP5-Codec,
        PIPELINE_SOURCE_1, 2, s24le,
-       48, 1000, 0, 0)
+       192, 1000, 0, 0)
 
 # PCM Low Latency, id 0
 PCM_PLAYBACK_ADD(Port5, 0, PIPELINE_PCM_1)
@@ -49,7 +49,7 @@ PCM_PLAYBACK_ADD(Port5, 0, PIPELINE_PCM_1)
 
 DAI_CONFIG(SSP, 5, 0, SSP5-Codec,
        SSP_CONFIG(I2S, SSP_CLOCK(mclk, 24576000, codec_mclk_in),
-               SSP_CLOCK(bclk, 3072000, codec_slave),
-               SSP_CLOCK(fsync, 48000, codec_slave),
+               SSP_CLOCK(bclk, 12288000, codec_slave),
+               SSP_CLOCK(fsync, 192000, codec_slave),
                SSP_TDM(2, 32, 3, 3),
                SSP_CONFIG_DATA(SSP, 5, 24)))

I had the following error with aplay:
root@ubilinux4:~# aplay -Dhw:0,0 -c2 -r192000 -f S16_LE aa_left.pcm
Playing raw data 'aa_left.pcm' : Signed 16 bit Little Endian, Rate 192000 Hz, Stereo
Warning: rate is not accurate (requested = 192000Hz, got = 48000Hz)
please, try the plug plugin

Indeed the .conf file has limitations to 48kHz:

SectionPCMCapabilities."Passthrough Playback 0" {

	formats "S32_LE,S24_LE,S16_LE"
	rate_min "48000"
	rate_max "48000"
	channels_min "2"
	channels_max "8"

the root cause is that the PCM formats are defined by PCM_CAPABILITIES macro, which isn't used consistently:

grep --color -nH -e PCM_CAPABILITIES *.m4
pipe-low-latency-capture.m4:67:PCM_CAPABILITIES(Low Latency Capture PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 4, 2, 4, 192, 16384, 65536, 65536)
pipe-low-latency-playback.m4:118:PCM_CAPABILITIES(Low Latency Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 2, 2, 16, 192, 16384, 65536, 65536)
pipe-passthrough-capture.m4:47:PCM_CAPABILITIES(Passthrough Capture PCM_ID, COMP_FORMAT_NAME(PIPELINE_FORMAT), 8000, 192000, 1, 16, 2, 16, 192, 16384, 65536, 65536)
pipe-passthrough-playback.m4:47:PCM_CAPABILITIES(Passthrough Playback PCM_ID, COMP_FORMAT_NAME(PIPELINE_FORMAT), 48000, 48000, 2, 4, 2, 16, 192, 16384, 65536, 65536)
pipe-pcm-media.m4:98:PCM_CAPABILITIES(Media Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 8000, 192000, 2, 2, 2, 32, 192, 262144, 8388608, 8388608)
pipe-src-capture.m4:64:PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE', 8000, 96000, 2, 4, 2, 16, 192, 16384, 65536, 65536)
pipe-src-playback.m4:64:PCM_CAPABILITIES(Passthrough Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 8000, 96000, 2, 4, 2, 16, 192, 16384, 65536, 65536)
pipe-volume-capture.m4:69:PCM_CAPABILITIES(Passthrough Capture PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 8, 2, 16, 192, 16384, 65536, 65536)
pipe-volume-playback.m4:70:PCM_CAPABILITIES(Passthrough Playback PCM_ID, `S32_LE,S24_LE,S16_LE', 48000, 48000, 2, 8, 2, 16, 192, 16384, 65536, 65536)

For passthrough or low-latency pipelines, the PCM format should be aligned with the pipeline/dai definitions.

@plbossart
Copy link
Member Author

When I force the rates in the .conf file to be 192kHz things work fine, so definitively an issue with PCM_CAPABILITIES macro
192khz

@plbossart plbossart changed the title topology PCM configurations are inconsistent topology PCM configurations are inconsistent - limited to 48kHz Aug 23, 2018
@mengdonglin mengdonglin added bug Something isn't working P2 Critical bugs or normal features labels Nov 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working P2 Critical bugs or normal features
Projects
None yet
Development

No branches or pull requests

3 participants