Quellcode durchsuchen

Merge c32a805c82486ff7e30c6d9eb430e7512bc69982 on remote branch

Change-Id: Ie544bc6a562455b4faffd6044a46bfaf4cc25e3f
Linux Build Service Account vor 1 Jahr
Ursprung
Commit
54e7994438
9 geänderte Dateien mit 167 neuen und 0 gelöschten Zeilen
  1. 6 0
      Makefile
  2. 13 0
      asoc/Kbuild
  3. 91 0
      asoc/auto_spf_dummy.c
  4. 5 0
      asoc/codecs/Kbuild
  5. 18 0
      config/sa7255auto.conf
  6. 19 0
      config/sa7255autoconf.h
  7. 5 0
      dsp/Kbuild
  8. 5 0
      ipc/Kbuild
  9. 5 0
      soc/Kbuild

+ 6 - 0
Makefile

@@ -1,3 +1,9 @@
+ifeq ($(TARGET_SUPPORT), monaco)
+KBUILD_OPTIONS := CONFIG_SND_SOC_AUTO=y
+KBUILD_OPTIONS += CONFIG_SND_SOC_SA7255=m
+KBUILD_OPTIONS += MODNAME=audio_dlkm
+endif
+
 M=$(PWD)
 AUDIO_ROOT=$(KERNEL_SRC)/$(M)
 

+ 13 - 0
asoc/Kbuild

@@ -29,6 +29,11 @@ ifeq ($(CONFIG_SND_SOC_AUTO), y)
 		export
 		INCS    +=  -include $(AUDIO_ROOT)/config/gvmautoconf.h
 	endif
+	ifdef CONFIG_SND_SOC_SA7255
+		include $(AUDIO_ROOT)/config/sa7255auto.conf
+		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sa7255autoconf.h
+	endif
 
 else
 ifeq ($(KERNEL_BUILD), 0)
@@ -220,6 +225,12 @@ ifdef CONFIG_SND_SOC_SA8155
 	MACHINE_OBJS += sa8155.o
 endif
 
+# for sa7255 sound card driver
+ifdef CONFIG_SND_SOC_SA7255_AUTO_SPF
+    SPF_MACHINE_OBJS += msm_common.o
+    SPF_MACHINE_OBJS += auto_spf_dummy.o
+endif
+
 ifdef CONFIG_SND_SOC_QDSP6V2
 	PLATFORM_OBJS += platform_init.o
 endif
@@ -316,6 +327,8 @@ machine_dlkm-y := $(MACHINE_OBJS)
 obj-$(CONFIG_SND_SOC_GVM_AUTO_SPF) += spf_machine_dlkm.o
 spf_machine_dlkm-y := $(SPF_MACHINE_OBJS)
 
+obj-$(CONFIG_SND_SOC_SA7255_AUTO_SPF) += spf_machine_dlkm.o
+spf_machine_dlkm-y := $(SPF_MACHINE_OBJS)
 
 # inject some build related information
 DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"

+ 91 - 0
asoc/auto_spf_dummy.c

@@ -159,6 +159,7 @@ struct msm_asoc_mach_data {
 	bool mclk_used;
 	struct msm_pinctrl_info mclk_pinctrl_info[MCLK_MAX];
 	struct msm_mclk_conf mclk_conf[MCLK_MAX];
+	struct snd_pcm_hardware hw_params;
 };
 
 static struct platform_device *spdev;
@@ -184,6 +185,10 @@ struct snd_soc_card sa8255_snd_soc_card_auto_msm = {
 	.name = "sa8255-adp-star-snd-card",
 };
 
+struct snd_soc_card sa7255_snd_soc_card_auto_msm = {
+	.name = "sa7255-adp-star-snd-card",
+};
+
 /* FIXME: it may various on different platform,
  * better to move to dt configuration in future
  */
@@ -575,6 +580,9 @@ static int tdm_snd_startup(struct snd_pcm_substream *substream)
 	int ret_pinctrl = 0;
 	int index, mclk_index;
 
