Add support for audio on SDM845 SoC
Subsystems (5)
v2 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 v1:
Addressed comments posted by Vinod and Srinivas.
Rohit kumar (2):
ASoC: qcom: dt-bindings: Add sdm845 machine bindings
ASoC: qcom: add sdm845 sound card support
.../devicetree/bindings/sound/qcom,sdm845.txt | 82 ++++ sound/soc/qcom/Kconfig | 9 + sound/soc/qcom/Makefile | 2 + sound/soc/qcom/sdm845.c | 514 +++++++++++++++++++++ 4 files changed, 607 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt 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.
PATCH v2 1/2 ASoC: qcom: dt-bindings: Add sdm845 machine bindings
Add devicetree bindings documentation file for SDM845 sound card.
--- .../devicetree/bindings/sound/qcom,sdm845.txt | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +82 -0
@@ -0,0 +1,82 @@ +* 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" + +- qcom,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. + +- cdc-vdd-supply: + Usage: Optional + Value type: <phandle> + Definition: phandle of regulator supply required for codec vdd. + += 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"; + qcom,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>; + + cdc-vdd-supply = <&pm8998_l14>; + + 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.
PATCH v2 2/2 ASoC: qcom: add sdm845 sound card support
In reply to Rohit kumarThis patch adds sdm845 audio machine driver support.
--- sound/soc/qcom/Kconfig | 9 + sound/soc/qcom/Makefile | 2 + sound/soc/qcom/sdm845.c | 514 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 525 insertions(+) create mode 100644 sound/soc/qcom/sdm845.c
sound/soc/qcom/Kconfig +9 -0
@@ -90,3 +90,12 @@ 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" + depends on QCOM_APR + 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
@@ -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 +snd-soc-sdm845-objs := sdm845.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 +514 -0
514 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.
Re: [alsa-devel] [PATCH v2 2/2] ASoC: qcom: add sdm845 sound card support
Hi Rohit,
Quoted 98 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +98
-0+static struct sdm845_snd_data *sdm845_sbc_parse_of (struct snd_soc_card *card) +{ +struct device *dev = card->dev; +struct snd_soc_dai_link *link; +struct device_node *np, *codec, *platform, *cpu, *node; +int ret, num_links; +struct sdm845_snd_data *data; + + ret =snd_soc_of_parse_card_name (card,"qcom,model" ); +if (ret) { +dev_err (dev,"Error parsing card name: %d\n" , ret); +return ERR_PTR (ret); + } + + node = dev->of_node; + +/* DAPM routes */ +if (of_property_read_bool (node,"qcom,audio-routing" )) { + ret =snd_soc_of_parse_audio_routing (card, +"qcom,audio-routing" ); +if (ret) +return ERR_PTR (ret); + } + +/* Populate links */ + num_links =of_get_child_count (node); + +/* Allocate the private data and the DAI link array */ + data =kzalloc (sizeof (*data) +sizeof (*link) * num_links, +GFP_KERNEL ); +if (!data) +return ERR_PTR (-ENOMEM ); + + card->dai_link = &data->dai_link[0 ]; + card->num_links = num_links; + + link = data->dai_link; + data->card = card; + +for_each_child_of_node (node, np) { + cpu =of_get_child_by_name (np,"cpu" ); +if (!cpu) { +dev_err (dev,"Can't find cpu DT node\n" ); + ret = -EINVAL ; + goto fail; + } + + link->cpu_of_node =of_parse_phandle (cpu,"sound-dai" ,0 ); +if (!link->cpu_of_node) { +dev_err (card->dev,"error getting cpu phandle\n" ); + ret = -EINVAL ; + goto fail; + } + + ret =snd_soc_of_get_dai_name (cpu, &link->cpu_dai_name); +if (ret) { +dev_err (card->dev,"error getting cpu dai name\n" ); + goto fail; + } + + platform =of_get_child_by_name (np,"platform" ); + codec =of_get_child_by_name (np,"codec" ); +if (codec && platform) { + link->platform_of_node =of_parse_phandle (platform, +"sound-dai" ,0 ); +if (!link->platform_of_node) { +dev_err (card->dev,"error getting platform phandle\n" ); + ret = -EINVAL ; + goto fail; + } + + ret =snd_soc_of_get_dai_link_codecs (dev, codec, link); +if (ret <0 ) { +dev_err (card->dev,"error getting codec dai name\n" ); + goto fail; + } + link->no_pcm =1 ; + link->ignore_pmdown_time =1 ; + link->ops = &sdm845_be_ops; + link->be_hw_params_fixup = sdm845_be_hw_params_fixup; + }else { + link->platform_of_node = link->cpu_of_node; + link->codec_dai_name ="snd-soc-dummy-dai" ; + link->codec_name ="snd-soc-dummy" ; + link->dynamic =1 ; + } + + link->ignore_suspend =1 ; + ret =of_property_read_string (np,"link-name" , &link->name); +if (ret) { +dev_err (card->dev, +"error getting codec dai_link name\n" ); + goto fail; + } + + link->dpcm_playback =1 ; + link->dpcm_capture =1 ; + link->stream_name = link->name;
sound/soc/qcom/sdm845.c line 310
Quoted 10 lines
sound/soc/qcom/sdm845.c new file +10
-0+ link++; + } +dev_set_drvdata (dev, card); +snd_soc_card_set_drvdata (card, data); + +return data; +fail: +kfree (data); +return ERR_PTR (ret); +}
this routine...
Quoted 20 lines
sound/soc/qcom/sdm845.c new file +20
-0+static int add_audio_components (struct device *dev, +struct component_match **matchptr) +{ +struct device_node *np, *platform, *cpu, *node, *dai_node; + + node = dev->of_node; + +for_each_child_of_node (node, np) { + cpu =of_get_child_by_name (np,"cpu" ); +if (cpu) { + dai_node =of_parse_phandle (cpu,"sound-dai" ,0 ); +of_node_get (dai_node); +component_match_add_release (dev, matchptr, + sdm845_release_of, + sdm845_compare_of, + dai_node); + } + + platform =of_get_child_by_name (np,"platform" ); +if (platform) {
sound/soc/qcom/sdm845.c line 475
Quoted 10 lines
sound/soc/qcom/sdm845.c new file +10
-0+ dai_node =of_parse_phandle (platform,"sound-dai" ,0 ); +component_match_add_release (dev, matchptr, + sdm845_release_of, + sdm845_compare_of, + dai_node); + } + } + +return 0 ; +}
And this one is generic DT parsing and seems quite similar to one in apq8096.c Can we move these into a lib and use them instead of duplicating.
Signature · 1 line
~Vinod
Re: [alsa-devel] [PATCH v2 2/2] ASoC: qcom: add sdm845 sound card support
Quoted 2 lines · Vinod
And this one is generic DT parsing and seems quite similar to one in
apq8096.cCan we move these into a lib and use them instead of duplicating.
I totally agree with Vinod, We should probably come up with a library functions something like common.c so that we do not duplicate code. This code is going be exactly same for most of the SoCs using qdsp.
thanks,
srini
Re: [alsa-devel] [PATCH v2 2/2] ASoC: qcom: add sdm845 sound card support
Quoted 8 lines · Srinivas Kandagatla
Quoted 2 lines · Vinod
And this one is generic DT parsing and seems quite similar to one in
apq8096.cCan we move these into a lib and use them instead of duplicating.I totally agree with Vinod, We should probably come up with a library functions something like
common.cso that we do not duplicate code. This code is going be exactly same for most of the SoCs using qdsp.
Sure, I will add a new file, qcom_snd_common.c, which will have these common functions and will update apq8096 and sdm845 machine driver to use APIs exposed by qcom_snd_common.c
Quoted 7 lines
thanks,
srini_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Regards,
Rohit
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.
Re: [alsa-devel] [PATCH v2 2/2] ASoC: qcom: add sdm845 sound card support
Quoted 3 lines · Rohit Kumar
Quoted 1 line
Sure, I will add a new file,
qcom_snd_common.c, which will have these common functions and will update apq8096 and sdm845 machine driver to use APIs exposed byqcom_snd_common.c
Just name it as "common.c" no need to prefix this as is going to live in sound/soc/qcom anyway.
--srini
Rob Herring
maintainerRe: [PATCH v2 1/2] ASoC: qcom: dt-bindings: Add sdm845 machine bindings
In reply to Rohit kumarQuoted 14 lines · Rohit kumar
Add devicetree bindings documentation file for SDM845 sound card.
Signed-off-by Rohit kumar <[email protected]>--- .../devicetree/bindings/sound/qcom,sdm845.txt | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txtDocumentation/devicetree/bindings/sound/qcom,sdm845.txt new file +0
-0
Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +10
-0@@ -0,0 +1,82 @@ +* 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" + +- qcom,audio-routing:
Use just 'audio-routing'.
Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 22
Quoted 12 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +12
-0+ 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. + +- cdc-vdd-supply: + Usage: Optional + Value type: <phandle> + Definition: phandle of regulator supply required for codec vdd.
The codec supply should be in the codec node.
Quoted 26 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +26
-0+ += 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 +
Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 58
Quoted 10 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +10
-0+- sound-dai: + Usage: required + Value type: <phandle> + Definition: dai phandle/s and port of CPU/CODEC/PLATFORM node. + +Example: + +audio { + compatible = "qcom,sdm845-sndcard"; + qcom,model = "sdm845-snd-card";
Not documented. Just use 'model'.
Quoted 28 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +24
-0+ pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pri_mi2s_active &pri_mi2s_ws_active>; + pinctrl-1 = <&pri_mi2s_sleep &pri_mi2s_ws_sleep>; + + cdc-vdd-supply = <&pm8998_l14>; + + 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.
Re: [alsa-devel] [PATCH v2 1/2] ASoC: qcom: dt-bindings: Add sdm845 machine bindings
Thanks Rob for reviewing.
Quoted 18 lines · Rob Herring
Quoted 17 lines · Rohit kumar
Add devicetree bindings documentation file for SDM845 sound card.
Signed-off-by Rohit kumar <[email protected]>--- .../devicetree/bindings/sound/qcom,sdm845.txt | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/qcom,sdm845.txtDocumentation/devicetree/bindings/sound/qcom,sdm845.txt new file +3
-0@@ -0,0 +1,82 @@ +* Qualcomm Technologies Inc. SDM845 ASoC sound card driver + +This binding describes the SDM845 sound card, which uses qdsp for audio.
Quoted 8 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 10
Quoted 7 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +7
-0+ +- compatible: + Usage: required + Value type: <stringlist> + Definition: must be "qcom,sdm845-sndcard" + +- qcom,audio-routing:Use just 'audio-routing'.
This is same which is being followed in apq8096 machine driver. As all qcom machine drivers will
mostly follow the same design, Vinod asked to pull out the APIs in common file - https://patchwork.kernel.org/patch/10479625/ . Same is for qcom,model. I will add missing documentation for it in the next patchset.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +5
-0+ 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
Quoted 8 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 22
Quoted 7 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +7
-0+ source. Valid names could be power supplies, MicBias + of codec and the jacks on the board. + +- cdc-vdd-supply: + Usage: Optional + Value type: <phandle> + Definition: phandle of regulator supply required for codec vdd.The codec supply should be in the codec node.
Sure. Will add this in codec driver.
Quoted 62 lines
Quoted 26 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +26
-0+ += 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 +Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 58
Quoted 10 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +10
-0+- sound-dai: + Usage: required + Value type: <phandle> + Definition: dai phandle/s and port of CPU/CODEC/PLATFORM node. + +Example: + +audio { + compatible = "qcom,sdm845-sndcard"; + qcom,model = "sdm845-snd-card";Not documented. Just use 'model'.
Quoted 24 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +24
-0+ pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pri_mi2s_active &pri_mi2s_ws_active>; + pinctrl-1 = <&pri_mi2s_sleep &pri_mi2s_ws_sleep>; + + cdc-vdd-supply = <&pm8998_l14>; + + 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>; + }; + }; +};
Quoted 8 lines
Quoted 4 lines
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._______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Regards,
Rohit
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.
Rob Herring
maintainerRe: [alsa-devel] [PATCH v2 1/2] ASoC: qcom: dt-bindings: Add sdm845 machine bindings
Quoted 32 lines · Rohit Kumar
Thanks Rob for reviewing.
Quoted 18 lines · Rob Herring
Quoted 17 lines · Rohit kumar
Add devicetree bindings documentation file for SDM845 sound card.
Signed-off-by Rohit kumar <[email protected]>--- .../devicetree/bindings/sound/qcom,sdm845.txt | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+)create mode 100644
Documentation/devicetree/bindings/sound/qcom,sdm845.txtDocumentation/devicetree/bindings/sound/qcom,sdm845.txt new file +3
-0@@ -0,0 +1,82 @@ +* Qualcomm Technologies Inc. SDM845 ASoC sound card driver + +This binding describes the SDM845 sound card, which uses qdsp for audio.Quoted 8 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt line 10
Quoted 7 lines
Documentation/devicetree/bindings/sound/qcom,sdm845.txt new file +7
-0+ +- compatible: + Usage: required + Value type: <stringlist> + Definition: must be "qcom,sdm845-sndcard" + +- qcom,audio-routing:Use just 'audio-routing'.
Quoted 6 lines
This is same which is being followed in apq8096 machine driver. As all qcom machine drivers will
mostly follow the same design, Vinod asked to pull out the APIs in common file - https://patchwork.kernel.org/patch/10479625/ . Same is for qcom,model. I will add missing documentation for it in the next patchset.
Yes, I know. There are lots of <vendor>,model and others, and I'm asking folks to drop the vendor prefix.
Rob