Commit graph

17568 commits

Author SHA1 Message Date
Kuninori Morimoto ff8f30e688 ASoC: rsnd: use mod probe method on SSI
Now, it can use .probe

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-05 14:07:53 +08:00
Kuninori Morimoto 76c6fb5c49 ASoC: rsnd: use mod probe method on SCU
Now, it can use .probe

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-05 14:07:53 +08:00
Kuninori Morimoto 7681f6ac6b 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>
2014-03-05 14:07:52 +08:00
Kuninori Morimoto 221bf523e3 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>
2014-03-05 14:07:52 +08:00
Kuninori Morimoto b8cc41e9e8 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>
2014-03-05 14:07:52 +08:00
Kuninori Morimoto 389933d9f6 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>
2014-03-05 14:07:52 +08:00
Kuninori Morimoto 78f13d0c5a ASoC: rsnd: add struct rsnd_dai_platform_info
R-Car sound DAI consists from SSI/SCU/SSIU/SRU...
Current R-Car sound DAI is decided from these settings,
but it is intuitively unclear, and is not good design for DT support.
This patch adds new rsnd_dai_platform_info to solve this issue.

But now, many platform is using this driver without
rsnd_dai_platform_info.
So, this patch still supports DAI settings via SSI to keep compatible.
It will be removed in next Linux version.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-05 14:07:52 +08:00
Kuninori Morimoto c82e1c8874 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>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto 8467dedc9d ASoC: rsnd: modify rsnd_adg_ssi_ws_timing_gen2() parameter
rsnd_adg_ssi_ws_timing_gen2() returns SSI WS timing,
and it used "mod" as parameter.
but, this "mod" is sometimes not ssi mod.
Get SSI mod from rsnd_dai_stream

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto 685fb3eb31 ASoC: rsnd: remove unused SSI_CONTROL
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto d1ac970f5d ASoC: rsnd: use function pointer for each probe
R-Car sound consists of many devices.
It will have more device support in the future.
Thus, for each probe become now function pointer array.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto 468be93eb4 ASoC: rsnd: use devm_clk_get() instead of clk_get()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto 374e542637 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>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto a126021d14 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>
2014-03-04 12:13:49 +08:00
Kuninori Morimoto 9bfed6cf4f 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>
2014-03-04 12:13:48 +08:00
Kuninori Morimoto ecba9e724c 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>
2014-03-03 10:19:21 +09:00
Kuninori Morimoto 98455ed5dd ASoC: rsnd: remove verbose debug message from scu/ssi
scu/ssi probe() already have more detail debug message.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03 10:19:21 +09:00
Kuninori Morimoto 5da39cf304 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>
2014-03-03 10:19:21 +09:00
Kuninori Morimoto d870a91e9d 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>
2014-03-03 10:19:21 +09:00
Kuninori Morimoto 498480731e ASoC: rsnd: move priv member settings to upper side
There is no big meaning, but preparation for platform dai support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03 10:19:21 +09:00
Kuninori Morimoto a2070feede ASoC: rsnd: print error if there is SRC settings mismatch
rsnd request clock master if SRC is used

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-12 11:59:35 +00:00
Kuninori Morimoto ee2c828d21 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>
2014-02-12 11:59:35 +00:00
Kuninori Morimoto 00463c113b 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>
2014-02-12 11:59:35 +00:00
Kuninori Morimoto 8691d0748e ASoC: rsnd: use device dependency clock
Current R-Car sound driver is using device
independent audio clock, but it is not good
design for DT support.
This patch adds device dependent clock support.
But, there are some platform which is using
independent audio clock.
It is still supported at this point,
but it will be removed soon.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 17:31:44 +00:00
Kuninori Morimoto 629509c5bc 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>
2014-02-03 12:41:38 +00:00
Kuninori Morimoto eb854f6dff ASoC: rsnd: rsnd_ssi_probe() goes forwarder than rsnd_scu_probe()
rsnd_ssi_probe() goes forwarder than rsnd_scu_probe(),
since scu will need ssi information on Gen2

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:38 +00:00
Kuninori Morimoto 4686a0ad9a 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>
2014-02-03 12:41:38 +00:00
Kuninori Morimoto 1b7b08efbe 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>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto 32f27ebf9b 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>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto 28dc4b63cd 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>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto 96c7c0d6f8 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>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto 39cf3c4064 ASoC: rsnd: Merge macros in scu.c
Merge #define lines, since these are defined
in the scattering place

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto c926b74605 ASoC: rsnd: clarify scu.c area
scu.c cares SRU(Gen1) / SCU(Gen2) / SSIU(Gen2)

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto be213ac1af ASoC: rsnd: SCU should be called before SSI
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto f5cab3b897 ASoC: rsnd: don't use schedule_work() when rsnd_dma_start()
rsnd_dma_start() is the function to start DMAEngine.
Current code is using schedule_work() for it,
but it breaks DMAC/SSI register setting timing.
Don't use schedule_work() on it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto 64de62b386 ASoC: rsnd: fixup Gen2 module naming
Gen2 has SCU, not SRU

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:37 +00:00
Kuninori Morimoto 106d2eff56 ASoC: rsnd: non 0 is error on probe
Some xxx_probe() returns not only -Exx, but also PTR_ERR().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto 9b5ab573a8 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>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto 41c6221c39 ASoC: rsnd: explain SRC bypass mode settings in comment
SRC bypass mode is useful for debugging.
This patch explains SRC bypass mode settings in comment

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto f80e1c9633 ASoC: rsnd: rename rsnd_scu_convert_rate_ctrl()
rsnd_scu_convert_rate_ctrl() is unclear naming,
and there is "rsnd_scu_convert_rate" variable.
These are confusable.
it renamed to rsnd_scu_set_convert_rate()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto dd27d808f9 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>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto 7b5ce9759a 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>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto 6f3ab6c1c0 ASoC: rsnd: remove pin sync option
Renesas Chip is supporting multi pin sound,
but the HW setting is very difficult and confusable.
But driver is supporting it halfway.
Remove SYNC option at this point.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:36 +00:00
Kuninori Morimoto e779a20da9 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>
2014-02-03 12:41:16 +00:00
Kuninori Morimoto e7ce74eaa7 ASoC: rsnd: merge rsnd_scu_start/stop() and rsnd_scu_transfer_start/stop()
rsnd_scu_transfer_start/stop() are no longer needed.
merge into rsnd_scu_start/stop()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:16 +00:00
Kuninori Morimoto 47718dc7d8 ASoC: rsnd: remove meaningless function parameter
struct rsnd_priv *priv on rsnd_scu_init/start/stop()
are no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:15 +00:00
Kuninori Morimoto a204d90c91 ASoC: rsnd: add rsnd_scu_init(), and separate init/start
Current scu.c has rsnd_scu_start(),
and, operation of initialization/start
are implemented in this function.
This patch adds new rsnd_scu_init() and separates
rsnd_scu_start(), since rsnd_mod_ops has .init/.start callbacks.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:15 +00:00
Kuninori Morimoto 013f38fe26 ASoC: rsnd: control SCU ops in probe timing
SCU will be used if platform requested to use.
Current driver is checking it in runtime,
but, it can be decided in probe timing.
This patch do it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:15 +00:00
Kuninori Morimoto 6acef1721c ASoC: rsnd: remove meaningless rsnd_ssi_non()
rsnd_ssi_non_ops callback functions are never called.
remove these meaningless callback

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:41:15 +00:00
Kuninori Morimoto 92d9587ede 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>
2014-02-03 12:41:15 +00:00