Commit graph

74 commits

Author SHA1 Message Date
Astrid Rost
9b271207ac
ASoC: simple-card-utils: create jack inputs for aux_devs
Add a generic way to create jack inputs for auxiliary jack detection
drivers (e.g. via i2c, spi), which are not part of any real codec.
The simple-card can be used as combining card driver to add the jacks,
no new one is required.

Create a jack (for input-events) for jack devices in the auxiliary
device list (aux_devs). A device which returns a valid value on
get_jack_type counts as jack device; set_jack is required
to add the jack to the device.

Signed-off-by: Astrid Rost <astrid.rost@axis.com>
Link: https://lore.kernel.org/r/20230123135913.2720991-3-astrid.rost@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-27 12:20:55 +00:00
Kuninori Morimoto
5c065eaf44
ASoC: simple-card-utils: remove asoc_simple_convert_fixup()
No one is using asoc_simple_convert_fixup(), we don't need to
export its symbol. This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874jvj8ftp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-07 13:58:05 +00:00
Aidan MacDonald
32def55d23
ASoC: simple-card: Fix up checks for HW param fixups
The "convert-xxx" properties only have an effect for DPCM DAI links.
A DAI link is only created as DPCM if the device tree requires it;
part of this involves checking for the use of "convert-xxx" properties.

When the convert-sample-format property was added, the checks got out
of sync. A DAI link that specified only convert-sample-format but did
not pass any of the other DPCM checks would not go into DPCM mode and
the convert-sample-format property would be silently ignored.

Fix this by adding a function to do the "convert-xxx" property checks,
instead of open-coding it in simple-card and audio-graph-card. And add
"convert-sample-format" to the check function so that DAI links using
it will be initialized correctly.

Fixes: 047a05366f ("ASoC: simple-card-utils: Fixup DAI sample format")
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Acked-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20221019012302.633830-1-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:39:34 +01:00
Sameer Pujar
047a05366f
ASoC: simple-card-utils: Fixup DAI sample format
Parse "convert-sample-format" DT binding and fixup the sample format
as applicable. This is similar to the existing "convert-channels" and
"convert-rate" properties for channels and rate fixup respectively.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/1659936452-2254-4-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-15 01:19:55 +01:00
Kuninori Morimoto
6976ed0137
ASoC: audio-graph-card2.c: remove pre-alloced Codec2Codec space
Because Codec2Codec settings becomes optional, we don't need to keep
its parameter space when init time. This patch removes its default
memory allocation from simple-card-utils.c, and allocate it at
audio-graph-card2 ondemand.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87edz5s95o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-08 11:51:43 +01:00
Uwe Kleine-König
e6f08af634
ASoC: simple-card-utils: Make asoc_simple_clean_reference() return void
asoc_simple_clean_reference() returns zero unconditionally. Letting it
return void instead makes it easier to see in the caller that there is no
error to handle.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220605153537.26591-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-07 12:00:43 +01:00
Richard Fitzgerald
1e974e5b82
ASoC: audio_graph_card2: Add support for variable slot widths
Some audio hardware cannot support the same slot width for all sample
widths, or a slot width equal to the sample width for all sample widths.
This is usually due either to limitations of the audio serial port or
system clocking restrictions.
A typical example would be:

- 16-bit samples in 16-bit slots
- 24-bit samples in 32-bit slots

The new dai-tdm-slot-width-map property allows setting a mapping of
sample widths and the corresponding tdm slot widths and slot counts.
Although the slot count is usually the same for all cases this does
allow for adding padding slots to maintain the same bitclk frequency.

The property is added to each endpoint node that needs the component
DAI to be told the TDM slot width and count.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220228172754.453783-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:58 +00:00
Robert Hancock
5ca2ab4598
ASoC: simple-card-utils: Add new system-clock-fixed flag
Add a new system-clock-fixed flag, which can be used to specify that the
driver cannot or should not allow the clock frequency of the mapped clock
to be modified. This behavior is also implied if the system-clock-frequency
parameter is set explicitly - the flag is meant for cases where a clock is
mapped to the DAI but which is, or should be treated as, fixed.

When mclk-fs is also specified, this causes a PCM constraint to be added
which enforces that only the corresponding valid sample rate can be used.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Link: https://lore.kernel.org/r/20220120195832.1742271-7-robert.hancock@calian.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-24 19:45:43 +00:00
Kuninori Morimoto
52a18c2914
ASoC: simple-card-utils: add codec2codec support
codec2codec needs snd_soc_pcm_stream settings.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874k9mn8qy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:37 +01:00
Kuninori Morimoto
9293925245
ASoC: simple-card-utils: add asoc_graph_is_ports0()
audio-graph-card2 will support DPCM/Multi/Codec2Codec,
and these will use almost same DT settings which uses
ports0 and ports1.
This patch adds asoc_graph_is_ports0() which checks
port is under port0 or not.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yu2n8ra.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:36 +01:00
Sameer Pujar
7a226f2eab
ASoC: simple-card-utils: Increase maximum DAI links limit to 512
The current limit of 128 is not sufficient when more components are
added to the audio map on Tegra210 and later platforms. Thus it is
resulting in probe failure.

