mbox series

[v2,0/4] ASoC: qcom: display port changes

Message ID 20240422134354.89291-1-srinivas.kandagatla@linaro.org (mailing list archive)
Headers show
Series ASoC: qcom: display port changes | expand

Message

Srinivas Kandagatla April 22, 2024, 1:43 p.m. UTC
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

This patchset adds support for.
	1. parse Display Port module tokens from ASoC topology
	2. add support to DP/HDMI Jack events.
	3. fixes a typo in function name in sm8250

Verified these patches on X13s along with changes to tplg in 
https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
and ucm changes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp

Thanks,
Srini

Changes since v1:
	- Fixed unused variable warning.
	- fixed warning 'break;' to avoid fall-through

Srinivas Kandagatla (4):
  ASoC: qcom: q6dsp: parse Display port tokens
  ASoC: qcom: common: add Display port Jack function
  ASoC: qcom: sc8280xp: add Display port Jack
  ASoC: qcom: sm8250: fix a typo in function name

 sound/soc/qcom/common.c         | 29 +++++++++++++++++++++++++++++
 sound/soc/qcom/common.h         |  3 +++
 sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
 sound/soc/qcom/sc8280xp.c       | 14 ++++++++++++++
 sound/soc/qcom/sm8250.c         |  4 ++--
 5 files changed, 74 insertions(+), 2 deletions(-)

Comments

Johan Hovold April 23, 2024, 11:59 a.m. UTC | #1
On Mon, Apr 22, 2024 at 02:43:50PM +0100, Srinivas Kandagatla wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> This patchset adds support for.
> 	1. parse Display Port module tokens from ASoC topology
> 	2. add support to DP/HDMI Jack events.
> 	3. fixes a typo in function name in sm8250
> 
> Verified these patches on X13s along with changes to tplg in 
> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
> and ucm changes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp

It looks like your UCM changes are still muxing the speaker and *each*
displayport output so that you can only use one device at a time (i.e.
only Speaker or DP1 or DP2 can be used).

As we discussed off list last week, this seems unnecessarily limited and
as far as I understood is mostly needed to work around some
implementation details (not sure why DP1 and DP2 can't be used in
parallel either).

Can you please describe the problem here so that we can discuss this
before merging an unnecessarily restricted solution which may later be
harder to change (e.g. as kernel, topology and ucm may again need to be
updated in lock step).

>From what I could tell after a quick look, this series does not
necessarily depend on muxing things this way, but please confirm that
too.

Johan
Srinivas Kandagatla April 23, 2024, 12:38 p.m. UTC | #2
On 23/04/2024 12:59, Johan Hovold wrote:
> On Mon, Apr 22, 2024 at 02:43:50PM +0100, Srinivas Kandagatla wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> This patchset adds support for.
>> 	1. parse Display Port module tokens from ASoC topology
>> 	2. add support to DP/HDMI Jack events.
>> 	3. fixes a typo in function name in sm8250
>>
>> Verified these patches on X13s along with changes to tplg in
>> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
>> and ucm changes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
> 
> It looks like your UCM changes are still muxing the speaker and *each*
> displayport output so that you can only use one device at a time (i.e.
> only Speaker or DP1 or DP2 can be used).
that is true.

What is the use-case to use more than one audio sink devices at the same 
time for a laptops?

How do you test it? I never tested anything like that on a full desktop 
setup.

May be some manual setup in Wireplumber, but not 100% sure about 
multiple stream handling.

> 
> As we discussed off list last week, this seems unnecessarily limited and
> as far as I understood is mostly needed to work around some
> implementation details (not sure why DP1 and DP2 can't be used in
> parallel either).

It is absolutely possible to run all the streams in parallel from the 
Audio hardware and DSP point of view.

One thing to note is, On Qualcomm DP IP, we can not read/write registers 
if the DP port is not connected, which means that we can not send data 
in such cases.

This makes it challenging to work with sound-servers like pipewire or 
pulseaudio as they tend to send silence data at very early stages in the 
full system boot up, ignoring state of the Jack events.

