Skip to contentSkip to conversation

Add support for audio on SDM845 SoC

PATCH Superseded Rohit kumar 4 participants 10 messages Jul 30, 2018 – Aug 1, 2018

Subsystems (5)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add support for audio on SDM845 SoC

This provides initial patchset to support audio on Qualcomm Techonologies Inc. SDM845 SoC. Currently, it supports audio playback/capture over Primary MI2S and Quaternary TDM ports.

Changes since v3:
- Added Module_license in common.c
- Merged apq8096.c machine driver change with common api patch
- Addressed comments by Srinivas, Mark and Vinod.

Rohit kumar (4):
ASoC: qcom: dt-bindings: Add sdm845 machine bindings
ASoC: dt-bindings: Update dt binding name for apq8096
ASoC: qcom: Add support to parse common audio device nodes
ASoC: qcom: add sdm845 sound card support

 .../devicetree/bindings/sound/qcom,apq8096.txt     |  15 +-
 .../devicetree/bindings/sound/qcom,sdm845.txt      |  80 ++++++
 sound/soc/qcom/Kconfig                             |   8 +
 sound/soc/qcom/Makefile                            |   4 +-
 sound/soc/qcom/apq8096.c                           | 111 +-------
 sound/soc/qcom/common.c                            | 112 ++++++++
 sound/soc/qcom/common.h                            |  12 +
 sound/soc/qcom/sdm845.c                            | 286 +++++++++++++++++++++
 8 files changed, 525 insertions(+), 103 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
 create mode 100644 sound/soc/qcom/common.c
 create mode 100644 sound/soc/qcom/common.h
 create mode 100644 sound/soc/qcom/sdm845.c
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

PATCH v4 1/4 ASoC: qcom: dt-bindings: Add sdm845 machine bindings

Add devicetree bindings documentation file for SDM845 sound card.

---
 .../devicetree/bindings/sound/qcom,sdm845.txt      | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +80 -0
new file mode 100644
index 0000000..408c483
@@ -0,0 +1,80 @@
+* Qualcomm Technologies Inc. SDM845 ASoC sound card driver
+
+This binding describes the SDM845 sound card, which uses qdsp for audio.
+
+- compatible:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "qcom,sdm845-sndcard"
+
+- audio-routing:
+	Usage: Optional
+	Value type: <stringlist>
+	Definition:  A list of the connections between audio components.
+		  Each entry is a pair of strings, the first being the
+		  connection's sink, the second being the connection's
+		  source. Valid names could be power supplies, MicBias
+		  of codec and the jacks on the board.
+
+- model:
+	Usage: required
+	Value type: <stringlist>
+	Definition: The user-visible name of this sound card.
+
+= dailinks
+Each subnode of sndcard represents either a dailink, and subnodes of each
+dailinks would be cpu/codec/platform dais.
+
+- link-name:
+	Usage: required
+	Value type: <string>
+	Definition: User friendly name for dai link
+
+= CPU, PLATFORM, CODEC dais subnodes
+- cpu:
+	Usage: required
+	Value type: <subnode>
+	Definition: cpu dai sub-node
+
+- codec:
+	Usage: required
+	Value type: <subnode>
+	Definition: codec dai sub-node
+
+- platform:
+	Usage: Optional
+	Value type: <subnode>
+	Definition: platform dai sub-node
+
+- sound-dai:
+	Usage: required
+	Value type: <phandle>
+	Definition: dai phandle/s and port of CPU/CODEC/PLATFORM node.
+
+Example:
+
+audio {
+	compatible = "qcom,sdm845-sndcard";
+	model = "sdm845-snd-card";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&pri_mi2s_active &pri_mi2s_ws_active>;
+	pinctrl-1 = <&pri_mi2s_sleep &pri_mi2s_ws_sleep>;
+
+	mm1-dai-link {
+		link-name = "MultiMedia1";
+		cpu {
+			sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
+		};
+	};
+
+	pri-mi2s-dai-link {
+		link-name = "PRI MI2S Playback";
+		cpu {
+			sound-dai = <&q6afedai PRIMARY_MI2S_RX>;
+		};
+
+		platform {
+			sound-dai = <&q6routing>;
+		};
+	};
+};
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer Reviewed-by on v4 1/4
#2 lore raw

Re: [PATCH v4 1/4] ASoC: qcom: dt-bindings: Add sdm845 machine bindings

Quoted 7 lines · Rohit kumar

Add devicetree bindings documentation file for SDM845 sound card.

---
 .../devicetree/bindings/sound/qcom,sdm845.txt      | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
#3 lore raw

PATCH v4 2/4 ASoC: dt-bindings: Update dt binding name for apq8096

In reply to Rohit kumar

Remove qcom prefix from machine driver dt bindings of apq8096 SoC.

---
 Documentation/devicetree/bindings/sound/qcom,apq8096.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/qcom,apq8096.txt +13 -2
