2024-03-27 11:34:10

by Mohammad Rafi Shaik

[permalink] [raw]
Subject: [PATCH v1 0/2] ASoC: qcom: add support for qcm6490 machine

This patchset adds support for QCM6490 SoC machine driver.

Mohammad Rafi Shaik (2):
ASoC: dt-bindings: qcom,qcm6490: Add qcm6490 snd qcs6490 sound card
ASoC: qcom: qcm6490: Add machine driver for qcm6490

.../bindings/sound/qcom,sm8250.yaml | 2 +
sound/soc/qcom/Kconfig | 13 ++
sound/soc/qcom/Makefile | 2 +
sound/soc/qcom/qcm6490.c | 173 ++++++++++++++++++
4 files changed, 190 insertions(+)
create mode 100644 sound/soc/qcom/qcm6490.c

--
2.25.1



2024-03-27 11:34:35

by Mohammad Rafi Shaik

[permalink] [raw]
Subject: [PATCH v1 1/2] ASoC: dt-bindings: qcom,qcm6490: Add qcm6490 snd qcs6490 sound card

Document bindings for the Qualcomm qcm6490 and qcs6490 SoC sound card.
The bindings are the same as for other newer Qualcomm ADSP sound cards,
thus keep them in existing qcom,sm8250.yaml file, even though Linux driver
is separate.

Signed-off-by: Mohammad Rafi Shaik <[email protected]>
---
Documentation/devicetree/bindings/sound/qcom,sm8250.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
index 2ab6871e89e5..247ad3d10933 100644
--- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
@@ -29,6 +29,8 @@ properties:
- enum:
- qcom,apq8016-sbc-sndcard
- qcom,msm8916-qdsp6-sndcard
+ - qcom,qcm6490-sndcard
+ - qcom,qcs6490-sndcard
- qcom,qrb5165-rb5-sndcard
- qcom,sc7180-qdsp6-sndcard
- qcom,sc8280xp-sndcard
--
2.25.1


2024-03-27 11:44:24

by Mohammad Rafi Shaik

[permalink] [raw]
Subject: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490

Add machine driver for qcm6490 SoC.

This initial supports which includes WSA883x Speakers with onboard DMIC
connected to internal LPASS codec via VA macros respectively and also
WCD937x based headset.

Add compatible for sound card on Qualcomm qcs6490 boards.

Signed-off-by: Mohammad Rafi Shaik <[email protected]>
---
sound/soc/qcom/Kconfig | 13 +++
sound/soc/qcom/Makefile | 2 +
sound/soc/qcom/qcm6490.c | 173 +++++++++++++++++++++++++++++++++++++++
3 files changed, 188 insertions(+)
create mode 100644 sound/soc/qcom/qcm6490.c

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 762491d6f2f2..0bc536766872 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -151,6 +151,19 @@ config SND_SOC_MSM8996
APQ8096 SoC-based systems.
Say Y if you want to use audio device on this SoCs

