History log of /linux-master/sound/soc/sh/rcar/rsnd.h
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>


# 547b02f7 23-Jul-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: enable multi Component support for Audio Graph Card/Card2

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

In above HW connection case, we intuitively think we want to handle these
as "2 Sound Cards".

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

But, we needed to handle it as "1 big Sound Card", because of
Component vs Card limitation.

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

This patch enables multi Component to handle multi Cards.
To support it, it needs

- Fill dai_args for each DAI on snd_soc_dai_driver
- Parse DT for each Component (Simple Card/Audio Graph Card)

Ex) Simple Card

rcar_sound {
...

/* Component0 */
rcar_sound,dai@0 {
...
};

/* Component1 */
rcar_sound,dai@1 {
...
};
};

Ex) Audio Graph Card/Card2

rcar_sound {
/* Component0 */
ports@0 {
...
};

/* Component1 */
ports@1 {
...
};
};

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


# c2bc6527 31-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add R-Car Gen4 Sound support

This patch is tested on V4H White Hawk + ARD-AUDIO-DA7212

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


# 6d612f67 31-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: indicate warning once if it can't handle requested rule

Some SoC can't handle all requested hw rule. In such case, it will indicate
like below, but it is unclear why it didn't work to user.
This patch indicates warning in such case once, because player will try to
similar rule many times.

