History log of /linux-master/sound/soc/sh/rcar/src.c
Revision Date Author Comments
# 340d79a1 06-Oct-2023 Rob Herring <robh@kernel.org>

ASoC: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> # for at91
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-1-13a4f0f7fee6@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 376be51c 01-Sep-2022 Jiasheng Jiang <jiasheng@iscas.ac.cn>

ASoC: rsnd: Add check for rsnd_mod_power_on

As rsnd_mod_power_on() can return negative numbers,
it should be better to check the return value and
deal with the exception.

Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20220902013030.3691266-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>


# d09a7db4 20-Apr-2022 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: care return value from rsnd_node_fixed_index()

Renesas Sound is very complex, and thus it needs to use
rsnd_node_fixed_index() to know enabled pin index.

It returns error if strange pin was selected,
but some codes didn't check it.

This patch 1) indicates error message, 2) check return
value.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pmlbgn5t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c413983e 30-May-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: adjust disabled module

In general Renesas SoC's SSI/SRC are all enabled, but some SoC is not.

H2 E2

SRC0 <=
SRC1 SRC1
SRC2 SRC2
... ...

Renesas Sound driver is assuming that *all* modules are
enabled, and thus it is using *data array* to access each modules.
Because of it, we have been using "status = disabled" at DT,
and using *full size* array but avoiding disabled module.

ex)
rcar_sound,src {
src-0 {
=> status = "disabled";
};
src1: src-1 {
...
};
...

But R-Car D3 have many disabled modules (It has SSI3/SSI4, SRC5/SRC6),
and Renesas SoC maintainer don't want above style on DT.

ex)
rcar_sound,src {
=> src0: src-0 { status = "disabled"; };
=> src1: src-1 { status = "disabled"; };
=> src2: src-2 { status = "disabled"; };
=> src3: src-3 { status = "disabled"; };
=> src4: src-4 { status = "disabled"; };
src5: src-5 {
...
};
src6: src-6 {
...
};
};

rcar_sound,ssi {
=> ssi0: ssi-0 { status = "disabled"; };
=> ssi1: ssi-1 { status = "disabled"; };
=> ssi2: ssi-2 { status = "disabled"; };
ssi3: ssi-3 {
...
};
ssi4: ssi-4 {
...
};
};

To adjust it, it needs to care about related for_each_child_of_node()
loop on rsnd driver, and it is used from...

