GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agoASoC: rsnd: fixup forever loop bug on SSI
Kuninori Morimoto [Thu, 18 Feb 2016 08:16:04 +0000 (08:16 +0000)]
ASoC: rsnd: fixup forever loop bug on SSI

commit b5b442abd9 ("ASoC: rsnd: add .irq callback")
added .irq support, and it cares both parent SSI and normal SSI.
But it should care only normal SSI. Otherwise SSI might be
forever loop if SSI is used as both parent SSI and normal SSI
(= 2 users), and if under/over run error happen. Because irq disable
do nothing in such case. This patch solve this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: SSI function parameter uses "mod" instead of "ssi"
Kuninori Morimoto [Thu, 18 Feb 2016 08:14:37 +0000 (08:14 +0000)]
ASoC: rsnd: SSI function parameter uses "mod" instead of "ssi"

To reduce confusion, SSI uses "mod" instead of "ssi"
as function parameter

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: indicates status failed SSI
Kuninori Morimoto [Thu, 18 Feb 2016 08:14:09 +0000 (08:14 +0000)]
ASoC: rsnd: indicates status failed SSI

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: setup SRC_ROUTE_MODE0 before SRC_SRCIR
Kuninori Morimoto [Thu, 18 Feb 2016 08:13:45 +0000 (08:13 +0000)]
ASoC: rsnd: setup SRC_ROUTE_MODE0 before SRC_SRCIR

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: rename RSND_DVC_CHANNELS to RSND_MAX_CHANNELS
Kuninori Morimoto [Thu, 18 Feb 2016 08:13:13 +0000 (08:13 +0000)]
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>
8 years agoASoC: rsnd: rsnd_ssi_is_multi_slave() macro uses rsnd_ssi_multi_slaves()
Kuninori Morimoto [Tue, 9 Feb 2016 07:04:09 +0000 (07:04 +0000)]
ASoC: rsnd: rsnd_ssi_is_multi_slave() macro uses rsnd_ssi_multi_slaves()

b4c83b171 ("ASoC: rsnd: add Multi channel support") added
Multi channel support, and current rsnd_ssi_is_multi_slave()'s check
method is !SSI equals SSIM1/2/3. But, SSI parent also hit to this macro.
Because of this reason, some stream which needs SSI parent clock
can't work correctly. This patch uses rsnd_ssi_multi_slaves() to
solve this issue. This issue was reported by Dung.

Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: add .irq callback
Kuninori Morimoto [Tue, 26 Jan 2016 04:56:57 +0000 (04:56 +0000)]
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>
8 years agoASoC: rsnd: don't auto-recover when under/over run error
Kuninori Morimoto [Tue, 26 Jan 2016 04:56:14 +0000 (04:56 +0000)]
ASoC: rsnd: don't auto-recover when under/over run error

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: disable SRC.out/in in same time
Kuninori Morimoto [Thu, 21 Jan 2016 02:00:13 +0000 (02:00 +0000)]
ASoC: rsnd: disable SRC.out/in in same time

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: tidyup Playback/Capture sequence
Kuninori Morimoto [Thu, 21 Jan 2016 01:59:55 +0000 (01:59 +0000)]
ASoC: rsnd: tidyup Playback/Capture sequence

Based on datasheet sequence

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: ctu: settings matches to datasheet
Kuninori Morimoto [Thu, 21 Jan 2016 01:59:33 +0000 (01:59 +0000)]
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>
8 years agoASoC: rsnd: ctu: add rsnd_ctu_halt()
Kuninori Morimoto [Thu, 21 Jan 2016 01:59:12 +0000 (01:59 +0000)]
ASoC: rsnd: ctu: add rsnd_ctu_halt()

Based on datasheet process

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: ctu: add rsnd_mix_activation()
Kuninori Morimoto [Thu, 21 Jan 2016 01:58:53 +0000 (01:58 +0000)]
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>
8 years agoASoC: rsnd: attach Audio-DMAC-periperi correctly
Kuninori Morimoto [Thu, 21 Jan 2016 01:58:33 +0000 (01:58 +0000)]
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>
8 years agoASoC: rsnd: each mod has status again for CTU/MUX support
Kuninori Morimoto [Thu, 21 Jan 2016 01:58:07 +0000 (01:58 +0000)]
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>
8 years agoASoC: rsnd: select each SRC correctly for CMD data path
Kuninori Morimoto [Thu, 21 Jan 2016 01:57:37 +0000 (01:57 +0000)]
ASoC: rsnd: select each SRC correctly for CMD data path

