History log of /linux-master/sound/soc/generic/simple-card-utils.c
Revision Date Author Comments
# 4504f633 14-Dec-2023 Linus Walleij <linus.walleij@linaro.org>

ASoC: simple-card-utils: Drop GPIO include

The generic card utilities are including the legacy GPIO header
<linux/gpio.h> but not using any symbols from it. Drop the
include from all files.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://msgid.link/r/20231214-gpio-descriptors-sound-misc-v1-3-e3004176bd8b@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# d29351e8 28-Nov-2023 Daniel Baluta <daniel.baluta@nxp.com>

ASoC: audio-graph-card2: Introduce playback-only/capture-only DAI link flags

We need this to support MICFIL PDM found on i.MX8MP where the DAI link
supports only capture direction.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://msgid.link/r/20231128081119.106360-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 393df6f3 13-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ASoC: simple-card-utils: Make simple_util_remove() return void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

simple_util_remove() returned zero unconditionally. Make it return void
instead and convert all users to struct platform_device::remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20231013221945.1489203-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# b4b7de99 11-Sep-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: generic: convert not to use asoc_xxx()

ASoC is now unified asoc_xxx() into snd_soc_xxx().
This patch convert asoc_xxx() to snd_soc_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h6o0qnho.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b5a95c5b 11-Sep-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils.h: convert not to use asoc_xxx()

ASoC is using 2 type of prefix (asoc_xxx() vs snd_soc_xxx()),
but these are unified into snd_soc_xxx().

simple_card / audio_graph drivers are historically using
asoc_xxx() prefix too. simple_card / audio_graph are not
ASoC framework, so let's use simple_card_xxx_() / audio_graph_xxx()
for global function prefix.

This patch has asoc_xxx() as define to keep compatible.
It will be removed if all drivers were switched to new style.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87edj4s26a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 69cf63b6 18-Sep-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: fixup simple_util_startup() error handling

It should use "goto" instead of "return"

Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/202309141205.ITZeDJxV-lkp@intel.com/
Closes: https://lore.kernel.org/all/202309151840.au9Aa2W4-lkp@intel.com/
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v8c76jnz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 90de551c 09-Jul-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils.c: enable multi Component support

If CPU/Codec driver keeps its DAI node, we can directly identify actual
DAI by using snd_soc_get_dai_via_args().
This means we can use multi Component.

This patch enables multi Component support on Audio Graph Card/Card2.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a5w4o949.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 988bad5e 09-Jul-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core.c: add snd_soc_dlc_use_cpu_as_platform()

Current snd_soc_is_matching_component() checks "of_node" or "dai_args".
Thus coping "of_node" only is not enough to use CPU as Platform.
This patch adds snd_soc_dlc_use_cpu_as_platform() and help it.

This is helper function for multi Component support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87cz10o94k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0baa2c3a 19-Jun-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card.c: use snd_soc_{of_}get_dlc()

Current ASoC has snd_soc_{of_}get_dai_name() to get DAI name
for dlc (snd_soc_dai_link_component).
But we now can use snd_soc_{of_}get_dlc() for it. Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fs6mdgmc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 45b4ad53 14-Jun-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils: remove unused cpus/codecs/platforms from props

