[PATCH v3 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...
Signed-off-by: Luca Weiss luca.weiss@fairphone.com --- 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: 7f1dd4e6634d085f3c9652d4e0f1903659fb96f9 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.
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..e920b413b762c803cfcc4049f35deba828275478 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 = "sm8250" }, + { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" }, + { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {} };

On Fri, Apr 25, 2025 at 10:07:26AM +0200, 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.
This doesn't apply against current code, please check and resend.

Hi Mark,
On Fri Apr 25, 2025 at 2:12 PM CEST, Mark Brown wrote:
On Fri, Apr 25, 2025 at 10:07:26AM +0200, 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.
This doesn't apply against current code, please check and resend.
I've based this series on next-20250417 tag, so this is probably due to the changes from the USB sound offloading series that Greg has picked up.
So either Greg also picks up these changes when they're ready, or we wait until 6.17?
Regards Luca

On Fri, Apr 25, 2025 at 08:19:39PM +0200, Luca Weiss wrote:
I've based this series on next-20250417 tag, so this is probably due to the changes from the USB sound offloading series that Greg has picked up.
So either Greg also picks up these changes when they're ready, or we wait until 6.17?
Or base it on my tree and let things get sorted in the merge, I don't know what the conflicts might be?

On Fri Apr 25, 2025 at 9:03 PM CEST, Mark Brown wrote:
On Fri, Apr 25, 2025 at 08:19:39PM +0200, Luca Weiss wrote:
I've based this series on next-20250417 tag, so this is probably due to the changes from the USB sound offloading series that Greg has picked up.
So either Greg also picks up these changes when they're ready, or we wait until 6.17?
Or base it on my tree and let things get sorted in the merge, I don't know what the conflicts might be?
For this patch here it might be okay but patch 3/5 from this series very much depends on the patch in Greg's tree, given it refactors/expands on the USB_RX if there. Resolving this through merge wouldn't be very pretty.
Regards Luca

On Fri, Apr 25, 2025 at 10:47:42PM +0200, Luca Weiss wrote:
On Fri Apr 25, 2025 at 9:03 PM CEST, Mark Brown wrote:
Or base it on my tree and let things get sorted in the merge, I don't know what the conflicts might be?
For this patch here it might be okay but patch 3/5 from this series very much depends on the patch in Greg's tree, given it refactors/expands on the USB_RX if there. Resolving this through merge wouldn't be very pretty.
Well, unfortunately Greg didn't put things on a branch so yeah waiting for next release might be easiest.

On Fri, Apr 25, 2025 at 10:07:26AM +0200, 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.
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..e920b413b762c803cfcc4049f35deba828275478 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 = "sm8250" },
sm4250 for rb2?
- { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
- { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {}
};
-- 2.49.0

Hi Srini,
Srinivas Kandagatla srini@kernel.org schreef op 1 mei 2025 13:37:45 CEST:
On Fri, Apr 25, 2025 at 10:07:26AM +0200, 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.
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..e920b413b762c803cfcc4049f35deba828275478 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 = "sm8250" },
sm4250 for rb2?
Since this name is visible to user space and used for picking the UCM config, I don't think it's a good idea to change it.
Regards Luca
- { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
- { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {}
};
-- 2.49.0

On 5/1/25 15:13, Luca Weiss wrote:
Hi Srini,
Srinivas Kandagatla srini@kernel.org schreef op 1 mei 2025 13:37:45 CEST:
On Fri, Apr 25, 2025 at 10:07:26AM +0200, 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.
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..e920b413b762c803cfcc4049f35deba828275478 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 = "sm8250" },
sm4250 for rb2?
Since this name is visible to user space and used for picking the UCM config, I don't think it's a good idea to change it.
It is not correct to pretend that rb2 is sm8250 for ucm cases, I agree previous code was already doing this, Good thing is that we do not have a ucm written yet for RB2.
Lets fix this as you are already doing this for other compatibles.
--srini
Regards Luca
- { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
- { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {}
};
-- 2.49.0

Hi Srini,
On Fri May 2, 2025 at 1:06 PM CEST, Srinivas Kandagatla wrote:
On 5/1/25 15:13, Luca Weiss wrote:
Hi Srini,
Srinivas Kandagatla srini@kernel.org schreef op 1 mei 2025 13:37:45 CEST:
On Fri, Apr 25, 2025 at 10:07:26AM +0200, 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.
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..e920b413b762c803cfcc4049f35deba828275478 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 = "sm8250" },
sm4250 for rb2?
Since this name is visible to user space and used for picking the UCM config, I don't think it's a good idea to change it.
It is not correct to pretend that rb2 is sm8250 for ucm cases, I agree previous code was already doing this, Good thing is that we do not have a ucm written yet for RB2.
Lets fix this as you are already doing this for other compatibles.
Okay, will change this in v4.
Regards Luca
--srini
Regards Luca
- { .compatible = "qcom,qrb5165-rb5-sndcard", .data = "sm8250" },
- { .compatible = "qcom,sm8250-sndcard", .data = "sm8250" }, {}
};
-- 2.49.0

Add support for DisplayPort Jack events, so that user space can configure the audio routing correctly.
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 e920b413b762c803cfcc4049f35deba828275478..a4bf6eff811ea3e2b005071cf3410e5a0410f5d8 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 Fri, Apr 25, 2025 at 10:07:27AM +0200, Luca Weiss wrote:
Add support for DisplayPort Jack events, so that user space can configure the audio routing correctly.
Signed-off-by: Luca Weiss luca.weiss@fairphone.com
sound/soc/qcom/sm8250.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@oss.qualcomm.com

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 a4bf6eff811ea3e2b005071cf3410e5a0410f5d8..43c93e24d77259f232062c7e4182a39151111c59 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 = "sm8250" }, { .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";
participants (6)
-
Dmitry Baryshkov
-
Luca Weiss
-
Luca Weiss
-
Mark Brown
-
Srinivas Kandagatla
-
Srinivas Kandagatla