+	if (!dai_link->no_pcm)
+		snd_soc_set_runtime_hwparams(substream, &pdata->hw_params);
+
 	index = msm_tdm_get_intf_idx(dai_link->id);
 	if (index < 0) {
 		ret = -EINVAL;
@@ -1136,6 +1144,8 @@ static const struct of_device_id asoc_machine_of_match[]  = {
 	  .data = "adp_star_codec"},
 	{ .compatible = "qcom,sa8255-asoc-snd-adp-star",
 	  .data = "adp_star_codec"},
+	{ .compatible = "qcom,sa7255-asoc-snd-adp-star",
+	  .data = "adp_star_codec"},
 	{},
 };
 
@@ -1167,6 +1177,8 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
 		card = &sa8295_snd_soc_card_auto_msm;
 	else if (!strcmp(match->compatible, "qcom,sa8255-asoc-snd-adp-star"))
 		card = &sa8255_snd_soc_card_auto_msm;
+	else if (!strcmp(match->compatible, "qcom,sa7255-asoc-snd-adp-star"))
+		card = &sa7255_snd_soc_card_auto_msm;
 
 	total_links = ARRAY_SIZE(msm_common_dai_links);
 	memcpy(msm_auto_dai_links,
@@ -1182,6 +1194,75 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
 	return card;
 }
 
+static int msm_get_hwparams(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = NULL;
+	struct msm_asoc_mach_data *pdata = NULL;
+	u32 pcm_info = 0;
+	u32 buffer_bytes_max = 0;
+	u32 periods_bytes[2] = {0};
+	u32 periods_count[2] = {0};
+	int ret = 0;
+
+	card = platform_get_drvdata(pdev);
+	if (!card) {
+		pr_err("%s: card is NULL\n",
+			__func__);
+		return -EINVAL;
+	}
+	pdata = snd_soc_card_get_drvdata(card);
+	if (!pdata) {
+		pr_err("%s: pdata is NULL\n",
+			__func__);
+		return -EINVAL;
+	}
+
+	ret = of_property_read_u32(pdev->dev.of_node,
+			"qcom,hw_pcm_info",
+			&pcm_info);
+	if (ret) {
+		pr_err("%s: read pcm info failed\n",
+			__func__);
+		return ret;
+	}
+
+	ret = of_property_read_u32(pdev->dev.of_node,
+			"qcom,hw_buffer_size_max",
+			&buffer_bytes_max);
+	if (ret) {
+		pr_err("%s: read buffer size max failed\n",
+			__func__);
+		return ret;
+	}
+
+	ret = of_property_read_u32_array(pdev->dev.of_node,
+			"qcom,hw_period_byte_size",
+			periods_bytes, 2);
+	if (ret) {
+		pr_err("%s: read period byte size failed\n",
+			__func__);
+		return ret;
+	}
+
+	ret = of_property_read_u32_array(pdev->dev.of_node,
+			"qcom,hw_period_count_size",
+			periods_count, 2);
+	if (ret) {
+		pr_err("%s: read period count size failed\n",
+			__func__);
+		return ret;
+	}
+
+	pdata->hw_params.info = pcm_info;
+	pdata->hw_params.buffer_bytes_max = buffer_bytes_max;
+	pdata->hw_params.period_bytes_min = periods_bytes[0];
+	pdata->hw_params.period_bytes_max = periods_bytes[1];
+	pdata->hw_params.periods_min = periods_count[0];
+	pdata->hw_params.periods_max = periods_count[1];
+
+	return ret;
+}
+
 struct msm_common_pdata *msm_common_get_pdata(struct snd_soc_card *card)
 {
 	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@@ -1493,6 +1574,8 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 	if (strnstr(match->compatible, "sa8295",
 			sizeof(match->compatible)) ||
 		strnstr(match->compatible, "sa8255",
+			sizeof(match->compatible)) ||
+		strnstr(match->compatible, "sa7255",
 			sizeof(match->compatible))) {
 		/* get mclk pinctrl info from devicetree */
 		ret = msm_get_mclk_pinctrl(pdev);
@@ -1508,6 +1591,14 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 		}
 	}
 
