History log of /openbmc/linux/sound/soc/soc-dai.c (Results 1 – 25 of 125)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.6.25, v6.6.24, v6.6.23, v6.6.16, v6.6.15, v6.6.14, v6.6.13, v6.6.12, v6.6.11, v6.6.10, v6.6.9, v6.6.8, v6.6.7, v6.6.6, v6.6.5, v6.6.4, v6.6.3
# 868eb92b 23-Nov-2023 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ASoC: soc-dai: add flag to mute and unmute stream during trigger

commit f0220575e65abe09c09cd17826a3cdea76e8d58f upstream.

In some setups like Speaker amps which are very sensitive, ex: keeping the

ASoC: soc-dai: add flag to mute and unmute stream during trigger

commit f0220575e65abe09c09cd17826a3cdea76e8d58f upstream.

In some setups like Speaker amps which are very sensitive, ex: keeping them
unmute without actual data stream for very short duration results in a
static charge and results in pop and clicks. To minimize this, provide a way
to mute and unmute such codecs during trigger callbacks.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231027105747.32450-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
[ johan: backport to v6.6.2 ]
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

show more ...


Revision tags: v6.6.2, v6.5.11, v6.6.1, v6.5.10, v6.6, v6.5.9, v6.5.8, v6.5.7, v6.5.6, v6.5.5, v6.5.4, v6.5.3, v6.5.2, v6.1.51, v6.5.1, v6.1.50, v6.5, v6.1.49, v6.1.48, v6.1.46, v6.1.45
# 624fee45 08-Aug-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai.h: merge DAI call back functions into ops

snd_soc_dai_driver has .ops for call back functions (A), but it also
has other call back functions (B). It is duplicated and confusable.

str

ASoC: soc-dai.h: merge DAI call back functions into ops

snd_soc_dai_driver has .ops for call back functions (A), but it also
has other call back functions (B). It is duplicated and confusable.

struct snd_soc_dai_driver {
...
^ int (*probe)(...);
| int (*remove)(...);
(B) int (*compress_new)(...);
| int (*pcm_new)(...);
v ...
(A) const struct snd_soc_dai_ops *ops;
...
}

This patch merges (B) into (A).

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

show more ...


# 3e8bcec0 08-Aug-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai.h: merge DAI call back functions into ops

snd_soc_dai_driver has .ops for call back functions (A), but it also
has other call back functions (B). It is duplicated and confusable.

str

ASoC: soc-dai.h: merge DAI call back functions into ops

snd_soc_dai_driver has .ops for call back functions (A), but it also
has other call back functions (B). It is duplicated and confusable.

struct snd_soc_dai_driver {
...
^ int (*probe)(...);
| int (*remove)(...);
(B) int (*compress_new)(...);
| int (*pcm_new)(...);
v ...
(A) const struct snd_soc_dai_ops *ops;
...
}

This patch merges (B) into (A).

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

show more ...


Revision tags: v6.1.44, v6.1.43, v6.1.42, v6.1.41, v6.1.40, v6.1.39
# 4005d1ba 13-Jul-2023 Peter Suti <peter.suti@streamunlimited.com>

ASoC: soc-dai: don't call PCM audio ops if the stream is not supported

PCM audio ops may be called when the stream is not supported.
We should not call the ops in that case to avoid unexpected behav

ASoC: soc-dai: don't call PCM audio ops if the stream is not supported

PCM audio ops may be called when the stream is not supported.
We should not call the ops in that case to avoid unexpected behavior.

hw_params is handled already in soc-pcm.c

[0] https://lore.kernel.org/alsa-devel/ae06b00a-f3f7-f9d1-0b58-4d71f3394416@linux.intel.com/T/#t

