~postmarketos/upstreaming

ASoC: qcom: Use qcom_snd_parse_of() for apq8016_sbc v1 PROPOSED

Stephan Gerhold
At the moment we have two separate functions to parse the sound card
properties from the device tree: qcom_snd_parse_of() for DPCM and
apq8016_sbc_parse_of() without DPCM. These functions are almost identical
except for a few minor differences.

This patch set extends qcom_snd_parse_of() to handle links without DPCM,
so that we can use one common function for all (qcom) machine drivers.

Stephan Gerhold (7):
  ASoC: qcom: Use devm for resource management
  ASoC: qcom: common: Use snd_soc_dai_link_set_capabilities()
  ASoC: q6afe: Remove unused q6afe_is_rx_port() function
  ASoC: qcom: common: Support parsing links without DPCM
  ASoC: qcom: common: Parse properties with "qcom," prefix
  ASoC: qcom: apq8016_sbc: Use qcom_snd_parse_of()
  ASoC: qcom: common: Avoid printing errors for -EPROBE_DEFER

 sound/soc/qcom/Kconfig       |   1 +
 sound/soc/qcom/apq8016_sbc.c | 120 ++++-------------------------------
 sound/soc/qcom/apq8096.c     |  28 +-------
 sound/soc/qcom/common.c      |  58 ++++++++++-------
 sound/soc/qcom/qdsp6/q6afe.c |   8 ---
 sound/soc/qcom/qdsp6/q6afe.h |   1 -
 sound/soc/qcom/sdm845.c      |  40 ++----------
 7 files changed, 59 insertions(+), 197 deletions(-)

-- 
2.27.0
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~postmarketos/upstreaming/patches/11707/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH 1/7] ASoC: qcom: Use devm for resource management Export this patch

Stephan Gerhold
Simplify the machine drivers for newer SoCs a bit by using the
devm_* function calls that automatically release the resources
when the driver is removed or when probing fails.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/apq8096.c | 28 +++-------------------------
 sound/soc/qcom/common.c  |  3 +--
 sound/soc/qcom/sdm845.c  | 40 ++++++----------------------------------
 3 files changed, 10 insertions(+), 61 deletions(-)

diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c
index 287ad2aa27f3..134f5a81df7f 100644
--- a/sound/soc/qcom/apq8096.c
+++ b/sound/soc/qcom/apq8096.c
@@ -109,7 +109,7 @@ static int apq8096_platform_probe(struct platform_device *pdev)
	struct device *dev = &pdev->dev;
	int ret;

	card = kzalloc(sizeof(*card), GFP_KERNEL);
	card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
	if (!card)
		return -ENOMEM;

@@ -117,31 +117,10 @@ static int apq8096_platform_probe(struct platform_device *pdev)
	dev_set_drvdata(dev, card);
	ret = qcom_snd_parse_of(card);
	if (ret)
		goto err;
		return ret;

	apq8096_add_be_ops(card);
	ret = snd_soc_register_card(card);
	if (ret)
		goto err_card_register;

	return 0;

err_card_register:
	kfree(card->dai_link);
err:
	kfree(card);
	return ret;
}

static int apq8096_platform_remove(struct platform_device *pdev)
{
	struct snd_soc_card *card = dev_get_drvdata(&pdev->dev);

	snd_soc_unregister_card(card);
	kfree(card->dai_link);
	kfree(card);

	return 0;
	return devm_snd_soc_register_card(dev, card);
}