index c7600a9..c814e86 100644
@@ -7,7 +7,7 @@ This binding describes the APQ8096 sound card, which uses qdsp for audio.
 	Value type: <stringlist>
 	Definition: must be "qcom,apq8096-sndcard"
 
-- qcom,audio-routing:
+- audio-routing:
 	Usage: Optional
 	Value type: <stringlist>
 	Definition:  A list of the connections between audio components.
@@ -49,6 +49,12 @@ This binding describes the APQ8096 sound card, which uses qdsp for audio.
 			"DMIC1"
 			"DMIC2"
 			"DMIC3"
+
+- model:
+	Usage: required
+	Value type: <stringlist>
+	Definition: The user-visible name of this sound card.
+
 = dailinks
 Each subnode of sndcard represents either a dailink, and subnodes of each
 dailinks would be cpu/codec/platform dais.
@@ -79,11 +85,16 @@ dailinks would be cpu/codec/platform dais.
 	Value type: <phandle with arguments>
 	Definition: dai phandle/s and port of CPU/CODEC/PLATFORM node.
 
+Obsolete:
+	qcom,model: String for soundcard name (Use model instead)
+	qcom,audio-routing: A list of the connections between audio components.
+			    (Use audio-routing instead)
+
 Example:
 
 audio {
 	compatible = "qcom,apq8096-sndcard";
-	qcom,model = "DB820c";
+	model = "DB820c";
 
 	mm1-dai-link {
 		link-name = "MultiMedia1";
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer Reviewed-by on v4 2/4
#4 lore raw

Re: [PATCH v4 2/4] ASoC: dt-bindings: Update dt binding name for apq8096

Quoted 8 lines · Rohit kumar

Remove qcom prefix from machine driver dt bindings of apq8096 SoC.

---
 Documentation/devicetree/bindings/sound/qcom,apq8096.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
#5 lore raw

PATCH v4 3/4 ASoC: qcom: Add support to parse common audio device nodes

In reply to Rohit kumar

This adds support to parse cpu, platform and codec device nodes and add them in dai-links. Also, update apq8096 machine driver to use the common API.

---
 sound/soc/qcom/Makefile  |   2 +-
 sound/soc/qcom/apq8096.c | 111 +++++-----------------------------------------
 sound/soc/qcom/common.c  | 112 +++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/qcom/common.h  |  12 +++++
 4 files changed, 136 insertions(+), 101 deletions(-)
 create mode 100644 sound/soc/qcom/common.c
 create mode 100644 sound/soc/qcom/common.h
sound/soc/qcom/Makefile +1 -1
index 206945b..fefecc0 100644
@@ -13,7 +13,7 @@ obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
 # Machine
 snd-soc-storm-objs := storm.o
 snd-soc-apq8016-sbc-objs := apq8016_sbc.o
-snd-soc-apq8096-objs := apq8096.o
+snd-soc-apq8096-objs := apq8096.o common.o
 
 obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o
 obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o
sound/soc/qcom/apq8096.c +11 -100

144 lines not on this page · raw message

sound/soc/qcom/common.c new file +112 -0

112 lines not on this page · raw message

sound/soc/qcom/common.h new file +12 -0
new file mode 100644
index 0000000..ad5d2cf
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+// Copyright (c) 2018, The Linux Foundation. All rights reserved.
+
+#ifndef __QCOM_SND_COMMON_H__
+#define __QCOM_SND_COMMON_H__
+
+#include <linux/component.h>
+#include <sound/soc.h>
+
+int qcom_snd_parse_of(struct snd_soc_card *card);
+
+#endif
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#6 lore raw

PATCH v4 4/4 ASoC: qcom: add sdm845 sound card support

In reply to Rohit kumar

This patch adds sdm845 audio machine driver support.

---
 sound/soc/qcom/Kconfig  |   8 ++
 sound/soc/qcom/Makefile |   2 +
 sound/soc/qcom/sdm845.c | 286 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 296 insertions(+)
 create mode 100644 sound/soc/qcom/sdm845.c
sound/soc/qcom/Kconfig +8 -0
index 87838fa..3507308 100644
@@ -90,3 +90,11 @@ config SND_SOC_MSM8996
           Support for Qualcomm Technologies LPASS audio block in
           APQ8096 SoC-based systems.
           Say Y if you want to use audio device on this SoCs
+
+config SND_SOC_SDM845
+	tristate "SoC Machine driver for SDM845 boards"
+	select SND_SOC_QDSP6
+	help
+	  To add support for audio on Qualcomm Technologies Inc.
+	  SDM845 SoC-based systems.
+	  Say Y if you want to use audio device on this SoCs.
sound/soc/qcom/Makefile +2 -0
index fefecc0..f0e94d4 100644
@@ -14,10 +14,12 @@ obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
 snd-soc-storm-objs := storm.o
 snd-soc-apq8016-sbc-objs := apq8016_sbc.o
 snd-soc-apq8096-objs := apq8096.o common.o
+snd-soc-sdm845-objs := sdm845.o common.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_SDM845) += snd-soc-sdm845.o
 
 #DSP lib
 obj-$(CONFIG_SND_SOC_QDSP6) += qdsp6/
sound/soc/qcom/sdm845.c new file +286 -0

286 lines not on this page · raw message

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#7 lore raw

Re: [PATCH v4 4/4] ASoC: qcom: add sdm845 sound card support

Thank you for the patch! Perhaps something to improve:

Hi Rohit,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on next-20180731]
[cannot apply to v4.18-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rohit-kumar/Add-support-for-audio-on-SDM845-SoC/20180801-082203
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

>> sound/soc/qcom/sdm845.c:193:27: sparse: incorrect type in argument 2 (different base types) @@    expected unsigned int [unsigned] val @@    got restricted snd_unsigned int [unsigned] val @@

sound/soc/qcom/sdm845.c:193:27: expected unsigned int [unsigned] val
sound/soc/qcom/sdm845.c:193:27: got restricted snd_pcm_format_t [usertype] <noident>

vim +193 sound/soc/qcom/sdm845.c

181
182 static int sdm845_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
183 struct snd_pcm_hw_params *params)
184 {
185 struct snd_interval *rate = hw_param_interval(params,
186 SNDRV_PCM_HW_PARAM_RATE);
187 struct snd_interval *channels = hw_param_interval(params,
188 SNDRV_PCM_HW_PARAM_CHANNELS);
189 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
190
191 rate->min = rate->max = DEFAULT_SAMPLE_RATE_48K;
192 channels->min = channels->max = 2;

 > 193		snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);