Signed-off-by: Peter Suti <peter.suti@streamunlimited.com>
Link: https://lore.kernel.org/r/20230713095258.3393827-1-peter.suti@streamunlimited.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v6.1.38, v6.1.37, v6.1.36, v6.4, v6.1.35, v6.1.34, v6.1.33, v6.1.32, v6.1.31, v6.1.30, v6.1.29, v6.1.28, v6.1.27, v6.1.26, v6.3, v6.1.25, v6.1.24, v6.1.23, v6.1.22, v6.1.21, v6.1.20, v6.1.19, v6.1.18, v6.1.17, v6.1.16
# 5c5a7521 05-Mar-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe()

dai->probed is used at snd_soc_pcm_dai_probe/remove(),
and used to call real remove() function only when it was probed.

int snd_s

ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe()

dai->probed is used at snd_soc_pcm_dai_probe/remove(),
and used to call real remove() function only when it was probed.

int snd_soc_pcm_dai_probe(...)
{
...
for_each_rtd_dais(rtd, i, dai) {
...

if (dai->driver->probe) {
(A) int ret = dai->driver->probe(dai);

if (ret < 0)
return soc_dai_ret(dai, ret);
}

=> dai->probed = 1;
}
...
}

int snd_soc_pcm_dai_remove(...)
{
...
for_each_rtd_dais(rtd, i, dai) {
...
=> if (dai->probed &&
...) {
...
}

=> dai->probed = 0;
}
...
}

But on probe() case, we need to check dai->probed before calling
real probe() function at (A), otherwise real probe() might be called
multi times (but real remove() will be called only once).
This patch checks it at probe().

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

show more ...


Revision tags: v6.1.15, v6.1.14, v6.1.13, v6.2, v6.1.12, v6.1.11, v6.1.10, v6.1.9
# 3653480c 30-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai.h: cleanup Playback/Capture data for snd_soc_dai

Current snd_soc_dai has data for Playback/Capture, but it is very
random. Someone is array (A), someone is playback/capture (B),
and so

ASoC: soc-dai.h: cleanup Playback/Capture data for snd_soc_dai

Current snd_soc_dai has data for Playback/Capture, but it is very
random. Someone is array (A), someone is playback/capture (B),
and someone is tx/rx (C);

struct snd_soc_dai {
...
(A) unsigned int stream_active[SNDRV_PCM_STREAM_LAST + 1];

(B) struct snd_soc_dapm_widget *playback_widget;
(B) struct snd_soc_dapm_widget *capture_widget;

(B) void *playback_dma_data;
(B) void *capture_dma_data;

...

(C) unsigned int tx_mask;
(C) unsigned int rx_mask;
};

Because of it, the code was very complicated.
This patch creates new data structure to merge these into one,
and tidyup the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/87cz6vea1v.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


# 8ede4b71 30-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai.c: use helper function

Current ASoC has many helper function.
This patch use it.

Link: https://lore.kernel.org/all/6f047ec5-4055-761d-c1ea-c2d0b606e53a@linux.intel.com/
Signed-off-by:

ASoC: soc-dai.c: use helper function

Current ASoC has many helper function.
This patch use it.

Link: https://lore.kernel.org/all/6f047ec5-4055-761d-c1ea-c2d0b606e53a@linux.intel.com/
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h6w7ea2a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v6.1.8, v6.1.7, v6.1.6, v6.1.5, v6.0.19, v6.0.18, v6.1.4, v6.1.3, v6.0.17, v6.1.2, v6.0.16, v6.1.1, v6.0.15, v6.0.14, v6.0.13, v6.1, v6.0.12, v6.0.11, v6.0.10, v5.15.80, v6.0.9, v5.15.79, v6.0.8, v5.15.78
# 3115be55 04-Nov-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: soc-dai: Do not call snd_soc_link_be_hw_params_fixup() twice

For a BE link snd_soc_link_be_hw_params_fixup() is called by
dpcm_be_dai_hw_params() to initialize the params before it passes them

ASoC: soc-dai: Do not call snd_soc_link_be_hw_params_fixup() twice