> 
> Can you please describe the problem here so that we can discuss this
> before merging an unnecessarily restricted solution which may later be
> harder to change (e.g. as kernel, topology and ucm may again need to be
> updated in lock step).
> 
>  From what I could tell after a quick look, this series does not
> necessarily depend on muxing things this way, but please confirm that
> too.

These patches have nothing to do with how we model the muxing in UCM or 
in tplg.

so these can go as it is irrespective of how we want to model the DP 
sinks in the UCM or tplg.


--srini
> 
> Johan
Johan Hovold April 23, 2024, 2:58 p.m. UTC | #3
On Tue, Apr 23, 2024 at 01:38:18PM +0100, Srinivas Kandagatla wrote:
> On 23/04/2024 12:59, Johan Hovold wrote:

> > It looks like your UCM changes are still muxing the speaker and *each*
> > displayport output so that you can only use one device at a time (i.e.
> > only Speaker or DP1 or DP2 can be used).

> that is true.
> 
> What is the use-case to use more than one audio sink devices at the same 
> time for a laptops?

I can imagine streaming audio and video to a TV (or audio to a soundbar)
over DP while playing systems sounds and doing video conferencing using
the internal speakers (or the other DP port).

> How do you test it? I never tested anything like that on a full desktop 
> setup.

You can select the sink per application in pavucontrol. Just verified
that playing audio over the 3.5 mm jack while playing system sounds
using the internal speakers works just fine.

> > As we discussed off list last week, this seems unnecessarily limited and
> > as far as I understood is mostly needed to work around some
> > implementation details (not sure why DP1 and DP2 can't be used in
> > parallel either).
> 
> It is absolutely possible to run all the streams in parallel from the 
> Audio hardware and DSP point of view.
> 
> One thing to note is, On Qualcomm DP IP, we can not read/write registers 
> if the DP port is not connected, which means that we can not send data 
> in such cases.
> 
> This makes it challenging to work with sound-servers like pipewire or 
> pulseaudio as they tend to send silence data at very early stages in the 
> full system boot up, ignoring state of the Jack events.

This bit sounds like it can and should be worked around by the driver to
avoid hard-coding policy which would prevent use cases such as the ones
mentioned above.

> > Can you please describe the problem here so that we can discuss this
> > before merging an unnecessarily restricted solution which may later be
> > harder to change (e.g. as kernel, topology and ucm may again need to be
> > updated in lock step).
> > 
> >  From what I could tell after a quick look, this series does not
> > necessarily depend on muxing things this way, but please confirm that
> > too.
> 
> These patches have nothing to do with how we model the muxing in UCM or 
> in tplg.
> 
> so these can go as it is irrespective of how we want to model the DP 
> sinks in the UCM or tplg.

Thanks for confirming.

Johan
Srinivas Kandagatla April 23, 2024, 3:59 p.m. UTC | #4
On 23/04/2024 15:58, Johan Hovold wrote:
>> It is absolutely possible to run all the streams in parallel from the
>> Audio hardware and DSP point of view.
>>
>> One thing to note is, On Qualcomm DP IP, we can not read/write registers
>> if the DP port is not connected, which means that we can not send data
>> in such cases.
>>
>> This makes it challenging to work with sound-servers like pipewire or
>> pulseaudio as they tend to send silence data at very early stages in the
>> full system boot up, ignoring state of the Jack events.
> This bit sounds like it can and should be worked around by the driver to
> avoid hard-coding policy which would prevent use cases such as the ones
> mentioned above.
This is not simple as you say. We have to fit these into a proper DPCM.
Either we have a dummy Backend connected for each of these pcm 
sub-devices when DP port is not connected and then switch back to DP 
when its connected.

Or somehow find a way to not let the pipewire talk to devices which are 
not connected.


thanks,
srini
Johan Hovold April 29, 2024, 3 p.m. UTC | #5
On Tue, Apr 23, 2024 at 04:59:56PM +0100, Srinivas Kandagatla wrote:
> On 23/04/2024 15:58, Johan Hovold wrote:

> >> It is absolutely possible to run all the streams in parallel from the
> >> Audio hardware and DSP point of view.
> >>
> >> One thing to note is, On Qualcomm DP IP, we can not read/write registers
> >> if the DP port is not connected, which means that we can not send data
> >> in such cases.
> >>
> >> This makes it challenging to work with sound-servers like pipewire or
> >> pulseaudio as they tend to send silence data at very early stages in the
> >> full system boot up, ignoring state of the Jack events.

> > This bit sounds like it can and should be worked around by the driver to
> > avoid hard-coding policy which would prevent use cases such as the ones
> > mentioned above.

> This is not simple as you say. We have to fit these into a proper DPCM.
> Either we have a dummy Backend connected for each of these pcm 
> sub-devices when DP port is not connected and then switch back to DP 
> when its connected.

I don't know how best to implement it, but we shouldn't necessarily let
that determine the user experience.

> Or somehow find a way to not let the pipewire talk to devices which are 
> not connected.

Yes, perhaps it requires a change in user space.

But it seems the kernel should be able to fake whatever probing user
space currently does to determine if the there is a DP jack (even when
there is nothing connected).

Johan
Xilin Wu May 23, 2024, 4:09 a.m. UTC | #6
On 2024/4/22 21:43, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> This patchset adds support for.
> 	1. parse Display Port module tokens from ASoC topology
> 	2. add support to DP/HDMI Jack events.
> 	3. fixes a typo in function name in sm8250
> 
> Verified these patches on X13s along with changes to tplg in
> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
> and ucm changes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
> 
> Thanks,
> Srini
> 
> Changes since v1:
> 	- Fixed unused variable warning.
> 	- fixed warning 'break;' to avoid fall-through
> 
> Srinivas Kandagatla (4):
>    ASoC: qcom: q6dsp: parse Display port tokens
>    ASoC: qcom: common: add Display port Jack function
>    ASoC: qcom: sc8280xp: add Display port Jack
>    ASoC: qcom: sm8250: fix a typo in function name
> 
>   sound/soc/qcom/common.c         | 29 +++++++++++++++++++++++++++++
>   sound/soc/qcom/common.h         |  3 +++
>   sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
>   sound/soc/qcom/sc8280xp.c       | 14 ++++++++++++++
>   sound/soc/qcom/sm8250.c         |  4 ++--
>   5 files changed, 74 insertions(+), 2 deletions(-)
> 

Hi Srini,

I tested this series on SM8550 with tplg in [1] and ucm in [2]. But the 
kernel output errors attached below. Headphone does work properly 
without DisplayPort in the ucm.

What could be the possible cause of this? Is there any significant 
change from sc8280xp to sm8550?
Srinivas Kandagatla May 24, 2024, 12:50 p.m. UTC | #7
Hi Xilin,

On 23/05/2024 05:09, Xilin Wu wrote:
>>
>> Srinivas Kandagatla (4):
>>    ASoC: qcom: q6dsp: parse Display port tokens
>>    ASoC: qcom: common: add Display port Jack function
>>    ASoC: qcom: sc8280xp: add Display port Jack
>>    ASoC: qcom: sm8250: fix a typo in function name
>>
>>   sound/soc/qcom/common.c         | 29 +++++++++++++++++++++++++++++
>>   sound/soc/qcom/common.h         |  3 +++
>>   sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
>>   sound/soc/qcom/sc8280xp.c       | 14 ++++++++++++++
>>   sound/soc/qcom/sm8250.c         |  4 ++--
>>   5 files changed, 74 insertions(+), 2 deletions(-)
>>
> 
> Hi Srini,
> 
> I tested this series on SM8550 with tplg in [1] and ucm in [2]. But the 
> kernel output errors attached below. Headphone does work properly 
> without DisplayPort in the ucm.
> 
> What could be the possible cause of this? Is there any significant 
> change from sc8280xp to sm8550?
> 
> -- 
> Thanks,
> Xilin Wu
> 
> [1] 
> https://github.com/edk2-porting/audioreach-topology/blob/sakuramist/QCS8550-AYN-ODIN2.m4
> [2] 
> https://github.com/strongtz/alsa-ucm-conf/blob/odin2/ucm2/Qualcomm/sm8550/HiFi.conf
> 
> [ 1552.313713] qcom-apm gprsvc:service:2:1: Error (1) Processing 
> 0x01001000 cmd
> [ 1552.313730] qcom-apm gprsvc:service:2:1: DSP returned error[1001000] 1
> [ 1552.314455] qcom-apm gprsvc:service:2:1: Error (1) Processing 