The requirement is of nearly ~200 DAI links. To give sufficient room
for future additions the maximum limit is increased to 512 DAI links.
This is a preparatory patch to add more components like resampler,
mixer, multiplexers, demultiplexers and volume controllers to Tegra210
and later platforms.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/1631551342-25469-3-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-20 13:31:28 +01:00
Kuninori Morimoto
f6fcc820e0
ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c
audio-graph-card2 can reuse  audio_graph_remove() / asoc_simple_remove().
This patch moves it to simple-card-utils.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2df3uby.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:45 +01:00
Kuninori Morimoto
1a456b1c6b
ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c
audio-graph-card2 can reuse audio_graph_card_probe().
This patch moves it to simple-card-utils.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgxv3uc4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:44 +01:00
Thierry Reding
343e55e718
ASoC: simple-card-utils: Increase maximum number of links to 128
On Tegra186 and later, the number of links can go up to 72, so bump the
maximum number of links to the next power of two (128).

Fixes: f2138aed23 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210416071147.2149109-2-thierry.reding@gmail.com
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 16:54:48 +01:00
Kuninori Morimoto
fcfd763bef
ASoC: simple-card-utils: tidyup asoc_simple_parse_convert()
dev is not used. This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eefgwf8j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:56 +01:00
Kuninori Morimoto
3919249e80
ASoC: simple-card-utils: tidyup dev_dbg() to use 1 line
We can use 100 char now for 1 line.
This patch tidyup unreadable dev_dbg() message.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fszwwf8o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:55 +01:00
Kuninori Morimoto
33cd6b191f
ASoC: simple-card-utils: tidyup debug info for clock
simple-card / audio-graph can use clock as dai->clk or dai->sysclk.
These related information should be indicated at same position.
This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7kcwf8t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:54 +01:00
Kuninori Morimoto
c826ec0391
ASoC: simple-card-utils: multi support at asoc_simple_canonicalize_cpu/platform()
Current asoc_simple_canonicalize_cpu/platform() is assuming single CPU,
single Platform, but we want to support Multi support.
This patch is prepare for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im4swf8y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:53 +01:00
Kuninori Morimoto
9830d3e99f
ASoC: simple-card-utils: add simple_props_to_xxx() macro
We shouldn't use dai_props->cpus/codecs/cpu_dai/codec_dai/codec_conf
directly, because these are array to supporting multi CPU/Codec/Platform.
This patch adds asoc_link_to_xxx() macro for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0p8wf9b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:52 +01:00
Kuninori Morimoto
40d8cbe70e
ASoC: simple-card-utils: indicate missing CPU/Codec numbers for debug
Now ALSA is supporting multi-CPU/Codec,
thus, we want to know number of CPU/Codec when debugging.
This patch indicates it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lf9owf9g.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:51 +01:00
Kuninori Morimoto
ac813c625a
ASoC: simple-card-utils: indicate dai_fmt if exist
link->dai_fmt might be 0.
Don't indicate it in such case when debugging.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mtu4wf9k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:50 +01:00
Kuninori Morimoto
e25704f84c
ASoC: simple-card-utils: remove asoc_simple_parse_xxx()
ASoC is now supporting multi DAI, but, current
simple-card / audio-graph are assuming fixed single DAI.

Now, asoc_simple_parse_xxx() macro is assuming single DAI.
To support multi-CPU/Codec, this patch unpack asoc_simple_parse_xxx()
macro, and uses "&dai_link->cpus[i]" instead of "dai_link->cpus".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pmz0wf9u.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:48 +01:00
Kuninori Morimoto
fafc05aadd
ASoC: simple-card-utils: use for_each_prop_xxx()
ASoC is now supporting multi DAI, but, current
simple-card / audio-graph are assuming fixed single DAI.

This patch uses for_each_prop_xxx() to support multi DAI.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1jgwf9y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:47 +01:00
Kuninori Morimoto
f899006d55
ASoC: simple-card-utils: remove li->dais/li->conf
li->dais is same as number of CPU + Codec,
li->conf is same as number of Codec when dummy-Codec.

li->dais/li->conf are no longer needed.
This patch removes these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg3wwfa3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13 12:32:46 +01:00
Kuninori Morimoto
205eb17edd
ASoC: simple-card-utils: share dummy DAI and reduce memory
Current simple-card / audio-graph creates 1xCPU + 1xCodec + 1xPlatform
for all dai_link, but some of them is not needed.
For example Platform is not needed for DPCM BE case.
Moreover, we can share snd-soc-dummy DAI for CPU-dummy / dummy-Codec
in DPCM.

