2024-06-06 10:49:40

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v3 0/4] ASoC: qcom: display port changes

From: Srinivas Kandagatla <[email protected]>

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

x1e80100 is verified by Krzysztof with his changes in tplg

https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits

Thanks,
Srini

Changes since v2:
- remove hdmi references.
- added more DP jacks
- added some comments in code
- added x1e80100 patch to this series

Krzysztof Kozlowski (1):
ASoC: qcom: x1e80100: Add USB DisplayPort plug support

Srinivas Kandagatla (3):
ASoC: qcom: q6dsp: parse Display port tokens
ASoC: qcom: common: add Display port Jack function
ASoC: qcom: sc8280xp: add Display port Jack

sound/soc/qcom/common.c | 35 +++++++++++++++++++++++++++++++++
sound/soc/qcom/common.h | 3 +++
sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++
sound/soc/qcom/sc8280xp.c | 15 ++++++++++++++
sound/soc/qcom/x1e80100.c | 20 +++++++++++++++++++
5 files changed, 99 insertions(+)

--
2.43.0



2024-06-06 10:49:52

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v3 1/4] ASoC: qcom: q6dsp: parse Display port tokens

From: Srinivas Kandagatla <[email protected]>

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index 70572c83e101..27a5adb201c3 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -730,6 +730,29 @@ static int audioreach_widget_i2s_module_load(struct audioreach_module *mod,
return 0;
}

+static int audioreach_widget_dp_module_load(struct audioreach_module *mod,
+ struct snd_soc_tplg_vendor_array *mod_array)
+{
+ struct snd_soc_tplg_vendor_value_elem *mod_elem;
+ int tkn_count = 0;
+
+ mod_elem = mod_array->value;
+
+ while (tkn_count <= (le32_to_cpu(mod_array->num_elems) - 1)) {
+ switch (le32_to_cpu(mod_elem->token)) {
+ case AR_TKN_U32_MODULE_FMT_DATA:
+ mod->data_format = le32_to_cpu(mod_elem->value);
+ break;
+ default:
+ break;
+ }
+ tkn_count++;
+ mod_elem++;
+ }
+
+ return 0;
+}
+
static int audioreach_widget_load_buffer(struct snd_soc_component *component,
int index, struct snd_soc_dapm_widget *w,
struct snd_soc_tplg_dapm_widget *tplg_w)
@@ -760,6 +783,9 @@ static int audioreach_widget_load_buffer(struct snd_soc_component *component,
case MODULE_ID_I2S_SOURCE:
audioreach_widget_i2s_module_load(mod, mod_array);
break;
+ case MODULE_ID_DISPLAY_PORT_SINK:
+ audioreach_widget_dp_module_load(mod, mod_array);
+ break;
default:
return -EINVAL;
}
--
2.43.0


2024-06-06 10:50:05

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v3 2/4] ASoC: qcom: common: add Display port Jack function

From: Srinivas Kandagatla <[email protected]>

Add a common function to add Display port jack.

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/common.c | 35 +++++++++++++++++++++++++++++++++++
sound/soc/qcom/common.h | 3 +++
2 files changed, 38 insertions(+)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 3d02aa3844f2..56b4a3654aec 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -8,9 +8,19 @@
#include <linux/input-event-codes.h>
#include "common.h"

+#define NAME_SIZE 32
+
static const struct snd_soc_dapm_widget qcom_jack_snd_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
+ SND_SOC_DAPM_SPK("DP0 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP1 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP2 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP3 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP4 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP5 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP6 Jack", NULL),
+ SND_SOC_DAPM_SPK("DP7 Jack", NULL),
};

int qcom_snd_parse_of(struct snd_soc_card *card)
@@ -240,5 +250,30 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
}
EXPORT_SYMBOL_GPL(qcom_snd_wcd_jack_setup);

+int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *dp_jack, int dp_pcm_id)
+{
+ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
+ struct snd_soc_card *card = rtd->card;
+ char jack_name[NAME_SIZE];
+ int rval, i;
+
+ snprintf(jack_name, sizeof(jack_name), "DP%d Jack", dp_pcm_id);
+ rval = snd_soc_card_jack_new(card, jack_name, SND_JACK_AVOUT, dp_jack);
+ if (rval)
+ return rval;
+
+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
+ rval = snd_soc_component_set_jack(codec_dai->component, dp_jack, NULL);
+ if (rval != 0 && rval != -ENOTSUPP) {
+ dev_warn(card->dev, "Failed to set jack: %d\n", rval);
+ return rval;
+ }
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(qcom_snd_dp_jack_setup);
+
MODULE_DESCRIPTION("ASoC Qualcomm helper functions");
MODULE_LICENSE("GPL");
diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h
index d7f80ee5ae26..1b8d3f90bffa 100644
--- a/sound/soc/qcom/common.h
+++ b/sound/soc/qcom/common.h
@@ -9,5 +9,8 @@
int qcom_snd_parse_of(struct snd_soc_card *card);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup);
+int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *dp_jack, int id);
+