+config SND_SOC_QCM6490
+ tristate "SoC Machine driver for QCM6490 boards"
+ depends on QCOM_APR && SOUNDWIRE
+ depends on COMMON_CLK
+ select SND_SOC_QDSP6
+ select SND_SOC_QCOM_COMMON
+ select SND_SOC_QCOM_SDW
+ help
+ Add support for audio on Qualcomm Technologies Inc.
+ QCM6490 SoC-based systems.
+ To compile this driver say Y or M if you want to
+ use audio device on this SoCs.
+
config SND_SOC_SDM845
tristate "SoC Machine driver for SDM845 boards"
depends on QCOM_APR && I2C && SOUNDWIRE
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 34f3fcb8ee9a..feb2c164be69 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_SND_SOC_LPASS_SC7280) += snd-soc-lpass-sc7280.o
snd-soc-storm-objs := storm.o
snd-soc-apq8016-sbc-objs := apq8016_sbc.o
snd-soc-apq8096-objs := apq8096.o
+snd-soc-qcm6490-objs := qcm6490.o
snd-soc-sc7180-objs := sc7180.o
snd-soc-sc7280-objs := sc7280.o
snd-soc-sdm845-objs := sdm845.o
@@ -34,6 +35,7 @@ snd-soc-x1e80100-objs := x1e80100.o
obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o
obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o
obj-$(CONFIG_SND_SOC_MSM8996) += snd-soc-apq8096.o
+obj-$(CONFIG_SND_SOC_QCM6490) += snd-soc-qcm6490.o
obj-$(CONFIG_SND_SOC_SC7180) += snd-soc-sc7180.o
obj-$(CONFIG_SND_SOC_SC7280) += snd-soc-sc7280.o
obj-$(CONFIG_SND_SOC_SC8280XP) += snd-soc-sc8280xp.o
diff --git a/sound/soc/qcom/qcm6490.c b/sound/soc/qcom/qcm6490.c
new file mode 100644
index 000000000000..5b0dc95963f5
--- /dev/null
+++ b/sound/soc/qcom/qcm6490.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+
+#include <dt-bindings/sound/qcom,q6afe.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of_device.h>
+#include <sound/core.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/pcm.h>
+#include <linux/soundwire/sdw.h>
+#include <sound/jack.h>
+#include <sound/pcm_params.h>
+#include "lpass.h"
+#include "qdsp6/q6afe.h"
+#include "common.h"
+#include "sdw.h"
+
+struct qcm6490_snd_data {
+ bool stream_prepared[AFE_PORT_MAX];
+ struct snd_soc_card *card;
+ struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
+ struct snd_soc_jack jack;
+ bool jack_setup;
+};
+
+static int qcm6490_snd_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+
+ switch (cpu_dai->id) {
+ case TX_CODEC_DMA_TX_3:
+ case LPASS_CDC_DMA_TX3:
+ case RX_CODEC_DMA_RX_0:
+ return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
+ case VA_CODEC_DMA_TX_0:
+ case WSA_CODEC_DMA_RX_0:
+ return 0;
+ default:
+ dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, cpu_dai->id);
+ }
+
+ return -EINVAL;
+}
+
+static int qcm6490_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_interval *rate = hw_param_interval(params,
+ SNDRV_PCM_HW_PARAM_RATE);
+ struct snd_interval *channels = hw_param_interval(params,
+ SNDRV_PCM_HW_PARAM_CHANNELS);
+
+ rate->min = 48000;
+ rate->max = 48000;
+ channels->min = 2;
+ channels->max = 2;
+ switch (cpu_dai->id) {
+ case TX_CODEC_DMA_TX_0:
+ case TX_CODEC_DMA_TX_1:
+ case TX_CODEC_DMA_TX_2:
+ case TX_CODEC_DMA_TX_3:
+ channels->min = 1;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+static int qcm6490_snd_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct qcm6490_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card);
+
+ return qcom_snd_sdw_hw_params(substream, params, &pdata->sruntime[cpu_dai->id]);
+}
+
+static int qcm6490_snd_prepare(struct snd_pcm_substream *substream)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
+ struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
+
+ return qcom_snd_sdw_prepare(substream, sruntime,
+ &data->stream_prepared[cpu_dai->id]);
+}
+
+static int qcm6490_snd_hw_free(struct snd_pcm_substream *substream)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
+
+ return qcom_snd_sdw_hw_free(substream, sruntime,
+ &data->stream_prepared[cpu_dai->id]);
+}
+
+static const struct snd_soc_ops qcm6490_be_ops = {
+ .hw_params = qcm6490_snd_hw_params,
+ .hw_free = qcm6490_snd_hw_free,
+ .prepare = qcm6490_snd_prepare,
+};
+
+static void qcm6490_add_be_ops(struct snd_soc_card *card)
+{
+ struct snd_soc_dai_link *link;
+ int i;
+
+ for_each_card_prelinks(card, i, link) {
+ if (link->no_pcm == 1) {
+ link->init = qcm6490_snd_init;
+ link->be_hw_params_fixup = qcm6490_be_hw_params_fixup;
+ link->ops = &qcm6490_be_ops;
+ }
+ }
+}
+
+static int qcm6490_platform_probe(struct platform_device *pdev)
+{
+ struct snd_soc_card *card;
+ struct qcm6490_snd_data *data;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
+ if (!card)
+ return -ENOMEM;
+ card->owner = THIS_MODULE;
+ /* Allocate the private data */
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ card->dev = dev;
+ dev_set_drvdata(dev, card);
+ snd_soc_card_set_drvdata(card, data);
+ ret = qcom_snd_parse_of(card);
+ if (ret)
+ return ret;
+
+ card->driver_name = of_device_get_match_data(dev);
+ qcm6490_add_be_ops(card);
+ return devm_snd_soc_register_card(dev, card);
+}
+
+static const struct of_device_id snd_qcm6490_dt_match[] = {
+ {.compatible = "qcom,qcm6490-sndcard", "qcm6490"},
+ {.compatible = "qcom,qcs6490-sndcard", "qcs6490"},
+ {}
+};
+
+MODULE_DEVICE_TABLE(of, snd_qcm6490_dt_match);
+
+static struct platform_driver snd_qcm6490_driver = {
+ .probe = qcm6490_platform_probe,
+ .driver = {
+ .name = "snd-qcm6490",
+ .of_match_table = snd_qcm6490_dt_match,
+ },
+};
+module_platform_driver(snd_qcm6490_driver);
+MODULE_DESCRIPTION("qcm6490 ASoC Machine Driver");
+MODULE_LICENSE("GPL");
--
2.25.1


