Commit Graph

293 Commits

Author SHA1 Message Date
Kuninori Morimoto 42bf029a55
ASoC: simple-card: don't select DPCM via simple-audio-card
commit da215354eb ("ASoC: simple-card: merge simple-scu-card")
merged simple-scu-audio-card which can handle DPCM into
simple-audio-card.

By this patch, the judgement to select "normal sound card" or
"DPCM sound card" is based on its CPU/Codec DAI count.
But, because of it, existing "simple-audio-card" user who is
assuming "normal sound card" might select DPCM unintentionally.

To solve this issue, this patch allows "simple-audio-card" user
can select "normal sound card", and "simple-scu-audio-card" user
can select both "normal sound card" and "DPCM sound card".
This keeps compatibility collectry.

Fixes: da215354eb ("ASoC: simple-card: merge simple-scu-card")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04 14:59:09 +07:00
Kuninori Morimoto c2c616021d
ASoC: audio-graph-card: don't select DPCM via audio-graph-card
commit ae3cb57909 ("ASoC: audio-graph-card: merge
audio-graph-scu-card") merged audio-graph-scu-card which can
handle DPCM into audio-graph-card.

By this patch, the judgement to select "normal sound card" or
"DPCM sound card" is based on its OF-graph endpoint connection.
But, because of it, existing "audio-graph-card" user who is
assuming "normal sound card" might select DPCM unintentionally.

To solve this issue, this patch allows "audio-graph-card" user
can select "normal sound card", and "audio-graph-scu-card" user
can select both "normal sound card" and "DPCM sound card".
This keeps compatibility collectry.

Fixes: ae3cb57909 ("ASoC: audio-graph-card: merge audio-graph-scu-card")
Reported-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04 14:58:31 +07:00
Takashi Iwai 0b9c9ed6dd
ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser
The function simple_for_each_link() has a few missing places that
forgot unrefereing of-nodes after the use.  The main do-while loop
may abort when loop=0, and this leaves the node object still
referenced.  A similar leak is found in the error handling of NULL
codec that aborts the loop as well.  Last but not least, the inner
for_each_child_of_node() loop may abort in the middle, and this leaks
the refcount of the iterator node.

This patch addresses these missing refcount issues.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-20 12:12:37 +00:00
Takashi Iwai 44662f90cd
ASoC: simple-card: Fix missing of_node_put() at simple_dai_link_of()
We forgot to unreference the platform node object obtained from
of_get_child_by_name().  This leads to the unbalance of node
refcount.

Fixes: e0ae225b7e ("ASoC: simple-card: support platform in dts parse")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-20 12:12:33 +00:00
Daniel Baluta 461d854c0d
ASoC: simple-card: Fix refcount underflow
of_get_child_by_name() takes a reference we'll need to drop
later so when we substitute in top we need to take a reference
as well as just assigning.

Without this patch we hit the following error:

[    1.246852] OF: ERROR: Bad of_node_put() on /sound-wm8524
[    1.262261] Hardware name: NXP i.MX8MQ EVK (DT)
[    1.266807] Workqueue: events deferred_probe_work_func
[    1.271950] Call trace:
[    1.274406]  dump_backtrace+0x0/0x158
[    1.278074]  show_stack+0x14/0x20
[    1.281396]  dump_stack+0xa8/0xcc
[    1.284717]  of_node_release+0xb0/0xc8
[    1.288474]  kobject_put+0x74/0xf0
[    1.291879]  of_node_put+0x14/0x28
[    1.295286]  __of_get_next_child+0x44/0x70
[    1.299387]  of_get_next_child+0x3c/0x60
[    1.303315]  simple_for_each_link+0x1dc/0x230
[    1.307676]  simple_probe+0x80/0x540
[    1.311256]  platform_drv_probe+0x50/0xa0

This patch is based on an earlier version posted by Kuninori Morimoto
and commit message includes explanations from Mark Brown.

https://patchwork.kernel.org/patch/10814255/

Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-18 18:24:28 +00:00
Kuninori Morimoto fe7ed4dec2
ASoC: simple-card: rename to asoc_simple_card_canonicalize_platform()
Current simple-card is using asoc_simple_card_canonicalize_dailink().
Its naming is "dailink", but is for "platform".
We already have asoc_simple_card_canonicalize_cpu() for "cpu",
let's follow same naming rule.
It never return error, so, void function is better idea.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-21 18:14:16 +00:00
Kuninori Morimoto 910fdcabed
ASoC: soc-core: add .num_platform for dai_link
Current snd_soc_dai_link is starting to use snd_soc_dai_link_component
(= modern) style for Platform, but it is still assuming single Platform
so far. We will need to have multi Platform support in the not far
future.

Currently only simple card is using it as sound card driver,
and other drivers are converted to it from legacy style by
snd_soc_init_platform().
To avoid future problem of multi Platform support, let's add
num_platforms before it is too late.

In the same time, to make it same naming mothed, "platform" should
be "platforms". This patch fixup it too.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-21 18:12:19 +00:00
Kuninori Morimoto 2d01a84605
ASoC: simple-card: reduce naming prefix
Current simple-card is using asoc_simple_card_xxx() for
function / data naming. Because of this long prefix, it is easy to be
80 character over.
Let's reduce prefix from asoc_simple_card_xxx() to simple_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:32 +00:00
Kuninori Morimoto c39291a764
ASoC: simple-card: cleanup DAI link loop method - step2
Current simple-card is parsing DAI link for both "normal sound" and
"DPCM sound". On this driver, it needs to count and parse
DAIs/Links/Codec Conf from each links.
Then, counting/parsing link loop are very similar, but using different
implementation. Because of this background, the link loop code is very
mysterious. Mystery code will be trouble in the future.

This patch cleanups the code by using asoc_simple_card_for_each_link()
which judges normal link / DPCM link.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:31 +00:00
Kuninori Morimoto d947cdfd4b
ASoC: simple-card: cleanup DAI link loop method - step1
Current simple-card is parsing DAI link for both "normal sound" and
"DPCM sound". On this driver, it needs to count and parse
DAIs/Links/Codec Conf from each links.
Then, counting/parsing link loop are very similar, but using different
implementation. Because of this background, the link loop code is very
mysterious. Mystery code will be trouble in the future.

This patch adds/modifies counting and parsing function for
"normal sound" and "DPCM sound", and call it from link loop.
This is prepare for cleanup DAI link loop method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:30 +00:00
Kuninori Morimoto 17029e494e
ASoC: simple-card: add link_info
Current simple-card is parsing DAI link for both "normal sound" and
"DPCM sound". On this driver, it needs to count and parse
DAIs/Links/Codec Conf from each links.
Then, counting/parsing link loop are very similar, but using different
implementation. Because of this background, the link loop code is very
mysterious. Mystery code will be trouble in the future.

To preparing cleanup code, this patch adds link_info which handles
number of DAIs/Links/Codec Conf, and CPU/Codec turn.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:29 +00:00
Kuninori Morimoto 7adee60ee2
ASoC: simple-card: add 1 CPU : 1 Codec support again
simple-card is now supporting normal sound and DPCM sound.
For DPCM sound, original sound card (= simple-scu-card) had been
supported 1 CPU : 1 Codec connection which uses hw_params_fixup()
for convert-rate/channel.
But, merged simple-card is completely forgeting about it.

This patch re-support it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:28 +00:00
Kuninori Morimoto 7e5e1f8bba
ASoC: simple-card: add asoc_simple_card_get_conversion()
simple-card is now supporting normal sound and DPCM sound.
For DPCM sound, original sound card (= simple-scu-card) had been
supported 1 CPU : 1 Codec connection which uses hw_params_fixup()
for convert-rate/channel.
But, merged simple-card is completely forgeting about it.

To re-support 1 CPU : 1 Codec DPCM for hw_params_fixup(),
it need to judge whether it is DPCM by checking convert-rate/channel.
For this purpose, this patch adds asoc_simple_card_get_conversion()
as preparation

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:27 +00:00
Kuninori Morimoto 97fe6ca414
ASoC: audio-graph-card: reduce naming prefix
Current audio-graph-card is using asoc_graph_card_xxx() for
function / data naming. Because of this long prefix, it is easy to be
80 character over.
Let's reduce prefix from asoc_graph_card_xxx() to graph_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:26 +00:00
Kuninori Morimoto fce9b90c1a
ASoC: audio-graph-card: cleanup DAI link loop method - step2
Current audio-graph-card is parsing DAI link for both "normal sound" and
"DPCM sound". On this driver, it needs to count and parse
DAIs/Links/Codec Conf from each links.
Then, counting/parsing link loop are very similar, but using different
implementation. Because of this background, the link loop code is very
mysterious. Mystery code will be trouble in the future.

This patch cleanups the code by using asoc_graph_card_for_each_link()
which judges normal link / DPCM link.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:25 +00:00
Kuninori Morimoto dd98fbc558
ASoC: audio-graph-card: cleanup DAI link loop method - step1
Current audio-graph-card is parsing DAI link for both "normal sound" and
"DPCM sound". On this driver, it needs to count and parse
DAIs/Links/Codec Conf from each links.
Then, counting/parsing link loop are very similar, but using different
implementation. Because of this background, the link loop code is very
mysterious. Mystery code will be trouble in the future.

This patch adds/modifies counting and parsing function for
"normal sound" and "DPCM sound", and call it from link loop.
This is prepare for cleanup DAI link loop method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:24 +00:00
Kuninori Morimoto 1e4771a62f
ASoC: audio-graph-card: add link_info
Current audio-graph-card is parsing DAI link for both "normal sound" and
"DPCM sound". On this driver, it needs to count and parse
DAIs/Links/Codec Conf from each links.
Then, counting/parsing link loop are very similar, but using different
implementation. Because of this background, the link loop code is very
mysterious. Mystery code will be trouble in the future.

To preparing cleanup code, this patch adds link_info which handles
number of DAIs/Links/Codec Conf, and CPU/Codec turn.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:23 +00:00
Kuninori Morimoto de2949fe26
ASoC: audio-graph-card: add 1 CPU : 1 Codec support again
audio-graph-card is now supporting normal sound and DPCM sound.
For DPCM sound, original sound card (= audio-graph-scu) had been
supported 1 CPU : 1 Codec connection which uses hw_params_fixup()
for convert-rate/channel.
But, merged audio-graph-card is completely forgeting about it.

This patch re-support it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:23 +00:00
Kuninori Morimoto c8ed6aca6b
ASoC: simple-scu-card: remove simple-scu-card
It is already merged into simple-card.
simple-scu-card is no longer needed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:19 +00:00
Kuninori Morimoto 61c263ac27
ASoC: audio-graph-scu-card: remove audio-graph-scu-card
It is already merged into audio-graph-card.
audio-graph-scu-card is no longer needed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:17 +00:00
Kuninori Morimoto 40dfae169a
ASoC: audio-graph-card: add asoc_graph_card_get_conversion()
audio-graph-card is now supporting normal sound and DPCM sound.
For DPCM sound, original sound card (= audio-graph-scu) had been
supported 1 CPU : 1 Codec connection which uses hw_params_fixup()
for convert-rate/channel.
But, merged audio-graph-card is completely forgeting about it.

To re-support 1 CPU : 1 Codec DPCM for hw_params_fixup(),
it need to judge whether it is DPCM by checking convert-rate/channel.
For this purpose, this patch adds asoc_graph_card_get_conversion()
as preparation

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:15 +00:00
Kuninori Morimoto a0c426fe14
ASoC: simple-card-utils: check "reg" property on asoc_simple_card_get_dai_id()
We will get DAI ID from "reg" property if it has on DT, otherwise get
it by counting port/endpoint.

But in below case, we need to get DAI ID = 0 via port reg = <0>, but
current implementation returns ID = 1, because it can't judge ID = 0 was
from "non reg" or "reg = <0>".
Thus, it will count port/endpoint number as "non reg" case.

of_graph_parse_endpoint() implementation itself is not a problem,
but because asoc_simple_card_get_dai_id() need to count port/endpoint
number when "non reg" case, it need to know ID = 0 was from
"non reg" or "reg = <0>".
This patch fix this issue.

	port {
		reg = <0>;
		xxxx: endpoint@0 {
		};
=>		xxxx: endpoint@1 {
		};
	};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-03 16:34:14 +00:00
Kuninori Morimoto cfc652a733
ASoC: simple-card: tidyup prefix for snd_soc_codec_conf
Current simple-card is handling "prefix" by many ways.
But, it is not useful and readable.
We want to do is that allow having it everywere.
This patch supports it.
It will be overwrote if lower node has it.

sound {
	simple-audio-card,prefix = "xxx"; // initial

	simple-audio-card,dai-link {
		prefix = "xxx"; // overwrite
		cpu {
			...
		};
		codec {
			prefix = "xxx"; // overwrite
		};
	};
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:48:57 +00:00
Kuninori Morimoto dd82410f7e
ASoC: simple-card: tidyup convert_rate/channel method
Current simple-card is handling "convert_rate/channel"
by many ways. But, it is not useful and readable.
We want to do is that allow having it everywere.
This patch support it.
It will be overwrote if lower node has it.

sound {
	simple-audio-card,convert_channels = <xxx>; // initial

	simple-audio-card,dai-link {
		convert_channels = <xxx>; // overwrite
		cpu {
			convert_channels = <xxx>; // overwrite
		};
		codec {
			convert_channels = <xxx>; // overwrite
		};
	};
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:48:42 +00:00
Kuninori Morimoto 79e834914d
ASoC: simple-card: tidyup mclk-fs method
Current simple-card is handling "mclk-fs" by many way.
But, it is not useful and readable.
We want to do is that allow having mclk-fs everywere.
This patch support it.
It will be overwrote if lower node has it.

sound {
	simple-audio-card,mclk-fs = <xxx>; // for initial

	simple-audio-card,dai-link {
		mclk-fs = <xxx>; // overwrite
		cpu {
			mclk-fs = <xxx>; // overwrite
		};
		codec {
			mclk-fs = <xxx>; // overwrite
		};
	};
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:48:27 +00:00
Kuninori Morimoto da215354eb
ASoC: simple-card: merge simple-scu-card
simple-card and simple-scu-card are very similar driver,
but the former is supporting normal sound card,
the latter is supporting DPCM sound card.

We couldn't use normal sound and DPCM sound in same time by
one sound card. This patch merges both sound card into
simple-card. Now we can use both feature on same driver.

simple-card is now supporting .compatible = "simple-scu-audio-card".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:48:12 +00:00
Kuninori Morimoto 66164a4da3
ASoC: audio-graph-card: tidyup prefix for snd_soc_codec_conf
Current audio-graph-card is handling "prefix" by many ways.
But, it is not useful and readable.
We want to do is that allow having it everywere.
This patch supports it.
It will be overwrote if lower node has it.

	sound {
		prefix = "xxx"; // initial
	};

	codec {
		audio-graph-card,prefix = "xxx"; // overwrite
		ports {
			prefix = "xxx"; // overwrite
			port {
				prefix = "xxx"; // overwrite
			};
		};
	};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:47:49 +00:00
Kuninori Morimoto 7ced65ffb8
ASoC: audio-graph-card: tidyup convert_rate/channel method
Current audio-graph-card is handling "convert_rate/channel"
by many ways. But, it is not useful and readable.
We want to do is that allow having it everywere.
This patch support it.
It will be overwrote if lower node has it.

sound {
	convert-channels = <xxx>; // initial
};

codec {
	audio-graph-card,convert-channels = <xxx>; // overwrite
	ports {
		convert_channels = <xxx>; // overwrite
		port {
			convert_channels = <xxx>; // overwrite
			endpoint {
				convert_channels = <xxx>; // overwrite
			};
		};
	};
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:47:34 +00:00
Kuninori Morimoto 56eb818191
ASoC: audio-graph-card: tidyup mclk-fs method
Current audio-graph-card is handling "mclk-fs" by many way.
But, it is not useful and readable.
We want to do is that allow having mclk-fs everywere.
This patch support it.
It will be overwrote if lower node has it.

sound {
	mclk-fs = <xxx>; // initial
};

codec {
	ports {
		mclk-fs = <xxx>; // overwrite
		port {
			mclk-fs = <xxx>; // overwrite
			endpoint {
				mclk-fs = <xxx>; // overwrite
			};
		};
	};
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:47:19 +00:00
Kuninori Morimoto ae3cb57909
ASoC: audio-graph-card: merge audio-graph-scu-card
audio-graph-card and audio-graph-scu-card are very similar driver,
but the former is supporting normal sound card,
the latter is supporting DPCM sound card.

We couldn't use normal sound and DPCM sound in same sound card by
audio-graph-card.
This patch merges both sound card into it.
Now we can use both feature on same driver.

audio-grap-card is now supporting .compatible = "audio-graph-scu-card".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:47:04 +00:00
Kuninori Morimoto b8b89f5ee0
ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() ID method
commit b6f3fc005a ("ASoC: simple-card-utils: fixup
asoc_simple_card_get_dai_id() counting") fixuped getting DAI ID method.
It will get DAI ID from OF graph "port", but, we want to consider about
"endpoint", too.
And, we also want to keep compatibility.

This patch fixup it as

	if (driver has specified DAI ID)
		use it as DAI ID
	else if (OF graph endpoint has reg)
		use it as DAI ID
	else if (OF graph port has reg)
		use it as DAI ID
	else
		use endpoint count as DAI ID

Fixes: commit b6f3fc005a ("ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting")
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 11:44:34 +00:00
Nathan Chancellor 869858f84a
ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simple_card_probe
Commit 4fb7f4df49 ("ASoC: simple-card: use cpu/codec pointer on
simple_dai_props") updated {cpu,codec}_dai to be pointers in struct
simple_dai_props but didn't update these locations to dereference the
pointers.
This patch fixup it for non DT simple-card use case.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-13 11:16:46 +00:00
Kuninori Morimoto 0a26d6df4f
ASoC: simple-scu-card: care multi DPCM codec_conf
Current simple-scu-card didn't care about codec_conf
for multi DPCM case. This patch cares it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 12:19:12 +00:00
Kuninori Morimoto e6a3ff2ed4
ASoC: simple-scu-card: use cpu/codec pointer on graph_dai_props
In  DPCM case, it uses CPU-dummy / dummy-Codec dai links, and
non DPCM case, it uses CPU-Codec dai links.

Now, we want to merge simple-card and simple-scu-card.

These sound cards are using silimar but not same logic on each functions.
Then, of course we want to share same logic.
To compromise, this patch uses cpu/codec pointer on simple-scu-card.
It is same logic with simple-card, thus easy merging.
This is prepare for merging simple card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 12:18:57 +00:00
Kuninori Morimoto 09ee833679
ASoC: simple-scu-card: tidyup "convert-rate/channels" parsing
simple-scu-card.c is supporting "convert-rate/channels" which is
used for DPCM.
But, sound card might have multi codecs, and each codec might need
each convert-rate/channels.

This patch supports each codec's convert-rate/channles support.
top node convert-rate/channels will overwrite settings if exist.

It can't support each codec's convert-rate/channels if sound card had
multi codecs without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 12:18:42 +00:00
Kuninori Morimoto b8d8f9a58f
ASoC: simple-scu-card: care link / dai count
In DPCM case, it uses CPU-dummy / dummy-Codec dai links.
If sound card is caring only DPCM, link count = dai count,
but, if non DPCM case, link count != dai count.
Now, we want to merge simple-card and simple-scu-card,
then, we need to care both link / dai count more carefly
This patch cares it, and prepare for merging simple card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 12:18:26 +00:00
Kuninori Morimoto da32d65378
ASoC: simple-scu-card: add dai-link support
simple-card is supporting dai-link support, but simple-scu-card
doesn't have it.
This patch support it. This is prepare for merging simple-card
and simple-scu-card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 12:17:39 +00:00
Kuninori Morimoto dbd08fe59c
ASoC: simple-scu-card: tidyup asoc_simple_card_parse_daifmt() timing
Current simple-scu-card driver is parsing codec position for DPCM
and consider DAI format. But, current operation is doing totally pointless,
because it should be called for each CPU/Codec pair.
Let's tidyup asoc_simple_card_parse_daifmt() timing.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 01:10:54 +00:00
Kuninori Morimoto 4fb7f4df49
ASoC: simple-card: use cpu/codec pointer on simple_dai_props
In  DPCM case, it uses CPU-dummy / dummy-Codec dai links, and
non DPCM case, it uses CPU-Codec dai links.

Now, we want to merge simple-card and simple-scu-card.

These sound cards are using silimar but not same logic on each functions.
Then, of course we want to share same logic.
To compromise, this patch uses cpu/codec pointer on simple-card.
It is same logic with simple-scu-card, thus easy merging.
This is prepare for merging audio card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 01:10:39 +00:00
Arnd Bergmann 2b320e0464
ASoC: simple-card-utils: fix build warning without CONFIG_OF
When CONFIG_OF is disabled, of_graph_parse_endpoint() does not
initialize 'info', and gcc can see that:

sound/soc/generic/simple-card-utils.c: In function 'asoc_simple_card_parse_graph_dai':
sound/soc/generic/simple-card-utils.c:284:13: error: 'info.port' may be used uninitialized in this function [-Werror=maybe-uninitialized]

It's probably best to check the return code anyway, and that also
takes care of the warning.

Fixes: b6f3fc005a ("ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-11 01:08:51 +00:00
Rob Herring 1d52a74ea2
ASoC: Use of_node_name_eq for node name comparisons
Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For the FSL ASoC card, the full node names appear to be "ssi", "esai",
and "sai", so there's not any reason to use strstr and of_node_name_eq
can be used instead.

Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-06 12:56:39 +00:00
Kuninori Morimoto 0e3460bcee
ASoC: audio-graph-card: use cpu/codec pointer on graph_dai_props
In  DPCM case, it uses CPU-dummy / dummy-Codec dai links, and
non DPCM case, it uses CPU-Codec dai links.

Now, we want to merge audio-graph-card and audio-graph-scu-card.

These sound cards are using silimar but not same logic on each functions.
Then, of course we want to share same logic.
To compromise, this patch uses cpu/codec pointer on audio-graph-card.
It is same logic with audio-graph-scu-card, thus easy merging.
This is prepare for merging audio card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-04 16:29:34 +00:00
Kuninori Morimoto 7c2ae7981d
ASoC: audio-graph-scu-card: care multi DPCM codec_conf
Current audio-graph-scu-card didn't care about codec_conf
for multi DPCM case. This patch cares it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-04 16:29:19 +00:00
Kuninori Morimoto a1af9858ed
ASoC: audio-graph-scu-card: use cpu/codec pointer on graph_dai_props
In  DPCM case, it uses CPU-dummy / dummy-Codec dai links, and
non DPCM case, it uses CPU-Codec dai links.

Now, we want to merge audio-graph-card and audio-graph-scu-card.

These sound cards are using silimar but not same logic on each functions.
Then, of course we want to share same logic.
To compromise, this patch uses cpu/codec pointer on audio-graph-scu-card.
It is same logic with audio-graph-card, thus easy merging.
This is prepare for merging audio card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-04 16:29:04 +00:00
Kuninori Morimoto c89ff03ac8
ASoC: audio-graph-scu-card: care link / dai count
In DPCM case, it uses CPU-dummy / dummy-Codec dai links.
If sound card is caring only DPCM, link count = dai count,
but, if non DPCM case, link count != dai count.
Now, we want to merge audio-graph-card and audio-graph-scu-card,
then, we need to care both link / dai count more carefly
This patch cares it, and prepare for merging audio card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-04 16:28:49 +00:00
Kuninori Morimoto b6f3fc005a
ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting
asoc_simple_card_get_dai_id() returns DAI ID, but it is based on
DT node's "endpoint" position.
Almost all cases 1 port has 1 endpoint, thus, it was no problem.
But in reality, port : endpoint = 1 : N, thus, counting endpoint
is BUG, it should based on "port" ID.
This patch fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-04 16:28:03 +00:00
Kuninori Morimoto 64ef0817b9
ASoC: audio-graph-card: tidyup define position
commit f986907c92 ("ASoC: audio-graph-card: add widgets and routing for
external amplifier support") added new function
asoc_graph_card_outdrv_event(), but the inserted position breaks
define area. This patch tidyup it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-23 14:01:56 +00:00
Kuninori Morimoto c3830f1a00
ASoC: audio-graph-card: tidyup typo SND_AUDIO_GRAPH_CARD
1 "simple" is enough on Kconfig help

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-23 14:01:55 +00:00
Kuninori Morimoto 338d7159c4
ASoC: audio-graph-scu-card: tidyup asoc_simple_card_parse_daifmt() timing
Current audio-graph-scu-card driver is parsing codec position for DPCM
and consider DAI format. But, current operation is doing totally pointless,
because 1) asoc_simple_card_parse_daifmt() will be called not only for 1st
codec on current implementation, and it will be used as fixed format
2) it should be called for each CPU/Codec pair.
Let's tidyup asoc_simple_card_parse_daifmt() timing.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-23 14:01:54 +00:00
Kuninori Morimoto 7f07a39acf
ASoC: audio-graph-scu-card: tidyup "convert-rate/channels" parsing
audio-graph-scu-card.c is supporting "convert-rate/channels" which is
used for DPCM.
But, sound card might have multi codecs, and each codec might need
each convert-rate/channels.

This patch supports each codec's convert-rate/channles support.
top node convert-rate/channels will overwrite settings if exist.

It can't support each codec's convert-rate/channels if sound card had
multi codecs without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-23 14:01:53 +00:00