simple_dai_props has cpus/codecs/platforms. These pointer were used
for dai_link before, but are allocated today since
commit 050c7950fd70 ("ASoC: simple-card-utils: alloc dai_link
information for CPU/Codec/Platform").
We don't need to keep it anymore. This patch removes these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bkhhxpc6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# fed4be31 13-Jun-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils.c: share asoc_graph_parse_dai()

Current Audio Graph Card/Card2 implements asoc_simple_parse_dai()
on each driver, but these are same function.
This patch share it as asoc_graph_parse_dai().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o7lihpvy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 635071f5 01-Jun-2023 Robert Hancock <robert.hancock@calian.com>

ASoC: simple-card-utils: fix PCM constraint error check

The code in asoc_simple_startup was treating any non-zero return from
snd_pcm_hw_constraint_minmax as an error, when this can return 1 in some
normal cases and only negative values indicate an error.

When this happened, it caused asoc_simple_startup to disable the clocks
it just enabled and return 1, which was not treated as an error by the
calling code which only checks for negative return values. Then when the
PCM is eventually shut down, it causes the clock framework to complain
about disabling clocks that were not enabled.

Fix the check for snd_pcm_hw_constraint_minmax return value to only
treat negative values as an error.

Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Link: https://lore.kernel.org/r/20230602011936.231931-1-robert.hancock@calian.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4d626112 23-Apr-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils.c: use asoc_dummy_dlc

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87ttx6ypi3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org


# a1cd7e80 02-Apr-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: audio-graph-card2: switch to use c2c_params instead of params

ASoC is now using c2c_params instead of params. This patch replace it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mt3pc2la.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# dcf08424 21-Mar-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card: add comment to indicate don't remove platforms

Basically CPU and Platform are different Component, but if CPU is using
soc-generic-dmaengine-pcm, same dev will be shared between CPU and
Platform, and Simple Card had been supporting it.

When we focus to clean up Simple Card driver, we tend to remove platforms
if no Platform was selected, but it is wrong because of above reasons.

This patch adds comment why we shouldn't remove platforms.

In case of CPU is not using soc-generic-dmaengine-pcm, CPU and Platform
will be duplicated, but it will be ignored by snd_soc_rtd_add_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yattwqv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9b271207 23-Jan-2023 Astrid Rost <astrid.rost@axis.com>

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>


# 5c065eaf 31-Oct-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 32def55d 18-Oct-2022 Aidan MacDonald <aidanmacdonald.0x0@gmail.com>

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: 047a05366f4b ("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>


# 355beeed 06-Sep-2022 Dmitry Torokhov <dmitry.torokhov@gmail.com>

ASoC: simple-card-utils: switch to using gpiod API

This patch switches the driver away from legacy gpio/of_gpio API to
gpiod API, and removes use of of_get_named_gpio_flags() which I want to
make private to gpiolib.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/YxeaITtlJexygQo9@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 047a0536 07-Aug-2022 Sameer Pujar <spujar@nvidia.com>

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>


# 16b7ba9c 30-Jun-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils.c: care Codec2Codec vs DPCM:BE

Current asoc_simple_init_for_codec2codec() adds default Codec2Codec
settings if rtd was Codec only.
But DPCM:BE also judged as Codec only, because dummy-DAI doesn't have
"endianness" (which is key parameter to judge as Codec).

This patch ignores setup Codec2Codec settings if it was DPCM:BE case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a69ts950.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 75d1b390 30-Jun-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils.c: ignore Codec2Codec setting if it already have

Audio Graph Card2 setups own Codec2Codec settings,
but current simple-card-utils.c will try to setup Codec2Codec default
settings if needed, it will overwirtes the settings.
This patch ignores default Codec2Codec settings if it already have.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bku9s95b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6976ed01 30-Jun-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# e6f08af6 05-Jun-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

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>


# ff31753f 29-May-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: rename asoc_simple_init_dai_link_params() to asoc_simple_init_for_codec2codec()

commit 95cfc0a0aaf5752071 ("ASoC: simple-card: Add support for
codec2codec DAI links") added the function
asoc_simple_init_dai_link_params() to initialize dai_link "params".
It is very straight naming, but difficult to noticed that it is for
Codec2Codec support. Handling Codec2Codec is one of very tricky part
on ALSA SoC, thus it is very important to clarify it. This patch
renames the function name.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o7zflk3n.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 28086d05 19-May-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: simple-card-utils: Move snd_soc_component_is_codec to be local

The helper function snd_soc_component_is_codec is based off the
presence of the non_legacy_dai_naming flag. This isn't super robust
as CPU side components may also specify this flag, and indeed the
kernel already contains a couple that do. After componentisation there
isn't really a totally robust solution to identifying what is a CODEC
driver, without introducing a flag specifically for that purpose, and
really the desirable direction to move in is that the distinction
doesn't matter.

This patch does two things to try to mitigate these problems. Firstly,
now that all the other users of the helper function have been removed,
it makes the helper function local to the driver rather, than being
part of the core. This should help to discourage any new code from
being created that depends on the CODEC driver distinction. Secondly,
it updates the helper function itself to use the endianness flag
rather than the non_legacy_dai_naming flag. The endianness flag is
definitely invalid on a CPU side component, so it a more reliable
indicator that the device is definitely a CODEC. The vast majority of
buses require the CODEC to set the endianness flag, so the number of
corner cases should be fairly minimal. It is worth noting that CODECs
sending audio over SPI, or built into the CPU CODECs are potential
corner cases, however the hope is that in most cases those types of
devices do not consitute a simple audio card.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220519154318.2153729-57-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 19aed2d6 07-Apr-2022 Akihiko Odaki <akihiko.odaki@gmail.com>

ASoC: soc-card: Create jack kcontrol without pins

snd_soc_card_jack_new() allowed to create jack kcontrol without pins,
but did not create kcontrols. The jack would not have kcontrols if pins
were not going to be added.

This renames the old snd_soc_card_jack_new() to
snd_soc_card_jack_new_pins() for use when pins are provided or will be
added later. The new snd_soc_card_jack_new() appropriately creates a
jack for use without pins and adds a kcontrol.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3756aa16 12-Apr-2022 Olivier Moysan <olivier.moysan@foss.st.com>

ASoC: simple-card-utils: fix sysclk shutdown

In asoc_simple_shutdown() the snd_soc_dai_set_sysclk() function
is called twice with input direction SND_SOC_CLOCK_IN.
Restore one call with output direction SND_SOC_CLOCK_OUT.

Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag")

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://lore.kernel.org/r/20220412111658.11015-1-olivier.moysan@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 51a630a7 03-Apr-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: simple-card-utils: Avoid NULL deref in asoc_simple_set_tdm()

Don't dereference simple_dai before it has been checked for NULL.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 1e974e5b82b3 ("ASoC: audio_graph_card2: Add support for variable slot widths")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220404113252.1152659-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5bbe2918 10-Mar-2022 Sameer Pujar <spujar@nvidia.com>

ASoC: simple-card-utils: Don't reset clock of active DAI

Playback or capture errors are seen when clock is reset during an active
stage of DAI. Presently this scenario happens when DAI has both playback
and capture sessions running and one of these finishes first which will
be followed by clock rate reset. The remaining active session will be
affected in such case.

Address this problem by allowing clock rate reset to happen only when
the DAI is no more active.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/1646910999-2501-1-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1e974e5b 28-Feb-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

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>


# 5ca2ab45 20-Jan-2022 Robert Hancock <robert.hancock@calian.com>

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>


# ce2f7b8d 20-Jan-2022 Robert Hancock <robert.hancock@calian.com>

ASoC: simple-card-utils: Set sysclk on all components

If an mclk-fs value was provided in the device tree configuration, the
calculated MCLK was fed into the downstream codec DAI and CPU DAI,
however set_sysclk was not being called on the platform device. Some
platform devices such as the Xilinx Audio Formatter need to know the MCLK
as well.

Call snd_soc_component_set_sysclk on each component in the stream to set
the proper sysclk value in addition to the existing call of
snd_soc_dai_set_sysclk on the codec DAI and CPU DAI. This may end up
resulting in redundant calls if one of the snd_soc_dai_set_sysclk calls
ends up calling snd_soc_component_set_sysclk itself, but that isn't
expected to cause any significant harm.

Fixes: f48dcbb6d47d ("ASoC: simple-card-utils: share asoc_simple_hw_param()")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20220120195832.1742271-5-robert.hancock@calian.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3d4641a4 14-Dec-2021 Stephan Gerhold <stephan@gerhold.net>

ASoC: core: Add snd_soc_of_parse_pin_switches() from simple-card-utils

The ASoC core already has several helpers to parse card properties
from the device tree. Move the parsing code for "pin-switches" from
simple-card-utils to a shared snd_soc_of_parse_pin_switches() function
so other drivers can also use it to set up pin switches configured in
the device tree.

Cc: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20211214142049.20422-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# 01e90ee1 17-Oct-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-component: add snd_soc_component_is_codec()

Checking .non_legacy_dai_naming is not readable.
Let's add new snd_soc_component_is_codec().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7dft7dn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 52a18c29 11-Oct-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 92939252 11-Oct-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 36a9d79e 04-Aug-2021 Samuel Holland <samuel@sholland.org>

ASoC: simple-card-utils: Avoid over-allocating DLCs

The allocation of the DAI link components (DLCs) passed the wrong
pointer to sizeof. Since simple_dai_props is much larger than
snd_soc_dai_link_component, there was no out of bounds access, only
wasted memory.

Fixes: f2138aed231c8 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Fixes: 050c7950fd706 ("ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform")
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20210805050706.46833-1-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2c7fd9de 13-Jun-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: switch to use snd_soc_daifmt_parse_format/clock_provider()

This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from
snd_soc_of_parse_daifmt().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871r95w9ch.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f6fcc820 18-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 1a456b1c 18-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# fcfd763b 11-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# c826ec03 11-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 1cf68057 11-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: care multi DAI at asoc_simple_clean_reference()

ASoC is now supporting multi DAI, but, current
simple-card / audio-graph are assuming fixed single DAI.

This patch cares multi DAI at asoc_simple_clean_reference()
for of_node_put().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o8ekwf9p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# fafc05aa 11-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# f899006d 11-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 59f5cd96 11-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: setup dai_props cpu_dai/codec_dai at initial timing

We couldn't setup dai_props cpu_dai/codec_dai at the initial timing,
because "counting DAIs loop" and "detecting DAIs loop" were different.
But we can do it now, because these are using same loops.

This patch setups dai_props cpu_dai/codec_dai at the initial timing.
It can removes triky code from simple-card / audio-graph.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tuocwfa8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 205eb17e 31-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# f2138aed 31-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 050c7950 25-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 89503d73 25-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils.c: remove old comment

commit adb76b5b9c474 ("ASoC: soc-core: remove legacy style dai_link")
removed snd_soc_init_multicodec(). The comment on asoc_simple_init_priv()
is no longer needed. This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87czvm1tq2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# bd029fc8 18-Feb-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: generic: simple-card-utils: remove useless assignment

cppcheck warning:

sound/soc/generic/simple-card-utils.c:258:10: style: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
int ret = 0;
^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8ca88d53 15-Mar-2021 Sameer Pujar <spujar@nvidia.com>

ASoC: simple-card-utils: Do not handle device clock

This reverts commit 1e30f642cf29 ("ASoC: simple-card-utils: Fix device
module clock"). The original patch ended up breaking following platform,
which depends on set_sysclk() to configure internal PLL on wm8904 codec
and expects simple-card-utils to not update the MCLK rate.
- "arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts"

It would be best if codec takes care of setting MCLK clock via DAI
set_sysclk() callback.

Reported-by: Michael Walle <michael@walle.cc>
Suggested-by: Mark Brown <broonie@kernel.org>
Suggested-by: Michael Walle <michael@walle.cc>
Fixes: 1e30f642cf29 ("ASoC: simple-card-utils: Fix device module clock")
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Tested-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/1615829492-8972-2-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1e30f642 09-Feb-2021 Sameer Pujar <spujar@nvidia.com>

ASoC: simple-card-utils: Fix device module clock

If "clocks = <&xxx>" is specified from the CPU or Codec component
device node, the clock is not getting enabled. Thus audio playback
or capture fails.

Fix this by populating "simple_dai->clk" field when clocks property
is specified from device node as well. Also tidy up by re-organising
conditional statements of parsing logic.

Fixes: bb6fc620c2ed ("ASoC: simple-card-utils: add asoc_simple_card_parse_clk()")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1612939421-19900-2-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9ae035e2 19-Jul-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: generic: use asoc_substream_to_rtd()

Now we can use asoc_substream_to_rtd() macro,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zh7vyoex.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 764aafdb 15-Jul-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

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>


# e7718a72 22-Mar-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: generic: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87tv2fir7y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 40a92dbc 08-Mar-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: use for_each_pcm_streams()

We already have for_each_pcm_streams() macro.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875zfei3aa.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 95cfc0a0 04-Mar-2020 Samuel Holland <samuel@sholland.org>

ASoC: simple-card: Add support for codec2codec DAI links

Following the example in cb2cf0de1174 ("ASoC: soc-core: care Codec <->
Codec case by non_legacy_dai_naming"), determine if a DAI link contains
only codec DAIs by examining the non_legacy_dai_naming flag in each
DAI's component.

For now, we assume there is only one or a small set of valid PCM stream
parameters, so num_params == 1 is good enough. We also assume that the
same params are valid for all supported streams. params is set to the
subset of parameters common among all DAIs, and then the existing code
automatically chooses the highest quality of the remaining values when
the link is brought up.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20200305051143.60691-4-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2458adb8 07-Sep-2019 Katsuhiro Suzuki <katsuhiro@katsuster.net>

SoC: simple-card-utils: set 0Hz to sysclk when shutdown

This patch set 0Hz to sysclk when shutdown the card.

Some codecs set rate constraints that derives from sysclk. This
mechanism works correctly if machine drivers give fixed frequency.

But simple-audio and audio-graph card set variable clock rate if
'mclk-fs' property exists. In this case, rate constraints will go
bad scenario. For example a codec accepts three limited rates
(mclk / 256, mclk / 384, mclk / 512).

Bad scenario as follows (mclk-fs = 256):
- Initialize sysclk by correct value (Ex. 12.288MHz)
- Codec set constraints of PCM rate by sysclk
48kHz (1/256), 32kHz (1/384), 24kHz (1/512)
- Play 48kHz sound, it's acceptable
- Sysclk is not changed

- Play 32kHz sound, it's acceptable
- Set sysclk to 8.192MHz (= fs * mclk-fs = 32k * 256)
- Codec set constraints of PCM rate by sysclk
32kHz (1/256), 21.33kHz (1/384), 16kHz (1/512)

- Play 48kHz again, but it's NOT acceptable because constraints
do not allow 48kHz

So codecs treat 0Hz sysclk as signal of applying no constraints to
avoid this problem.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
Link: https://lore.kernel.org/r/20190907174501.19833-1-katsuhiro@katsuster.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# 794fcee8 10-Jul-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: care no Platform for DPCM

commit 34614739988ad ("ASoC: soc-core: support dai_link with
platforms_num != 1") supports multi Platform, and
commit 9f3eb91753451 ("ASoC: simple-card-utils: consider CPU-Platform
possibility") removed no Platform from simple-card.

Multi Platform is now checking both Platform name/of_node are NULL case.
But in normal case, DPCM be doesn't have Platform.

asoc_simple_canonicalize_platform() try to use CPU of_node
to Platform (This is needed for DMAEngine platform case),
but it still might be NULL at DPCM be.

This patch try to use no Platform after that if Platform of_node
is still NULL. It can't probe without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87muhmgw2o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9f3eb917 27-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: consider CPU-Platform possibility

commit 6f0437445735 ("ASoC: simple-card-utils: don't select unnecessary
Platform")

Current ALSA SoC avoid to add duplicate component to rtd,
and this driver was selecting CPU component as Platform component.
Thus, above patch removed Platform settings from this driver,
because it assumed these are same component.

But, some CPU driver is using generic DMAEngine, in such case, both
CPU component and Platform component will have same of_node/name.
In other words, there are some components which are different but
have same of_node/name.

In such case, Card driver definitely need to select Platform even
though it is same as CPU.
It is depends on CPU driver, but is difficult to know it from Card driver.
This patch reverts above patch.

Fixes: commit 6f0437445735 ("ASoC: simple-card-utils: don't select unnecessary Platform")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6f043744 18-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: don't select unnecessary Platform

ALSA SoC is now supporting "no Platform". Sound card doesn't need to
select "CPU component" as "Platform" anymore if it doesn't need
special Platform.
This patch removes such settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f107294c 05-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 90194281 25-Apr-2019 Paul Cercueil <paul@crapouillou.net>

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>


# 35146467 24-Mar-2019 YueHaibing <yuehaibing@huawei.com>

ASoC: simple-card-utils: remove set but not used variable 'dai_name'

Fixes gcc '-Wunused-but-set-variable' warning:

sound/soc/generic/simple-card-utils.c: In function 'asoc_simple_parse_clk':
sound/soc/generic/simple-card-utils.c:164:18: warning:
parameter 'dai_name' set but not used [-Wunused-but-set-parameter]

It's not used since commit 0580dde59438 ("ASoC: simple-card-utils: add
asoc_simple_debug_info()"), so can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 008fe4e5 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: test memory allocation

li->conf will be 0 if it was not DPCM case.
Then, 1) we shouldn't call devm_kcalloc() with size 0,
2) we need NULL pointer check if li->conf was not 0.
This patch fixed above issues.
Special thanks to Pierre-Louis Bossart

Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ad11e59f 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 8f7f298a 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 65a5056b 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 629f7544 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# ad934ca8 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# f48dcbb6 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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 e9be4ffd4f40fcb ("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>


# 686911b4 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# f38df5bf 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 0580dde5 19-Mar-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# fe7ed4de 21-Jan-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 910fdcab 20-Jan-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# a0c426fe 19-Dec-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# b8b89f5e 13-Dec-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() ID method

commit b6f3fc005a2c8 ("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 b6f3fc005a2c8 ("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>


# 2b320e04 10-Dec-2018 Arnd Bergmann <arnd@arndb.de>

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: b6f3fc005a2c ("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>


# b6f3fc00 29-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 33404f3f 20-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# a48bf02b 20-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# f31a1710 20-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: accept NULL parameter on asoc_simple_card_xxx()

If simple-card-utils accept NULL pointer on asoc_simple_card_xxx(),
each driver code will be more simple.
Let's accept NULL pointer.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c0f4697c 20-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: remove asoc_simple_card_clk_register()

asoc_simple_card_clk_register() is used but only 1 user,
and very pointless code. Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7fe072b4 17-Sep-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add for_each_card_prelinks() macro

To be more readable code, this patch adds
new for_each_card_prelinks() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c2f0898b 30-Aug-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-util: remove dai_link compatible code for platform

Now no simple/audio cards are using legacy dai_link style for platform.
Let's remove compatible code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 868cdb46 30-Aug-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>


# 2967e5ea 30-Aug-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-util: remove dai_link compatible code for codec

Now no simple/audio cards are using legacy dai_link style for codec.
Let's remove compatible code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e664de68 30-Aug-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec

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_utils for codec.

[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>


# d613a7f4 02-Jul-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: convert to SPDX identifiers

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 62c2c9fc 11-Jun-2018 Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>

ASoC: simple-card-utils: move hp and mic detect gpios from simple-card

This patch moves headphone and microphone jack detection gpios from
simple-card driver. It is preparing for using this feature from other
drivers.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a728f560 17-Aug-2017 Vitaly Wool <vitalywool@gmail.com>

ASoC: make clock direction configurable in asoc-simple

Some CPU drivers (e. g. davinci-mcasp) may require the system clock to
be configured as OUT, while there's no good way currently to set
SND_SOC_CLK_OUT in simple-soc driver if the clock is fixed-rate.

This patch makes asoc_simple_card_init_dai() initialize clock to
SND_SOCK_CLK_OUT if explicitly stated in the relevant dts file. This
change is transparent and doesn't change the default behavior.

Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1b4a56cd 29-Aug-2017 Lucas Stach <l.stach@pengutronix.de>

ASoC: simple_card_utils: fix fallback when "label" property isn't present

snd_soc_of_parse_card_name() doesn't return an error if the requested
property isn't present, but silently fails to fill the card name. This can
not be changed, as it is a backwards compatibility measure itself.

We can not rely on the return value of this function alone, but must check
if the card name has been filled sucessfully when deciding to skip the
fallback path, which is in place for existing users.

Fixes: dedfaa1eedc7 (ASoC: simple-card-utils: enable "label" on
asoc_simple_card_parse_card_name)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c0a480d1 28-Jul-2017 Tony Lindgren <tony@atomide.com>

device property: Fix usecount for of_graph_get_port_parent()

Fix inconsistent use of of_graph_get_port_parent() where
asoc_simple_card_parse_graph_dai() does of_node_get() before
calling it while other callers do not. We can fix this by
not trashing the node passed to of_graph_get_port_parent().

Let's also make sure the callers have correct refcounts and remove
related incorrect of_node_put() calls for of_for_each_phandle
as that's done by of_phandle_iterator_next() except when
we break out of the loop early.

Let's fix both issues with a single patch to avoid kobject
refcounts getting messed up more if two patches are merged
separately.

Otherwise strange issues can happen caused by memory corruption
caused by too many kobject_del() calls such as:

BUG: sleeping function called from invalid context at
kernel/locking/mutex.c:747
...
(___might_sleep)
(__mutex_lock)
(mutex_lock_nested)
(kernfs_remove)
(kobject_del)
(kobject_put)
(of_get_next_parent)
(of_graph_get_port_parent)
(asoc_simple_card_parse_graph_dai [snd_soc_simple_card_utils])
(asoc_graph_card_probe [snd_soc_audio_graph_card])

Fixes: 0ef472a973eb ("of_graph: add of_graph_get_port_parent()")
Fixes: 2692c1c63c29 ("ASoC: add audio-graph-card support")
Fixes: 1689333f8311 ("ASoC: simple-card-utils: add asoc_simple_card_parse_graph_dai()")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b31f11d0 15-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_of_parse_widgets()

Current simple card drivers are parsing widgets on each own driver
(only simple-card at this point, but will be supported on all drivers)
Encapsulation is one of simple card util's purpose.
Let's add asoc_simple_card_of_parse_widgets for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3296d078 14-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_of_parse_routing()

Current simple card drivers are parsing routing on each own driver.
Encapsulation is one of simple card util's purpose.
Let's add asoc_simple_card_of_parse_routing for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 13bb1cc0 14-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_convert_fixup()

Current simple/audio scu card drivers are supporting same
convert-rate/convert-channels on DT, but doesn't use same function
for it.
Encapsulation is one of simple card util's purpose.
Let's add asoc_simple_card_parse_convert/asoc_simple_card_convert_fixup

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 63a5f592 13-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils: add EXPORT_SYMBOL_GPL() for asoc_simple_card_clk_xxx()

commit 891caea41746 ("ASoC: simple_card_utils:
add asoc_simple_card_clk_xxx()") added new asoc_simple_card_clk_xxx(),
but, it didn't have EXPORT_SYMBOL_GPL().
This patch adds it. Otherwise, we will get below error

ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-scu-card.ko] undefined!
ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-simple-card.ko] undefined!
ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-scu-card.ko] undefined!
ERROR: "asoc_simple_card_clk_enable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!
ERROR: "asoc_simple_card_clk_disable" [sound/soc/generic/snd-soc-audio-graph-card.ko] undefined!

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 891caea4 08-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils: add asoc_simple_card_clk_xxx()

Current simple-card-utils sets asoc_simple_dai::clk via
asoc_simple_card_parse_clk().
Current simple card drivers are using it directly for
clk_enable/disable.
Encapsulation is one of simple card util's purpose.
Let's encapsulate it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8e166382 04-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: share same dev_dbg() for sysclk

Let's share same debug message for sysclk

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4579771e 04-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: share same dev_dbg() for Dai Name

Let's share same debug message for DAI Name

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# aaad9c13 04-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: share same dev_dbg() for DAI format

Let's share same debug message for DAI format

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d4dbcb63 04-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: share same dev_dbg() for Card Name

Let's share same debug message for Card Name

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 155b8f3a 24-May-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: remove strict limitation of bit/frame master

Current asoc_simple_card_parse_daifmt is keeping backward compatibility
for bitmaster/framemaster which didn't use phandle.
The keep compatibility, it is checking prefix length, but it is
too strict. let's loosen it. Otherwise, OF-graph base sound card
which doesn't have prefix can't detect daifmt.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 73b17f1a 17-May-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: support snd_soc_get_dai_id()

ALSA SoC needs to know connected DAI ID for detecting.
It is not a big problem if device/driver was only for sound,
but getting DAI ID will be difficult if device includes both
Video/Sound, like HDMI.
To solve this issue, this patch adds new snd_soc_get_dai_id() and
its related .of_xlate_dai_id callback on component driver.
In below case, we can handle Sound port (= port@2) as ID = 0
if .of_xlate_dai_id has its support.

hdmi {
port@0 { /* VIDEO */ };
port@1 { /* VIDEO */ };
port@2 { /* SOUND */ };
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1689333f 19-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_parse_graph_dai()

simple-card already has asoc_simple_card_parse_dai(),
but graph base parsing needs graph specific version of it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# dedfaa1e 19-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: enable "label" on asoc_simple_card_parse_card_name

Current asoc_simple_card_parse_card_name() detects [prefix]name,
but in generally, we uses "label" for user visible names.
This patch enables it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 971edb0a 23-Mar-2017 Lucas Stach <l.stach@pengutronix.de>

ASoC: simple-card: fix simple_dai clk lookup

The clock needs to be stored in the simple_dai structure, so it can
be enabled later on. This has been broken during the conversion to use
devm_* functions for the clk lookup.

Fixes: e984fd61e860 (ASoC: simple-card: use devm_get_clk_from_child())
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e984fd61 23-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card: use devm_get_clk_from_child()

Current simple-card-utils is getting clk by of_clk_get(), but didn't call
clk_free(). Now we can use devm_get_clk_from_child() for this purpose.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 29a43aa9 01-Dec-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple_card_utils: tidyup file comment/define

simple_card_utils was created as simple_card_core in 1st prototype,
and current code still have it. Let's tidyup

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6c1c06cb 27-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check

Remove cpu/codec pointer check from asoc_simple_card_canonicalize_dailink()
This is verbose check, and will be issue if CPU name was created by
fmt_single_name() on simple-scu-card.c.
see also asoc_simple_card_canonicalize_cpu()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0f4e0711 09-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_clean_reference()

simple-card needs to decrease the reference count of the device nodes.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 983cebd6 09-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu()

simple-card needs remove dai_link->cpu_dai_name if it CPU was
single DAI.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c262c9ab 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()

simple-card is assuming that sometimes platform and cpu are same.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 21ba62f8 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_init_dai()

simple-card is supporting clock/tdm slot initialization.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ae30a694 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_parse_dai()

simple-card needs to get its dai name and endpoint node.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bb6fc620 07-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_parse_clk()

Current simple-card can get clock via DT clocks or
"system-clock-frequency" property.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1f85e118 02-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add missing MODULE_xxx()

simple-card-utils might be used as module, but MODULE_xxx()
information was missed. This patch adds it.
Otherwise, we will have below error, and can't use it.
Specil thanks to Kevin.

> insmod simple-card-utils.ko
simple_card_utils: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
simple_card_utils: Unknown symbol snd_soc_of_parse_daifmt (err 0)
simple_card_utils: Unknown symbol snd_soc_of_parse_card_name (err 0)
insmod: can't insert 'simple-card-utils.ko': \
unknown symbol in module, or unknown parameter

Reported-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fc55c9b5 11-Jul-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()

simple-card needs to get its card name.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1db3312e 11-Jul-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name()

Current simple-card is creating dai_link->name / dai_link->stream_name.
These are based on CPU + Codec name, or "fe.CPU" or "be.Codec" if it
was DPCM.
This patch adds asoc_simple_card_set_dailink_name() and set dailink
name as common method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# abd3147e 31-May-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add new simple-card-utils.c

Current ALSA SoC has simple-card driver which is supporting both
platform and DT probe.
Now, some sound cards driver are created based on simple-card.
They have similar feature or function, but implemented separately
on each drivers. This is a waste of code.
OTOH, merging these driver into same driver is highly risk,
because it will be very difficult to keep compatibility.
More over, ALSA SoC want to have graph base of DT feature in the
future. Maybe it want to use simple-card like feature / function.
Because of these background, this patch creates simple-card
helper utils, and provides common function to each drivers.
1st is asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>