> grep -l for_each_child_of_node sound/soc/sh/rcar/*
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/ctu.c
sound/soc/sh/rcar/dma.c
sound/soc/sh/rcar/dvc.c
sound/soc/sh/rcar/mix.c
sound/soc/sh/rcar/src.c
sound/soc/sh/rcar/ssi.c
sound/soc/sh/rcar/ssiu.c

This patch adjust to this situation.
By this patch, we can avoid disabled modules on DT

rcar_sound,src {
src5: src-5 {
...
};
src6: src-6 {
...
};
};

rcar_sound,ssi {
ssi3: ssi-3 {
...
};
ssi4: ssi-4 {
...
};
};

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


# 039f2ccc 30-May-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup rsnd_dma_request_channel()

This patch adds "char *name" to rsnd_dma_request_channel().
It is not yet used so far, but is preparation for
next "ASoC: rsnd: adjust disabled module" patch

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


# 1f9c82b5 26-May-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add debugfs support

Current rsnd supports #define DEBUG, but it is not helpful
if issue happen after 4-5 hours.
This patch adds debugfs support for it.

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


# 1788a152 26-May-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: incidate irq error message

Current rsnd is using dev_dbg() if irq error happen,
but it makes debug very difficult if some strange things happen.
This patch uses dev_info() for it, and rename the macro name.

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


# 63346d3d 07-Apr-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add usage for SRC

This patch add missing usage comment for SRC.

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


# 399706df 06-Mar-2019 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: src: fix compiler warnings

compiler complains about following declarations

sound/soc/sh/rcar/src.c:174:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern1[] = {
^~~~~
sound/soc/sh/rcar/src.c:183:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern2[] = {
^~~~~
sound/soc/sh/rcar/src.c:192:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsisr_table[] = {
^~~~~
sound/soc/sh/rcar/src.c:201:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan288888[] = {
^~~~~
sound/soc/sh/rcar/src.c:210:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan244888[] = {
^~~~~
sound/soc/sh/rcar/src.c:219:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan222222[] = {
^~~~~

This patch moves the 'static' keyword to the front of the
declaration to fix the compiler warnings

Fixes: linux-next commit 7674bec4fc09 ("ASoC: rsnd: update BSDSR/BSDISR handling")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ba164a49 06-Mar-2019 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: src: Avoid a potential deadlock

lockdep warns us that priv->lock and k->k_lock can cause a
deadlock when after acquire of k->k_lock, process is interrupted
by src, while in another routine of src .init, k->k_lock is
acquired with priv->lock held.

This patch avoids a potential deadlock by not calling soc_device_match()
in SRC .init callback, instead it adds new soc fields in priv->flags to
differentiate SoCs.

Fixes: linux-next commit 7674bec4fc09 ("ASoC: rsnd: update BSDSR/BSDISR handling")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 825b22e5 06-Mar-2019 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: src: fix compiler warnings

compiler complains about following declarations

sound/soc/sh/rcar/src.c:174:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern1[] = {
^~~~~
sound/soc/sh/rcar/src.c:183:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern2[] = {
^~~~~
sound/soc/sh/rcar/src.c:192:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsisr_table[] = {
^~~~~
sound/soc/sh/rcar/src.c:201:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan288888[] = {
^~~~~
sound/soc/sh/rcar/src.c:210:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan244888[] = {
^~~~~
sound/soc/sh/rcar/src.c:219:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan222222[] = {
^~~~~

This patch moves the 'static' keyword to the front of the
declaration to fix the compiler warnings

Fixes: linux-next commit 7674bec4fc09 ("ASoC: rsnd: update BSDSR/BSDISR handling")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7674bec4 24-Dec-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: update BSDSR/BSDISR handling

Current BSDSR/BSDISR are using temporary/generic settings, but it can't
handle all SRCx/SoC. It needs to handle correctry.
Otherwise, sampling rate converted sound channel will be broken if it
was TDM. One note is that it needs to overwrite settings on E3 case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: chaoliang qin <chaoliang.qin.jg@renesas.com>
Tested-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c2aaaa57 05-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: handle DPCM converted rate/chan under core

converted rate/chan are handled each rated module, but
it will be used other module too.
For examle, converted channel is currently used for CTU,
but, it will be used for TDM Split mode, too.

This patch move/merge SRC/CTU hw_param under core.c
and handles converted rate/chan under rsnd_dai_stream.

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


# c0ea089d 30-Oct-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_mod_name() handles both name and ID

Current rsnd driver is using "%s[%d]" for mod name and ID,
but, this ID portion might confusable.
For example currently, CTU ID is 0 to 7, but using 00 to 13
(= 00, 01, 02, 03, 10, 11, 12, 13) is very best matching to datasheet.

In the future, we will support BUSIFn, but it will be more complicated
numbering. To avoid future confusable code, this patch modify
rsnd_mod_name() to return understandable name.

To avoid using pointless memory, it uses static char and snprintf,
thus, rsnd_mod_name() user should use it immediately, and shouldn't keep
its pointer.

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


# 7e7fe06d 30-Oct-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: move .get_status under rsnd_mod_ops

Each mod needs to have .get_status, but current driver is handling it
under rsnd_mod, instead of rsnd_mod_ops.
It is not any make sence. This patch moves it to rsnd_mod_ops, and
tidyup its parameter order to align to other callback functions.

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


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

ASoC: add for_each_dpcm_be() macro

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


# 1e0edd4d 11-Jun-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: convert to SPDX identifiers

Tidyup incoherence between MODULE_LICENSE and header license, too

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


# a86854d0 12-Jun-2018 Kees Cook <keescook@chromium.org>

treewide: devm_kzalloc() -> devm_kcalloc()

The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:

devm_kzalloc(handle, a * b, gfp)

with:
devm_kcalloc(handle, a * b, gfp)

as well as handling cases of:

devm_kzalloc(handle, a * b * c, gfp)

with:

devm_kzalloc(handle, array3_size(a, b, c), gfp)

as it's slightly less ugly than:

devm_kcalloc(handle, array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

devm_kzalloc(handle, 4 * 1024, gfp)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
expression HANDLE;
type TYPE;
expression THING, E;
@@

(
devm_kzalloc(HANDLE,
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
devm_kzalloc(HANDLE,
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression HANDLE;
expression COUNT;
typedef u8;
typedef __u8;
@@

(
devm_kzalloc(HANDLE,
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
expression HANDLE;
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)

// 2-factor product, only identifiers.
@@
expression HANDLE;
identifier SIZE, COUNT;
@@

- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- SIZE * COUNT
+ COUNT, SIZE
, ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@

(
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)

// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE,
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)

// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * E2
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * (E2)
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- E1 * E2
+ E1, E2
, ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>


# 2b627869 12-Feb-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: indicate IRQ error status for debug

SSI/SRC have under/over flow error handling, and its status is useful
for debuging. But sometimes it might be too much message,
and it might blocks necessity other information.

To avoid such situation, basically this patch indicates interrupt
status debug message if DEBUG was defined, but it will be suppressed
if RSND_DEBUG_NO_IRQ_STATUS was defined.

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c1629356 21-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove unused rsnd_xxx_to_dma()

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


# b65cb7a5 21-Aug-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup comments position/space/tab

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


# 53ba2aa3 15-Jul-2017 Julia Lawall <Julia.Lawall@lip6.fr>

ASoC: rsnd: add missing of_node_put

for_each_child_of_node performs an of_node_get on each iteration, so a
jump out of the loop requires an of_node_put.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e,e1;
identifier l;
@@

for_each_child_of_node(e1,n) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? goto l;
)
...
}
...
l: ... when != n
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f0b04d8b 06-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: control kctrl items acceptance anytime/runtime

Current SRC/DVC/CTU adds kctrl for each device,
and SRC can adjust its sampling rate during playback,
thus, this feature should be enabled only *during* playback.
This patch controls it more clearly

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


# 90431eb4 15-May-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use PDTA bit for 24bit on SSI

Current SSI uses PDTA bit which indicates data that Input/Output
data are Right-Aligned. But, 24bit sound should be Left-Aligned
in this HW. Because Linux is using Right-Aligned data, and HW uses
Left-Aligned data, current 24bit data is missing lower 8bit.
To fix this issue, this patch removes PDTA bit, and shift 8bit
in necessary module

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 607ee058 14-May-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove mismatch explain comment from src.c

Before, src.c cares SRC and SSIU, but now SSIU is cared by ssiu.c by
commit c7f69ab5364d ("ASoC: rsnd: use mod base common method on SSIU").
This patch removes mismatched explanation for SRC/SSIU from src.c

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


# a9b10ddd 14-May-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove un-used OUF_SRCO/I macro

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


# fc99d23f 06-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup src->convert_rate reset timing

Current src->convert_rate will be set on .hw_param, and
be reset on .quit timing.
But, .hw_param will not be called again if user did Ctrl-Z + fg.
It should be reset on initial of .hw_param to keep its value.
Here, ctu.c already do this.
This patch solves this issue, other wise, MIXed sound will be
strange if user did like below.

> aplay -D plughw:0,0 sound_44100.wav &
> aplay -D plughw:0,1 sound_96000.wav
> Ctrl-Z
> fg # 96kHz will be played as 44.1kHz

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ef30da1c5 01-Feb-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup reset timing of sync convert_rate

Sync convert rate settings should be availabled *after* Playing.
Thus, src->sync should be reset first of init function.
Otherwise, it will set remaining settings when it start playing.
This patch fixes it. Thanks to Yokoyama-san

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 67923f77 26-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: enable SRC sync even FIN = FOUT

Current SRC (= Sampling Rate Converter) is supporting
SYNC mode and ASYNC mode. Current src.c cares SRC if FIN != FOUT.
Here, SYNC mode will be used for tweak, so it will be used
even FIN = FOUT. This patch enables SRC sync in such situation

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Tested-by: Yuichi Takagi <yuichi.takagi.uh@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 42b197e7 25-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup SCU_SYS_STATUSx access

SCU_SYS_STATUSx is the register that writing 1 initializes the bit,
and writing 0 is ignored. So, it should use rsnd_mod_write()
instead of rsnd_mod_bset(), otherwise all bit will be cleared.
Thanks Shimoda-san

Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b99305d2 24-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove non DT support for DMA

Current Renesas Sound driver is based on DeviceTree, and no one is
using this driver from non DT. Non-DT support is no longer needed.
Let's remove it.

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


# 93ca33c9 24-Jul-2016 Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>

ASoC: rsnd: Fixup SRCm_IFSVR calculate method

This patch fixes the calculation accuracy degradation of SRCm_IFSVR
register value.

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


# de196515 11-May-2016 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

rcar: src: skip disabled-SRC nodes

The current device tree representation of the R-Car Sample Rate Converters
(SRC) assumes that they are numbered consecutively, starting from 0. Alas,
this is not the case with the R8A7794 SoC where SRC0 isn't present. In
order to keep the existing device trees working, I'm suggesting to use a
disabled node for SRC0. Teach the SRC probe to just skip disabled nodes.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0102eed5 06-Mar-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SRC TIMSEL support for Capture

SRC has Sync/Async mode, and it can't use Sync mode when Capture
with CMD. In Async mode, it needs to care about in/out SRC rate
for settings, but current driver supporting Playback case only.
This patch supports Capture case.

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


# cbf1494f 06-Mar-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_src_get_in/out_rate()

SRC will convert rate, and then, CMD and SSI want to know its
rate (= SRC.in / SRC.out) for each purpose.
Current driver is supporting only Playback, but SRC+Capture support
needs more flexibility.
This patch adds rsnd_src_get_in/out_rate() for it.

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


# ab2049f9 06-Mar-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename rsnd_enable_sync_convert() to rsnd_src_sync_is_enabled()

rsnd_enable_sync_convert() is for checking, not for setting.
In order to avoid confusion, this patch renamed it to
rsnd_src_sync_is_enabled()

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


# 1a9be9ee 06-Mar-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SRC function parameter uses "mod" instead of "src"

To reduce confusion, SRC uses "mod" instead of "src"
as function parameter

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


# b5ebbb3a 06-Mar-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SRC sync mode is not related to clock master mode

SRC sync mode needs to control its clock (= for in/out). 1st but codec
side clock

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


# 61a219fe 06-Mar-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't enable SRC Sync mode when Capture with CMD

It can't use SRC Synchronous convert when Capture if it uses CMD,
because no one provide out side clocks.

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


# eed76bb8 24-Feb-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_runtime_channel_xxx()

Current SSI is supporting Normal SSI/Multi mode SSI/TDM mode SSI
and its behavior is based on input channels.
This input channel might be converted by CTU,
and SSI needs to be Multi SSI mode / TDM SSI mode if 6ch input

EX) 6ch input, CTU for 2ch, playback

6ch 6ch 2ch 2ch 2ch 2ch
-> SRC -> CTU -> MIX -> DVC -> SSIU -> SSI

EX) 6ch input, no CTU, Multi SSI, playback

6ch 6ch 6ch 6ch 6ch 2ch
-> SRC -> CTU -> MIX -> DVC -> SSIU -> SSI0/SSI1/SSI2

Current driver is using rsnd_get_adinr_chan() / rsnd_get_slot_width()
for this purpose, but it is complicated enough without meaning.
This patch adds new rsnd_runtime_channel_xxx() which is caring
CTU/Multi SSI.

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


# 0fbab951 18-Feb-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: setup SRC_ROUTE_MODE0 before SRC_SRCIR

SRC_ROUTE_MODE0 determines whether to use SRC.
Thus, it should be setup before SRC_SRCIR.

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


# b5b442ab 25-Jan-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add .irq callback

Current rsnd driver has .init/.start/.stop/.quit callbacks,
and it needs many IPs (SRC/CTU/MUX/DVC/CMD/SSIU/SSI).
Because of these relationship, it might get unnecessary
error IRQ when start/stop.
This patch adds new .irq callback and control IRQ enable/disable
timing to avoid it.

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


# 6a25c8da 25-Jan-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't auto-recover when under/over run error

Renesas R-Car sound needs recovery (= restart) when under/over run
error occurred, and current driver tries it on under/over run error
handler automatically. But this recovery should be handled by userland,
not kernel. This patch stops XRUN when under/over run error occur, and
will leave the recovery of HW in userland.

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


# 31739a68 20-Jan-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: disable SRC.out/in in same time

commit b761bf272bce ("ASoC: rsnd: disable SRC.out only when stop timing")
disabled SRC.out/in in different timing, but was based on
picky HW information. Now, we have confirmed that we can disable
both in the same time. This patch do it.

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


# 355cb84fb 20-Jan-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: attach Audio-DMAC-periperi correctly

SSI/SRC will try to attach DMAC as Audio-DMAC or Audio-DMAC-periperi.
It is fixed IP, but will be attached to each streams as different module
in case of MUX (= multi sound path will be merged).
This patch solves this issue.

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


# 5ba17b42 20-Jan-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: each mod has status again for CTU/MUX support

SSI will be used as normal SSI or as clock parent SSI. Therefor,
rsnd driver wants to control SSI and parent SSI separately. Otherwise it
can't use Playback/Capture in the same time.
And it has been done by c2dc47d5cf("ASoC: rsnd: rsnd_dai_stream has each
mod's status insted of rsnd_mod") before.

OTOH, rsnd driver doesn't want to control CTU/MUX/DVC/SSIU/SSI in
separately. Otherwise, these will be re-initialized during playing if
MUX merges 2 sounds.
Because of these picky reasons, this patch re-defines status on each mod,
and add new parent_ssi_status on rsnd_dai_stream.

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


# 475a361a 30-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: src: add rsnd_src_halt()

Based on datasheet process

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


# 98efeeae 30-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: src: rename rsnd_src_soft_reset() to rsnd_src_activation()

Based on datasheet naming

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


# bf4e8d7c 30-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add missing SRC_O_BUSIF_MODE register

SRC_BUSIF_MODE has both IN/OUT register. Current src driver sets
IN register only. This patch sets missing OUT register.
IN/OUT register are using default setting, so, there is no
HW effect.

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


# c45f7263 30-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add missing ADINR::CHNUM on DVC/SRC/SSIU

DVC/SRC/SSIU needs ADINR::CHNUM settings too. This patch adds
these missing value.

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


# 8cc225f7 26-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup semantics of rsnd_src_record_error()

rsnd_src_error_record() should recorde error, but it clears error too.
this patch fixes up semantic of rsnd_src_error_record that it records
error but doesn't clear error.
And this patch renames
rsnd_src_error_clear() to rsnd_src_status_clear()
rsnd_src_error_record() to rsnd_src_record_error()

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


# 2ea6b074 09-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove struct platform_device from probe/remove parameter

Current Renesas sound driver requests struct platform_device on
probe/remove for each modules. But driver can get it by
rsnd_priv_to_pdev(). This patch removes unnecessary parameter

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


# e797f58e 09-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove struct rsnd_of_data

No board is using Renesas sound driver via platform boot now.
This means all user is using DT boot. Platform boot support is
no longer needed. But, it strongly depends on platform boot style.
Now, platform boot style was removed from driver.
This is cleanup patch, and remove pointless struct rsnd_of_data

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


# adf6a681 09-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove platform boot support from src.c

No board is using Renesas sound driver via platform boot now.
This means all user is using DT boot. Platform boot support is
no longer needed. But, it strongly depends on platform boot style.
This patch removes platform boot support from src.c

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


# 94e2710c 09-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove platform boot support from core.c

No board is using Renesas sound driver via platform boot now.
This means all user is using DT boot. Platform boot support is
no longer needed. But, it strongly depends on platform boot style.
This patch removes platform boot support from core.c

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


# 75916f65 09-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SRC settings matches to datasheet

Current SRC settings order was rough. Now, Gen1 support was removed.
This patch makes it cleanup and match to datasheet.

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


# e8e7b7bd 09-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove Gen1 support from SRC

This patch removes SRC Gen1 support which has no user on upstream.
Historically, SRC Gen1 was created as prepare for SRC Gen2 support.
It works well for Gen2 support, but Gen1 is not same as Gen2.
So now, Gen1 support is no longer needed. Thanks Gen1 and Bye-bye.

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


# f36a8226 27-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: call rsnd_src_quit() from rsnd_src_quit_gen2()

2d604e03("ASoC: rsnd: disable SRC.out only when stop timing")
added rsnd_src_quit_gen2(), but it should call rsnd_src_quit()
same as before. This patch fixup it.

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


# c7f69ab5 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: use mod base common method on SSIU

Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

This patch makes SSIU mod base common method

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


# 497debaa 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: use mod base common method on DMA phase3

Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

This patch makes DMA mod bse common method

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


# 76c80b5b 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: use mod base common method on DMA phase2

Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

DMA will be implemented as module. Then rsnd_dma_ops will be rebased
to rsnd_mod_ops, but these are similar, but different function.
This patch modify rsnd_dma_ops same style as rsnd_mod_ops.
This is prepare for final merge

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


# 940e9479 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: use mod base common method on DMA phase1

Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

DMA will be implemented as module. Then rsnd_dma will be mod base.
This patch makes rsnd_dma mod base, but still not yet completely
finished. This mod is not yet installed to system at this point.

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


# 69e32a58 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: Don't stop HW even if a large number of errors occur

Current SSI/SRC restarts HW if under/over flow happened to avoid L/R
invert issue. But it will stop HW if too many error happen.
But if it stops on HW, other side under/over flow happen. OTHA, it will
be forever loop interrupt if something strange error happen on
HW/driver without escape route of large number error.

To avoid this issue, it indicates error message if large number error
occur, and disables error interrupt.

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


# b761bf27 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: disable SRC.out only when stop timing

Because SRC is connected to DMA and DMA want to keep dreq when stop
timing. This patch makes SRC stop SRC.out only when stop timing. And
it stops both SRC.out/SRC.in when quit timing

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


# 37447b46 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: move rsnd_src_ssi_irq_enable/disable() to ssi.c

Part of SSI IRQ enable/disable was controlled by SRU (on Gen1)
or CMD (on Gen2). Because of this reason SSI IRQ function was
implemented under src.c. but it is not understandable.
Let's move it to ssi.c

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


# 81ecbb65 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename rsnd_dma_init() to rsnd_dma_attach()

Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

DMA will be implemented as module. Then each rsnd_dma_ops will be
rsnd_mod_ops. But current rsnd_dma_ops::init means "DMA attach".
This patch removes .init from rsnd_dma_ops, and renames
rsnd_dma_init() to rsnd_dma_attach()

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


# 232c00b6 26-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: DMA become SSI/SRC member

Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

Current rsnd_mod is member of rsnd_mod. But the DMA user is only
SSI/SRC. This DMA will be implemented as module. As 1st step, DMA
become SSI/SRC member by this patch.

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


# 7115cb91 10-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: make sure SRC In Rate feature enablement

SRC In Rate convert feature cannot be used if data path is using DVC.
This patch judges it, and not allowed to use it in such case.

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


# b415b4d3 21-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove duplicate parameter from rsnd_ssi_xxx()

rsnd_ssi_use_busif() and rsnd_ssi_is_pin_sharing() are the function
which returns current SSI status. But these requests duplicated parameter.
This patch removes duplicated parameter.

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


# c9929345 21-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename rsnd_mod_hw_start/stop to rsnd_mod_power_on/off

rsnd_mod_hw_start/stop were unclear naming.
It became rsnd_mod_power_on/off by this patch

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


# 43624957 14-Oct-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: Announce for removing Gen1 SRU support

Gen1 SRU support was created for preparation of Gen2 SRC support,
but no-one is using this feature (sampling rate convert) on Gen1.
BockW had used SRU before, but it was pass through mode.
This means it is same as SSI. And BockW "platform base" code was
removed from upstream code. It is now supported via DT, but it doesn't
use SRU. More detail, r8a7778.dtsi has "rcar_sound,src" entry, but
no-one is using this feature today. SRU probing has no relation to this
removing. This means there is no effect for DT compatibility, no issues
on upstream kernel.

Gen2 SRC was created from Gen1 SRU, these are similar but not same IP.
Keeping Gen1 SRU in current driver is a little bit difficult,
and no-one is using it today. Gen1 sound is still supported via SSI.
Gen1 SRU support will be removed in the next kernel version.
This patch announces it.

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


# b76e218a 10-Sep-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_mod_get() macro and use it

Renesas sound driver has SSI/SRC/DVC/CTU/MIX, and these are controlled
as modules. And these module are member of each modules's private data.
It used own method to get module pointer, but Let's use common method

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


# b9bfe9d5 10-Sep-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename rsnd_src_pcm_new() to rsnd_src_pcm_new_gen2()

rsnd_src_pcm_new() is used only from Gen2. make it clear in function name,
and remove unneeded Gen1 check.

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


# 4689032b 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup data align position

Sound L/R order of SSI is different from Linux sound data order.
So current rsnd driver is using DALIGN (= data align) to exchange data
align on SSIU. OTOH, CMD/SRC/SSIU have DALIGN register. Now inverted
sound volume will be exchanged if user used volume control on DVC.
Because SSIU which exchanges data align is located after DVC.

MEM -> SRC -> DVC -> SSI

This patch exchanges data align SRC if possible

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>


# 3023b384 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup ADINR function name

Renesas sound IP (= SSIU/SRC/CTU/MIX/DVC) have ADINR
(= Audio Information Register), but some of them (= SSIU/SRC/DVC)
are for audio data bits, some of them (= CTU/MIX) are for audio data
channels.
Current rsnd driver is supporting SSIU/SRC/DVC, and these ADINR were
for bits. This patch rename rsnd_get_adinr() to rsnd_get_adinr_bit(),
and we will have rsnd_get_adinr_chan() for CTU/MIX.

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>


# d1ade514 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_src_initialize_lock/unlock()

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxIR (Initialization Register) is one
of them. These xxxIR need be set to 1 during initialization.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_src_initialize_lock/unlock() and make sure it

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>


# 379febfd 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: src: make sure SRC soft reset

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxRSR (Software reset Register) is one
of them. These xxxRSR need be set to 1 to 0 when software reset.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_src_soft_reset() and make sure it

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>


# da599fd3 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: move SRC specific macro into src.c

rsnd_src_nr() is used only from src.c

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>


# 1a1bf58a 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add workaround for SRC sync convert + DVC

We couldn't use SRC sync convert mode together with DVC,
but we can use workaround for it.
This patch adds workaround and can use SRC sync convert + DVC

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>


# efa991dc 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE

based on datasheet

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>


# cdde84d1 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN

based on datasheet

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>


# 33363f7a 15-Jul-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove unnecessary 'out of memory' message from SRC

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

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>


# d5bbe7de 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: move rsnd_mod_is_working() to rsnd_io_is_working()

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship.
This patch checks module working status via io instead of mod

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>


# b65a7ccc 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use rsnd_mod_to_io() on snd_kcontrol

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from snd_kcontrol
and related function.

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>


# 88c61cff 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_src_xxx()

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from rsnd_src_xxx()
and related function.

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>


# 9b99e9a7 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_dma_xxx()

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from rsnd_dma_xxx()
and related function

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>


# 4e2639ff 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_get_adinr()

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from rsnd_get_adinr()
and its related function

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>


# 2c0fac19 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: adds struct rsnd_dai_stream as on each fuction as parameter

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This means we can't call rsnd_mod_to_io() any more.
This patch adds struct rsnd_dai_stream to each function as parameter.

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>


# 2099bc8e 15-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_mod has rsnd_priv

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This means we can't use rsnd_mod_to_io() in SSI/SRC/DMA
interrupt handler. In such case, we need to check all io in interrupt
handler, and then, "priv" is needed.
This patch adds rsnd_priv pointer in rsnd_mod for prepare it.

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>


# 02299d98 20-May-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: spin lock for interrupt handler

Renesas R-Car driver interrupt handler was not locked before.
But now, SSI/SRC interrupt handler calls restart function
which should be called under spin lock.
Below error might happen witout this patch.

Unable to handle kernel NULL pointer dereference at virtual address 00000048
pgd = edfac000
[00000048] *pgd=6e0f0831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] SMP ARM
CPU: 0 PID: 2009 Comm: aplay Not tainted 4.1.0-rc2-dirty #4
Hardware name: Generic R8A7790 (Flattened Device Tree)
task: eeac9040 ti: eebe8000 task.ti: eebe8000
PC is at rsnd_get_adinr+0x28/0x60
LR is at rsnd_src_ssiu_start+0xdc/0x19c
pc : [<c0409790>] lr : [<c040c068>] psr: a0000193
sp : eebe9e58 ip : eebe9e68 fp : eebe9e64
r10: c06ed9d0 r9 : ee919d10 r8 : 00000001
r7 : 00000001 r6 : ee1cb090 r5 : 00000000 r4 : edcaa418
r3 : 00000000 r2 : eea8ce00 r1 : 80000193 r0 : edcaa418
...

Reported-by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Tested by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 43cb6954 31-Mar-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add Synchronous SRC mode

Renesas R-Car sound SRC (= Sampling Rate Converter) has
Asynchronous/Synchronous SRC mode. Asynchronous mode is already
supported via DPCM. This patch adds Synchronous mode on it.

The condition of enabling Synchronous mode are
- SoC is clock master
- Sound uses SRC
- Sound doesn't use DVC
- Sound card uses DPCM (= rsrc-card card)

amixer set "SRC Out Rate" on
aplay xxx.wav &
amixer set "SRC Out Rate" 48000

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


# 3b7843ff 25-Mar-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add DPCM based sampling rate convert

This patch supports DPCM based sampling rate convert on Renesas sound
driver. It assumes...
1. SRC is implemented as FE
2. BE dai_link supports .be_hw_params_fixup

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


# b543b52a 25-Mar-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove useless debug message

This patch removes useless debug message. especially some kind of
"probed" message will be printed from core.c if it has #define DEBUG

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


# 2f78dd7f 25-Mar-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: call clk_prepare/unprepare() in probe/remove

clk_prepare_enable()/clk_disable_unprepare() uses mutex inside,
in concretely clk_prepare()/clk_unprepare().And it uses __schedule().
Then, raw_spin_lock/unlock_irq() is called, and it breaks Renesas
sound driver's spin lock irq.
This patch separates thesse into clk_prepare()/clk_unprepare() and
clk_enable/clk_disable. And call clk_prepare()/clk_unprepare() from
probe/remove function. Special thanks to Das Biju.

Reported-by: Das Biju <biju.das@bp.renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 639b231f 18-Mar-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: no more SRC restart when unusual situation

It will be SRC interrupt endless loop f unusual situation happen.
This patch adds restart limit for it.

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


# 72adc61f 20-Feb-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: 1st DMAC dma-names cares subnode

Renesas R-Car sound (= rsnd) needs 2 DMAC which are called as
Audio DMAC (= 1st DMAC) and Audio DMAC peri peri (2nd DMAC).
And rsnd had assumed that 1st / 2nd DMACs are implemented as DMAEngine.
But, in result of DMA ML discussion, 2nd DMAC was concluded that it is
not a general purpose DMAC (2nd DMAC is for Device to Device inside
sound system). Additionally, current DMAEngine can't support Device to
Device, and we don't have correct DT bindings for it at this point.
So the easiest solution for it is that move it from DMAEngine to rsnd
driver.

dma-names on DT was implemented as no difference between 1st / 2nd
DMAC's, since rsnd had assumed that both DMACs are implemented as
DMAEngine. That style was "src_dst". But now, 2nd DMAC was implemented
as non DMAEngine, and it doesn't need dma-names anymore. So, this
dma-names rule is no longer needed.

And additionally, dma-names was assumed that it has all
(= SSI/SSIU/SRC/DVC) nodes under sound node.

In upstream code, no SoC/platform is supporting DMA for rsnd driver yet.
This means there is no compatible issue if this patch changes
dma-names's rule of DT.

This patch assumes dma-names for 1st DMAC are tx/rx base, and listed
in each SSI/SRC/DVC subnode
ex)
rcar_sound,dvc {
dvc0: dvc@0 {
dmas = <&audma0 0xbc>;
dma-names = "tx";
};
...

rcar_sound,src {
src0: src@0 {
...
dmas = <&audma0 0x85>, <&audma1 0x9a>;
dma-names = "rx", "tx";
};
...

rcar_sound,ssi {
ssi0: ssi@0 {
...
dmas = <&audma0 0x01>, <&audma1 0x02>, <&audma0 0x15>, <&audma1 0x16>;
dma-names = "rx", "tx", "rxu", "txu";
};
...

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


# 82e76ed3 20-Feb-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: src: add rsnd_src_of_node()

This patch adds rsnd_src_of_node() to get SRC subnode from DT.
This is prepare for new DT bindings for 1st DMAC

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


# 8a2ff426 20-Feb-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove un-needed parameter from rsnd_dma_quit()

priv is not used on rsnd_dma_quit()

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


# 9c706ab2 20-Feb-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove unused rsnd_dma_available()

rsnd_dma_available() is not used. Let's remove it.

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


# 4715219e 20-Feb-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove un-needed parameter from rsnd_dma_init()

It can get DMA direction via rsnd_dai_stream.
Remove un-needed is_play from rsnd_dma_init().

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


# 337b0b4c 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: error meesage indicates its port

Current SRC/SSI output its error, but it desn't indicate
port number. it is un-understandable.
Let's indicate port number for it.

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


# 1b13d118 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: save priv in struct rsnd_dai

Current rsnd driver has rsnd_mod_to_priv() macro, and struct rsnd_mod
has struct rsnd_priv pointer. But, it is waste of memory from data
structure point of view.
Today we can link mod <-> io <-> rdai each other, so saving priv in
rdai is very reasonable.

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


# 690602fc 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: replace rdai to priv in each function

Current rsnd driver's function requests rdai, but it is not used.
Adding priv is more reasonable. Let's replace it.

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


# f708d944 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove unsed rdai parameter from each function

Current rsnd driver's many functions requests struct rsnd_dai (= rdai),
but, 1) we can get rdai from rsnd_io_to_rsnd(), 2) almost all rdai
is not used. Let's remove these rdai.

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


# 985a4f6e 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: replace rsnd_dai_is_play() to rsnd_io_is_play()

Current rsnd driver can use rsnd_io_to_rdai()
we can get play/capture direction via io now.
Let's replace rsnd_dai_is_play() to rsnd_io_is_play()

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


# 3ed6448c 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename rsnd_dai_is_clk_master() to rsnd_rdai_is_clk_master()

struct rsnd_dai is called as "rdai", and struct snd_soc_dai is called
as "dai" on this driver. but macro/function have confusable naming.
This patch rename rsnd_dai_is_clk_master() to rsnd_rdai_is_clk_master()

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


# 85642952 15-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_mod controls clock

Current rsnd driver's mod (= ssi/src/dvc) have each own clk,
but, these are needed to start/stop each mod.
This patch adds struct clk in rsnd_mod, and start/stop these
via rsnd_mod_hw_start/stop() macro

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


# cfcefe01 07-Jan-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add recovery support for under/over flow error on SRC

L/R channel will be switched if under/over flow error happen on
Renesas R-Car sound device by the HW bugs. Then, HW restart is required
for salvage. This patch add salvage support for SRC.

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


# f0ef0cb8 27-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove un-necessary parameter from rsnd_src_start/stop()

rsnd_src_start/stop() requests struct rsnd_dai as parameter.
but, it is not used, and become more complex in L/R error handling.
Let's remove it.

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


# 933cc8cb 27-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: set SRC_ROUTE_MODE0 on each rsnd_src_set_convert_rate()

Current src.c sets SRC_ROUTE_MODE0 on rsnd_src_start(), but, set it in
rsnd_src_set_convert_rate() is natural.

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


# 603cefa5 27-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: initialize SRC on rsnd_src_init()

Current src initialize SRC on rsnd_src_set_convert_rate()
but, it should be done on rsnd_src_init().

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


# b167a578 27-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: use rsnd_src_convert_rate() once on rsnd_src_set_convert_rate_gen2()

using many rsnd_src_convert_rate() is not readable.

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


# c17dba8b 27-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup SSI interrupt enable/disable method

Current SSI doesn't care interrupt "disable" method. And, it is used
when PIO mode only at this point. SSI interrupt will be used for
sound R/L issue workaround when DMA mode too.
This patch tidyup SSI interrupt enable/disable method.

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


# 660cdce2 27-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_src_ssiu_stop() stops SSIU compulsorily

rsnd_src_ssiu_stop() is used to stop SSIU,
but it shouldn't depend on whether it is using SSIU.
This patch stops SSIU compulsorily.

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


# 30cc4faf 09-Nov-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup debug message format and timing

Current Renesas R-Car sound driver debug message
is using random format
(ex "ssi0: xxx" / "SSI0 xxx" / "ssi[0]: xxx")
and confusable timing
("xxx probe failed" and "xxx probed" are shown in same time)
This patch fixes these

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


# 1cc71959 31-Jul-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: care audio local bus data format consistency

R-Car sound uses Audio Local Bus which uses Lch/Rch format.
This bus is used if driver uses BUSIF.
But sound data is written as Rch/Lch format in register.
This means Rch <-> Lch will be inverted.
SSIU :: BUSIF_DALIGN is used to controlling data format.

Reported-by: Jun Watanabe <jun.watanabe.ue@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 054cd7f4 31-Jul-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: care detail of SRC_BSDSR

Driver should care more detail of SRC_BSDSR settings.
The sound includes noise without this patch
if it used SRC.

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


# d9288d0b 22-Jun-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SSI + DMA can select BUSIF

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

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


# 8aefda50 23-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: module name is unified

Renesas sound driver uses many modules (= SSI/SRC/DVC),
and each module had own name.
But, each module name can be used as several purpose,
like clock name, DMA name etc...
This patch uses common name for each module.

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


# 033e7ed8 23-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove rsnd_src_non_ops

Renesas sound driver is supporting Gen1/Gen2.
SRC probe can return error if it was unknown
generation.
Now, rsnd_src_non_ops is not needed.

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


# f451e48d 23-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: DT node clean up by using the of_node_put()

Driver needs to call of_node_put() after of_get_chile_by_name()

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


# bff58ea4 08-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add DVC support

This patch adds DVC (Digital Volume Controller)
support which is member of CMD unit.

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


# b42fccf6 08-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove duplicate parameter from rsnd_mod_ops

Now, it can get rsnd_dai_stream pointer from rsnd_mod.
Remove duplicate parameter from rsnd_mod_ops

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


# d7bdbc5d 08-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_get_adinr()

SRC module needs ADINR register settings,
but, it has many similar xxx_ADINR register,
and needs same settings.
This patch adds rsnd_get_adinr() to sharing code.

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


# 29e69fd2 08-May-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove compatibility code

Now, all platform is using new style rsnd_dai_platform_info.
Keeping compatibility is no longer needed.
We can cleanup code.

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


# 79861bbb 10-Apr-2014 Ben Dooks <ben.dooks@codethink.co.uk>

ASoC: rsnd: fix clock prepare/unprepare

As with the previous commit, before a clock can be used it must be prepared
for use. Change from clk_enable() and clk_disable() to the versions of the
calls which also prepare and un-prepare the clocks.

Will fix warnings from the clock code when this is used.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# b1eac430 23-Mar-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rcar: bugfix: it cares about the non-src case

src might not exist.
kernel will be hung-up without this patch in such case.

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


# 90e8e50f 17-Mar-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add DeviceTree support

Support for loading the Renesas R-Car sound driver via DeviceTree.

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


# ba9c949f 03-Mar-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rename scu to src

R-Car sound has SCU unit which has SRC/CTU/MIX/DVC,
and current rsnd driver has scu.c and scu module.
Current scu.c has SRC support only.
My first concept was control these feature on scu.c
but, it become difficult and un-understandable now.
This patch rename scu to src

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