194
195 return 0;
196 }
197

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#8 lore raw

Re: [PATCH v4 4/4] ASoC: qcom: add sdm845 sound card support

Quoted 26 lines · kbuild test robot

Hi Rohit,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on next-20180731]
[cannot apply to v4.18-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rohit-kumar/Add-support-for-audio-on-SDM845-SoC/20180801-082203
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

sound/soc/qcom/sdm845.c:193:27: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [unsigned] val @@ got restricted snd_unsigned int [unsigned] val @@

sound/soc/qcom/sdm845.c:193:27: expected unsigned int [unsigned] val
sound/soc/qcom/sdm845.c:193:27: got restricted snd_pcm_format_t [usertype] <noident>

vim +193 sound/soc/qcom/sdm845.c

Quoted 13 lines
   181	
   182	static int sdm845_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
   183					struct snd_pcm_hw_params *params)
   184	{
   185		struct snd_interval *rate = hw_param_interval(params,
   186						SNDRV_PCM_HW_PARAM_RATE);
   187		struct snd_interval *channels = hw_param_interval(params,
   188						SNDRV_PCM_HW_PARAM_CHANNELS);
   189		struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
   190	
   191		rate->min = rate->max = DEFAULT_SAMPLE_RATE_48K;
   192		channels->min = channels->max = 2;
Quoted 1 line

193 snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);

FYI, we have introduced a new helper, snd_mask_set_format(), just for avoiding this sparse warning. It's already in Mark's for-next tree.

thanks,

Takashi

#9 lore raw

Re: [PATCH v4 4/4] ASoC: qcom: add sdm845 sound card support

Quoted 40 lines · Takashi Iwai
Quoted 25 lines · kbuild test robot

Hi Rohit,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on next-20180731]
[cannot apply to v4.18-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rohit-kumar/Add-support-for-audio-on-SDM845-SoC/20180801-082203
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
         # apt-get install sparse
         make ARCH=x86_64 allmodconfig
         make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

sound/soc/qcom/sdm845.c:193:27: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [unsigned] val @@ got restricted snd_unsigned int [unsigned] val @@

sound/soc/qcom/sdm845.c:193:27: expected unsigned int [unsigned] val
sound/soc/qcom/sdm845.c:193:27: got restricted snd_pcm_format_t [usertype] <noident>

vim +193 sound/soc/qcom/sdm845.c

Quoted 13 lines
    181	
    182	static int sdm845_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
    183					struct snd_pcm_hw_params *params)
    184	{
    185		struct snd_interval *rate = hw_param_interval(params,
    186						SNDRV_PCM_HW_PARAM_RATE);
    187		struct snd_interval *channels = hw_param_interval(params,
    188						SNDRV_PCM_HW_PARAM_CHANNELS);
    189		struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
    190	
    191		rate->min = rate->max = DEFAULT_SAMPLE_RATE_48K;
    192		channels->min = channels->max = 2;
Quoted 1 line

193 snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);

Quoted 2 lines

FYI, we have introduced a new helper, snd_mask_set_format(), just for avoiding this sparse warning. It's already in Mark's for-next tree.

Thanks Takashi for API suggestion. I will update in next spin.

Quoted 4 lines

thanks,

Takashi