History log of /linux-master/include/sound/soc.h
Revision Date Author Comments
# cf88ab48 16-Feb-2024 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

ASoC: Constify pointer to of_phandle_args

Constify pointer to of_phandle_args in few function arguments, for code
safety and self-documenting code.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240216145448.224185-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 13f58267 18-Dec-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: don't create dummy Component via COMP_DUMMY()

Many ASoC drivers define CPU/Codec/Platform dai_link by below macro.

SND_SOC_DAILINK_DEFS(link,
(A) DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai")),
(B) DAILINK_COMP_ARRAY(COMP_CODEC("codec", "dai1"),
(B) COMP_CODEC("codec", "dai2")),
(C) DAILINK_COMP_ARRAY(COMP_EMPTY()));

In this case, this macro will be converted to like below

[o] = static struct snd_soc_dai_link_component

(A) [o] link_cpus[] = {{ .dai_name = "cpu_dai" }};
(B) [o] link_codecs[] = {{ .dai_name = "dai1", .name = "codec" },
{ .dai_name = "dai2", .name = "codec" }}
(C) [o] link_platforms[] = {{ }};

CPU and Codec info will be filled by COMP_CPU() / COMP_CODEC (= A,B),
and Platform will have empty data by COMP_EMPTY() (= C) in this case.

Platform empty info will be filled when driver probe()
(most of case, CPU info will be copied to use soc-generic-dmaengine-pcm).

For example in case of DPCM FE/BE, it will be like below.
Codec will be dummy Component / DAI in this case (X).

SND_SOC_DAILINK_DEFS(link,
DAILINK_COMP_ARRAY(COMP_CPU(...)),
(X) DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));

(X) part will converted like below

[o] link_codecs[] = {{ .name = "snd-soc-dummy",
.dai_name = "snd-soc-dummy-dai", }}

Even though we already have common asoc_dummy_dlc for dummy
Component / DAI, this macro will re-create new dummy dlc.
Some drivers defines many dai_link info via SND_SOC_DAILINK_DEFS(),
this means many dummy dlc also will be re-created. This is waste of
memory.

If we can use existing common asoc_dummy_dlc at (X),
we can avoid to re-creating dummy dlc, then, we can save the memory.

At that time, we want to keep existing code as much as possible, because
too many drivers are using this macro. But because of its original style,
using common asoc_dummy_dlc from it is very difficult or impossible.

So let's change the mind. The macro is used like below

SND_SOC_DAILINK_DEFS(link,
DAILINK_COMP_ARRAY(COMP_CPU(...)),
(x) DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));

static struct snd_soc_dai_link dai_links[] = {
{
.name = ...,
.stream_name = ...,
(y) SND_SOC_DAILINK_REG(link),
},

(y) part will be like below

static struct snd_soc_dai_link dai_links[] = {
{
.name = ...,
.stream_name = ...,
^ ...
| .codecs = link_codecs,
(y) .num_codecs = ARRAY_SIZE(link_codecs),
v ...
}

This patch try to use trick on COMP_DUMMY()

- #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
+ #define COMP_DUMMY()

By this tric, (x) part will be like below.

before
[o] link_codecs[] = {{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }}
after
[o] link_codecs[] = { };

This is same as below

[o] link_codecs[0];

This means it has pointer (link_codecs), but the array size is 0.
(y) part will be like below.

static struct snd_soc_dai_link dai_links[] = {
{
...
.codecs = link_codecs,
.num_codecs = 0,
...
},

This is very special settings that normal use usually not do,
but new macro do.
We can find this special settings on soc-core.c and fill it as
"dummy DAI" (= asoc_dummy_dlc). By this tric, we can avoid to re-create
dummy dlc and save the memory.

This patch add tric at COMP_DUMMY() and add snd_soc_fill_dummy_dai()
to fill dummy DAI.

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


# 4a6ba09e 17-Nov-2023 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: pcm: Honor subformat when configuring runtime

Subformat options are ignored when setting up hardware parameters and
assigning PCM stream capabilities. Account for them to allow for
granular format selection.

As there is only one user currently (format S32_LE), subformat is
represented by a simple u32 and stores flags only for that one user
alone. Such approach allows for alloc/free-less code until there are
more users on the horizon.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 45cc50d1 12-Nov-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: makes CPU/Codec channel connection map more generic

Current ASoC CPU:Codec = N:M connection is using connection mapping idea,
but it is used for N < M case only. We want to use it for any case.

By this patch, not only N:M connection, but all existing connection
(1:1, 1:N, N:N) will use same connection mapping. Then, because it will
use default mapping, no conversion patch is needed to exising drivers.

More over, CPU:Codec = N:M (N > M) also supported in the same time.

ch_maps array will has CPU/Codec index by this patch.

Image
CPU0 <---> Codec0
CPU1 <-+-> Codec1
CPU2 <-/

ch_map
ch_map[0].cpu = 0 ch_map[0].codec = 0
ch_map[1].cpu = 1 ch_map[1].codec = 1
ch_map[2].cpu = 2 ch_map[2].codec = 1

Link: https://lore.kernel.org/r/87fs6wuszr.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/878r7yqeo4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/87ttpq4f2c.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ad484cc9 26-Sep-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove asoc_xxx() compatible macro

No driver is using asoc_xxx() any more.
This patch removes compatible macro for asoc_xxx().

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


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

ASoC: soc.h: convert asoc_xxx() to snd_soc_xxx()

ASoC is using 2 type of prefix (asoc_xxx() vs snd_soc_xxx()), but there
is no particular reason about that [1].
To reduce confusing, standarding these to snd_soc_xxx() is sensible.

This patch adds asoc_xxx() macro to keep compatible for a while.
It will be removed if all drivers were switched to new style.

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


# 47f56e38 12-Sep-2023 Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: soc-card: Add storage for PCI SSID

Add members to struct snd_soc_card to store the PCI subsystem ID (SSID)
of the soundcard.

The PCI specification provides two registers to store a vendor-specific
SSID that can be read by drivers to uniquely identify a particular
"soundcard". This is defined in the PCI specification to distinguish
products that use the same silicon (and therefore have the same silicon
ID) so that product-specific differences can be applied.

PCI only defines 0xFFFF as an invalid value. 0x0000 is not defined as
invalid. So the usual pattern of zero-filling the struct and then
assuming a zero value unset will not work. A flag is included to
indicate when the SSID information has been filled in.

Unlike DMI information, which has a free-format entirely up to the vendor,
the PCI SSID has a strictly defined format and a registry of vendor IDs.

It is usual in Windows drivers that the SSID is used as the sole identifier
of the specific end-product and the Windows driver contains tables mapping
that to information about the hardware setup, rather than using ACPI
properties.

This SSID is important information for ASoC components that need to apply
hardware-specific configuration on PCI-based systems.

As the SSID is a generic part of the PCI specification and is treated as
identifying the "soundcard", it is reasonable to include this information
in struct snd_soc_card, instead of components inventing their own custom
ways to pass this information around.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230912163207.3498161-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 428cc410 04-Sep-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: soc.h: replace custom COUNT_ARGS() & CONCATENATE() implementations

Replace custom implementation of the macros from args.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20230904111524.1740930-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# dd9f9cc1 28-Sep-2023 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: core: Do not call link_exit() on uninitialized rtd objects

On init we have sequence:

for_each_card_prelinks(card, i, dai_link) {
ret = snd_soc_add_pcm_runtime(card, dai_link);

ret = init_some_other_things(...);
if (ret)
goto probe_end:

for_each_card_rtds(card, rtd) {
ret = soc_init_pcm_runtime(card, rtd);

probe_end:

while on exit:
for_each_card_rtds(card, rtd)
snd_soc_link_exit(rtd);

If init_some_other_things() step fails due to error we end up with
not fully setup rtds and try to call snd_soc_link_exit on them, which
depending on contents on .link_exit handler, can end up dereferencing
NULL pointer.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230929103243.705433-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

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

To use multi Component support, we need to check dai_args whether
Card could get DAI from args (CPU/Codec needs set dai_args on DAI driver).
If it could, we need to allocate dai_args for dlc.
This patch adds snd_soc_copy_dai_args() for 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/87bkgko94e.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>


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

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

To enable multi Component, Card driver need to get DAI via dai_args
to identify it. This patch adds snd_soc_get_dai_via_args() for 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/87edlgo94p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: soc-core.c: enable multi Component

Current ASoC Card is using dlc (snd_soc_dai_link_component) to find
target DAI / Component to be used.
Current dlc has below 3 items to identify DAI / Component

(a) name for Component
(b) of_node for Component
(c) dai_name for DAI

(a) or (b) is used to identify target Component, and (c) is used
to identify DAI.

One of the biggest issue on it today is dlc needs "name matching"
for "dai_name" (c).

It was not a big deal when we were using platform_device, because we
could specify nessesary "dai_name" via its platform_data.

But we need to find DAI name pointer from whole registered datas and/or
each related driver somehow in case of DT, because we can't specify it.
Therefore, Card driver parses DT and assumes the DAI, and find its name
pointer. How to assume is based on each Component and/or Card.

Next biggest issue is Component node (a)/(b).

Basically, Component is registered when CPU/Codec driver was
probed() (X). Here, 1 Component is possible to have some DAIs.

int xxx_probe(struct platform_device *pdev)
{
...
(X) ret = devm_snd_soc_register_component(pdev->dev,
&component_driver,
&dai_driver, dai_driver_num);
...
}

The image of each data will be like below.
One note here is "driver" is included for later explanation.

+-driver------+
|+-component-+|
|| dai0||
|| dai1||
|| ...||
|+-----------+|
+-------------+

The point here is 1 driver has 1 Component, because basically driver
calles snd_soc_register_component() (= X) once.

Here is the very basic CPU/Codec connection image.

HW image SW image
+-- Board ------------+ +-card--------------------------+
|+-----+ +------+| |+-driver------+ +-driver------+|
|| CPU | <--> |CodecA|| ||+-component-+| |+-component-+||
|+-----+ +------+| ||| dai|<=>|dai |||
+---------------------+ ||+-----------+| |+-----------+||
|+-------------+ +-------------+|
+-------------------------------+

It will be very complex if it has multi DAIs.
Here is intuitive easy to understandable HW / SW example.

HW image SW image
+-- Board ---------------+ +-card--------------------------+
|+--------+ +------+| |+-driver------+ +-driver------+|
|| CPU ch0| <--> |CodecA|| ||+-component-+| |+-component-+||
|| | +------+| ||| ch0 dai|<=>|dai |||
|| | +------+| ||| || |+-----------+||
|| ch1| <--> |CodecB|| ||| || +-------------+|
|+--------+ +------+| ||| || +-driver------+|
+------------------------+ ||| || |+-component-+||
||| ch1 dai|<=>|dai |||
||+-----------+| |+-----------+||
|+-------------+ +-------------+|
+-------------------------------+

It will be handled as multi interface as "one Card".

card0,0: CPU-ch0 - CodecA
card0,1: CPU-ch1 - CodecB
^

But, here is the HW image example which will be more complex

+-- Basic Board ---------+
|+--------+ +------+|
|| CPU ch0| <--> |CodecA||
|| ch1| <-+ +------+|
|+--------+ | |
+-------------|----------+
+-- expansion board -----+
| | +------+|
| +->|CodecB||
| +------+|
+------------------------+

We intuitively think we want to handle these as "2 Sound Cards".

card0,0: CPU-ch0 - CodecA
card1,0: CPU-ch1 - CodecB
^

But below image which we can register today doesn't allow it,
because the same Component will be connected to both Card0/1,
but it will be rejected by (Z).

+-driver------+
|+-component-+|
+-card0-------------------------+
||| || +-driver------+|
||| || |+-component-+||
||| ch0 dai|<=>|dai |||
||| || |+-----------+||
||| || +-------------+|
+-------------------------------+
|| ||
+-card1-------------------------+
||| || +-driver------+|
||| || |+-component-+||
||| ch1 dai|<=>|dai |||
||| || |+-----------+||
||| || +-------------+|
+-------------------------------+
|+-----------+|
+-------------+

static int soc_probe_component()
{
...
if (component->card) {
(Z) if (component->card != card) {
dev_err(component->dev, ...);
return -ENODEV;
}
return 0;
}
...
}

So, how about to call snd_soc_register_component() (= X) multiple times
on probe() to avoid buplicated component->card limitation, to be like
below ?

+-driver------+
+-card0-------------------------+
|| | +-driver------+|
||+-component-+| |+-component-+||
||| ch0 dai|<=>|dai |||
||+-----------+| |+-----------+||
|| | +-------------+|
+-------------------------------+
| |
+-card1-------------------------+
|| | +-driver------+|
||+-component-+| |+-component-+||
||| ch1 dai|<=>|dai |||
||+-----------+| |+-----------+||
|| | +-------------+|
+-------------------------------+
+-------------+

Yes, looks good. But unfortunately it doesn't help us for now.
Let's see soc_component_to_node() and snd_soc_is_matching_component()

static struct device_node
*soc_component_to_node(struct snd_soc_component *component)
{
...
(A) of_node = component->dev->of_node;
...
}

static int snd_soc_is_matching_component(...)
{
...
(B) if (dlc->of_node && component_of_node != dlc->of_node)
...
}

dlc checkes "of_node" to identify target component (B),
but this "of_node" came from component->dev (A) which is added
by snd_soc_register_component() (X) on probe().

This means we can have different "component->card", but have same
"component->dev" in this case.

Even though we calls snd_soc_register_component() (= X) multiple times,
all Components have same driver's dev, thus it is impossible to
identified the Component.
And if it was impossible to identify Component, it is impossible to
identify DAI on current implementation.

So, how to handle above complex HW image today is 2 patterns.
One is handles it as "1 big sound card".
The SW image is like below.

SW image
+-card--------------------------+
|+-driver------+ +-driver------+|
||+-component-+| |+-component-+||
||| ch0 dai|<=>|dai |||
||| || |+-----------+||
||| || +-------------+|
||| || +-driver------+|
||| || |+-component-+||
||| ch1 dai|<->|dai |||
||+-----------+| |+-----------+||
|+-------------+ +-------------+|
+-------------------------------+

But the problem is not intuitive.
We want to handle it as "2 Cards".

2nd pattern is like below.

SW image
+-card0-------------------------+
|+-driver------+ +-driver------+|
||+-component-+| |+-component-+||
||| ch0 dai|<=>|dai |||
||+-----------+| |+-----------+||
|+-------------+ +-------------+|
+-------------------------------+

+-card1-------------------------+
|+-driver------+ +-driver------+|
||+-component-+| |+-component-+||
||| ch1 dai|<=>|dai |||
||+-----------+| |+-----------+||
|+-------------+ +-------------+|
+-------------------------------+

It handles as "2 Cards", but CPU part needs to be probed as 2 drivers.
It is also not intuitive.

To solve this issue, we need to have multi Component support.

In current implementation, we need to identify Component first
to identify DAI, and it is using name matching to identify DAI.

But how about to be enable to directly identify DAI by unique way
instead of name matching ? In such case, we can directly identify DAI,
then it can identify Component from DAI.

For example Simple-Card / Audio-Graph-Card case, it is specifying DAI
via its node.

Simple-Card

sound-dai = <&cpu-sound>;

Audio-Graph-Card

dais = <&cpu-sound>;

If each CPU/Codec driver keeps this property when probing,
we can identify DAI directly from Card.
Being able to identify DAI directly means being able to identify its
Component as well even though Component has same dev (= B).

This patch adds new "dai_node" for it.

To keeping compatibility, it checks "dai_node" first if it has,
otherwise, use existing method (name matching).

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


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

ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()

Current snd_soc_of_get_dai_name() doesn't accept index
for #sound-dai-cells. It is not useful for user.
This patch adds it.

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


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

ASoC: soc-core.c: add snd_soc_{of_}get_dlc()

Current soc-core.c has snd_soc_{of_}get_dai_name() to get DAI name
for dlc (snd_soc_dai_link_component). It gets .dai_name, but we need
.of_node too. Therefor user need to arrange.

It will be more useful if it gets both .dai_name and .of_node.
This patch adds snd_soc_{of_}get_dlc() for it, and existing functions
uses it.

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


# 099770e2 08-Jun-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove old trigger ordering method

All drivers switch to use generic trigger ordering method.
Let's remove old method.

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


# 356caf66 08-Jun-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add new trigger ordering method

Current ASoC is assuming that trigger starting order is
Link -> Component -> DAI as default, and its reverse order for stopping.
But some Driver / Card want to reorder it for some reasons.
We have such flags, but is unbalance like below.

struct snd_soc_component_driver :: start_dma_last
struct snd_soc_dai_link :: stop_dma_first

We want to have more flexible, and more generic method.
This patch adds new snd_soc_trigger_order for start/stop at
component / DAI-link.

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


# ac950278 06-Jun-2023 Bard Liao <yung-chuan.liao@linux.intel.com>

ASoC: add N cpus to M codecs dai link support

Currently, ASoC supports dailinks with the following mappings:
1 cpu DAI to N codec DAIs
N cpu DAIs to N codec DAIs
But the mapping between N cpu DAIs and M codec DAIs is not supported.
The reason is that we didn't have a mechanism to map cpu and codec DAIs

This patch suggests a new snd_soc_dai_link_codec_ch_map struct in
struct snd_soc_dai_link{} which provides codec DAI to cpu DAI mapping
information used to implement N cpu DAIs to M codec DAIs
support.

When a dailink contains two or more cpu DAIs, we should set channel
number of cpus based on its channel mask. The new struct also provides
channel mask information for each codec and we can construct the cpu
channel mask by combining all codec channel masks which map to the cpu.

The N:M mapping is however restricted to the N <= M case due to physical
restrictions on a time-multiplexed bus such as I2S/TDM, AC97, SoundWire
and HDaudio.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230607031242.1032060-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1c943f60 31-May-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_get_stream_cpu()

We are using get_stream_cpu() to get CPU stream which cares
Codec2Codec. But it is static function for now, and we want to use it
from other files. This patch makes it global function.

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


# b9aa53fb 31-May-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: remove snd_soc_compr_ops :: trigger

ASoC framework is not using trigger call-back for snd_soc_compr_ops.
This patch remove it.

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


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

ASoC: soc-utils.c: add asoc_dummy_dlc

ASoC uses dummy Component, sharing snd_soc_dai_link_component
for it is better idea. This patch adds it.

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


# 38e42f6d 05-Apr-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: expand snd_soc_dpcm_mutex_lock/unlock()

soc-pcm.c has snd_soc_dpcm_mutex_lock/unlock(),
but other files can't use it because it is static function.

It requests snd_soc_pcm_runtime as parameter (A), but sometimes we
want to use it by snd_soc_card (B).

(A) static inline void snd_soc_dpcm_mutex_lock(struct snd_soc_pcm_runtime *rtd)
{
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
} ^^^^^^^^^

(B) mutex_lock_nested(&card->pcm_mutex, card->pcm_subclass);
^^^^

We want to use it with both "rtd" and "card" for dapm lock/unlock.
To enable it, this patch uses _Generic macro.

This patch makes snd_soc_dpcm_mutex_{un}lock() global function, and use it on
each files.

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


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

ASoC: expand snd_soc_dapm_mutex_lock/unlock()

soc.h has snd_soc_dapm_mutex_lock/unlock() definition and
many drivers are using it, but soc-dapm.c is not.

1st reason is snd_soc_dapm_mutex_lock/unlock() requests
snd_soc_dapm_context pointer as parameter (A), but sometimes soc-dapm.c
needs to use snd_soc_card (B).

(A) static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
{
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
} ^^^^^^^^^^

(B) mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
^^^^

2nd reason is it want to use SND_SOC_DAPM_CLASS_INIT for mutex_lock_nested(),
but helper is using _RUNTIME (A).

The conclusion is we want to use "dapm vs card" and "_RUNTIME vs _INIT"
for dapm lock/unlock. To enable this selfish request, this patch uses
_Generic macro. We can use snd_soc_dapm_mutex_lock/unlock() for both
dapm and card case.

snd_soc_dapm_mutex_lock(dapm); snd_soc_dapm_mutex_unlock(dapm);
snd_soc_dapm_mutex_lock(card); snd_soc_dapm_mutex_unlock(card);

Current soc-dapm.c is using both mutex_lock() and mutex_lock_nested().
This patch handles mutex_lock() as mutex_lock_nested(..., 0),
in other words, handles below as same.

mutex_lock(&card->dapm_mutex);
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);

Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_dapm_mutex_lock_root() for it.

This patch also moves snd_soc_dapm_subclass definition from soc-dapm.h
to soc.h to keep related code together.

Because very complex soc.h vs soc-dapm.h relationship,
it is difficult/impossible to define these helper into soc-dapm.h.

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


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

ASoC: soc.h: remove unused params/num_params

No drivers are using params/num_params any more.
Let's remove these.

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


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

ASoC: soc.h: clarify Codec2Codec params

snd_soc_dai_link has params/num_params, but it is unclear that
params for what. This patch clarify it is params for Codec2Codec.

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


# ffaf886e 26-Mar-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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

Current ASoC supports snd_soc_add_pcm_runtime(), but user need to
call it one-by-one if it has multi dai_links.
This patch adds snd_soc_add_pcm_runtimes() which supports multi
dai_links.

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


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

ASoC: soc.h: add snd_soc_card_is_instantiated() helper

ASoC framework/driver checks whether card was instantiated every
where. Then, it should check card pointer too in such case.
This patch adds snd_soc_card_is_instantiated() for it.

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


# 3289dc02 20-Sep-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: use array instead of playback/capture_widget

snd_soc_pcm_runtime has playback/capture_widget for Codec2Coddec.
The naming is unclear.
This patch names it as c2c_widget and uses array.

struct snd_soc_pcm_runtime {
...
=> struct snd_soc_dapm_widget *playback_widget;
=> struct snd_soc_dapm_widget *capture_widget;
...
}

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


# a26ec2ac 20-Sep-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: use defined number instead of direct number

snd_soc_pcm_runtime has dpcm for Playback/Capture, but it is defined
directly "2". It should use defined number.

struct snd_soc_pcm_runtime {
...
=> struct snd_soc_dpcm_runtime dpcm[2];
...
}

This patch fixup it.

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


# 3989ade2 20-Sep-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: remove num_cpus/codecs

Current rtd has both dai_link pointer (A) and num_cpus/codecs (B).

(A) rtd->dai_link = dai_link;
(B) rtd->num_cpus = dai_link->num_cpus;
(B) rtd->num_codecs = dai_link->num_codecs;

But, we can get num_cpus/codecs (B) via dai_link (A).
This means we don't need to keep num_cpus/codecs on rtd.
This patch removes these.

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


# 26bdcc4b 16-Aug-2022 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ASoC: core: remove setting platform_max in kcontrol macros

platform_max should not be set by the driver, its intended for machine drivers
or DT to override the max value for platform specific reasons.

So remove setting this from Kcontrol macros.

Setting this to max in these macros would limit the range when min
value is less then zero.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220816172129.6661-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1892a991 21-Jun-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ASoC: core: Make snd_soc_unregister_card() return void

The function snd_soc_unregister_card() returned 0 unconditionally and most
callers don't care to check the return value. Make it return void and
adapt the callers that didn't ignore the return value before.

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/20220621145834.198519-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6b183919 21-Jun-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: core: Add new SOC_DOUBLE_SX_TLV macro

Currently macros only exist for SX style (implicit sign bit 2's
compliment) volume controls where the volumes for left and right
are in separate registers. Some future Cirrus devices will have
both volumes in the same register, as such add a new macro to
support this.

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


# 81eef68f 10-Jun-2022 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: Remove unused hw_write_t type

Commit 81da8a0b7975 ("ASoC: remove codec hw_write/control_data") removed
use of hw_write_t in struct snd_soc_codec, but it left type definition.
Fully clean it up.

Fixes: 81da8a0b7975 ("ASoC: remove codec hw_write/control_data")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220610124420.4160986-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# df4d27b1 06-Jun-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: Introduce 'fixup_controls' card method

The new method is called just before the card is registered, providing
an opportune time for machine-level drivers to do some final controls
amending: deactivating individual controls or obtaining control
references for later use.

Some controls can be created by DAPM after 'late_probe' has been called,
hence the need for this new method.

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


# 12abc4d1 10-Jun-2022 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: Remove unused hw_write_t type

Commit 81da8a0b7975 ("ASoC: remove codec hw_write/control_data") removed
use of hw_write_t in struct snd_soc_codec, but it left type definition.
Fully clean it up.

Fixes: 81da8a0b7975 ("ASoC: remove codec hw_write/control_data")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220610124420.4160986-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 64c917d1 13-May-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: core: Correct spelling fliped -> flipped

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


# 5349c0c9 25-Apr-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: soc.h: Add SOC_SINGLE_S_EXT_TLV macro

Add a SOC_SINGLE_S_EXT_TLV macro as a convenience wrapper
around SOC_DOUBLE_R_S_EXT_TLV for mono volume controls.

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


# cf51406c 25-Apr-2022 Simon Trimmer <simont@opensource.cirrus.com>

ASoC: soc.h: Introduce SOC_DOUBLE_R_S_EXT_TLV() macro

A straightforward extension of the SOC_DOUBLE_R_S_TLV() macro that
allows the get and put functions to be customised.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220425125012.3044919-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1ef34dd2 05-Apr-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: soc-utils: Add helper to calculate BCLK from TDM info

Add a helper function snd_soc_tdm_params_to_bclk() to calculate
the bclk from params info and the tdm sots configuration.

When using a TDM frame of N slots of width W bits:

bclk = sample_rate * N * W

As a convenience to simplify calling code, if the slot count or
slot width are 0 a value will be obtained from the params. This
allows calling code to use this one function to handle cases of
TDM where only one parameter is fixed, or I2S where the slot width
is fixed (for example to set a 32-bit slot for 24-bit samples).

Also as a convenience the slot count can optionally be rounded up
to a multiple. This is mainly useful for I2S systems, since I2S has
two phases of LRCLK the number of slots is always a multiple of 2.

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


# bc8cb029 05-Apr-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

ASoC: soc.h: Add SOC_SINGLE_S_TLV() macro

Add a convenience macro for defining a single (mono) TLV control
with a signed value. This can already be done by using
SOC_DOUBLE_R_S_TLV() with the same address for left and right
registers, but a dedicated macro is more readable.

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


# 900dedd7 30-Mar-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: Introduce snd_soc_of_get_dai_link_cpus

This function is an analogue of snd_soc_of_get_dai_link_codecs to help
machine drivers read CPU DAI lists from devicetrees.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220331000449.41062-5-povik+lin@cutebit.org
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>


# b7898396 07-Dec-2021 Takashi Iwai <tiwai@suse.de>

ASoC: soc-pcm: Fix and cleanup DPCM locking

The existing locking for DPCM has several issues
a) a confusing mix of card->mutex and card->pcm_mutex.
b) a dpcm_lock spinlock added inconsistently and on paths that could
be recursively taken. The use of irqsave/irqrestore was also overkill.

The suggested model is:

1) The pcm_mutex is the top-most protection of BE links in the FE. The
pcm_mutex is applied always on either the top PCM callbacks or the
external call from DAPM, not taken in the internal functions.

2) the FE stream lock is taken in higher levels before invoking
dpcm_be_dai_trigger()

3) when adding and deleting a BE, both the pcm_mutex and FE stream
lock are taken.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[clarification of commit message by plbossart]
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 59dd33f8 16-Jul-2021 Vijendar Mukunda <vijendar.mukunda@amd.com>

ASoC: soc-pcm: add a flag to reverse the stop sequence

On stream stop, currently CPU DAI stop sequence invoked first
followed by DMA. For Few platforms, it is required to stop the
DMA first before stopping CPU DAI.

Introduced new flag in dai_link structure for reordering stop sequence.
Based on flag check, ASoC core will re-order the stop sequence.

Fixes: 4378f1fbe92405 ("ASoC: soc-pcm: Use different sequence for start/stop trigger")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20210716123015.15697-1-vijendar.mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: soc-core: remove snd_soc_of_parse_daifmt()

No driver is using snd_soc_of_parse_daifmt().
This patch removes it.

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


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

ASoC: soc-core: add snd_soc_daifmt_parse_format/clock_provider()

snd_soc_of_parse_daifmt() parses daifmt, but bitclock/frame provider
parsing part is one of headacke, because we are assuming below both cases.

A) node {
bitclock-master;
frame-master;
...
};

B) link {
bitclock-master = <&xxx>;
frame-master = <&xxx>;
...
};

The original was style A), and style B) was added later
by commit b3ca11ff59bc ("ASoC: simple-card: Move dai-link level
properties away from dai subnodes").

snd_soc_of_parse_daifmt() parses it as style A),
and user need to update it to style B) if needed.

To handle it more flexibile, this patch adds new functions
which separates snd_soc_of_parse_daifmt() helper function.

snd_soc_daifmt_parse_format() :for DAI format
snd_soc_daifmt_parse_clock_provider_as_flag() :for style A)
snd_soc_daifmt_parse_clock_provider_as_phandl() :for style B)
snd_soc_daifmt_parse_clock_provider_as_bitmap() :use with _from_bitmap

This means

snd_soc_of_parse_daifmt() ==
snd_soc_daifmt_parse_format() |
snd_soc_daifmt_parse_clock_provider_as_flag()

This patch also indicate relatesionship comment for
snd_soc_daifmt_clock_provider_from_bitmap().

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


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

ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped()

Sometimes we want to get CLOCK_PROVIDER fliped dai_fmt.
This patch adds new snd_soc_daifmt_clock_provider_fliped() for it.

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


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

ASoC: soc-core: add snd_soc_daifmt_clock_provider_from_bitmap()

This patch adds snd_soc_daifmt_clock_provider_from_bitmap() function
to judge clock/frame master from its bitmap.
This is prepare for snd_soc_of_parse_daifmt() cleanup.

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


# d908b922 21-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: return error if multi platform at snd_soc_fixup_dai_links_platform_name()

snd_soc_fixup_dai_links_platform_name() is assuming it is single platform.
return error if multi platforms.

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


# 4a50724e 21-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: fixup return timing for snd_soc_fixup_dai_links_platform_name()

Current snd_soc_fixup_dai_links_platform_name() creates name first (A),
and checks setup target pointer (B), and set it (C).
We should check target pointer first IMO.
This patch exchange the order to (B) -> (A) -> (C).

int snd_soc_fixup_dai_links_platform_name(...)
{
...
/* set platform name for each dailink */
for_each_card_prelinks(card, i, dai_link) {
(A) name = devm_kstrdup(...);
if (!name)
return -ENOMEM;

(B) if (!dai_link->platforms)
return -EINVAL;

/* only single platform is supported for now */
(C) dai_link->platforms->name = name;
}

return 0;
}

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


# 4da40cb9 21-Mar-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: add asoc_link_to_cpu/codec/platform() macro

We shouldn't use dai_link->cpus/codecs/platforms directly,
because these are array now to supporting multi CPU/Codec/Platform.
This patch adds asoc_link_to_xxx() macro for it.

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


# 933f98be 21-Feb-2021 Krzysztof Kozlowski <krzk@kernel.org>

ASoC: constify of_phandle_args in snd_soc_get_dai_name()

The pointer to of_phandle_args passed to snd_soc_get_dai_name() and
of_xlate_dai_name() implementations is not modified. Since it is being
used only to translate passed OF node to a DAI name, it should not be
modified, so mark it as const for correctness and safer code.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210221153024.453583-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# f14654dd 14-Jan-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: sync parameter naming : rate / sample_bits

snd_pcm_runtime / snd_soc_dai / snd_soc_dai_driver / snd_soc_dai_link
have related parameter which is similar but not same naming.

struct snd_pcm_runtime {
...
(A) unsigned int rate;
...
(B) unsigned int sample_bits;
...
};

struct snd_soc_dai {
...
(A) unsigned int rate;
(B) unsigned int sample_bits;
...
};