For a BE link snd_soc_link_be_hw_params_fixup() is called by
dpcm_be_dai_hw_params() to initialize the params before it passes them
to __soc_pcm_hw_params(). Then __soc_pcm_hw_params() refines params to
match the BE codec and passes that to snd_soc_dai_hw_params().

The second call of snd_soc_link_be_hw_params_fixup() within
snd_soc_dai_hw_params() was overwriting the refined params with the
original BE CPU DAI params. This would then lead to various problems,
for example passing an invalid number of channels to the codec driver
hw_params(), or enabling more AIF widgets on the codec than are actually
mapped by TDM slots.

These errors may not be noticed on a simple 1:1 link between one CPU DAI
and one codec DAI, because most likely they have the same DAI config
(though this is not necessarily true, for example if the CPU end has dummy
TDM slots to achieve a desirable BCLK).

For 1:N mappings there are likely to be multiple codecs using different
subsets of the TDM slots and this overwriting of the refined params
can cause incorrect configuration of each codec on the link.

The erroneous extra call to the BE fixup function() was introduced
by:
commit a655de808cbd ("ASoC: core: Allow topology to override machine
driver FE DAI link config.")

at that time, the call to the BE fixup was already done by
dpcm_be_dai_hw_params(), which was introduced several years earlier
by:
commit 01d7584cd2e5 ("ASoC: dpcm: Add Dynamic PCM core operations.")

The erroneous code has changed and moved to a different source file
since the patch that introduced it, so this fix patch won't directly
apply as a fix on top of code older than:
commit 8b4ba1d31771 ("ASoC: soc-dai: fix up hw params only if it is
needed")

though it can be applied with some minor adjustment to code before
that patch but after:
commit aa6166c2ac28 ("ASoC: soc-dai: mv soc_dai_hw_params() to soc-dai")

On any tree older than that the code is in soc-pcm.c.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221104160252.166114-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v6.0.7, v5.15.77, v5.15.76, v6.0.6, v6.0.5, v5.15.75, v6.0.4, v6.0.3, v6.0.2, v5.15.74, v5.15.73, v6.0.1, v5.15.72, v6.0, v5.15.71, v5.15.70, v5.15.69, v5.15.68, v5.15.67, v5.15.66, v5.15.65, v5.15.64, v5.15.63, v5.15.62
# ceff365a 18-Aug-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: Change handling of unimplemented set_bclk_ratio

If a 'set_bclk_ratio' call is attempted on a DAI not implementing the
method, make it an -ENOSUPP error instead of -EINVAL. Assume the DAI can
s

ASoC: Change handling of unimplemented set_bclk_ratio

If a 'set_bclk_ratio' call is attempted on a DAI not implementing the
method, make it an -ENOSUPP error instead of -EINVAL. Assume the DAI can
still be okay with the ratio, just does not care to register a handler.

No current in-tree users of snd_soc_dai_set_bclk_ratio seem to inspect
the return value, but -ENOSUPP disables an error print from within the
common soc_dai_ret return filter. With the new behavior a machine
driver can do a blanket 'set_bclk_ratio' on all DAIs on a bus, some of
which may care about the ratio, some of which may not.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220818165336.76403-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v5.15.61, v5.15.60, v5.15.59, v5.19, v5.15.58, v5.15.57, v5.15.56, v5.15.55, v5.15.54, v5.15.53, v5.15.52, v5.15.51, v5.15.50, v5.15.49, v5.15.48, v5.15.47, v5.15.46, v5.15.45, v5.15.44, v5.15.43, v5.15.42, v5.18
# 19423951 19-May-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: soc-dai: Remove set_fmt_new callback

Now the behaviour of the core and all drivers is updated to the new
direct clock specification the temporary set_fmt_new callback can be
completely removed

ASoC: soc-dai: Remove set_fmt_new callback

Now the behaviour of the core and all drivers is updated to the new
direct clock specification the temporary set_fmt_new callback can be
completely removed.

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

show more ...


# 905f3a04 19-May-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: core: Add set_fmt_new callback that directly specifies provider

The original set_fmt callback always passes clock provider/consumer
with respect to the CODEC. This made sense when the framewor

ASoC: core: Add set_fmt_new callback that directly specifies provider

The original set_fmt callback always passes clock provider/consumer
with respect to the CODEC. This made sense when the framework was
directly broken down into platforms and CODECs. Now everything is
componentised it simplifies things if each side of the link is
just told if it is provider or consumer of the clocks. To start
this migration add a new callback that can be used to receive a
direct specification of clocking. As there are more CODEC drivers
than platform drivers, we make the new flags identical to the old
CODEC flags meaning CODEC drivers will not require an update.

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

show more ...


Revision tags: v5.15.41, v5.15.40, v5.15.39, v5.15.38, v5.15.37, v5.15.36, v5.15.35, v5.15.34, v5.15.33, v5.15.32, v5.15.31, v5.17, v5.15.30, v5.15.29, v5.15.28, v5.15.27, v5.15.26, v5.15.25, v5.15.24, v5.15.23, v5.15.22, v5.15.21, v5.15.20, v5.15.19, v5.15.18, v5.15.17, v5.4.173, v5.15.16, v5.15.15, v5.16, v5.15.10, v5.15.9, v5.15.8, v5.15.7, v5.15.6, v5.15.5, v5.15.4, v5.15.3
# 8544f08c 16-Nov-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: update snd_soc_dai_delay() to snd_soc_pcm_dai_delay()

Current soc_pcm_pointer() is manually calculating
both CPU-DAI's max delay (= A)
and Codec-DAI's max delay (= B).

static snd

ASoC: soc-dai: update snd_soc_dai_delay() to snd_soc_pcm_dai_delay()

Current soc_pcm_pointer() is manually calculating
both CPU-DAI's max delay (= A)
and Codec-DAI's max delay (= B).

static snd_pcm_uframes_t soc_pcm_pointer(...)
{
...
^ for_each_rtd_cpu_dais(rtd, i, cpu_dai)
(A) cpu_delay = max(cpu_delay, ...);
v delay += cpu_delay;

^ for_each_rtd_codec_dais(rtd, i, codec_dai)
(B) codec_delay = max(codec_delay, ...);
v delay += codec_delay;

runtime->delay = delay;
...
}

Current soc_pcm_pointer() and the total delay calculating
is not readable / difficult to understand.

This patch update snd_soc_dai_delay() to snd_soc_pcm_dai_delay(),
and calcule both CPU/Codec delay in one function.

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

show more ...


Revision tags: v5.15.2, v5.15.1, v5.15, v5.14.14, v5.14.13, v5.14.12, v5.14.11, v5.14.10, v5.14.9, v5.14.8, v5.14.7, v5.14.6, v5.10.67, v5.10.66, v5.14.5, v5.14.4, v5.10.65, v5.14.3, v5.10.64, v5.14.2, v5.10.63, v5.14.1, v5.10.62, v5.14, v5.10.61, v5.10.60
# 454a7422 15-Aug-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new()

This patch cleanups below cppcheck warning.

sound/soc/soc-dai.c:553:13: style: Variable 'ret' is assigned a value that is never used

ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new()

This patch cleanups below cppcheck warning.

sound/soc/soc-dai.c:553:13: style: Variable 'ret' is assigned a value that is never used. [unreadVariable]
int i, ret = 0;
^

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

show more ...


# d490f4e7 15-Aug-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: cleanup cppcheck warning at snd_soc_dai_link_set_capabilities()

This patch cleanups below cppcheck warning.

sound/soc/soc-dai.c:454:7: style: The scope of the variable 'supported_cpu

ASoC: soc-dai: cleanup cppcheck warning at snd_soc_dai_link_set_capabilities()

This patch cleanups below cppcheck warning.

sound/soc/soc-dai.c:454:7: style: The scope of the variable 'supported_cpu' can be reduced. [variableScope]
bool supported_cpu;
^
sound/soc/soc-dai.c:455:7: style: The scope of the variable 'supported_codec' can be reduced. [variableScope]
bool supported_codec;
^

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

show more ...


Revision tags: v5.10.53, v5.10.52, v5.10.51, v5.10.50, v5.10.49, v5.13, v5.10.46, v5.10.43, v5.10.42, v5.10.41
# ba9e82a1 26-May-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()

ASoC is using dai_link which specify DAI format (= dai_link->dai_fmt),
and it is selected by "Sound Card" driver in corrent implementation.
In other

ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()

ASoC is using dai_link which specify DAI format (= dai_link->dai_fmt),
and it is selected by "Sound Card" driver in corrent implementation.
In other words, Sound Card *needs* to setup it.
But, it should be possible to automatically selected from CPU and
Codec driver settings.

This patch adds new .auto_selectable_formats support
at snd_soc_dai_ops.

By this patch, dai_fmt can be automatically selected from each
driver if both CPU / Codec driver had it.
Automatically selectable *field* is depends on each drivers.

For example, some driver want to select format "automatically",
but want to select other fields "manually", because of complex limitation.
Or other example, in case of both CPU and Codec are possible to be
clock provider, but the quality was different.
In these case, user need/want to *manually* select each fields
from Sound Card driver.

This .auto_selectable_formats can set priority.
For example, no limitaion format can be HI priority,
supported but has picky limitation format can be next priority, etc.

It uses Sound Card specified fields preferentially, and try to select
non-specific fields from CPU and Codec driver automatically
if all drivers have .auto_selectable_formats.

In other words, we can select all dai_fmt via Sound Card driver
same as before.

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

show more ...


Revision tags: v5.10.40, v5.10.39
# 8b4ba1d3 14-May-2021 Gyeongtaek Lee <gt82.lee@samsung.com>

ASoC: soc-dai: fix up hw params only if it is needed

If fixed hw params won't be used, fixing up isn't needed also.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Link: https://lore.kernel.or

ASoC: soc-dai: fix up hw params only if it is needed

If fixed hw params won't be used, fixing up isn't needed also.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Link: https://lore.kernel.org/r/000401d748bc$fa466d50$eed347f0$@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v5.4.119, v5.10.36, v5.10.35, v5.10.34, v5.4.116, v5.10.33, v5.12, v5.10.32, v5.10.31, v5.10.30, v5.10.27, v5.10.26, v5.10.25, v5.10.24, v5.10.23, v5.10.22, v5.10.21, v5.10.20
# 2fb87110 01-Mar-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: soc-dai: fix kernel-doc

v5.12-rc1 flags new warnings with make W=1, fix missing or broken
function descriptors.

sound/soc/soc-dai.c:167: warning: expecting prototype for
snd_soc_xlate_tdm_slo

ASoC: soc-dai: fix kernel-doc

v5.12-rc1 flags new warnings with make W=1, fix missing or broken
function descriptors.

sound/soc/soc-dai.c:167: warning: expecting prototype for
snd_soc_xlate_tdm_slot(). Prototype was for
snd_soc_xlate_tdm_slot_mask() instead

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

show more ...


Revision tags: v5.10.19, v5.4.101, v5.10.18, v5.10.17, v5.11, v5.10.16, v5.10.15, v5.10.14, v5.10
# 6374f493 30-Nov-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-pcm: care trigger rollback

soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.

static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PC

ASoC: soc-pcm: care trigger rollback

soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.

static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;

(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;

ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;

ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;

ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}

For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.

This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.

Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.

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

show more ...


# 1e6a93cf 18-Nov-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: add mark for snd_soc_dai_compr_startup/shutdown()

soc_compr_open() does rollback when failed (A),
but, it is almost same as soc_compr_free().

static int soc_compr_open(xxx)
{
...

ASoC: soc-dai: add mark for snd_soc_dai_compr_startup/shutdown()

soc_compr_open() does rollback when failed (A),
but, it is almost same as soc_compr_free().

static int soc_compr_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

^ machine_err:
| ...
| out:
(A) ...
| pm_err:
| ...
v return ret;
}

The difference is
soc_compr_free() is for all dai/component/substream,
rollback is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_compr_free() and rollback.
=> 1) snd_soc_dai_compr_startup/shutdown()
2) snd_soc_component_compr_open/free()
3) snd_soc_link_compr_startup/shutdown()

