[PATCH v4 0/5] Add DisplayPort sound support for Fairphone 5 smartphone

Add the necessary sound card bits and some dts additions to enable sound over DisplayPort-over-USB-C, e.g. to a connected TV or monitor.
The UCM files can be found here: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/t...
This series - in spirit - depends on the series enabling DisplayPort in the first place, but can land pretty independently, especially the ASoC bits: https://lore.kernel.org/linux-arm-msm/20250312-fp5-pmic-glink-dp-v2-0-a55927...
The ASoC bits depend on the patches for USB audio offloading merged through Greg's tree so this cannot easily be applied for v6.16 through the sound tree. Either it waits for v6.17 or also goes through Greg's tree.
Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- Changes in v4: - Use "sm4250" for qcom,qrb4210-rb2-sndcard (Srinivas) - Expand cover letter to mention dependencies for ASoC patches - Pick up tags - Link to v3: https://lore.kernel.org/r/20250425-fp5-dp-sound-v3-0-7cb45180091b@fairphone....
Changes in v3: - Simplify return qcom_snd_wcd_jack_setup in machine driver - Pick up tags - Link to v2: https://lore.kernel.org/r/20250418-fp5-dp-sound-v2-0-05d65f084b05@fairphone....
Changes in v2: - Revamp series based on comments on v1, doesn't have much too much in common anymore - Use sm8250 instead of sc8280xp sndcard file, so port other required changes from sc8280xp.c to sm8250.c - This also changes the sound card compatible to from qcom,qcm6490-sndcard to fairphone,fp5-sndcard - Link to v1: https://lore.kernel.org/r/20240809-fp5-dp-sound-v1-0-d7ba2c24f6b9@fairphone....
--- Luca Weiss (5): ASoC: dt-bindings: qcom,sm8250: Add Fairphone 5 sound card ASoC: qcom: sm8250: set card driver name from match data ASoC: qcom: sm8250: add DisplayPort Jack support ASoC: qcom: sm8250: Add Fairphone 5 soundcard compatible arm64: dts: qcom: qcm6490-fairphone-fp5: Add DisplayPort sound support
.../devicetree/bindings/sound/qcom,sm8250.yaml | 1 + arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 31 ++++++++++++++++++++++ sound/soc/qcom/sm8250.c | 27 ++++++++++--------- 3 files changed, 47 insertions(+), 12 deletions(-) --- base-commit: f819a667fa466d3b96b542b147053b6873f18ea1 change-id: 20240809-fp5-dp-sound-b3768f3019bd
Best regards,

Document the bindings for the sound card on Fairphone 5 which uses the older non-audioreach audio architecture.
Acked-by: Rob Herring (Arm) robh@kernel.org Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- Documentation/devicetree/bindings/sound/qcom,sm8250.yaml | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml index 4e208cb7f6c61adfd4b687227038d275f849480a..57f62a228c262f38e703816efdcf443355052619 100644 --- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml @@ -28,6 +28,7 @@ properties: - qcom,sm8750-sndcard - const: qcom,sm8450-sndcard - enum: + - fairphone,fp5-sndcard - qcom,apq8096-sndcard - qcom,qcm6490-idp-sndcard - qcom,qcs6490-rb3gen2-sndcard