#endif
--
2.43.0


2024-06-06 10:50:38

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v3 4/4] ASoC: qcom: x1e80100: Add USB DisplayPort plug support

From: Krzysztof Kozlowski <[email protected]>

Add support for handling jack events of USB (DisplayPort).

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/x1e80100.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c
index 0e0773a85809..789d833bcd2f 100644
--- a/sound/soc/qcom/x1e80100.c
+++ b/sound/soc/qcom/x1e80100.c
@@ -19,12 +19,32 @@ struct x1e80100_snd_data {
struct snd_soc_card *card;
struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack;
+ struct snd_soc_jack dp_jack[8];
bool jack_setup;
};

static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
{
struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_jack *dp_jack = NULL;
+ int dp_pcm_id = 0;
+
+ switch (cpu_dai->id) {
+ case DISPLAY_PORT_RX_0:
+ dp_pcm_id = 0;
+ dp_jack = &data->dp_jack[dp_pcm_id];
+ break;
+ case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
+ dp_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
+ dp_jack = &data->dp_jack[dp_pcm_id];
+ break;
+ default:
+ break;
+ }
+
+ if (dp_jack)
+ return qcom_snd_dp_jack_setup(rtd, dp_jack, dp_pcm_id);

return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}
--
2.43.0


2024-06-06 11:16:55

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v3 3/4] ASoC: qcom: sc8280xp: add Display port Jack

From: Srinivas Kandagatla <[email protected]>

Add support for Display Port Jack events.

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/sc8280xp.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index 06fd47c4178f..922ecada1cd8 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -19,6 +19,7 @@ struct sc8280xp_snd_data {
struct snd_soc_card *card;
struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack;
+ struct snd_soc_jack dp_jack[8];
bool jack_setup;
};

@@ -27,6 +28,8 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_jack *dp_jack = NULL;
+ int dp_pcm_id = 0;

switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
@@ -41,10 +44,22 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
break;
+ case DISPLAY_PORT_RX_0:
+ /* DISPLAY_PORT dai ids are not contiguous */
+ dp_pcm_id = 0;
+ dp_jack = &data->dp_jack[dp_pcm_id];
+ break;
+ case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
+ dp_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
+ dp_jack = &data->dp_jack[dp_pcm_id];
+ break;
default:
break;
}

+ if (dp_jack)
+ return qcom_snd_dp_jack_setup(rtd, dp_jack, dp_pcm_id);
+
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}

--
2.43.0


2024-06-08 02:23:54

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes

On Thu, Jun 06, 2024 at 11:49:18AM +0100, [email protected] wrote:
> From: Srinivas Kandagatla <[email protected]>
>
> 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
>
> x1e80100 is verified by Krzysztof with his changes in tplg
>
> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
>
> Thanks,
> Srini
>

I have been testing this patchset on X13s, switching between speakers,
connected and disconnected DP output.

- Once the DSP got into the state, where I could not further get it to
work until the reboot:

rohan pipewire[1749]: spa.alsa: set_hw_params: Invalid argument
rohan pipewire[1749]: pw.node: (alsa_output.platform-sound.HiFi__hw_SC8280XPLENOVOX_1__sink-48) suspended -> error (Start error: Invalid argument)
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare Graph -22
rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at snd_soc_pcm_dai_prepare on WSA_CODEC_DMA_RX_0: -22
rohan pipewire[1749]: spa.alsa: set_hw_params: Invalid argument
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare Graph -22
rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at snd_soc_pcm_dai_prepare on WSA_CODEC_DMA_RX_0: -22
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1


- Once in a while during startup PipeWire will try opening the
incorrect DAI and then fail with:

rohan kernel: hdmi-audio-codec hdmi-audio-codec.8.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
rohan kernel: hdmi-audio-codec hdmi-audio-codec.8.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22

I think this happens if previously I have selected DP as an output,
then closed gnome session, unplugged the cable and tried logging in
again.