struct snd_soc_dai_driver {
...
(A) unsigned int symmetric_rates:1;
(B) unsigned int symmetric_samplebits:1;
...
};

struct snd_soc_dai_link {
...
(A) unsigned int symmetric_rates:1;
(B) unsigned int symmetric_samplebits:1;
...
};

Because it is similar but not same naming rule,
code can be verbose / can't share macro.

This patch sync naming rule for framework.
- xxx_rates;
+ xxx_rate;

- xxx_samplebits;
+ xxx_sample_bits;

old name will be removed if all drivers were switched
to new naming rule.

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


# 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_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>


# ddfbe828 29-Nov-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add soc-jack.h

ALSA SoC has soc-jack.c, but doesn't have soc-jack.h.
This patch creates new soc-jack.h and moves snd_soc_jack_xxx()
from soc.h.

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


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

ASoC: soc-component: add mark for snd_soc_link_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 3) snd_soc_link_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/87k0ui5iwf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# aa293777 02-Nov-2020 Sameer Pujar <spujar@nvidia.com>

ASoC: soc-pcm: Get all BEs along DAPM path

dpcm_end_walk_at_be() stops the graph walk when first BE is found for
the given FE component. In a component model we may want to connect
multiple DAIs from different components. A new flag is introduced in
'snd_soc_card', which when set allows DAI/component chaining. Later
PCM operations can be called for all these listed components for a
valid DAPM path.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1604329814-24779-3-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4662c596 28-Sep-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-pcm: add soc_pcm_hw_clean() and call it from soc_pcm_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()

Now, 1) to 3) are handled.
This patch adds new soc_pcm_hw_clean() and call it from
soc_pcm_hw_params() as rollback, and from soc_pcm_hw_free() as
normal close handler.

Other difference is that soc_pcm_hw_free() handles digital mute
if it was last user. Rollback also handles it by this patch.

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


# 918ad772 28-Sep-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-link: add mark for snd_soc_link_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 1) snd_soc_link_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 ist 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/87lfgtgqba.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5560d8c6 28-Sep-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: remove for_each_rtd_dais_rollback()

commit 140a4532cdb8 ("ASoC: soc-pcm: add soc_pcm_clean() and call it
from soc_pcm_open/close()") uses soc_pcm_clean() and then
for_each_rtd_dais_rollback() is no longer used.
This patch removes it.

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


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

ASoC: soc-link: add mark for snd_soc_link_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 2) snd_soc_link_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/87k0webwnv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 20244b2a 07-Sep-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: core: Do not cleanup uninitialized dais on soc_pcm_open failure

Introduce for_each_rtd_dais_rollback macro which behaves exactly like
for_each_codec_dais_rollback and its cpu_dais equivalent but for all
dais instead.

Use newly added macro to fix soc_pcm_open error path and prevent
uninitialized dais from being cleaned-up.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Fixes: 5d9fa03e6c35 ("ASoC: soc-pcm: tidyup soc_pcm_open() order")
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200907111939.16169-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 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_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>


# 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_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>


# 1ae0965d 31-Jul-2020 Stephan Gerhold <stephan@gerhold.net>

ASoC: core: Add common helper to parse aux devs from device tree

simple-card.c and meson-card-utils.c use pretty much the same
helper function to parse auxiliary devices from the device tree.

Make it easier for other drivers to parse these from the device tree
as well by adding a shared helper function to soc-core.c.

snd_soc_of_parse_aux_devs() is pretty much a copy of
meson_card_add_aux_devices() from meson-card-utils.c
with two minor changes:

- Make property name configurable as parameter
- Change dev_err() message slightly for consistency with other
error messages in soc-core.c

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20200801100257.22658-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# ea029dd8 31-Jul-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: core: Two step component registration

Modify snd_soc_add_component so it calls snd_soc_component_initialize
no longer and thus providing true two-step registration. Drivers may
choose to change component's fields before actually adding it to ASoC
subsystem.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200731144146.6678-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7274d4cd 31-Jul-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: core: Simplify snd_soc_component_initialize declaration

Move 'name' field initialization responsibility back to
snd_soc_component_initialize to prepare snd_soc_add_component function
for being called separatelly as a second registration step.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200731144146.6678-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 08ff7209 31-Jul-2020 Cezary Rojewski <cezary.rojewski@intel.com>

ASoC: core: Relocate and expose snd_soc_component_initialize

To allow for two-step component registration, expose
snd_soc_component_initialize function and move it back to soc-core.c.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200731144146.6678-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 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_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>


# 58f30150f 07-Jul-2020 Maxime Ripard <maxime@cerno.tech>

ASoC: core: Remove only the registered component in devm functions

The ASoC devm_ functions that register a component
(devm_snd_soc_register_component and devm_snd_dmaengine_pcm_register) will
clean their component by running snd_soc_unregister_component.

snd_soc_unregister_component will then remove all the components for the
device that was used to register the component in the first place.

However, some drivers register several components (such as a DAI and a
dmaengine PCM) on the same device, and if the dmaengine PCM is registered
first, then the DAI will be cleaned up first and
snd_dmaengine_pcm_unregister will be called next.

snd_dmaengine_pcm_unregister will then lookup the dmaengine PCM component
on the device, and if there's one unregister that component and release its
dmaengine channels. That doesn't happen in practice though since the first
call to snd_soc_unregister_component removed all the components, so we
never get the chance to release the dmaengine channels.

In order to fix this, instead of removing all the components for a given
device, we can simply remove the component that was registered in the first
place. We should have the same number of component registration than we
have components, so it should work just fine.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20200707074237.287171-1-maxime@cerno.tech
Signed-off-by: Mark Brown <broonie@kernel.org>


# 10e83409 25-Jun-2020 Tzung-Bi Shih <tzungbi@google.com>

ASoC: core: move definition of enum snd_soc_bias_level

To fix compilation error:

- error: field 'XXX' has incomplete type

Moves definition of enum snd_soc_bias_level from soc.h to soc-dapm.h.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200625153543.85039-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 21a00fb3 22-Jun-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: soc-link: introduce exit() callback

Some machine drivers allocate or request resources with
snd_soc_link_init() phase of the card probe. These resources need to
be properly released when removing a card, and this patch suggests a
dual exit() callback.

The exit() is invoked in soc_remove_pcm_runtime(), which is not
completely symmetric with the init() invoked in soc_init_pcm_runtime().

Alternate solutions were considered, e.g. adding a .remove() callback
for the platform driver, but that's not symmetrical at all and would
be difficult to handle if there are more than one dailink implementing
an .init(). We looked also into using .remove_dai_link() callback, but
that would also be imbalanced.

Note that because of the error handling in snd_soc_bind_card(), which
jumps to probe_end, there is no way to guarantee the exit() is invoked
with resources allocated in the init(). Prior to releasing those
resources, implementations of the exit() callback shall check the
resources are valid.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Curtis Malainey <curtis@malainey.com>
Link: https://lore.kernel.org/r/20200622154241.29053-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0fae253a 12-Jun-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: soc-devres: add devm_snd_soc_register_dai()

The registration of DAIs may be done at two distinct times, once
during a component registration and later when loading a
topology. Since devm_ managed resources are freed in the reverse order
they were allocated, when a component starts unregistering DAIs by
walking through the DAI list, the memory allocated for the
topology-registered DAIs was freed already, which leads to 100%
reproducible KASAN use-after-free reports.

This patch suggests a new devm_ function to force the DAI list to be
updated prior to freeing the memory chunks referenced by the list
pointers.

Suggested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
BugLink: https://github.com/thesofproject/linux/issues/2186
Link: https://lore.kernel.org/r/20200612205938.26415-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6fbea6b6 12-Jun-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: soc-card: export snd_soc_lookup_component_nolocked

snd_soc_lookup_component_nolocked can be used for the DPCM case
that Front-End needs to get the unused platform component but
added by Back-End cpu dai driver.

If the component is gotten, then we can get the dma chan created
by Back-End component and reused it in Front-End.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/55f6e0d76f67a517b9a44136d790ff2a06b5caa8.1591947428.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 27f07cac 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-card: add probed bit field to snd_soc_card

We already have bit field to control snd_soc_card.
Let's add "probed" field on it instead of local variable.

One note here is that soc_cleanup_card_resources()
will be called as (A) formal cleanup or as (B) error handling,
thus, it needs to distinguish these.

In (A) case, card will have "instantiated" flag if all probe
callback functions were called without error.
Thus, snd_soc_unbind_card() is using it to judging card was probed.
But this this patch removes it, because it is no longer needed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87r1v4zv36.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# bf5bb8db 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-card: move snd_soc_card_subclass to soc-card

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874ks025jn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 65a75718 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/875zcg25jv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 63efed58 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/877dww25k4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3359e9b6 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-card: move snd_soc_card_jack_new() to soc-card

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/878shc25kc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 209c6cdf 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a71s25kj.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1793936b 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add soc-card.c

Current ALSA SoC has some snd_soc_card_xxx() functions,
and card->xxx() callbacks.
But, it is implemented randomly at random place.

To collect all card related functions into one place,
this patch creats new soc-card.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87blm825kt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 317ec675 27-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: convert bool to bit field for snd_soc_card

snd_soc_card has many bool, but it can be bit field.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87d06o25l2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f4aa5e21 26-May-2020 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: dapm: Move dai_link widgets to runtime to fix use after free

The newly added CODEC to CODEC DAI link widget pointers in
snd_soc_dai_link are better placed in snd_soc_pcm_runtime.
snd_soc_dai_link is really intended for static configuration of
the DAI, and the runtime for dynamic data. The snd_soc_dai_link
structures are not destroyed if the card is unbound. The widgets
are cleared up on unbind, however if the card is rebound as the
snd_soc_dai_link structures are reused these pointers will be left at
their old values, causing access to freed memory.

Fixes: 595571cca4de ("ASoC: dapm: Fix regression introducing multiple copies of DAI widgets")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200526161930.30759-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d9051d86 14-May-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro

snd_soc_runtime_activate()/deactivate() are implemented by global function
which are just calling snd_soc_runtime_action().
We can replace it to macro, and this patch do it.
This patch is prepare for xxx_active cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87blmq6n4y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2d6201ee 07-May-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

ASoC: soc-core: Replace zero-length array with flexible-array

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
int stuff;
struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507192228.GA16355@embeddedor
Signed-off-by: Mark Brown <broonie@kernel.org>


# be16a0f0 28-Apr-2020 Arnd Bergmann <arnd@arndb.de>

ASoC: component: suppress uninitialized-variable warning

Old versions of gcc (tested on gcc-4.8) produce a warning for
correct code:

sound/soc/soc-compress.c: In function 'soc_compr_open':
sound/soc/soc-compress.c:75:28: error: 'component' is used uninitialized in this function [-Werror=uninitialized]
struct snd_soc_component *component, *save = NULL;

Change the for_each_rtd_components() macro to ensure 'component'
gets initialized to a value the compiler does not complain about.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200428214754.3925368-1-arnd@arndb.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4aa86e05 22-Apr-2020 Jason Yan <yanaijie@huawei.com>

ASoC: soc-core: return true, false in snd_soc_volsw_is_stereo()

Fix the following coccicheck warning:

include/sound/soc.h:1271:9-10: WARNING: return of 0/1 in function
'snd_soc_volsw_is_stereo' with return type bool

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Link: https://lore.kernel.org/r/20200422071805.48793-1-yanaijie@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1729025b 29-Mar-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove cpu_dai/codec_dai/cpu_dais/codec_dais

No-one is using cpu_dai/codec_dai/cpu_dais/codec_dais.
Let's remove these from snd_soc_pcm_runtime

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/87eetabok4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c2233a26 29-Mar-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc: 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/87imimboli.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 595571cc 09-Apr-2020 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: dapm: Fix regression introducing multiple copies of DAI widgets

Refactoring was done to factor out the linking of DAI widgets into
a helper function, dapm_add_valid_dai_widget. However when this was
done, a regression was introduced for CODEC to CODEC links. It was
over looked that the playback and capture variables persisted across
all CODEC DAIs being processed, which ensured that the special DAI
widget that is added for CODEC to CODEC links was only created once.
This bug causes kernel panics during DAPM shutdown.

To stick with the spirit of the original refactoring whilst fixing the
issue, variables to hold the DAI widgets are added to snd_soc_dai_link.
Furthermore the dapm_add_valid_dai_widget function is renamed to
dapm_connect_dai_pair, the function only adds DAI widgets in the CODEC
to CODEC case and its primary job is to add routes connecting two DAI
widgets, making the original name quite misleading.

Fixes: 6c4b13b51aa3 ("ASoC: Add dapm_add_valid_dai_widget helper")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200409181209.30130-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: soc-core: add asoc_rtd_to_cpu/codec() macro

Now, snd_soc_pcm_runtime supports multi cpu_dai/codec_dai.
It still has cpu_dai/codec_dai for single DAI,
and has cpu_dais/codec_dais for multi DAIs.

dais = [][][][][][][][][][][][][][][][][][]
^cpu_dais ^codec_dais
|--- num_cpus ---|--- num_codecs --|

/* for multi DAIs */
rtd->cpu_dais = &rtd->dais[0];
rtd->codec_dais = &rtd->dais[dai_link->num_cpus];

/* for single DAI */
rtd->cpu_dai = rtd->cpu_dais[0];
rtd->codec_dai = rtd->codec_dais[0];

But, these can be replaced by dais.
This patch adds asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for it.

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/875zevk5va.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: soc-core: Merge CPU/Codec DAIs

ALSA SoC is currently categorizing CPU/Codec DAIs,
and it works well.

But modern devices require more complex connections,
for example Codec to Codec, etc, and future devices will
enable to more complex connections.
Because of these background, CPU/Codec DAIs categorizing is
no longer good much to modern device.

Currently, rtd has both CPU/Codec DAIs pointer.

rtd->cpu_dais = [][][][][][][][][]
rtd->codec_dais = [][][][][][][][][]

This patch merges these into DAIs pointer.

rtd->dais = [][][][][][][][][][][][][][][][][][]
^cpu_dais ^codec_dais
|--- num_cpus ---|--- num_codecs --|

Then, we can merge for_each_rtd_cpu/codec_dais() from this patch.

- for_each_rtd_cpu_dais() {
- ...
- }
- for_each_rtd_codec_dais() {
- ...
- }
+ for_each_rtd_dais() {
+ ...
+ }

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


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

ASoC: soc-dapm: add for_each_card_widgets() macro

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

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


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

ASoC: soc-dapm: add for_each_card_dapms() macro

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

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


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

ASoC: soc.h: remove non plural form for_each_xxx macro

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


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

ASoC: soc.h: add for_each_rtd_codecs/cpus_dai() macro

We are using plural form for for_each_xxx() macro.
But, for_each_rtd_codec/cpu_dai() are out of this rule.
This patch adds plural form macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/8736aii326.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a22ae72b 09-Mar-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: soc-core: disable route checks for legacy devices

v5.4 changes in soc-core tightened the checks on soc_dapm_add_routes,
which results in the ASoC card probe failing.

Introduce a flag to be set in machine drivers to prevent the probe
from stopping in case of incomplete topologies or missing routes. This
flag is for backwards compatibility only and shall not be used for
newer machine drivers.

Example with an HDaudio card with a bad topology:

[ 236.177898] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to
add route iDisp1_out -> direct -> iDisp1 Tx

[ 236.177902] skl_hda_dsp_generic skl_hda_dsp_generic:
snd_soc_bind_card: snd_soc_dapm_add_routes failed: -19

with the disable_route_checks set:

[ 64.031657] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to
add route iDisp1_out -> direct -> iDisp1 Tx

[ 64.031661] skl_hda_dsp_generic skl_hda_dsp_generic:
snd_soc_bind_card: disable_route_checks set, ignoring errors on
add_routes

Fixes: daa480bde6b3a9 ("ASoC: soc-core: tidyup for snd_soc_dapm_add_routes()")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200309192744.18380-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5854a464 04-Mar-2020 Samuel Holland <samuel@sholland.org>

ASoC: pcm: Export parameter intersection logic

The logic to calculate the subset of stream parameters supported by all
DAIs associated with a PCM stream is nontrivial. Export a helper
function so it can be used to set up simple codec2codec DAI links.

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


# 76afa643 25-Feb-2020 Shreyas NC <shreyas.nc@intel.com>

ASoC: Add initial support for multiple CPU DAIs

ASoC core supports multiple codec DAIs but supports only a CPU DAI.
To support multiple cpu DAIs, add cpu_dai and num_cpu_dai in
snd_soc_dai_link and snd_soc_pcm_runtime structures similar to
support for codec_dai. This is intended as a preparatory patch to
eventually support the unification of the Codec and CPU DAI.

Inline with multiple codec DAI approach, add support to allocate,
init, bind and probe multiple cpu_dai on init if driver specifies
that. Also add support to loop over multiple cpu_dai during
suspend and resume.

This is intended as a preparatory patch to eventually unify the CPU
and Codec DAI into DAI components.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Link: https://lore.kernel.org/r/20200225133917.21314-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 63d68382 19-Feb-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: soc-core: fix for_rtd_codec_dai_rollback() macro

The use of parentheses to protect the argument is fine for (i)++ but
not for (--i).

Fixes: 83f94a2e293d61 ("ASoC: soc-core: add snd_soc_close_delayed_work()")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200219222130.29933-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 83f94a2e 09-Jan-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_close_delayed_work()

We need to setup rtd->close_delayed_work_func.
It will be set at snd_soc_dai_compress_new() or soc_new_pcm().
But these setups close_delayed_work() which is same name /
same implemantaion, but different local code.
To reduce duplicate code, this patch moves it as
snd_soc_close_delayed_work() and share same code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/8736cot4v2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 613fb500 09-Jan-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove snd_soc_rtdcom_list

Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.

struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};

struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};

The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()

int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...

/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...

/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}

}

It shows, it is possible to know how many components will be
connected to rtd by using

dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms

If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ee8f537f 12-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove legacy style of codec_conf

Now all driver is using snd_soc_dai_link_component for codec_conf.
Let's remove legacy style

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871rt959ic.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c13493a2 12-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: support snd_soc_dai_link_component for codec_conf

To find codec_conf component, it is using dev_name, of_node.
But, we already has this kind of finding component method by
snd_soc_dai_link_component, and snd_soc_is_matching_component().
We shouldn't have duplicate implementation to do same things.
This patch adds snd_soc_dai_link_component support to find
codec_conf component.

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


# 01fec8cc 10-Dec-2019 Takashi Iwai <tiwai@suse.de>

ASoC: Drop snd_soc_pcm_lib_ioctl()

Now all snd_soc_pcm_lib_ioctl() calls were dropped, and it became
superfluous. Let's kill it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210145406.21419-24-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8a6a6a38 10-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: tidyup for CONFIG_DMI

soc-core.c has 2 #ifdef CONFIG_DMI, but we can merge these.
OTOH, soc.h has dmi_longname, but it is needed if CONFIG_DMI was defined.
In other words, It is not needed if CONFIG_DMI was not defined.
This patch tidyup these.

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


# 50cd9b53 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: rename snd_soc_remove_dai_link() to snd_soc_remove_pcm_runtime()

Now soc-core and soc-topology is using snd_soc_remove_dai_link().
It removes pcm_runtime (= rtd) and disconnect it from card.
The purpose is removing pcm_runtime, not dai_link.
This patch renames function name.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/875zipyq5s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0c048004 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: rename snd_soc_add_dai_link() to snd_soc_add_pcm_runtime()

Now soc-core and soc-topology is using snd_soc_add_dai_link().
The abstract of this function is "create pcm_runtime from
dai_link information and connect it to card".
Thus, "add dai_link" is wrong/confusable naming.
This patch renames function name.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/877e35yq5w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d6f31e0e 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: move snd_soc_find_dai_link()

snd_soc_find_dai_link() is soc-topology specific function.
We don't need to have it at soc-core.
This patch moves it to soc-topology.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/878snlyq61.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4468189f 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: find rtd via dai_link pointer at snd_soc_get_pcm_runtime()

Current snd_soc_get_pcm_runtime() is finding rtd by checking dai_link
name. But, it is strange and waste of CPU power, because its user want
to get from rtd from dai_link, not from dai_link name.
This patch find rtd via dai_link pointer instead of its name.

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


# 8babfb70 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove snd_soc_get_dai_substream()

No driver is using snd_soc_get_dai_substream(),
and snd_soc_get_pcm_runtime() is enough for such purpose.
We can revival it if it was needed in the future.
Let's remove unused function.

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


# cc733900 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove dai_link_list

ASoC is using many lists.
Now, used dai_link is listed to card as dai_link_list.

[card]->[dai_link]->[dai_link]->...

BTW, this "dai_link" is used to create "rtd".
And this rtd is listed to card as rtd_list.

[card]->[rtd]->[rtd]->...

Here, each rtd has dai_link. This means, we can track all dai_link via
rtd list. This patch removes card dai_link_list, and uses rtd_list
instead of it.

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


# 4bf2e385 03-Dec-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: core: Init pcm runtime work early to avoid warnings

There are cases where we fail before we reach soc_new_pcm which would
init the workqueue. When we fail we attempt to flush the queue which
generates warnings from the workqueue subsystem when we have not inited
the queue. Solution is to use a proxy function to get around this issue.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191203173007.46504-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# fb512677 19-Nov-2019 Tzung-Bi Shih <tzungbi@google.com>

ASoC: core: add SND_SOC_BYTES_E

Add SND_SOC_BYTES_E to accept getter and putter.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191120060844.224607-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# dc73d73a 19-Nov-2019 Jaroslav Kysela <perex@perex.cz>

ASoC: add control components management

This ASCII string can carry additional information about
soundcard components or configuration. Add the possibility
to set this string via the ASoC card.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20191119174933.25526-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>


# 509ba54f 04-Nov-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY

snd_soc_dobj is used only when SND_SOC_TOPOLOGY was selected.
Let's enable it under SND_SOC_TOPOLOGY.

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


# e443c205 04-Nov-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() at snd_soc_register_dai()

ALSA SoC has 2 functions.
snd_soc_register_dai() is used from topology
snd_soc_register_dais() is used from snd_soc_add_component()

In general, people think like _dai() is called from _dais()
with for loop. But in reality, these are very similar
but different implementation.
We shouldn't have duplicated and confusing implementation.

snd_soc_register_dai() is now used from topology.
But to reduce duplicated code, it should be used from _dais(), too.

Because of topology side specific reason,
it is calling snd_soc_dapm_new_dai_widgets(),
but it is not needed _dais() side.

This patch factorizes snd_soc_register_dai() to
topology / _dais() common part, and topology specific part.
And do topology specific part at soc-topology.

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


# 5d075197 04-Nov-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai()

ALSA SoC has 2 functions.
snd_soc_register_dai() is used from topology
snd_soc_register_dais() is used from snd_soc_add_component()

In general, people think like _dai() is called from _dais()
with for loop. But in reality, these are very similar
but different implementation.
We shouldn't have duplicated and confusing implementation.

snd_soc_register_dai() is now used from topology.
But to reduce duplicated code, it should be used from _dais(), too.
To prepare it, this patch adds missing parameter legacy_dai_naming
to snd_soc_register_dai().

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


# e11381f3 04-Nov-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_unregister_dai()

It is easy to read code if it is cleanly using paired function/naming,
like start <-> stop, register <-> unregister, etc, etc.
But, current ALSA SoC code is very random, unbalance, not paired, etc.
It is easy to create bug at the such code, and is difficult to debug.

This patch adds missing soc_del_dai() and snd_soc_unregister_dai().

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


# 2b544dd7 14-Oct-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add for_each_rtd_components() and replace

ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below

rtdcom rtdcom rtdcom
component component component
rtd->component_list -> list -> list -> list ...

Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component

for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}

but usually, user want to get pointer from for_each_xxx is component
directly, like below.

for_each_rtd_component(rtd, rtdcom, component) {
...
}

This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.

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


# 33536a14 14-Oct-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove for_each_rtdcom_safe()

There is no user of for_each_rtdcom().
Let's remove it.

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


# 8ec241c4 01-Oct-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_pcm_lib_ioctl()

add snd_soc_pcm_lib_ioctl() to bypass to snd_pcm_lib_ioctl()

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


# b7c5bc45 11-Sep-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: merge soc_free_pcm_runtime() and soc_rtd_free()

"rtd" is handled by soc_xxx_pcm_runtime(), and
"rtd->dev" is handled by soc_rtd_xxx().

There is no reason to separate these, and it makes code complex.
We can free these in the same time.

Here soc_rtd_free() (A) which frees rtd->dev is called from
soc_remove_link_dais() many times (1).
Then, it is using dev_registered flags to avoid multi kfree() (2).
This is no longer needed if we can merge these functions.

static void soc_remove_link_dais(...)
{
...
(1) for_each_comp_order(order) {
(1) for_each_card_rtds(card, rtd) {

(A) soc_rtd_free(rtd);
...
}
}
}

(A) static void soc_rtd_free(...)
{
(2) if (rtd->dev_registered) {
/* we don't need to call kfree() for rtd->dev */
device_unregister(rtd->dev);
(2) rtd->dev_registered = 0;
}
}

This patch merges soc_rtd_free() into soc_free_pcm_runtime().

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


# b03bfaec 19-Aug-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: merge snd_soc_initialize_card_lists()

snd_soc_initialize_card_lists() is doing card related
INIT_LIST_HEAD(), but, it is already doing at
snd_soc_register_card(). We don't need to do it separately.
This patch merges these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/877e781ldq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 72b745e3 13-Aug-2019 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Move pcm_mutex up to card level from snd_soc_pcm_runtime

The pcm_mutex is used to prevent concurrent execution of snd_pcm_ops
callbacks. This works fine most of the cases but it can not handle setups
when the same DAI is used by different rtd, for example:
pcm3168a have two DAIs: one for Playback and one for Capture.
If the codec is connected to a single CPU DAI we need to have two dai_link
to support both playback and capture.

In this case the snd_pcm_ops callbacks can be executed in parallel causing
unexpected races in DAI drivers.

By moving the pcm_mutex up to card level this can be solved
while - hopefully - not breaking other setups.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190813104532.16669-1-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c2b71c71 07-Aug-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add for_each_xxx macro for aux_dev

To be more readable code, this patch adds
new for_each_xxx() macro for aux_dev.

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


# a48b561d 07-Aug-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove legacy style of aux_dev

Now all drivers are using snd_soc_dai_link_component for aux_dev.
Let's remove legacy style

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


# 3dc29b8b 07-Aug-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: support snd_soc_dai_link_component for aux_dev

To find aux_dev, ASoC is using .name, codec_name, codec_of_node.
Here, .name is used to fallback in case of no codec.

But, we already have this kind of component finding method by
snd_soc_dai_link_component and soc_find_component().
We shouldn't have duplicated implementation to do same things.
This patch adds snd_soc_dai_link_component support to finding aux_dev.

Now, no driver is using only .name.
All drivers are using codec_name and/or codec_of_node.
This means no driver is finding component from .name so far.
(Actually almost all drivers are using .name as just "device name",
not for finding component...)

This patch
1) add snd_soc_dai_link_component support for aux_dev. legacy style will
be removed if all drivers are switched to new style.
2) try to find component via snd_soc_dai_link_component.
Then, it doesn't try to find via .name, because no driver is using
it so far.

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


# b3da4251 06-Aug-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: tidyup for card->deferred_resume_work

card->deferred_resume_work is used if CONFIG_PM_SLEEP was defined.
but
1) It is defined even though CONFIG_PM_SLEEP was not defined
2) random ifdef code is difficult to read.
This patch tidyup these issues.

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


# 4ff1fef1 25-Jul-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add soc-component.c

ALSA SoC has many snd_soc_component_xxx(), but these are randomly
located in many files. Because of it, code is difficult to read.
This patch creates new soc-component.c, and moves existing
snd_soc_component_xxx() into it.
But not yet fully. We need more cleanup it.

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


# fee531d6 31-Jul-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: core: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Also, there is no need to store the individual debugfs file name, just
remove the whole directory all at once, saving a local variable.

Note, the soc-pcm "state" file has now moved to a subdirectory, as it is
only a good idea to save the dentries for debugfs directories, not
individual files, as the individual file debugfs functions are changing
to not return a dentry.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190731131716.9764-2-gregkh@linuxfoundation.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# aa6166c2 21-Jul-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-dai: mv soc_dai_hw_params() to soc-dai

Sometimes ALSA SoC naming is very random.
Current soc_dai_hw_params() should use snd_soc_dai_xxx() style.
And then, 1st parameter should be dai. Otherwise it is confusable.
- soc_dai_hw_params(..., dai);
+ snd_soc_dai_hw_params(dai, ...);

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


# 34614739 27-Jun-2019 Jerome Brunet <jbrunet@baylibre.com>

ASoC: soc-core: support dai_link with platforms_num != 1

Add support platforms_num != 1 in dai_link. Initially, the main purpose of
this change was to make the platform optional in the dai_link, instead of
inserting the dummy platform driver.

This particular case had just been solved by Kuninori Morimoto with
commit 1d7689892878 ("ASoC: soc-core: allow no Platform on dai_link").

However, this change may still be useful for those who need multiple
platform components on a single dai_link (it solves one of the FIXME
note in soc-core)

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


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

ASoC: soc-core: allow no Platform on dai_link

dai_link is used to selecting Component (= CPU/Codec/Platform) and
DAI (= CPU/Codec). And selected CPU/Codec/Platform components are
*listed* on Card.

Many drivers don't need special Platform component, but was
mandatory at legacy style ALSA SoC.
Thus, there is this kind of settings on many drivers.

dai_link->platform_of_node = dai_link->cpu_of_node;

In this case, soc_bind_dai_link() will pick-up "CPU component" as
"Platform component", and try to add it to snd_soc_pcm_runtime.
But it will be ignored, because it is already added when CPU bindings.

Historically, this kind of "CPU component" is used/selected as
"Platform" on many ALSA SoC drivers.
OTOH, Dummy Platform will be selected automatically by ALSA SoC if
driver doesn't have Platform settings.

These indicates that there are 2 type of Platforms exist at current
ALSA SoC if driver doesn't need special Platform.

1) use Dummy Platform as Platform component
2) use CPU component as Platform component

ALSA SoC will call Dummy Platform callback function if it is using
Dummy Platform, but it is completely pointless. Because it is the
sound card which doesn't need special Platform.

Thus, the behavior we request to ALSA SoC is selecting 2) automatically
instead of 1) if sound card doesn't need special Platform.
And, 2) means "do nothing" as above explain.

These were needed at legacy style dai_link, but is no longer needed
at modern style dai_link anymore.

This patch allows "no Platform" settings on dai_link, and will do
nothing for it if there was no platform settings. This is same as 2).

By this patch, all drivers which is selecting "CPU component" as
"Platform" can remove such settings.

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


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

ASoC: soc.h: fixup for_each_card_links() macro

Macro is using "link", not "dai_link"

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


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

ASoC: soc-core: remove legacy style dai_link

All drivers switched to modern style dai_link
(= struct snd_soc_dai_link_component).
Let's remove legacy style dai_link.

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


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

ASoC: soc.h: add sound dai_link connection macro

Modern style dai_link requests CPU/Codec/Platform component
pointer array and its size, but it will be very verbose code.
To avoid such scene, this patch adds dai_link connection macro.

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


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

ASoC: soc-core: use snd_soc_dai_link_component for CPU

current ALSA SoC is starting to support modern style dai_linke
(= struct snd_soc_dai_link_component) which is mainly used for
multipul DAI/component connection.
Now Codec has full multi-codec support, Platform is using modern
style but still for single Platform.
Only CPU is not yet supporting modern style yet.
If we could support it for CPU, we can switch to modern style
dai_link on all CPU/Codec/Platform, and remove legacy style
from ALSA SoC.

Multi-CPU will be supported in the future.
This patch is initial support for modern style for CPU

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