To select CMD data patch, it should use correct SRC from each stream
in MUX case. But current code is selecting SRC from fixed stream.
This patch solves this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: don't overwrite io on rsnd_cmd_init()
Kuninori Morimoto [Thu, 21 Jan 2016 01:57:17 +0000 (01:57 +0000)]
ASoC: rsnd: don't overwrite io on rsnd_cmd_init()

Current rsnd_cmd_init() overwrites "io" which will be used end of this
function. This patch solved this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: always call probe/remove for MUX
Kuninori Morimoto [Thu, 21 Jan 2016 01:56:59 +0000 (01:56 +0000)]
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>
8 years agoASoC: rsnd: try to connect connected mod is not error
Kuninori Morimoto [Thu, 21 Jan 2016 01:56:36 +0000 (01:56 +0000)]
ASoC: rsnd: try to connect connected mod is not error

If system uses CTU/MUX, CTU/MUX/DVC will try to connect same CMD to
system, but it is not error in this case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: don't update status if rsnd_mod_call() doesn't match
Kuninori Morimoto [Thu, 21 Jan 2016 01:56:18 +0000 (01:56 +0000)]
ASoC: rsnd: don't update status if rsnd_mod_call() doesn't match

If system uses CTU/MUX, and if probe error happened, it will try to
call rsnd_dai_call(remove, ...). Then, MUX/DVC/SSIU/SSI might be called
without calling rsnd_dai_call(probe, ...). Then, each mod status might
be un-matched. It doesn't call un-matched remove function by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: add debug message for rsnd_mod_call()
Kuninori Morimoto [Thu, 21 Jan 2016 01:55:57 +0000 (01:55 +0000)]
ASoC: rsnd: add debug message for rsnd_mod_call()

rsnd_mod_call() tries to call each IP's relevant function. But it is
difficult to understand which function returned error.
This patch adds debug message for this purpose

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: use rsnd_mod_init() for ADG
Kuninori Morimoto [Thu, 21 Jan 2016 01:55:39 +0000 (01:55 +0000)]
ASoC: rsnd: use rsnd_mod_init() for ADG

Current ADG doesn't use rsnd_mod_init(), but this limitation is no
longer necessary. Let's use common rsnd_mod_init()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: remove unsed *parent
Kuninori Morimoto [Thu, 21 Jan 2016 01:55:16 +0000 (01:55 +0000)]
ASoC: rsnd: remove unsed *parent

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
8 years agoASoC: rsnd: precedence error in rsnd_ssiu_init()
Dan Carpenter [Wed, 6 Jan 2016 09:38:41 +0000 (12:38 +0300)]
ASoC: rsnd: precedence error in rsnd_ssiu_init()

The bitwise OR has higher precedence than ?: so the val2 was always set
to 0x2.