static const struct of_device_id msm_snd_apq8096_dt_match[] = {
@@ -153,7 +132,6 @@ MODULE_DEVICE_TABLE(of, msm_snd_apq8096_dt_match);

static struct platform_driver msm_snd_apq8096_driver = {
	.probe  = apq8096_platform_probe,
	.remove = apq8096_platform_remove,
	.driver = {
		.name = "msm-snd-apq8096",
		.of_match_table = msm_snd_apq8096_dt_match,
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 8ada4ecba847..d677e83828af 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -36,7 +36,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
	num_links = of_get_child_count(dev->of_node);

	/* Allocate the DAI link array */
	card->dai_link = kcalloc(num_links, sizeof(*link), GFP_KERNEL);
	card->dai_link = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL);
	if (!card->dai_link)
		return -ENOMEM;

@@ -143,7 +143,6 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
	of_node_put(cpu);
	of_node_put(codec);
	of_node_put(platform);
	kfree(card->dai_link);
	return ret;
}
EXPORT_SYMBOL(qcom_snd_parse_of);
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index 68e9388ff46f..580acfaf38e7 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -543,16 +543,14 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
	struct device *dev = &pdev->dev;
	int ret;

	card = kzalloc(sizeof(*card), GFP_KERNEL);
	card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
	if (!card)
		return -ENOMEM;

	/* Allocate the private data */
	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if (!data) {
		ret = -ENOMEM;
		goto data_alloc_fail;
	}
	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	card->dapm_widgets = sdm845_snd_widgets;
	card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets);
@@ -560,38 +558,13 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
	dev_set_drvdata(dev, card);
	ret = qcom_snd_parse_of(card);
	if (ret)
		goto parse_dt_fail;
		return ret;

	data->card = card;
	snd_soc_card_set_drvdata(card, data);

	sdm845_add_ops(card);
	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:
	kfree(card->dai_link);
parse_dt_fail:
	kfree(data);
data_alloc_fail:
	kfree(card);
	return ret;
}

static int sdm845_snd_platform_remove(struct platform_device *pdev)
{
	struct snd_soc_card *card = dev_get_drvdata(&pdev->dev);
	struct sdm845_snd_data *data = snd_soc_card_get_drvdata(card);

	snd_soc_unregister_card(card);
	kfree(card->dai_link);
	kfree(data);
	kfree(card);
	return 0;
	return devm_snd_soc_register_card(dev, card);
}