Sound machine drivers for Qualcomm SoCs can be reused across multiple SoCs. But user space ALSA UCM files depend on the card driver name which should be set per board/SoC.
Allow such customization by using driver match data as sound card driver name. The QRB4210 RB2 gets its name set to "sm4250" as requested by Srinivas Kandagatla, and since no (known) UCM has been written yet this should not break anything.
Also while we're already touching these lines, sort the compatibles alphabetically.
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com Reviewed-by: Neil Armstrong neil.armstrong@linaro.org Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- sound/soc/qcom/sm8250.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index b70b2a5031dfbf69024666f8a1049c263efcde0a..f0d83a843765d8dcdd51569e7cbc95eb72292497 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -16,7 +16,6 @@ #include "usb_offload_utils.h" #include "sdw.h"
-#define DRIVER_NAME "sm8250" #define MI2S_BCLK_RATE 1536000
struct sm8250_snd_data { @@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev) if (ret) return ret;
- card->driver_name = DRIVER_NAME; + card->driver_name = of_device_get_match_data(dev); sm8250_add_be_ops(card); return devm_snd_soc_register_card(dev, card); }
static const struct of_device_id snd_sm8250_dt_match[] = { - {.compatible = "qcom,sm8250-sndcard"}, - {.compatible = "qcom,qrb4210-rb2-sndcard"}, - {.compatible = "qcom,qrb5165-rb5-sndcard"}, + { .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm4250" }, + { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" }, + { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {} };

On 5/7/25 09:01, Luca Weiss wrote:
Sound machine drivers for Qualcomm SoCs can be reused across multiple SoCs. But user space ALSA UCM files depend on the card driver name which should be set per board/SoC.
Allow such customization by using driver match data as sound card driver name. The QRB4210 RB2 gets its name set to "sm4250" as requested by Srinivas Kandagatla, and since no (known) UCM has been written yet this should not break anything.
Also while we're already touching these lines, sort the compatibles alphabetically.
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com Reviewed-by: Neil Armstrong neil.armstrong@linaro.org Signed-off-by: Luca Weiss luca.weiss@fairphone.com
Reviewed-by: Srinivas Kandagatla srinivas.kandagatla@oss.qualcomm.com
sound/soc/qcom/sm8250.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index b70b2a5031dfbf69024666f8a1049c263efcde0a..f0d83a843765d8dcdd51569e7cbc95eb72292497 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -16,7 +16,6 @@ #include "usb_offload_utils.h" #include "sdw.h"
-#define DRIVER_NAME "sm8250" #define MI2S_BCLK_RATE 1536000
struct sm8250_snd_data { @@ -200,15 +199,15 @@ static int sm8250_platform_probe(struct platform_device *pdev) if (ret) return ret;
- card->driver_name = DRIVER_NAME;
- card->driver_name = of_device_get_match_data(dev); sm8250_add_be_ops(card); return devm_snd_soc_register_card(dev, card);
}
static const struct of_device_id snd_sm8250_dt_match[] = {
- {.compatible = "qcom,sm8250-sndcard"},
- {.compatible = "qcom,qrb4210-rb2-sndcard"},
- {.compatible = "qcom,qrb5165-rb5-sndcard"},
- { .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm4250" },
- { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
- { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {}
};

Add support for DisplayPort Jack events, so that user space can configure the audio routing correctly.
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- sound/soc/qcom/sm8250.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index f0d83a843765d8dcdd51569e7cbc95eb72292497..2317fe285ee7d41689d7fac453164fbe706744ff 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -25,6 +25,7 @@ struct sm8250_snd_data { struct snd_soc_jack jack; struct snd_soc_jack usb_offload_jack; bool usb_offload_jack_setup; + struct snd_soc_jack dp_jack; bool jack_setup; };
@@ -32,14 +33,16 @@ static int sm8250_snd_init(struct snd_soc_pcm_runtime *rtd) { struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); - int ret;
- if (cpu_dai->id == USB_RX) - ret = qcom_snd_usb_offload_jack_setup(rtd, &data->usb_offload_jack, - &data->usb_offload_jack_setup); - else - ret = qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); - return ret; + switch (cpu_dai->id) { + case DISPLAY_PORT_RX: + return qcom_snd_dp_jack_setup(rtd, &data->dp_jack, 0); + case USB_RX: + return qcom_snd_usb_offload_jack_setup(rtd, &data->usb_offload_jack, + &data->usb_offload_jack_setup); + default: + return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); + } }
static void sm8250_snd_exit(struct snd_soc_pcm_runtime *rtd)

On 5/7/25 09:01, Luca Weiss wrote:
Add support for DisplayPort Jack events, so that user space can configure the audio routing correctly.
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com Signed-off-by: Luca Weiss luca.weiss@fairphone.com
Reviewed-by: Srinivas Kandagatla srinivas.kandagatla@oss.qualcomm.com
sound/soc/qcom/sm8250.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index f0d83a843765d8dcdd51569e7cbc95eb72292497..2317fe285ee7d41689d7fac453164fbe706744ff 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -25,6 +25,7 @@ struct sm8250_snd_data { struct snd_soc_jack jack; struct snd_soc_jack usb_offload_jack; bool usb_offload_jack_setup;
- struct snd_soc_jack dp_jack; bool jack_setup;
};
@@ -32,14 +33,16 @@ static int sm8250_snd_init(struct snd_soc_pcm_runtime *rtd) { struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
int ret;
if (cpu_dai->id == USB_RX)
ret = qcom_snd_usb_offload_jack_setup(rtd, &data->usb_offload_jack,
&data->usb_offload_jack_setup);
else
ret = qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
return ret;
- switch (cpu_dai->id) {
- case DISPLAY_PORT_RX:
return qcom_snd_dp_jack_setup(rtd, &data->dp_jack, 0);
- case USB_RX:
return qcom_snd_usb_offload_jack_setup(rtd, &data->usb_offload_jack,
&data->usb_offload_jack_setup);
- default:
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
- }
}
static void sm8250_snd_exit(struct snd_soc_pcm_runtime *rtd)

Add a compatible for the QCM6490-based Fairphone 5 which can use this machine driver.
As a note, QCM6490 RB3 board is using audioreach architecture while Fairphone 5 uses pre-audioreach.
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com Reviewed-by: Neil Armstrong neil.armstrong@linaro.org Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- sound/soc/qcom/sm8250.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index 2317fe285ee7d41689d7fac453164fbe706744ff..69c514fad0b1babafae4b61bb5ac944c6b4906dd 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -208,6 +208,7 @@ static int sm8250_platform_probe(struct platform_device *pdev) }
static const struct of_device_id snd_sm8250_dt_match[] = { + { .compatible = "fairphone,fp5-sndcard", .data = "qcm6490" }, { .compatible = "qcom,qrb4210-rb2-sndcard", .data = "sm4250" }, { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" }, { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" },

Add the required nodes for sound playback via a connected external display (DisplayPort over USB-C).
In user space just the following route needs to be set (e.g. using ALSA UCM):
amixer -c0 cset name='DISPLAY_PORT_RX Audio Mixer MultiMedia1' 1
Afterwards one can play audio on the MultiMedia1 sound device, e.g.:
aplay -D plughw:0,0 test.wav
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index 9e8f9fb57c4723a24704a8239a86c6081910916b..e115b6a52b299ef663ccfb614785f8f89091f39d 100644 --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts @@ -14,6 +14,8 @@ #include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> #include <dt-bindings/regulator/qcom,rpmh-regulator.h> +#include <dt-bindings/sound/qcom,q6asm.h> +#include <dt-bindings/sound/qcom,q6dsp-lpass-ports.h> #include "sc7280.dtsi" #include "pm7250b.dtsi" #include "pm7325.dtsi" @@ -1147,6 +1149,35 @@ &sdhc_2 { status = "okay"; };
+&sound { + compatible = "fairphone,fp5-sndcard"; + model = "Fairphone 5"; + + mm1-dai-link { + link-name = "MultiMedia1"; + + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>; + }; + }; + + displayport-rx-dai-link { + link-name = "DisplayPort Playback"; + + codec { + sound-dai = <&mdss_dp>; + }; + + cpu { + sound-dai = <&q6afedai DISPLAY_PORT_RX>; + }; + + platform { + sound-dai = <&q6routing>; + }; + }; +}; + &spi13 { status = "okay";

On Wed, 07 May 2025 10:01:36 +0200, Luca Weiss wrote:
Add the necessary sound card bits and some dts additions to enable sound over DisplayPort-over-USB-C, e.g. to a connected TV or monitor.
The UCM files can be found here: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/t...
This series - in spirit - depends on the series enabling DisplayPort in the first place, but can land pretty independently, especially the ASoC bits: https://lore.kernel.org/linux-arm-msm/20250312-fp5-pmic-glink-dp-v2-0-a55927...
[...]
Applied, thanks!
[5/5] arm64: dts: qcom: qcm6490-fairphone-fp5: Add DisplayPort sound support commit: 8fc88fbd471044d66cb2fd85dc0d431866ed7448
Best regards,
participants (3)
-
Bjorn Andersson
-
Luca Weiss
-
Srinivas Kandagatla