# 7426af50 13-May-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: fe_compr can be bit field

fe_compr is used at soc-compress, it can be bit field.
This patch move it from int to bit field.

> grep fe_compr -r sound/soc/*
sound/soc/soc-compress.c: rtd->fe_compr = 1;
sound/soc/soc-pcm.c: if (!fe->dpcm[stream].runtime && !fe->fe_compr)

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


# b4ed6b51 05-Apr-2019 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: core: conditionally increase module refcount on component open

Recently, for Intel platforms the "ignore_module_refcount" field
was introduced for the component driver. In order to avoid a
deadlock preventing the PCI modules from being removed
even when the card was idle, the refcounts were not incremented
for the device driver module during component probe.

However, this change introduced a nasty side effect:
the device driver module can be unloaded while a pcm stream is open.

This patch proposes to change the field to be renamed as
"module_get_upon_open". When this field is set, the module
refcount should be incremented on pcm open amd decremented
upon pcm close. This will enable modules to be removed
when no PCM playback/capture happens and prevent removal
when the component is actually in use.

Also, align with the skylake component driver with the new name.

Fixes: b450b878('ASoC: core: don't increase component module refcount
unconditionally'
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bbfaa7d3 06-Mar-2019 KaiChieh Chuang <kaichieh.chuang@mediatek.com>

ASoC: dpcm: prevent snd_soc_dpcm use after free

The dpcm get from fe_clients/be_clients
may be free before use

Add a spin lock at snd_soc_card level,
to protect the dpcm instance.
The lock may be used in atomic context, so use spin lock.

possible race condition between
void dpcm_be_disconnect(
...
list_del(&dpcm->list_be);
list_del(&dpcm->list_fe);
kfree(dpcm);
...

and
for_each_dpcm_fe()
for_each_dpcm_be*()

race condition example
Thread 1:
snd_soc_dapm_mixer_update_power()
-> soc_dpcm_runtime_update()
-> dpcm_be_disconnect()
-> kfree(dpcm);
Thread 2:
dpcm_fe_dai_trigger()
-> dpcm_be_dai_trigger()
-> snd_soc_dpcm_can_be_free_stop()
-> if (dpcm->fe == fe)

Excpetion Scenario:
two FE link to same BE
FE1 -> BE
FE2 ->

Thread 1: switch of mixer between FE2 -> BE
Thread 2: pcm_stop FE1

Exception:

Unable to handle kernel paging request at virtual address dead0000000000e0

pc=<> [<ffffff8960e2cd10>] dpcm_be_dai_trigger+0x29c/0x47c
sound/soc/soc-pcm.c:3226
if (dpcm->fe == fe)
lr=<> [<ffffff8960e2f694>] dpcm_fe_dai_do_trigger+0x94/0x26c

Backtrace:
[<ffffff89602dba80>] notify_die+0x68/0xb8
[<ffffff896028c7dc>] die+0x118/0x2a8
[<ffffff89602a2f84>] __do_kernel_fault+0x13c/0x14c
[<ffffff89602a27f4>] do_translation_fault+0x64/0xa0
[<ffffff8960280cf8>] do_mem_abort+0x4c/0xd0
[<ffffff8960282ad0>] el1_da+0x24/0x40
[<ffffff8960e2cd10>] dpcm_be_dai_trigger+0x29c/0x47c
[<ffffff8960e2f694>] dpcm_fe_dai_do_trigger+0x94/0x26c
[<ffffff8960e2edec>] dpcm_fe_dai_trigger+0x3c/0x44
[<ffffff8960de5588>] snd_pcm_do_stop+0x50/0x5c
[<ffffff8960dded24>] snd_pcm_action+0xb4/0x13c
[<ffffff8960ddfdb4>] snd_pcm_drop+0xa0/0x128
[<ffffff8960de69bc>] snd_pcm_common_ioctl+0x9d8/0x30f0
[<ffffff8960de1cac>] snd_pcm_ioctl_compat+0x29c/0x2f14
[<ffffff89604c9d60>] compat_SyS_ioctl+0x128/0x244
[<ffffff8960283740>] el0_svc_naked+0x34/0x38
[<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a9764869 07-Mar-2019 KaiChieh Chuang <kaichieh.chuang@mediatek.com>

ASoC: dpcm: prevent snd_soc_dpcm use after free

The dpcm get from fe_clients/be_clients
may be free before use

Add a spin lock at snd_soc_card level,
to protect the dpcm instance.
The lock may be used in atomic context, so use spin lock.

Use irq spin lock version,
since the lock may be used in interrupts.

possible race condition between
void dpcm_be_disconnect(
...
list_del(&dpcm->list_be);
list_del(&dpcm->list_fe);
kfree(dpcm);
...

and
for_each_dpcm_fe()
for_each_dpcm_be*()

race condition example
Thread 1:
snd_soc_dapm_mixer_update_power()
-> soc_dpcm_runtime_update()
-> dpcm_be_disconnect()
-> kfree(dpcm);
Thread 2:
dpcm_fe_dai_trigger()
-> dpcm_be_dai_trigger()
-> snd_soc_dpcm_can_be_free_stop()
-> if (dpcm->fe == fe)

Excpetion Scenario:
two FE link to same BE
FE1 -> BE
FE2 ->

Thread 1: switch of mixer between FE2 -> BE
Thread 2: pcm_stop FE1

Exception:

Unable to handle kernel paging request at virtual address dead0000000000e0

pc=<> [<ffffff8960e2cd10>] dpcm_be_dai_trigger+0x29c/0x47c
sound/soc/soc-pcm.c:3226
if (dpcm->fe == fe)
lr=<> [<ffffff8960e2f694>] dpcm_fe_dai_do_trigger+0x94/0x26c

Backtrace:
[<ffffff89602dba80>] notify_die+0x68/0xb8
[<ffffff896028c7dc>] die+0x118/0x2a8
[<ffffff89602a2f84>] __do_kernel_fault+0x13c/0x14c
[<ffffff89602a27f4>] do_translation_fault+0x64/0xa0
[<ffffff8960280cf8>] do_mem_abort+0x4c/0xd0
[<ffffff8960282ad0>] el1_da+0x24/0x40
[<ffffff8960e2cd10>] dpcm_be_dai_trigger+0x29c/0x47c
[<ffffff8960e2f694>] dpcm_fe_dai_do_trigger+0x94/0x26c
[<ffffff8960e2edec>] dpcm_fe_dai_trigger+0x3c/0x44
[<ffffff8960de5588>] snd_pcm_do_stop+0x50/0x5c
[<ffffff8960dded24>] snd_pcm_action+0xb4/0x13c
[<ffffff8960ddfdb4>] snd_pcm_drop+0xa0/0x128
[<ffffff8960de69bc>] snd_pcm_common_ioctl+0x9d8/0x30f0
[<ffffff8960de1cac>] snd_pcm_ioctl_compat+0x29c/0x2f14
[<ffffff89604c9d60>] compat_SyS_ioctl+0x128/0x244
[<ffffff8960283740>] el0_svc_naked+0x34/0x38
[<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b450b878 01-Feb-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: core: don't increase component module refcount unconditionally

The ASoC core has for the longest time increased the module reference
counts, even before the transition to the component model. This is
probably fine on most platforms, but it introduces a deadlock case on
Intel devices with the Skylake and SOF drivers which cannot be removed
due to their reference counts being modified by the core.

In these 2 cases, the PCI or ACPI driver .probe creates a platform
device to let the machine driver .probe register the audio
card. Conversely the PCI or ACPI driver .remove will unregister the
platform device which results in the card being removed by the machine
driver .remove.

With ascii art, this can be represented as

modprobe
snd_soc_skl/
soc-pci-dev/sof-acpci-dev ----------> pci/acpi probe
^ |
| ---------------|
| | |
| V V
increase register register machine
refcount component platform_device
^ |
| |
| V
component <---- register card <---- probe
probe

The issue is that by playing with the component's module reference
counts during the card registration, it's no longer possible to remove
the module which controls the component. This can be shown, e.g. with
the following error:

root@plb-XPS-13-9350:~# lsmod | grep snd_soc_skl
snd_soc_skl 110592 1

root@plb-XPS-13-9350:~# rmmod snd_soc_skl
rmmod: ERROR: Module snd_soc_skl is in use

Increasing the reference count during the component probe is not
useful. If the PCI/ACPI module is removed, the card will be removed
anyway.

To avoid breaking existing platforms and allowing Intel platforms to
safely deal with module load/unload cases, this patch introduces a
flag which needs to be set during the component initialization. This
is a strictly opt-in capability that should only be used when the
handling of the component module does not require a reference count
increase to prevent removal during use.

Note that this solution is not directly applicable to the legacy
Atom/SST driver, which uses a different device hierarchy. There are
however additional refcount issues which prevent the ACPI driver from
being removed. This is a different issue which would need a different
patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cb50358b 25-Jan-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: add helper to change platform name for all dailinks

To reuse the same machine drivers with Atom/SST, Skylake and SOF, we
need to change the default platform_name (or platforms->name in the
"modern" representation).

So far, this override was done with an automatic override, which was
broken by a set of changes for DT platforms related to deferred probe
handling.

This automatic override is actually not really needed, the machine
driver can already receive the platform name as a platform_data
parameter. This is used e.g. for HDaudio support where we have
different PCI aliases used for different platforms. We can reuse the
same mechanism and modify the machine drivers to override the dailinks
prior to registrating the card.

This will require additional work for SOF, but with this helper it'll
be just two lines of additional code per machine driver which is
reused, not the end of the world.

This helper can be simplified when all drivers have transitioned to
the "modern" representation of dailinks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.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>


# 62bc79d3 17-Jan-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: add explanation of legacy/modern style of dai_link

Current ALSA SoC is assuming 1 CPU 1 Platform (= DMA) style system.
Because of this background, it is directly using
xxx_name / xxx_of_node / xxx_dai_name on dai_link.
Let's call it as legacy style here.

More complex style system like multi CPU multi Platform (= DMA) will
coming. To supporting it, we can use snd_soc_dai_link_component on
dai_link. Let's call it as modern style here.
But current ALSA SoC can't support it so far. Thus, we need to have
multi CPU / multi Codec / multi Platform style in the future on ALSA SoC.

Currently we already have multi Codec support. Platform is starting to
use modern style on dai_link, but still style only. Multi Platform is
not yet implemented. And we still don't have multi CPU support on ALSA
SoC, and not have modern style either.

Currently, if driver is using legacy style Codec/Platform, it will be
converted to modern style on soc-core. This means, we are using glue code
for legacy vs modern style so far on ALSA SoC.
We can fully switch to modern style on all drivers if ALSA SoC supported
modern style for CPU, and then, legacy style code will be removed from
ALSA SoC.
Untile then, we need to keep both legacy/modern style and its glue code.
This patch adds such future plan and background on soc.h

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


# 09ac6a81 10-Jan-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: soc-core: fix init platform memory handling

snd_soc_init_platform initializes pointers to snd_soc_dai_link which is
statically allocated and it does this by devm_kzalloc. In the event of
an EPROBE_DEFER the memory will be freed and the pointers are left
dangling. snd_soc_init_platform sees the dangling pointers and assumes
they are pointing to initialized memory and does not reallocate them on
the second probe attempt which results in a use after free bug since
devm has freed the memory from the first probe attempt.

Since the intention for snd_soc_dai_link->platform is that it can be set
statically by the machine driver we need to respect the pointer in the
event we did not set it but still catch dangling pointers. The solution
is to add a flag to track whether the pointer was dynamically allocated
or not.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2708bccf 25-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: makes snd_soc_of_parse_audio_prefix() inline

commit 3b7103562c03c ("ASoC: soc-core: add
snd_soc_of_parse_node_prefix()") maked snd_soc_of_parse_audio_prefix()
as #define. But it'd be better to make this a static inline rather than
a #define. It helps with error messages and type safety.
This patch makes it inline.

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


# 3b710356 21-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_of_parse_node_prefix()

Current ASoC has snd_soc_of_parse_audio_prefix() to get codec_conf
settings from DT which is used to avoid DAI naming conflict when
CPU/Codec matching.

Currently, it is parsing from "top node",
but, we want to parse from "each sub node" if sound card had multi
cpus/codecs.

This patch adds new snd_soc_of_parse_node_prefix() to allow parsing
settings from selected node.
It is keeping existing snd_soc_of_parse_audio_prefix() by using macro.

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


# 576ce407 02-Nov-2018 Arnd Bergmann <arnd@arndb.de>

ASoC: wm97xx: fix uninitialized regmap pointer problem

gcc notices that without either the ac97 bus or the pdata, we never
initialize the regmap pointer, which leads to an uninitialized variable
access:

sound/soc/codecs/wm9712.c: In function 'wm9712_soc_probe':
sound/soc/codecs/wm9712.c:666:2: error: 'regmap' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since that configuration is invalid, it's better to return an error
here. I tried to avoid adding complexity to the conditions, and turned
the #ifdef into a regular if(IS_ENABLED()) check for readability.
This in turn requires moving some header file declarations out of
an #ifdef.

The same code is used in three drivers, all of which I'm changing
the same way.

Fixes: 2ed1a8e0ce8d ("ASoC: wm9712: add ac97 new bus support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 23cb2d04 26-Oct-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: fix oops w/ for_each_rtd_codec_dai_rollback() macro

A kernel oops happens on an error case (usual missing BE mixer
configuration required by Intel SST driver). Git bisect points to this
macro and an operator precedence issue.

for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)

The initial code replaced by this macro was
while (--i >= 0) {
codec_dai = rtd->codec_dais[i];

Fix the C operator precedence difference by reverting to pre-decrement

Fixes: 0b7990e3897 ('ASoC: add for_each_rtd_codec_dai() macro')
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 15a0c645 20-Sep-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add for_each_component_dais() macro

To be more readable code, this patch adds
new for_each_component_dais() 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>


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

ASoC: add for_each_comp_order() macro

To be more readable code, this patch adds
new for_each_comp_order() 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>


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

ASoC: add for_each_card_components() macro

To be more readable code, this patch adds
new for_each_card_components() 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>


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

ASoC: add for_each_card_rtds() macro

To be more readable code, this patch adds
new for_each_card_rtds() 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>


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

ASoC: add for_each_card_links() macro

To be more readable code, this patch adds
new for_each_card_links() 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>


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


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

ASoC: rename for_each_rtd_codec_dai_reverse to rollback

commit 0b7990e38971 ("ASoC: add for_each_rtd_codec_dai() macro")
added for_each_rtd_codec_dai_reverse(). but _rollback() is better
naming than _reverse(). This patch rename it.

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


# e894efef 12-Sep-2018 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ASoC: core: add support to card rebind

Current behaviour of ASoC core w.r.t to component removal is that it
unregisters dependent sound card totally. There is no support to
rebind the card if the component comes back.
Typical use case is DSP restart or kernel modules itself.

With this patch, core now maintains list of cards that are unbind due to
any of its depended components are removed and card not unregistered yet.
This list is cleared when the card is rebind successfully or when the
card is unregistered from machine driver.

This list of unbind cards are tried to bind once again after every new
component is successfully added, giving a fair chance for card bind
to be successful.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4f1b327e 11-Sep-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove unused num_dai_links

ALSA SoC is counting card->dai_link_list user,
but no-one is using it.
Let's remove it.

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


# 243bcfaf 05-Sep-2018 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: dapm: Move CODEC to CODEC params from the widget to the runtime

Larger CODECs may contain many several hundred widgets and which set of
parameters is selected only needs to be recorded on a per DAI basis. As
such move the selected CODEC to CODEC link params to be stored in the
runtime rather than the DAPM widget, to save some memory.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0b7990e3 02-Sep-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add for_each_rtd_codec_dai() macro

ALSA SoC snd_soc_pcm_runtime has snd_soc_dai array for codec_dai.
To be more readable code, this patch adds
new for_each_rtd_codec_dai() 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>


# 3db769f1 02-Sep-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add for_each_link_codecs() macro

ALSA SoC snd_soc_dai_link has snd_soc_dai_link_component array
for codecs.
To be more readable code, this patch adds
new for_each_link_codecs() 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>


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

ASoC: soc-core: use snd_soc_dai_link_component for platform

Current struct snd_soc_dai_link is supporting multicodec,
and it is supporting legacy style of
codec_name
codec_of_node
code_dai_name
This is handled as single entry of multicodec.

We don't have multicpu support yet, but in the future we will.
In such case, we can use snd_soc_dai_link_component for both
cpu/codec. Then the code will be more simple and readble.

As next step, we want to use it for platform, too.
This patch adds snd_soc_dai_link_component style for platform.
We might have multiplatform support in the future, but we
don't know yet. To avoid un-known issue / complex code,
this patch supports just single-platform as 1st step.

If we could use snd_soc_dai_link_component for all CPU/Codec/Platform,
we will switch to new style, and remove legacy code.
This is prepare for it.

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


# 611cbc87 02-Aug-2018 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ASoC: core: remove support for card rebind using component framework

DRM based audio components get registered inside the component framework
bind callback. However component framework has a big mutex lock taken for
every call to component_add, component_del and bind, unbind callbacks.

This can lead to deadlock situation if we are trying to add new/remove
component within a bind/unbind callbacks. Which is what was happening
with bcm2837 rpi 3.

Revert this change till we sort out the mutex issue.

Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cbdfab3b 17-Jul-2018 Jerome Brunet <jbrunet@baylibre.com>

ASoC: export snd_soc_of_get_slot_mask

Amlogic's axg card driver can't use snd_soc_of_parse_tdm_slot()
directly because it needs to handle 4 mask for each direction.
Yet the parsing of each mask is the same, so export
snd_soc_of_get_slot_mask() to reuse the the existing code.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bb4b894a 13-Jul-2018 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ASoC: core: add support to card re-bind using component framework

This patch aims at achieving dynamic behaviour of audio card when
the dependent components disappear and reappear.

With this patch the card is removed if any of the dependent component
is removed and card is added back if the dependent component comes back.
All this is done using component framework and matching based on
component name.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# baacd8d1 04-Jul-2018 Jerome Brunet <jbrunet@baylibre.com>

ASoC: dpcm: add rate merge to the BE stream merge

As done for format and channels, add the possibility to merge
the backend rates on the frontend rates.

This useful if the backend does not support all rates supported by the
frontend, or if several backends (cpu and codecs) with different
capabilities are connected to the same frontend.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a655de80 02-Jul-2018 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: core: Allow topology to override machine driver FE DAI link config.

Machine drivers statically define a number of DAI links that currently
cannot be changed or removed by topology. This means PCMs and platform
components cannot be changed by topology at runtime AND machine drivers
are tightly coupled to topology.

This patch allows topology to override the machine driver DAI link config
in order to reuse machine drivers with different topologies and platform
components. The patch supports :-

1) create new FE PCMs with a topology defined PCM ID.
2) destroy existing static FE PCMs
3) change the platform component driver.
4) assign any new HW params fixups.
5) assign a new card name prefix to differentiate this topology to userspace.

The patch requires no changes to the machine drivers, but does add some
platform component flags that the platform component driver can assign
before loading topologies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: soc-core: convert to SPDX identifiers

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


# f4c277b8 20-Jun-2018 Jiada Wang <jiada_wang@mentor.com>

ASoC: soc-pcm: DPCM cares BE channel constraint

Current DPCM is caring only FE channel configuration. Sometimes
it will be trouble if user selects channel which isn't supported
by BE.

This patch adds new .dpcm_merged_chan on struct snd_soc_dai_link.
DPCM will use FE / BE merged channel if struct snd_soc_dai_link
has it.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0b014d72 29-May-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: fix 0-day warnings with snd_soc_new_compress()

All conditionally-defined routines in include/sound/soc.h expose a
static inline fallback to avoid 0-day warnings and compilation issues,
except snd_soc_new_compress().

Fixes: 5db6aab6f36f ('ASoC: topology: Add support for compressed PCMs')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c8306238 07-May-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: merge CONFIG_DEBUG_FS

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 999f7f5a 07-May-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove Codec related code

Now no one is using Codec related code.
Let's remove all

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 11fb14f8 07-May-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove unneeded .pcm_new/free

commit ef050bece1b55 ("ASoC: Remove platform code now everything is
componentised") removed platform code, but it didn't remove
.pcm_new/free which existed only for platform.
This patch remove these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2250e76d 07-May-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove .get_regmap

To setup regmap, ALSA SoC has snd_soc_component_init_regmap() and
.get_regmap. But these are duplicated feature.
Now, no one is using .get_regmap, let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d1021c88 07-May-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove codec reg_cache

Codec reg_cache is legacy feature, almost all driver are now using
common regmap, and very few driver had been used this legacy feature.
Because of this background, it is now implemented on each
driver internally now.
So now, no one is using codec reg_cache. Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 81da8a0b 07-May-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove codec hw_write/control_data

No one is using codec hw_write/control_data any more.
Let's remove these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ef050bec 24-Apr-2018 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: Remove platform code now everything is componentised

As all drivers have been moved over to the new generic component
code remove the now unused platform specific code.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 291bfb92 18-Apr-2018 Mark Brown <broonie@kernel.org>

ASoC: topology: Revert recent changes while boot errors are investigated

Krzysztof Kozlowski reported a NULL dereference in _instantiate_card()
on Odroid XU3 and XU boards which he bisected to 45f8cb57da0d7 (ASoC:
core: Allow topology to override machine driver FE DAI link config).
Revert that commit for now, along with f11a5c27f928 (ASoC: core: Add
name prefix for machines with topology rewrites) due to dependency
issues, in order to keep things booting cleanly in -next.

Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f11a5c27 27-Mar-2018 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: core: Add name prefix for machines with topology rewrites

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 45f8cb57 27-Mar-2018 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: core: Allow topology to override machine driver FE DAI link config.

Machine drivers statically define a number of DAI links that currently
cannot be changed or removed by topology. This means PCMs and platform
components cannot be changed by topology at runtime AND machine drivers
are tightly coupled to topology.

This patch allows topology to override the machine driver DAI link config
in order to reuse machine drivers with different topologies and platform
components. The patch supports :-

1) create new FE PCMs with a topology defined PCM ID.
2) destroy existing static FE PCMs
3) change the platform component driver.
4) assign any new HW params fixups.

The patch requires no changes to the machine drivers, but does add some
platform component flags that the platform component driver can assign
before loading topologies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 94685763 09-Mar-2018 Sylwester Nawrocki <s.nawrocki@samsung.com>

ASoC: Add snd_soc_of_put_dai_link_codecs() helper function

The code for dereferencing device nodes in the 'codecs' array is moved
to a separate function so we can avoid open coding that in drivers.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c95869e5 28-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: ac97: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1

To keep compatibilty, this patch adds snd_soc_xxx_ac97_codec()
macro. These will be removed when all codec code was removed.

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


# 72c38184 18-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-pcm: rename .pmdown_time to .use_pmdown_time for Component

commit fbb16563c6c2 ("ASoC: snd_soc_component_driver has pmdown_time")
added new .pmdown_time which is for inverted version of current
.ignore_pmdown_time
But it is confusable name. Let's rename it to .use_pmdown_time

Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d0ff8ba5 15-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level .read/.write

In current ALSA SoC, Codec only has .read/.write callback.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

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


# 4855f6a6 19-Dec-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: Arrange DAI related parameter

"dai_list" and "num_dai" on snd_soc_component are related
parameter. Let's arrange these.

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


# 58bf4179 19-Dec-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove dai_drv from snd_soc_component

ALSA SoC has some duplicate parameter.
snd_soc_component::dai_drv is one of them.

Each DAI is keeping its driver as snd_soc_dai::driver,
and component has dai_list.
This means, we can reach to each DAI and its driver by using dai_link.
Thus, there is no need to keep DAI driver pointer on component.
Let's remove it

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


# ef2e8175 27-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_disconnect_sync()

Now, we have snd_card_disconnect_sync() on ALSA framework.
snd_soc_disconnect_sync() is ASoC version of it.

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


# e07bd30b 05-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_dapm_kcontrol_component()

snd_soc_dapm_kcontrol_codec() (= for Codec) will be removed soon.
This patch Component version of it.

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


# 474db2c9 05-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_component_cache_sync()

snd_soc_cache_sync() (= for Codec) will be removed soon.
This patch Component version of it.

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


# 10e079d9 05-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_component_xxx_bias_level()

snd_soc_codec_xxx_bias_level() (= for Codec) will be removed soon.
This patch Component version of it.

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


# 738b49ef 05-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_component_read32

Current codec drivers are using snd_soc_read(). It will be replaced
into snd_soc_component_read(), but these 2 are using different style.
For example, it will be

- val = snd_soc_read(xxx, reg);
+ ret = snd_soc_component_read(xxx, reg, &val);
+ if (ret < 0) {
+ ...
+ }

To more smooth replace, let's add snd_soc_component_read32
which is copied from snd_soc_read()

- val = snd_soc_read(xxx, reg);
+ val = snd_soc_component_read32(xxx, reg);

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


# 69941bab 10-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: snd_soc_component_driver has non_legacy_dai_naming

Codec will be replaced into Component, then Codec side
doesn't use legacy_dai_naming on snd_soc_register_dais().

This patch adds new non_legacy_dai_naming flag on Component driver
and use converted its value for snd_soc_register_dais().

When Codec is replaced into Component, Codec driver needs
to have non_legacy_dai_naming = 1 flags.
Existing CPU side of course doesn't have this flag, thus CPU calls
it as true.

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


# 273d778e 10-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: snd_soc_component_driver has endianness

Codec will be replaced into Component, then Codec side only
needs to call fixup_codec_formats() at this point.

This patch adds new endianness flag on Component driver
and call convert_endianness_formats() (= was fixup_codec_format())
if endianness was true.

When Codec is replaced into Component, Codec driver needs
to have endianness = 1 flags.
Existing CPU side of course doesn't have this flag, thus CPU doesn't
call it.

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


# fbb16563 10-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: snd_soc_component_driver has pmdown_time

Current snd_soc_runtime_ignore_pmdown_time() tallys all Codec and
CPU's "ignore_pmdown_time". Now, CPU (= via compoent)
ignore_pmdown_time is fixed as "true". Codec's one is copied from Codec
driver. This means Codec side default is "false".

Current all Codec driver will be replaced into Component, thus, we can
use for_each_rtdcom() for this totalization. This patch adds new
"pmdown_time" on Component driver. Its inverted value will be used
for this "ignore" totalizaton.

Of course all existing Component driver doesn't have its settings now,
thus, all existing "pmdown_time" is "false". This means all
Components will ignore pmdown time. This is current CPU behavior.
To keep compatibility, snd_soc_runtime_ignore_pmdown_time() totalize
Component's inverted "pmdown_time" (= total will be true) and
Codec's "ignore_pmdown_time" (= depends on Codec driver settings).
Because It is using AND operation, its result is based on Codec driver
settings only.
This means this operation can keep compatibility and doesn't have
nonconformity.

When we replace Codec to Component, the driver which has
".ignore_pmdown_time = true" will be just removed,
and the driver which doesn't have it will have new
".pmdown_time = true".

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


# 9e7e3738 10-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: snd_soc_component_driver has snd_compr_ops

Platform will be replaced into Component in the future.
snd_soc_platform_driver has snd_compr_ops, but snd_soc_component_driver
doesn't have. To prepare for replacing, this patch adds snd_compr_ops on
component driver.

platform will be replaced into component, and its code will be removed.
But during replacing, both platform and component process code exists.
To keep compatibility, to avoid platform NULL access and to avoid
platform/component duplicate operation during replacing process, this
patch has such code. Some of this code will be removed when platform was
removed.

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


# b8135864 10-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: snd_soc_component_driver has snd_pcm_ops

Platform will be replaced into Component in the future.
snd_soc_platform_driver has snd_pcm_ops, but snd_soc_component_driver
doesn't have it. To prepare for replacing, this patch adds snd_pcm_ops
on component driver.

platform will be replaced into component, and its code will be removed.
But during replacing, both platform and component process code exists.
To keep compatibility, to avoid platform NULL access and to avoid
platform/component duplicate operation during replacing process, this
patch has such code. Some of this code will be removed when platform was
removed.

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


# 7c761b59 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Add helper to find codec_dai from dai_name

Create a helper function to remove duplicate code used in machine drivers

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e0dac41b 01-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_add_component()

ALSA SoC platform/codec will be replaced to component soon.
But, some function exist in "platform" doesn't exist in "component".
Current soc-core has snd_soc_register_component(), but
doesn't have snd_soc_add_component() like snd_soc_add_platform().
This patch adds it.

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


# 7dd5d0d9 01-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add component lookup functions

ALSA SoC platform/codec will be replaced to component soon.
This means 1 device might have multiple components. But current
unregister component function only checks "dev" to find it.
This means, unexpected component might be unregistered by current
function.
But, it is no problem if driver registered only 1 component.

To prepare avoid this issue, this patch adds new component
lookup function. it finds component by "dev" and "driver name".

Here, the reason why it uses "driver name" is that "component name"
was created by fmt_single_name() and difficult to use it from driver.
Driver of course knows its "driver name", thus, using it is more easy.

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


# 7ba236ce 25-Sep-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level set_bias_level

In current ALSA SoC, Codec only has set_bias_level feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

Codec driver has .idle_bias_off for dapm bias. But Component
driver doesn't have it, and dapm->idle_bias_off is set as "true".
To keep compatibility, this patch adds "idle_bias_on" instead of
".idle_bias_off" on Component driver.
dapm->idle_bias_off will be set by inverted idle_bias_on.

When we replace Codec to Component, the driver which has
".idle_bias_off = true" is just remove it,
and the driver which doesn't have it will have new
".idle_bias_on = true".

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


# f523aceb 25-Sep-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level pcm_new/pcm_free v2

In current ALSA SoC, Platform only has pcm_new/pcm_free feature,
but it should be supported on Component level. This patch adds it.

The v1 was added commit 99b04f4c4051f7 ("ASoC: add Component level
pcm_new/pcm_free") but it called all "card" connected component's
pcm_new/free, it was wrong.
This patch calls "rtd" connected component.

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


# 840bc448 20-Sep-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add missing snd_soc_component_set_jack

commit 44c07365e9e2 ("ASoC: add Component level set_jack") added new
snd_soc_component_set_jack(), but it didn't add definition on soc.h.
This patch adds it.

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


# 44c07365 23-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level set_jack

In current ALSA SoC, Codec only has set_jack feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

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


# ef641e5d 23-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level set_pll

In current ALSA SoC, Codec only has set_pll feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

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


# 71ccef0d 23-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level set_sysclk

In current ALSA SoC, Codec only has set_sysclk feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

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


# 6969b2ba 24-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove duplicate definition of dapm_routes/num_dapm_routes

snd_soc_component and snd_soc_component_driver both have
dapm_routes/num_dapm_routes, but these are duplicated.
Let's remove duplicated definition.

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


# 688d0ebf 24-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove duplicate definition of dapm_widgets/num_dapm_widgets

snd_soc_component and snd_soc_component_driver both have
dapm_widgets/num_dapm_widgets, but these are duplicated.
Let's remove duplicated definition.

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


# b8972bf0 24-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove duplicate definition of controls/num_controls

snd_soc_component and snd_soc_component_driver both have
controls/num_controls, but these are duplicated.
Let's remove duplicated definition.

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


# 90be711e 08-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: use snd_soc_rtdcom_add() and convert to consistent operation

Basically, current ALSA SoC framework is based on CPU/Codec/Platform,
but its operation doesn't have consistent.
Thus, source code was unreadable, and difficult to understand.
This patch connects each component (= CPU/Codec/Platform) to rtd by
using snd_soc_rtdcom_add(), and convert uneven operations to consistent
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a0ac4411 08-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: add snd_soc_rtdcom_xxx()

Current snd_soc_pcm_runtime has platform / codec pointers, and we could
use these specific pointer. But these will be replaced to more generic
"component" soon, and will need more generic method to get each
connected component pointer from rtd.

This patch adds new snd_soc_rtdcom_xxx() to connect/disconnect
component to rtd. It means same as previous "platform" / "codec"
pointer style, but more generic.
We can find necessary component pointer from rtd by using component
driver name on snd_soc_rtdcom_lookup().

Here, the reason why it uses "driver name" is that "component name"
was created by fmt_single_name() and difficult to use it from driver.
Driver of course knows its "driver name", thus, using it is more easy.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cf9e829e 06-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: rename "cmpnt" to "component"

To unify notation, to readable.

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


# 353c64dd 07-Aug-2017 Fabio Estevam <festevam@gmail.com>

ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec

There is no need to have the *debugfs_reg dentry member as part of
the snd_soc_codec structure as its only usage is inside
soc_init_codec_debugfs().

Use a local dentry variable instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f1e3f409 29-Jul-2017 Fabio Estevam <fabio.estevam@nxp.com>

ASoC: soc-pcm: Remove unused 'debugfs_dpcm_state' entry

'debugfs_dpcm_state' member from structure snd_soc_pcm_runtime
is never used at all, so it is safe to remove it.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a7e1149b 25-Jul-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove cache_bypass from snd_soc_codec

snd_soc_codec .cache_bypass related operation code has been removed.
Let's remove remaining code.

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


# c641e5b2 12-Jul-2017 Johan Hovold <johan@kernel.org>

ASoC: fix pcm-creation regression

This reverts commit 99b04f4c4051 ("ASoC: add Component level
pcm_new/pcm_free"), which started calling the pcm_new callback for every
component in a *card* when creating a new pcm, something which does not
seem to make any sense.

This specifically led to memory leaks in systems with more than one
platform component and where DMA memory is allocated in the
platform-driver callback. For example, when both mcasp devices are being
used on an am335x board, DMA memory would be allocated twice for every
DAI link during probe.

When CONFIG_SND_VERBOSE_PROCFS was set this fortunately also led to
warnings such as:

WARNING: CPU: 0 PID: 565 at ../fs/proc/generic.c:346 proc_register+0x110/0x154
proc_dir_entry 'sub0/prealloc' already registered

Since there seems to be no users of the new component callbacks, and the
current implementation introduced a regression, let's revert the
offending commit for now.

Fixes: 99b04f4c4051 ("ASoC: add Component level pcm_new/pcm_free")
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable <stable@vger.kernel.org> # 4.10


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

ASoC: add snd_soc_get_dai_id() function

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>


# 1f5a4535 24-Apr-2017 Takashi Iwai <tiwai@suse.de>

ASoC: Provide a dummy wrapper of snd_soc_set_dmi_name()

For systems without DMI, it makes no sense to have the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d7344010 06-Apr-2017 Bard Liao <bardliao@realtek.com>

ASoC: jack: add snd_soc_codec_set_jack

There are many codecs with the capability of jack detection. Usually,
we create a jack on machine driver but there is no common function for
machine driver to deliver the jack pointer to codec driver.
snd_soc_codec_set_jack can be used for delivering the jack pointer to
codec driver and enable the jack detection function. To make it work,
codec driver need to define a callback function to receive the jack
pointer and do all necessary procedure for enabling jack detection.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 73548dd3 21-Mar-2017 Dmitry Torokhov <dtor@chromium.org>

ASoC: jack - check status of GPIO-based pins on resume

For GPIO-backed pins that are not configured as wakeup sources, we may
miss change in their state that happens while system is suspended. Let's
use PM notifier to refresh their state upon resume.

Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 991454e1 23-Mar-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: core: remove pointless auxiliary from snd_soc_component

commit 1a653aa44725 ("ASoC: core: replace aux_comp_list to ...")
tried to replace aux_comp_list to component_dev_list,
but it failed because of binding timing. Thus, Sylwester fixuped it by
commit d2e3a1358c37 ("ASoC: Fix binding and probing of auxiliary...").

One of main purpose of commit 1a653aa44725 ("ASoC: core: replace...")
was remove replaceable list (= list_aux) from snd_soc_component by using
new "auxiliary" flags (but it failed).
Because of this background, current code has reborned card_aux_list
(= same as original list_aux), and almost pointless "auxiliary" flags.

Let's remove pointless "auxiliary" flags by this patch
This means, it is same as revert both
commit 1a653aa44725 ("ASoC: core: replace aux_comp_list to ...") and
commit d2e3a1358c37 ("ASoC: Fix binding and probing of auxiliary...").

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b07609ce 26-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_card_name

Because prototype of OF-graph sound card support didn't have Sound Card
node, commit 8f5ebb1bee15b5720741a98414767bb86f6c2b23
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_name")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit 8f5ebb1bee15b5720741a98414767bb86f6c2b23.

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


# 440a3006 26-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_prefix

Because prototype of OF-graph sound card support didn't have Sound Card
node, commit b6defcca0a604129155ae472b116a2e1688d8995
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit b6defcca0a604129155ae472b116a2e1688d8995.

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


# 21efde50 26-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_simple_widgets

Because prototype of OF-graph sound card support didn't have Sound Card
node, commit 1ef5bcd57be5c8b31286b7b47828064be25f266b
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgets")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit 1ef5bcd57be5c8b31286b7b47828064be25f266b.

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


# 2bc644af 26-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_routing

Because prototype of OF-graph sound card support didn't have Sound Card
node, commit 7364c8dc255232db33bcd1c5b19eb8f34cf6108a
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit 7364c8dc255232db33bcd1c5b19eb8f34cf6108a.

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


# 345233d7 14-Jan-2017 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: core: Add API to use DMI name in sound card long name

Intel DSP platform drivers are used by many different devices but are
difficult for userspace to differentiate. This patch adds an API to allow
the DMI name to be used in the sound card long name, thereby helping
userspace load the correct UCM configuration. Usually machine drivers
uses their own name as the sound card name (short name), and leave the
long name and driver name blank. This API will use the DMI info like
vendor, product and board to make up the card long name. If the machine
driver has already explicitly set the long name, this API will do nothing.

This patch also allows for further differentiation as many devices that
share the same DMI name i.e. Minnowboards, UP boards may be configured
with different codecs or firmwares. The API supports flavoring the DMI
name into the card longname to provide the extra differentiation required
for these devices.

For Use Case Manager (UCM) in the user space, changing card long name by
this API is backward compatible, since the card name does not change. For
a given sound card, even if there is no device-specific UCM configuration
file that uses the card long name, UCM will fall back to load the default
configuration file that uses the card name.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 96241bae 19-Dec-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove snd_soc_platform_trigger()

No one is using snd_soc_platform_trigger().
Let's remove it.

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


# 10611e1b 19-Dec-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove .bespoke_trigger from snd_soc_platform_driver

No existing platform is using .bespoke_trigger.
Let's remove it.

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


# fcff45f8 19-Dec-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove .delay from snd_soc_platform_driver

No existing platform is using .delay.
Let's remove it.

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


# d2e3a135 29-Dec-2016 Sylwester Nawrocki <s.nawrocki@samsung.com>

ASoC: Fix binding and probing of auxiliary components

Currently binding of auxiliary devices doesn't work as in
soc_bind_aux_dev() function a bound component is not being added
to any list and in soc_probe_aux_devices() we are trying to walk
the component_dev_list list to probe auxiliary components but
at that time this list doesn't contain any auxiliary components
since they are being added to the card only in soc_probe_component().

This patch adds a list to the card where are stored bound but not
probed auxiliary devices, so that all aux devices can be probed.

Fixes: 1a653aa44725 "ASoC: core: replace aux_comp_list to component_dev_list"
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 99b04f4c 15-Dec-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level pcm_new/pcm_free

In current ALSA SoC, Platform only has pcm_new/pcm_free feature,
but it should be supported on Component level. This patch adds it.

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


# 9178feb4 29-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Component level suspend/resume

In current ALSA SoC, Codec only has suspend/resume feature,
but it should be supported on Component level. This patch adds it.

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


# 1a653aa4 29-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: core: replace aux_comp_list to component_dev_list

Now, Card has component_dev_list, we can replace aux_comp_list
to component_dev_list with new auxiliary flags

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


# d9fc4063 29-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: core: replace codec_dev_list to component_dev_list on Card

Current Card has Codec list (= codec_dev_list), but Codec will be
removed in the future. Because of this reason, this patch adds
new Component list in Card, and replace Codec list.

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


# 1b4d9c22 29-Nov-2016 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

ASoC: core: Add component pin control functions

It's often the case that a codec driver will need to control its
own pins. However, if a name_prefix has been applied to this codec it
must be included in the name passed to any of the snd_soc_dapm_x_pin()
functions.

The behaviour of the existing pin control functions is reasonable, since
you may want to search for a fully-specified name within the scope of an
entire card. This means that we can't apply the prefix in these functions
because it will break card-scope searches.

Constructing a prefixed string "manually" in codec drivers leads to a lot
of repetition of the same code.

To make this tidier in codec drivers this patch adds a new set of
equivalent functions that take a struct snd_soc_component instead of a
dapm context and automatically add the component's name_prefix to the
given name. This makes it a simple change in codec drivers to be
prefix-safe.

The new functions are not quite trivial enough to be inlines and the
compiler won't be able to compile-away any part of them.

Although it looks somewhat inefficient to have to allocate a temporary
buffer and combine strings, the current design of the widget list
doesn't lend itself to a more optimized implementation - it's a single
list of all widgets on a card and is searched linearly for a matching
string. As pin state changes are generally low-frequency events it's
unlikely to be a significant issue - at least not enough to rewrite the
widget list handling just for this.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1ef5bcd5 10-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgets

It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

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


# 8f5ebb1b 10-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_name

It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

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


# b6defcca 10-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix

It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

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


# 1ad8ec53 10-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: snd_soc_get_dai_name() become non static

snd_soc_get_dai_name() is used from snd_soc_of_get_dai_name(),
and it is assuming that DT is using "sound-dai" / "#sound-dai-cells".
But graph base DT is using "remote-endpoint". This patch makes
snd_soc_get_dai_name() non static for graph support.

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


# 7364c8dc 10-Nov-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing

It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

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


# 17fb1755 02-Nov-2016 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Define API to find a dai link

Define the API to find an existing DAI link of the soc card by matching
the ID, name and stream name.

Some cards may use unique ID for each DAI link, so matching ID is enough,
and name or stream name are not necessary. But user need to specify name
or stream name as well if not sure whether link ID is unique since most
cards use 0 as the default link ID.

Topology can use this API to find an existing BE link and configure it.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 57619b4c 24-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: remove component from snd_soc_pcm_runtime

commit f2ed6b07645e ("ASoC: Make aux_dev more like a generic component")
removed its usecase. No one is using it now.

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


# a7df0d3b 23-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: bunch up bit field for snd_soc_pcm_runtime

We can reduce struct size in certain environment.

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


# 1236fa1e 23-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: use bit field for playback/capture_only

Current snd_soc_dai_link is already using many bit fields.
Let's use it for playback_only/capture_only too.
We can reduce struct size in certain environment.

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


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

ASoC: remove snd_soc_pcm_set/get_drvdata()

snd_soc_pcm_set_drvdata() will set driver data to rtd->dev,
but driver data of rtd->dev is already used as "rtd" on
soc_post_component_init().

static int soc_post_component_init(xxx)
{
...
dev_set_drvdata(rtd->dev, rtd);
...
}

To remove confusion, this patch removes snd_soc_pcm_set/get_drvdata().

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


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

ASoC: remove codec duplicated callback function

codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch removes codec side duplicated callback function.

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


# dcc0799b 27-May-2016 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ASoC: Introduce SOC_SINGLE_S8_TLV() macro

This patch introduces SOC_SINGLE_S8_TLV() macro for volume control
on chips which supports both negative and positive gains with sign
bit on a 8 bit register, Gain ranges from -128 to +127 with a
predefined step size.
Currently we only have support to DOUBLE_S8_TLV() which does not fit
for cases where we just have separate gain control register for each
channel.

One of the Qualcomm SOC msm8916 has such gain control register whose gain
range is from -38.4dB to +38.4dB with step size of 0.3dB.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 305e9020 18-Apr-2016 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Export snd_soc_find_dai()

This API can be used by topology to find an existing BE dai by name
and further configure it.

Topology will also check DAI ID to avoid wrong match.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2f0ad491 18-Apr-2016 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Change DAI link's be_id to a generic id

The generic ID can be used by topology:
- Toplogy can create FE links and set their ID, machine drivers will
be notified and check this ID for machine-specific init.
- Toplogy can use the ID to find existing BE & CC links and further
configure them.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 64527e8a 15-Jan-2016 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: topology: Add FE DAIs dynamically

Topology will create FE DAIs dynamically from the PCM objects,
and register them to the component.

A PCM topoplogy object describes a FE DAI and DAI link. Later
patch will add FE DAI links as well.

Change tplg load ops for DAI:
- Only process a DAI.
- Pass the DAI driver pointer to the component driver for
extra initialization.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f2ed6b07 05-Jan-2016 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Make aux_dev more like a generic component

aux_dev is mainly used by the machine driver to specify analog devices,
which are registered as codecs. Making it more like a generic component
can help the machine driver to use it to specify any component with
topology info by name.

Details:
- Remove the stub 'rtd_aux' array from the soc card.
- Add a list 'aux_comp_list' to store the components of aux_devs.
And add a list head 'list_aux' to struct snd_soc_component, for adding
such components to the above list.
- Add a 'init' ops to a component for machine specific init.
soc_bind_aux_dev() will set it to be aux_dev's init. And it will be
called when probing the component.
- soc_bind_aux_dev() will also search components by name of an aux_dev,
since it may not be a codec.
- Move probing of aux_devs before checking new DAI links brought by
topology.
- Move removal of aux_devs later than removal of links. Because topology
of aux components may register DAIs and the DAI drivers will go with
removal of the aux components, we want soc_remove_link_dais() to remove
the DAIs at first.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 68003e6c 31-Dec-2015 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Support registering a DAI dynamically

Define API snd_soc_register_dai() to add a DAI dynamically and
create the DAI widgets. Topology can use this API to register DAIs
when probing a component with topology info. These DAIs's playback
& capture widgets will be freed when the sound card is unregistered
and the DAIs will be freed when cleaning up the component.

And a dobj is embedded into the struct snd_soc_dai_driver. Topology
can use the dobj to find the DAI drivers created by it and free them
when the topology component is removed.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 783513ee 29-Dec-2015 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

ASoC: Use nested lock for snd_soc_dapm_mutex_lock

snd_soc_dapm_mutex_lock currently uses the un-nested call which can
cause lockdep warnings when called from control handlers (a relatively
common usage) and using modules. As creating the control causes a
potential mutex inversion with the handler, creating the control will
take the controls_rwsem under the dapm_mutex and accessing the control
will take the dapm_mutex under controls_rwsem.

All the users look like they want to be using the runtime class of the
lock anyway, so this patch just changes snd_soc_dapm_mutex_lock to use
the nested call, with the SND_SOC_DAPM_CLASS_RUNTIME class.

Fixes: f6d5e586b416 ("ASoC: dapm: Add helpers to lock/unlock DAPM mutex")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d13871b3 08-Dec-2015 Damien.Horsley <Damien.Horsley@imgtec.com>

ASoC: Add SOC_DOUBLE_STS macro

Add SOC_DOUBLE_STS macro for read-only volatile status controls

Signed-off-by: Damien.Horsley <Damien.Horsley@imgtec.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d6f220ea 01-Dec-2015 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Define add/remove_dai_link ops for a soc card

A machine driver can register the two ops.

When a DAI link is added or removed by a component's topology, the
ASoC core can call the ops to notify the machine driver for extra
intialization or destruction.

E.g. topology can create FE DAI links from a cpu DAI component, and
the machine driver may define an add_dai_link ops to set machine-specific
.init ops for the DAI link.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f8f80361 01-Dec-2015 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Implement DAI links in a list & define API to add/remove a link

Implement a dai link list for the soc card.

Add APIs to add/remove a DAI links dynamically, e.g. by topology.

And a dobj is embedded into the struct snd_soc_dai_link. Topology can
use the dobj to find the links created by it and remove them when the
topology component is unloaded.

The predefined DAI links are reserved to keep backward compatibility.
And they will also be added to the list.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 50a4f98d 23-Nov-2015 Vinod Koul <vkoul@kernel.org>

ASoC: core: mark SND_SOC_BYTES_EXT as deprecated

Since we have SND_SOC_BYTES_TLV control to lets devices have
larger size data sent, we do not need SND_SOC_BYTES_EXT with 512
byte limitation so mark it deprecated

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a497983 18-Nov-2015 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Change the PCM runtime array to a list

Currently the number of DAI links is statically defined by the machine
driver at build time using an array. This makes it difficult to shrink/
grow the number of DAI links at runtime in order to reflect any changes
in topology.

We can change the DAI link array in the core to a list so that PCMs and
FE DAI links can be added and deleted at runtime to reflect changes in
use case and DSP topology. The machine driver can still register DAI links
as an array.

As the 1st step, this patch change the PCM runtime array to a list. A new
PCM runtime is added to the list when a DAI link is bound successfully.

Later patches will further implement the DAI link list.

More:
- define snd_soc_new/free_pcm_runtime() to create/free a runtime.
- define soc_add_pcm_runtime() to add a runtime to the rtd list.
- define soc_remove_pcm_runtimes() to clean up the runtime list.

- traverse the rtd list to probe the link components and dais.

- Add a field "num" to PCM runtime struct, used to specify the device
number when creating the pcm device, and for a soc card to access
its dai_props array.

- The following 3rd party machine/platform drivers iterate the rtd list
to check the runtimes:
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/intel/boards/cht_bsw_rt5645.c
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/soc/intel/boards/cht_bsw_max98090_ti.c

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a1e5e7e9 09-Nov-2015 Mythri P K <mythri.p.k@intel.com>

ASoC: core: Pass kcontrol to bytes tlv callbacks

Add kcontrol to the tlv callbacks in soc_bytes_ext, as it is
needed for referencing the corresponding control in the driver
code

Also fix the only upstream user in topology core

Signed-off-by: Mythri P K <mythri.p.k@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6f0c4226 13-Oct-2015 Jie Yang <yang.jie@intel.com>

ASoC: compress: add config item for soc-compress to make it compiled only when needed

We don't always need soc-compress in soc, here add a config item
SND_SOC_COMPRESS, when nobody select it, the soc-compress will
not be compiled.

Here also change Kconfig to 'select SND_SOC_COMPRESS' for drivers
that needed soc-compress.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 26d9ca34 18-Oct-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Let snd_soc_limit_volume() take a snd_soc_card

snd_soc_limit_volume() operates on a card and the CODEC that is passed in
is only used to look up the card. Let it directly take the card instead.
This makes it possible to use it when no snd_soc_codec is available.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Tested-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 34198710 14-Oct-2015 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

ASoC: Add info callback for SX_TLV controls

SX_TLV controls are intended for situations where the register behind
the control has some non-zero value indicating the minimum gain
and then gains increasing from there and eventually overflowing through
zero.

Currently every CODEC implementing these controls specifies the minimum
as the non-zero value for the minimum and the maximum as the number of
gain settings available.

This means when the info callback subtracts the minimum value from the
maximum value to calculate the number of gain levels available it is
actually under reporting the available levels. This patch fixes this
issue by adding a new snd_soc_info_volsw_sx callback that does not
subtract the minimum value.

Fixes: 1d99f2436d0d ("ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Tested-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# c25c79b4 29-Sep-2015 Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

ASoC: Add SOC_DOUBLE_R_EXT

_EXT version of SOC_DOUBLE_R required to allow for custom handlers.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a54e22f4 16-Sep-2015 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

ASoC: Add SOC_SINGLE_RANGE_EXT_TLV macro

Add a version of the SOC_SINGLE_RANGE_TLV macro that allows a custom get
and put to be specified.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6131084a 09-Sep-2015 Jyri Sarha <jsarha@ti.com>

ASoC: simple-card: Add tdm slot mask support to simple-card

Adds DT binding for explicitly choosing a tdm mask for DAI and uses it
in simple-card. The API for snd_soc_of_parse_tdm_slot() has also been
changed.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 628536ea 25-Aug-2015 Jonathan Corbet <corbet@lwn.net>

ASoC: Clean up docbook warnings

A number of functions and structures in the sound subsystem had incomplete
and/or obsolete DocBook comments, leading to warnings when the docs were
built. Correct those comments so that we can enjoy our audio in the
absence of warning noise.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7361fbea 21-Jul-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: ac97: Add support for resetting device before registration

AC97 devices need to be initially reset before they can be used. Currently
each driver does this on its own.

Add support for resetting the device to core in snd_soc_new_ac97_codec().
If the caller supplies a device ID and device ID mask the function will
reset the device and verify that it has the correct ID, if it does not a
error is returned.

This will allow to remove custom code with similar functionality from
individual drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5e3cdaa2 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: core: add snd_soc_of_parse_audio_prefix()

Current ASoC can add name_prefix for DAPM, and it is necessary for
route settings. This patch adds snd_soc_of_parse_audio_prefix() for
this purpose. It will be used with snd_soc_of_parse_audio_routing().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# abd31b32 08-Jul-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Use card field to indicate whether a component is bound

Use the card field of a component to indicate whether it is bound or not.
This makes a certain sense given that the field contains the card the
component is bound to and a component can only be bound to one card at a
time. And it also requires to unset the card field when the component is
unbound from the card.

This makes the probded flag redundant and it can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4890140f 06-Jul-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove snd_soc_codec dapm field

There are no more direct users of the snd_soc_codec DAPM field left. So we
can finally remove it and switch over to directly using the component DAPM
context and remove the dapm_ptr indirection.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8a978234 29-May-2015 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: topology: Add topology core

The topology core parses the FW topology file for known block types and
instanciates any common ALSA/ASoC objects that it discovers. The core
also passes any block that is does not understand to client component
drivers for enumeration.

The core exports some APIs to client drivers in order to load and unload
firmware topology data as use case require.

Currently the core deals with the following object types :-

o kcontrols. This includes TLV, enumerated and bytes controls.
o DAPM widgets. All types with any associated kcontrol.
o DAPM graph.
o FE PCM. FE PCM capabilities and configuration can be defined.
o BE DAI Link. BE DAI link capabilities and configuration can be defined.
o Codec <-> codec style links capabilities and configuration.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b073ed4e 11-May-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-pcm: DPCM cares BE format

Current DPCM is caring only FE format. but it will be no sound
if FE/BE was below style, and user selects S24_LE format.

FE: S16_LE/S24_LE
BE: S16_LE

DPCM can rewrite the format, so basically we don't want to
constrain with the BE constraints. But sometimes it will be trouble.
This patch adds new .dpcm_merged_format on struct snd_soc_dai_link.
DPCM will use FE / BE merged format if .struct snd_soc_dai_link
has it. We can have other .dpcm_merged_xxx in the future

.dpcm_merged_foramt
.dpcm_merged_rate
.dpcm_merged_chan

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 561ed680 30-Apr-2015 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

ASoC: dapm: Add support for autodisable mux controls

Commit 57295073b6ac ("ASoC: dapm: Implement mixer input auto-disable")
added support for autodisable controls, controls whose values are only
written to the hardware when their respective widgets are powered up.
But it only added support for controls based on the mixer abstraction.

This patch add support for mux controls (DAPM controls based on the
enum abstraction) to be auto-disabled as well. As each mux can only have
a single control, there is no need to tie the autodisable widget to the
inputs (as is done for the mixer controls) it can be tided directly to
the mux widget itself.

Note that it is assumed that the first entry in a autodisable mux
control will always represent the off state for the mux and is what the
mux will be set to whilst it is disabled.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5967cb3d 30-Apr-2015 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

ASoC: Correct typo in SOC_VALUE_ENUM_SINGLE macro

xnitmes is clearly intended to be xnitems, but all other macros just
refer to this as xitems, so change it to that.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fa880775 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper functions bias level management

Currently drivers are responsible for managing the bias_level field of
their DAPM context. The DAPM state itself is managed by the DAPM core
though and the core has certain expectations on how and when the bias_level
field should be updated. If drivers don't adhere to these undefined
behavior can occur.

This patch adds a few helper functions for manipulating the DAPM context
state, each function with a description on when it should be used and what
its effects are. This will also help us to move more of the bias_level
management from drivers to the DAPM core.

For convenience also add snd_soc_codec_* wrappers around these helpers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 39ed68c8 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper function getting CODEC's DAPM context

The DAPM context in the snd_soc_codec struct is redundant and scheduled to
be replaced by the DAPM context in the snd_soc_component struct. This patch
introduces a new helper function snd_soc_codec_get_dapm() which should be
used for getting the DAPM context for a CODEC rather then directly
accessing the dapm field. Once there are no more direct users of the dapm
field left it is possible to transparently switch all drivers to the
component DAPM context by updating snd_soc_codec_get_dapm() function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2dc0f16b 21-Apr-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc.h: tidyup struct snd_soc_dai_link definition order

Current struct snd_soc_dai_link has many members, but definition order
was random. Especially, bool / bit field are defined randomly.
This patch tidyups these definition order to calculate data alignment
easy.

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


# aae013d6 18-Apr-2015 Jie Yang <yang.jie@intel.com>

ASoC: add static inline funcs to fix a compiling issue

When CONFIG_PM_SLEEP is not selected, calling funcs
snd_soc_suspend and _resume will generate a compiling
issue.

Here add static inline stub functions to fix it.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c6615082 02-Feb-2015 Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>

ASoC: dapm: add code to configure dai link parameters

dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6b5b042d 15-Mar-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Make snd_soc_dapm_kcontrol_codec() inline

snd_soc_dapm_kcontrol_codec() is a extremely simple function and inlining it
typically results in less code than necessary for calling the non-inlined
version of the function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 77c71765 04-Mar-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove snd_soc_jack_new()

There are no users of snd_soc_jack_new() left and new users should use
snd_soc_card_jack_new() instead. So remove the function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 97093996 04-Mar-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Allow to register jacks at the card level

Jacks are typically card level elements, but are currently registered with a
CODEC. When it was originally introduced snd_soc_jack_new() took a
snd_soc_card as its parameter, but at that time DAPM was only implemented at
the CODEC level and there was only one CODEC per card. This made it clear
which CODEC to use for the jack DAPM operations. But the multi-component
patchset added support for having multiple CODECs per card and with it the
API was updated to register jacks with a specific CODEC instance instead.
Subsequently DAPM support at the card level has been introduced, but the
snd_soc_jack_new() API has so remained unchanged.

This leaves us with the issue that the DAPM pins that are managed by the
jack detection logic usually are part of the card DAPM context but are
accessed through a CODEC DAPM context. Currently this works fine, but might
break in the future if we take a more hierarchical approach to DAPM
contexts.

Furthermore with componentization progressing systems that do not register
a snd_soc_codec might appear, while these system may still want to able to
register a jack.

This patch addresses these issues by adding a new function called
snd_soc_card_jack_new() that can be used to register jacks with the card
rather than a CODEC.

This new function is mostly identical to snd_soc_jack_new() except that it
additionally allows to directly specify the DAPM pins associated with the
jack. This was done since most users of snd_soc_jack_new() typically call
snd_soc_jack_add_pins() right after it, which is not necessary with the new
API and allows to reduce the amount of boiler plate code.

The old snd_soc_jack_new() is re-implemented as a wrapper around
snd_soc_card_jack_new().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a6ab46f 03-Mar-2015 Masanari Iida <standby24x7@gmail.com>

ALSA: Fix spelling typo in Documentation/DocBook/alsa-driver-api.xml

This patch fix spelling typo found in alsa-driver-api.xml.
It is because this file is generated from comments in source files,
I have to fix source files.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f23e860e 14-Feb-2015 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: core: Add extra dapm properties for Device Tree

The current helper functions, snd_soc_of_parse_audio_simple_widgets()
and snd_soc_of_parse_audio_routing(), set dapm_widgets and dapm_routes
without caring if they are already set by using build-in widgets and
routes in the card driver. So there could be one of them, build-in one
or Device Tree one, overrided by the other depending on which one was
assigned later.

This patch adds an extra pair of dapm_widgets and dapm_routes for DT
use only so as to prevent unexpected overriding.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 48c7699f 11-Feb-2015 Vinod Koul <vkoul@kernel.org>

ASoC: core: allow pcms to be registered as nonatomic

ALSA core with commit 257f8cce5d40 - "ALSA: pcm: Allow nonatomic trigger
operations" allows trigger ops to implemented as nonatomic. For ASoC, we can
specify this in dailinks and is updated while snd_pcm is created

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 47e03941 23-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add support for allocating AC'97 device before registering it

In some cases it is necessary to before additional operations after the
device has been initialized and before the device is registered. This can
for example be resetting the device.

This patch introduces a new function snd_soc_alloc_ac97_codec() which is
similar to snd_soc_new_ac97_codec() except that it does not register the
device. Any users of snd_soc_alloc_ac97_codec() are responsible for calling
device_add() manually.

Fixes: 6794f709b712 ("ASoC: ac97: Drop delayed device registration")
Reported-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# ce64c8b9 06-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper function for changing the DAI link format

For some setups it is necessary to change the DAI link format at runtime.
This patch factors out the code that does the initial static DAI link format
configuration into a separate helper function which can be used board
drivers as well.

This allows board drivers that have to change the DAI link format at runtime
to reuse it instead of having to manually change the format on all DAIs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c362effe 24-Nov-2014 Jean-Francois Moine <moinejf@free.fr>

ASoC: Remove 'const' from the device_node pointers

As Russell King's explained it, there should not be pointers to
struct device_node:

"struct device_node is a ref-counted structure. That means if you
store a reference to it, you should "get" it, and you should "put"
it once you've done. The act of "put"ing the pointed-to structure
involves writing to that structure, so it is totally unappropriate
to store a device_node structure as a const pointer. It forces you
to have to cast it back to a non-const pointer at various points
in time to use various OF function calls."

[This isn't quite the application here, we're not geting or putting the
pointer though we did add some other users who call non-const OF
functions -- broonie]

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e874bf5f 25-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Disable regmap helpers if regmap is disabled

If regmap is disabled there will be no users of the ASoC regmap helpers.
Furthermore regmap_exit() will no be defined causing the following compile
error:
sound/soc/soc-core.c: In function 'snd_soc_component_exit_regmap':
sound/soc/soc-core.c:2645:2: error: implicit declaration of function
'regmap_exit' [-Werror=implicit-function-declaration]

So disable the helpers if regmap is disabled.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 20feb881988c ASoC: Add helper functions for deferred regmap setup")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 93b0f3ee 25-Nov-2014 Jean-Francois Moine <moinejf@free.fr>

ASoC: core: add multi-codec support in DT

This patch exports a core function which handles the DT description
of multi-codec links (as: "sound-dai = <&hdmi 0>, <&spdif_codec>;")
and creates a CODEC component array in the DAI link.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 20feb881 18-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper functions for deferred regmap setup

Some drivers (most notably the AC'97 drivers) do not have access to their
regmap struct when the component/codec is registered. For those drivers the
automatic regmap setup will not work and needs to be done manually,
typically from the component/CODEC drivers probe callback.

This patch adds a set of helper function to handle deferred regmap
initialization as well as early regmap tear-down.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 358a8bb5 10-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: ac97: Push snd_ac97 pointer to the driver level

Now that the ASoC core no longer needs a handle to the AC'97 device that is
associated with a CODEC we can remove it from the snd_soc_codec struct and
push it into the individual driver state structs like we do for other
communication buses. Doing so creates a clean separation between the AC'97
bus support and the ASoC core.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6794f709 10-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: ac97: Drop delayed device registration

We have all the information and dependencies we need to initialize and
register the device available in snd_soc_new_ac97_codec(). So there is no
need to delay the device registration until after the card itself as been
registered.

This makes the code significantly simpler and also makes it possible to use
the AC'97 device in the CODECs probe function. The later will be required to
be able to convert the AC'97 CODEC drivers to regmap.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ca005f32 10-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: ac97: Drop support for setting platform data via the CPU DAI

This has no users since commit f0fba2ad1b6b ("ASoC: multi-component - ASoC
Multi-Component Support") which was almost 5 years ago. Given that this runs
after CODEC probe functions have been run it also doesn't seem to be that
useful.

So drop it altogether to make the code simpler.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# eda1a701 10-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: ac97: Use static ac97_bus

We always pass soc_ac97_ops to snd_soc_new_ac97_codec(). So instead of
allocating a snd_ac97_bus in snd_soc_new_ac97_codec() just use a static one
that gets initialized when snd_soc_set_ac97_ops() is called.

Also drop the device number parameter from snd_soc_new_ac97_codec(). We
currently only support one device per bus and all drivers pass 0 for the
device number. And if we should ever support multiple devices per bus it
wouldn't be up to individual AC'97 device drivers to pick their number, but
rather either the AC'97 adapter driver or the core code will assign them.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 336b8423 10-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move AC'97 support to its own file

Currently the AC'97 support is splattered all throughout soc-core.c. Some
parts are #ifdef'd some parts are not. This patch moves the AC'97 support to
its own file, this should make the code a bit more clearer and also makes it
possible to easily not compile it into the kernel when not needed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bd6b87c1 09-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove CODEC mutex

The CODEC mutex is now unused and can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 427d204c 08-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove snd_soc_cache_sync() implementation

This function has no more non regmap user, which means we can remove the
implementation of the function and associated functions and structure
fields.

For convenience we keep a static inline version of the function that
forwards calls to regcache_sync() unconditionally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# dd63a9c2 03-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove snd_soc_platform_driver suspend/resume callbacks

Those are unused and new drivers should use device driver suspend/resume.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c1b4d1c7 25-Oct-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Use generic control handlers for S8 control

Commit f227b88f0fce ("ASoC: core: Add signed register volume control logic")
added support for signed control to the generic volsw control handler.
This makes it possible to use them for the S8 control as well, rather than
having to use a custom control handler implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0634814f 20-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove table based DAPM/control setup support from snd_soc_platform_driver

There are no users left and new users should rather use the component_driver
struct embedded in the snd_soc_platform_driver struct to do this. E.g.:

static const struct snd_soc_platform_driver foobar_driver = {
.component_driver = {
.dapm_widgets = ...,
.num_dapm_widgets = ...,
...,
},
...
};

instead of

static const struct snd_soc_platform_driver foobar_driver = {
.dapm_widgets = ...,
.num_dapm_widgets = ...,
...
};

This also allows us to remove the steal_sibling_dai_widgets hack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# c815dbb4 20-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add snd_soc_component_{get,set}_drvdata()

Add Add snd_soc_component_{get,set}_drvdata() similar to
snd_soc_codec_{get,set}_drvdata() and snd_soc_platform_{get,set}_drvdata().
Also update them to use the new functions internally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 86dbf2ac 04-Sep-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add support for automatically going to BIAS_OFF on suspend

There is a substantial amount of drivers that in go to SND_SOC_BIAS_OFF on
suspend and go back to SND_SOC_BIAS_SUSPEND on resume (Often this is even
the only thing done in the suspend and resume handlers). This patch
introduces a new suspend_bias_off flag, which when set by a driver will let
the ASoC core automatically put the device's DAPM context at the
SND_SOC_BIAS_OFF level during suspend. Once the device is resumed the DAPM
context will go back to SND_SOC_BIAS_STANDBY (if the context is idle,
otherwise to SND_SOC_BIAS_ON).

This will allow us to remove a fair bit of duplicated code from the drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b792346f 28-Aug-2014 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: Remove unused cache_only from struct snd_soc_codec

There are no real users for cache_only in "struct snd_soc_codec" so remove
it and needless debugfs node.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 75af7c08 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove support for legacy snd_soc_platform IO

There were never any actual users of this in upstream and by we have with
regmap a replacement in place, which should be used by new drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 886f5692 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Automatically initialize regmap for all components

So far regmap is only automatically initialized for CODECs. Now that we have the
infrastructure in place to let components have DAPM widgets and controls that
want to use the generic regmap based IO also make sure to automatically
initialize regmap for all components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 57bf7726 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Pass component instead of DAPM context to AUX dev init callback

Given that the component is the containing structure it makes more sense to pass
the component rather than the DAPM context to the AUX dev init callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 65d9361f 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move AUX dev support to the component level

This patch makes it possible to register arbitrary components as a AUX dev
for a card. This was previously only possible for CODEC components. With
componentization having made it possible for components to have DAPM contexts
and controls there is no reason why AUX devs should be artificially limited to
snd_soc_codec devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 61aca564 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add component level probe/remove support

Now that we have a unified probe and remove path make sure to call them for all
components. soc_{probe,remove}_component are responsible for setting up the DAPM
context for the component, initialize the component prefix, manage the debugfs
entries as well as do the registration of table based controls and DAPM
elements. They also call the component drivers probe and remove callbacks. This
patch makes these things available for generic snd_soc_component drivers rather
than only having them for snd_soc_codec and snd_soc_platform drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f1d45cc3 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Consolidate platform and CODEC probe/remove

The platform and CODEC probe and remove code is now largely identical. This
patch consolidates it at the component level.

The resulting code is slightly larger due to all the boiler plate code setting
up the indirection for the table based control and DAPM registration. Once all
drivers have been update to no longer use the snd_soc_codec_driver and
snd_soc_platform_driver specific fields for this the indirection can be removed
again.

This patch contains two noteworthy hacks that are only meant to be temporary to
be able to update drivers and the core in separate incremental patches.

The first hack is related to that some DPCM platforms expect that the DAPM
widgets for the DAIs of a snd_soc_component are created in the DAPM context of
the snd_soc_platform that has the same parent device. For handling this the
steal_sibling_dai_widgets attribute is introduced. It gets set for
snd_soc_platforms that register DAPM elements. When creating the DAI widgets for
a component this flag is checked and if it is found on one of the siblings the
component will not create any DAI widgets in its own DAPM context. If the
attribute is set on a platform it will look for siblings components and create
DAI widgets for them in its own context. The fix for this will be to update
the offending drivers to only register a single component rather than two.

The second hack deals with the fact that the ASoC card suspend and resume code
still needs a list of CODECs that have been registered for the card. To handle
this the generic probe and remove path have a check to see if the component is
CODEC and if yes add/remove it to the card's CODEC list. While it is possible to
clean up the suspend/resume code to not need the CODEC list anymore this is a
bit of a chicken and egg problem since it will become easier to clean up the
suspend/resume code once there is a unified component layer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 81c7cfd1 19-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move debugfs registration to the component level

The debugfs registration is mostly identical between platforms and CODECs. This
patches consolidates the two implementations at the component level.

Unfortunately there are still a couple of CODEC specific debugfs files that are
related to legacy ASoC IO that need to be registered. For this a new callback is
added to the component struct that will be initialized when a CODEC is
registered and will be used to register the CODEC specific files. Once there are
no drivers left using legacy IO this can be removed again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 4d61b39b 18-Aug-2014 Subhransu S. Prusty <subhransu.s.prusty@intel.com>

ASoC: core: fix .info for SND_SOC_BYTES_TLV

Commit 7523a271 - "ASoC: core: add a helper for extended byte controls using
TLV" introduced support for TLV byte controls but had a typo for the info
function, so fix the same

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 8ad9f9ef 16-Jun-2014 Sylwester Nawrocki <s.nawrocki@samsung.com>

ASoC: Drop const from struct snd_soc_dai_link *of_node members

Dropping the const qualifiers prevents "passing argument 1 of ‘of_node_put’
discards ‘const’ qualifier from pointer target type" type warnings when
compiling the code dropping reference to cpu_of_node, codec_of_node or
platform_of_node with with an of_node_put() function call.

This lets us to avoid casting to struct device_node * or caching variables
internally in drivers just to be able to properly drop a reference to the
OF node on clean up paths.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 0f2780ad 17-Jul-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add function to register component controls

We have now everything in place to actual let a component register controls. Add
a function which allows to do so.

Also update snd_soc_add_codec_controls() and snd_soc_platform_controls() to use
this new function internally. And while we are at it also change the
num_controls parameter of those two functions from int to unsigned int.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 00200107 17-Jul-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move card field form platform/codec to component

Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the
parent card and both handle this pointer in mostly the same way. This patch
moves the card field to the component level which will allow further code
consolidation between platforms and CODECS.

Since there are only a handful of users of the snd_soc_codec struct's card field
(and none of the snd_soc_platform's) these are update in this patch as well,
which allows it to be removed from the snd_soc_codec struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9898e1cc 17-Jul-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove per card platform list

The platform_dev_list was added in commit f0fba2ad1b ("ASoC: multi-component -
ASoC Multi-Component Support") and while platforms are added and remove from
that list it is otherwise unused. This patch removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 93e6958a 08-Jul-2014 Benoit Cousson <bcousson@baylibre.com>

ASoC: pcm: Add soc_dai_hw_params helper

Add a function helper to factorize the hw_params code.

Suggested by Lars-Peter Clausen <lars@metafoo.de>

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 88bd870f 08-Jul-2014 Benoit Cousson <bcousson@baylibre.com>

ASoC: core: Add initial support for DAI multicodec

DAI link assumes a one to one mapping between CPU DAI and CODEC. In
some cases, the same CPU DAI can be connected to several codecs.
This is the case for example, if you connect two mono codecs to the
same I2S link in order to have a stereo card.
The current ASoC implementation does not allow such setup.

Add support for DAI links composed of a single CPU DAI and multiple
CODECs. Sound cards have to pass the CODECs array in the corresponding
DAI link through a new 'snd_soc_dai_link_component' struct. Each CODEC in
this array is described in the same manner single CODEC DAIs are
(either DT/OF node or codec_name).

Multi-codec links are not supported in the case of CODEC to CODEC links.
Just print a warning if it happens.

Based on an original code done by Misael.

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 7523a271 15-Jul-2014 Omair Mohammed Abdullah <omair.m.abdullah@intel.com>

ASoC: core: add a helper for extended byte controls using TLV

ALSA supports arbitrary length TLVs for each kcontrol that can be used
to pass metadata about the control (e.g. volumes, enum information). The
same transport mechanism is now used for arbitrary length data by
defining a new helper.

Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 1e4c0d7c 07-Jul-2014 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

ASoC: add SOC_VALUE_ENUM_EXT

Adds an equivalent of SOC_ENUM_EXT for value enums

Strictly speaking SOC_ENUM_EXT can also be used to define
a value enum since the only difference is the get and set
functions. But this doesn't look good in code because it is
inconsistent with the normal control definitions. Adding a
specific SOC_VALUE_ENUM_EXT is better for code clarity.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 14e8bdeb 16-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add component level stream_event() and seq_notifier() support

This patch adds stream_event() and seq_notifier() callbacks similar to those
found in the snd_soc_codec_driver and snd_soc_platform driver struct to the
snd_soc_component_driver struct. This is meant to unify the handling of these
callbacks across different types of components and will eventually allow their
removal from the CODEC and platfrom driver structs.

The new callbacks are slightly different from the old ones in that they take a
snd_soc_component as a parameter rather than a snd_soc_dapm_context. This was
done since otherwise casting from the DAPM context to the component would
typically be the first thing to do in the callback. And the interface becomes
slightly cleaner by passing a snd_soc_component to all callbacks in the
snd_soc_component_driver struct.

The patch also already removes the stream_event() callback from the
snd_soc_codec_driver and snd_soc_platform_driver structs as it is currently
unused.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# bc9af9fa 16-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Use component DAPM context for platforms

The snd_soc_platform dapm field is not accessed outside of the ASoC core. Switch
it over to using the snd_soc_component DAPM context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ce0fc93a 16-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add DAPM support at the component level

This patch adds full DAPM support at the component level. Previously there was
only full DAPM support for CODECs and partial DAPM support (e.g. no Mixers nor
MUXs) for platforms. Having DAPM support at the component level will allow all
types of components to use DAPM and also help in consolidating the DAPM support
between CODECs and platforms.

Since the DAPM context is directly embedded into the snd_soc_codec and
snd_soc_platform struct and the 'dapm' field is directly referenced in a lot of
drivers moving the field just right now is not possible without causing code
churn. The approach this patch takes is to add two new fields to the component
struct. One field which is the pointer to the actual DAPM context used by the
component and one DAPM context that will be used as the default if no other
context was specified. For CODECs and platforms the pointer is initialized to
point to the CODEC or platform DAPM context. All generic code when referencing
a component's DAPM struct will go via the pointer. This will make it possible to
eventually seamlessly move the DAPM context from snd_soc_codec and
snd_soc_platform struct over once all direct references have been eliminated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f4333203 16-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move name and id from CODEC/platform to component

The component struct already has a name and id field which are initialized to
the same values as the same fields in the CODEC and platform structs. So remove
them from the CODEC and platform structs and used the ones from the component
struct instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 94f99c87 16-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move name_prefix from CODEC to component

Move the name_prefix from the CODEC struct to the component struct. This will
eventually allow to specify prefixes for all types of components. It is also
necessary to make the DAPM code component type independent (i.e. a DAPM context
does not need to know whether it belongs to a CODEC or a platform or something
else).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 24089e04 18-May-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper functions to cast from DAPM context to CODEC/platform

This is useful if we have a pointer to a DAPM context and know that it is a
CODEC or platform DAPM context and want to get a pointer to the CODEC or
platform.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# e667487b 27-May-2014 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: jack: Fix multiple definition of `snd_soc_jack_add_gpiods'

Commit f025d3b9c64e ("ASoC: jack: Add support for GPIO descriptor defined
jack pins") caused build error when CONFIG_GPIOLIB is not set:

sound/include/sound/soc.h:470: multiple definition of `snd_soc_jack_add_gpiods'
sound/soc/soc-core.o:sound/include/sound/soc.h:470: first defined here
make[2]: *** [sound/soc/snd-soc-core.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [sound/soc] Error 2
make: *** [sound] Error 2

Fix this by marking snd_soc_jack_add_gpiods() as static inline in soc.h.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 83ad152d 27-May-2014 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: jack: Clarify GPIO descriptor lookup in struct snd_soc_jack_gpio doc

Clarify struct snd_soc_jack_gpio documentation for the idx and name fields.
Because name is passed as connection ID to gpiod_get_index() when using GPIO
descriptor defined jack pins it is not only used as a label in debugfs but
also as function name lookup in systems that support functions names for
GPIOs.

Clarify also idx since the index is within the function of the GPIO consumer
device and not within the device itself only.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f025d3b9 26-May-2014 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: jack: Add support for GPIO descriptor defined jack pins

Allow jack GPIO pins be defined also using GPIO descriptor-based interface
in addition to legacy GPIO numbers. This is done by adding two new fields to
struct snd_soc_jack_gpio: idx and gpiod_dev.

Legacy GPIO numbers are used only when GPIO consumer device gpiod_dev is
NULL and otherwise idx is the descriptor index within the GPIO consumer
device.

New function snd_soc_jack_add_gpiods() is added for typical cases where all
GPIO descriptor jack pins belong to same GPIO consumer device. For other
cases the caller must set the gpiod_dev in struct snd_soc_jack_gpio before
calling snd_soc_jack_add_gpios().

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 50dfb69d 26-May-2014 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: jack: Basic GPIO descriptor conversion

This patch does basic GPIO descriptor conversion to soc-jack. Even the GPIOs
are still passed and requested using legacy GPIO numbers the driver
internals are converted to use GPIO descriptor API.

Motivation for this is to prepare soc-jack so that it will allow registering
jack GPIO pins using both GPIO descriptors and legacy GPIO numbers.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# db88a8e3 06-May-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused num_dai field from CODEC

Commit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the
last user of the num_dai field. Also remove the field itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# af0881ff 06-May-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused 'list' field form card

The global card list was removed in commit b19e6e7b7 ("ASoC: core: Use driver
core probe deferral"). The 'list' field of the snd_soc_card struct has been
unused since then. This patch removes the field.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 24faf765 06-May-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove card's DAI list

Commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support") added
a per card list that keeps track of all the DAIs that have been registered with
the card, but the list has never been used. This patch removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# d9881208 01-May-2014 Vinod Koul <vkoul@kernel.org>

ASoC: add SND_SOC_BYTES_EXT

we need _EXT version for SND_SOC_BYTES so that DSPs can use this to pass data
for DSP modules

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 3ca041ed 28-Apr-2014 Sebastian Reichel <sre@kernel.org>

ASoC: dt: Allow Aux Codecs to be specified using DT

This patch adds support for specifying auxiliary codecs and
codec configuration via device tree phandles.

This change adds new fields to snd_soc_aux_dev and snd_soc_codec_conf
and adds support for the changes to SoC core methods.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 389cb834 23-Mar-2014 Jyri Sarha <jsarha@ti.com>

ASoC: core: Update snd_soc_of_parse_daifmt() interface

Adds struct device_node **bitclkmaster and struct device_node **framemaster
function parameters. With the new syntax bitclock-master and frame-master
properties can explicitly indicate the dai-link bit-clock and frame masters
with a phandle. This patch also makes the minimal changes to simple-card
for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears
to be the only user of snd_soc_of_parse_daifmt() for now.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 907fe36a 22-Apr-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move standard kcontrol helpers to the component level

After moving the IO layer inside ASoC to the component level we can now easily
move the standard control helpers also to the component level. This allows to
reuse the same standard helper control implementations for other components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# e2c330b9 22-Apr-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move IO abstraction to the component level

We currently have two very similar IO abstractions in ASoC, one for CODECs, the
other for platforms. Moving this to the component level will allow us to unify
those two. It will also enable us to move the standard kcontrol helpers as well
as DAPM support to the component level.

The new component level abstraction layer is primarily build around regmap.
There is a per component pointer for the regmap instance for the underlying
device. There are four new function snd_soc_component_read(),
snd_soc_component_write(), snd_soc_component_update_bits() and
snd_soc_component_update_bits_async(). They have the same signature as their
regmap counter-part and will internally forward the call one-to-one to regmap.
If the component it not using regmap it will fallback to using the custom IO
callbacks. This is done to be able to support drivers that haven't been
converted to regmap yet, but it is expected that this will eventually be removed
in the future once all component drivers have been converted to regmap.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ab2874a8 19-Apr-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Change return type of snd_soc_write() to int

The CODEC's write callback can return a negative error code, make sure to pass
that on correctly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 8931bf62 16-Apr-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: Add resource managed snd_soc_register_platform()

Simplify error handling and remove repetitive (and rarely executed) code
for unregistration by providing a devm_snd_soc_register_platform()
platform.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 66097ca7 15-Apr-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Fix snd_soc_kcontrol_platform() return type

This should obviously be snd_soc_platform * and not snd_soc_codec *

Fixes: f6272ff8a5f4 ("ASoC: Add snd_soc_kcontrol_platform() helper function")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 785b3c4e 14-Apr-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove deprecated ENUM/MUX macros

Since there are no users left, we can remove the deprecated ENUM and MUX macros
which are just alias for other macros.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 1a39019e 07-Apr-2014 Bard Liao <bardliao@realtek.com>

ASoC: core: Allow snd_soc_update_bits use 32 bits register

Change reg's type from unsigned short to unsigned int. So that we can use
32 bits reg value in snd_soc_update_bits.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# b37f1d12 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Let snd_soc_platform subclass snd_soc_component

There is an increasing amount of code that is very similar between platforms,
CODECS and other components. Making platforms a component will allow us to
share this code. For now the patch just adds component and component_driver
fields to the platform and platform_driver structs and registers the platform as
a component. Followup patches will be used to consolidate code between the
different types of components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 98e639fb 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Track which components have been registered with snd_soc_register_component()

snd_soc_unregister_component() takes the parent device of the component as a
parameter and then looks up the component based on this. This is a problem if
multiple components are registered for the same parent device. Currently drivers
do not do this, but some drivers register a CPU DAI component and a platform for
the same parent device. This will become a problem once platforms are also made
components. To make sure that snd_soc_unregister_component() will not
accidentally unregister the platform in such a case only consider components
that were registered with snd_soc_register_component(). This is only meant as
short term stopgap solution to be able to continue componentisation. Long term
we'll need something different.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 20a0ec27 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove IO register modifier callbacks

There are no ASoC drivers left that use them and new drivers are supposed to use
regmap for this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f6272ff8 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add snd_soc_kcontrol_platform() helper function

For platform controls snd_kcontrol_chip() currently returns a pointer to the
platform that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_platform() helper function that will hide the
implementation details of how the platform for a control can be obtained. This
will allow us to change this easily in the future.

The patch also updates all platforms to use this new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ea53bf77 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add snd_soc_kcontrol_codec() helper function

For CODEC controls snd_kcontrol_chip() currently returns a pointer to the
CODEC that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_codec() helper function that will hide the implementation
details of how the CODEC for a control can be obtained. This will allow us to
change this easily in the future.

The patch also updates all CODEC drivers to use the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# a39f75f7 25-Mar-2014 Xiubo Li <Li.Xiubo@freescale.com>

ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec()

Add the default regmap I/O setting to snd_soc_register_codec() while
the CODEC is initialising, which will be called by CODEC driver device
probe(), and then we can make XXX_set_cache_io() go away entirely from each
CODEC ASoC probe.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 28d6d175 18-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper function to cast component back to CODEC

Add a helper function to cast back from a component struct to the CODEC struct
it is embedded in. This is useful in situations where we know that a certain
component is a CODEC and want to get access to some CODEC specific properties.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 092eba93 10-Mar-2014 Xiubo Li <Li.Xiubo@freescale.com>

ASoC: io: New signature for snd_soc_codec_set_cache_io()

Now that all users have been converted to regmap and the config.reg_bits
and config.val_bits can be setted by each user through regmap core API.
So these two params are redundant here.

Since the only control type that left is SND_SOC_REGMAP, so remove it. Drop
the control params and add struct regmap *regmap to simplify the code.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 1438c2f6 09-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add a per component dai list

Now that every DAI has a component we can track the DAIs on a per component
basis. This simplifies the DAI lookup when we are only interested in DAIs of a
specific component and also makes it possible to have multiple components with
the same parent device and also register DAIs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 3d59400f 05-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move ignore_pmdown_time from CODEC to component

In preparation for componentization move the ignore_pmdown_time field from the
snd_soc_codec struct to the snd_soc_component struct. Set it to true for non
CODEC components for now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# cdde4ccb 05-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move active count from CODEC to component

There is no reason why active count tracking should only be done for CODECs but
not for other components. Moving the active count from the snd_soc_codec struct
to the snd_soc_component struct reduces the differences between CODECs and other
components and will eventually allow component to component DAI links (Which is
a prerequisite for converting CODECs to components).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 5c898e74 05-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper function to check whether a CODEC is active

Instead of directly checking the 'active' field of the CODEC struct add a new
helper function that will return either true or false depending on whether the
CODEC is active. This will make the migration to the component level easier.

The patch also updates all CODEC drivers that check the active attribute to use
the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 24894b76 05-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add helper functions for PCM runtime 'active' management

We have the same code that increments and decrements the active field of the
various PCM runtime components (all with the same bugs). Factor this out into
common helper functions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 208a1589 05-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Handle ignore_pmdown_time for CODEC to CODEC links

For CODEC to CODEC links we should only immediately power down if both CODECs
are configured to ignore the power down delay. Factor the logic for this
into a helper function that can be used for both compressed and normal PCMs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# feff9f3c 04-Mar-2014 Mark Brown <broonie@linaro.org>

ASoC: io: Remove hw_read() operation

We now no longer have any users of hw_read() in the kernel so remove the
code in order to prevent any new users being added. Users should be using
regmap.

Signed-off-by: Mark Brown <broonie@linaro.org>


# b948837a 28-Feb-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add macros for defining virtual enums

With the upcoming consolidation of normal MUXs and virtual MUXs we need to be
able to distinguish between enums with and without a backing register at the
enum level. Use the same approach as used for virtual mixer controls by setting
the reg field of the enum to SND_SOC_NOPM for enums without a backing register.
This patch adds a set of helper macros that can be used to define such enums.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 29ae2fa5 28-Feb-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Consolidate enum and value enum controls

The implementations for enum and value enum controls are almost identical. The
only difference is that the value enum uses an additional look-up table to map
the control value to the register value, while the enum control uses a direct
mapping. Enums and value enums can easily be distinguished at runtime, for value
enums the values field of the snd_soc_enum struct contains the look-up table,
while for enums it is NULL. This patch adds two new small helper functions
called snd_soc_enum_item_to_val() and snd_soc_enum_val_to_item() which map
between register value and control item. If the items field of the snd_soc_enum
struct is NULL the function will do a direct mapping otherwise they'll use the
look-up table to do the mapping. Using these small helper functions it is
possible to use the same kcontrol handlers for both enums and value enums. The
functions are added a inline functions in soc.h so they can also be used by the
DAPM code to accomplish similar consolidation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 8303d769 28-Feb-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused 'reg2' field from soc_enum struct

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# cb29d7b9 22-Feb-2014 xiangxiao <xiaoxiang@xiaomi.com>

ASoC: add data field into snd_soc_jack_gpio

so callback could get the context data as needed

Signed-off-by: xiangxiao <xiaoxiang@xiaomi.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 89c67857 13-Feb-2014 Xiubo Li <Li.Xiubo@freescale.com>

ASoC: core: add TDM slot parsing from DT supports

For some CPU/CODEC DAI devices the TDM slot infomation maybe needed. This
patch adds the slot parsing from DT supports.

TDM slot properties:
dai-tdm-slot-num : Number of slots in use.
dai-tdm-slot-width : Width in bits for each slot.

For instance:
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <8>;

And for each spcified driver, there could be one .of_xlate_tdm_slot_mask()
to specify a explicit mapping of the channels and the slots. If it's absent
the default snd_soc_of_xlate_tdm_slot_mask() will be used to generating the
tx and rx masks.

For snd_soc_of_xlate_tdm_slot_mask(), the tx and rx masks will use a 1 bit
for an active slot as default, and the default active bits are at the LSB of
the masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 56b2f349 19-Feb-2014 Mark Brown <broonie@linaro.org>

ASoC: io: Remove SND_SOC_I2C

Now that all users have been converted to regmap we can eliminate the ASoC
level wrapper for I2C I/O reducing the amount of duplicated functionality.

Signed-off-by: Mark Brown <broonie@linaro.org>


# f6d5e586 18-Feb-2014 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

ASoC: dapm: Add helpers to lock/unlock DAPM mutex

Acquiring the DAPM mutex is necessary before using several DAPM
functions and dereference is quite ugly. This patch provides a helper
function to simplify this.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 2e7e1993 18-Feb-2014 Takashi Iwai <tiwai@suse.de>

ASoC: Add const to SOC_ENUM_*_DECL() macros

Since these macros are supposed to be used for decalring const
objects, let's add the const modifier there.

The doubled const appearing in usages will be cleaned by later
patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9a8d38db 18-Feb-2014 Takashi Iwai <tiwai@suse.de>

ASoC: Rename soc_enum.max field with items

The name "max" in struct soc_enum is rather confusing since it
actually takes the number of items. With "max", one might try to
assign (nitems - 1) value.

Rename the field to a more appropriate one, "items", which is also
used in struct snd_ctl_elem_info, too.

This patch also rewrites some code like "if (x > e->nitems - 1)" with
"if (x >= e->nitems)". Not only the latter improves the readability,
it also fixes a potential bug when e->items is zero.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 7b80300e 15-Feb-2014 Mark Brown <broonie@linaro.org>

ASoC: io: Remove SPI support

All ASoC CODEC drivers that use SPI have now been converted to use regmap
so we can delete SND_SOC_SPI, preventing any new users being added.

Signed-off-by: Mark Brown <broonie@linaro.org>


# 9a6d4860 08-Feb-2014 Xiubo Li <Li.Xiubo@freescale.com>

ASoC: add snd_soc_of_parse_audio_simple_widgets for DT

This patch adds snd_soc_of_parse_audio_simple_widgets() and supports
below style of widgets name on DT:

"template-wname", "user supplied wname"

For instance:
simple-audio-widgets =
"Microphone", "Microphone Jack",
"Line", "Line In Jack",
"Line", "Line Out Jack",
"Headphone", "Headphone Jack",
"Speaker", "Speaker External";

The "template-wname" currently includes: "Microphone", "Line", "Headphone"
and "Speaker".

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# cd21b123 16-Jan-2014 Markus Pargmann <mpa@pengutronix.de>

ASoC: core: Add SOC_DOUBLE_R_S_TLV

Add a macro for signed mixer with two registers and tlv array.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f227b88f 16-Jan-2014 Markus Pargmann <mpa@pengutronix.de>

ASoC: core: Add signed register volume control logic

Some codecs use signed volume control representation with non standard
register sizes, e.g. 6 or 7 bit signed integers.

This patch adds generic signed register volume control logic to
soc-core. Instead of a fixed width signed register control, this
implementation uses a 'min' value and the signed bit location to translate
it to an absolute volume. Using the 'sign_bit' we can calculate a
correct mask for the register values and translate it back into signed
integers of standard size.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 2a99ef0f 17-Jan-2014 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: compress: Add suport for DPCM into compressed audio

Currently compressed audio streams are statically routed from the /dev
to the DAI link. Some DSPs can route compressed data to multiple BE DAIs
like they do for PCM data.

Add support to allow dynamically routed compressed streams using the existing
DPCM infrastructure. This patch adds special FE versions of the compressed ops
that work out the runtime routing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 1e9de42f 07-Jan-2014 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: dpcm: Explicitly set BE DAI link supported stream directions

Some BE DAIs can be "dummy" (when the DSP is controlling the DAI) and as such
wont have set a minimum number of playback or capture channels required for BE
DAI registration (to establish supported stream directions).

Force machine drivers to explicitly set whether they support playback and capture
stream directions for every BE DAIs.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 8778ac6b 21-Nov-2013 Takashi Iwai <tiwai@suse.de>

ASoC: Fix build without CONFIG_GPIOLIB

snd_soc_jack_gpio stuff is currently enabled for CONFIG_GPIOLIB
explicitly with ifdef, and this causes build errors on some drivers
such as:
sound/soc/omap/rx51.c:220:33: error: array type has incomplete element type

Remove ifdef and provide dummy functions for CONFIG_GPIOLIB=n case
instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 3635bf09 13-Nov-2013 Nicolin Chen <b42378@freescale.com>

ASoC: soc-pcm: add symmetry for channels and sample bits

Some SoCs can only work in mono or stereo mode at one time. So if
we let them capture a mono stream while playing a stereo stream,
there might be a problem occur to one of these two streams: double
paced or slowed down.

In soc-pcm.c, we have soc_pcm_apply_symmetry() to apply the rate
symmetry. But we don't have one for channels.

Likewise, we can treat symmetric_rate as a solution for those SoCs
or CODECs which can not handle asymmetrical LRCLK. But it's also
impossible for them to handle asymmetrical BCLK. And accodring to
BCLK = LRCLK * channel number * slot size(fixed or sample bits),
sample bits might also be a problem if they are not using a fixed
slot size.

Thus, this patch applys symmetry for channels and sample bits.

Meanwhile, there might be a race between two substreams if starting
simultaneously. Previously, we only added warning to compalin but
still using conservative way to let it carry on. However, this patch
rejects the second stream with any unmatched parameter to make sure
the first existing stream won't be broken.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 6833c452 16-Oct-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_of_get_dai_name() default of_xlate

Current snd_soc_of_get_dai_name() needs .of_xlate_dai_name()
callback on each component drivers.
But required behavior on almost all these drivers is
just returns its indexed driver's name.

This patch adds this feature as default behavior.
.of_xlate_dai_name() can overwrite it.

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


# 249ce138 06-Oct-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: dapm: Add support for virtual mixer controls

This patch adds support for virtual DAPM mixer controls. They are similar to
virtual DAPM enums. There is no hardware register backing the control, so
changing the control's value wont have any direct effect on the hardware. But it
still influences the DAPM graph by causing the path it sits on to be connected
or disconnected. This in turn can cause power changes for some of the widgets on
the DAPM graph, which will then modify the hardware state.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# cb470087 10-Sep-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add .of_xlate_dai_name on snd_soc_component_driver

ASoC sound driver requires CPU/CODEC drivers for probing,
and each CPU/CODEC has some DAI on it.
Then, "dai name matching" have been used to identify
CPU-CODEC DAI pair on ASoC.

But, the "dai port number matching" is now required from DeviceTree.
The solution of this issue is to replace
the dai port number into dai name.
Now, CPU/CODEC are based on struct snd_soc_component,
and it can care above as common issue.

This patch adds .of_xlate_dai_name callback interface
on struct snd_soc_component_driver,
and snd_soc_of_get_dai_name() which is using .of_xlate_dai_name.

Then, #sound-dai-cells which enables DAI specifier is required
on CPU/CODEC device tree properties.

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


# d191bd8d 04-Sep-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: snd_soc_codec includes snd_soc_component

Codec includes component by this patch,
and component moved to upside of codec
to avoid extra declaration.
Codec dai will be registered via component
by this patch.

Current component register function
is used for cpu, and it is using
dai/dais functions properly to keep
existing cpu dai name.

And now, it will be used from codec also.
But codec driver had been used dais function only
even though it was single dai.
This patch adds new flag which can selects
dai/dais function on component register
function to keep existing codec dai name.

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


# 0e4ff5c8 16-Sep-2013 Mark Brown <broonie@linaro.org>

ASoC: core: Add devm_snd_soc_register_card()

Simplify error handling and remove repetitive (and rarely executed) code
for unregistration by providing a devm_snd_soc_register() card.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>


# a0b03a61 04-Sep-2013 Mark Brown <broonie@linaro.org>

ASoC: core: Implement devm_snd_soc_register_component()

Since with the wider use of devres many drivers are now only calling
snd_soc_unregister_component() in their remove functions providing a
managed version will save a reasonable amount of code.

Signed-off-by: Mark Brown <broonie@linaro.org>


# f90fb3f7 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove infrastructure for supporting multiple cache types

The only cache type left is the flat cache and new other cache types won't be
added since new drivers are supposed to use regmap directly for IO and caching.
This patch removes the snd_soc_cache_ops indirection that was added to support
multiple cache types and modifies the code to always use the flat cache
directly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# a94ed234 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove 'reg_size' field from snd_soc_codec struct

The reg_size field is calculated in snd_soc_register_codec() and then used
exactly once in snd_soc_flat_cache_init(). Since it is calculated based on other
fields from the codec struct just move the calculation to
snd_soc_flat_cache_init() and remove the 'reg_size' field from the codec struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# b012aa61 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove reg_def_copy

reg_def_copy was introduced in commit 3335ddca ("ASoC: soc-cache: Use
reg_def_copy instead of reg_cache_default") to keep a copy of the register
defaults around in case the register defaults where placed in the __devinitdata
section. With the __devinitdata section gone we effectivly keep the same data
around twice. This patch removes reg_def_copy and uses reg_cache_default
directly instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 2a1212a8 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove snd_soc_bulk_write_raw()

No users of snd_soc_bulk_write_raw() are left and new drivers are going to use
regmap directly for this, so the function can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 175ee39e 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove support for reg_access_defaults

No users of reg_access_defaults are left and new drivers are going to use regmap
for this, so support for it can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# d6bead02 29-Aug-2013 Fabio Estevam <fabio.estevam@freescale.com>

ASoC: soc-pcm: Allow to specify unidirectional dai_link

Add 'playback_only' and 'capture_only' fields that can be used for specifying
that a dai_link has a unidirectional capability.

The motivation for this is for the cases of systems, such as Freescale MX28,
that has two unidirectional DAIs.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# d7b1538c 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused sysfs_registered field from snd_soc_codec struct

The sysfs_registered field was added to the snd_soc_codec struct in commit
f0fba2ad ("ASoC: multi-component - ASoC Multi-Component Support"), but has never
been used.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ad758a67 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused debugfs_dapm field from snd_soc_{platform,codec} struct

The DAPM context struct has its own field where it stores the pointer to the
DAPM debugfs entry. The debugfs_dapm field in the snd_soc_platform and
snd_soc_codec structs are completely unused and can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 43d92e7d 31-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused control_type field from snd_soc_codec struct

The control_type field was used by the core to track which raw IO methods to
use, but when switching to regmap this was no longer necessary and so the last
user of the field was removed in commit be3ea3b9 ("ASoC: Use new register map
API for ASoC generic physical I/O"). The field is now completely unused and can
be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 741a509f 19-Aug-2013 Markus Pargmann <mpa@pengutronix.de>

ASoC: core: Generic ac97 link reset functions

This patch adds generic ac97 reset functions using pincontrol and gpio
parsed from devicetree.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9a953e6f 10-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Use snd_soc_info_enum_double() for SOC_ENUM_EXT controls

snd_soc_info_enum_ext() and snd_soc_info_enum_double() are almost identical. The
only difference is that snd_soc_info_enum_double() is also able to handle stereo
controls. Using snd_soc_info_enum double() instead of snd_soc_info_enum_ext()
for the SOC_ENUM_EXT control's info callback allows us to remove
snd_soc_info_enum_ext().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# c77f872e 10-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Remove unused snd_soc_info_volsw_ext()

The SOC_SINGLE_EXT control has been using snd_soc_info_volsw() for its info
callback since commit 1c433fb ("[ALSA] soc - 0.13 ASoC headers"). The
snd_soc_info_volsw_ext() function has been unused ever since then, so remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 57295073 05-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: dapm: Implement mixer input auto-disable

Some devices have the problem that if a internal audio signal source is disabled
the output of the source becomes undefined or goes to a undesired state (E.g.
DAC output goes to ground instead of VMID). In this case it is necessary, in
order to avoid unwanted clicks and pops, to disable any mixer input the signal
feeds into or to active a mute control along the path to the output. Often it is
still desirable to expose the same mixer input control to userspace, so cerain
paths can sill be disabled manually. This means we can not use conventional DAPM
to manage the mixer input control. This patch implements a method for letting
DAPM overwrite the state of a userspace visible control. I.e. DAPM will disable
the control if the path on which the control sits becomes inactive. Userspace
will then only see a cached copy of the controls state. Once DAPM powers the
path up again it will sync the userspace setting with the hardware and give
control back to userspace.

To implement this a new widget type is introduced. One widget of this type will
be created for each DAPM kcontrol which has the auto-disable feature enabled.
For each path that is controlled by the kcontrol the widget will be connected to
the source of that path. The new widget type behaves like a supply widget,
which means it will power up if one of its sinks are powered up and will only
power down if all of its sinks are powered down. In order to only have the mixer
input enabled when the source signal is valid the new widget type will be
disabled before all other widget types and only be enabled after all other
widget types.

E.g. consider the following simplified example. A DAC is connected to a mixer
and the mixer has a control to enable or disable the signal from the DAC.

+-------+
+-----+ | |
| DAC |-----[Ctrl]-| Mixer |
+-----+ : | |
| : +-------+
| :
+-------------+
| Ctrl widget |
+-------------+

If the control has the auto-disable feature enabled we'll create a widget for
the control. This widget is connected to the DAC as it is the source for the
mixer input. If the DAC powers up the control widget powers up and if the DAC
powers down the control widget is powered down. As long as the control widget
is powered down the hardware input control is kept disabled and if it is enabled
userspace can freely change the control's state.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 564c6504 29-Jul-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: dapm: Move snd_soc_dapm_update from dapm context to card

The update field of a DAPM context is only assigned while the card's dapm_mutex
is locked, the field is also cleared again while the mutex is stil locked. So
there will only ever be one DAPM context at a time with a non-NULL update field.
So it is safe to move the update field from the DAPM context struct to the card
struct. Doing so will allow further cleanups in this area.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 4fefd698 29-Jul-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: core: Add snd_soc_card_get_kcontrol()

This is useful for drivers who want to grab a pointer to
snd_kcontrol outside of the kcontrol callbacks.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# b047e1cc 25-Jun-2013 Mark Brown <broonie@linaro.org>

ASoC: ac97: Support multi-platform AC'97

Currently we can only have a single platform built in with AC'97 support
due to the use of a global variable to provide the bus operations. Fix
this by making that variable a pointer and having the bus drivers set the
operations prior to registering.

This is not a particularly good or nice approach but it avoids blocking
multiplatform and a real fix involves fixing the fairly deep problems
with AC'97 support - we should be converting it to a real bus.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 71a45cda 15-Apr-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Add snd_soc_{add, remove}_platform

snd_soc_{add,remove}_platform are similar to snd_soc_register_platform and
snd_soc_unregister_platform with the difference that they won't allocate and
free the snd_soc_platform structure.

Also add snd_soc_lookup_platform which looks up a platform by the device it has
been registered for.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ef03c9ae 26-Mar-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Constify the 'compr_ops' field of snd_soc_platform_driver

The ASoC core does not modify a platform driver's compr_ops structure. Making it
const allows ASoC platform drivers to declare their snd_compr_ops struct as
const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1f03f55b 26-Mar-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Constify the 'ops' field of snd_soc_platform_driver

The ASoC core does not modify a platform driver's ops structure. Making it const
allows ASoC platform drivers to declare their snd_pcm_ops struct as const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d79e57db 26-Mar-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Constify the 'driver' field of snd_soc_platform

The ASoC core does no not modify the driver of a platform. Making it const
allows ASoC platform drivers to declare the snd_soc_platform_driver struct as
const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 61782e4f 14-Mar-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add .name for snd_soc_component_driver

This patch adds .name member on snd_soc_component_driver.
But this patch doesn't care about whether cmpnt_drv was NULL,
and/or its name was NULL in snd_soc_register_component()
at this point.

Because, it is easy to switch over to
snd_soc_register_component() from snd_soc_register_dais()
if it doesn't care cmpnt_drv was NULL.

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


# 030e79f6 11-Mar-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_register_component()

Current ASoC has register function for platform/codec/dai/card,
but doesn't have for cpu.
It often produces confusion and fault on ASoC.

As result of ASoC community discussion,
we consider new struct snd_soc_component for CPU/CODEC,
and will switch over to use it.

This patch adds very basic struct snd_soc_component,
and register function for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e383c467 08-Mar-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: core: Drop unused "dapm" field form soc_enum struct

This field was added in commit 2e72f8e ("ASoC: New enum type: value_enum"), but
has never been used since. Considering that the soc_enum struct is usually
shared between all instances of a CODEC, it also doesn't make much sense to have
a pointer to DAPM specific data in it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a7930ed4 14-Jan-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add snd_soc_of_parse_daifmt() for DeviceTree

This patch adds snd_soc_of_parse_daifmt() and supports below style on DT.

[prefix]format = "i2c";
[prefix]clock-gating = "continuous";
[prefix]bitclock-inversion;
[prefix]bitclock-master;
[prefix]frame-master;

Each driver can use specific [prefix]
(ex simple-card,cpu,dai,format = xxx;)

This sample will be
SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CONT |
SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBM_CFM

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


# 13aec722 10-Jan-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Constify ops and compr_ops fields of snd_soc_dai_link

The core does not modify these fields, so they can be made const. This allows
drivers to declare their op tables as const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 9bde4f0b 19-Dec-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Fix SOC_DOUBLE_RANGE() macros

Although we've had macros defining double _RANGE controls for a while now
they've not actually been backed up properly by the implementation, it's
treated everything as mono. Fix that by implementing the handling in the
stereo controls, ensuring that the mono controls don't mistakenly get
treated as stereo.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 9bffb1fb 12-Dec-2012 Misael Lopez Cruz <misael.lopez@ti.com>

ASoC: Prevent pop_wait overwrite

pop_wait is used to determine if a deferred playback close
needs to be cancelled when the a PCM is open or if after
the power-down delay expires it needs to run. pop_wait is
associated with the CODEC DAI, so the CODEC DAI must be
unique. This holds true for most CODECs, except for the
dummy CODEC and its DAI.

In DAI links with non-unique dummy CODECs (e.g. front-ends),
pop_wait can be overwritten by another DAI link using also a
dummy CODEC. Failure to cancel a deferred close can cause
mute due to the DAPM STOP event sent in the deferred work.

One scenario where pop_wait is overwritten and causing mute
is below (where hw:0,0 and hw:0,1 are two front-ends with
default pmdown_time = 5 secs):

aplay /dev/urandom -D hw:0,0 -c 2 -r 48000 -f S16_LE -d 1
sleep 1
aplay /dev/urandom -D hw:0,1 -c 2 -r 48000 -f S16_LE -d 3 &
aplay /dev/urandom -D hw:0,0 -c 2 -r 48000 -f S16_LE

Since CODECs may not be unique, pop_wait is moved to the PCM
runtime structure. Creating separate dummy CODECs for each
DAI link can also solve the problem, but at this point it's
only pop_wait variable in the CODEC DAI that has negative
effects by not being unique.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 86767b7d 14-Sep-2012 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Avoid recalculating the bitmask for SOC_ENUM controls

For ENUM controls the bitmask is calculated based on the number of items.
Currently this is done each time the control is accessed. And while the
performance impact of this should be negligible we can easily do better. The
roundup_pow_of_two macro performs the same calculation which is currently done
manually, but it is also possible to use this macro with compile time constants
and so it can be used to initialize static data. So we can use it to initialize
the mask field of a ENUM control during its declaration.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 49681077 16-Aug-2012 Vinod Koul <vkoul@kernel.org>

ASoC: add definations for compressed operations

Here we update the asoc structures to add compress stream definations
First the struct snd_soc_dai_driver adds a new member to indicate if the dai is
compressed or pcm. Next we add a new structre the struct snd_soc_compr_ops in
the struct snd_soc_dai_link. This is to be used for machine driver to perform
any opertaions required for setting up compressed audio streams

next is the compressed data operations, they are added using struct
snd_compr_ops in the struct snd_soc_platform_driver.

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 229e3fdc 22-Jun-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Add DOUBLE_R variants of the _RANGE controls

The code handles this fine already, we just need new macros in the header
for drivers to create the controls.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 6c9d8cf6 31-May-2012 Adam Thomson <Adam.Thomson@diasemi.com>

ASoC: core: Add single controls with specified range of values

Control type added for cases where a specific range of values
within a register are required for control.

Added convenience macros:

SOC_SINGLE_RANGE
SOC_SINGLE_RANGE_TLV

Added accessor implementations:

snd_soc_info_volsw_range
snd_soc_put_volsw_range
snd_soc_get_volsw_range

Signed-off-by: Michal Hajduk <Michal.Hajduk@diasemi.com>
Signed-off-by: Adam Thomson <Adam.Thomson@diasemi.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# bc92657a 25-May-2012 Stephen Warren <swarren@nvidia.com>

ASoC: make snd_soc_dai_link more symmetrical

Prior to this patch, the CPU side of a DAI link was specified using a
single name. Often, this was the result of calling dev_name() on the
device providing the DAI, but in the case of a CPU DAI driver that
provided multiple DAIs, it needed to mix together both the device name
and some device-relative name, in order to form a single globally unique
name.

However, the CODEC side of the DAI link was specified using separate
fields for device (name or OF node) and device-relative DAI name.

This patch allows the CPU side of a DAI link to be specified in the same
way as the CODEC side, separating concepts of device and device-relative
DAI name.

I believe this will be important in multi-codec and/or dynamic PCM
scenarios, where a single CPU driver provides multiple DAIs, while also
booting using device tree, with accompanying desire not to hard-code the
CPU side device's name into the original .cpu_dai_name field.

Ideally, both the CPU DAI and CODEC DAI loops in soc_bind_dai_link()
would now be identical. However, two things prevent that at present:

1) The need to save rtd->codec for the CODEC side, which means we have
to search for the CODEC explicitly, and not just the CODEC side DAI.

2) Since we know the CODEC side DAI is part of a codec, and not just
a standalone DAI, it's slightly more efficient to convert .codec_name/
.codec_of_node into a codec first, and then compare each DAI's .codec
field, since this avoids strcmp() on each DAI's CODEC's name within
the loop.

However, the two loops are essentially semantically equivalent.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 07bf84aa 24-Apr-2012 Liam Girdwood <lrg@ti.com>

ASoC: dpcm: Add bespoke trigger()

Some on SoC DSP HW is very tightly coupled with DMA and DAI drivers. It's
necessary to allow some flexability wrt to PCM operations here so that we
can define a bespoke DPCM trigger() PCM operation for such HW.

A bespoke DPCM trigger() allows exact ordering and timing of component
triggering by allowing a component driver to manage the final enable
and disable configurations without adding extra complexity to other
component drivers. e.g. The McPDM DAI and ABE are tightly coupled on
OMAP4 so we have a bespoke trigger to manage the trigger to improve
performance and reduce complexity when triggering new McPDM BEs.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 47c88fff 24-Apr-2012 Liam Girdwood <lrg@ti.com>

ASoC: dpcm: Add API for DAI link substream and runtime lookup

Some component drivers will need to be able to look up their
DAI link substream and RTD data. Provide a mechanism for this.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f86dcef8 24-Apr-2012 Liam Girdwood <lrg@ti.com>

ASoC: dpcm: Add debugFS support for DPCM

Add debugFS files for DPCM link management information.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 01d7584c 24-Apr-2012 Liam Girdwood <lrg@ti.com>

ASoC: dpcm: Add Dynamic PCM core operations.

The Dynamic PCM core allows digital audio data to be dynamically
routed between different ALSA PCMs and DAI links on SoC CPUs with
on chip DSP devices. e.g. audio data could be played on pcm:0,0 and
routed to any (or all) SoC DAI links.

Dynamic PCM introduces the concept of Front End (FE) PCMs and Back
End (BE) PCMs. The FE PCMs are normal ALSA PCM devices except that
they can dynamically route digital audio data to any supported BE
PCM. A BE PCM has no ALSA device, but represents a DAI link and it's
substream and audio HW parameters.

e.g. pcm:0,0 routing digital data to 2 external codecs.

FE pcm:0,0 ----> BE (McBSP.0) ----> CODEC 0
+--> BE (McPDM.0) ----> CODEC 1

e.g. pcm:0,0 and pcm:0,1 routing digital data to 1 external codec.

FE pcm:0,0 ---
+--> BE (McBSP.0) ----> CODEC
FE pcm:0,1 ---

The digital audio routing is controlled by the usual ALSA method
of mixer kcontrols. Dynamic PCM uses a DAPM graph to work out the
routing based upon the mixer settings and configures the BE PCMs
based on routing and the FE HW params.

DPCM is designed so that most ASoC component drivers will need no
modification at all. It's intended that existing CODEC, DAI and
platform drivers can be used in DPCM based audio devices without
any changes. However, there will be some cases where minor changes
are required (e.g. for very tightly coupled HW) and there are
helpers to support this too.

Somethimes the HW params of a FE and BE do not match or are
incompatible, so in these cases the machine driver can reconfigure
any hw_params and make any DSP perform sample rate / format conversion.

This patch adds the core DPCM code and contains :-

o The FE and BE PCM operations.
o FE and BE DAI link support.
o FE and BE PCM creation.
o BE support API.
o BE and FE link management.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# dd7b10b3 20-Apr-2012 Kristoffer KARLSSON <kristoffer.karlsson@stericsson.com>

ASoC: core: Add strobe control

Added support for a control that strobes a bit in
a register to high then back to low (or the inverse).

This is typically useful for hardware that requires
strobing a singe bit to trigger some functionality
and where exposing the bit in a normal single control
would require the user to first manually set then
again unset the bit again for the strobe to trigger.

Added convenience macro.

SOC_SINGLE_STROBE

Added accessor implementations.

snd_soc_get_strobe
snd_soc_put_strobe

Signed-off-by: Kristoffer KARLSSON <kristoffer.karlsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4183eed2 20-Apr-2012 Kristoffer KARLSSON <kristoffer.karlsson@stericsson.com>

ASoC: core: Add signed multi register control

Added control type that can span multiple consecutive codec registers
forming a single signed value in a MSB/LSB manner.
The control dynamically adjusts to the register word size configured
in driver.

Added convenience macro.

SOC_SINGLE_XR_SX

Added accessor implementations.

snd_soc_info_xr_sx
snd_soc_get_xr_sx
snd_soc_put_xr_sx

Signed-off-by: Kristoffer KARLSSON <kristoffer.karlsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c74184ed 04-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Support transparent CODEC<->CODEC DAI links

Rather than having the user half start a stream but avoid any DMA to
trigger data flow on links which don't pass through the CPU create a
DAPM route between the two DAI widgets using a hw_params configuration
provided by the machine driver with the new 'params' member of the
dai_link struct. If no configuration is provided in the dai_link then
use the old style even for CODEC<->CODEC links to avoid breaking
systems.

This greatly simplifies the userspace usage of such links, making them
as simple as analogue connections with the stream configuration being
completely transparent to them.

This is achieved by defining a new dai_link widget type which is created
when CODECs are linked and triggering the configuration of the link via
the normal PCM operations from there. It is expected that the bias
level callbacks will be used for clock configuration.

Currently only the DAI format, rate and channel count can be configured
and currently the only DAI operations which can be called are hw_params
and digital_mute(). This corresponds well to the majority of CODEC
drivers which only use other callbacks for constraint setting but there
is obviously much room for extension here. We can't simply call
hw_params() on startup as things like the system clocking configuration
may change at runtime and in future it will be desirable to offer some
configurability of the link parameters.

At present we are also restricted to a single DAPM link for the entire
DAI. Once we have better support for channel mapping it would also be
desirable to extend this feature so that we can propagate per-channel
power state over the link.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 1d99f243 30-Mar-2012 Brian Austin <brian.austin@cirrus.com>

ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV

Some codecs namely Cirrus Logic Codecs have a way of wrapping the dB scale around 0dB without 0dB being in the middle.

Rework of SOC_DOUBLE_R_SX_TLV to be more consistent with other asoc tlv macros.
Add single register macro : SOC_SINGLE_SX_TLV.
Use snd_soc_info_volsw for .info
Use snd_soc_get_volsw_sx, snd_soc_put_volsw_sx for single and double.

kcontrols for CS42L51 and CS42L73 are adjusted to these new TLV Macros.

The max value is determined by: (number of steps) +1 for 0dB +max from codec datasheet.

Signed-off-by: Brian Austin <brian.austin@cirrus.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b19e6e7b 14-Mar-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Use driver core probe deferral

In version 3.4 the driver core acquired probe deferral which is a core way
of doing essentially the same thing as ASoC has been doing since forever
to make sure that all the devices needed to make up the card are present
without needing open coding in the subsystem.

Make basic use of this probe deferral mechanism for the cards, removing the
need to handle partially instantiated cards. We should be able to remove
even more code than this, though some of the checks we're currently doing
should stay since they're about things like suppressing unneeded DAPM runs
rather than deferring probes.

In order to avoid robustness issues with our teardown paths (which do need
quite a bit of TLC) add a check for aux_devs prior to attempting to set
things up, this means that we've got a reasonable idea that everything will
be there before we start. As with the removal of partial instantiation
support more work will be needed to make this work neatly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 2667b4b8 12-Mar-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: jack: Push locking for jacks down to the jack

Currently operations on jack reporting take the CODEC mutex both to protect
the current jack status and also to protect the DAPM run which is triggered
on status updates. Since the addition of a DAPM-specific lock we no longer
need to worry about locking DAPM as it has its own finer grained lock so
create a per jack lock to take care of the jack status.

This is both cleaner where the jack isn't specifically associated with a
CODEC and clearer as it's much more obvious what the lock is protecting.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6874a918 08-Mar-2012 Liam Girdwood <lrg@ti.com>

ASoC: core: Rename card mutex subclass to better align with usage

Change SND_SOC_CARD_CLASS_PCM to SND_SOC_CARD_CLASS_RUNTIME to better
describe all uses for this mutex subclass and align with DAPM too.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a73fb2df 07-Mar-2012 Liam Girdwood <lrg@ti.com>

ASoC: dapm: Use DAPM mutex for DAPM ops instead of codec mutex

It has now become necessary to use a DAPM mutex instead of the codec
mutex to lock the DAPM operations. This is due to the recent multi
component support and forth coming Dynamic PCM updates.

Currently we lock DAPM operations with the codec mutex of the calling
RTD context. However, DAPM operations can span the whole card context
and all components.

This patch updates the DAPM operations that use the codec mutex to
now use the DAPM mutex PCM subclass for all DAPM ops.

We also add a mutex subclass for DAPM init and PCM operations.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 01b9d99a 07-Mar-2012 Liam Girdwood <lrg@ti.com>

ASoC: core: Add card mutex locking subclasses

This is the first part of a change that is intended to improve
ASoC locking protection for DAPM and PCM operations.

This part of the series adds a mutex class for the soc_card mutex. The
SND_SOC_CARD_CLASS_INIT class is used for card initialisation only whilst the
SND_SOC_CARD_CLASS_PCM class is used for the forth coming Dynamic
PCM operations. The new mutex classes are required otherwise we will see a false
positive mutex deadlock warning between the card initialisation and the PCM
operations (something that would never deadlock in real life).

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cc22d37e 06-Mar-2012 Liam Girdwood <lrg@ti.com>

ASoC: core: Add platform component mutex

Add mutex support for platform IO operations. e.g. can be used
for platform DAPM widget IO ops.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f831b055 17-Feb-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Add support for masking out parts of coefficient blocks

Chip designers frequently include things like the enable and disable
controls for algorithms in the register blocks which also hold the
coefficients. Since it's desirable to split out the enable/disable
control from userspace the plain SND_SOC_BYTES() isn't optimal for
these devices.

Add a SND_SOC_BYTES_MASK() which allows a bitmask from the first word
of the block to be excluded from the control. This supports the needs
of devices I've looked at and lets us have a reasonably simple API.
Further controls can be added in future if that's needed.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 71d08516 10-Oct-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Add SND_SOC_BYTES control for coefficient blocks

Allow devices to export blocks of registers to the application layer,
intended for use for reading and writing coefficient data which can't
usefully be worked with by the kernel at runtime (for example, due to
requiring complex and expensive calculations or being the results of
callibration procedures). Currently drivers are using platform data to
provide configurations for coefficient blocks which isn't at all
convenient for runtime management or configuration development.

Currently only devices using regmap are supported, an error will be
generated for any attempt to work with a byte control on a non-regmap
device. There's no fundamental block to other devices so support could
be added if required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 3056557f 16-Feb-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: dapm: Constify lots of names that are never modified

Neater and avoids warnings when used in other places where const strings
are desired.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 731f1ab2 15-Feb-2012 Sebastien Guiriec <s-guiriec@ti.com>

ASoC: core: add platform DAPM debugfs support

Allow platform widgets to be visible in debugfs like codec widgets.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5124e69e 08-Feb-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: core: Allow CODECs to set ignore_pmdown_time in the driver struct

This is usually not a use case dependant flag anyway.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 022658be 03-Feb-2012 Liam Girdwood <lrg@ti.com>

ASoC: core: Add support for DAI and machine kcontrols.

Currently ASoC can only add kcontrols using codec and platform component device
handles. It's also desirable to add kcontrols for DAIs (i.e. McBSP) and for
SoC card machine drivers too. This allows the kcontrol to have a direct handle to
the parent ASoC component DAI/SoC Card/Platform/Codec device and hence easily
get it's private data.

This change makes snd_soc_add_controls() static and wraps it in the folowing
calls (card and dai are new) :-

snd_soc_add_card_controls()
snd_soc_add_codec_controls()
snd_soc_add_dai_controls()
snd_soc_add_platform_controls()

This patch also does a lot of small mechanical changes in individual codec drivers
to replace snd_soc_add_controls() with snd_soc_add_codec_controls().

It also updates the McBSP DAI driver to use snd_soc_add_dai_controls().

Finally, it updates the existing machine drivers that register controls to either :-

1) Use snd_soc_add_card_controls() where no direct codec control is required.
2) Use snd_soc_add_codec_controls() where there is direct codec control.

In the case of 1) above we also update the machine drivers to get the correct
component data pointers from the kcontrol (rather than getting the machine pointer
via the codec pointer).

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8a713da8 02-Dec-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Use regmap update bits operation for drivers using regmap

If a driver is using regmap directly ensure that we're coherent with
non-ASoC register updates by using the regmap API directly to do our
read/modify/write cycles. This will bypass the ASoC cache but drivers
using regmap directly should not be using the ASoC cache.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 58ba9b25 16-Jan-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow drivers to specify how many bits are significant on a DAI

Most devices accept data in formats that don't correspond directly to
their internal format. ALSA allows us to set a msbits constraint which
tells userspace about this in case it finds it useful (for example, in
order to avoid wasting effort dithering bits that will be ignored when
raising the sample size of data) so provide a mechanism for drivers to
specify the number of bits that are actually significant on a DAI and
add the appropriate constraints along with all the others.

This is done slightly awkwardly as the constraint is specified per sample
size - we loop over every possible sample size, including ones that the
device doesn't support and including ones that have fewer bits than are
actually used, but this is harmless as the upper layers do the right thing
in these cases.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 36ae1a96 06-Jan-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Dynamically allocate the rtd device for a non-empty release()

The device model needs a release() function so it can free devices when
they become dereferenced. Do that for rtds.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 354a2142 21-Dec-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Declare soc_new_pcm() properly

Ensure that everything is seeing the same declaration by moving it to
a header file rather than putting the declaration in soc-core.c

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 5a504963 21-Dec-2011 Stephen Warren <swarren@nvidia.com>

ASoC: Allow DAI links to be specified using device tree nodes

DAI link endpoints and platform (DMA) devices are currently specified
by name. When instantiating sound cards from device tree, it may be more
convenient to refer to these devices by phandle in the device tree, and
for code to describe DAI links using the "struct device_node *"
("of_node") those phandles map to.

This change adds new fields to snd_soc_dai_link which can "name" devices
using of_node, enhances soc_bind_dai_link() to allow binding based on
of_node, and enhances snd_soc_register_card() to ensure that illegal
combinations of name and of_node are not used.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a4a54dd5 12-Dec-2011 Stephen Warren <swarren@nvidia.com>

ASoC: Add utility to parse DAPM routes from device tree

Implement snd_soc_of_parse_audio_routing(), a utility function that can
parses a simple DAPM route table from device tree.The machine driver
specifies the DT property to use, since this is binding-specific.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# bec4fa05 12-Dec-2011 Stephen Warren <swarren@nvidia.com>

ASoC: Add utility to set a card's name from device tree

Implement snd_soc_of_parse_card_name(), a utility function that sets a
card's name from device tree. The machine driver specifies the DT
property to use, since this is binding-specific.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1dfb6efd 10-Nov-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove rbtree register cache

All users now use regmap directly so delete the ASoC version of the code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 84b315ee 02-Dec-2011 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Drop unused state parameter from CODEC suspend callback

The existence of this parameter is purely historical. None of the CODEC drivers
uses it and we always pass in the same value anyway, so it should be safe to
remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1633281b 23-Nov-2011 Stephen Warren <swarren@nvidia.com>

ASoC: Implement fully_routed card property

A card is fully routed if the DAPM route table describes all connections on
the board.

When a card is fully routed, some operations can be automated by the ASoC
core. The first, and currently only, such operation is described below, and
implemented by this patch.

Codecs often have a large number of external pins, and not all of these pins
will be connected on all board designs. Some machine drivers therefore call
snd_soc_dapm_nc_pin() for all the unused pins, in order to tell the ASoC core
never to activate them.

However, when a card is fully routed, the information needed to derive the
set of unused pins is present in card->dapm_routes. In this case, have
the ASoC core automatically call snd_soc_dapm_nc_pin() for each unused
codec pin.

This has been tested with soc/tegra/tegra_wm8903.c and soc/tegra/trimslice.c.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c9016a79 10-Nov-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove LZO cache type

There are no current users and new drivers ought to be using the regmap
API and its cache implementation directly so just delete the ASoC copy.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d66a327d 10-Nov-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove extra space in runtime struct definition

My usual technique for finding definitions is to search for "name {"
which breaks with the extra space.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e50fad4f 26-Oct-2011 ramesh.babu@linux.intel.com <ramesh.babu@linux.intel.com>

ASoC: Allow machines to ignore pmdown_time per-link

With this flag, each dai_link in machine driver can choose
to ignore pmdown_time during DAPM shut down sequence.

If the ignore_pmdown_time is set, the DAPM for corresponding DAI
will be executed immediately.

Signed-off-by: Ramesh Babu K V <ramesh.babu@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1d69c5c5 14-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Add flag to ignore pmdown_time at pcm_close

With this flag codec drivers can indicate that it is desired
to ignore the pmdown_time for DAPM shutdown sequence when
playback stream is stopped.
The DAPM sequence will be executed without delay in this case.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a92f1394 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: fix codec breakage caused by the volsw/volsw_2r merger

By accident few places still uses the _2r calls from
the core.
This is a quick fix, the drivers using the old callbacks
going to be changed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1576a5ff 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Remove snd_soc_put_volsw_2r definition

We do not have users for snd_soc_put_volsw_2r anymore.
It can be removed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 974815ba 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Combine snd_soc_put_volsw/put_volsw_2r functions

Handle the put_volsw/put_volsw_2r in one function.

To avoid build breakage in twl6040 keep the
snd_soc_put_volsw_2r as define, and map it snd_soc_put_volsw.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f7915d99 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Combine snd_soc_get_volsw/get_volsw_2r functions

Handle the get_volsw/get_volsw_2r in one function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e8f5a103 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Combine snd_soc_info_volsw/info_volsw_2r functions

Handle the info_volsw/info_volsw_2r in one function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 30d86ba4 05-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Change SOC_SINGLE/DOUBLE_VALUE representation

SOC_SINGLE/DOUBLE_VALUE is used for mixer controls, where the
bits are within one register.

Assign .rreg to be the same as .reg for these types.

With this change we can tell if the mixer in question:
is mono:
mc->reg == mc->rreg && mc->shift == mc->rshift

is stereo, within single register:
mc->reg == mc->rreg && mc->shift != mc->rshift

is stereo, in two registers:
mc->reg != mc->rreg

The patch provide a small inline function to query, if the mixer
is stereo, or mono.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# db432b41 03-Oct-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Do DAPM power checks only for widgets changed since last run

In order to reduce the number of DAPM power checks we run keep a list of
widgets which have been changed since the last DAPM run and iterate over
that rather than the full widget list. Whenever we change the power state
for a widget we add all the source and sink widgets it has to the dirty
list, ensuring that all widgets in the path are checked.

This covers more widgets than we need to as some of the neighbour widgets
won't be connected but it's simpler as a first step. On one system I tried
this gave:

Power Path Neighbour
Before: 207 1939 2461
After: 114 1066 1327

which seems useful.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cdffa775 04-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Introduce SOC_DOUBLE_R_VALUE macro

With the new macro we can remove duplicated code
for the SOC_DOUBLE_R type of controls.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 460acbec 04-Oct-2011 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: core: Introduce SOC_DOUBLE_VALUE macro

With the new macro we can remove duplicated code
for the SOC_DOUBLE type of controls.
We can also remap the SOC_SINGLE_VALUE macro to
SOC_DOUBLE_VALUE

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 75d9ac46 27-Sep-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow DAI formats to be specified in the dai_link

For almost all machines the DAI format is a constant, always set to the
same thing. This means that not only should we normally set it on init
rather than in hw_params() (where it has been for historical reasons) we
should also allow users to configure this by setting a variable in the
dai_link structure. The combination of these two will make many machine
drivers even more data driven.

Implement a new dai_fmt field in the dai_link doing just that. Since 0 is
a valid value for many format flags and we need to be able to tell if the
field is actually set also add one to all the values used to configure
formats.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 17841020 29-Aug-2011 Dong Aisheng <b29396@freescale.com>

ASoC: soc-core: symmetry checking for each DAIs separately

The orginal code does not cover the case that one DAI such as codec
may be shared between other two DAIs(CPU).
When do symmetry checking, altough the codec DAI requires symmetry,
the two CPU DAIs may still be configured to run on different rates.

We change to check each DAI's state separately instead of only checking
the dai link to prevent this issue.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# de02d078 20-Sep-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Trace and collect statistics for DAPM graph walking

One of the longest standing areas for improvement in ASoC has been the
DAPM algorithm - it repeats the same checks many times whenever it is run
and makes no effort to limit the areas of the graph it checks meaning we
do an awful lot of walks over the full graph. This has never mattered too
much as the size of the graph has generally been small in relation to the
size of the devices supported and the speed of CPUs but it is annoying.

In preparation for work on improving this insert a trace point after the
graph walk has been done. This gives us specific timing information for
the walk, and in order to give quantifiable (non-benchmark) numbers also
count every time we check a link or check the power for a widget and report
those numbers. Substantial changes in the algorithm may require tweaks to
the stats but they should be useful for simpler things.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# da1c6ea6 24-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow source specification for CODEC level sysclk

Similarly to PLLs/FLLs some modern CODECs provide selectable system clock
sources. When the clock is the clock for a DAI we do not usually need to
identify which clock is being configured so can use clk_id for the source
clock but with CODEC wide system clocks we will need to specify both the
clock being configured and the source.

Add a source argument to the CODEC driver set_sysclk() operation to
reflect this. As this operation is not as widely used as the DAI
set_sysclk() operation the change is not very invasive. We probably
ought to go and make the same alternation for DAIs at some point.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4a8923ba 24-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow register defaults to be larger than unsigned short

Devices that need this exist; obviously the newer regmap defaults
mechanism will deal with this more happily.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 33c5f969 22-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow idle_bias_off to be specified in CODEC drivers

If devices can unconditionally support idle_bias_off let them flag it in
their driver structure.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 0671da18 23-Jul-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add regmap as a control type

Allow drivers to set up their own regmap API structures. This is mainly
useful with MFDs where the core driver will have set up regmap at the
minute, though it may make sense to push the existing regmap setup out
of the core into the drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# be3ea3b9 13-Jun-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Use new register map API for ASoC generic physical I/O

Remove all the ASoC specific physical I/O code and replace it with calls
into the regmap API. The bulk write code can only be used safely if all
regmap calls are locked with the CODEC lock, we need to add bulk support
to the regmap API or replace the code with an open coded loop (though
currently it has no users...).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 64a648c2 25-Jul-2011 Liam Girdwood <lrg@ti.com>

ASoC: dapm - Add DAPM stream completion event.

In preparation for Dynamic PCM (AKA DSP) support.

This adds a callback function to be called at the completion of a DAPM stream
event.

This can be used by DSP components to perform calculations based on DAPM graphs
after completion of stream events.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cb2cf612 04-Jul-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - Add convenience register for platform kcontrol and DAPM

Allow platform probe to register platform kcontrols and DAPM just like
the CODEC probe().

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b7950641 04-Jul-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - Add platform widget IO

Allow platform driver widgets to perform any IO required for DAPM.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a491a5c8 04-Jul-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - Add API call to register platform kcontrols.

In preparation for Dynamic PCM (AKA DSP) support.

Allow platform drivers to register kcontrols.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f1442bc1 04-Jul-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - Add platform read and write.

In preparation for ASoC Dynamic PCM (AKA DSP) support.

Allow platform driver to perform IO. Intended for platform DAPM.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e9c03905 13-Jun-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove unused and about to be broken SND_SOC_CUSTOM I/O bus

This will be removed in -next so let's drop it from mainline as soon as
we can in order to minimise surprises.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b8c0dab9 09-Jun-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - PCM mutex per rtd

In preparation for the new ASoC Dynamic PCM support (AKA DSP support).

The new ASoC Dynamic PCM core allows DAIs to be dynamically re-routed
at runtime between the PCM device end (or Frontend - FE) and the physical DAI
(Backend - BE) using regular kcontrols (just like a hardware CODEC routes
audio in the analog domain). The Dynamic PCM core therefore must be
able to call PCM operations for both the Frontend and Backend(s) DAIs at
the same time.

Currently we have a global pcm_mutex that is used to serialise
the ASoC PCM operations. This patch removes the global mutex
and adds a mutex per RTD allowing the PCM operations to be reentrant and
allow control of more than one DAI at at time. e.g. a frontend PCM hw_params()
could configure multiple backend DAI hw_params() with similar or different
hw parameters at the same time.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 0168bf0d 07-Jun-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - Allow components to probe/remove in sequence.

Some ASoC components depend on other ASoC components to provide clocks and
power resources in order to probe() and vice versa for remove().

Allow components to be ordered so that components can be probed() and removed()
in sequences that conform to their dependencies.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 552d1ef6 07-Jun-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - Optimise and refactor pcm_new() to pass only rtd

Currently pcm_new() passes in 3 arguments :- card, pcm and DAI.

Refactor this to only pass in 1 argument (i.e. the rtd) since struct rtd contains
card, pcm and DAI along with other members too that are useful too.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d4c6005f 06-Jun-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add context parameter to card DAPM callbacks

The card callback will get called for each DAPM context in the card so it
can be useful for it to know which device is currently undergoing a
transition.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 56fba41f 04-Jun-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Specify target bias state directly as a bias state

Rather than a simple flag to say if we want the DAPM context to be at full
power specify the target bias state. This should have no current effect
but is a bit more direct and so makes it easier to change our decisions
about the which bias state to go into in future.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 22de71ba 12-May-2011 Liam Girdwood <lrg@ti.com>

ASoC: core - allow ASoC more flexible machine name

Allow ASoC machine drivers to register a driver name
and a longname. This allows user space to determine
the flavour of machine driver.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 87023ff7 02-May-2011 Takashi Iwai <tiwai@suse.de>

ASoC: Declare const properly for enum texts

The enum texts are supposed to be const char * const []. Without the
second const, it gets compile warnings like
sound/soc/codecs/max98095.c:607:2: warning: initialization discards qualifiers from pointer target type

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fb257897 28-Apr-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Work around allmodconfig failure

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# d06e48db 12-Apr-2011 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Make struct snd_soc_card's dapm_widgets and dapm_routes const

Those should not be modified (and are not) by the core code, so make them const.
This also makes them consistent with the same members of snd_soc_codec.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b7af1daf 07-Apr-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add data based control initialisation for CODECs and cards

Allow CODEC and card drivers to point to an array of controls from their
driver structure rather than explicitly calling snd_soc_add_controls().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 239c9706 24-Mar-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Add snd_soc_codec_{readable,writable}_register()

Provide the top level ASoC core functions for indicating whether
a given register is readable or writable.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8020454c 24-Mar-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Add default snd_soc_default_writable_register() callback

By using struct snd_soc_reg_access for the read/write/vol attributes
of the registers, we provide callbacks that automatically determine whether
a given register is readable/writable or volatile.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 67850a89 22-Mar-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Add control_type in snd_soc_codec

This is mainly used by the soc-cache code to easily determine the
currently used underlying serial bus. Set SND_SOC_CUSTOM to 1 so we
can distinguish it if it is not initialized or set.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5fb609d4 22-Mar-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Introduce raw bulk write support

As it has become more common to have to write firmware or similar
large chunks of data to the hardware, add a function to perform
raw bulk writes that bypass the cache. This only handles volatile
registers as we should avoid getting out of sync with the actual
cache.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# efb7ac3f 08-Mar-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Fix prefixing of DAPM controls by factoring prefix into snd_soc_cnew()

Currently will ignore prefixes when creating DAPM controls. Since currently
all control creation goes through snd_soc_cnew() we can fix this by factoring
the prefixing into that function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# ec4ee52a 07-Mar-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Provide CODEC clocking operations and API calls

When multi component systems use DAIless amplifiers which require clocking
configuration it is at best hard to use the current clocking API as this
requires a DAI even though the device may not even have one. Address this
by adding set_sysclk() and set_pll() operations and APIs for CODECs.

In order to avoid issues with devices which could be used either with or
without DAIs make the DAI variants call through to their CODEC counterparts
if there is no DAI specific operation. Converting over entirely would create
problems for multi-DAI devices which offer per-DAI clocking setup.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 89b95ac0 07-Mar-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add DAPM widget and path data to CODEC driver structure

Allow a slight simplification of CODEC drivers by allowing DAPM routes and
widgets to be provided in a table. They will be instantiated at the end of
CODEC probe.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 28e9ad92 02-Mar-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add a late_probe() callback to cards

This is run after the DAPM widgets and routes are added, allowing setup
of things like jacks using the routes. The main card probe() is run before
anything else so can't be used for this purpose.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# b8ad29de 02-Mar-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow card DAPM widgets and routes to be set up at registration

These will be added after all devices are registered and allow most DAI
init functions in machine drivers to be replaced by simple data.
Regular controls are not supported as the registration function still
works in terms of CODECs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# e37a4970 02-Mar-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add a per-card DAPM context

This means that rather than adding the board specific DAPM widgets to a
random CODEC DAPM context they can be added to the card itself which is
a bit cleaner. Previously there only was one DAPM context and it was
tied to the single supported CODEC.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# fadddc87 17-Feb-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add kerneldoc for jack_status_check callback

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 7887ab3a 17-Feb-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow GPIO jack detection to be configured as a wake source

Some systems wish to use jacks as wake sources. Provide a wake flag in the
GPIO configuration which causes the driver to enable the IRQ as a wake
source.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# fa9879ed 09-Feb-2011 Vinod Koul <vkoul@kernel.org>

ASoC: add support for multiple jack types

This patch adds soc-jack support for adding voltage zones and for
detecting jack type

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Harsha Priya <priya.harsha@intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# dddf3e4c 28-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add card driver data

Provide driver data for cards within the card structure. To simplify the
implementation of the PM operations we don't use the struct device driver
data as this is used by the core to retrieve the card in callbacks from
the device model and PM core.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# f85a9e0d 26-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add subsequence information to seq_notify callbacks

Allows drivers to distinguish which subsequence is being notified when
they get called back.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# aaee8ef1 26-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Make cache status available via debugfs

Could just as well live in sysfs but sysfs doesn't have the simple
value export helpers debugfs does.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 6f8ab4ac 26-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Export card PM callbacks for use in direct registered cards

Allow hookup of cards registered directly with the core to the PM
operations by exporting the device power management operations to
modules, also exporting the default PM operations since it is
expected that most cards will end up using exactly the same setup.

Note that the callbacks require that the driver data for the card be
the snd_soc_card.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# e7361ec4 26-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Replace pdev with card in machine driver probe and remove

In order to support cards instantiated without using soc-audio remove
the use of the platform device in the card probe() and remove() ops.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 70b2ac12 26-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Use card rather than soc-audio device to card PM functions

The platform device for the card is tied closely to the soc-audio
implementation which we're currently trying to remove in favour of
allowing cards to have their own devices. Begin removing it by
replacing it with the card in the suspend and resume callbacks we
give to cards, also taking the opportunity to remove the legacy
suspend types which are currently hard coded anyway.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 181e055e 24-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Fix type for snd_soc_volatile_register()

We generally refer to registers as unsigned ints (including in the
underlying CODEC driver operation).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# dad8e7ae 19-Jan-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Introduce the cache_bypass option

This is primarily needed to avoid writing back to the cache
whenever we are syncing the cache with the hardware. This gives a
performance benefit especially for large register maps.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 474b62d6 18-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Provide per widget type callback when executing DAPM sequences

Many modern devices have features such as DC servos which take time to start.
Currently these are handled by per-widget events but this makes it difficult
to paralleise operations on multiple widgets, meaning delays can end up
being needlessly serialised. By providing a callback to drivers when all
widgets of a given type have been handled during a DAPM sequence the core
allows drivers to start operations separately and wait for them to complete
much more simply.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 70a7ca34 14-Jan-2011 Vinod Koul <vkoul@kernel.org>

ASoC: soc core allow machine driver to register the card

The machine driver can't register the card directly and need to do this thru
soc-audio device creation

This patch allows the register and unregister card to be directly called by
machine drivers

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Harsha Priya <priya.harsha@intel.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4e10bda0 13-Jan-2011 Vinod Koul <vkoul@kernel.org>

ASoC: soc core add inline to handle card list initialzation

Currently the soc_probe initializes the card hence it does the card list
initialzation. But if machines directly register the card they would need to
do these steps, so putting them as inline would save lot of code

This patch adds an inline to do list initialzation

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Harsha Priya <harsha.priya@intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1500b7b5 12-Jan-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Automatically assign the default readable()/volatile() functions

Ensure that all calls to readable_register()/volatile_register() go via
the snd_soc_codec function pointers.

If the default register access table has been given but no functions
for handling readable()/volatile() registers, use the default ones provided
by soc-cache.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d4754ec9 12-Jan-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Update users of readable_register()/volatile_register()

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 066d16c3 12-Jan-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Add support for default readable()/volatile() functions

For common scenarios, device drivers can provide a table of all the
registers that are at least either readable/writable/volatile. The idea
is that if a register lookup fails, all of its read/write/vol members
will be zero and will be treated as default. This also reduces the
size of the register access array.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# aea170a0 12-Jan-2011 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Add reg_size as a member to snd_soc_codec

Simplify the use of reg_size, by calculating it once and storing it in
the codec structure for later reference. The value of reg_size is
reg_cache_size * reg_word_size.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8a9dab1a 10-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Update name of debugfs root symbol to snd_soc_

Everything else is using snd_soc_ so we should use it here too.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# faff4bb0 07-Jan-2011 Stephen Warren <swarren@nvidia.com>

ASoC: Export debugfs root dentry

A couple Tegra ASoC drivers will create debugfs entries. Mark requested
these by under debugfs/asoc/ not just debugfs/. To enable this, export
the dentry representing debugfs/asoc/.

Also, rename debugfs_root -> asoc_debugfs_root now it's exported to
prevent potential symbol name clashes.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7be31be8 13-Dec-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Extend DAPM to handle power changes on cross-device paths

Power change event like stream start/stop or kcontrol change in a
cross-device path originates from one device but codec bias and widget power
changes must be populated to another devices on that path as well.

This patch modifies the dapm_power_widgets so that all the widgets on a
sound card are checked for a power change, not just those that are specific
to originating device. Also bias management is extended to check all the
devices. Only exception in bias management are widgetless codecs whose bias
state is changed only if power change is originating from that context.

DAPM context test is added to dapm_seq_run to take care of if power sequence
extends to an another device which requires separate register writes.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 97c866de 13-Dec-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Move widgets from DAPM context to snd_soc_card

Decoupling widgets from DAPM context is required when extending the ASoC
core to cross-device paths. Even the list of widgets are now kept in
struct snd_soc_card, the widget listing in sysfs and debugs remain sorted
per device.

This patch makes possible to build cross-device paths but does not extend
yet the DAPM to handle codec bias and widget power changes of an another
device.

Cross-device paths are registered by listing the widgets from device A in
a map for device B. In case of conflicting widget names between the devices,
a uniform name prefix is needed to separate them. See commit ead9b91
"ASoC: Add optional name_prefix for kcontrol, widget and route names" for
help.

An example below shows a path that connects MONO out of A into Line In of B:

static const struct snd_soc_dapm_route mapA[] = {
{"MONO", NULL, "DAC"},
};

static const struct snd_soc_dapm_route mapB[] = {
{"Line In", NULL, "MONO"},
};

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8ddab3f5 13-Dec-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Move DAPM paths from DAPM context to snd_soc_card

Decoupling DAPM paths from DAPM context is a first prerequisite when
extending ASoC core to cross-device paths. This patch is almost a nullop and
does not allow to construct cross-device setup but the path clean-up part in
dapm_free_widgets is prepared to remove cross-device paths between a device
being removed and others.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 05d209ad 08-Dec-2010 Seungwhan Youn <sw.youn@samsung.com>

ASoC: Remove unnecessary structure definitions

This patch removes some legacy structure definitions which are not using
in current ASoC drivers.

Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 0d735eaa 06-Dec-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Add optional cache name member to snd_soc_cache_ops

Added an optional name member to snd_soc_cache_ops to enable more
sensible diagnostic messages during cache init, exit and sync.

Remove redundant newline in source code.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1badabd9 03-Dec-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add post-CODEC bias level callback for machine driver

Currently the machine driver can only do bias level configuration before
the CODEC bias level is brought up. This means that the machine cannot do
any configuration which depends on the CODEC bias level being maintained.
Provide a post-CODEC callback which allows the machine driver to do things
like enable the FLL on a CODEC which is brought down to BIAS_OFF when idle.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 001ae4c0 02-Dec-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Constify struct snd_soc_codec_driver

Allow the CODEC driver structure to be marked const by making all
the APIs that use it do so.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# fdf0f54d 02-Dec-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-core: Allow machine drivers to override compress_type

This patch allows machine drivers to override the compression type
provided by the codec driver.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3335ddca 02-Dec-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Use reg_def_copy instead of reg_cache_default

Make sure to use codec->reg_def_copy instead of codec_drv->reg_cache_default
wherever necessary. This change is necessary because in the next patch we
move the cache initialization code outside snd_soc_register_codec() and by that
time any data marked as __devinitconst such as the original reg_cache_default
array might have already been freed by the kernel.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ff819b83 02-Dec-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-core: Generalize snd_soc_prefix_map and rename to snd_soc_codec_conf

The snd_soc_codec_conf struct now holds codec specific configuration
information.

A new configuration option has been added to allow machine drivers to
override the compression type set by the codec driver.

In the absence of providing an snd_soc_codec_conf struct or when providing
one but not setting the compress_type member to anything, the one supplied
by the codec driver will be used instead. In all other cases the one
set in the snd_soc_codec_conf struct takes effect.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 119bd789 02-Dec-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Change the base value of compress_type

Ensure that the base value of compress_type starts at 1 so that
we know whether the machine driver has provided a compress_type
for overriding the codec supplied one.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 23bbce34 02-Dec-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: Add compress_type as a member to snd_soc_codec

We need to keep a copy of the compress_type supplied by the codec driver
so that we can override it if necessary with whatever the machine driver
has provided us with. The reason for not modifying the codec->driver
struct directly is that ideally we'd like to keep it const.

Adjust the code in soc-cache and soc-core to make use of the compress_type
member in the snd_soc_codec struct.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c3acec26 02-Dec-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Move active copy of CODEC read and write into runtime structure

We shouldn't be assigning to the driver structure (which really ought
to be const, further patch to follow) though there's unlikely to be any
actual problem except in the unlikely case that two devices with the
same driver but different bus types appear in the same system.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 2eea392d 25-Nov-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Add support for optional auxiliary dailess codecs

This makes possible to register auxiliary dailess codecs in a machine
driver. Term dailess is used here for amplifiers and codecs without DAI or
DAI being unused.

Dailess auxiliary codecs are kept in struct snd_soc_aux_dev and those codecs
are probed after initializing the DAI links. There are no major differences
between DAI link codecs and dailess codecs in ASoC core point of view. DAPM
handles them equally and sysfs and debugfs directories for dailess codecs
are similar except the pmdown_time node is not created.

Only suspend and resume functions are modified to traverse all probed codecs
instead of DAI link codecs.

Example below shows a dailess codec registration.

struct snd_soc_aux_dev foo_aux_dev[] = {
{
.name = "Amp",
.codec_name = "codec.2",
.init = foo_init2,
},
};

static struct snd_soc_card card = {
...
.aux_dev = foo_aux_dev,
.num_aux_devs = ARRAY_SIZE(foo_aux_dev),
};

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# df0701bb 29-Nov-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Ensure consistent cache naming

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ead9b919 13-Nov-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Add optional name_prefix for codec kcontrol, widget and route names

There is a need to prefix codec kcontrol, widget and internal route names in
an ASoC machine that has multiple codecs with conflicting names. The name
collision would occur when codec drivers try to registering kcontrols with
the same name or when building audio paths.

This patch introduces optional prefix_map into struct snd_soc_card. With it
machine drivers can specify a unique name prefix to each codec that have
conflicting names with anothers. Prefix to codec is matched with codec
name.

Following example illustrates a machine that has two same codec instances.
Name collision from kcontrol registration is avoided by specifying a name
prefix "foo" for the second codec. As the codec widget names are prefixed
then second audio map for that codec shows a prefixed widget name.

static const struct snd_soc_dapm_route map0[] = {
{"Spk", NULL, "MONO"},
};

static const struct snd_soc_dapm_route map1[] = {
{"Vibra", NULL, "foo MONO"},
};

static struct snd_soc_prefix_map codec_prefix[] = {
{
.dev_name = "codec.2",
.name_prefix = "foo",
},
};

static struct snd_soc_card card = {
...
.prefix_map = codec_prefix,
.num_prefixes = ARRAY_SIZE(codec_prefix),
};

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a7f387d5 11-Nov-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Add support for rbtree based register caching

This patch adds support for rbtree compression when storing the
register cache. It does this by not adding any uninitialized registers
(those whose value is 0). If any of those registers is written
with a nonzero value they get added into the rbtree.

Consider a sample device with a large sparse register map. The
register indices are between [0, 0x31ff]. An array of 12800 registers
is thus created each of which is 2 bytes. This results in a 25kB
region. This array normally lives outside soc-core, normally in the
driver itself. The original soc-core code would kmemdup this region
resulting in 50kB total memory. When using the rbtree compression
technique and __devinitconst on the original array the figures are
as follows. For this typical device, you might have 100 initialized
registers, that is registers that are nonzero by default. We build
an rbtree with 100 nodes, each of which is 24 bytes. This results
in ~2kB of memory. Assuming that the target arch can freeup the
memory used by the initial __devinitconst array, we end up using
about ~2kB bytes of actual memory. The memory footprint will increase
as uninitialized registers get written and thus new nodes created in
the rbtree. In practice, most of those registers are never changed.
If the target arch can't freeup the __devinitconst array, we end up
using a total of ~27kB. The difference between the rbtree and the LZO
caching techniques, is that if using the LZO technique the size of
the cache will increase slower as more uninitialized registers get
changed.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cc28fb8e 11-Nov-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Add support for LZO register caching

This patch adds support for LZO compression when storing the register
cache. The initial register defaults cache is marked as __devinitconst
and the only change required for a driver to use LZO compression is
to set the compress_type member in codec->driver to SND_SOC_LZO_COMPRESSION.

For a typical device whose register map would normally occupy 25kB or 50kB
by using the LZO compression technique, one can get down to ~5-7kB. There
might be a performance penalty associated with each individual read/write
due to decompressing/compressing the underlying cache, however that should not
be noticeable. These memory benefits depend on whether the target architecture
can get rid of the memory occupied by the original register defaults cache
which is marked as __devinitconst. Nevertheless there will be some memory
gain even if the target architecture can't get rid of the original register
map, this should be around ~30-32kB instead of 50kB.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7a30a3db 11-Nov-2010 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

ASoC: soc-cache: Add support for flat register caching

This patch introduces the new caching API and migrates the
old caching interface into the new one. The flat register caching
technique does not use compression at all and it is equivalent to
the old caching technique. One can still access codec->reg_cache
directly but this is not advised as that will not be portable
across different caching strategies.

None of the existing drivers need to be changed to adapt to this
caching technique. There should be no noticeable overhead associated
with using the new caching API.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3a45b867 05-Nov-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Move pop time from DAPM context to sound card

Based on discussion the dapm_pop_time in debugsfs should be per card rather
than per device. Single pop time value for entire card is cleaner when the
DAPM sequencing is extended to cross-device paths.

debugfs/asoc/{card->name}/{codec dir}/dapm_pop_time
->
debugfs/asoc/{card->name}/dapm_pop_time

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a6052154 05-Nov-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Add sound card directory under debugfs/asoc/

There will be need to have sound card specific debugfs entries. This patch
introduces a new debugfs/asoc/{card->name}/ directory but does not add yet
any entries there.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ce6120cc 05-Nov-2010 Liam Girdwood <lrg@slimlogic.co.uk>

ASoC: Decouple DAPM from CODECs

Decoupling Dynamic Audio Power Management (DAPM) from codec devices is
required when developing ASoC further. Such as for other ASoC components to
have DAPM widgets or when extending DAPM to handle cross-device paths.

This patch decouples DAPM related variables from struct snd_soc_codec and
moves them to new struct snd_soc_dapm_context that is used to encapsulate
DAPM context of a device. ASoC core and API of DAPM functions are modified
to use DAPM context instead of codec.

This patch does not change current functionality and a large part of changes
come because of structure and internal API changes.

Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some
minor core changes, codecs and machine driver conversions from
Jarkko Nikula <jhnikula@gmail.com>.

Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Cliff Cai <cliff.cai@analog.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: Timur Tabi <timur@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Jassi Brar <jassi.brar@samsung.com>
Cc: Daniel Gloeckner <dg@emlix.com>
Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c3753707 01-Nov-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Push snd_soc_write() and snd_soc_read() into the source file

Facilitating adding trace type stuff. For a first pass add some dev_dbg()
statements into them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 0562f788 13-Oct-2010 Mika Westerberg <mika.westerberg@iki.fi>

ASoC: don't register AC97 devices twice

With generic AC97 ASoC glue driver (codec/ac97.c), we get following warning when
the device is registered (slightly stripped the backtrace):

kobject (c5a863e8): tried to init an initialized object, something is seriously
wrong.
[<c00254fc>] (unwind_backtrace+0x0/0xec)
[<c014fad0>] (kobject_init+0x38/0x70)
[<c0171e94>] (device_initialize+0x20/0x70)
[<c017267c>] (device_register+0xc/0x18)
[<bf20db70>] (snd_soc_instantiate_cards+0x924/0xacc [snd_soc_core])
[<bf20e0d0>] (snd_soc_register_platform+0x16c/0x198 [snd_soc_core])
[<c0175304>] (platform_drv_probe+0x18/0x1c)
[<c0174454>] (driver_probe_device+0xb0/0x16c)
[<c017456c>] (__driver_attach+0x5c/0x7c)
[<c0173cec>] (bus_for_each_dev+0x48/0x78)
[<c0173600>] (bus_add_driver+0x98/0x214)
[<c0174834>] (driver_register+0xa4/0x130)
[<c001f410>] (do_one_initcall+0xd0/0x1a4)
[<c0062ddc>] (sys_init_module+0x12b0/0x1454)

This happens because the generic AC97 glue driver creates its codec->ac97 via
calling snd_ac97_mixer(). snd_ac97_mixer() provides own version of
snd_device.register which handles the device registration when
snd_card_register() is called.

To avoid registering the AC97 device twice, we add a new flag to the
snd_soc_codec: ac97_created which tells whether the AC97 device was created by
SoC subsystem.

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4c14d78e 06-Oct-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Use delayed work for debounce of GPIO based jacks

Rather than block the workqueue by sleeping to do the debounce use delayed
work to implement the debounce time. This should also means that we extend
the debounce time on each new bounce, potentially allowing shorter debounce
times for clean insertions.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 4e485416 31-Aug-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Swap bias level enumeration

Swapping the bias level enumeration is only meant to help debugging. It is
easier if number 0 means bias off and bigger number means bigger bias level.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f0fba2ad 17-Mar-2010 Liam Girdwood <lrg@slimlogic.co.uk>

ASoC: multi-component - ASoC Multi-Component Support

This patch extends the ASoC API to allow sound cards to have more than one
CODEC and more than one platform DMA controller. This is achieved by dividing
some current ASoC structures that contain both driver data and device data into
structures that only either contain device data or driver data. i.e.

struct snd_soc_codec ---> struct snd_soc_codec (device data)
+-> struct snd_soc_codec_driver (driver data)

struct snd_soc_platform ---> struct snd_soc_platform (device data)
+-> struct snd_soc_platform_driver (driver data)

struct snd_soc_dai ---> struct snd_soc_dai (device data)
+-> struct snd_soc_dai_driver (driver data)

struct snd_soc_device ---> deleted

This now allows ASoC to be more tightly aligned with the Linux driver model and
also means that every ASoC codec, platform and (platform) DAI is a kernel
device. ASoC component private data is now stored as device private data.

The ASoC sound card struct snd_soc_card has also been updated to store lists
of it's components rather than a pointer to a codec and platform. The PCM
runtime struct soc_pcm_runtime now has pointers to all its components.

This patch adds DAPM support for ASoC multi-component and removes struct
snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec
or runtime PCM level basis rather than using snd_soc_socdev.

Other notable multi-component changes:-

* Stream operations now de-reference less structures.
* close_delayed work() now runs on a DAI basis rather than looping all DAIs
in a card.
* PM suspend()/resume() operations can now handle N CODECs and Platforms
per sound card.
* Added soc_bind_dai_link() to bind the component devices to the sound card.
* Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove
DAI link components.
* sysfs entries can now be registered per component per card.
* snd_soc_new_pcms() functionailty rolled into dai_link_probe().
* snd_soc_register_codec() now does all the codec list and mutex init.

This patch changes the probe() and remove() of the CODEC drivers as follows:-

o Make CODEC driver a platform driver
o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core.
o Removed all static codec pointers (drivers now support > 1 codec dev)
o snd_soc_register_pcms() now done by core.
o snd_soc_register_dai() folded into snd_soc_register_codec().

CS4270 portions:
Acked-by: Timur Tabi <timur@freescale.com>

Some TLV320aic23 and Cirrus platform fixes.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>

TI CODEC and OMAP fixes
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Samsung platform and misc fixes :-
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>

MPC8610 and PPC fixes.
Signed-off-by: Timur Tabi <timur@freescale.com>

i.MX fixes and some core fixes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

J4740 platform fixes:-
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

CC: Tony Lindgren <tony@atomide.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC: Kuninori Morimoto <morimoto.kuninori@renesas.com>
CC: Daniel Gloeckner <dg@emlix.com>
CC: Manuel Lauss <mano@roarinelk.homelinux.net>
CC: Mike Frysinger <vapier.adi@gmail.com>
CC: Arnaud Patard <apatard@mandriva.com>
CC: Wan ZongShun <mcuos.com@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# b6f4bb38 15-May-2010 apatard@mandriva.com <apatard@mandriva.com>

ASoC: Add SOC_DOUBLE_R_SX_TLV control

This patch is adding a new control which has the following capabilities:
- tlv
- variable data size (for instance, 7 ou 8 bit)
- double mixer
- data range centered around 0

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
Acked-by: Liam Girdwood <lrg@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d11bb4a9 10-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: core: Fix for the volume limiting when invert is in use

If the register for the volume needs invert, than the inversion
need to be done from the chip maximum, and not from the platform
dependent limit.
Introduce soc_mixer_control.platform_max value, which initially
equals to chip maximum.
The snd_soc_limit_volume function only modify the platform_max,
all volsw_info call returns this as well.
The .max value holds the chip default (maximum), and it is used
for the inversion, if it is needed.

Additional check in the volsw_info call has been added to check
the validity of the platform_max in case, when custom macros
used by codec drivers are not initializing it correctly.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3efab7dc 09-May-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow DAI links to be kept active over suspend

As well as allowing DAPM pins to be marked as ignoring suspend allow DAI
links to be similarly marked. This is primarily intended for digital
links between CODECs and non-CPU devices such as basebands in mobile
phones and will suppress all suspend calls for the DAI link. It is
likely that this will need to be revisited if used with devices which
are part of the SoC CPU.

Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 637d3847 07-May-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: core: Support for limiting the volume

Add support for the core to limit the maximum volume on an
existing control.
The function will modify the soc_mixer_control.max value
of the given control.
The new value must be lower than the original one (chip maximum)

If there is a need for limiting a gain on a given control,
than machine drivers can do the following in their
snd_soc_dai_link.init function:

snd_soc_limit_volume(codec, "TPA6140A2 Headphone Playback Volume", 21);

This will modify the original 31 (chip maximum) to 21, so user
space will not be able to set the gain higher than this.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b2c812e2 14-Apr-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add indirection for CODEC private data

One of the features of the multi CODEC work is that it embeds a struct
device in the CODEC to provide diagnostics via a sysfs class rather than
via the device tree, at which point it's much better to use the struct
device private data rather than having two places to store it. Provide
an accessor function to allow this change to be made more easily, and
update all the CODEC drivers are updated.

To ensure use of the accessor the private data structure member is
renamed, meaning that if code developed with older an older core that
still uses private_data is merged it will fail to build.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 5f712b2b 22-Mar-2010 Daniel Mack <daniel@caiaq.de>

ALSA: ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream

This fixes a memory corruption when ASoC devices are used in
full-duplex mode. Specifically for pxa-ssp code, where this pointer
is dynamically allocated for each direction and destroyed upon each
stream start.

All other platforms are fixed blindly, I couldn't even compile-test
them. Sorry for any breakage I may have caused.

[Note that this is a backported version for 2.6.34.
Upstream commit is fd23b7dee]

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Reported-by: Sven Neumann <s.neumann@raumfeld.com>
Reported-by: Michael Hirsch <m.hirsch@raumfeld.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d5021ec9 21-Mar-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add a notifier for jack status changes

Some systems provide both mechanical and electrical detection of jack
status changes. On such systems power savings can be achieved by only
enabling the electrical detection methods when physical insertion has
been detected.

Begin supporting such systems by providing a notifier for jack status
changes which can be used to trigger any reconfiguration.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# fd23b7de 19-Mar-2010 Daniel Mack <daniel@caiaq.de>

ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream

This fixes a memory corruption when ASoC devices are used in
full-duplex mode. Specifically for pxa-ssp code, where this pointer
is dynamically allocated for each direction and destroyed upon each
stream start.

All other platforms are fixed blindly, I couldn't even compile-test
them. Sorry for any breakage I may have caused.

Reported-by: Sven Neumann <s.neumann@raumfeld.com>
Reported-by: Michael Hirsch <m.hirsch@raumfeld.com>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 258020d0 03-Mar-2010 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: core: Add delay operation to snd_soc_dai_ops

The delay callback can be used by the core to query the delay
on the dai caused by FIFO or delay in the platform side.
In case if both CPU and CODEC dai has FIFO the delay reported
by each will be added to form the full delay on the chain.
If none of the dai has FIFO, than the delay will be kept as
zero.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 14dc5734 25-Feb-2010 Jassi Brar <jassi.brar@samsung.com>

ASoC: Allow mulitple usage count of codec and cpu dai

If we are to have a snd_soc_dai i.e, cpu_dai and codec_dai, shared among two
or more dai_links we need to log the number of active users of the dai.
For that, we change semantics of the snd_soc_dai.active flag from indicator
to reference counter.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d273ebe7 21-Feb-2010 jassi brar <jassisinghbrar@gmail.com>

ASoC: Pass dai_link as argument to platform suspend and resume

Passing pointer to relevant dai_link provides easier reach to the
ASoC tree in suspend/resume of snd_soc_platform. It also provides
direct access to the dai at the other end of the dai_link.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6c5f1fed 17-Feb-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Make pmdown_time a long

Fixes a warning.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 96dd3622 12-Feb-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Make pmdown_time a per-card setting

Make the pmdown_time a per-card setting rather than a global one,
initialised before the card initialisation runs. This allows cards
to override the default setting if it makes sense to do so (for
example, due to an unavoidable pop).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# a3032b47 01-Feb-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add a cache_sync bit to the CODEC structure

Add a bit to the CODEC structure indicating if a cache sync is required.
By default this will be set if a cache only write is done to a soc-cache
register cache. This allows us to avoid syncing the cache back after
using cache only writes if there were no changes.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 8c961bcc 01-Feb-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow CODECs to ask soc-cache to suppress physical writes

Currently the soc-cache code will always write to the device, meaning
that we need the device to be powered and active at pretty much all
times the system is active. Allowing cache only writes lays some
groundwork for future enhancements to allow devices to be put into a
full off state when the audio subsystem is idle.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 6c2fb6a8 21-Jan-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>

ASoC: add helper macros to declare struct soc_enum instances

Several shortcuts for popular uses of some of SOC_ENUM_* and
SOC_VALUE_ENUM_* macros.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a96ca338 19-Jan-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Support turning off bias when the CODEC is idle

Currently ASoC always maintains the bias of the CODEC while the system
is active. With older mobile CODECs this is required since the outputs
are referenced to a non-zero voltage and enabling or disabling this
voltage without audible pops or clicks in the output takes too long to
do when starting or stopping audio.

As a result of features such as ground referenced outputs and class D
speaker drivers current generation devices are able to power on and off
much more quickly without these system level issues so provide a new
flag idle_bias_off in snd_soc_codec which will cause the core to turn
off the CODEC bias. The distinction between STANDBY and OFF is still
maintained. This is partly for consistency but also allows for
potential future extensions such as per-machine overrides or deferring
the bias removal.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# dd1b3d53 04-Dec-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Export snd_soc_update_bits_unlocked()

Allows custom controls to use it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# c0fa59df 19-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add BCLK calculation utility for TDM mode too

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c871a053 12-Nov-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: Add jack_status_check callback function for GPIO jacks

The jack_status_check callback function is the interface to check the
status of the jack. Some target provides the method to distinguish what
is the jack inserted - headphone jack, microphone jack, tvout jack, etc,
so we can implement it using the jack_status_check function.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7aae816d 10-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add bit clock rate calculator utility functions

Many devices need to calculate the bit clock rate desired to
work out the clock configuration required for the device.
Provide utility functions to do this using both hw_params
structures and raw numbers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# fe3e78e0 03-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Factor out snd_soc_init_card()

snd_soc_init_card() is always called as the last part of the CODEC probe
function so we can factor it out into the core card setup rather than
have each CODEC replicate the code to do the initialiastation. This will
be required to support multiple CODECs per card.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d2058b0c 13-Oct-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove snd_soc_suspend_device()

The PM core will grow pm_link infrastructure in 2.6.33 which can be
used to implement the intended functionality of the ASoC-specific
device suspend and resume callbacks so drop them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 88439ac7 01-Oct-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: add support for multiple cards/codecs in debugfs

In order to support multiple codecs on the same system in the debugfs
the directory hierarchy need to be changed by adding directory per codec
under the asoc direcorty:

debugfs/asoc/{dev_name(socdev->dev)}-{codec->name}/codec_reg
/dapm_pop_time
/dapm/{widgets}

With the original implementation only the debugfs files are only
created for the first codec, other codecs loaded later would fail to
create the debugfs files (since they are already exist).
Furthermore in this situation any of the codecs has been removed, would
cause the debugfs entries to disappear, regardless if the codec, which
created them are still loaded (the one which loaded first).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 236cc528 06-Sep-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove unuused hw_read_t

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 79fb9387 21-Aug-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add DAPM widget power decision debugfs files

Currently when built with DEBUG DAPM will dump information about
the power state decisions it is taking for each widget to dmesg.
This isn't an ideal way of getting the information - it requires
a kernel build to turn it on and off and for large hub CODECs the
volume of information is so large as to be illegible. When the
output goes to the console it can also cause a noticable impact
on performance simply to print it out.

Improve the situation by adding a dapm directory to our debugfs
tree containing a file per widget with the same information in
it. This still requires a decision to build with debugfs support
but is easier to navigate and much less intrusive.

In addition to the previously displayed information active streams
are also shown in these files.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# afa2f106 10-Jul-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Factor out I2C 8 bit address 16 bit data I/O

As part of this refactoring the type of the CODEC hw_read operation
is changed to match the regular read operation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7084a42b 10-Jul-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add I/O control bus information to factored out cache setup

While writes tend to be able to use a fairly bus independant format to
do the writes reads are all bus specific. To allow us to factor out
this code include the bus type as a parameter when setting up the
cache.

Initially just use this to factor out hw_write_t for I2C.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 77ee09c6 31-Jul-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Allow CODECs to flag invalid registers

This helps CODECs with sparse register maps work better with the
register cache display interface.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3ce91d5a 15-Jul-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: add SOC_DOUBLE_R_EXT_TLV control type

This is a macro for double controls with special callback function and
TLV. The SOC_DOUBLE_R_EXT_TLV needs two registers and one shift for
double controls.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d0af93db 15-Jul-2009 Joonyoung Shim <jy0922.shim@samsung.com>

ASoC: add SOC_DOUBLE_EXT_TLV control type

This is a macro for double controls with special callback function and
TLV. The SOC_DOUBLE_EXT_TLV needs one register and two shifts for double
controls.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 17a52fd6 05-Jul-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Begin to factor out register cache I/O functions

A lot of CODECs share the same register data formats and therefore
replicate the code to manage access to and caching of the register
map. In order to reduce code duplication centralised versions of
this code will be introduced with drivers able to configure the use
of the common code by calling the new snd_soc_codec_set_cache_io()
API call during startup.

As an initial user the 7 bit address/9 bit data format used by many
Wolfson devices is supported for write only CODECs and the drivers
with straightforward register cache implementations are converted to
use it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 096e49d5 05-Jul-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add CODEC volatile register operation

Add a volatile_register() operation to the CODEC structure providing a
standard operation to query if a register is volatile. This will be used
to factor out the register cache I/O operations for the CODECs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 831dc0f1 13-Jun-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add stub suspend and resume calls for ASoC subdevices

Now that ASoC subdevices can be regular devices they can have normal
suspend and resume calls from their buses. However, suspending them
individually is not desirable since this can lead to problems such as
pops and clicks from devices being suspended with their signals being
amplified or clocks being stopped suddenly.

This will be resolved by having the normal device model suspend and
resume calls call into ASoC which will suspend the entire card while any
of its components are suspended. At present this is not yet implemented
but in order to aid the transition of drivers to the standard device
model this patch adds API calls for the notifications.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 291f3bbc 07-Jun-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Make DAPM power sequence lists local variables

They are now only accessed within dapm_power_widgets() so can be local
to that function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 46f5822f 06-Jun-2009 Daniel Ribeiro <drwyrm@gmail.com>

ASoC: Allow 32 bit registers for DAPM

Replace the remaining unsigned shorts with unsigned ints.
Tested with pcap2 codec (25 bits registers).

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5c82f567 22-May-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

AsoC: Make snd_soc_read() and snd_soc_write() functions

Should be no impact on the generated code but it helps the compiler
print clearer messages.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 452c5eaa 17-May-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Integrate bias management with DAPM power management

Rather than managing the bias level of the system based on if there is
an active audio stream manage it based on there being an active DAPM
widget. This simplifies the code a little, moving the power handling
into one place, and improves audio performance for bypass paths when no
playbacks or captures are active.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6d3ddc81 16-May-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Split DAPM power checks from sequencing of power changes

DAPM has always applied any changes to the power state of widgets as soon
as it has determined that they are required. Instead of doing this store
all the changes that are required on lists of widgets to power up and
down, then iterate over those lists and apply the changes. This changes
the sequence in which changes are implemented, doing all power downs
before power ups and always using the up/down sequences (previously they
were only used when changes were due to DAC/ADC power events). The error
handling is also changed so that we continue attempting to power widgets
if some changes fail.

The main benefit of this is to allow future changes to do optimisations
over the whole power sequence and to reduce the number of walks of the
widget graph required to check the power status of widgets.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7629ad24 24-Apr-2009 Daniel Mack <daniel@caiaq.de>

ASoC: add SOC_DOUBLE_EXT macro

Add a macro for double controls with special callback functions.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 06f409d7 07-Apr-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Provide core support for symmetric sample rates

Many devices require symmetric configurations of capture and playback
data formats, often due to shared clocking but sometimes also due to
other shared playback and record configuration in the device. Start
providing core support for this by allowing the DAIs or the machine
to specify that the sample rates used should be kept symmetric.

A flag symmetric_rates is provided in the snd_soc_dai and
snd_soc_dai_link structures. If this is set in either of the DAIs or in
the machine then a constraint will be applied when a stream is already
open preventing any changes in sample rate.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ec67624d 03-Mar-2009 Lopez Cruz, Misael <x0052729@ti.com>

ASoC: Add GPIO support for jack reporting interface

Add GPIO support to jack reporting framework in ASoC using gpiolib calls.
The gpio support exports two new functions: snd_soc_jack_add_gpios and
snd_soc_jack_free_gpios.

Client drivers using gpio feature must pass an array of jack_gpio pins
belonging to a specific jack to the snd_soc_jack_add_gpios function. The
framework will request the gpios, set the data direction and request irq.
The framework will update power status of related jack_pins when an event on
the gpio pins comes according to the reporting bits defined for each gpio.

All gpio resources allocated when adding jack_gpio pins can be released
using snd_soc_jack_free_gpios function.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6627a653 23-Jan-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Push the codec runtime storage into the card structure

This is a further stage on the road to refactoring away the ASoC
platform device.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3e8e1952 08-Jan-2009 Ian Molton <ian@mnementh.co.uk>

ASoC: cleanup duplicated code.

Many codec drivers were implementing cookie-cutter copies of the function
that adds kcontrols to the codec.

This patch moves this code to a common function snd_soc_add_controls() in
soc-core.c and updates all drivers using copies of this function to use the
new common version.

[Edited to raise priority of error log message and document parameters.
-- broonie]

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8a2cd618 07-Jan-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add jack reporting interface

This patch adds a jack reporting interface to ASoC. This wraps the ALSA
core jack detection functionality and provides integration with DAPM to
automatically update the power state of pins based on the jack state.

Since embedded platforms can have multiple detecton methods used for a
single jack (eg, separate microphone and headphone detection) the report
function allows specification of which bits are being updated on a given
report.

The expected usage is that machine drivers will create jack objects and
then configure jack detection methods to update that jack.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 74155556 08-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: Merge the soc_value_enum to soc_enum struct

Merge the recently introduced soc_value_enum structure to the soc_enum.
The value based enums are still handled separately from the normal enum types,
but with the merge some of the newly introduced functions can be removed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2e72f8e3 05-Jan-2009 Peter Ujfalusi <peter.ujfalusi@nokia.com>

ASoC: New enum type: value_enum

This patch introduces a new enum type.
In this enum type each enumerated items referred with a value.

This new enum type can handle enums encoded in bitfield, or any other
weird ways. twl4030 codec has several mux selection register, where the
input/output mux is coded in a bitfield. With the normal enum type this type
of mux can not be handled in a clean way.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 0d0cf00a 10-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add codec registration API

Another part of the backporting of Liam's ASoC v2 work. Using this is
more complicated than the other registration types since currently the
codec is instantiated during the probe of the ASoC device so we can't
currently readily wait for the codec to register.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 12a48a8c 03-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add platform registration API

ASoC v2 allows platform drivers to instantiate independantly of the
overall ASoC card. This API allows drivers to notify the core when
they are registered.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c5af3a2e 28-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add card registration API

ASoC v2 allows cards, codecs and platforms to instantiate separately,
with the overall ASoC device only being instantiated once all the
required components have registered. As part of backporting Liam's work
introduce an initial version of the card registration functions. At
present these do nothing active and are internal only, they will be
exposed to machine drivers after further backporting. Adding this now
allows the datastructures used for dynamic card instantiation to be
built up gradually.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 32c8dabc 03-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove obsolete declaration of struct snd_soc_clock_info

The struct is never defined.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 07c84d04 03-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove device from platform suspend and resume operations

None of the platforms are actually using the SoC device so remove it
(only atmel actually has a suspend method).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 384c89e2 03-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Push debugfs files out of the snd_soc_device structure

This is in preparation for the removal of struct snd_soc_device.

The pop time configuration should really be a property of the card not
the codec but since DAPM currently uses the codec rather than the card
using the codec is fine for now.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 87689d56 02-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Push platform registration down into the card

As part of the deprecation of snd_soc_device push the registration of
the platform down into the card structure.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6308419a 02-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Push workqueue data into snd_soc_card

ASoC v2 does not use the struct snd_soc_device at runtime, using struct
snd_soc_card as the root of the card. Begin removing data from
snd_soc_device by pushing the workqueue data into snd_soc_card, using a
backpointer to the snd_soc_device to keep things going for the time
being.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 968a6025 28-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Rename snd_soc_register_card() to snd_soc_init_card()

Currently ASoC card initialisation is completed by a function called
snd_soc_register_card(). As part of the work to allow independant
registration of cards, codecs and machines in ASoC v2 a new function of
the same name has been added so rename the existing function to
facilitate the merge of v2.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3ba9e10a 24-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove DAI type information

DAI type information is only ever used within ASoC in order to special
case AC97 and for diagnostic purposes. Since modern CPUs and codecs
support multi function DAIs which can be configured for several modes
it is more trouble than it's worth to maintain anything other than a
flag identifying AC97 DAIs so remove the type field and replace it with
an ac97_control flag.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a47cbe72 23-Jul-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Move DAI structure definitions into new soc-dai.h

ASoC v2 factors most of the contents of soc.h out into separate headers,
including soc-dai.h for the DAI. Factor the existing DAI API out into
this file in order to prepare for backporting of the ASoC v2 DAI API.
Also backport some of Liam's improvements to the documentation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 87506549 18-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Rename snd_soc_card to snd_soc_machine

One of the issues with the ASoC v1 API which has been addressed in the
ASoC v2 work that Liam Girdwood has done is that the ALSA card provided
by ASoC is distributed around the ASoC structures. For example, machine
wide data such as the struct snd_card are maintained as part of the
CODEC data structure, preventing the use of multiple codecs. This has
been addressed by refactoring the data structures so that all the data
for the ALSA card is contained in a single structure snd_soc_card which
replaces the existing snd_soc_machine and snd_soc_device.

Begin the process of backporting this by renaming struct snd_soc_machine
to struct snd_soc_card, better reflecting its function and bringing it
closer to standard ALSA terminology.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ca3ea02e 18-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove unused snd_soc_machine_config declaration

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ea913940 05-Nov-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove core version number

Rather than try to remember to keep the core version number updated
(which hasn't been happening) just remove it. It was much more useful
when ASoC was out of tree.

Signed-off-by: Mark brown <broonie@opensource.wolfsonmicro.com>


# 12ef193d 13-Oct-2008 Troy Kisky <troy.kisky@boundarydevices.com>

ASoC: Allow setting codec register with debugfs filesystem

i.e. echo 6 59 >/sys/kernel/debug/soc-audio.0/codec_reg
will set register 0x06 to a value of 0x59.
Also, pop_time debugfs interface setup is moved so that it
is setup in the same function as codec_reg

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 762b8df7 29-Oct-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ALSA: ASoC: Fix mono controls after conversion to support full int masks

When ASoC was converted to support full int width masks SOC_SINGLE_VALUE()
omitted the assignment of rshift, causing the control operatins to report
some mono controls as stereo. This happened to work some of the time due
to a confusion between shift and min in snd_soc_info_volsw().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 815ecf8d 29-Jul-2008 Jon Smirl <jonsmirl@gmail.com>

ALSA: ASoC: convert use of uint to unsigned int

ASOC: convert use of uint to unsigned int

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# f8ba0b7b 29-Jul-2008 Jon Smirl <jonsmirl@gmail.com>

ALSA: ASoC: Rename mask to max to reflect usage

Most of the ASoC controls refer to the maximum value that can be set for
a control as mask but there is no actual requirement for all bits to be
set at the highest possible value making the name mask misleading.
Change the code to use max instead.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 4eaa9819 29-Jul-2008 Jon Smirl <jonsmirl@gmail.com>

ALSA: ASoC: Convert bitfields in ASoC into full int width

Convert bitfields in ASoC into full int width. This is a
simple mechanical conversion. Two places in the DAPM code
were fixed to properly use mask.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 58cd33c0 29-Jul-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ALSA: ASoC: Allow codecs to override register display

Some codecs have unusual features in their register maps such as very
large registers representing arrays of coefficients. Support these
codecs in the register cache sysfs file by allowing them to provide a
function register_display() overriding the default output for register
contents.

Also ensure that we don't overflow PAGE_SIZE while writing out the
register dump.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 8c6529db 08-Jul-2008 Liam Girdwood <lg@opensource.wolfsonmicro.com>

ALSA: asoc: core - add Digital Audio Interface (DAI) control functions.

This patch adds several functions for DAI control and config
and replaces the current method of calling function pointers within
the DAI struct.

Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 3c4b266f 07-Jul-2008 Liam Girdwood <lg@opensource.wolfsonmicro.com>

ALSA: asoc: core - merge structs snd_soc_codec_dai and snd_soc_cpu_dai.

This patch series merges struct snd_soc_codec_dai and struct
snd_soc_cpu_dai into struct snd_soc_dai in preparation for further
ASoC v2 patches.

This merger removes duplication in both DAI structures and simplifies
the API for other users.

Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 6ed25978 13-Jun-2008 Andy Green <andy@openmoko.com>

ALSA: ASoC: Don't block system resume

On OpenMoko soc-audio resume is taking 700ms of the whole resume time of
1.3s, dominated by writes to the codec over I2C. This patch shunts the
resume guts into a workqueue which then is done asynchronously.

The "card" is locked using the ALSA power state APIs as suggested by
Mark Brown.

[Added fix for race with resume to suspend and fixed a couple of nits
from checkpatch -- broonie.]

Signed-off-by: Andy Green <andy@openmoko.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 10144c09 11-Jun-2008 Mike Montour <mail@mmontour.net>

ALSA: ASoC: Add SOC_SINGLE_EXT_TLV control type

Signed-off-by: Mike Montour <mail@mmontour.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# bdb92876 11-Jun-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

ALSA: ASoC: Pass the DAI being configured into CPU DAI probe and remove

This allows per-DAI initialisation to be done by the CPU DAI drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# e13ac2e9 28-May-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

[ALSA] ASoC: Add SOC_DOUBLE_S8_TLV control type

The SOC_DOUBLE_S8_TLV control type was originally implemented in the
UDA1380 driver by Philipp Zabel and was moved into the core by me.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0be9898a 18-May-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

[ALSA] ASoC: Clarify API for bias configuration

Currently the ASoC core configures the bias levels in the system using
a callback on codecs and machines called 'dapm_event', passing it PCI
style power levels as SNDRV_CTL_POWER_ constants. This is more obscure
than it needs to be and has caused confusion to driver authors,
especially given that DAPM is also performing power management.

Address this by renaming the callback function to 'set_bias_level' and
using constants explicitly representing the off, standby, pre-on and on
states which DAPM transitions through.

Also unexport the API for setting bias level: there are currently no
in-tree users of this API other than the core itself and it is likely
that the core would need to be extended to cater for any users.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 1ef6ab75 18-May-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

[ALSA] ASoC: Make CPU and codec DAI operations have same type

The CPU and codec DAI operations differ only in the presence of the
digital mute operation for the codec so they may as well be the same
type.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 392abe9c 13-May-2008 Philipp Zabel <philipp.zabel@gmail.com>

[ALSA] ASoC: build fix for snd_soc_info_bool_ext

I suspect that snd_ctl_boolean_mono should have been
snd_ctl_boolean_mono_info instead. This fixes the build for magician.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0a22b87d 10-Jan-2008 Mark Brown <broonie@opensource.wolfsonmicro.com>

[ALSA] Bump ASoC core version number


Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 4ccab3e7 10-Jan-2008 Liam Girdwood <lg@opensource.wolfsonmicro.com>

[ALSA] soc - Ensure PCMs are suspended

This fixes a bug whereby PCMs were not being suspended when the rest of the
audio subsystem was suspended.

Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# a7a4ac86 10-Jan-2008 Philipp Zabel <philipp.zabel@gmail.com>

[ALSA] ASoC TLV support

Add TLV support to ASoC.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 0b4d221b 10-Jan-2008 Liam Girdwood <lg@opensource.wolfsonmicro.com>

[ALSA] soc - Add device level DAPM event

Added a device level dapm event so that both the machine and codec are informed
when dapm events occur.

Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 9004acc7 08-Jan-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove sound/driver.h

This header file exists only for some hacks to adapt alsa-driver
tree. It's useless for building in the kernel. Let's move a few
lines in it to sound/core.h and remove it.
With this patch, sound/driver.h isn't removed but has just a single
compile warning to include it. This should be really killed in
future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# a5ce8890 23-Jul-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] Clean up with common snd_ctl_boolean_*_info callbacks

Clean up codes using the new common snd_ctl_boolean_*_info() callbacks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# a68660e0 10-May-2007 Liam Girdwood <lg@opensource.wolfsonmicro.com>

[ALSA] ASoC AC97 device reg bugfix

This patch fixes a bug whereby AC97 bus device data was being clobbered
when AC97 codecs using the generic ac97_codec.c driver were being
registered. Codecs that didn't use the generic driver were unaffected
(e.g. WM9712, WM9713).
Changes:-
o Add new AC97 codec class for custom (or need bus dev registration)
AC97 codecs.
o Only register/deregister this custom codec device with the AC97 bus.
The generic AC97 driver already does this for generic codec devices.
This may be related to bug #3038 :-
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3038

Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 1c433fbd 02-Feb-2007 Graeme Gregory <gg@opensource.wolfsonmicro.com>

[ALSA] soc - 0.13 ASoC headers

This patch updates the API's to include the new DAI configuration and
clocking architecture.
Changes:-
o Removed DAI automatic matching and capabilities structure (struct
snd_soc_dai_mode) and macros.
o Added DAI operations for codec and CPU interfaces.
o Removed config_sysclk() function and struct snd_soc_clock_info. No
longer needed as clocking is now configured manually in the machine
drivers. Also removed other clocking data from structures.
o Updated version to 0.13
o Added shift to SOC_SINGLE_EXT kcontrol macro.

Signed-off-by: Graeme Gregory <gg@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 1321b160 21-Dec-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] soc - Fix delayed_work related changes on 2.6.20 kernel

Fix the changes realted to delayed_work in soc/codecs/wm8750.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 4484bb2e 15-Dec-2006 Andrew Morton <akpm@osdl.org>

[ALSA] Fix the soc code after dhowells workqueue changes.

From: Andrew Morton <akpm@osdl.org>
I converted the workqueues to per-device while I was there. It seems
strange to create a new kernel thread (on each CPU!) and to then only
have a single global work to ever be queued upon it.
Plus without this, I'd have to use the _NAR stuff, gawd help me.
Does that workqueue really need to be per-cpu?
Does that workqueue really need to exist? Why not use keventd?
Cc: Takashi Iwai <tiwai@suse.de>
Cc: David Howells <dhowells@redhat.com>

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# a71a468a 19-Oct-2006 Liam Girdwood <lg@opensource.wolfsonmicro.com>

[ALSA] ASoC: Add support for BCLK based on (Rate * Chn * Word Size)

This patch adds support for the DAI BCLK to be generated by multiplying
Rate * Channels * Word Size (RCW).
This now gives 3 options for BCLK clocking and synchronisation :-
1. BCLK = Rate * x
2. BCLK = MCLK / x
3. BCLK = Rate * Chn * Word Size. (New)
Changes:-
o Add support for RCW generation of BCLK
o Update Documentation to include RCW.
o Update DAI documentation for label = value DAI modes.
o Add RCW support to wm8731, wm8750 and pxa2xx-i2s drivers.

Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 808db4a4 06-Oct-2006 Richard Purdie <rpurdie@rpsys.net>

[ALSA] ASoC: core and dapm headers

This patch adds the ASoC and DAPM headers.
Features:-
o Defines Digital Audio Interface (DAI) API
o Defines Codec, Platform and Machine API
o Defines Dynamic Audio Power Management API

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>