static const struct of_device_id sdm845_snd_device_id[]  = {
@@ -604,7 +577,6 @@ MODULE_DEVICE_TABLE(of, sdm845_snd_device_id);

static struct platform_driver sdm845_snd_driver = {
	.probe = sdm845_snd_platform_probe,
	.remove = sdm845_snd_platform_remove,
	.driver = {
		.name = "msm-snd-sdm845",
		.of_match_table = sdm845_snd_device_id,
-- 
2.27.0

[PATCH 2/7] ASoC: qcom: common: Use snd_soc_dai_link_set_capabilities() Export this patch

Stephan Gerhold
Commit a2120089251f ("ASoC: qcom: common: set correct directions for dailinks")
introduced a call to q6afe_is_rx_port() to set the dpcm_playback/capture
parameters correctly. This is necessary because those parameters are now
validated to match the capabilities of the DAIs. [1]

The disadvantage of introducing the call to q6afe_is_rx_port() is that
it makes the qcom_snd_parse_of() helper dependent on the QDSP6 driver.
When the ADSP is bypassed (e.g. in apq8016-sbc) QDSP6 is not used.

There is a generic solution for this now: The correct direction for the links
is already defined by the DAI capabilities (e.g. rx ports only support playback).

Commit 25612477d20b ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
introduced the snd_soc_dai_link_set_capabilities() function that we can use
to set dpcm_playback/dpcm_capture according to the capabilities of the DAIs.

Use that for both FE/BE DAI links to avoid the dependency on the QDSP6 driver.

[1]: https://lore.kernel.org/alsa-devel/20200616085409.GA110999@gerhold.net/

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/common.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index d677e83828af..030df6026562 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -4,7 +4,6 @@

#include <linux/module.h>
#include "common.h"
#include "qdsp6/q6afe.h"

int qcom_snd_parse_of(struct snd_soc_card *card)
{
@@ -102,15 +101,6 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
			}
			link->no_pcm = 1;
			link->ignore_pmdown_time = 1;

			if (q6afe_is_rx_port(link->id)) {
				link->dpcm_playback = 1;
				link->dpcm_capture = 0;
			} else {
				link->dpcm_playback = 0;
				link->dpcm_capture = 1;
			}

		} else {
			dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
			if (!dlc)
@@ -123,10 +113,9 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
			link->codecs->dai_name = "snd-soc-dummy-dai";
			link->codecs->name = "snd-soc-dummy";
			link->dynamic = 1;
			link->dpcm_playback = 1;
			link->dpcm_capture = 1;
		}

		snd_soc_dai_link_set_capabilities(link);
		link->ignore_suspend = 1;
		link->nonatomic = 1;
		link->stream_name = link->name;
-- 
2.27.0

[PATCH 3/7] ASoC: q6afe: Remove unused q6afe_is_rx_port() function Export this patch

Stephan Gerhold
This reverts commit 4a95737440d ("ASoc: q6afe: add support to get
port direction"), since the function is not needed anymore.

q6afe-dai already exposes the possible directions for a DAI through
the DAI capabilities (playback/capture-only DAI). Now we use
snd_soc_dai_link_set_capabilities() to infer the information
directly from the DAI capabilities.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/qdsp6/q6afe.c | 8 --------
 sound/soc/qcom/qdsp6/q6afe.h | 1 -
 2 files changed, 9 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 0ce4eb60f984..e0945f7a58c8 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -800,14 +800,6 @@ int q6afe_get_port_id(int index)
}
EXPORT_SYMBOL_GPL(q6afe_get_port_id);

int q6afe_is_rx_port(int index)
{
	if (index < 0 || index >= AFE_PORT_MAX)
		return -EINVAL;

	return port_maps[index].is_rx;
}
EXPORT_SYMBOL_GPL(q6afe_is_rx_port);
static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt,
			    struct q6afe_port *port)
{
diff --git a/sound/soc/qcom/qdsp6/q6afe.h b/sound/soc/qcom/qdsp6/q6afe.h
index 1a0f80a14afe..c7ed5422baff 100644
--- a/sound/soc/qcom/qdsp6/q6afe.h
+++ b/sound/soc/qcom/qdsp6/q6afe.h
@@ -198,7 +198,6 @@ int q6afe_port_start(struct q6afe_port *port);
int q6afe_port_stop(struct q6afe_port *port);
void q6afe_port_put(struct q6afe_port *port);
int q6afe_get_port_id(int index);
int q6afe_is_rx_port(int index);
void q6afe_hdmi_port_prepare(struct q6afe_port *port,
			    struct q6afe_hdmi_cfg *cfg);
void q6afe_slim_port_prepare(struct q6afe_port *port,
-- 
2.27.0

[PATCH 4/7] ASoC: qcom: common: Support parsing links without DPCM Export this patch

Stephan Gerhold
So far qcom_snd_parse_of() was only used to parse the device tree
for boards using the QDSP6 driver together with DPCM. apq8016_sbc
uses an almost identical version (apq8016_sbc_parse_of()) which
parses links without DPCM.

Given the similarity of the two functions it is useful to combine
these two. To allow using qcom_snd_parse_of() in apq8016_sbc we
need to support parsing links without DPCM as well.

This is pretty simple: A DPCM link in the device tree is defined using:

  - DPCM frontend: "cpu"
  - DPCM backend:  "cpu", "platform" and "codec"

... while a link without DPCM has "cpu" and "codec" (but no "platform").

Add a few more if conditions to handle links without DPCM correctly.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/common.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 030df6026562..54f5bc60246f 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -84,7 +84,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
			goto err;
		}

		if (codec && platform) {
		if (platform) {
			link->platforms->of_node = of_parse_phandle(platform,
					"sound-dai",
					0);
@@ -93,15 +93,24 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
				ret = -EINVAL;
				goto err;
			}
		} else {
			link->platforms->of_node = link->cpus->of_node;
		}

		if (codec) {
			ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
			if (ret < 0) {
				dev_err(card->dev, "%s: codec dai not found\n", link->name);
				goto err;
			}
			link->no_pcm = 1;
			link->ignore_pmdown_time = 1;

			if (platform) {
				/* DPCM backend */
				link->no_pcm = 1;
				link->ignore_pmdown_time = 1;
			}
		} else {
			/* DPCM frontend */
			dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
			if (!dlc)
				return -ENOMEM;
@@ -109,15 +118,18 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
			link->codecs	 = dlc;
			link->num_codecs = 1;

			link->platforms->of_node = link->cpus->of_node;
			link->codecs->dai_name = "snd-soc-dummy-dai";
			link->codecs->name = "snd-soc-dummy";
			link->dynamic = 1;
		}

		snd_soc_dai_link_set_capabilities(link);
		link->ignore_suspend = 1;
		link->nonatomic = 1;
		if (platform || !codec) {
			/* DPCM */
			snd_soc_dai_link_set_capabilities(link);
			link->ignore_suspend = 1;
			link->nonatomic = 1;
		}

		link->stream_name = link->name;
		link++;

-- 
2.27.0

[PATCH 5/7] ASoC: qcom: common: Parse properties with "qcom," prefix Export this patch

Stephan Gerhold
The apq8016_sbc device tree binding uses a "qcom," vendor prefix
for all device tree properties, while qcom_snd_parse_of() uses the
same properties without a prefix.

In the future it would be nice to make this consistent, however,
for backwards compatibility we need to parse both names to allow
apq8016_sbc to use the common qcom_snd_parse_of() function.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/common.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 54f5bc60246f..84dba0d69e6b 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -18,6 +18,9 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
	int ret, num_links;

	ret = snd_soc_of_parse_card_name(card, "model");
	if (ret == 0 && !card->name)
		/* Deprecated, only for compatibility with old device trees */
		ret = snd_soc_of_parse_card_name(card, "qcom,model");
	if (ret) {
		dev_err(dev, "Error parsing card name: %d\n", ret);
		return ret;
@@ -25,8 +28,13 @@ int qcom_snd_parse_of(struct snd_soc_card *card)

	/* DAPM routes */
	if (of_property_read_bool(dev->of_node, "audio-routing")) {
		ret = snd_soc_of_parse_audio_routing(card,
				"audio-routing");
		ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
		if (ret)
			return ret;
	}
	/* Deprecated, only for compatibility with old device trees */
	if (of_property_read_bool(dev->of_node, "qcom,audio-routing")) {
		ret = snd_soc_of_parse_audio_routing(card, "qcom,audio-routing");
		if (ret)
			return ret;
	}
-- 
2.27.0

[PATCH 6/7] ASoC: qcom: apq8016_sbc: Use qcom_snd_parse_of() Export this patch

Stephan Gerhold
Now that we have updated qcom_snd_parse_of() to handle the device
tree bindings used for apq8016_sbc, update the apq8016_sbc driver
to use the common function and remove the duplicated code.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/Kconfig       |   1 +
 sound/soc/qcom/apq8016_sbc.c | 120 ++++-------------------------------
 2 files changed, 15 insertions(+), 106 deletions(-)

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index cfca0f730c61..5d6b2466a2f2 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -37,6 +37,7 @@ config SND_SOC_APQ8016_SBC
	tristate "SoC Audio support for APQ8016 SBC platforms"
	depends on SND_SOC_QCOM
	select SND_SOC_LPASS_APQ8016
	select SND_SOC_QCOM_COMMON
	help
	  Support for Qualcomm Technologies LPASS audio block in
	  APQ8016 SOC-based systems.
diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c
index 2ef090f4af9e..083413abc2f6 100644
--- a/sound/soc/qcom/apq8016_sbc.c
+++ b/sound/soc/qcom/apq8016_sbc.c
@@ -16,13 +16,14 @@
#include <sound/soc.h>
#include <uapi/linux/input-event-codes.h>
#include <dt-bindings/sound/apq8016-lpass.h>
#include "common.h"

struct apq8016_sbc_data {
	struct snd_soc_card card;
	void __iomem *mic_iomux;
	void __iomem *spkr_iomux;
	struct snd_soc_jack jack;
	bool jack_setup;
	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
};

#define MIC_CTRL_TER_WS_SLAVE_SEL	BIT(21)
@@ -110,107 +111,13 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
	return 0;
}

static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
static void apq8016_sbc_add_ops(struct snd_soc_card *card)
{
	struct device *dev = card->dev;
	struct snd_soc_dai_link *link;
	struct device_node *np, *codec, *cpu, *node  = dev->of_node;
	struct apq8016_sbc_data *data;
	struct snd_soc_dai_link_component *dlc;
	int ret, num_links;

	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);
	}

	/* 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 = devm_kzalloc(dev,
			    struct_size(data, dai_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;

	for_each_child_of_node(node, np) {
		dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL);
		if (!dlc)
			return ERR_PTR(-ENOMEM);

		link->cpus	= &dlc[0];
		link->platforms	= &dlc[1];

		link->num_cpus		= 1;
		link->num_platforms	= 1;

		cpu = of_get_child_by_name(np, "cpu");
		codec = of_get_child_by_name(np, "codec");

		if (!cpu || !codec) {
			dev_err(dev, "Can't find cpu/codec DT node\n");
			ret = -EINVAL;
			goto error;
		}
	int i;

		link->cpus->of_node = of_parse_phandle(cpu, "sound-dai", 0);
		if (!link->cpus->of_node) {
			dev_err(card->dev, "error getting cpu phandle\n");
			ret = -EINVAL;
			goto error;
		}

		ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
		if (ret) {
			dev_err(card->dev, "error getting cpu dai name\n");
			goto error;
		}

		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 error;
		}

		link->platforms->of_node = link->cpus->of_node;
		ret = of_property_read_string(np, "link-name", &link->name);
		if (ret) {
			dev_err(card->dev, "error getting codec dai_link name\n");
			goto error;
		}

		link->stream_name = link->name;
	for_each_card_prelinks(card, i, link)
		link->init = apq8016_sbc_dai_init;
		link++;

		of_node_put(cpu);
		of_node_put(codec);
	}

	return data;

 error:
	of_node_put(np);
	of_node_put(cpu);
	of_node_put(codec);
	return ERR_PTR(ret);
}

static const struct snd_soc_dapm_widget apq8016_sbc_dapm_widgets[] = {
@@ -228,20 +135,20 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev)
	struct snd_soc_card *card;
	struct apq8016_sbc_data *data;
	struct resource *res;
	int ret;

	card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
	if (!card)
	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	card = &data->card;
	card->dev = dev;
	card->dapm_widgets = apq8016_sbc_dapm_widgets;
	card->num_dapm_widgets = ARRAY_SIZE(apq8016_sbc_dapm_widgets);
	data = apq8016_sbc_parse_of(card);
	if (IS_ERR(data)) {
		dev_err(&pdev->dev, "Error resolving dai links: %ld\n",
			PTR_ERR(data));
		return PTR_ERR(data);
	}

	ret = qcom_snd_parse_of(card);
	if (ret)
		return ret;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mic-iomux");
	data->mic_iomux = devm_ioremap_resource(dev, res);
@@ -255,6 +162,7 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev)

	snd_soc_card_set_drvdata(card, data);

	apq8016_sbc_add_ops(card);
	return devm_snd_soc_register_card(&pdev->dev, card);
}

-- 
2.27.0

[PATCH 7/7] ASoC: qcom: common: Avoid printing errors for -EPROBE_DEFER Export this patch

Stephan Gerhold
qcom_snd_parse_of() tends to produce lots of error messages during bootup:

	MultiMedia1: error getting cpu dai name

This happens because the DAIs are not probed until the ADSP remoteproc
has booted, which takes a while. Until it is ready, snd_soc_of_get_dai_name()
returns -EDEFER_PROBE to retry probing later. This is perfectly normal,
so cleanup the kernel log a bit by not printing in case of -EPROBE_DEFER.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/qcom/common.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 84dba0d69e6b..5194d90ddb96 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -88,7 +88,9 @@ int qcom_snd_parse_of(struct snd_soc_card *card)

		ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
		if (ret) {
			dev_err(card->dev, "%s: error getting cpu dai name\n", link->name);
			if (ret != -EPROBE_DEFER)
				dev_err(card->dev, "%s: error getting cpu dai name: %d\n",
					link->name, ret);
			goto err;
		}

@@ -108,7 +110,9 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
		if (codec) {
			ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
			if (ret < 0) {
				dev_err(card->dev, "%s: codec dai not found\n", link->name);
				if (ret != -EPROBE_DEFER)
					dev_err(card->dev, "%s: codec dai not found: %d\n",
						link->name, ret);
				goto err;
			}

-- 
2.27.0