+	ret = msm_get_hwparams(pdev);
+	if (ret) {
+		dev_err(&pdev->dev,
+			"%s: hwparams get failed with %d\n",
+			__func__, ret);
+		goto err;
+	}
+
 	dev_info(&pdev->dev, "Sound card %s registered\n",
 		card->name);
 	pr_err("Sound card %s registered\n",

+ 5 - 0
asoc/codecs/Kbuild

@@ -29,6 +29,11 @@ ifeq ($(CONFIG_SND_SOC_AUTO), y)
         export
         INCS    +=  -include $(AUDIO_ROOT)/config/gvmautoconf.h
 	endif
+	ifdef CONFIG_SND_SOC_SA7255
+		include $(AUDIO_ROOT)/config/sa7255auto.conf
+		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sa7255autoconf.h
+	endif
 else
 ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SM8150), y)

+ 18 - 0
config/sa7255auto.conf

@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+export CONFIG_MSM_ADSP_LOADER=m
+export CONFIG_MSM_QDSP6_SSR=m
+export CONFIG_MSM_QDSP6_NOTIFIER=m
+export CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
+export CONFIG_SND_EVENT=m
+export CONFIG_MSM_QDSP6_GPR_RPMSG=m
+export CONFIG_AUDIO_PKT=m
+export CONFIG_AUDIO_PKT_ION=m
+export CONFIG_AUDIO_PRM=m
+export CONFIG_SPF_CORE=m
+export CONFIG_SND_SOC_QDSP6V2=m
+export CONFIG_SND_SOC_MSM_STUB=m
+export CONFIG_SND_SOC_SA7255_AUTO_SPF=m
+export CONFIG_PINCTRL_LPI=m
+export CONFIG_SND_SOC_WCD9XXX_V2=m
+export CONFIG_DIGITAL_CDC_RSC_MGR=m

+ 19 - 0
config/sa7255autoconf.h

@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+#define CONFIG_MSM_QDSP6_SSR 1
+#define CONFIG_MSM_ADSP_LOADER 1
+#define CONFIG_MSM_QDSP6_NOTIFIER 1
+#define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1
+#define CONFIG_SND_SOC_QDSP6V2 1
+#define CONFIG_MSM_QDSP6_GPR_RPMSG 1
+#define CONFIG_AUDIO_PKT 1
+#define CONFIG_AUDIO_PKT_ION 1
+#define CONFIG_AUDIO_PRM 1
+#define CONFIG_SPF_CORE 1
+#define CONFIG_SND_EVENT 1
+#define CONFIG_SND_SOC_MSM_STUB 1
+#define CONFIG_SND_SOC_SA7255_AUTO_SPF 1
+#define CONFIG_PINCTRL_LPI 1
+#define CONFIG_SND_SOC_WCD9XXX_V2 1
+#define CONFIG_DIGITAL_CDC_RSC_MGR 1

+ 5 - 0
dsp/Kbuild

@@ -24,6 +24,11 @@ ifeq ($(CONFIG_SND_SOC_AUTO), y)
 		export
 		INCS    +=  -include $(AUDIO_ROOT)/config/sa6155autoconf.h
 	endif
+	ifdef CONFIG_SND_SOC_SA7255
+		include $(AUDIO_ROOT)/config/sa7255auto.conf
+		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sa7255autoconf.h
+	endif
 else
 ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SM6150), y)

+ 5 - 0
ipc/Kbuild

@@ -25,6 +25,11 @@ ifeq ($(CONFIG_SND_SOC_AUTO), y)
 		export
 		INCS    +=  -include $(AUDIO_ROOT)/config/sa6155autoconf.h
 	endif
+	ifdef CONFIG_SND_SOC_SA7255
+		include $(AUDIO_ROOT)/config/sa7255auto.conf
+		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sa7255autoconf.h
+	endif
 else
 ifeq ($(KERNEL_BUILD), 0)
         ifeq ($(CONFIG_ARCH_SM6150), y)

+ 5 - 0
soc/Kbuild

@@ -24,6 +24,11 @@ ifeq ($(CONFIG_SND_SOC_AUTO), y)
 		export
 		INCS    +=  -include $(AUDIO_ROOT)/config/sa6155autoconf.h
 	endif
+	ifdef CONFIG_SND_SOC_SA7255
+		include $(AUDIO_ROOT)/config/sa7255auto.conf
+		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sa7255autoconf.h
+	endif
 else
 ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SM8150), y)