2024-03-27 13:22:22

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] ASoC: dt-bindings: qcom,qcm6490: Add qcm6490 snd qcs6490 sound card

On 27/03/2024 12:32, Mohammad Rafi Shaik wrote:
> Document bindings for the Qualcomm qcm6490 and qcs6490 SoC sound card.
> The bindings are the same as for other newer Qualcomm ADSP sound cards,
> thus keep them in existing qcom,sm8250.yaml file, even though Linux driver
> is separate.
>
> Signed-off-by: Mohammad Rafi Shaik <[email protected]>
> ---
> Documentation/devicetree/bindings/sound/qcom,sm8250.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
> index 2ab6871e89e5..247ad3d10933 100644
> --- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
> +++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
> @@ -29,6 +29,8 @@ properties:
> - enum:
> - qcom,apq8016-sbc-sndcard
> - qcom,msm8916-qdsp6-sndcard
> + - qcom,qcm6490-sndcard
> + - qcom,qcs6490-sndcard

What are the differences between these sound cards? I know that we ask
for specific compatibles per each SoC block, but for similar SoCs sound
cards might be an exception. It's more of a software construct anyway.

Best regards,
Krzysztof


2024-03-27 13:30:51

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490

On 27/03/2024 12:32, Mohammad Rafi Shaik wrote:
> +
> +static int qcm6490_snd_hw_free(struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
> +
> + return qcom_snd_sdw_hw_free(substream, sruntime,
> + &data->stream_prepared[cpu_dai->id]);
> +}
> +
> +static const struct snd_soc_ops qcm6490_be_ops = {
> + .hw_params = qcm6490_snd_hw_params,
> + .hw_free = qcm6490_snd_hw_free,
> + .prepare = qcm6490_snd_prepare,
> +};

I think you leak sdw_stream, because of missing shutdown.

Except that everything looks like sc8280xp, except the snd_init(), so I
wonder how important that difference is? Cannot be combined into sc8280xp?

Best regards,
Krzysztof


2024-03-27 14:39:35

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490

On Wed, 27 Mar 2024 at 13:34, Mohammad Rafi Shaik <[email protected]> wrote:
>
> Add machine driver for qcm6490 SoC.
>
> This initial supports which includes WSA883x Speakers with onboard DMIC
> connected to internal LPASS codec via VA macros respectively and also
> WCD937x based headset.
>
> Add compatible for sound card on Qualcomm qcs6490 boards.