This patch adds dummy DAI and share it when DPCM case,
I beliave it can contribute to reduce memory.

By this patch, CPU-dummy / dummy-CPU are set at asoc_simple_init_priv(),
thus, its settings are no longer needed at DPCM detecting timing
on simple-card / audio-graph.
Moreover, we can remove triky Platform settings code for DPCM BE,
because un-needed Platform is not created.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tuoqod22.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-08 15:18:03 +01:00
Kuninori Morimoto
f2138aed23
ASoC: simple-card-utils: enable flexible CPU/Codec/Platform
Current simple-card / audio-graph are assuming fixed
single-CPU/Codec/Platform.
This patch prepares multi-CPU/Codec/Platform support.

Note is that it is not yet full-multi-support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v996od2c.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-08 15:18:02 +01:00
Kuninori Morimoto
050c7950fd
ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform
simple-card / audio-graph are assuming single CPU/Codec/Platform on
dai_link. Because of it, it is difficult to support Multi-CPU/Codec.

This patch allocs CPU/Codec/Platform dai_link imformation
instead of using existing props information. It can update to
multi-CPU/Codec, but is still assuming single-CPU/Codec for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blb61tpv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-31 13:42:40 +01:00
Sameer Pujar
d09c774f2f
ASoC: audio-graph: Expose new members for asoc_simple_priv
Add new members in struct 'asoc_simple_priv'. Idea is to leverage
simple or graph card driver as much as possible and vendor can
maintain a thin driver to control the behavior by populating these
newly exposed members.

Following are the members added in 'asoc_simple_priv':

  - 'ops' struct: In some cases SoC vendor drivers may want to
    implement 'snd_soc_ops' callbacks differently. In such cases
    custom callbacks would be used.

  - 'force_dpcm' flag: Right now simple or graph card drivers
    detect DAI links as DPCM links if:

      * The dpcm_selectable is set AND
      * Codec is connected to multiple CPU endpoints or aconvert
        property is used for rate/channels.

    So there is no way to directly specify usage of DPCM alone. So a
    flag is exposed to mark all links as DPCM. Vendor driver can
    set this if required.

  - 'dpcm_selectable': Currently simple or audio graph drivers
    provide a way to enable this for specific compatibles. However
    vendor driver may want to define some additional info. Thus
    expose this variable where vendor drivers can set this if
    required.

Audio graph driver is updated to consider above flags or callbacks.
Subsequent patches in the series illustrate usage for above.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/1604329814-24779-7-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-10 17:28:22 +00:00
Shengjiu Wang
764aafdb98
ASoC: simple-card-utils: Support configure pin_name for asoc_simple_init_jack
Currently the pin_name is fixed in asoc_simple_init_jack, but some driver
may use a different pin_name. So add a new parameter in
asoc_simple_init_jack for configuring pin_name.

If this parameter is NULL, then the default pin_name is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1594822179-1849-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-16 23:24:12 +01:00
Mark Brown
992fd39a34
Merge branch 'for-5.4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.5 2019-11-06 16:29:34 +00:00
Daniel Baluta
4bbee14d8e
ASoC: simple_card_utils.h: Add missing include
When debug is enabled compiler cannot find the definition of
clk_get_rate resulting in the following error:

./include/sound/simple_card_utils.h:168:40: note: previous implicit
declaration of ‘clk_get_rate’ was here
   dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));
./include/sound/simple_card_utils.h:168:3: note: in expansion of macro
‘dev_dbg’
   dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));

Fix this by including the appropriate header.

Fixes: 0580dde594 ("ASoC: simple-card-utils: add asoc_simple_debug_info()")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20191009153615.32105-2-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-09 18:14:50 +01:00
Daniel Baluta
af6219590b
ASoC: simple_card_utils.h: Fix potential multiple redefinition error
asoc_simple_debug_info and asoc_simple_debug_dai must be static
otherwise we might a compilation error if the compiler decides
not to inline the given function.

Fixes: 0580dde594 ("ASoC: simple-card-utils: add asoc_simple_debug_info()")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20191009153615.32105-3-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-09 18:02:34 +01:00
Kuninori Morimoto
52db668593
ASoC: simple_card_utils.h: care NULL dai at asoc_simple_debug_dai()
props->xxx_dai might be NULL when DPCM.
This patch cares it for debug.