This patch is for 1) snd_soc_dai_compr_startup/shutdown(),
and adds new cstream mark.
It will mark cstream when startup() was suceeded.
If rollback happen *after* that, it will check rollback flag
and marked cstream.

It cares *previous* startup() only now,
but we might want to check *whole* marked cstream in the future.
This patch is using macro so that it can be easily adjust to it.

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

show more ...


Revision tags: v5.8.17, v5.8.16, v5.8.15, v5.9, v5.8.14, v5.8.13
# c304c9ac 28-Sep-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: add mark for snd_soc_dai_hw_params/free()

soc_pcm_hw_params() does rollback when failed (A),
but, it is almost same as soc_pcm_hw_free().

static int soc_pcm_hw_params(xxx)
{
...

ASoC: soc-dai: add mark for snd_soc_dai_hw_params/free()

soc_pcm_hw_params() does rollback when failed (A),
but, it is almost same as soc_pcm_hw_free().

static int soc_pcm_hw_params(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return ret;

^ component_err:
| ...
| interface_err:
(A) ...
| codec_err:
| ...
v return ret;
}

The difference is
soc_pcm_hw_free() is for all dai/component/substream,
rollback is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_hw_free() and rollback.

Now, soc_pcm_hw_params/free() are handling
1) snd_soc_link_hw_params/free()
2) snd_soc_pcm_component_hw_params/free()
=> 3) snd_soc_dai_hw_params/free()