Generally, it looks like even though the Jack is reporting
'unplugged', sound daemon still can switch to to the disabled output
(or the audio card can be left in the stale state). In case of DP
this frequently results in audio daemon or DSP failures.

So, the DP implementation needs to be made more robust, so that if
DP output gets selected when the cable is unplugged, the driver will not
attempt to configure the DSP.

--
With best wishes
Dmitry

2024-06-08 09:12:18

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes

Thanks Dmitry for testing this out.

On 08/06/2024 03:23, Dmitry Baryshkov wrote:
> On Thu, Jun 06, 2024 at 11:49:18AM +0100, [email protected] wrote:
>> From: Srinivas Kandagatla <[email protected]>
>>
>> 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
>>
>> x1e80100 is verified by Krzysztof with his changes in tplg
>>
>> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
>>
>> Thanks,
>> Srini
>>
>
> I have been testing this patchset on X13s, switching between speakers,
> connected and disconnected DP output.
>

This series changed the Jack event names by removing HDMI string from it
as suggested, did you update the UCM to reflect this?
I have pushed changes required to
https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp


Can you also try to clean the asound.state restart the pipewire.

> - Once the DSP got into the state, where I could not further get it to
> work until the reboot:
>
> rohan pipewire[1749]: spa.alsa: set_hw_params: Invalid argument
> rohan pipewire[1749]: pw.node: (alsa_output.platform-sound.HiFi__hw_SC8280XPLENOVOX_1__sink-48) suspended -> error (Start error: Invalid argument)
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare Graph -22
> rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at snd_soc_pcm_dai_prepare on WSA_CODEC_DMA_RX_0: -22
> rohan pipewire[1749]: spa.alsa: set_hw_params: Invalid argument
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare Graph -22
> rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at snd_soc_pcm_dai_prepare on WSA_CODEC_DMA_RX_0: -22
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
>
>
> - Once in a while during startup PipeWire will try opening the
> incorrect DAI and then fail with:
>
> rohan kernel: hdmi-audio-codec hdmi-audio-codec.8.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
> rohan kernel: hdmi-audio-codec hdmi-audio-codec.8.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
>
> I think this happens if previously I have selected DP as an output,
> then closed gnome session, unplugged the cable and tried logging in
> again.
>
> Generally, it looks like even though the Jack is reporting
> 'unplugged', sound daemon still can switch to to the disabled output
I think this is to do with ucm changes requried for new jack name.

> (or the audio card can be left in the stale state). In case of DP
> this frequently results in audio daemon or DSP failures.
>
> So, the DP implementation needs to be made more robust, so that if
> DP output gets selected when the cable is unplugged, the driver will not
> attempt to configure the DSP.

I have tested this with

kernel:
https://git.codelinaro.org/srinivas.kandagatla/linux/-/tree/dp/sc8280xp-6.10-rc1?ref_type=heads
ucm: https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
tplg:
https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads


with the above on my x13s, I can properly do switching between dp0,dp1
and speakers with no issues.

Can you try them?

thanks,
Srini

>

2024-06-08 14:56:34

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes

On Sat, 8 Jun 2024 at 12:12, Srinivas Kandagatla
<[email protected]> wrote:
>
> Thanks Dmitry for testing this out.
>
> On 08/06/2024 03:23, Dmitry Baryshkov wrote:
> > On Thu, Jun 06, 2024 at 11:49:18AM +0100, [email protected] wrote:
> >> From: Srinivas Kandagatla <[email protected]>
> >>
> >> 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
> >>
> >> x1e80100 is verified by Krzysztof with his changes in tplg
> >>
> >> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
> >>
> >> Thanks,
> >> Srini
> >>
> >
> > I have been testing this patchset on X13s, switching between speakers,
> > connected and disconnected DP output.
> >
>
> This series changed the Jack event names by removing HDMI string from it
> as suggested, did you update the UCM to reflect this?

Yes, I did. The pipewire properly reports 'unconnected' state, but
nothing stops user from selecting the unconnected device / verb.