Fixes: b4c83b171557 ('ASoC: rsnd: add Multi channel support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: fix usrcnt decrementing bug
Andrzej Hajda [Thu, 24 Dec 2015 07:02:39 +0000 (08:02 +0100)]
ASoC: rsnd: fix usrcnt decrementing bug

Field usrcnt is unsigned so it cannot be lesser than zero.
The patch fixes the check, moves it to the beginning of the function
and changes return value to -EIO in case of usercnt error.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: add Multi channel support
Kuninori Morimoto [Thu, 17 Dec 2015 03:00:10 +0000 (03:00 +0000)]
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>
9 years agoASoC: rsnd: add missing DT example for Simple Card with TDM
Kuninori Morimoto [Thu, 17 Dec 2015 02:59:31 +0000 (02:59 +0000)]
ASoC: rsnd: add missing DT example for Simple Card with TDM

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: add missing DT example for Simple Card
Kuninori Morimoto [Thu, 17 Dec 2015 02:59:09 +0000 (02:59 +0000)]
ASoC: rsnd: add missing DT example for Simple Card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro
Kuninori Morimoto [Thu, 17 Dec 2015 02:58:14 +0000 (02:58 +0000)]
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>
9 years agoASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()
Kuninori Morimoto [Thu, 17 Dec 2015 02:57:47 +0000 (02:57 +0000)]
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>
9 years agoASoC: rsnd: tidyup rsnd_get_slot_xxx() naming
Kuninori Morimoto [Thu, 17 Dec 2015 02:57:27 +0000 (02:57 +0000)]
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>
9 years agoASoC: rsnd: remove rsnd_get_slot_runtime()
Kuninori Morimoto [Thu, 17 Dec 2015 02:57:07 +0000 (02:57 +0000)]
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>
9 years agoASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM
Kuninori Morimoto [Thu, 17 Dec 2015 02:56:50 +0000 (02:56 +0000)]
ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM

Current SSI/SSIU are using rsnd_get_slot_runtime() to check TDM,
but using rsnd_get_slot_extend() is more sane.
This patch fix it up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod
Kuninori Morimoto [Thu, 17 Dec 2015 02:56:31 +0000 (02:56 +0000)]
ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: tidyup debug print position on rsnd_dma_attach()
Kuninori Morimoto [Thu, 17 Dec 2015 02:56:11 +0000 (02:56 +0000)]
ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()

It can't output corrent dma name *before* rsnd_mod_init().
It goes to *after* rsnd_mod_init() by this patch

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()
Kuninori Morimoto [Thu, 17 Dec 2015 02:55:51 +0000 (02:55 +0000)]
ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()

Renesas sound driver has rsnd_get_adinr_bit/chan() functions.
It is assuming _bit() returns ADINR :: OTBL,
and _chan() returns ADINR :: CHNUM.
Current _bit() returns both OTBL and CHNUM. This patch fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: fixup SSIU control timing
Kuninori Morimoto [Thu, 17 Dec 2015 02:55:25 +0000 (02:55 +0000)]
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>
9 years agoASoC: rsrc-card: tidyup dai format for DPCM
Kuninori Morimoto [Thu, 17 Dec 2015 02:49:43 +0000 (02:49 +0000)]
ASoC: rsrc-card: tidyup dai format for DPCM

rsrc-card is DPCM supported version of simple-card. Thus it has similar
DT format. OTOH, snd_soc_dai_link requests cpu/codec, but one of them
will be snd-soc-dummy in DPCM case, and DPCM requests frontend/backend
dai_link. This means it might have multi backend/codec.
And, SND_SOC_DAIFMT_xxx is based on "codec". Because of these
difference, current rsrc card can't detect correct dai_fmt.
This patch detect correct dai fmt from 1st "codec".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsrc-card: Remove support for setting differing DAI formats
Kuninori Morimoto [Thu, 17 Dec 2015 02:48:58 +0000 (02:48 +0000)]
ASoC: rsrc-card: Remove support for setting differing DAI formats

1efb53a220 ("ASoC: simple-card: Remove support for setting differing
DAI formats") removed set_fmt support from simple-card.
rsrc-card follows same style, because it is based on simple-card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsrc-card: enable to use tdm_slot on DT
Kuninori Morimoto [Thu, 17 Dec 2015 02:48:23 +0000 (02:48 +0000)]
ASoC: rsrc-card: enable to use tdm_slot on DT

Renesas sound driver will use tdm slot on TDM Multi Mode support.
This patch enables tdm slot on rsrc card driver on DT.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agorcar: mux: Avoid use of ret uninitialised
Mark Brown [Mon, 14 Dec 2015 12:05:28 +0000 (12:05 +0000)]
rcar: mux: Avoid use of ret uninitialised

We use ret as the return value from the rsnd_mix_probe() but if there
are no child nodes and no errors then we will never initialize ret leading
to build warnings. Ensure ret is initialized before we iterate over the
child nodes to avoid this.

Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agorcar: dvc: Avoid use of ret uninitialised
Mark Brown [Mon, 14 Dec 2015 12:05:17 +0000 (12:05 +0000)]
rcar: dvc: Avoid use of ret uninitialised

We use ret as the return value from the rsnd_dvc_probe() but if there
are no child nodes and no errors then we will never initialize ret leading
to build warnings. Ensure ret is initialized before we iterate over the
child nodes to avoid this.

Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agorcar: ctu: Avoid use of ret uninitialised
Mark Brown [Mon, 14 Dec 2015 12:04:54 +0000 (12:04 +0000)]
rcar: ctu: Avoid use of ret uninitialised

We use ret as the return value from the rsnd_ctu_probe() but if there
are no child nodes and no errors then we will never initialize ret leading
to build warnings. Ensure ret is initialized before we iterate over the
child nodes to avoid this.

Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: tidyup data align position for capture
Kuninori Morimoto [Tue, 8 Dec 2015 05:38:23 +0000 (05:38 +0000)]
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>
9 years agoASoC: rsnd: care SWSP bit for TDM/non-TDM
Kuninori Morimoto [Wed, 2 Dec 2015 07:34:28 +0000 (07:34 +0000)]
ASoC: rsnd: care SWSP bit for TDM/non-TDM

SSICR::SWSP bit controls WS signal low/high, but in case of TDM
it is inverted. This patch solves this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: rsrc-card: check return value of snd_soc_of_get_dai_name()
Kuninori Morimoto [Tue, 1 Dec 2015 08:33:23 +0000 (08:33 +0000)]
ASoC: rsnd: rsrc-card: check return value of snd_soc_of_get_dai_name()

This patch adds missing check of snd_soc_of_get_dai_name().
It might not be able to use sound card, because it might returns
-EPROBE_DEFER.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: fixup wrong snd_soc_dai_driver pointer access
Kuninori Morimoto [Tue, 1 Dec 2015 08:31:38 +0000 (08:31 +0000)]
ASoC: rsnd: fixup wrong snd_soc_dai_driver pointer access

drv pointer should be "base + offset" instead of
"current + offset". This patch fixup this issue, otherwise
third and subsequent pointer will be broken

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: add TDM Extend Mode support
Kuninori Morimoto [Mon, 30 Nov 2015 08:54:03 +0000 (08:54 +0000)]
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>
9 years agoASoC: rsnd: dvc enables non-stereo sound
Kuninori Morimoto [Mon, 30 Nov 2015 08:53:44 +0000 (08:53 +0000)]
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>
9 years agoASoC: rsnd: ssi enables non-stereo sound
Kuninori Morimoto [Mon, 30 Nov 2015 08:53:27 +0000 (08:53 +0000)]
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>
9 years agoASoC: rsnd: set SSIWSR setting on rsnd_ssi_config_init()
Kuninori Morimoto [Mon, 30 Nov 2015 08:53:04 +0000 (08:53 +0000)]
ASoC: rsnd: set SSIWSR setting on rsnd_ssi_config_init()

It will have TDM settings on SSIWSR. Actually, we would like to set
it on rsnd_ssi_config_init(), but we can't. Because SSI might be used
as clock master (It doesn't need to call rsnd_ssi_config_init() when
clock master mode).
This patch adds new ssi->wsr and set it on rsnd_ssi_start().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: add rsnd_ssi_config_init()
Kuninori Morimoto [Mon, 30 Nov 2015 08:52:38 +0000 (08:52 +0000)]
ASoC: rsnd: add rsnd_ssi_config_init()

In order to enhance code readability, this patch adds
rsnd_ssi_config_init() and moves SSICR register settings to it.
This is prepare patch for TDM support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: dvc: add rsnd_dvc_halt()
Kuninori Morimoto [Mon, 30 Nov 2015 08:52:21 +0000 (08:52 +0000)]
ASoC: rsnd: dvc: add rsnd_dvc_halt()

Based on datasheet process

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: mix: add rsnd_mix_halt()
Kuninori Morimoto [Mon, 30 Nov 2015 08:51:52 +0000 (08:51 +0000)]
ASoC: rsnd: mix: add rsnd_mix_halt()

Based on datasheet process

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: src: add rsnd_src_halt()
Kuninori Morimoto [Mon, 30 Nov 2015 08:51:35 +0000 (08:51 +0000)]
ASoC: rsnd: src: add rsnd_src_halt()

Based on datasheet process

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: dvc: rename rsnd_dvc_soft_reset() to rsnd_dvc_activation()
Kuninori Morimoto [Mon, 30 Nov 2015 08:51:15 +0000 (08:51 +0000)]
ASoC: rsnd: dvc: rename rsnd_dvc_soft_reset() to rsnd_dvc_activation()

Based on datasheet naming

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: mix: rename rsnd_mix_soft_reset() to rsnd_mix_activation()
Kuninori Morimoto [Mon, 30 Nov 2015 08:50:51 +0000 (08:50 +0000)]
ASoC: rsnd: mix: rename rsnd_mix_soft_reset() to rsnd_mix_activation()

Based on datasheet naming

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: src: rename rsnd_src_soft_reset() to rsnd_src_activation()
Kuninori Morimoto [Mon, 30 Nov 2015 08:50:32 +0000 (08:50 +0000)]
ASoC: rsnd: src: rename rsnd_src_soft_reset() to rsnd_src_activation()

Based on datasheet naming

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: add missing SRC_O_BUSIF_MODE register
Kuninori Morimoto [Mon, 30 Nov 2015 08:50:08 +0000 (08:50 +0000)]
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>
9 years agoASoC: rsnd: add missing ADINR::CHNUM on DVC/SRC/SSIU
Kuninori Morimoto [Mon, 30 Nov 2015 08:49:33 +0000 (08:49 +0000)]
ASoC: rsnd: add missing ADINR::CHNUM on DVC/SRC/SSIU

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: don't use normal *mod in adg.c
Kuninori Morimoto [Mon, 30 Nov 2015 08:49:15 +0000 (08:49 +0000)]
ASoC: rsnd: don't use normal *mod in adg.c

adg.c is used from ssi/src/cmd. Thus don't use confusable *mod here.
This patch rename it to ssi_mod/src_mod/cmd_mod

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: Add device tree support for r8a77{79,93,94}
Simon Horman [Mon, 30 Nov 2015 06:02:52 +0000 (15:02 +0900)]
ASoC: rsnd: Add device tree support for r8a77{79,93,94}

Simply document new compat strings.
There appears to be no need for a driver updates.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: tidyup semantics of rsnd_ssi_record_error()
Kuninori Morimoto [Thu, 26 Nov 2015 11:13:40 +0000 (11:13 +0000)]
ASoC: rsnd: tidyup semantics of rsnd_ssi_record_error()

rsnd_ssi_record_error() should recorde error, but it clears error too.
this patch fixes up semantic of rsnd_ssi_record_error that it records
error but doesn't clear error.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: tidyup semantics of rsnd_src_record_error()
Kuninori Morimoto [Thu, 26 Nov 2015 11:11:03 +0000 (11:11 +0000)]
ASoC: rsnd: tidyup semantics of rsnd_src_record_error()

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: indicate register name for debug
Kuninori Morimoto [Thu, 26 Nov 2015 08:43:59 +0000 (08:43 +0000)]
ASoC: rsnd: indicate register name for debug

Current rsnd driver is indicating how to use regmap debug method
on gen.c comment area.
regmap debug method indicates address and value, but rsnd driver is
using too many IPs (SSI/SSIU/SRC/CTU/MIX/DVC/CMD), and address.
Thus, we would like to know more useful information for debugging.
This patch indicates address name for debugging.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: tidyup void* cast for 64bit compiler
Kuninori Morimoto [Thu, 19 Nov 2015 04:22:56 +0000 (04:22 +0000)]
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>
9 years agoASoC: rsnd: remove struct platform_device from probe/remove parameter
Kuninori Morimoto [Tue, 10 Nov 2015 05:14:12 +0000 (05:14 +0000)]
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>
9 years agoASoC: rsnd: remove struct rcar_snd_info
Kuninori Morimoto [Tue, 10 Nov 2015 05:13:53 +0000 (05:13 +0000)]
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>
9 years agoASoC: rsnd: remove struct rsnd_of_data
Kuninori Morimoto [Tue, 10 Nov 2015 05:13:33 +0000 (05:13 +0000)]
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>
9 years agoASoC: rsnd: remove platform boot support from gen.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:13:12 +0000 (05:13 +0000)]
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>
9 years agoASoC: rsnd: remove platform boot support from dvc.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:12:50 +0000 (05:12 +0000)]
ASoC: rsnd: remove platform boot support from dvc.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 dvc.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: remove platform boot support from mix.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:12:32 +0000 (05:12 +0000)]
ASoC: rsnd: remove platform boot support from mix.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 mix.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: remove platform boot support from ctu.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:12:13 +0000 (05:12 +0000)]
ASoC: rsnd: remove platform boot support from ctu.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 ctu.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: remove platform boot support from src.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:11:55 +0000 (05:11 +0000)]
ASoC: rsnd: remove platform boot support from src.c

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: remove platform boot support from ssi.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:11:35 +0000 (05:11 +0000)]
ASoC: rsnd: remove platform boot support from ssi.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 ssi.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: remove platform boot support from core.c
Kuninori Morimoto [Tue, 10 Nov 2015 05:11:18 +0000 (05:11 +0000)]
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>
9 years agoASoC: rsnd: SRC settings matches to datasheet
Kuninori Morimoto [Tue, 10 Nov 2015 05:10:48 +0000 (05:10 +0000)]
ASoC: rsnd: SRC settings matches to datasheet

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: cleanup RSND_REG_xxx
Kuninori Morimoto [Tue, 10 Nov 2015 05:10:18 +0000 (05:10 +0000)]
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>
9 years agoASoC: rsnd: remove Gen1 support from SRC
Kuninori Morimoto [Tue, 10 Nov 2015 05:09:52 +0000 (05:09 +0000)]
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>
9 years agoASoC: rsnd: ssi: 24bit data needs right-aligned settings
Kuninori Morimoto [Tue, 17 Nov 2015 08:28:11 +0000 (08:28 +0000)]
ASoC: rsnd: ssi: 24bit data needs right-aligned settings