Is the DP cable connected?

if its not connected the dsp will throw this error.

due to this issue I did workaround this issue by modeling it as 
conflicting device to Speaker in x13s ucm.

I see in your ucm setup its not the case.
which is why you might be hitting this issue.

Can you try
amixer -c 0 cset iface=MIXER,name='DISPLAY_PORT_RX_0 Audio Mixer 
MultiMedia2' 1
aplay -D plughw:0,1 some-wav-file.wav

both with and without display connected.


--srini



> 0x01001006 cmd
> [ 1552.314463] qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> [ 1552.315496] qcom-apm gprsvc:service:2:1: Error (1) Processing 
> 0x01001006 cmd
> [ 1552.315506] qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> [ 1552.316033] qcom-apm gprsvc:service:2:1: Error (1) Processing 
> 0x01001001 cmd
> [ 1552.316042] qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> [ 1552.316045] q6apm-lpass-dais 
> 30000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare 
> Graph -22
> [ 1552.316047] q6apm-lpass-dais 
> 30000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at 
> snd_soc_pcm_dai_prepare on DISPLAY_PORT_RX_0: -22
Xilin Wu May 25, 2024, 7:12 a.m. UTC | #8
Hi Srini,

On 2024/5/24 20:50, Srinivas Kandagatla wrote:
> Hi Xilin,
> 
> On 23/05/2024 05:09, Xilin Wu wrote:
>>>
>>> Srinivas Kandagatla (4):
>>>    ASoC: qcom: q6dsp: parse Display port tokens
>>>    ASoC: qcom: common: add Display port Jack function
>>>    ASoC: qcom: sc8280xp: add Display port Jack
>>>    ASoC: qcom: sm8250: fix a typo in function name
>>>
>>>   sound/soc/qcom/common.c         | 29 +++++++++++++++++++++++++++++
>>>   sound/soc/qcom/common.h         |  3 +++
>>>   sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
>>>   sound/soc/qcom/sc8280xp.c       | 14 ++++++++++++++
>>>   sound/soc/qcom/sm8250.c         |  4 ++--
>>>   5 files changed, 74 insertions(+), 2 deletions(-)
>>>
>>
>> Hi Srini,
>>
>> I tested this series on SM8550 with tplg in [1] and ucm in [2]. But 
>> the kernel output errors attached below. Headphone does work properly 
>> without DisplayPort in the ucm.
>>
>> What could be the possible cause of this? Is there any significant 
>> change from sc8280xp to sm8550?
>>
>> -- 
>> Thanks,
>> Xilin Wu
>>
>> [1] 
>> https://github.com/edk2-porting/audioreach-topology/blob/sakuramist/QCS8550-AYN-ODIN2.m4
>> [2] 
>> https://github.com/strongtz/alsa-ucm-conf/blob/odin2/ucm2/Qualcomm/sm8550/HiFi.conf
>>
>> [ 1552.313713] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>> 0x01001000 cmd
>> [ 1552.313730] qcom-apm gprsvc:service:2:1: DSP returned error[1001000] 1
>> [ 1552.314455] qcom-apm gprsvc:service:2:1: Error (1) Processing 
> 
> Is the DP cable connected?

I'm sure that the cable is connected and I have desktop on external display.
If it's not connected, kernel gives the following error when using aplay:

hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: error at 
snd_soc_dai_hw_params on i2s-hifi: -22

> 
> if its not connected the dsp will throw this error.
> 
> due to this issue I did workaround this issue by modeling it as 
> conflicting device to Speaker in x13s ucm.
> 
> I see in your ucm setup its not the case.
> which is why you might be hitting this issue.
> 
> Can you try
> amixer -c 0 cset iface=MIXER,name='DISPLAY_PORT_RX_0 Audio Mixer 
> MultiMedia2' 1
> aplay -D plughw:0,1 some-wav-file.wav
> 
> both with and without display connected.
> 