Granted that qcm6490 is similar to sc7280, is there any reason why you
can not use one of the existing sound card drivers? Like sc7280.c or
sc8280xp.c?

>
> Signed-off-by: Mohammad Rafi Shaik <[email protected]>
> ---
> sound/soc/qcom/Kconfig | 13 +++
> sound/soc/qcom/Makefile | 2 +
> sound/soc/qcom/qcm6490.c | 173 +++++++++++++++++++++++++++++++++++++++
> 3 files changed, 188 insertions(+)
> create mode 100644 sound/soc/qcom/qcm6490.c
>
> diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
> index 762491d6f2f2..0bc536766872 100644
> --- a/sound/soc/qcom/Kconfig
> +++ b/sound/soc/qcom/Kconfig
> @@ -151,6 +151,19 @@ config SND_SOC_MSM8996
> APQ8096 SoC-based systems.
> Say Y if you want to use audio device on this SoCs
>
> +config SND_SOC_QCM6490
> + tristate "SoC Machine driver for QCM6490 boards"
> + depends on QCOM_APR && SOUNDWIRE
> + depends on COMMON_CLK
> + select SND_SOC_QDSP6
> + select SND_SOC_QCOM_COMMON
> + select SND_SOC_QCOM_SDW
> + help
> + Add support for audio on Qualcomm Technologies Inc.
> + QCM6490 SoC-based systems.
> + To compile this driver say Y or M if you want to
> + use audio device on this SoCs.
> +
> config SND_SOC_SDM845
> tristate "SoC Machine driver for SDM845 boards"
> depends on QCOM_APR && I2C && SOUNDWIRE
> diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
> index 34f3fcb8ee9a..feb2c164be69 100644
> --- a/sound/soc/qcom/Makefile
> +++ b/sound/soc/qcom/Makefile
> @@ -22,6 +22,7 @@ obj-$(CONFIG_SND_SOC_LPASS_SC7280) += snd-soc-lpass-sc7280.o
> snd-soc-storm-objs := storm.o
> snd-soc-apq8016-sbc-objs := apq8016_sbc.o
> snd-soc-apq8096-objs := apq8096.o
> +snd-soc-qcm6490-objs := qcm6490.o
> snd-soc-sc7180-objs := sc7180.o
> snd-soc-sc7280-objs := sc7280.o
> snd-soc-sdm845-objs := sdm845.o
> @@ -34,6 +35,7 @@ snd-soc-x1e80100-objs := x1e80100.o
> obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o
> obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o
> obj-$(CONFIG_SND_SOC_MSM8996) += snd-soc-apq8096.o
> +obj-$(CONFIG_SND_SOC_QCM6490) += snd-soc-qcm6490.o
> obj-$(CONFIG_SND_SOC_SC7180) += snd-soc-sc7180.o
> obj-$(CONFIG_SND_SOC_SC7280) += snd-soc-sc7280.o
> obj-$(CONFIG_SND_SOC_SC8280XP) += snd-soc-sc8280xp.o
> diff --git a/sound/soc/qcom/qcm6490.c b/sound/soc/qcom/qcm6490.c
> new file mode 100644
> index 000000000000..5b0dc95963f5
> --- /dev/null
> +++ b/sound/soc/qcom/qcm6490.c
> @@ -0,0 +1,173 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
> +
> +#include <dt-bindings/sound/qcom,q6afe.h>
> +#include <linux/input.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/of_device.h>
> +#include <sound/core.h>
> +#include <sound/soc.h>
> +#include <sound/soc-dapm.h>
> +#include <sound/pcm.h>
> +#include <linux/soundwire/sdw.h>
> +#include <sound/jack.h>
> +#include <sound/pcm_params.h>
> +#include "lpass.h"
> +#include "qdsp6/q6afe.h"
> +#include "common.h"
> +#include "sdw.h"
> +
> +struct qcm6490_snd_data {
> + bool stream_prepared[AFE_PORT_MAX];
> + struct snd_soc_card *card;
> + struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
> + struct snd_soc_jack jack;
> + bool jack_setup;
> +};
> +
> +static int qcm6490_snd_init(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> +
> + switch (cpu_dai->id) {
> + case TX_CODEC_DMA_TX_3:
> + case LPASS_CDC_DMA_TX3:
> + case RX_CODEC_DMA_RX_0:
> + return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
> + case VA_CODEC_DMA_TX_0:
> + case WSA_CODEC_DMA_RX_0:
> + return 0;
> + default:
> + dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, cpu_dai->id);
> + }
> +
> + return -EINVAL;
> +}
> +
> +static int qcm6490_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
> + struct snd_pcm_hw_params *params)
> +{
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct snd_interval *rate = hw_param_interval(params,
> + SNDRV_PCM_HW_PARAM_RATE);
> + struct snd_interval *channels = hw_param_interval(params,
> + SNDRV_PCM_HW_PARAM_CHANNELS);
> +
> + rate->min = 48000;
> + rate->max = 48000;
> + channels->min = 2;
> + channels->max = 2;
> + switch (cpu_dai->id) {
> + case TX_CODEC_DMA_TX_0:
> + case TX_CODEC_DMA_TX_1:
> + case TX_CODEC_DMA_TX_2:
> + case TX_CODEC_DMA_TX_3:
> + channels->min = 1;
> + break;
> + default:
> + break;
> + }
> +
> + return 0;
> +}
> +
> +static int qcm6490_snd_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct qcm6490_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card);
> +
> + return qcom_snd_sdw_hw_params(substream, params, &pdata->sruntime[cpu_dai->id]);
> +}
> +
> +static int qcm6490_snd_prepare(struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> + struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
> +
> + return qcom_snd_sdw_prepare(substream, sruntime,
> + &data->stream_prepared[cpu_dai->id]);
> +}
> +
> +static int qcm6490_snd_hw_free(struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct qcm6490_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
> +
> + return qcom_snd_sdw_hw_free(substream, sruntime,
> + &data->stream_prepared[cpu_dai->id]);
> +}
> +
> +static const struct snd_soc_ops qcm6490_be_ops = {
> + .hw_params = qcm6490_snd_hw_params,
> + .hw_free = qcm6490_snd_hw_free,
> + .prepare = qcm6490_snd_prepare,
> +};
> +
> +static void qcm6490_add_be_ops(struct snd_soc_card *card)
> +{
> + struct snd_soc_dai_link *link;
> + int i;
> +
> + for_each_card_prelinks(card, i, link) {
> + if (link->no_pcm == 1) {
> + link->init = qcm6490_snd_init;
> + link->be_hw_params_fixup = qcm6490_be_hw_params_fixup;
> + link->ops = &qcm6490_be_ops;
> + }
> + }
> +}
> +
> +static int qcm6490_platform_probe(struct platform_device *pdev)
> +{
> + struct snd_soc_card *card;
> + struct qcm6490_snd_data *data;
> + struct device *dev = &pdev->dev;
> + int ret;
> +
> + card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
> + if (!card)
> + return -ENOMEM;
> + card->owner = THIS_MODULE;
> + /* Allocate the private data */
> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + card->dev = dev;
> + dev_set_drvdata(dev, card);
> + snd_soc_card_set_drvdata(card, data);
> + ret = qcom_snd_parse_of(card);
> + if (ret)
> + return ret;
> +
> + card->driver_name = of_device_get_match_data(dev);
> + qcm6490_add_be_ops(card);
> + return devm_snd_soc_register_card(dev, card);
> +}
> +
> +static const struct of_device_id snd_qcm6490_dt_match[] = {
> + {.compatible = "qcom,qcm6490-sndcard", "qcm6490"},
> + {.compatible = "qcom,qcs6490-sndcard", "qcs6490"},
> + {}
> +};
> +
> +MODULE_DEVICE_TABLE(of, snd_qcm6490_dt_match);
> +
> +static struct platform_driver snd_qcm6490_driver = {
> + .probe = qcm6490_platform_probe,
> + .driver = {
> + .name = "snd-qcm6490",
> + .of_match_table = snd_qcm6490_dt_match,
> + },
> +};
> +module_platform_driver(snd_qcm6490_driver);
> +MODULE_DESCRIPTION("qcm6490 ASoC Machine Driver");
> +MODULE_LICENSE("GPL");
> --
> 2.25.1
>
>