Data left/right aligned is controlled by PDTA bit on SSICR.
But default is left-aligned. Thus 24bit sound will be very small sound
without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: SND_SOC_RCAR doesn't depend on DMA_OF
Kuninori Morimoto [Fri, 6 Nov 2015 06:46:30 +0000 (06:46 +0000)]
ASoC: rsnd: SND_SOC_RCAR doesn't depend on DMA_OF

8616774("ASoC: rnsd: fix build regression without CONFIG_OF")
added "depends on DMA_OF" in SND_SOC_RCAR to avoid compile error of

    sound/built-in.o: In function `rsnd_dma_request_channel':
    :(.text+0x9fb84): undefined reference to `of_dma_request_slave_channel'

But, it was OF base DMAEngine API definition issue, not SND_SOC_RCAR
issue. This patch remove DMA_OF dependence.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: call clk_prepare()/clk_enable() for AUDIO_CLKx
Kuninori Morimoto [Thu, 5 Nov 2015 08:51:15 +0000 (08:51 +0000)]
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>
9 years agoASoC: rsnd: tidyup comment position of rsnd_mod_xxx
Kuninori Morimoto [Thu, 5 Nov 2015 08:50:10 +0000 (08:50 +0000)]
ASoC: rsnd: tidyup comment position of rsnd_mod_xxx