Fixes: commit 0580dde594 ("ASoC: simple-card-utils: add asoc_simple_debug_info()")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o922gw4u.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-10 16:25:29 +01:00
Kuninori Morimoto
f107294c64
ASoC: simple-card: support snd_soc_dai_link_component style for cpu
ASoC supports modern style dai_link (= snd_soc_dai_link_component) for
CPU. legacy style dai_link (= cpu_dai_name, cpu_name, cpu_of_node) are
no longer needed.
This patch switches to modern style.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-06 21:22:17 +01:00
Paul Cercueil
90194281ee
ASoC: simple-card-utils: add asoc_simple_parse_pin_switches()
This function is a helper that permits to create pin switch controls for
a list of widgets whose names are listed in the PREFIX "pin-switches"
devicetree property.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-26 10:50:02 +01:00
Kuninori Morimoto
ad11e59f52
ASoC: simple-card-utils: rename asoc_simple_card_xxx() to asoc_simple_()
Current simple-card-utils is using asoc_simple_card_xxx() for each
function naming, but it is very verbose.
Thus it is easy to be over 80 char.
This patch renames it to asoc_simple_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:52:51 +00:00
Kuninori Morimoto
8f7f298a33
ASoC: simple-card-utils: separate asoc_simple_card_parse_dai()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph are using
asoc_simple_card_parse_dai() which is different implementation.
But, these are implemanted at simple-card-utils.
It should be implemanted at each files.
This patch separate these into each files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:52:37 +00:00
Kuninori Morimoto
65a5056b21
ASoC: simple-card-utils: share asoc_simple_card_init_priv()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph are initializing each priv,
but it is same operation.
This patch adds new asoc_simple_card_init_priv() and initialize
priv by same operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:52:24 +00:00
Kuninori Morimoto
629f75440a
ASoC: simple-card-utils: share asoc_simple_be_hw_params_fixup()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_be_hw_params_fixup() between in these
2 drivers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:52:11 +00:00
Kuninori Morimoto
ad934ca801
ASoC: simple-card-utils: share asoc_simple_dai_init()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_dai_init() between in these 2 drivers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:51:57 +00:00
Kuninori Morimoto
f48dcbb6d4
ASoC: simple-card-utils: share asoc_simple_hw_param()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_hw_param() between in these 2 drivers.

One note is that only simple-card supports simple_set_clk_rate()
at hw_param from commit e9be4ffd4f ("ASoC: simple-card: set cpu
dai clk in hw_params").
By this patch, audio-graph has same feature.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:51:43 +00:00
Kuninori Morimoto
686911b46f
ASoC: simple-card-utils: share asoc_simple_shutdown()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_shutdown() between in these 2 drivers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:51:30 +00:00
Kuninori Morimoto
f38df5bf0c
ASoC: simple-card-utils: share asoc_simple_startup()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_startup() between in these 2 drivers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:51:16 +00:00
Kuninori Morimoto
e59289cda8
ASoC: simple_card_utils: share common priv for simple-card/audio-graph
Historically, simple-card/simple-scu-card/audio-graph/audio-graph-scu
are similar but different generic sound card.
simple-scu-card which was for DPCM was merged into simple-card, and
audio-graph-scu which was for DPCM was merged into audio-graph.
simple-card is for non OF graph sound card, and
audio-graph is for     OF graph sound card.
And, small detail difference (= function parameter, naming, etc)
between simple-card/audio-graph has been unified.

So today, the difference between simple-card/audio-graph are
just using OF graph style, or not.
In other words, there should no difference other than OF graph sytle.
simple-card/audio-graph are using own priv today , but we can merge it.
This patch merge it at simple_card_utils.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:51:03 +00:00
Kuninori Morimoto
0580dde594
ASoC: simple-card-utils: add asoc_simple_debug_info()
Current simple-card-utils has dev_dbg(), but people want to
add #define DEBUG at simple-card/audio-graph, not simple-card-utils.
And, people want to get all information.
This patch adds new asoc_simple_debug_info() to indicates information.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21 14:50:50 +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
33404f3f10
ASoC: simple_card_utils: remove "option" from asoc_simple_card_of_parse_routing()
asoc_simple_card_of_parse_routing() had "option" parameter
to consider error handling, but it is very pointless parameter.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-21 13:28:49 +00:00
Kuninori Morimoto
a48bf02b35
ASoC: simple-card-utils: tidyup asoc_simple_card_parse_convert()
Current simple-card-utils has asoc_simple_card_parse_convert() to parse
convert channel/rate for be_hw_params_fixup.
But, it is parsing from top of node.

If sound card had multi subnode, we need to parse it from each sub node.
This patch tidyup asoc_simple_card_parse_convert() to allow parsing
settings from each node.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-21 13:28:34 +00:00
Kuninori Morimoto
868cdb4690
ASoC: simple-card-util: support snd_soc_dai_link_component style for platform
Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card-util for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-31 15:58:43 +01:00