--
With best wishes
Dmitry

2024-03-27 18:49:26

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] ASoC: dt-bindings: qcom,qcm6490: Add qcm6490 snd qcs6490 sound card

On 27/03/2024 12:32, Mohammad Rafi Shaik wrote:
> Document bindings for the Qualcomm qcm6490 and qcs6490 SoC sound card.
> The bindings are the same as for other newer Qualcomm ADSP sound cards,
> thus keep them in existing qcom,sm8250.yaml file, even though Linux driver
> is separate.
>
> Signed-off-by: Mohammad Rafi Shaik <[email protected]>
> ---

Patch is trivial, yet people make whitespace mistakes also in trivial
stuff. Therefore please be sure the patch is being tested by CC-ing
appropriate mailing lists.

Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline), work on fork of kernel
(don't, instead use mainline) or you ignore some maintainers (really
don't). Just use b4 and everything should be fine, although remember
about `b4 prep --auto-to-cc` if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be
tested by automated tooling.

Please kindly resend and include all necessary To/Cc entries.

Best regards,
Krzysztof


2024-03-29 15:58:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490

On 29/03/2024 16:19, Mohammad Rafi Shaik wrote:
>
> On 3/27/2024 6:39 PM, Dmitry Baryshkov wrote:
>> On Wed, 27 Mar 2024 at 13:34, Mohammad Rafi Shaik<[email protected]> wrote:
>>> Add machine driver for qcm6490 SoC.
>>>
>>> This initial supports which includes WSA883x Speakers with onboard DMIC
>>> connected to internal LPASS codec via VA macros respectively and also
>>> WCD937x based headset.
>>>
>>> Add compatible for sound card on Qualcomm qcs6490 boards.
>> Granted that qcm6490 is similar to sc7280, is there any reason why you
>> can not use one of the existing sound card drivers? Like sc7280.c or
>> sc8280xp.c?
>
> The qcs6490/qcm6490 has additional interfaces like MI2S, which requires
> additional machine driver modification.
>
> Example : Required new DAPM widget change in machine driver for MI2S
> interface which is specific to qcs6490/qcm6490.
>
> So, using new qcm6490 machine driver.
>
> Will try to use existing sc8280xp.c machine driver.

In that case, if it does not fit into sc8280xp, it looks fine for a new
driver. Maybe just mention this in commit msg.

Best regards,
Krzysztof


2024-03-29 18:39:29

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490

Hi,

On Fri, 29 Mar 2024 at 17:20, Mohammad Rafi Shaik <[email protected]> wrote:
>
>
> On 3/27/2024 6:39 PM, Dmitry Baryshkov wrote:
>
> On Wed, 27 Mar 2024 at 13:34, Mohammad Rafi Shaik <[email protected]> wrote:

Please turn off HTML mail composition and never ever send HTML email
to OSS mailing lists.
Now quotation levels are broken...

>
> Add machine driver for qcm6490 SoC.
>
> This initial supports which includes WSA883x Speakers with onboard DMIC
> connected to internal LPASS codec via VA macros respectively and also
> WCD937x based headset.
>
> Add compatible for sound card on Qualcomm qcs6490 boards.
>
> Granted that qcm6490 is similar to sc7280, is there any reason why you
> can not use one of the existing sound card drivers? Like sc7280.c or
> sc8280xp.c?
>
> The qcs6490/qcm6490 has additional interfaces like MI2S, which requires additional machine driver modification.
>
> Example : Required new DAPM widget change in machine driver for MI2S interface which is specific to qcs6490/qcm6490.
>
> So, using new qcm6490 machine driver.
>
> Will try to use existing sc8280xp.c machine driver.

What about sc7280? In the end, qcm6490 is sc7280 with different firmware / spin.


--
With best wishes
Dmitry

2024-04-02 09:21:25

by Mohammad Rafi Shaik

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490

On 3/30/2024 12:09 AM, Dmitry Baryshkov wrote:
> Hi,
>
> On Fri, 29 Mar 2024 at 17:20, Mohammad Rafi Shaik <[email protected]> wrote:
>>
>>
>> On 3/27/2024 6:39 PM, Dmitry Baryshkov wrote:
>>
>> On Wed, 27 Mar 2024 at 13:34, Mohammad Rafi Shaik <[email protected]> wrote:
>
> Please turn off HTML mail composition and never ever send HTML email
> to OSS mailing lists.
> Now quotation levels are broken...
>
>>
>> Add machine driver for qcm6490 SoC.
>>
>> This initial supports which includes WSA883x Speakers with onboard DMIC
>> connected to internal LPASS codec via VA macros respectively and also
>> WCD937x based headset.
>>
>> Add compatible for sound card on Qualcomm qcs6490 boards.
>>
>> Granted that qcm6490 is similar to sc7280, is there any reason why you
>> can not use one of the existing sound card drivers? Like sc7280.c or
>> sc8280xp.c?
>>
>> The qcs6490/qcm6490 has additional interfaces like MI2S, which requires additional machine driver modification.
>>
>> Example : Required new DAPM widget change in machine driver for MI2S interface which is specific to qcs6490/qcm6490.
>>
>> So, using new qcm6490 machine driver.
>>
>> Will try to use existing sc8280xp.c machine driver.
>
> What about sc7280? In the end, qcm6490 is sc7280 with different firmware / spin.
>
>

The sc7280 is tightly linked with realtek codec. which will only support
for chrome.

The sc8280xp.c machine driver is more suitable for qcm6490, will use
same sc8280xp.


2024-04-23 13:27:18

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ASoC: qcom: qcm6490: Add machine driver for qcm6490



On 4/2/24 11:20, Mohammad Rafi Shaik wrote:
> On 3/30/2024 12:09 AM, Dmitry Baryshkov wrote:
>> Hi,
>>
>> On Fri, 29 Mar 2024 at 17:20, Mohammad Rafi Shaik <[email protected]> wrote:
>>>
>>>
>>> On 3/27/2024 6:39 PM, Dmitry Baryshkov wrote:
>>>
>>> On Wed, 27 Mar 2024 at 13:34, Mohammad Rafi Shaik <[email protected]> wrote:
>>
>> Please turn off HTML mail composition and never ever send HTML email
>> to OSS mailing lists.
>> Now quotation levels are broken...
>>
>>>
>>> Add machine driver for qcm6490 SoC.
>>>
>>> This initial supports which includes WSA883x Speakers with onboard DMIC
>>> connected to internal LPASS codec via VA macros respectively and also
>>> WCD937x based headset.
>>>
>>> Add compatible for sound card on Qualcomm qcs6490 boards.
>>>
>>> Granted that qcm6490 is similar to sc7280, is there any reason why you
>>> can not use one of the existing sound card drivers? Like sc7280.c or
>>> sc8280xp.c?
>>>
>>> The qcs6490/qcm6490 has additional interfaces like MI2S, which requires additional machine driver modification.
>>>
>>> Example : Required new DAPM widget change in machine driver for MI2S interface which is specific to qcs6490/qcm6490.
>>>
>>> So, using new qcm6490 machine driver.
>>>
>>> Will try to use existing sc8280xp.c machine driver.
>>
>> What about sc7280? In the end, qcm6490 is sc7280 with different firmware / spin.
>>
>>
>
> The sc7280 is tightly linked with realtek codec. which will only support for chrome.

Perhaps we should rename it and stop suggesting it's for all 7280-like platforms then..

> The sc8280xp.c machine driver is more suitable for qcm6490, will use same sc8280xp.

This in turn, should it become something like snd-qcom-audioreach?

Konrad