f1df12290("ASoC: rsnd: add common mod confirm method")
added rsnd_mod_make_sure(), but rsnd_mod_xxx() comment position
was wrong. This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: MIX settings matches to datasheet
Kuninori Morimoto [Wed, 4 Nov 2015 08:44:32 +0000 (08:44 +0000)]
ASoC: rsnd: MIX settings matches to datasheet

Current MIX settings order was rough.
This patch makes it match to datasheet.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: DVC settings matches to datasheet
Kuninori Morimoto [Wed, 4 Nov 2015 08:44:12 +0000 (08:44 +0000)]
ASoC: rsnd: DVC settings matches to datasheet

Current DVC settings order was rough.
This patch makes it match to datasheet.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: move CMD related operation to cmd.c
Kuninori Morimoto [Wed, 4 Nov 2015 08:43:33 +0000 (08:43 +0000)]
ASoC: rsnd: move CMD related operation to cmd.c

8cca6e11c1 ("ASoC: rsnd: use mod base common method on CMD")
added cmd.c. Let's move CMD related operation to cmd.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: audio_clkout0/1/2/3 are optional properties
Kuninori Morimoto [Thu, 29 Oct 2015 07:42:40 +0000 (07:42 +0000)]
ASoC: rsnd: audio_clkout0/1/2/3 are optional properties