This patch is for 3) snd_soc_dai_hw_params/free().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when hw_params() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *previous* hw_params() only now,
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

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

show more ...


# 00a0b46c 27-Sep-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret

ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

^ config_err:
| ...
| rtd_startup_err:
(A) ...
| component_err:
| ...
v return ret;
}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()

This patch is for 1) snd_soc_dai_startup/shutdown().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

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

show more ...


Revision tags: v5.8.12, v5.8.11, v5.8.10, v5.8.9, v5.8.8, v5.8.7, v5.8.6, v5.4.62, v5.8.5
# 20d9fdee 26-Aug-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_find_dai_with_mutex()

commit 25612477d20b52 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
added snd_soc_dai_link_set_capabilities().
But it is using snd_soc_f

ASoC: soc-core: add snd_soc_find_dai_with_mutex()

commit 25612477d20b52 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
added snd_soc_dai_link_set_capabilities().
But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
And client_mutex is soc-core.c local.

struct snd_soc_dai *snd_soc_find_dai(xxx)
{
...
(B) lockdep_assert_held(&client_mutex);
...
}

void snd_soc_dai_link_set_capabilities(xxx)
{
...
for_each_pcm_streams(direction) {
...
for_each_link_cpus(dai_link, i, cpu) {
(A) dai = snd_soc_find_dai(cpu);
...
}
...
for_each_link_codecs(dai_link, i, codec) {
(A) dai = snd_soc_find_dai(codec);
...
}
}
...
}

Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.

WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO)
pc : snd_soc_find_dai+0xf8/0x100
lr : snd_soc_find_dai+0xf4/0x100
...
Call trace:
snd_soc_find_dai+0xf8/0x100
snd_soc_dai_link_set_capabilities+0xa0/0x16c
graph_dai_link_of_dpcm+0x390/0x3c0
graph_for_each_link+0x134/0x200
graph_probe+0x144/0x230
platform_drv_probe+0x5c/0xb0
really_probe+0xe4/0x430
driver_probe_device+0x60/0xf4

snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
mutex lock, and (Y) Card driver without mutex lock.
This snd_soc_dai_link_set_capabilities() is for Card driver,
this means called without mutex.
This patch adds snd_soc_find_dai_with_mutex() to solve it.

Fixes: 25612477d20b52 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


# c1c277b2 26-Aug-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_find_dai_with_mutex()

commit 25612477d20b52 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
added snd_soc_dai_link_set_capabilities().
But it is using snd_soc_f

ASoC: soc-core: add snd_soc_find_dai_with_mutex()

commit 25612477d20b52 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
added snd_soc_dai_link_set_capabilities().
But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
And client_mutex is soc-core.c local.

struct snd_soc_dai *snd_soc_find_dai(xxx)
{
...
(B) lockdep_assert_held(&client_mutex);
...
}

