Skip to content

Commit

Permalink
ASoC: qcom: common: Respect status = "disabled" on DAI link nodes
Browse files Browse the repository at this point in the history
At the moment, the DAI link nodes in the device tree always have to be
specified completely in each device tree. However, the available
interfaces (e.g. Primary/Secondary/Tertiary/Quaternary MI2S) are common
for all devices of a SoC, so the majority of the definitions can be
placed in a common device tree include to reduce boilerplate.

Make it possible to define such stubs in device tree includes by
respecting the "status" property for the DAI link nodes. This is
a trivial change that just requires switching to the _available_
OF functions that check the "status" property additionally.

This allows defining a stub like:

	sound_dai_quaternary: dai-link-quaternary {
		link-name = "Quaternary MI2S";
		status = "disabled"; /* Needs extra codec configuration */
		cpu {
			sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
		};
		platform {
			sound-dai = <&q6routing>;
		};
	};

where the codec would be filled in by the device-specific device tree.

For existing device trees this change does not make any difference.
A missing "status" property is treated like status = "okay".

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211025105503.49444-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Stephan Gerhold authored and Mark Brown committed Oct 25, 2021
1 parent de6e919 commit 4b29d5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/qcom/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
return ret;

/* Populate links */
num_links = of_get_child_count(dev->of_node);
num_links = of_get_available_child_count(dev->of_node);

/* Allocate the DAI link array */
card->dai_link = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL);
Expand All @@ -54,7 +54,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
card->num_links = num_links;
link = card->dai_link;

for_each_child_of_node(dev->of_node, np) {
for_each_available_child_of_node(dev->of_node, np) {
dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL);
if (!dlc) {
ret = -ENOMEM;
Expand Down

0 comments on commit 4b29d5a

Please sign in to comment.