# aplay sound.wav
Playing WAVE 'sound.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
aplay: aplay.c: 1359: set_params: Assertion `err >= 0' failed.
Aborted by signal Aborted...

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


# e5a3c491 31-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: Remove unnecessary rsnd_dbg_dai_call()

commit b43b8ae87c8e0a8 ("ASoC: rsnd: protect mod->status") removed
RSND_DEBUG_NO_DAI_CALL and rsnd_dbg_dai_call(), but these are still
exist on rsnd.h. This patch removes it.

Fixes: b43b8ae87c8e ("ASoC: rsnd: protect mod->status")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875ycm6t7l.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 49123b51 31-Jan-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup #endif position

commit 1f9c82b5ab83ff2 ("ASoC: rsnd: add debugfs support") added
CONFIG_DEBUG_FS related definitions on rsnd.h, but it should be
added inside of RSND_H. This patch fixup it.

Fixes: 1f9c82b5ab83 ("ASoC: rsnd: add debugfs support")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877cx26t7r.wl-kuninori.morimoto.gx@renesas.com
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>


# 3f4593fb 01-Jun-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup __rsnd_mod_xxx macro comments

status and __rsnd_mod_xxx were updated, but some related comments were
not. And it has verbose comments. This patch cleanup/tidyup these.

1) adds missing "D" to status sample
2) remove verbose list for "H"
3) add "needs protect" to __rsnd_mod_call_xxx

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


# cb2f97d8 01-Jun-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: adg: use more simple method for null_clk

commit 965386c97616c ("ASoC: rsnd: call unregister for null_hw when
removed") tried unregister null_clk, but it has some issues.

1st issue is kernel will indicate below message when unregistering,
because of its timing. unregistering should be happen after clk_disable().

clk_unregister: unregistering prepared clock: rsnd_adg_null

2nd issue is, it is using priv->null_clk, but it should be adg->null_clk.

3rd issue is it is using very complex clk registering method.
more simple clk_register/unregister_fixed_rate() should be OK.

This patch fixes these.

Fixes: 965386c97616c ("ASoC: rsnd: call unregister for null_hw when removed")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1hli215.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>


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

ASoC: rsnd: tidyup rsnd_parse_connect_common()

This patch adds "char *name" to rsnd_parse_connect_common().
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/87a6obk01v.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rsnd: implement BUSIF related code in ssiu.c

BUSIF is SSIU feature, but its related code is
implemented at ssi.c today.
This patch moves it to ssiu.c

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


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

ASoC: rsnd: protect mod->status

Renesas Sound uses many modules (SSI/SSIU/SRC/CTU/MIX/DVC/DMA),
and supports complex connections/path.
Thus each modules needs to save its status to correctly control it.
This status is updated when by .trigger, and .hw_params/.hw_free.

Renesas Sound is protecting modules by using lock when .trigger,
but it was not enough to protecting each modules "status" if it was
used from many paths.

1) .hw_params/.hw_free update status
2) another doesn't update status, but overwrites by same value

This patch do
1) protects .hw_params/.hw_free by lock
2) do nothing if no status update

Without this patch, protected mod->status (= .trigger) might be
overwrote by non protected mod->status (= .hw_params / .hw_free),
and in such case, CTU/MIX/DVC/SSIU/SSI which are used from
many paths might get damage.

If above issue happens, Renesas Sound will be hung (= silence)
and never be recoverd.
I could reproduce this issue by continue playing very short sound
with loop very long term (3-4 hours) through 2 inputs (= MIXer).

For updating rsnd_status_update(), this patch removes rsnd_dai_call()
debug message. Because we already have debugfs support, and is not
good match to new code.

Reported-by: Linh Phung T. Y <linh.phung.jy@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Message-Id: <87wnrklwyh.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>


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

ASoC: rsnd: attach SSIU when SSI was DMA mode

SSIU is not needed if SSI was PIO mode.
This patch ignores such case.

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


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

ASoC: rsnd: call unregister for null_hw when removed

commit d6956a7dde6fb ("ASoC: rsnd: add null CLOCKIN support")
added null_clk, but it is using local static valuable.
It will be leaked if rsnd driver was removed.
This patch moves it to priv, and call unregister when removing.

Fixes: d6956a7dde6fb ("ASoC: rsnd: add null CLOCKIN support")
Link: https://lore.kernel.org/r/87tumsoe2p.wl-kuninori.morimoto.gx@renesas.com
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Message-Id: <877djknbl5.wl-kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: sh: rcar: align function prototypes

cppcheck warnings:

sound/soc/sh/rcar/adg.c:208:51: style:inconclusive: Function
'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration
'mod' definition 'cmd_mod'. [funcArgNamesDifferent]
int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod,
^
sound/soc/sh/rcar/rsnd.h:608:51: note: Function
'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration
'mod' definition 'cmd_mod'.
int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod,
^
sound/soc/sh/rcar/adg.c:208:51: note: Function
'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration
'mod' definition 'cmd_mod'.
int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod,
^
sound/soc/sh/rcar/adg.c:322:44: style:inconclusive: Function
'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod'
definition 'ssi_mod'. [funcArgNamesDifferent]
int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod)
^
sound/soc/sh/rcar/rsnd.h:600:44: note: Function
'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod'
definition 'ssi_mod'.
int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod);
^
sound/soc/sh/rcar/adg.c:322:44: note: Function 'rsnd_adg_ssi_clk_stop'
argument 1 names different: declaration 'mod' definition 'ssi_mod'.
int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod)
^
sound/soc/sh/rcar/adg.c:329:49: style:inconclusive: Function
'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration
'mod' definition 'ssi_mod'. [funcArgNamesDifferent]
int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate)
^
sound/soc/sh/rcar/rsnd.h:601:49: note: Function
'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration
'mod' definition 'ssi_mod'.
int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate);
^
sound/soc/sh/rcar/adg.c:329:49: note: Function
'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration
'mod' definition 'ssi_mod'.
int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate)
^

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


# 25b384b8 13-Jul-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use discriminatory terms for function names

rsnd is using discriminatory terms for function names.
This patch changes it to "secondary"

One note here is that it do nothing to DMA related naming
for now, because it needs framework level modification.

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


# 66c705d0 12-May-2020 Yongbo Zhang <giraffesnn123@gmail.com>

SoC: rsnd: add interrupt support for SSI BUSIF buffer

SSI BUSIF buffer is possible to overflow or underflow, especially in a
hypervisor environment. If there is no interrupt support, it will eventually
lead to errors in pcm data.
This patch adds overflow and underflow interrupt support for SSI BUSIF buffer.

Reported-by: Chen Li <licheng0822@thundersoft.com>
Signed-off-by: Yongbo Zhang <giraffesnn123@gmail.com>
Tested-by: Chen Li <licheng0822@thundersoft.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200512093003.28332-1-giraffesnn123@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 859fd6cb 22-Jul-2019 Timo Wischer <twischer@de.adit-jv.com>

ASoC: rsnd: Support hw_free() callback at DAI level

This patch provides the needed infrastructure to support calling hw_free()
at the DAI level. This is for example required to free resources allocated
in hw_params() callback.

The modification of __rsnd_mod_add_hw_params does not have any side
effects because rsnd_mod_ops::hw_params callback is not used by anyone
until now.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Link: https://lore.kernel.org/r/20190722072403.11008-2-jiada_wang@mentor.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 66287def 25-Apr-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup 6ch settings to 8ch

rsnd need to use 8ch clock settings for 6ch for TDM.
Otherwise, it can't work correctly.
This patch fixup it.

Signed-off-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>


# 8af6c521 24-Feb-2019 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: gen: fix SSI9 4/5/6/7 busif related register address

Currently each SSI unit 's busif mode/adinr/dalign address is
registered by: (in busif4 case)
RSND_GEN_M_REG(SSI_BUSIF4_MODE, 0x500, 0x80)
RSND_GEN_M_REG(SSI_BUSIF4_ADINR,0x504, 0x80)
RSND_GEN_M_REG(SSI_BUSIF4_DALIGN, 0x508, 0x80)

But according to user manual 41.1.4 Register Configuration
ssi9 4/5/6/7 busif mode/adinr/dalign register address
( SSI9-[4/5/6/7]_BUSIF_[MODE/ADINR/DALIGN] )
are out of this rule.

This patch registers ssi9 4/5/6/7 mode/adinr/dalign register
as single register, and access these registers in case of
SSI9 BUSIF 4/5/6/7.

Fixes: commit 8c9d75033340 ("ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b7169dde 12-Dec-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove RSND_REG_ from rsnd_reg

Current rsnd is using RSND_REG_xxx for register naming,
and using RSND_REG_##f style macro for read/write.
The biggest reason why it uses this style is that
we can avoid non-existing register access.
But, its demerit is sequential register access code will
be very ugly.
Current rsnd driver is well tested, so, let's remove RSND_REG_
from rsnd_reg, and cleanup sequential register access code.

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>


# 665c1ade 04-Dec-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup mod ID for CTU regmap read/write

commit c16015f36cc12824 ("ASoC: rsnd: add .get_id/.get_id_sub")
add new .get_id/.get_id_sub to indicate module ID/subID.
It is used for SSIU and CTU. In SSIU case, subID indicates BUSIF,
but register settings is based on SSIU ID.
OTOH, in CTU case, subID indicates CTU channel, and register settings
is based on it. This means regmap read/write function needs to care it.
This patch fixup this issue. It can't play MIXed sound without this
patch.

Fixes: c16015f36cc12824 ("ASoC: rsnd: add .get_id/.get_id_sub")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rsnd: makes rsnd_ssi_is_dma_mode() static

ssi.c only is using rsnd_ssi_is_dma_mode().
Let's move it as static function.

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


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

ASoC: rsnd: add TDM Split mode support

This patch adds TDM Split mode support. rsnd driver is assuming
audio-graph-scu-card is used for Sound Card.

This is very simple sample DT settings to use it.

sound_card: sound {
compatible = "audio-graph-scu-card";
...
convert-channels = <8>; /* TDM Split */

dais = <&rsnd_port0 /* playback ch1/ch2 */
&rsnd_port1 /* playback ch3/ch4 */
&rsnd_port2 /* playback ch5/ch6 */
&rsnd_port3 /* playback ch7/ch8 */
>;
};

audio-codec {
...
port {
codec_0: endpoint@1 {
remote-endpoint = <&rsnd_ep0>;
};
codec_1: endpoint@2 {
remote-endpoint = <&rsnd_ep1>;
};
codec_2: endpoint@3 {
remote-endpoint = <&rsnd_ep2>;
};
codec_3: endpoint@4 {
remote-endpoint = <&rsnd_ep3>;
};
};
};

&rcar_sound {
...
ports {
rsnd_port0: port@0 {
rsnd_ep0: endpoint {
remote-endpoint = <&codec_0>;
...
playback = <&ssiu30 &ssi3>;
};
};
rsnd_port1: port@1 {
rsnd_ep1: endpoint {
remote-endpoint = <&codec_1>;
...
playback = <&ssiu31 &ssi3>;
};
};
rsnd_port2: port@2 {
rsnd_ep2: endpoint {
remote-endpoint = <&codec_2>;
...
playback = <&ssiu32 &ssi3>;
};
};
rsnd_port3: port@3 {
rsnd_ep3: endpoint {
remote-endpoint = <&codec_3>;
...
playback = <&ssiu33 &ssi3>;
};
};
};
};

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


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

ASoC: rsnd: add SSIU BUSIF support

Gen2 has BUSIF0-3, Gen3 has BUSIF0-7 on some SSIU.
Current driver is assuming it is using BUSIF0 as default.
Thus, SSI is attaching SSIU (with BUSIF0) by using rsnd_ssiu_attach().
But, TDM split mode also needs other BUSIF to use it.
This patch adds missing SSIU BUSIFx support.

BUSIF is handled by SSIU instead of SSI anymore.
Thus, its settings no longer needed on SSI node on DT.
This patch removes its settings from Document, but driver is still
keeping compatibility. Thus, old DT style is still working.
But, to avoid confusing, it doesn't indicate old compatibility things on
Document. New SoC should have SSIU on DT from this patch.

1) old style DT is still supported (= no rcar_sound,ssiu node on DT)
2) If ssiu is not indicated on playback/capture,
BUSIF0 will be used as default
playback = <&ssi3>; /* ssiu30 will be selected */
3) you can select own ssiu
playback = <&ssi32 &ssi3>; /* ssiu32 will be selected */

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@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>


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

ASoC: rsnd: move HDMI information from ssi.c to core.c

Current driver is supporting HDMI output, and its information
are handled under ssi.c. But, it is stream information.
Let's move it from ssi.c to core.c.

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


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

ASoC: rsnd: rename rsnd_runtime_is_ssi_xxx()

Current rsnd driver has rsnd_runtime_is_ssi_xxx() functions,
but it is not only related to SSI, thus, it is misunderstandable.
This patch renames it.

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>


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

ASoC: rsnd: add .get_id/.get_id_sub

ID for CTU and SSIU are confusable.
1 CTU has 4 sub nodes. This means, CTU0 has CTU01 - CTU03, CTU1 has
CTU10 - CTU13. SSIU is more confusable. Gen2 SSIU has BUSIF0-3, Gen3
SSIU has BUSIF0-7, but not for all SSIU.
In rsnd driver, each mod drivers are assuming rsnd_mod_id() returns
main device ID (In CTU case CTU0-1, SSIU case SSIU0-9), not serial
number.
This patch adds new .id/.id_sub to handling more detail ID.

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>


# 624d1a7c 20-Sep-2018 Dmytro Prokopchuk <dmytro.prokopchuk@globallogic.com>

ASoC: rsnd: fixup SSI clock during suspend/resume modes

Prepare <-> Cleanup functions pair has balanced calls.
But in case of suspend mode no call to rsnd_soc_dai_shutdown()
function, so cleanup isn't called. OTOH during resume mode
function rsnd_soc_dai_prepare() is called, but calling
rsnd_ssi_prepare() is skipped (rsnd_status_update() returns zero,
bacause was not cleanup before).
We need to call rsnd_ssi_prepare(), because it enables SSI clocks
by calling rsnd_ssi_master_clk_start().

This patch allows to call prepare/cleanup functions always.

Signed-off-by: Dmytro Prokopchuk <dmytro.prokopchuk@globallogic.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
[kuninori: adjusted to upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rsnd: merge .nolock_start and .prepare

Main purpose of .nolock_start is we need to call
some function without spinlock.
OTOH we have .prepare which main purpose is
called under atomic context.
Then, it is called without spinlock.

In summary, our main callback init/quit, and start/stop
are called under "atomic context and with spinlock".
And some function need to be called under
"non-atomic context or without spinlock".
Let's merge .nolock_start and prepare to be more clear code.
Then, let's rename nolock_stop to cleanup

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>


# 8c9d7503 03-Sep-2018 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0

Currently only BUSIF0 is supported by SSIU, all register setting
is done only for BUSIF.

Since BUSIF1 ~ BUSIF7 has been supported, so also support
these BUSIF from SSIU.

One note is that we can't support SSI9-4/5/6/7 so far,
because its address is out of calculation rule.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
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>


# 5e45a6fa 03-Sep-2018 Jiada Wang <jiada_wang@mentor.com>

ASoc: rsnd: dma: Calculate dma address with consider of BUSIF

DMA address calculated by rsnd_dma_addr() only considers BUSIF0 so far.
But BUSIF1 ~ BUSIF7 also maybe used, in the future.

This patch updates DMA address calculations, to also consider
BUSIF number used by SSI.

One note is that we can't support SSI9-4/5/6/7 so far,
because its address is out of calculation rule.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[kuninori: adjust to upstreaming]
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>


# 0e289012 03-Sep-2018 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: ssi: Fix issue in dma data address assignment

Same SSI device may be used in different dai links,
by only having one dma struct in rsnd_ssi, after the first
instance's dma config be initilized, the following instances
can no longer configure dma, this causes issue, when their
dma data address are different from the first instance.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
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>


# fb2815f4 03-Sep-2018 Dragos Tarcatu <dragos_tarcatu@mentor.com>

ASoC: rsnd: add support for 16/24 bit slot widths

The slot width (system word length) was fixed at 32 bits.
This patch allows also setting it to 16 or 24 bits.

Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
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>


# 4d230d12 03-Sep-2018 Jiada Wang <jiada_wang@mentor.com>

ASoC: rsnd: fixup not to call clk_get/set under non-atomic

Clocking operations clk_get/set_rate, are non-atomic,
they shouldn't be called in soc_pcm_trigger() which is atomic.

Following issue was found due to execution of clk_get_rate() causes
sleep in soc_pcm_trigger(), which shouldn't be blocked.

We can reproduce this issue by following
> enable CONFIG_DEBUG_ATOMIC_SLEEP=y
> compile, and boot
> mount -t debugfs none /sys/kernel/debug
> while true; do cat /sys/kernel/debug/clk/clk_summary > /dev/null; done &
> while true; do aplay xxx; done

This patch adds support to .prepare callback, and moves non-atomic
clocking operations to it. As .prepare is non-atomic, it is always
called before trigger_start/trigger_stop.

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
in_atomic(): 1, irqs_disabled(): 128, pid: 2242, name: aplay
INFO: lockdep is turned off.
irq event stamp: 5964
hardirqs last enabled at (5963): [<ffff200008e59e40>] mutex_lock_nested+0x6e8/0x6f0
hardirqs last disabled at (5964): [<ffff200008e623f0>] _raw_spin_lock_irqsave+0x24/0x68
softirqs last enabled at (5502): [<ffff200008081838>] __do_softirq+0x560/0x10c0
softirqs last disabled at (5495): [<ffff2000080c2e78>] irq_exit+0x160/0x25c
Preemption disabled at:[ 62.904063] [<ffff200008be4d48>] snd_pcm_stream_lock+0xb4/0xc0
CPU: 2 PID: 2242 Comm: aplay Tainted: G B C 4.9.54+ #186
Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
Call trace:
[<ffff20000808fe48>] dump_backtrace+0x0/0x37c
[<ffff2000080901d8>] show_stack+0x14/0x1c
[<ffff2000086f4458>] dump_stack+0xfc/0x154
[<ffff2000081134a0>] ___might_sleep+0x57c/0x58c
[<ffff2000081136b8>] __might_sleep+0x208/0x21c
[<ffff200008e5980c>] mutex_lock_nested+0xb4/0x6f0
[<ffff2000087cac74>] clk_prepare_lock+0xb0/0x184
[<ffff2000087cb094>] clk_core_get_rate+0x14/0x54
[<ffff2000087cb0f4>] clk_get_rate+0x20/0x34
[<ffff20000113aa00>] rsnd_adg_ssi_clk_try_start+0x158/0x4f8 [snd_soc_rcar]
[<ffff20000113da00>] rsnd_ssi_init+0x668/0x7a0 [snd_soc_rcar]
[<ffff200001133ff4>] rsnd_soc_dai_trigger+0x4bc/0xcf8 [snd_soc_rcar]
[<ffff200008c1af24>] soc_pcm_trigger+0x2a4/0x2d4

Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
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>
Cc: stable@vger.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>


# 5423d772 15-Apr-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: Enable IPMMU v2

commit 4821d914fe747 ("ASoC: rsnd: use dma_sync_single_for_xxx() for
IOMMU") (= v1) which have been already reverted had supported IPMMU
support on rsnd driver.
Because memory allocating timing and DMAEngine access timing were
different, it used continuous memory and called dma map function by
itself.

OTOH, it is using DMA descriptor mode (= DMA cyclic mode), thus, there
was timing conflict between DMA sync/unsync and DMA transfer starting,
and it maked sound noise.

This patch supports IPMMU with coherent memory, and, it uses Audio DMAC
dev for allocating memory by snd_pcm_lib_preallocate_pages_for_all() to
indicate memory area to IPMMU.
One note is that Playback/Capture need each paired Audio DMAC dev.
Because of this, we need to keep each paired Audio DMAC dev when probing,
and use it when allocating each memory for IPMMU.

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>


# d188e140 10-Apr-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add RSND_GEN3 for R-Car Gen3

rsnd driver is supporting Gen3. The difference between Gen1 and Gen2
were very big, but, between Gen2 and Gen3 are not so much.
Thus, it is assuming Gen2 and Gen3 have compatible, therefore,
there is no RSND_GEN3 and rsnd_is_gen3() macro.
But in the future, it will need Gen2 and Gen3 different operation,
and for Gen4.
This patch adds missing RSND_GEN3 and rsnd_is_gen3() macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9fff2d39 05-Apr-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: makes rsnd_cmd_mod_get() static

rsnd_cmd_mod_get() is used from cmd.c only.
Let's makes it static function

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


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

ASoC: rsnd: suppress rsnd_dai_call() debug message

rsnd_dai_call() is using dev_dbg(), but its message is sometimes
blocks nessesary other messages. If RSND_DEBUG_NO_DAI_CALL was
defined it will be suppressed by this patch.

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>


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


# b2fb31bb 28-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: TDM 6ch needs 8ch clock for hw refine

Renesas sound needs 8ch clock if TDM 6ch mode, and needs 2ch clock for
6ch or 8ch sound if Multi SSI mode. And these are related to before/after
CTU (= Channel Transfer Unit).
To calculate these we already has rsnd_runtime_channel_for_ssi() which
returns runtime necessary channels.
But, it based on runtime->channels which is not yet set when hw refine.
We need to use hw_params instead of runtime->xxx when hw refine,
and it is not needed after runtime was set.
This patch adds new hw_params on rsnd_dai_stream, and it will be removed
on rsnd_hw_params().
This is very temporary durty code, but it seems no choice at this point.

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


# 9b6ea250 01-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove NULL check from rsnd_mod_name()/rsnd_mod_id()

Current rsnd driver has rsnd_mod_id() which returns mod ID,
and it returns -1 if mod was NULL.
In the same time, this driver has rsnd_mod_name() which returns mod
name, and it returns "unknown" if mod or mod->ops was NULL.

Basically these "mod" never be NULL, but the reason why rsnd driver
has such behavior is that DMA path finder is assuming memory as
"mod == NULL".
Thus, current DMA path debug code prints like below.
Here "unknown[-1]" means it was memory.

...
rcar_sound ec500000.sound: unknown[-1] from
rcar_sound ec500000.sound: src[0] to
rcar_sound ec500000.sound: ctu[2]
rcar_sound ec500000.sound: mix[0]
rcar_sound ec500000.sound: dvc[0]
rcar_sound ec500000.sound: ssi[0]
rcar_sound ec500000.sound: audmac[0] unknown[-1] -> src[0]
...

1st issue is that it is confusable for user.
2nd issue is rsnd driver has something like below code.

mask |= 1 << rsnd_mod_id(mod);

Because of this kind of code, some statically code checker will
reports "Shifting by a negative value is undefined behaviour".

But this "mod" never be NULL, thus negative shift never happen.
To avoid these issues, this patch adds new dummy "mem" to
indicate memory, and use it to indicate debug information,
and, remove unneeded "NULL mod" behavior from rsnd_mod_id() and
rsnd_mod_name().

The debug information will be like below by this patch
...
rcar_sound ec500000.sound: mem[0] from
rcar_sound ec500000.sound: src[0] to
rcar_sound ec500000.sound: ctu[2]
rcar_sound ec500000.sound: mix[0]
rcar_sound ec500000.sound: dvc[0]
rcar_sound ec500000.sound: ssi[0]
rcar_sound ec500000.sound: audmac[0] mem[0] -> src[0]
...

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>


# 3a9fa27b 10-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_kctrl_xxx() macro

Current CTU/MIX/DVC are directly using rsnd_kctrl_cfg_m/s to control
val etc, but it is difficult to read/understand.
And there was no uniformity in access method.
This patch adds new rsnd_kctrl_xxx() and implements uniformed access
method.

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


# 3e3c9ee1 01-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add MIX Volume Ramp support

Both DVC/MIX have Volume Ramp Control. This patch supprts MIX
Volume Ramp. One note is that main purpose of MIX Volume Ramp
is to reduce noise, thus, MIX Ramp range is very few if you
compare to DVC Volume Ramp (DVC = 5bit, MIX = 4bit).

You can use MIX Volume Ranp like below
amixer set "MIX Ramp Up Rate" "0.125 dB/1 step"
amixer set "MIX Ramp Down Rate" "0.125 dB/1 step"
amixer set "MIX Ramp" on
aplay xxx.wav &
amixer set "MIX",0 80% // DAI0 Volume Down
amixer set "MIX",1 100% // DAI1 Volume Up

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>


# f3c26ac6 01-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: makes volume ramp rate list generic

DVC is supporting Volume Ramp Rate, and MIX has Volume Ramp
but not yet supported. To support MIX Volume Ramp, we want to
share Rate List since DVC/MIX are using almost same list.
This patch move DVC specific Volume Ramp Rate List to core.c.

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>


# 42991989 01-Oct-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add generic rsnd_flags_xxx() macro

SSI is using rsnd_ssi_flags_xxx() macro to control flags.
But it is useful macro not only for SSI. This patch replace it
to more generic rsnd_flags_xxx().

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>


# 16d44989 23-Jul-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: don't use private_value on rsnd_kctrl_new()

Current rsnd kctrl is using both .private_value (for rsnd_kctrl_cfg)
and .private_data (for rsnd_mod) on snd_kcontrol.
But only 1 private data (= rsnd_kctrl_cfg) can be enough if it has
rsnd_mod pointer.
This patch doesn't use private_value.

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


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

ASoC: rsnd: fixup unsigned expression compared with zero: main_rate

This patch fixes this WARNING

sound/soc/sh/rcar/ssi.c:285:5-14: WARNING: Unsigned expression\
compared with zero: main_rate < 0

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


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

ASoC: rsnd: add rsnd_soc_hw_rule/constraint()

Current Renesas sound driver is assuming that all Sampling rate and
channles are possible to use, but these are depends on inputed clock
and SSI connection situation.
For example, if it is using 1 SSI, enabled TDM mode and has 12288000
input clock, 2ch output can support until 192000Hz, but 6ch output can
support until 64000Hz, 8ch can support 48000Hz.
To control these situation correctly, it needs to support
hw_constraints / refine feature.

To support such feature, this patch adds new
rsnd_soc_hw_rule/constraint() which adds hw rule of Channel and
Sampling Rate.

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>


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

ASoC: rsnd: add rsnd_ssi_clk_query()

Current Renesas sound driver is assuming that all Sampling rate and
channles are possible to use, but these are depends on inputed clock
and SSI connection situation.
For example, if it is using 1 SSI, enabled TDM mode and has 12288000
input clock, 2ch output can support until 192000Hz, but 6ch output can
support until 64000Hz, 8ch can support 48000Hz.
To control these situation correctly, it needs to support
hw_constraints / refine feature.

To support such feature, this patch adds new rsnd_ssi_clk_query().

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>


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

ASoC: rsnd: add rsnd_adg_clk_query()

Current Renesas sound driver is assuming that all Sampling rate and
channles are possible to use, but these are depends on inputed clock
and SSI connection situation.
For example, if it is using 1 SSI, enabled TDM mode and has 12288000
input clock, 2ch output can support until 192000Hz, but 6ch output can
support until 64000Hz, 8ch can support 48000Hz.
To control these situation correctly, it needs to support
hw_constraints / refine feature.

To support such feature, it needs SSI clock query feature, and it needs
ADG clock query feature. Current ADG has rsnd_adg_ssi_clk_try_start()
and it is doing similar things, but it try to setup ADG register in
same time. This is not needed.

This patch adds new rsnd_adg_clk_query() and separates query feature
and register setting feature in adg.c

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>


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

ASoC: rsnd: rename "slots" related variable

Current Renesas sound driver has slots and slots_num in
struct rsnd_dai, but these are very un-understandable naming
(It had named from TDM slots).
In this driver, the "slots" means total usable channels, and
"stot_num" means SSI lane number if Multi SSI was used.
To more understandable code, this patch renames "slots" to
"max_channels", and "slots_num" to "ssi_lane", and replaces related
functions name.

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>


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


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

ASoC: rsnd: cleanup pointer related code

Current rsnd driver is sharing pointer related code between
PIO / DMA. But, it is used only PIO mode now, no longer needed.
This patch cleanup these.

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


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

ASoC: rsnd: update pointer more accurate

Current rsnd driver updates pointer when DMA transfer was finished
in DMA transfer mode. But PulseAudio requests more accurate
pointer update when timer mode.
This patch consider about DMA transfer residue and update more
accurate pointer.

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


# d70c34db 05-Jun-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove unused rsnd_dai_path_info

commit 2ea2cc86db7c ("ASoC: rsnd: remove struct rcar_snd_info")
removed all struct rsnd_dai_path_info related code.
This patch removes unused rsnd_dai_path_info.

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


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

ASoC: rsnd: add HDMI output support

Renesas R-Car Gen3 can output HDMI sound if SSIU/SSI are connected to
R-Car built-in HDMI device (R-Car Gen3 built-in HDMI device will be
controlled by DRM/KMS driver).
If SSIx was connected to HDMI0/1 on DT, SSI driver will detect it
automatically by this patch.
Note is that now Renesas R-Car sound driver is assuming that it is
using OF-graph base simple card for HDMI sound.

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


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

ASoC: rsnd: add support graph base DT phase 1

To enable OF-graph base DT on rsnd driver, and to keep compatible
previous normal sound card style, it need to support both
"rcar_sound,dai" and "ports" (or "port") on DT.

This patch modify rsnd_dai_of_node() to parse
"rcar_sound,dai" and "ports" (or "port") as phase 1. It can detect
graph base style, but do nothing at this point.

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>


# 9ca5e57d 18-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_mod_make_sure() is not under DEBUG

rsnd_mod_make_sure() will be used any situation,
thus, under DEBUG is not realistic.
This patch move it to non DEBUG area

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


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

ASoC: rsnd: merge rsnd_kctrl_new_m/s/e into rsnd_kctrl_new()

Current rsnd driver is using rsnd_kctrl_new_m/s/e function,
but the differences are very few.
This patch merge these rsnd_kctrl_new_m/s/e into rsnd_kctrl_new

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>


# e0c42118 27-Mar-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rcar: remove rsnd_kctrl_remove()

Current rcar driver is trying to remove kctrl when remove time.
But, 1) rcar driver can't/shouldn't remove before removing sound
card driver, 2) sound card driver will call snd_ctl_dev_free()
and removes all kctrls by snd_ctl_remove().
Thus, rsnd_kctrl_remove() is not necessary. Current implementation
will get Oops when removing rcar driver after sound card.
This patch fix this issue.

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


# 90ffc1ec 19-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup for_each_rsnd_mod_array{s} iterator increment

commit 5f222a292 ("ASoC: rsnd: use for_each_rsnd_mod_xxx() ...")
modifies rsnd_dai_call() to use for_each_rsnd_mod_arrays().

Current rsnd is incrementing iterator in rsnd_mod_next(),
but the iterator will indicate +1 position in for_each loop in
this case. Incremental position should be inside for()

Reported-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 826e83de 19-Jan-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup for_each_rsnd_mod_array{s} iterator increment

commit 5f222a292 ("ASoC: rsnd: use for_each_rsnd_mod_xxx() ...")
modifies rsnd_dai_call() to use for_each_rsnd_mod_arrays().

Current rsnd is incrementing iterator in rsnd_mod_next(),
but the iterator will indicate +1 position in for_each loop in
this case. Incremental position should be inside for()

Reported-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c2d31718 06-Dec-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: enable/disable ADG when suspend/resume timing

Current rsnd driver enables ADG clock when .probe timing,
but it breaks sound after Suspend/Resume. These should be setups
every suspend/resume timing too.
This patch is tested on R-Car Gen3 Salvator-X board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rsnd: rsnd_get_dalign() needs to care SSIU, not SSI

SSIU was controlled by SSI before, but
commit c7f69ab53("ASoC: rsnd: use mod base common method on SSIU")
separated it into ssiu.c

But, it didn't care about rsnd_get_dalign() for judging SSI_BUSIF_DALIGN
register value which changes the stream data order.
This function will be called from cmd/src/ssiu now, but current code
still cares ssi, not ssiu.
This patch fix it up

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>


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

ASoC: rsnd: use BRGCKR instead of SSICKR

Current register name of "SSICKR" was came from R-Car Gen1
which is very old style. It is called as "BRGCKR" on R-Car Gen2/Gen3.
Let's rename it

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


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

ASoC: rsnd: clear SSI_SYS_STATUSx every time

Renesas sound SSIU has SSI_SYS_STATUS register whick will
be changed if over/under run was occurred.
Current rsnd driver is handling over/under run error on SSI/SRC,
but doesn't on SSIU.
HW guys can't guarantee correct behavior if it already had error bit
on status register when it start.
Thus, it should be cleared every start timing. This patch do it.

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


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

ASoC: rsnd: rsnd_reg cleanup for SSIU

R-Car Gen1 didn't have SSIU IP, and it was part of SRU.
In Gen2, SSIU was created and it has original register.
Let's cleanup rsnd_reg for SSIU, because this driver
doesn't support Gen1 SRU any more.

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


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

ASoC: rsnd: remove "Gen2 only" comment

Gen1 support had been removed. "Gen2 only" comment is
no longer needed.

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


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

ASoC: rsnd: add nolock_start/stop callback

Current Renesas Sound driver requests DMA channel when .probe timing,
and release it when .remove timing. And use DMA on .start/.stop
But, Audio DMAC power ON was handled when request timing (= .probe),
and power OFF was when release timing (= .remove).
This means Audio DMAC power is always ON during driver was enabled.
To fixup this issue, it should request/release DMA channel on each
playback/recorde timing.
But, DMA channel request/release function uses mutex lock inside.
This means it will breaks current spinlock's interrupt protect.
To solve this issue, DMA channel request/release function needs to
be called from non-spinlock area. This patch adds its callback.

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


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

ASoC: rsnd: remove rsnd_dma_detach()

DMA mod is now connected to stream via rsnd_dai_connect().
This means DMA mod can use .remove for its clearance.
rsnd_dma_detach() is no longer needed.

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>


# be78cea1 18-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_parse_of_node() and integrate rsnd_xxx_of_node

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


# b3ca3fbe 18-Oct-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_mod_next() for for_each_rsnd_mod_xxx()

Current rsnd driver is using too complex macro for for-loop of each mod.
In order to simplify this issue, this patch adds new rsnd_mod_next()
which is non-macro.

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


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

ASoC: rsnd: amend .probe/.remove call for DPCM

commit 1a5658c2131 ("ASoC: rsnd: count .probe/.remove for
rsnd_mod_call()") solved multi-resource-free issue, by putting
.probe/.remove under count control. But,it breaks sound mixing case
(if it was used under DPCM). In such case, it uses MIXn/DVCn/SSIn,
and these should be always probed.
This patch reverted above patch, and solved the same issue by
modifing _rsnd_kctrl_remove() function.

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


# 1a5658c2 27-Apr-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: count .probe/.remove for rsnd_mod_call()

Current rsnd_mod_call is counting its calling count to avoid unbalanced
function pair calling for error cases (ex init <-> quit).
SSI parent is now controlled as "mod" on current rsnd driver. Because of
this reason, SSI .remove function will be called twice if it was used as
SSI parent when user tried unbind. But probe/remove pair were not
counted. This patch counts probe/remove functions to avoid it.
Special thans Hiep

Reported-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
Signed-off-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>


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


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

ASoC: rsnd: add CTU basic support

This patch adds Renesas R-Car sound CTU (= Channel Transfer Unit)
very basic support, but not yet enough feature at this point.
Because CTU support needs more complex channel function for
each modules.
To avoid complex patch reviewing, this patch picked up very basic
part only.

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


# b3fc95ad 14-Feb-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_write() / rsnd_bset() uses regmap _force_ function

Some R-Car sound requests picky register access which needs *force*
register write.
Some status register needs to set 1 to clear status, but we might
read 1 from its register. In such case, current regmap does nothing
and driver will be forever loop
To reduce code complexity, this patch uses regmap _force_
function for all register access.

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


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

ASoC: rsnd: judge multi SSI in runtime

Current rsnd supports multi SSI (maximum 4 SSI for 8ch),
and, it should determine whether using each SSI or not in runtime.
Current judgement is vague, and had broken by
c308abe45e2("ASoC: rsnd: rsnd_ssi_is_multi_slave() macro uses
rsnd_ssi_multi_slaves()")
This patch makes clean it, and solve this issue.

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


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

ASoC: rsnd: rename RSND_DVC_CHANNELS to RSND_MAX_CHANNELS

The channels number is not only for DVC. Let's rename it.

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>


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

ASoC: rsnd: ctu: settings matches to datasheet

Current CTU settings was rough. This patch makes it match to datasheet.
But do nothing at this point.

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


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

ASoC: rsnd: ctu: add rsnd_mix_activation()

Based on datasheet

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>


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

ASoC: rsnd: always call probe/remove for MUX

CTU/MUX/DVC/SSIU/SSI/Audio-DMAC-periperi might be used under multipath.
So, probe()/remove() need to be called multiple times.
This patch allows it.

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


# b4c83b17 16-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add Multi channel support

This patch adds Multi channel support on Renesas R-Car sound.
This patch is tested on Salvator-X board, but it can't use
Multi channel, because supported format is different between
codec chip and R-Car.
Thus, it was tested on board which doesn't mount codec chip,
with oscilloscope.

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


# 89b66174 16-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro

Current rsnd driver is using complex macro to parse DAI connection.
This patch adds new rsnd_parse_connect_common() and replace current
macro to it.
This is prepare for multi channel support

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


# 750fd445 16-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()

TDM will use 6 or 8 slots on 1 SSI, and Multi channel will use
6 or 8 slots on few SSI (each SSI uses 2 slots).
Thus, this adds new slot control functions which can be prepare
for Multi channel support.

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


# c140284b 16-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming

rsnd_get_slot_rdai() returns total slots (it returns 6 if total 6
channels) , and rsnd_get_slot_extend() returns extended SSI width
(it returns 8 if total 6 channels). This will be used on SSI multi
channel support too (It will return 2 if total 6 channels with 3 SSI).
But, it is using confusable naming.
This patch changes rsnd_get_slot_rdai() -> rsnd_get_slot(),
rsnd_get_slot_extend() -> rsnd_get_slot_width()

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


# 5858a7d1 16-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove rsnd_get_slot_runtime()

Current Renesas sound driver is using rsnd_get_slot_runtime(), but
it is same as runtime->channels. This patch removes
rsnd_get_slot_runtime()

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


# cdf310ce 16-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: fixup SSIU control timing

SSIU should be controlled after SSI. This patch fix up it

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


# a504b1ee 07-Dec-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup data align position for capture

L/R channel data has been treated as inverted on R-Car sound 16bit mode,
Thus, 4689032b1("ASoC: rsnd: tidyup data align position") tidyuped data
align position. But it couldn't care about capture case. This patch
cares both playback/capture

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


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

ASoC: rsnd: add TDM Extend Mode support

Renesas R-Car can out TDM by
1) 6ch x 1 DAI as TDM Extend Mode
2) 2ch x 4 x 1 DAI as TDM split Mode
3) 2ch x 3 DAI or
2ch x 4 DAI as TDM Multichannel Mode

This patch adds 1) TDM Extend Mode. Because of HW design,
this 6ch data will be outputed via 8ch data width.

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


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

ASoC: rsnd: dvc enables non-stereo sound

Current DVC is assuming that the sound is always stereo.
This patch makes it more flexible

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


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

ASoC: rsnd: ssi enables non-stereo sound

Current SSI is assuming that the sound is always stereo. But, SSI needs
to calculate its frequency when master mode. Then This frequency depends
on each SSI's slots, and TDM mode (= TDM Extend Mode, TDM split Mode,
TDM Multichannel Mode).
This patch enables to use non-stereo sound.

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>


# c51eb1c6 18-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup void* cast for 64bit compiler

64bit compiler indicates this without this patch

linux/sound/soc/sh/rcar/core.c: In function 'rsnd_probe':
linux/sound/soc/sh/rcar/core.c:1002:16: warning: cast from pointer to\
integer of different size [-Wpointer-to-int-cast]

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>


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

ASoC: rsnd: remove struct rcar_snd_info

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 rcar_snd_info

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>


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

ASoC: rsnd: remove platform boot support from gen.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 gen.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>


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

ASoC: rsnd: cleanup RSND_REG_xxx

SRC Gen1 support was removed. Current rsnd driver is sharing Gen1/Gen2
register index to reduce memory, but there is no effect anymore.
Let's remove share definition and merge RSND_REG_xxx

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>


# 68a55024 05-Nov-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: call clk_prepare()/clk_enable() for AUDIO_CLKx

ADG can output AUDIO_CLKOUTx, and these are generated from
AUDIO_CLKx. Thus we need to call clk_prepare()/clk_enable()
for AUDIO_CLKx.

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


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

ASoC: rsnd: use mod base common method on SSI-parent

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 SSI parent mod base common method

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>


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

ASoC: rsnd: use mod base common method on CMD

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


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

ASoC: rsnd: rsnd_dai_stream has each mod's status insted of rsnd_mod

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 is controling each mod's status on mod. But it was not
good design for SSI, because stream might has SSI-parent.
In such case, it can't play/capture in same time, because SSI-parent
is used as normal SSI in other stream, but it shares same status.
To avoid this issue each mod's status is controlled by rsnd_dai_stream
instead of rsnd_mod.

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>


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

ASoC: rsnd: enable to use rsnd_dai_connect() from each mod

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.

DMAC/SSIU/SSI-parent/CMD will be implemented as module, but these are
not customer controlled module. These should be automatically install
to system. Because of this, rsnd_dai_connect() should be called from
each mod. SSI can be very special, because it will be installed as
SSI-parent / SSI-child. Thus, new rsnd_dai_connect() has type parameter
which should be mod->type except SSI-parent

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>


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

ASoC: rsnd: DMA related definition goes to dma.c

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. Current DMA definition is no longer
needed on rsnd.h. Let's move it to dma.c

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>


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


# dcc448e6 06-Oct-2015 Geert Uytterhoeven <geert+renesas@glider.be>

ASoC: rsnd: Remove obsolete platform data support

Since commit 3d7608e4c169af03 ("ARM: shmobile: bockw: remove legacy
board file and config"), Renesas R-Car SoCs are only supported in
generic DT-only ARM multi-platform builds. The driver doesn't need to
use platform data anymore, hence remove platform data configuration.

Move <sound/rcar_snd.h> to sound/soc/sh/rcar/, as it's no longer needed
by platform code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rsnd: add common mod confirm method

Renesas sound has SSI/SRC/DVC/MIX/ADG modules, and these have original
register mapping. Thus this driver is using regmap field, and each module
is using it based on each module ID.

Sometimes, each module needs other module to controlling. but current each
function is using just "mod" as parameter name. This is confusable.
For example, if SSI0 and SRC2 are connected, and if SRC module function
has bug of module access, and if it needs to control connected SSI,
SRC function will access to SSI2 (It should access to SSI0, but it uses
SRC's ID 2). This is easy to happen in current driver style.

To avoid this kind of confusable trouble, this patch adds module confirm
macro for debug purpose.

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>


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

ASoC: rsnd: tidyup rsnd_dma_to_xxx() position

rsnd_dma_to_xxx() macro should exist in same place

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


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

ASoC: rsnd: add MIX (Mixer) support

This patch adds MIX (Mixer) initial support for rsnd driver.
It is assuming that this MIX is used via DPCM.

This is sample code for playback.

CPU0 : [MEM] -> [SRC1] -> [CTU02] -+
|
+-> [MIX0] -> [DVC0] -> [SSI0]
|
CPU1 : [MEM] -> [SRC2] -> [CTU03] -+

sound {
compatible = "renesas,rsrc-card";

...

cpu@0 {
sound-dai = <&rcar_sound 0>;
};

cpu@1 {
sound-dai = <&rcar_sound 1>;
};

codec {
...
};
};

rcar_sound {

...

rcar_sound,dai {
dai0 {
playback = <&src1 &ctu02 &mix0 &dvc0 &ssi0>;
};
dai1 {
playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;
};
};
};

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>


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

ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support

This patch adds CTU (Channel Transfer Unit) support for rsnd driver.
But, it does nothing to data at this point, but is required for MIX
support.

CTU design is a little different from other IPs (CTU0 is including
CTU00 - CTU03, and CTU1 is including CTU10 - CTU13, these have different
register mapping) We need to care about it on this driver.

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>


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

ASoC: rsnd: tidyup SRC position on each code

This is cleanup for CTU/MIX support

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>


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

ASoC: rsnd: add rsnd_io_to_mod()

Sometimes we would like to get each module directly, especially data path
searching. this patch adds rsnd_io_to_mod() macro, and existing
rsnd_io_to_mod_xxx() use 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>


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

ASoC: rsnd: tidyup rsnd_dma_ops definition place

rsnd_dma_ops is used only from dma.c, rsnd.h doesn't need 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>


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


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

ASoC: rsnd: add rsnd_get_adinr_chan()

Current rsnd driver has rsnd_get_adinr_bit() to get bit settings for
ADINR (= Audio Information Register) of SSIU/SRC/DVC.
This patch adds rsnd_get_adinr_chan() to get channel settings for
ADINR (= Audio Information Register) of 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>


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


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

ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting

Current sound data route settings is done in dvc.c, and it doesn't care
about CTU/MIX at this poinnt, but we need to care about these.
OTOH, rsnd driver already has rsnd_path_xxx() functions for data path which
are good match for CTU/MIX/DVC path selectio.
This patch adds new rsnd_path_parse() to select sound data route which will
care about CTU/MIX/DVC path.

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>


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

ASoC: rsnd: move DVC specific macro into dvc.c

rsnd_dvc_nr() is used only from dvc.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>


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

ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL

enabling to use same method for exception case is useful.

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>


# 7b47ab47 16-Jun-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: gen: add rsnd_force_write()

rsnd_force_write() is similar to rsnd_write(),
but rsnd_force_write() write data to register even though
it is same value.

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


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

ASoC: rsnd: remove io from rsnd_mod

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many path
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. rsnd_mod_to_io() is no longer needed. 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>


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

ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_ssi_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_ssi_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>


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

ASoC: rsnd: add common interrupt handler for SSI/SRC/DMA

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. Then, interrupt handler can't use rsnd_mod_to_io().
This patch adds SSI/SRC/DMA common interrupt handler frame

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>


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

ASoC: rsnd: count each mod (SSI/SRC/DVC)

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. Then, we don't need to re-call each mod function
that had been called. This patch count each mod status.

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>


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

ASoC: rsnd: don't call snd_pcm_period_elapsed() under spin lock

'a9e1ac1a9e4585b5("ASoC: rsnd: spin lock for interrupt handler")'
added spin lock under interrupt handler to solve HW restart issue.

OTOH, current rsnd driver calls snd_pcm_period_elapsed() from
rsnd_dai_pointer_update(). but, it will be called under spin lock
if SSI was PIO mode.

If it was called under spin lock, it will call
snd_pcm_update_state() -> snd_pcm_drain_done().
Then, it calls rsnd_soc_dai_trigger() and will be dead-lock.
This patch doesn't call rsnd_dai_pointer_update() under spin lock

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>


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


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


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

ASoC: rsnd: add dai_link stream name

This patch adds missing dai_link stream_name
which is used when DPCM

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>


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

ASoC: rsnd: enable rsnd_ssi_use_busif() for DMA

Renesas R-Car sound driver uses SSI, but the DMA interfaces are
SSI/SSIU. This interface is based on SSI/SRC/DVC connection.
And DMA function needs to know which interface is used somehow.
This patch enables rsnd_ssi_use_busif() for DMA.

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


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

ASoC: rsnd: use union with rsnd_dmaen / rsnd_dmapp

Renesas R-Car needs 2 DMACs.1st DMAC is DMAEngine, and 2nd DMAC is
implemented as local code. These 2 DMACs are never shared.
We can use union for these.

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


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

ASoC: rsnd: remove rsnd_dma::dir

DMAEngine direction can be calculated from rsnd_dai_stream,
So, rsnd_dma::dir does not make sense now.
Let's remove it.

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


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

ASoC: rsnd: remove rsnd_dma::addr

DMAEngine for Renesas R-Car driver is used only for Audio DMAC now.
rsnd_dma::addr was added to support Audio DMAC peri peri,
but it 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>


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

ASoC: rsnd: add Audio DMAC peri peri support rework

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.
Audio DMAC peri peri is controlled from sound driver without DMAEngine
by this patch.

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


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

ASoC: rsnd: enable to care 1st / 2nd DMAC on rsnd_dma_xxx()

rsnd driver needs to care about Audio DAMC (via DMAEngine),
Audio DMAC peri peri (via local method) on rsnd driver.
This patch adds new rsnd_dma_ops and care it.

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


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

ASoC: rsnd: move rsnd_gen_dma_addr() from gen.c to dma.c

Now, we have dma.c for Audio DMAC / Audio DMAC peri peri.
rsnd_gen_dma_addr() should go there.

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


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

ASoC: rsnd: add rsnd_gen_get_phy_addr() to get physical address

physical address is required from Audio DMAC peri peri.

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


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

ASoC: rsnd: tidyup rsnd_dma_to_mod() macro declaration position

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>


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

ASoC: rsnd: remove SH-DMA-BASE specific implementation

Renesas R-Car sound had SH-DMA-BASE specific implementation before,
but, now, it 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>


# d1f83d6e 01-Feb-2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: call missing snd_ctl_remove()

Current Renesas R-Car sound driver is using snd_ctl_xxx()
functions, but it didn't call snd_ctl free_one() / snd_ctl_remove().
This patch call these functions.

Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
Reported-by: Bui Duc Phuc <bd-phuc@jinso.co.jp>
Reported-by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rsnd: tidyup DVC/SRC/SSI order

Current R-Car sound driver calls SRC -> SSI -> DVC functions,
but, it should be DVC -> SRC -> SSI.
Otherwise, SSI (= interface of codec) will have underrun error
when playback.

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>


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

ASoC: rsnd: add rsnd_io_to_rdai()

Current rsnd driver request rdai in everywhere, but each mod should
reach to rdai by itself. this patch adds missing rsnd_io_to_rdai().

io = rsnd_mod_to_io(mod);
rdai = rsnd_io_to_rdai(io);

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


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

ASoC: rsnd: remove rsnd_dai_get_platform_info() macro

rsnd_dai_get_platform_info() 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>


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

ASoC: rsnd: remove unused rsnd_dai_id()

rsnd_dai_id() was not used. Let's remove it

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>


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

ASoC: rsnd: rename rsnd_dai_get() to rsnd_rdai_get()

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_get() to rsnd_rdai_get()

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>


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

ASoC: rsnd: tidyup rsnd_io_to_xxx() macro declaration position

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>


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

ASoC: rsnd: tidyup rsnd_io_to_runtime() macro

Avoid NULL pointer access

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


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

ASoC: rsnd: move snd_kcontrol_new fucntions to core.c

Current DVC is using snd_kcontrol_new functions, but, SRC will need
same method. Move common functions to core.c

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>


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

ASoC: rsnd: tidyup PIO/DMA mode settings method

Current ssi.c has .cr_etc which is used for SSICR's
etc settings. but, it is used as PIO/DMA switching purpose now.
This patch tidyup this method. This is prepare for
under/over run issue handling

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>


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

ASoC: rsnd: add callback status check method

R-Car sound can use SSI/SRC/DVC modules, and these are controlled as
rsnd_mod in rsnd driver. These rsnd_mod has each own function as
callback. Basically these callback function has pair like probe/remove,
start/stop, etc. And, these functions are called by order to each stage
like below.
1. src->probe
2. ssi->probe
3. dvc->probe
4. src->start
5. ssi->start
6. dvc->start
7. src->stop
8. ssi->stop
9. dvc->stop
10. src->remove
11. ssi->remove
12. dvc->remove

But, current rsnd driver doesn't care about its status which indicates
which function is called.
For example, if 5) returns error, 6) is not called. In such case,
9) should not be called. This patch care about each modules status.

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


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

ASoC: rsnd: add .fallback callback

Current R-Car sound has PIO fallback support if it couldn't use DMA.
This fallback is done in .remove callback, but, it should have
.fallback callback. Otherwise, normal .remove callback will have
strange behavior. This patch adds .fallback callback.

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


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

ASoC: rsnd: Add Volume Ramp support

This patch adds Volume Ramp to Renesas sound driver.

amixer set "DVC Out" 100%
amixer set "DVC Out Ramp Up Rate" "0.125 dB/64 steps"
amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
amixer set "DVC Out Ramp" on
aplay xxx.wav &
amixer set "DVC Out" 80% // Volume Down
amixer set "DVC Out" 100% // Volume Up

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>


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

ASoC: rsnd: DMA start address is properly used for each DMAC

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

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


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

ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

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


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

ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

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>


# cd7bcc60 19-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rcar: Fix dma direction type

dmaengine_prep_slave_single() expects a enum dma_transfer_direction and not a
enum dma_data_direction. Since the integer representations of both DMA_TO_DEVICE
and DMA_MEM_TO_DEV aswell as DMA_FROM_DEVICE and DMA_DEV_TO_MEM have the same
value the code worked fine even though it was using the wrong type.

Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49: int enum dma_data_direction versus
sound/soc/sh/rcar/core.c:227:49: int enum dma_transfer_direction

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


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

ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr

The DMAC src/dst addr needs to be set from driver when DT case.
(It was set from SoC/DMAEngine code when non-DT case)
This patch adds rsnd_gen_dma_addr() to set DMAC src/dst addr.

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


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

ASoC: rsnd: save platform_device instead of device

DT DMA support needs struct platform_device pointer,
and it can get struct device pointer from platform_device.
Save platform_device instead of device.

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>


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


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

ASoC: rsnd: remove all rsnd_xxx_remove()

Now, rsnd_xxx_remove() do nothing.
remove these

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


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

ASoC: rsnd: add probe/remove callback on rsnd_mod_ops

Each rsnd mod needs specific probe method,
and its best timing is DAI probe timing.
But current code runs it mod probe timing.
This patch adds new probe/remove callback to solve it.

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


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

ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI

Current R-Car sound driver is assuming that
SCU mod is used even though it is not needed.
Because scu.c is controlling SSIU too.
(it is Gen1 compatibility)
But, SCU mod will be really not used if new platform dai
feature was added.
Thus, rsnd_scu_ssi_mode_init() is called from SSI
directory by this patch.

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


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

ASoC: rsnd: add rsnd_scu_enable_ssi_irq()

Current R-Car sound driver is assuming that
SCU mod is used even though it is not needed.
Because scu.c is controlling SSIU too.
(it is Gen1 compatibility)
But, SCU mod will be really not used if new platform dai
feature was used.
Thus, SSIU irq setting is called from SSI
directory by this patch.

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


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

ASoC: rsnd: Get correct SCU ID

Current rsnd driver is assuming that SCU/SRU ID is
same as SSIU/SSI ID, because Gen1 can't select it.
But, Gen2 can select it.
The SCU/SRU/SSIU/SSI pair depends on the platform.
This patch get correct SCU ID from platform info.
To keep compatible, it still assuming SCU ID = SSI ID
if platform doesn't have info

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


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

ASoC: rsnd: share reg_field and reduce memory

Gen1/Gen2 code never be used in same time.
Thus, driver can share Gen1 only register and Gen2 only register.
It can reduce memory too.

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


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

ASoC: rsnd: remove unused SSI_CONTROL

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


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

ASoC: rsnd: get ssi/scu from rsnd_dai_stream

Current driver is assuming that SSI id = SCU id.
But, now, it can get correct SSI/SCU from
rsnd_dai_stream. use it.

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


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

ASoC: rsnd: use mod array instead of list on rdai

struct rsnd_dai_stream used list for mod list.
It added only odd flexibility to current driver, and
it is a factor which makes extendibility difficult.
rsnd use mod array instead of list from now.

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


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

ASoC: rsnd: run rsnd_path_init() when probe() timing

Current rsnd SSIU/SSI/SCU/SRU path is set
when playback/capture starts up.
But it is meaningless method, since the path is based
on platform and can be set in probe() timing.
This patch sets the path on probe() timing.

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


# ecba9e72 24-Feb-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: unify rdai naming

struct rsnd_dai is called as "rdai",
but its size has been called as "dai_nr".
Unify these as "rdai"

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


# 5da39cf3 24-Feb-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove verbose function parameter

priv has rcar_snd_info pointer.
having priv and info in same time is verbose.

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


# d870a91e 24-Feb-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: move rsnd_mod_call() macro

core.c is the only user of rsnd_mod_call() macro.
Move it to core.c from rsnd.h

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


# ee2c828d 11-Feb-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: set DIV_EN register on rsnd_adg_set_convert_clk_gen2()

DIV_EN register enable bit is required when you use Gen2 SRC

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


# 00463c11 11-Feb-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup original for_each_rsnd_xxx macro

Current for_each_rsnd_xxx macro will read out-of-array's
memory after last loop operation.
It was not good C language operation, and the binary which was
compiled by (at least) gcc 4.8.1 is broken
This patch tidyup these issues

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


# 629509c5 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add Gen2 SRC and DMAEngine support

Renesas sound Gen2 has SRC (= Sampling Rate Converter)
which needs 2 DMAC.
The data path image when you use SRC on Gen2 is

[mem] -> Audio-DMAC -> SRC -> Audio-DMAC-peri-peri -> SSIU -> SSI

This patch support SRC and DMAEnine.
It is tested on R-Car H2 Lager board

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


# 4686a0ad 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove SSI dependent DMAEngine callback

Renesas Gen2 sound will use 2 DMAC
which are Audio-DMAC, and Audio-DMAC-peri-peri.
Current driver has callback function for each DMAC,
because it assumed each DMAC needs special settings.
But it became clear that these can share settings.
This patch removes unnecessary callback

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


# 1b7b08ef 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: extracts Gen1/Gen2 common parts

Renesas sound IP Gen1/Gen2 are similar, but different.
This patch extracts Gen1/Gen2 common and dependency parts,
and create Gen1/Gen2 ops to control it.

According to this structure, SSIU setup which
has been implemented on ssi.c can be moved to scu.c
(SRU/SSIU/SCU should be implemented on scu.c)

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


# 32f27ebf 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add rsnd_ssi_is_play()

SCU needs SSI direction if Gen2.
Add rsnd_ssi_is_play() function for it.

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


# 28dc4b63 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: merge SRC clock timing/setting

SRC clock and timing setting register
exist in SRU and ADG on Gen1.
But, these are merged into ADG on Gen2.
Current driver is supporting Gen1 SRC only
at this point, but, above settings are
set as different function.
This patch merges these as preparation of Gen2 support.

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


# 96c7c0d6 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_scu_hpbif_is_enable() become macro

rsnd_scu_hpbif_is_enable() is used only scu.c now.
It can be local macro

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


# 9b5ab573 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove duplicate *priv from rsnd_dma

*priv pointer exists under rsnd_mod,
and, it can get rsnd_mod pointer from rsnd_dma.
remove duplicate rsnd_dma :: priv

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


# dd27d808 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove ssiu from ssi.c

Now, SSI_MODE0/1 are controlled under scu.c
ssiu is no longer needed on ssi.c

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


# 7b5ce975 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SSI_MODE0/1 settings goes to scu.c

SRU (Gen1) / SCU (Gen2) / SSIU (Gen2) are controlled under scu.c.
(SCU + SSIU (Gen2) was SRU (Gen1))
And register of SSI_MODE0/1 are mapped on these IP.
But these have been implemented under ssi.c on this driver.
The naming is very confusable,
but it should be implemented under scu.c

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


# e779a20d 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: rsnd_dai_is_clk_master() can be shared

Current rsnd driver is using ssi local
rsnd_rdai_is_clk_master() for checking clock master.
But it can be rsnd_dai_is_clk_master(), and share in each file

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


# 92d9587e 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: cleanup debug information method

rsnd_mod debug information is implemented
in each callback functions now.
But, it can be implemented in rsnd_mod_call(),
and share this code.
This patch adds it

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


# 0290d2a4 23-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup register naming of BUSIF_MODE

Gen1:SRU has only 1 BUSIF_MODE,
but Gen2:SSIU/SCU has SRCm_BUSIF_MODE, and SSIn_BUSIF_MODE.
This patch rename current BUSIF_MODE to SRC_BUSIF_MODE.

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


# ef749400 19-Dec-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add SRC (Sampling Rate Converter) support

This patch adds SRC support to Renesas sound driver.
SRC converts sampling rate between codec <-> cpu.
It needs special codec chip,
or very simple DA/AD converter to use it.
This patch was tested via ak4554 codec,
and supports Gen1 only at this point.

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


# 52ea2a79 19-Dec-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: INT_ENABLE is needed only Gen2

INT_ENABLE is needed only Gen2.
rsnd_mod_write() do nothing on Gen1, but it is confusable.

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


# 2582718c 19-Dec-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: route setting is needed only Gen1

Renesas sound has SRC (= Sampling Rate Converter),
but, the HW implementation depends on its generation.
It was part of SRU on Gen1, and SCU on Gen2.
This SCU needs DMA transfer to use it.
Current rsnd driver is using it as DMA transfer buffer
(= no rate convert), and Gen1 is only supported at this point.

This patch cleanup it with focusing about SRC and Gen2 part.

rsnd_scu_set_route() is needed only Gen1.

This patch renames it to rsnd_scu_set_route_if_gen1()
and it adds comment to rsnd_reg member
in order to clarify it is used for Gen1.

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


# 690ef81e 19-Dec-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: tidyup register naming

Use correct register name which appears in the datasheet

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


# 507d466c 28-Nov-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rcar: add Gen2 sound support

This patch adds Gen2 sound support for Renesas R-Car.
But, it is supporting PIO transfer only at this point

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


# 17b9a2b7 28-Nov-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rcar: remove unused register settings

AUDIO_CLK_SEL4/5 are not used

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


# a3737731 07-Nov-2013 Dan Carpenter <dan.carpenter@oracle.com>

ASoC: rcar: some dubious one-bit signed bitfields

Because these are signed they can either be 0 or -1 instead of 0 and 1
as intended. It doesn't cause a problem from what I can see, but it's
dangerous and Sparse complains:

sound/soc/sh/rcar/rsnd.h:177:25:
error: dubious one-bit signed bitfield

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# cdcfcac9 17-Oct-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rcar: add rsnd_scu_hpbif_is_enable()

Current SSI needs RSND_SSI_DEPENDENT flag to
decide dependent/independent mode.
And SCU needs RSND_SCU_USE_HPBIF flag
to decide HPBIF is enable/disable.
But these 2 means same things.

This patch adds new rsnd_scu_hpbif_is_enable()
function, and merges above methods.

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


# c5d5a58d 11-Oct-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rcar: fixup generation checker

Current rcar is using rsnd_is_gen1/gen2() to checking its
IP generation, but it needs data mask.
This patch fixes it up.

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


# efeb970e 24-Sep-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove rsnd_priv_read/write/bset()

adg.c only used rsnd_priv_read/write/bset()
which is the only user of NULL mod.
but, it can be removed.

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


# 374a5281 28-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: SSI supports DMA transfer via BUSIF

This patch adds BUSIF support for R-Car sound DMAEngine transfer.
The sound data will be transferred via FIFO which can cover blank time
which will happen when DMA channel is switching.

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


# 0a4d94c0 28-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: add common DMAEngine method

R-Car Sound driver will support DMA transfer in the future,
then, SSI/SRU/SRC will use it.
Current R-Car can't use soc-dmaengine-pcm.c since its DMAEngine
doesn't support dmaengine_prep_dma_cyclic(),
and SSI needs double plane transfer (which needs special submit) on DMAC.
This patch adds common DMAEngine method for it

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


# 4b4dab82 28-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rsnd: remove platform dai and add dai_id on platform setting

Current rsnd driver is using struct rsnd_dai_platform_info
so that indicate sound DAI information (playback/capture SSI ID).
But, SSI settings were also required separately.
Thus, platform settings was very un-understandable.
This patch adds dai_id to SSI
settings, and removed rsnd_dai_platform_info.

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


# ae5c3223 21-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Renesas R-Car SSI feature

Renesas R-Car series sound circuit consists of SSI and its peripheral.
But this peripheral circuit is different between
R-Car Generation1 (E1/M1/H1) and Generation2 (E2/M2/H2)
(Actually, there are many difference in Generation1 chips)

As 1st protype, this patch adds SSI feature on this driver.
But, it is PIO sound playback support only at this point.
The DMA transfer, and capture feature will be supported in the future

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


# dfc9403b 21-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Renesas R-Car ADG feature

Renesas R-Car series sound circuit consists of SSI and its peripheral.
But this peripheral circuit is different between
R-Car Generation1 (E1/M1/H1) and Generation2 (E2/M2/H2)
(Actually, there are many difference in Generation1 chips)

This patch adds ADG feature which controls sound clock

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


# 07539c1d 21-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Renesas R-Car SCU feature

Renesas R-Car series sound circuit consists of SSI and its peripheral.
But this peripheral circuit is different between
R-Car Generation1 (E1/M1/H1) and Generation2 (E2/M2/H2)
(Actually, there are many difference in Generation1 chips)

This patch adds SCU feature on this driver.
But, it defines SCU style only, does nothing at this point.

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


# 3337744a 21-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Renesas R-Car Generation feature

Renesas R-Car series sound circuit consists of SSI and its peripheral.
But this peripheral circuit is different between
R-Car Generation1 (E1/M1/H1) and Generation2 (E2/M2/H2)
(Actually, there are many difference in Generation1 chips)

The main difference between Gen1 and Gen2 are
1) register offset, 2) data path

In order to control Gen1/Gen2 by same method,
this patch adds gen.c.

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


# cdaa3cdf 21-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Renesas R-Car module feature

Renesas R-Car series sound circuit consists of SSI and its peripheral.
But this peripheral circuit is different between
R-Car Generation1 (E1/M1/H1) and Generation2 (E2/M2/H2)
(Actually, there are many difference in Generation1 chips)

Gen1 series consists of SRU/SSI/ADG, and
Gen2 series consists of SCU/SSIU/SSI/ADG.

In order to control these by same method,
these are treated as "mod" on this driver.

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


# 1536a968 21-Jul-2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: add Renesas R-Car core feature

Renesas R-Car series sound circuit consists of SSI and its peripheral.
But this peripheral circuits are different between
R-Car Generation1 (E1/M1/H1) and Generation2 (E2/M2/H2).
(Actually, there are many difference in Generation1 chips)

Basically, for the future, Renesas R-Car series will use
Gen2 style sound circuit, but driver should care Gen1 also.
The main differences between Gen1 and Gen2 peripheral
are 1) register offset, 2) data path.

This patch adds basic (core) feature for R-Car
series sound driver as prototype

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