Renesas sound driver can output Audio-clkout0/1/2/3,
but these are optional properties for each board.

Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsrc-card: Clarify compatible value
Geert Uytterhoeven [Thu, 29 Oct 2015 19:59:55 +0000 (20:59 +0100)]
ASoC: rsrc-card: Clarify compatible value

The compatible value can be board-specific, not SoC-specific.
Add curly braces to indicate that the board type is optional.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: Add missing initialization of ADG req_rate
Geert Uytterhoeven [Wed, 28 Oct 2015 15:03:48 +0000 (16:03 +0100)]
ASoC: rsnd: Add missing initialization of ADG req_rate

If the "clock-frequency" DT property is not found, req_rate is used
uninitialized, and the "audio_clkout" clock will be created with an
arbitrary clock rate.

This uninitialized kernel stack data may leak to userspace through
/sys/kernel/debug/clk/clk_summary, cfr. the value in the "rate" column:

       clock     enable_cnt  prepare_cnt        rate   accuracy   phase
    --------------------------------------------------------------------
     audio_clkout         0            0  4001836240          0 0

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: fixup rsnd_dmapp_stop() return value
Kuninori Morimoto [Wed, 28 Oct 2015 04:31:03 +0000 (04:31 +0000)]
ASoC: rsnd: fixup rsnd_dmapp_stop() return value