aplay always gives the following error:

Playing WAVE 'Summer.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, 
Stereo
aplay: set_params:1456: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (42666 42667)
PERIOD_SIZE: (1881 1882)
PERIOD_BYTES: (7524 7528)
PERIODS: (3 5)
BUFFER_TIME: (170657 170658)
BUFFER_SIZE: 7526
BUFFER_BYTES: 30104
TICK_TIME: 0

and kernel gives the following when display is connected:

[drm:dp_catalog_audio_config_sdp] sdp_cfg = 0x100066
[drm:dp_catalog_audio_config_sdp] sdp_cfg2 = 0x1b800004
[drm:dp_audio_hw_params] Header Byte 1: value = 0xce020000, parity_byte 
= 0xce
[drm:dp_audio_hw_params] Header Byte 2: value = 0x67010000, parity_byte 
= 0x0
[drm:dp_audio_hw_params] Header Byte 3: value = 0x67010000, parity_byte 
= 0x67
[drm:dp_audio_hw_params] Header Byte 1: value = 0x67010000, parity_byte 
= 0x67
[drm:dp_audio_hw_params] Header Byte 2: value = 0x33443517, parity_byte 
= 0x35
[drm:dp_audio_hw_params] Header Byte 3: value = 0x33443517, parity_byte 
= 0x33
[drm:dp_audio_hw_params] Header Byte 1: value = 0x84840000, parity_byte 
= 0x84
[drm:dp_audio_hw_params] Header Byte 2: value = 0x3344d71b, parity_byte 
= 0xd7
[drm:dp_audio_hw_params] Header Byte 3: value = 0x44, parity_byte = 0x33
[drm:dp_audio_hw_params] Header Byte 1: value = 0xd8050000, parity_byte 
= 0xd8
[drm:dp_audio_hw_params] Header Byte 2: value = 0x4b0f, parity_byte = 0x4b
[drm:dp_audio_hw_params] Header Byte 3: value = 0x4b0f, parity_byte = 0x0
[drm:dp_audio_hw_params] Header Byte 1: value = 0x71060000, parity_byte 
= 0x71
[drm:dp_audio_hw_params] Header Byte 2: value = 0x4b0f, parity_byte = 0x4b
[drm:dp_catalog_audio_config_acr] select: 0x3, acr_ctrl: 0x80004130
[drm:dp_catalog_audio_sfe_level] mainlink_level = 0xa08, 
safe_to_exit_level = 0x8
[drm:dp_catalog_audio_enable] dp_audio_cfg = 0xc1
qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
q6apm-lpass-dais 30000000.remoteproc:glink-edge:gpr:service@1:bedais: 
Failed to prepare Graph -22
q6apm-lpass-dais 30000000.remoteproc:glink-edge:gpr:service@1:bedais: 
ASoC: error at snd_soc_pcm_dai_prepare on DISPLAY_PORT_RX_0: -22
[drm:dp_catalog_audio_enable] dp_audio_cfg = 0xc0

> 
> --srini
> 
> 
> 
>> 0x01001006 cmd
>> [ 1552.314463] qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
>> [ 1552.315496] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>> 0x01001006 cmd
>> [ 1552.315506] qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
>> [ 1552.316033] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>> 0x01001001 cmd
>> [ 1552.316042] qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
>> [ 1552.316045] q6apm-lpass-dais 
>> 30000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare 
>> Graph -22
>> [ 1552.316047] q6apm-lpass-dais 
>> 30000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at 
>> snd_soc_pcm_dai_prepare on DISPLAY_PORT_RX_0: -22
Dmitry Baryshkov May 30, 2024, 10:56 p.m. UTC | #9
On Tue, Apr 23, 2024 at 01:38:18PM +0100, Srinivas Kandagatla wrote:
> 
> 
> On 23/04/2024 12:59, Johan Hovold wrote:
> > On Mon, Apr 22, 2024 at 02:43:50PM +0100, Srinivas Kandagatla wrote:
> > > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> > > 
> > > This patchset adds support for.
> > > 	1. parse Display Port module tokens from ASoC topology
> > > 	2. add support to DP/HDMI Jack events.
> > > 	3. fixes a typo in function name in sm8250
> > > 
> > > Verified these patches on X13s along with changes to tplg in
> > > https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
> > > and ucm changes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
> > 
> > It looks like your UCM changes are still muxing the speaker and *each*
> > displayport output so that you can only use one device at a time (i.e.
> > only Speaker or DP1 or DP2 can be used).
> that is true.
> 
> What is the use-case to use more than one audio sink devices at the same
> time for a laptops?

