Add support for audio on SDM845 SoC
Subsystems (5)
v3 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 v2:
- Added new file to parse dai-links from device tree and use it in sdm845 and apq8096 machine driver.
- Removed qcom prefix from device tree properties as suggested by Robb.
- Updated apq8096 machine driver to use common APIs.
Rohit kumar (5):
ASoC: qcom: dt-bindings: Add sdm845 machine bindings
ASoC: qcom: Add support to parse common audio device nodes
ASoC: qcom: add sdm845 sound card support
ASoC: dt-bindings: Update dt binding name for apq8096
ASoC: qcom: apq8096: Use common APIs to parse device nodes
.../devicetree/bindings/sound/qcom,apq8096.txt | 15 +- .../devicetree/bindings/sound/qcom,sdm845.txt | 80 +++++ sound/soc/qcom/Kconfig | 14 + sound/soc/qcom/Makefile | 3 + sound/soc/qcom/apq8096.c | 151 +------- sound/soc/qcom/common.c | 150 ++++++++ sound/soc/qcom/common.h | 14 + sound/soc/qcom/sdm845.c | 390 +++++++++++++++++++++ 8 files changed, 674 insertions(+), 143 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.
PATCH v3 1/5 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
@@ -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.
Re: [PATCH v3 1/5] ASoC: qcom: dt-bindings: Add sdm845 machine bindings
Quoted 7 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 | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sdm845.txt
PATCH v3 2/5 ASoC: qcom: Add support to parse common audio device nodes
In reply to Rohit kumarThis adds support to parse cpu, platform and codec device nodes and add them in dai-links. Also, add API to add slave components associated with machine driver.
--- sound/soc/qcom/Kconfig | 3 + sound/soc/qcom/Makefile | 1 + sound/soc/qcom/common.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/qcom/common.h | 14 +++++ 4 files changed, 168 insertions(+) create mode 100644 sound/soc/qcom/common.c create mode 100644 sound/soc/qcom/common.h
sound/soc/qcom/Kconfig +3 -0
@@ -90,3 +90,6 @@ 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_QCOM_COMMON + tristate
sound/soc/qcom/Makefile +1 -0
@@ -19,5 +19,6 @@ 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_QCOM_COMMON) += common.o #DSP lib obj-$(CONFIG_SND_SOC_QDSP6) += qdsp6/
sound/soc/qcom/common.c new file +150 -0
150 lines not on this page · raw message
sound/soc/qcom/common.h new file +14 -0
@@ -0,0 +1,14 @@ +/* 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); +int qcom_snd_add_components (struct device *dev, +struct component_match **matchptr); + +#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.
Re: [PATCH v3 2/5] ASoC: qcom: Add support to parse common audio device nodes
Quoted 5 lines · Rohit kumar
This adds support to parse cpu, platform and codec device nodes and add them in dai-links. Also, add API to add slave components associated with machine driver.
Quoted 8 lines
Signed-off-by Rohit kumar<[email protected]>--- sound/soc/qcom/Kconfig | 3 + sound/soc/qcom/Makefile | 1 + sound/soc/qcom/common.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/qcom/common.h | 14 +++++ 4 files changed, 168 insertions(+)create mode 100644
sound/soc/qcom/common.c
common.c seems to miss
MODULE_LICENSE("GPL v2");
this will be an issue for snd card module auto-loading!
Also patch 5/5 can go with this.
Other than that it looks good.
Once these 2 fixed you can add my Ack
--srini
Quoted 1 line
create mode 100644
sound/soc/qcom/common.h
Re: [alsa-devel] [PATCH v3 2/5] ASoC: qcom: Add support to parse common audio device nodes
Quoted 17 lines · Srinivas Kandagatla
Quoted 5 lines · Rohit kumar
This adds support to parse cpu, platform and codec device nodes and add them in dai-links. Also, add API to add slave components associated with machine driver.
Quoted 8 lines
Signed-off-by Rohit kumar<[email protected]>--- sound/soc/qcom/Kconfig | 3 + sound/soc/qcom/Makefile | 1 + sound/soc/qcom/common.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/qcom/common.h | 14 +++++ 4 files changed, 168 insertions(+)create mode 100644
sound/soc/qcom/common.c
Quoted 1 line
common.cseems to miss
Btw do you need a new Kconfig symbol for this?
Alternate option would be to just add common.o to wherever it is needed
Signature · 1 line
~Vinod
PATCH v3 3/5 ASoC: qcom: add sdm845 sound card support
In reply to Rohit kumarThis patch adds sdm845 audio machine driver support.
--- sound/soc/qcom/Kconfig | 10 ++ sound/soc/qcom/Makefile | 2 + sound/soc/qcom/sdm845.c | 390 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 402 insertions(+) create mode 100644 sound/soc/qcom/sdm845.c
sound/soc/qcom/Kconfig +10 -0
@@ -93,3 +93,13 @@ config SND_SOC_MSM8996 config SND_SOC_QCOM_COMMON tristate + +config SND_SOC_SDM845 + tristate "SoC Machine driver for SDM845 boards" + select SND_SOC_QDSP6 + select SND_SOC_QCOM_COMMON + default n + 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 obj-$(CONFIG_SND_SOC_QCOM_COMMON) += common.o #DSP lib
sound/soc/qcom/sdm845.c new file +390 -0
390 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 v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 17 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +17
-0+static void sdm845_init_supplies (struct device *dev) +{ +struct snd_soc_card *card =dev_get_drvdata (dev); +struct sdm845_snd_data *data =snd_soc_card_get_drvdata (card); + + data->vdd_supply =regulator_get (dev,"cdc-vdd" ); +if (IS_ERR (data->vdd_supply)) { +dev_err (dev,"Unable to get regulator supplies\n" ); + data->vdd_supply =NULL ; +return ; + } + +if (regulator_enable (data->vdd_supply)) +dev_err (dev,"Unable to enable vdd supply\n" ); +} + +static void sdm845_deinit_supplies (struct device *dev)
sound/soc/qcom/sdm845.c line 227
Quoted 10 lines
sound/soc/qcom/sdm845.c new file +10
-0+{ +struct snd_soc_card *card =dev_get_drvdata (dev); +struct sdm845_snd_data *data =snd_soc_card_get_drvdata (card); + +if (!data->vdd_supply) +return ; + +regulator_disable (data->vdd_supply); +regulator_put (data->vdd_supply); +}
these two can be made generic, cant we make these common when we have supplies present?
Quoted 43 lines
sound/soc/qcom/sdm845.c new file +43
-0+static int sdm845_bind (struct device *dev) +{ +struct snd_soc_card *card; +struct sdm845_snd_data *data; +int ret; + + card =kzalloc (sizeof (*card),GFP_KERNEL ); +if (!card) +return -ENOMEM ; + +/* Allocate the private data */ + data =kzalloc (sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + ret =component_bind_all (dev, card); +if (ret) { +dev_err (dev,"Audio components bind failed: %d\n" , ret); + goto bind_fail; + } + +dev_set_drvdata (dev, card); + card->dev = dev; + ret =qcom_snd_parse_of (card); +if (ret) { +dev_err (dev,"Error parsing OF data\n" ); + goto parse_dt_fail; + } + + data->card = card; +snd_soc_card_set_drvdata (card, data); + +sdm845_add_be_ops (card); + +sdm845_init_supplies (dev); + + ret =snd_soc_register_card (card); +if (ret) { +dev_err (dev,"Sound card registration failed\n" ); + goto register_card_fail; + } +return ret; +
sound/soc/qcom/sdm845.c line 295
Quoted 10 lines
sound/soc/qcom/sdm845.c new file +10
-0+register_card_fail: +sdm845_deinit_supplies (dev); +kfree (card->dai_link); +parse_dt_fail: +component_unbind_all (dev, card); +bind_fail: +kfree (data); +kfree (card); +return ret; +}
I would make a case for this to be moved into common too :)
Signature · 1 line
~Vinod
Re: [alsa-devel] [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Thanks Vinod for reviewing.
Quoted 23 lines · Vinod
Quoted 21 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +21
-0+static void sdm845_init_supplies (struct device *dev) +{ +struct snd_soc_card *card =dev_get_drvdata (dev); +struct sdm845_snd_data *data =snd_soc_card_get_drvdata (card); + + data->vdd_supply =regulator_get (dev,"cdc-vdd" ); +if (IS_ERR (data->vdd_supply)) { +dev_err (dev,"Unable to get regulator supplies\n" ); + data->vdd_supply =NULL ; +return ; + } + +if (regulator_enable (data->vdd_supply)) +dev_err (dev,"Unable to enable vdd supply\n" ); +} + +static void sdm845_deinit_supplies (struct device *dev) +{ +struct snd_soc_card *card =dev_get_drvdata (dev); +struct sdm845_snd_data *data =snd_soc_card_get_drvdata (card); +
Quoted 8 lines
sound/soc/qcom/sdm845.c line 227
Quoted 6 lines
sound/soc/qcom/sdm845.c new file +6
-0+if (!data->vdd_supply) +return ; + +regulator_disable (data->vdd_supply); +regulator_put (data->vdd_supply); +}these two can be made generic, cant we make these common when we have supplies present?
Actually we need to move it to codec driver as suggested by Rob in v2 patchset. I will remove this in next spin.
Quoted 46 lines
Quoted 46 lines
sound/soc/qcom/sdm845.c new file +46
-0+static int sdm845_bind (struct device *dev) +{ +struct snd_soc_card *card; +struct sdm845_snd_data *data; +int ret; + + card =kzalloc (sizeof (*card),GFP_KERNEL ); +if (!card) +return -ENOMEM ; + +/* Allocate the private data */ + data =kzalloc (sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + ret =component_bind_all (dev, card); +if (ret) { +dev_err (dev,"Audio components bind failed: %d\n" , ret); + goto bind_fail; + } + +dev_set_drvdata (dev, card); + card->dev = dev; + ret =qcom_snd_parse_of (card); +if (ret) { +dev_err (dev,"Error parsing OF data\n" ); + goto parse_dt_fail; + } + + data->card = card; +snd_soc_card_set_drvdata (card, data); + +sdm845_add_be_ops (card); + +sdm845_init_supplies (dev); + + ret =snd_soc_register_card (card); +if (ret) { +dev_err (dev,"Sound card registration failed\n" ); + goto register_card_fail; + } +return ret; + +register_card_fail: +sdm845_deinit_supplies (dev); +kfree (card->dai_link);
Quoted 8 lines
sound/soc/qcom/sdm845.c line 295
Quoted 7 lines
sound/soc/qcom/sdm845.c new file +7
-0+parse_dt_fail: +component_unbind_all (dev, card); +bind_fail: +kfree (data); +kfree (card); +return ret; +}I would make a case for this to be moved into common too :)
There are few platform specific APIs and structs here like struct sdm845_snd_data, sdm845_add_be_ops() which needs to be initialized and assigned before soundcard registration. Moving this complete API to common will restrict it. Please suggest.
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 v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 55 lines · Rohit Kumar
Quoted 46 lines
Quoted 46 lines
sound/soc/qcom/sdm845.c new file +46
-0+static int sdm845_bind (struct device *dev) +{ +struct snd_soc_card *card; +struct sdm845_snd_data *data; +int ret; + + card =kzalloc (sizeof (*card),GFP_KERNEL ); +if (!card) +return -ENOMEM ; + +/* Allocate the private data */ + data =kzalloc (sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + ret =component_bind_all (dev, card); +if (ret) { +dev_err (dev,"Audio components bind failed: %d\n" , ret); + goto bind_fail; + } + +dev_set_drvdata (dev, card); + card->dev = dev; + ret =qcom_snd_parse_of (card); +if (ret) { +dev_err (dev,"Error parsing OF data\n" ); + goto parse_dt_fail; + } + + data->card = card; +snd_soc_card_set_drvdata (card, data); + +sdm845_add_be_ops (card); + +sdm845_init_supplies (dev); + + ret =snd_soc_register_card (card); +if (ret) { +dev_err (dev,"Sound card registration failed\n" ); + goto register_card_fail; + } +return ret; + +register_card_fail: +sdm845_deinit_supplies (dev); +kfree (card->dai_link);Quoted 8 lines
sound/soc/qcom/sdm845.c line 295
Quoted 7 lines
sound/soc/qcom/sdm845.c new file +7
-0+parse_dt_fail: +component_unbind_all (dev, card); +bind_fail: +kfree (data); +kfree (card); +return ret; +}I would make a case for this to be moved into common too :)
Quoted 6 lines
There are few platform specific APIs and structs here like struct
sdm845_snd_data,sdm845_add_be_ops()which needs to be initialized and assigned before soundcard
registration. Moving this complete API to common will restrict it. Please suggest.
Yes indeed, they can be split and done outside while the common stuff use a 'core' object and use that to initialize. If you need to do some driver step, you can invoke a callback.
Signature · 1 line
~Vinod
Re: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
In reply to Rohit kumarMinor Nits...
sound/soc/qcom/sdm845.c line 28
Quoted 8 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +8
-0+struct sdm845_snd_data { +struct snd_soc_card *card; +struct regulator *vdd_supply; +uint32_t pri_mi2s_clk_count; +uint32_t quat_tdm_clk_count; +}; + +
Unnecessary extra line..
sound/soc/qcom/sdm845.c line 383
Quoted 10 lines
sound/soc/qcom/sdm845.c new file +9
-0+static unsigned int tdm_slot_offset[8 ] = {0 ,4 ,8 ,12 ,16 ,20 ,24 ,28 }; + +static struct platform_driver sdm845_snd_driver = { + .probe = sdm845_snd_platform_probe, + .remove = sdm845_snd_platform_remove, + .driver = { + .name ="msm-snd-sdm845" , + .pm = &sdm845_pm_ops, + .owner =THIS_MODULE ,
setting owner is not required here!
Quoted 3 lines
sound/soc/qcom/sdm845.c new file +3
-0+ .of_match_table = sdm845_snd_device_id, + }, +};
Mark Brown
maintainerRe: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
In reply to Rohit kumarsound/soc/qcom/sdm845.c line 4
Quoted 5 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +4
-0@@ -0,0 +1,390 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2018, The Linux Foundation. All rights reserved. +*/
Please make the entire comment block a C++ comment, it makes it look more intentional.
sound/soc/qcom/sdm845.c line 314
Quoted 4 lines
sound/soc/qcom/sdm845.c new file +4
-0+static const struct component_master_ops sdm845_ops = { + .bind = sdm845_bind, + .unbind = sdm845_unbind, +};
Why is this using the component stuff rather than the normal support for finding the components of audio cards?
Re: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Thanks Mark for reviewing.
Quoted 9 lines · Mark Brown
sound/soc/qcom/sdm845.c line 4
Quoted 5 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +4
-0@@ -0,0 +1,390 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2018, The Linux Foundation. All rights reserved. +*/ Please make the entire comment block a C++ comment, it makes it look more intentional.
Sure, will make this change in next patchset.
Quoted 7 lines
sound/soc/qcom/sdm845.c line 314
Quoted 4 lines
sound/soc/qcom/sdm845.c new file +4
-0+static const struct component_master_ops sdm845_ops = { + .bind = sdm845_bind, + .unbind = sdm845_unbind, +};Why is this using the component stuff rather than the normal support for finding the components of audio cards?
QCOM soundcard is dependent on platform and cpu dais which gets registered only when ADSP is up.
This is the design being followed in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/qcom/apq8096.c?h=v4.18-rc4#n132
We too have the same dependency.
Quoted 6 lines
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Thanks,
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.
Mark Brown
maintainerRe: [alsa-devel] [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 11 lines · Rohit Kumar
Quoted 9 lines · Mark Brown
sound/soc/qcom/sdm845.c line 314
Quoted 4 lines · Rohit kumar
sound/soc/qcom/sdm845.c new file +4
-0+static const struct component_master_ops sdm845_ops = { + .bind = sdm845_bind, + .unbind = sdm845_unbind, +};Why is this using the component stuff rather than the normal support for finding the components of audio cards?
Quoted 2 lines
QCOM soundcard is dependent on platform and cpu dais which gets registered only when ADSP is up.
This doesn't answer the question...
Quoted 1 line
This is the design being followed in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/qcom/apq8096.c?h=v4.18-rc4#n132
Oh dear, missed that :( This is also broken and should be fixed.
Re: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
In reply to Mark BrownQuoted 6 lines · Mark Brown
sound/soc/qcom/sdm845.c line 314
Quoted 4 lines
sound/soc/qcom/sdm845.c new file +4
-0+static const struct component_master_ops sdm845_ops = { + .bind = sdm845_bind, + .unbind = sdm845_unbind, +};Why is this using the component stuff rather than the normal support for finding the components of audio cards?
Could you elaborate this please?
Do you mean something like snd_soc_lookup_component()? Or in general audio card binding during startup.
AFAIU, The issue with that mechanism or EPROBEDEFER is that it works only for first time.. for the second time(restart usecase) there are no hooks like bind/unbind.
The reason why we chose to use component framework is because of bind and unbind functionality. Am more than happy to rework on this if there is already a alternative mechanism in ASoC which can provide this.
The design we are aiming at is:
1> audio card to deregister when any of the DSP audio services go DOWN. 2> re-register audio card only when all the DSP audio services are UP.
Usecase is something like DSP start-stop or restart due to fatal errors.
thanks,
srini
Mark Brown
maintainerRe: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 9 lines · Srinivas Kandagatla
Quoted 7 lines · Mark Brown
sound/soc/qcom/sdm845.c line 314
Quoted 4 lines
sound/soc/qcom/sdm845.c new file +4
-0+static const struct component_master_ops sdm845_ops = { + .bind = sdm845_bind, + .unbind = sdm845_unbind, +};Why is this using the component stuff rather than the normal support for finding the components of audio cards?
Quoted 3 lines
Could you elaborate this please?
Do you mean something likesnd_soc_lookup_component()? Or in general audio card binding during startup.
Just the normal audio card binding during startup.
Quoted 3 lines
AFAIU, The issue with that mechanism or EPROBEDEFER is that it works only for first time.. for the second time(restart usecase) there are no hooks like bind/unbind.
This is not the case, the card will be unbound at the ASoC level when any of the components are removed and then probed again when they reappear.
Quoted 3 lines
The reason why we chose to use component framework is because of bind and unbind functionality. Am more than happy to rework on this if there is already a alternative mechanism in ASoC which can provide this.
The component framework is a generalization of what ASoC does.
Re: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 4 lines · Mark Brown
This is not the case, the card will be unbound at the ASoC level when any of the components are removed and then probed again when they reappear.
I will give that a try now!
--srini
Re: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
In reply to Mark BrownQuoted 7 lines · Mark Brown
Quoted 3 lines
AFAIU, The issue with that mechanism or EPROBEDEFER is that it works only for first time.. for the second time(restart usecase) there are no hooks like bind/unbind.
This is not the case, the card will be unbound at the ASoC level when any of the components are removed and then probed again when they reappear.
I did try this and It works only for first time! May be am missing something!
snd_soc_component_del_unlocked() unregisters the sound card totally. so for the second time (After DSP stop) there is no registered sound card in place.. Am not sure how this is supposed to work?
The reason I think it works for the first time is because of EPROBEDEFER from the machine driver.
Here are the steps I do with DSP:
Step1: Start DSP, can see sound card after all the services are ON.
Step2: Stop DSP, there is no audio card.
Step3: Start DSP, I can see all the components in debugfs but not the sound card.
This is what I do w.r.t code:
From machine driver in snd_soc_register_card() in probe() From Audio services driver snd_soc_register_component() in probe() and snd_soc_unregister_component() in remove()
When DSP is stopped the audio services disappear and snd_soc_unregister_component() is invoked.
thanks,
srini
Mark Brown
maintainerRe: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 10 lines · Srinivas Kandagatla
Quoted 5 lines · Mark Brown
Quoted 1 line
AFAIU, The issue with that mechanism or EPROBEDEFER is that it works only
This is not the case, the card will be unbound at the ASoC level when any of the components are removed and then probed again when they reappear.
I did try this and It works only for first time! May be am missing something!
Quoted 6 lines
snd_soc_component_del_unlocked()unregisters the sound card totally. so for the second time (After DSP stop) there is no registered sound card in place.. Am not sure how this is supposed to work?The reason I think it works for the first time is because of EPROBEDEFER from the machine driver.
Ugh, right - we ripped out that code because there's no sensible use case for it so now we don't keep the cards on a list. The expectation is that if someone is going around removing bits of the card they can probably figure out that they should be removing the card first.
In any case the place to implement this is in the core, there's nothing special about your cards here. Either the core should be using the component framework or the card list should be resurrected and we open code it. This isn't something that's unique to your device.
Re: [PATCH v3 3/5] ASoC: qcom: add sdm845 sound card support
Quoted 23 lines · Mark Brown
Quoted 10 lines · Srinivas Kandagatla
Quoted 5 lines · Mark Brown
Quoted 1 line
AFAIU, The issue with that mechanism or EPROBEDEFER is that it works only
This is not the case, the card will be unbound at the ASoC level when any of the components are removed and then probed again when they reappear.
I did try this and It works only for first time! May be am missing something!
Quoted 6 lines
snd_soc_component_del_unlocked()unregisters the sound card totally. so for the second time (After DSP stop) there is no registered sound card in place.. Am not sure how this is supposed to work?The reason I think it works for the first time is because of EPROBEDEFER from the machine driver.
Ugh, right - we ripped out that code because there's no sensible use case for it so now we don't keep the cards on a list. The expectation is that if someone is going around removing bits of the card they can probably figure out that they should be removing the card first.
Quoted 4 lines
In any case the place to implement this is in the core, there's nothing special about your cards here. Either the core should be using the component framework or the card list should be resurrected and we open code it. This isn't something that's unique to your device.
I totally agree with you, this functionality belongs to core!
I will explore both options and see how it goes.
thanks,
srini
Quoted 1 line
PATCH v3 4/5 ASoC: dt-bindings: Update dt binding name for apq8096
In reply to Rohit kumarRemove 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
@@ -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.
Re: [PATCH v3 4/5] ASoC: dt-bindings: Update dt binding name for apq8096
Quoted 2 lines · Rohit kumar
Remove qcom prefix from machine driver dt bindings of apq8096 SoC.
Yes, this is a good move to make everything inline!
Quoted 5 lines
Signed-off-by Rohit kumar<[email protected]>--- Documentation/devicetree/bindings/sound/qcom,apq8096.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
Re: [PATCH v3 4/5] ASoC: dt-bindings: Update dt binding name for apq8096
In reply to Rohit kumarQuoted 7 lines · Rohit kumar
Remove qcom prefix from machine driver dt bindings of apq8096 SoC.
Signed-off-by Rohit kumar <[email protected]>--- Documentation/devicetree/bindings/sound/qcom,apq8096.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
PATCH v3 5/5 ASoC: qcom: apq8096: Use common APIs to parse device nodes
In reply to Rohit kumarUse generic APIs exposed by common.c for parsing dai link device tree nodes and adding slave components.
--- sound/soc/qcom/Kconfig | 1 + sound/soc/qcom/apq8096.c | 151 ++++------------------------------------------- 2 files changed, 11 insertions(+), 141 deletions(-)
sound/soc/qcom/Kconfig +1 -0
@@ -86,6 +86,7 @@ config SND_SOC_MSM8996 tristate "SoC Machine driver for MSM8996 and APQ8096 boards" depends on QCOM_APR select SND_SOC_QDSP6 + select SND_SOC_QCOM_COMMON help Support for Qualcomm Technologies LPASS audio block in APQ8096 SoC-based systems.
sound/soc/qcom/apq8096.c +10 -141
190 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.