void snd_soc_dai_link_set_capabilities(xxx)
{
...
for_each_pcm_streams(direction) {
...
for_each_link_cpus(dai_link, i, cpu) {
(A) dai = snd_soc_find_dai(cpu);
...
}
...
for_each_link_codecs(dai_link, i, codec) {
(A) dai = snd_soc_find_dai(codec);
...
}
}
...
}

Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.

WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO)
pc : snd_soc_find_dai+0xf8/0x100
lr : snd_soc_find_dai+0xf4/0x100
...
Call trace:
snd_soc_find_dai+0xf8/0x100
snd_soc_dai_link_set_capabilities+0xa0/0x16c
graph_dai_link_of_dpcm+0x390/0x3c0
graph_for_each_link+0x134/0x200
graph_probe+0x144/0x230
platform_drv_probe+0x5c/0xb0
really_probe+0xe4/0x430
driver_probe_device+0x60/0xf4

snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
mutex lock, and (Y) Card driver without mutex lock.
This snd_soc_dai_link_set_capabilities() is for Card driver,
this means called without mutex.
This patch adds snd_soc_find_dai_with_mutex() to solve it.

Fixes: 25612477d20b52 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v5.8.4, v5.4.61, v5.8.3, v5.4.60, v5.8.2, v5.4.59, v5.8.1, v5.4.58, v5.4.57, v5.4.56, v5.8, v5.7.12, v5.4.55, v5.7.11, v5.4.54
# 4f872154 23-Jul-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: core: use less strict tests for dailink capabilities

Previous updates to set dailink capabilities and check dailink
capabilities were based on a flawed assumption that all dais support
the sam

ASoC: core: use less strict tests for dailink capabilities

Previous updates to set dailink capabilities and check dailink
capabilities were based on a flawed assumption that all dais support
the same capabilities as the dailink. This is true for TDM
configurations but existing configurations use an amplifier and a
capture device on the same dailink, and the tests would prevent the
card from probing.

This patch modifies the snd_soc_dai_link_set_capabilities()
helper so that the dpcm_playback (resp. dpcm_capture) dailink
capabilities are set if at least one dai supports playback (resp. capture).

Likewise the checks are modified so that an error is reported only
when dpcm_playback (resp. dpcm_capture) is set but none of the CPU
DAIs support playback (resp. capture).

Fixes: 25612477d20b5 ('ASoC: soc-dai: set dai_link dpcm_ flags with a helper')
Fixes: b73287f0b0745 ('ASoC: soc-pcm: dpcm: fix playback/capture checks')
Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200723180533.220312-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

show more ...


Revision tags: v5.7.10, v5.4.53
# 0ceef681 19-Jul-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-xxx: add asoc_substream_to_rtd()

Current soc-xxx are getting rtd from substream by

rtd = substream->private_data;

But, getting data from "private_data" is very unclear.
This patch adds

ASoC: soc-xxx: add asoc_substream_to_rtd()

Current soc-xxx are getting rtd from substream by

rtd = substream->private_data;

But, getting data from "private_data" is very unclear.
This patch adds asoc_substream_to_rtd() macro which is
easy to understand that rtd from substream.

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

show more ...


12345