Consider multi-seat setup, with each monitor having its own set of
keyboard, mouse, headphone and user behind it.

> 
> How do you test it? I never tested anything like that on a full desktop
> setup.
> 
> May be some manual setup in Wireplumber, but not 100% sure about multiple
> stream handling.
> 
> > 
> > As we discussed off list last week, this seems unnecessarily limited and
> > as far as I understood is mostly needed to work around some
> > implementation details (not sure why DP1 and DP2 can't be used in
> > parallel either).
> 
> It is absolutely possible to run all the streams in parallel from the Audio
> hardware and DSP point of view.
> 
> One thing to note is, On Qualcomm DP IP, we can not read/write registers if
> the DP port is not connected, which means that we can not send data in such
> cases.

How is this handled for the native HDMI playback on platforms like
Dragonboard 820c? As far as I was able to test, playback fails with -EIO
if HDMI output is not enabled or if the DVI monitor is connected.

> 
> This makes it challenging to work with sound-servers like pipewire or
> pulseaudio as they tend to send silence data at very early stages in the
> full system boot up, ignoring state of the Jack events.
> 
> > 
> > Can you please describe the problem here so that we can discuss this
> > before merging an unnecessarily restricted solution which may later be
> > harder to change (e.g. as kernel, topology and ucm may again need to be
> > updated in lock step).
> > 
> >  From what I could tell after a quick look, this series does not
> > necessarily depend on muxing things this way, but please confirm that
> > too.
> 
> These patches have nothing to do with how we model the muxing in UCM or in
> tplg.
> 
> so these can go as it is irrespective of how we want to model the DP sinks
> in the UCM or tplg.
> 
> 
> --srini
> > 
> > Johan
Srinivas Kandagatla June 6, 2024, 9:18 a.m. UTC | #10
Hi Xilin

On 25/05/2024 08:12, Xilin Wu wrote:
> Hi Srini,
> 
> On 2024/5/24 20:50, Srinivas Kandagatla wrote:
>> Hi Xilin,
>>
>> On 23/05/2024 05:09, Xilin Wu wrote:
>>>>
>>>> Srinivas Kandagatla (4):
>>>>    ASoC: qcom: q6dsp: parse Display port tokens
>>>>    ASoC: qcom: common: add Display port Jack function
>>>>    ASoC: qcom: sc8280xp: add Display port Jack
>>>>    ASoC: qcom: sm8250: fix a typo in function name
>>>>
>>>>   sound/soc/qcom/common.c         | 29 +++++++++++++++++++++++++++++
>>>>   sound/soc/qcom/common.h         |  3 +++
>>>>   sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
>>>>   sound/soc/qcom/sc8280xp.c       | 14 ++++++++++++++
>>>>   sound/soc/qcom/sm8250.c         |  4 ++--
>>>>   5 files changed, 74 insertions(+), 2 deletions(-)
>>>>
>>>
>>> Hi Srini,
>>>
>>> I tested this series on SM8550 with tplg in [1] and ucm in [2]. But 
>>> the kernel output errors attached below. Headphone does work properly 
>>> without DisplayPort in the ucm.
>>>
>>> What could be the possible cause of this? Is there any significant 
>>> change from sc8280xp to sm8550?
>>>
>>> -- 
>>> Thanks,
>>> Xilin Wu
>>>
>>> [1] 
>>> https://github.com/edk2-porting/audioreach-topology/blob/sakuramist/QCS8550-AYN-ODIN2.m4
>>> [2] 

For sm8550 you would need this patch for tplg

https://git.codelinaro.org/krzysztof.kozlowski/audioreach-topology/-/commit/d8ef47bc85700a7cdfabee5e06808d9f359b0a26