45a4394d03("ASoC: rsnd: use mod base common method on DMA phase3")
Exchanged "void rsnd_dmapp_stop()" to "int rsnd_dmapp_stop()",
but it returns inverted value. This patch fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: call rsnd_src_quit() from rsnd_src_quit_gen2()
Kuninori Morimoto [Wed, 28 Oct 2015 04:30:11 +0000 (04:30 +0000)]
ASoC: rsnd: call rsnd_src_quit() from rsnd_src_quit_gen2()

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: use mod base common method on SSI-parent
Kuninori Morimoto [Mon, 26 Oct 2015 08:43:57 +0000 (08:43 +0000)]
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>
9 years agoASoC: rsnd: use mod base common method on SSIU
Kuninori Morimoto [Mon, 26 Oct 2015 08:43:41 +0000 (08:43 +0000)]
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>
9 years agoASoC: rsnd: use mod base common method on CMD
Kuninori Morimoto [Mon, 26 Oct 2015 08:43:21 +0000 (08:43 +0000)]
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>
9 years agoASoC: rsnd: use mod base common method on DMA phase3
Kuninori Morimoto [Mon, 26 Oct 2015 08:43:01 +0000 (08:43 +0000)]
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>
9 years agoASoC: rsnd: use mod base common method on DMA phase2
Kuninori Morimoto [Mon, 26 Oct 2015 08:42:46 +0000 (08:42 +0000)]
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>
9 years agoASoC: rsnd: use mod base common method on DMA phase1
Kuninori Morimoto [Mon, 26 Oct 2015 08:42:25 +0000 (08:42 +0000)]
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>
9 years agoASoC: rsnd: use common rsnd_ssi_status_xxx()
Kuninori Morimoto [Mon, 26 Oct 2015 08:42:09 +0000 (08:42 +0000)]
ASoC: rsnd: use common rsnd_ssi_status_xxx()

Current ssi.c driver has random access to SSISR register. Let's use
common rsnd_ssi_status_xxx() function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: avoid pointless loop in rsnd_mod_interrupt()
Kuninori Morimoto [Mon, 26 Oct 2015 08:41:53 +0000 (08:41 +0000)]
ASoC: rsnd: avoid pointless loop in rsnd_mod_interrupt()

Current Renesas sound driver doesn't have 1:1 relationship between
stream <-> mod because it is supporting MIX. Because of this reason
rsnd_mod_interrupt() is searching correspond mod by for loop.
But this loop is not needed, because each mod has own type.
This patch avoid pointless loop by using mod->type.

This patch is good for SSI-parent support, because stream might have
2 SSI as SSI-parent/child. SSI interrupt handler will be called twice
if stream has SSI-parent without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: rsnd: Don't stop HW even if a large number of errors occur
Kuninori Morimoto [Mon, 26 Oct 2015 08:41:36 +0000 (08:41 +0000)]
ASoC: rsnd: Don't stop HW even if a large number of errors occur

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

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

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