> I have pushed changes required to
> https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
>
>
> Can you also try to clean the asound.state restart the pipewire.
>
> > - Once the DSP got into the state, where I could not further get it to
> > work until the reboot:
> >
> > rohan pipewire[1749]: spa.alsa: set_hw_params: Invalid argument
> > rohan pipewire[1749]: pw.node: (alsa_output.platform-sound.HiFi__hw_SC8280XPLENOVOX_1__sink-48) suspended -> error (Start error: Invalid argument)
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> > rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare Graph -22
> > rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at snd_soc_pcm_dai_prepare on WSA_CODEC_DMA_RX_0: -22
> > rohan pipewire[1749]: spa.alsa: set_hw_params: Invalid argument
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> > rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: Failed to prepare Graph -22
> > rohan kernel: q6apm-lpass-dais 3000000.remoteproc:glink-edge:gpr:service@1:bedais: ASoC: error at snd_soc_pcm_dai_prepare on WSA_CODEC_DMA_RX_0: -22
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001006 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001006] 1
> > rohan kernel: qcom-apm gprsvc:service:2:1: Error (1) Processing 0x01001001 cmd
> > rohan kernel: qcom-apm gprsvc:service:2:1: DSP returned error[1001001] 1
> >
> >
> > - Once in a while during startup PipeWire will try opening the
> > incorrect DAI and then fail with:
> >
> > rohan kernel: hdmi-audio-codec hdmi-audio-codec.8.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
> > rohan kernel: hdmi-audio-codec hdmi-audio-codec.8.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
> >
> > I think this happens if previously I have selected DP as an output,
> > then closed gnome session, unplugged the cable and tried logging in
> > again.
> >
> > Generally, it looks like even though the Jack is reporting
> > 'unplugged', sound daemon still can switch to to the disabled output
> I think this is to do with ucm changes requried for new jack name.

No. The jack (and the pipewire status) reports unconnected.

>
> > (or the audio card can be left in the stale state). In case of DP
> > this frequently results in audio daemon or DSP failures.
> >
> > So, the DP implementation needs to be made more robust, so that if
> > DP output gets selected when the cable is unplugged, the driver will not
> > attempt to configure the DSP.
>
> I have tested this with
>
> kernel:
> https://git.codelinaro.org/srinivas.kandagatla/linux/-/tree/dp/sc8280xp-6.10-rc1?ref_type=heads
> ucm: https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
> tplg:
> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
>
>
> with the above on my x13s, I can properly do switching between dp0,dp1
> and speakers with no issues.

Have you tried switching to the unconnected sink? Starting the
pipewire when the previously selected sink is now disconnected?

>
> Can you try them?

Is the changing of the JACK names the only change in the UCM? compared
to your previous version?

I've used the following topology, fom the topology repo / x13s-dp branch

5206af2e1915b8dba52da2e59fb5ebff audioreach-tplg.bin




--
With best wishes
Dmitry

2024-06-10 15:36:17

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes



On 08/06/2024 15:56, Dmitry Baryshkov wrote:
> On Sat, 8 Jun 2024 at 12:12, Srinivas Kandagatla
> <[email protected]> wrote:
>>
>> Thanks Dmitry for testing this out.
>>
>> On 08/06/2024 03:23, Dmitry Baryshkov wrote:
>>> On Thu, Jun 06, 2024 at 11:49:18AM +0100, [email protected] wrote:
>>>> From: Srinivas Kandagatla <[email protected]>
>>>>
>>>> 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
>>>>
>>>> x1e80100 is verified by Krzysztof with his changes in tplg
>>>>
>>>> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
>>>>
>>>> Thanks,
>>>> Srini
>>>>
>>>
>>> I have been testing this patchset on X13s, switching between speakers,
>>> connected and disconnected DP output.
>>>
>>
>> This series changed the Jack event names by removing HDMI string from it
>> as suggested, did you update the UCM to reflect this?
>
> Yes, I did. The pipewire properly reports 'unconnected' state, but
> nothing stops user from selecting the unconnected device / verb.

No, the jack events should prevent that from happening. You should not
see them in output devices in settings->Sound.


>
>> I have pushed changes required to
>> https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
>>
...

>> kernel:
>> https://git.codelinaro.org/srinivas.kandagatla/linux/-/tree/dp/sc8280xp-6.10-rc1?ref_type=heads
>> ucm: https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
>> tplg:
>> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
>>
>>
>> with the above on my x13s, I can properly do switching between dp0,dp1
>> and speakers with no issues.
>
> Have you tried switching to the unconnected sink? Starting the
> pipewire when the previously selected sink is now disconnected?
>
>>
>> Can you try them?
>
> Is the changing of the JACK names the only change in the UCM? compared
> to your previous version?

Yes.

>
> I've used the following topology, fom the topology repo / x13s-dp branch
>
> 5206af2e1915b8dba52da2e59fb5ebff audioreach-tplg.bin
>
>
>
>

2024-06-10 18:01:28

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes

On Mon, 10 Jun 2024 at 18:36, Srinivas Kandagatla
<[email protected]> wrote:
>
>
>
> On 08/06/2024 15:56, Dmitry Baryshkov wrote:
> > On Sat, 8 Jun 2024 at 12:12, Srinivas Kandagatla
> > <[email protected]> wrote:
> >>
> >> Thanks Dmitry for testing this out.
> >>
> >> On 08/06/2024 03:23, Dmitry Baryshkov wrote:
> >>> On Thu, Jun 06, 2024 at 11:49:18AM +0100, [email protected] wrote:
> >>>> From: Srinivas Kandagatla <[email protected]>
> >>>>
> >>>> 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
> >>>>
> >>>> x1e80100 is verified by Krzysztof with his changes in tplg
> >>>>
> >>>> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
> >>>>
> >>>> Thanks,
> >>>> Srini
> >>>>
> >>>
> >>> I have been testing this patchset on X13s, switching between speakers,
> >>> connected and disconnected DP output.
> >>>
> >>
> >> This series changed the Jack event names by removing HDMI string from it
> >> as suggested, did you update the UCM to reflect this?
> >
> > Yes, I did. The pipewire properly reports 'unconnected' state, but
> > nothing stops user from selecting the unconnected device / verb.
>
> No, the jack events should prevent that from happening. You should not
> see them in output devices in settings->Sound.

No. With PulseAudio and with PipeWire unconnected devices are still
visible. They are annotated as (unconnected), but it's still possible
to select them.

Anyway, even if the sound daemon were to forbid that (or to hide these
devices), it would be perfectly possible to select them via alsaucm,
not to mention the amixer.

>
>
> >
> >> I have pushed changes required to
> >> https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
> >>
> ...
>
> >> kernel:
> >> https://git.codelinaro.org/srinivas.kandagatla/linux/-/tree/dp/sc8280xp-6.10-rc1?ref_type=heads
> >> ucm: https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp
> >> tplg:
> >> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
> >>
> >>
> >> with the above on my x13s, I can properly do switching between dp0,dp1
> >> and speakers with no issues.
> >
> > Have you tried switching to the unconnected sink? Starting the
> > pipewire when the previously selected sink is now disconnected?
> >
> >>
> >> Can you try them?
> >
> > Is the changing of the JACK names the only change in the UCM? compared
> > to your previous version?
>
> Yes.
>

Then consider it tested with your patches (I did fix the jack names).

--
With best wishes
Dmitry

2024-06-13 10:23:57

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes

On 06/06/2024 12:49, [email protected] wrote:
> From: Srinivas Kandagatla <[email protected]>
>
> 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
>
> x1e80100 is verified by Krzysztof with his changes in tplg
>
> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
>

Entire patchset tested on X1E80100-CRD:

Tested-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2024-06-13 12:41:12

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] ASoC: qcom: display port changes

On Thu, Jun 06, 2024 at 11:49:18AM +0100, [email protected] wrote:
> From: Srinivas Kandagatla <[email protected]>
>
> 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
>
> x1e80100 is verified by Krzysztof with his changes in tplg
>
> https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits

Together with [1] and corresponding DT changes:

Reviewed-by: Dmitry Baryshkov <[email protected]>
Tested-by: Dmitry Baryshkov <[email protected]> # X13s

Note, patch [1] is required to get the switching between Speakers and DP
work in a stable way, so I'd consider for it to be a dependency for this
series.

[1] https://lore.kernel.org/linux-sound/[email protected]/

>
> Thanks,
> Srini
>
> Changes since v2:
> - remove hdmi references.
> - added more DP jacks
> - added some comments in code
> - added x1e80100 patch to this series
>
> Krzysztof Kozlowski (1):
> ASoC: qcom: x1e80100: Add USB DisplayPort plug support
>
> Srinivas Kandagatla (3):
> ASoC: qcom: q6dsp: parse Display port tokens
> ASoC: qcom: common: add Display port Jack function
> ASoC: qcom: sc8280xp: add Display port Jack
>
> sound/soc/qcom/common.c | 35 +++++++++++++++++++++++++++++++++
> sound/soc/qcom/common.h | 3 +++
> sound/soc/qcom/qdsp6/topology.c | 26 ++++++++++++++++++++++++
> sound/soc/qcom/sc8280xp.c | 15 ++++++++++++++
> sound/soc/qcom/x1e80100.c | 20 +++++++++++++++++++
> 5 files changed, 99 insertions(+)
>
> --
> 2.43.0
>

--
With best wishes
Dmitry