can you try this as the Container CAP Id changed for platforms from sm8550.

Kryzstof verified Display port tplg and these patches on x1e80100.


thanks,
srini

>>> https://github.com/strongtz/alsa-ucm-conf/blob/odin2/ucm2/Qualcomm/sm8550/HiFi.conf
>>>
>>> [ 1552.313713] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>>> 0x01001000 cmd
>>> [ 1552.313730] qcom-apm gprsvc:service:2:1: DSP returned 
>>> error[1001000] 1
>>> [ 1552.314455] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>>
>> Is the DP cable connected?
> 
> I'm sure that the cable is connected and I have desktop on external 
> display.
> If it's not connected, kernel gives the following error when using aplay:
> 
> hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: error at 
> snd_soc_dai_hw_params on i2s-hifi: -22
> 
>>
>> if its not connected the dsp will throw this error.
>>
>> due to this issue I did workaround this issue by modeling it as 
>> conflicting device to Speaker in x13s ucm.
>>
>> I see in your ucm setup its not the case.
>> which is why you might be hitting this issue.
>>
>> Can you try
>> amixer -c 0 cset iface=MIXER,name='DISPLAY_PORT_RX_0 Audio Mixer 
>> MultiMedia2' 1
>> aplay -D plughw:0,1 some-wav-file.wav
>>
>> both with and without display connected.
>>
> 
> aplay always gives the following error:
> 
> Playing WAVE 'Summer.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, 
> Stereo
> aplay: set_params:1456: Unable to install hw params:
> ACCESS:  RW_INTERLEAVED
> FORMAT:  S16_LE
> SUBFORMAT:  STD
> SAMPLE_BITS: 16
> FRAME_BITS: 32
> CHANNELS: 2
> RATE: 44100
> PERIOD_TIME: (42666 42667)
> PERIOD_SIZE: (1881 1882)
> PERIOD_BYTES: (7524 7528)
> PERIODS: (3 5)
> BUFFER_TIME: (170657 170658)
> BUFFER_SIZE: 7526
> BUFFER_BYTES: 30104
> TICK_TIME: 0
> 
> and kernel gives the following when display is connected:
> 
> [drm:dp_catalog_audio_config_sdp] sdp_cfg = 0x100066
> [drm:dp_catalog_audio_config_sdp] sdp_cfg2 = 0x1b800004
> [drm:dp_audio_hw_params] Header Byte 1: value = 0xce020000, parity_byte 
> = 0xce
> [drm:dp_audio_hw_params] Header Byte 2: value = 0x67010000, parity_byte 
> = 0x0
> [drm:dp_audio_hw_params] Header Byte 3: value = 0x67010000, parity_byte 
> = 0x67
> [drm:dp_audio_hw_params] Header Byte 1: value = 0x67010000, parity_byte 
> = 0x67
> [drm:dp_audio_hw_params] Header Byte 2: value = 0x33443517, parity_byte 
> = 0x35
> [drm:dp_audio_hw_params] Header Byte 3: value = 0x33443517, parity_byte 
> = 0x33
> [drm:dp_audio_hw_params] Header Byte 1: value = 0x84840000, parity_byte 
> = 0x84
> [drm:dp_audio_hw_params] Header Byte 2: value = 0x3344d71b, parity_byte 
> = 0xd7
> [drm:dp_audio_hw_params] Header Byte 3: value = 0x44, parity_byte = 0x33
> [drm:dp_audio_hw_params] Header Byte 1: value = 0xd8050000, parity_byte 
> = 0xd8
> [drm:dp_audio_hw_params] Header Byte 2: value = 0x4b0f, parity_byte = 0x4b
> [drm:dp_audio_hw_params] Header Byte 3: value = 0x4b0f, parity_byte = 0x0
> [drm:dp_audio_hw_params] Header Byte 1: value = 0x71060000, parity_byte 
> = 0x71
> [drm:dp_audio_hw_params] Header Byte 2: value = 0x4b0f, parity_byte = 0x4b
> [drm:dp_catalog_audio_config_acr] select: 0x3, acr_ctrl: 0x80004130
> [drm:dp_catalog_audio_sfe_level] mainlink_level = 0xa08, 
> safe_to_exit_level = 0x8
> [drm:dp_catalog_audio_enable] dp_audio_cfg = 0xc1
> qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> q6apm-lpass-dais 30000000.remoteproc:glink-edge:gpr:service@1:bedais: 
> Failed to prepare Graph -22
> q6apm-lpass-dais 30000000.remoteproc:glink-edge:gpr:service@1:bedais: 
> ASoC: error at snd_soc_pcm_dai_prepare on DISPLAY_PORT_RX_0: -22
> [drm:dp_catalog_audio_enable] dp_audio_cfg = 0xc0
> 
>>
>> --srini
>>
>>
>>
>>> 0x01001006 cmd
>>> [ 1552.314463] qcom-apm gprsvc:service:2:1: DSP returned 
>>> error[1001006] 1
>>> [ 1552.315496] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>>> 0x01001006 cmd
>>> [ 1552.315506] qcom-apm gprsvc:service:2:1: DSP returned 
>>> error[1001006] 1
>>> [ 1552.316033] qcom-apm gprsvc:service:2:1: Error (1) Processing 
>>> 0x01001001 cmd
>>> [ 1552.316042] qcom-apm gprsvc:service:2:1: DSP returned 
>>> error[1001001] 1
>>> [ 1552.316045] q6apm-lpass-dais 
>>> 30000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to 
>>> prepare Graph -22
>>> [ 1552.316047] q6apm-lpass-dais 
>>> 30000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at 
>>> snd_soc_pcm_dai_prepare on DISPLAY_PORT_RX_0: -22
>
Xilin Wu June 8, 2024, 11:41 a.m. UTC | #11
On 2024/6/6 17:18, Srinivas Kandagatla wrote:
> Hi Xilin
> 
> On 25/05/2024 08:12, Xilin Wu wrote:
>> Hi Srini,
>>
>> On 2024/5/24 20:50, Srinivas Kandagatla wrote:
>>> Hi Xilin,
>>>
>>> On 23/05/2024 05:09, Xilin Wu wrote:
>>>>>
>>>>> Srinivas Kandagatla (4):
>>>>>    ASoC: qcom: q6dsp: parse Display port tokens
>>>>>    ASoC: qcom: common: add Display port Jack function
>>>>>    ASoC: qcom: sc8280xp: add Display port Jack
>>>>>    ASoC: qcom: sm8250: fix a typo in function name
>>>>>
>>>>>   sound/soc/qcom/common.c         | 29 +++++++++++++++++++++++++++++
>>>>>   sound/soc/qcom/common.h         |  3 +++
>>>>>   sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
>>>>>   sound/soc/qcom/sc8280xp.c       | 14 ++++++++++++++
>>>>>   sound/soc/qcom/sm8250.c         |  4 ++--
>>>>>   5 files changed, 74 insertions(+), 2 deletions(-)
>>>>>
>>>>
>>>> Hi Srini,
>>>>
>>>> I tested this series on SM8550 with tplg in [1] and ucm in [2]. But 
>>>> the kernel output errors attached below. Headphone does work 
>>>> properly without DisplayPort in the ucm.
>>>>
>>>> What could be the possible cause of this? Is there any significant 
>>>> change from sc8280xp to sm8550?
>>>>
>>>> -- 
>>>> Thanks,
>>>> Xilin Wu
>>>>
>>>> [1] 
>>>> https://github.com/edk2-porting/audioreach-topology/blob/sakuramist/QCS8550-AYN-ODIN2.m4
>>>> [2] 
> 
> For sm8550 you would need this patch for tplg
> 
> https://git.codelinaro.org/krzysztof.kozlowski/audioreach-topology/-/commit/d8ef47bc85700a7cdfabee5e06808d9f359b0a26
> 
> can you try this as the Container CAP Id changed for platforms from sm8550.
> 
> Kryzstof verified Display port tplg and these patches on x1e80100.
> 

That exactly solved the previous problem, thanks!

Hot-unplugging type-c caused `fail to close APM port` error, and DP 
audio will no longer work after that. But I guess that would be another 
issue anyway :)