: ASoC: rsnd: add Renesas Gen2 DMAEngine support
Subsystems (3)
cover : ASoC: rsnd: add Renesas Gen2 DMAEngine support
Hi Mark
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.
These patches are based on asoc-v3.14-3 tag
Kuninori Morimoto (27):
1) ASoC: rsnd: tidyup register naming of BUSIF_MODE
2) ASoC: rsnd: cleanup debug information method
3) ASoC: rsnd: remove meaningless rsnd_ssi_non()
4) ASoC: rsnd: control SCU ops in probe timing
5) ASoC: rsnd: add rsnd_scu_init(), and separate init/start
6) ASoC: rsnd: remove meaningless function parameter
7) ASoC: rsnd: merge rsnd_scu_start/stop() and rsnd_scu_transfer_start/stop()
8) ASoC: rsnd: rsnd_dai_is_clk_master() can be shared
9) ASoC: rsnd: remove pin sync option
10) ASoC: rsnd: SSI_MODE0/1 settings goes to scu.c
11) ASoC: rsnd: remove ssiu from ssi.c
12) ASoC: rsnd: rename rsnd_scu_convert_rate_ctrl()
13) ASoC: rsnd: explain SRC bypass mode settings in comment
14) ASoC: rsnd: remove duplicate *priv from rsnd_dma
15) ASoC: rsnd: non 0 is error on probe
16) ASoC: rsnd: fixup Gen2 module naming
17) ASoC: rsnd: don't use schedule_work() when rsnd_dma_start()
18) ASoC: rsnd: SCU should be called before SSI
19) ASoC: rsnd: clarify scu.c area
20) ASoC: rsnd: Merge macros in scu.c
21) ASoC: rsnd: rsnd_scu_hpbif_is_enable() become macro
22) ASoC: rsnd: merge SRC clock timing/setting
23) ASoC: rsnd: add rsnd_ssi_is_play()
24) ASoC: rsnd: extracts Gen1/Gen2 common parts
25) ASoC: rsnd: remove SSI dependent DMAEngine callback
26) ASoC: rsnd: rsnd_ssi_probe() goes forwarder than rsnd_scu_probe()
27) ASoC: rsnd: add Gen2 SRC and DMAEngine support
include/sound/rcar_snd.h | 7 +- sound/soc/sh/rcar/adg.c | 158 ++++++++++-- sound/soc/sh/rcar/core.c | 70 ++++-- sound/soc/sh/rcar/gen.c | 38 ++- sound/soc/sh/rcar/rsnd.h | 66 +++-- sound/soc/sh/rcar/scu.c | 605 ++++++++++++++++++++++++++++++++++------------ sound/soc/sh/rcar/ssi.c | 222 +++++------------ 7 files changed, 779 insertions(+), 387 deletions(-))
Best regards
---
Kuninori Morimoto
PATCH 1/27 ASoC: rsnd: tidyup register naming of BUSIF_MODE
From: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/gen.c | 2 +- sound/soc/sh/rcar/rsnd.h | 2 +- sound/soc/sh/rcar/scu.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/gen.c +1 -1
@@ -317,7 +317,7 @@ static int rsnd_gen1_regmap_init(struct rsnd_priv *priv, struct rsnd_gen *gen)RSND_GEN1_S_REG (gen,SRU ,SRC_ROUTE_CTRL ,0xc0 ),RSND_GEN1_S_REG (gen,SRU ,SSI_MODE0 ,0xD0 ),RSND_GEN1_S_REG (gen,SRU ,SSI_MODE1 ,0xD4 ), -RSND_GEN1_M_REG (gen,SRU ,BUSIF_MODE ,0x20 ,0x4 ), +RSND_GEN1_M_REG (gen,SRU ,SRC_BUSIF_MODE ,0x20 ,0x4 ),RSND_GEN1_M_REG (gen,SRU ,SRC_ROUTE_MODE0 ,0x50 ,0x8 ),RSND_GEN1_M_REG (gen,SRU ,SRC_SWRSR ,0x200 ,0x40 ), RSND_GEN1_M_REG(gen, SRU, SRC_SRCIR, 0x204, 0x40),
sound/soc/sh/rcar/rsnd.h +1 -1
@@ -39,8 +39,8 @@ enum rsnd_reg {RSND_REG_SRC_ROUTE_CTRL ,/* for Gen1 */ RSND_REG_SSI_MODE0 ,RSND_REG_SSI_MODE1 , -RSND_REG_BUSIF_MODE ,RSND_REG_INT_ENABLE ,/* for Gen2 */ +RSND_REG_SRC_BUSIF_MODE ,RSND_REG_SRC_ROUTE_MODE0 ,RSND_REG_SRC_SWRSR , RSND_REG_SRC_SRCIR,
sound/soc/sh/rcar/scu.c +1 -1
@@ -211,7 +211,7 @@ static int rsnd_scu_convert_rate_ctrl(struct rsnd_priv *priv,rsnd_mod_write (mod,SRC_SRCIR ,0 );/* use DMA transfer */ -rsnd_mod_write (mod,BUSIF_MODE ,1 ); +rsnd_mod_write (mod,SRC_BUSIF_MODE ,1 );return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 2/27 ASoC: rsnd: cleanup debug information method
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- sound/soc/sh/rcar/rsnd.h | 11 ++++++++++- sound/soc/sh/rcar/scu.c | 2 -- sound/soc/sh/rcar/ssi.c | 12 ------------ 3 files changed, 10 insertions(+), 15 deletions(-)
sound/soc/sh/rcar/rsnd.h +10 -1
@@ -152,10 +152,19 @@ struct rsnd_mod {#define rsnd_mod_id (mod) ((mod)->id)#define for_each_rsnd_mod (pos, n, io) \ list_for_each_entry_safe(pos, n, &(io)->head, list) +#define __rsnd_mod_call (mod, func, rdai, io) \ +({ \ + struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \ + struct device *dev = rsnd_priv_to_dev(priv); \ + dev_dbg(dev, "%s-%d-%s\n", \ + rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \ + (mod)->ops->func(mod, rdai, io); \ +}) +#define rsnd_mod_call (mod, func, rdai, io) \ (!(mod) ? -ENODEV : \ !((mod)->ops->func) ? 0 : \ - (mod)->ops->func(mod, rdai, io)) + __rsnd_mod_call(mod, func, rdai, io)) void rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod,
sound/soc/sh/rcar/scu.c +0 -2
@@ -300,8 +300,6 @@ static int rsnd_scu_start(struct rsnd_mod *mod,if (ret <0 )return ret; -dev_dbg (dev,"%s%d start\n" ,rsnd_mod_name (mod),rsnd_mod_id (mod)); -return 0 ; }
sound/soc/sh/rcar/ssi.c +0 -12
@@ -324,7 +324,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, {struct rsnd_ssi *ssi =rsnd_mod_to_ssi (mod);struct rsnd_priv *priv =rsnd_mod_to_priv (mod); -struct device *dev =rsnd_priv_to_dev (priv);struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io);u32 cr;
@@ -371,8 +370,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,rsnd_ssi_mode_set (priv, rdai, ssi); -dev_dbg (dev,"%s.%d init\n" ,rsnd_mod_name (mod),rsnd_mod_id (mod)); -return 0 ; }
@@ -384,8 +381,6 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv); -dev_dbg (dev,"%s.%d quit\n" ,rsnd_mod_name (mod),rsnd_mod_id (mod)); -if (ssi->err >0 )dev_warn (dev,"ssi under/over flow err = %d\n" , ssi->err);
@@ -450,7 +445,6 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod, {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_ssi *ssi =rsnd_mod_to_ssi (mod); -struct device *dev =rsnd_priv_to_dev (priv);/* enable PIO IRQ */ ssi->cr_etc =UIEN |OIEN |DIEN ;
@@ -461,8 +455,6 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,rsnd_ssi_hw_start (ssi, rdai, io); -dev_dbg (dev,"%s.%d start\n" ,rsnd_mod_name (mod),rsnd_mod_id (mod)); -return 0 ; }
@@ -470,12 +462,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - struct rsnd_priv *priv = rsnd_mod_to_priv(mod); -struct device *dev =rsnd_priv_to_dev (priv); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); -dev_dbg (dev,"%s.%d stop\n" ,rsnd_mod_name (mod),rsnd_mod_id (mod)); - ssi->cr_etc =0 ;rsnd_ssi_hw_stop (ssi, rdai);
Signature · 1 line
1.7.9.5
PATCH 3/27 ASoC: rsnd: remove meaningless rsnd_ssi_non()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
rsnd_ssi_non_ops callback functions are never called. remove these meaningless callback
--- sound/soc/sh/rcar/ssi.c | 16 ---------------- 1 file changed, 16 deletions(-)
sound/soc/sh/rcar/ssi.c +0 -16
@@ -555,24 +555,8 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {/* * Non SSI */ -static int rsnd_ssi_non (struct rsnd_mod *mod, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) -{ -struct rsnd_priv *priv =rsnd_mod_to_priv (mod); -struct device *dev =rsnd_priv_to_dev (priv); - -dev_dbg (dev,"%s\n" , __func__); - -return 0 ; -} -static struct rsnd_mod_ops rsnd_ssi_non_ops = { .name ="ssi (non)" , - .init = rsnd_ssi_non, - .quit = rsnd_ssi_non, - .start = rsnd_ssi_non, - .stop = rsnd_ssi_non, };/*
Signature · 1 line
1.7.9.5
PATCH 4/27 ASoC: rsnd: control SCU ops in probe timing
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- sound/soc/sh/rcar/scu.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-)
sound/soc/sh/rcar/scu.c +11 -19
@@ -270,24 +270,10 @@ static int rsnd_scu_start(struct rsnd_mod *mod, {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_scu *scu =rsnd_mod_to_scu (mod); -struct device *dev =rsnd_priv_to_dev (priv);int ret; -/* -* SCU will be used if it has RSND_SCU_USE_HPBIF flags -*/ -if (!rsnd_scu_hpbif_is_enable (mod)) { -/* it use PIO transter */ -dev_dbg (dev,"%s%d is not used\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); - -return 0 ; - } -clk_enable (scu->clk); -/* it use DMA transter */ - ret =rsnd_src_set_route_if_gen1 (priv, mod, rdai, io);if (ret <0 )return ret;
@@ -310,9 +296,6 @@ static int rsnd_scu_stop(struct rsnd_mod *mod,struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_scu *scu =rsnd_mod_to_scu (mod); -if (!rsnd_scu_hpbif_is_enable (mod)) -return 0 ; -rsnd_scu_transfer_stop (priv, mod, rdai, io);clk_disable (scu->clk);
@@ -326,6 +309,10 @@ static struct rsnd_mod_ops rsnd_scu_ops = { .stop = rsnd_scu_stop, }; +static struct rsnd_mod_ops rsnd_scu_non_ops = { + .name ="scu (non)" , +}; +struct rsnd_mod *rsnd_scu_mod_get (struct rsnd_priv *priv,int id) {if (WARN_ON (id <0 || id >=rsnd_scu_nr (priv)))
@@ -340,6 +327,7 @@ int rsnd_scu_probe(struct platform_device *pdev, {struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_scu *scu; +struct rsnd_mod_ops *ops;struct clk *clk;char name[RSND_SCU_NAME_SIZE ];int i, nr;
@@ -364,11 +352,15 @@ int rsnd_scu_probe(struct platform_device *pdev,if (IS_ERR (clk))return PTR_ERR (clk); -rsnd_mod_init (priv, &scu->mod, - &rsnd_scu_ops, i); scu->info = &info->scu_info[i]; scu->clk = clk; + ops = &rsnd_scu_non_ops; +if (rsnd_scu_hpbif_is_enable (&scu->mod)) + ops = &rsnd_scu_ops; + +rsnd_mod_init (priv, &scu->mod, ops, i); +dev_dbg (dev,"SCU%d probed\n" , i); }dev_dbg (dev,"scu probed\n" );
Signature · 1 line
1.7.9.5
PATCH 5/27 ASoC: rsnd: add rsnd_scu_init(), and separate init/start
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/scu.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
sound/soc/sh/rcar/scu.c +23 -6
@@ -264,7 +264,7 @@ bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod)return !!(flags &RSND_SCU_USE_HPBIF ); } -static int rsnd_scu_start (struct rsnd_mod *mod, +static int rsnd_scu_init (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io) {
@@ -282,13 +282,30 @@ static int rsnd_scu_start(struct rsnd_mod *mod,if (ret <0 )return ret; - ret =rsnd_scu_transfer_start (priv, mod, rdai, io); -if (ret <0 ) -return ret; +return 0 ; +} + +static int rsnd_scu_quit (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_scu *scu =rsnd_mod_to_scu (mod); + +clk_disable (scu->clk);return 0 ; } +static int rsnd_scu_start (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_priv *priv =rsnd_mod_to_priv (mod); +struct rsnd_scu *scu =rsnd_mod_to_scu (mod); + +return rsnd_scu_transfer_start (priv, mod, rdai, io); +} +static int rsnd_scu_stop (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -298,13 +315,13 @@ static int rsnd_scu_stop(struct rsnd_mod *mod,rsnd_scu_transfer_stop (priv, mod, rdai, io); -clk_disable (scu->clk); -return 0 ; }static struct rsnd_mod_ops rsnd_scu_ops = { .name ="scu" , + .init = rsnd_scu_init, + .quit = rsnd_scu_quit, .start = rsnd_scu_start, .stop = rsnd_scu_stop, };
Signature · 1 line
1.7.9.5
PATCH 6/27 ASoC: rsnd: remove meaningless function parameter
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
struct rsnd_priv *priv on rsnd_scu_init/start/stop() are no longer needed
--- sound/soc/sh/rcar/scu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/scu.c +6 -5
@@ -50,7 +50,7 @@ struct rsnd_scu { i++)/* Gen1 only */ -static int rsnd_src_set_route_if_gen1 (struct rsnd_priv *priv, +static int rsnd_src_set_route_if_gen1 (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -69,6 +69,7 @@ static int rsnd_src_set_route_if_gen1(struct rsnd_priv *priv, { 0x3, 28, }, /* 7 */ { 0x3, 30, }, /* 8 */ }; +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_scu *scu =rsnd_mod_to_scu (mod);u32 mask;u32 val;
@@ -149,11 +150,12 @@ unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,return rate; } -static int rsnd_scu_convert_rate_ctrl (struct rsnd_priv *priv, +static int rsnd_scu_convert_rate_ctrl (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io);struct rsnd_scu *scu =rsnd_mod_to_scu (mod);u32 convert_rate =rsnd_scu_convert_rate (scu);
@@ -268,17 +270,16 @@ static int rsnd_scu_init(struct rsnd_mod *mod,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct rsnd_scu *scu = rsnd_mod_to_scu(mod);int ret;clk_enable (scu->clk); - ret =rsnd_src_set_route_if_gen1 (priv, mod, rdai, io); + ret =rsnd_src_set_route_if_gen1 (mod, rdai, io);if (ret <0 )return ret; - ret =rsnd_scu_convert_rate_ctrl (priv, mod, rdai, io); + ret =rsnd_scu_convert_rate_ctrl (mod, rdai, io);if (ret <0 )return ret;
Signature · 1 line
1.7.9.5
PATCH 7/27 ASoC: rsnd: merge rsnd_scu_start/stop() and rsnd_scu_transfer_start/stop()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
rsnd_scu_transfer_start/stop() are no longer needed. merge into rsnd_scu_start/stop()
--- sound/soc/sh/rcar/scu.c | 56 ++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 42 deletions(-)
sound/soc/sh/rcar/scu.c +14 -42
@@ -218,46 +218,6 @@ static int rsnd_scu_convert_rate_ctrl(return 0 ; } -static int rsnd_scu_transfer_start (struct rsnd_priv *priv, -struct rsnd_mod *mod, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) -{ -struct rsnd_scu *scu =rsnd_mod_to_scu (mod); -int id =rsnd_mod_id (mod); -u32 val; - -if (rsnd_is_gen1 (priv)) { - val = (1 << id); -rsnd_mod_bset (mod,SRC_ROUTE_CTRL , val, val); - } - -if (rsnd_scu_convert_rate (scu)) -rsnd_mod_write (mod,SRC_ROUTE_MODE0 ,1 ); - -return 0 ; -} - -static int rsnd_scu_transfer_stop (struct rsnd_priv *priv, -struct rsnd_mod *mod, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) -{ -struct rsnd_scu *scu =rsnd_mod_to_scu (mod); -int id =rsnd_mod_id (mod); -u32 mask; - -if (rsnd_is_gen1 (priv)) { - mask = (1 << id); -rsnd_mod_bset (mod,SRC_ROUTE_CTRL , mask,0 ); - } - -if (rsnd_scu_convert_rate (scu)) -rsnd_mod_write (mod,SRC_ROUTE_MODE0 ,0 ); - -return 0 ; -} -bool rsnd_scu_hpbif_is_enable (struct rsnd_mod *mod) {struct rsnd_scu *scu =rsnd_mod_to_scu (mod);
@@ -303,8 +263,15 @@ static int rsnd_scu_start(struct rsnd_mod *mod, {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_scu *scu =rsnd_mod_to_scu (mod); +int id =rsnd_mod_id (mod); -return rsnd_scu_transfer_start (priv, mod, rdai, io); +if (rsnd_is_gen1 (priv)) +rsnd_mod_bset (mod,SRC_ROUTE_CTRL , (1 << id), (1 << id)); + +if (rsnd_scu_convert_rate (scu)) +rsnd_mod_write (mod,SRC_ROUTE_MODE0 ,1 ); + +return 0 ; } static int rsnd_scu_stop(struct rsnd_mod *mod,
@@ -313,8 +280,13 @@ static int rsnd_scu_stop(struct rsnd_mod *mod, {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_scu *scu =rsnd_mod_to_scu (mod); +int id =rsnd_mod_id (mod); + +if (rsnd_is_gen1 (priv)) +rsnd_mod_bset (mod,SRC_ROUTE_CTRL , (1 << id),0 ); -rsnd_scu_transfer_stop (priv, mod, rdai, io); +if (rsnd_scu_convert_rate (scu)) +rsnd_mod_write (mod,SRC_ROUTE_MODE0 ,0 );return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 8/27 ASoC: rsnd: rsnd_dai_is_clk_master() can be shared
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- sound/soc/sh/rcar/rsnd.h | 1 + sound/soc/sh/rcar/ssi.c | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -215,6 +215,7 @@ int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai);void rsnd_dai_pointer_update (struct rsnd_dai_stream *io,int cnt);int rsnd_dai_pointer_offset (struct rsnd_dai_stream *io,int additional); +#define rsnd_dai_is_clk_master (rdai) ((rdai)->clk_master)/* * R-Car Gen1/Gen2
sound/soc/sh/rcar/ssi.c +4 -5
@@ -95,7 +95,6 @@ struct rsnd_ssiu {#define rsnd_ssi_dma_available (ssi) \ rsnd_dma_available(rsnd_mod_to_dma(&(ssi)->mod))#define rsnd_ssi_clk_from_parent (ssi) ((ssi)->parent) -#define rsnd_rdai_is_clk_master (rdai) ((rdai)->clk_master)#define rsnd_ssi_mode_flags (p) ((p)->info->flags)#define rsnd_ssi_dai_id (ssi) ((ssi)->info->dai_id)#define rsnd_ssi_to_ssiu (ssi)\
@@ -133,7 +132,7 @@ static void rsnd_ssi_mode_set(struct rsnd_priv *priv,#define ssi_parent_set (p, sync, adg, ext) \ do { \ ssi->parent = ssiu->ssi + p; \ - if (rsnd_rdai_is_clk_master(rdai)) \ + if (rsnd_dai_is_clk_master(rdai)) \ val = adg; \ else \ val = ext; \
@@ -252,7 +251,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,if (0 == ssi->usrcnt) {clk_enable (ssi->clk); -if (rsnd_rdai_is_clk_master (rdai)) { +if (rsnd_dai_is_clk_master (rdai)) {if (rsnd_ssi_clk_from_parent (ssi))rsnd_ssi_hw_start (ssi->parent, rdai, io);else
@@ -302,7 +301,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi,rsnd_mod_write (&ssi->mod,SSICR , cr);/* disabled all */ rsnd_ssi_status_check (&ssi->mod,IIRQ ); -if (rsnd_rdai_is_clk_master (rdai)) { +if (rsnd_dai_is_clk_master (rdai)) {if (rsnd_ssi_clk_from_parent (ssi))rsnd_ssi_hw_stop (ssi->parent, rdai);else
@@ -522,7 +521,7 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,rsnd_ssi_hw_start (ssi, ssi->rdai, io);/* enable WS continue */ -if (rsnd_rdai_is_clk_master (rdai)) +if (rsnd_dai_is_clk_master (rdai))rsnd_mod_write (&ssi->mod,SSIWSR ,CONT );return 0 ;
Signature · 1 line
1.7.9.5
PATCH 9/27 ASoC: rsnd: remove pin sync option
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- include/sound/rcar_snd.h | 1 - sound/soc/sh/rcar/ssi.c | 2 -- 2 files changed, 3 deletions(-)
include/sound/rcar_snd.h +0 -1
@@ -35,7 +35,6 @@*/ #define RSND_SSI_CLK_PIN_SHARE (1 << 31)#define RSND_SSI_CLK_FROM_ADG (1 << 30)/* clock parent is master */ -#define RSND_SSI_SYNC (1 << 29)/* SSI34_sync etc */ #define RSND_SSI_PLAY (1 << 24)
sound/soc/sh/rcar/ssi.c +0 -2
@@ -136,8 +136,6 @@ static void rsnd_ssi_mode_set(struct rsnd_priv *priv, val = adg; \ else \ val = ext; \ -if (flags &RSND_SSI_SYNC ) \ - val |= sync; \ }while (0 ) flags =rsnd_ssi_mode_flags (ssi);
Signature · 1 line
1.7.9.5
PATCH 10/27 ASoC: rsnd: SSI_MODE0/1 settings goes to scu.c
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- sound/soc/sh/rcar/rsnd.h | 1 + sound/soc/sh/rcar/scu.c | 45 +++++++++++++++++++++ sound/soc/sh/rcar/ssi.c | 98 +++++++++++++--------------------------------- 3 files changed, 74 insertions(+), 70 deletions(-)
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -321,5 +321,6 @@ void rsnd_ssi_remove(struct platform_device *pdev,struct rsnd_mod *rsnd_ssi_mod_get (struct rsnd_priv *priv,int id);struct rsnd_mod *rsnd_ssi_mod_get_frm_dai (struct rsnd_priv *priv,int dai_id,int is_play); +int rsnd_ssi_is_pin_sharing (struct rsnd_mod *mod);#endif
sound/soc/sh/rcar/scu.c +45 -0
63 lines not on this page · raw message
sound/soc/sh/rcar/ssi.c +28 -70
134 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 11/27 ASoC: rsnd: remove ssiu from ssi.c
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Now, SSI_MODE0/1 are controlled under scu.c
ssiu is no longer needed on ssi.c
--- sound/soc/sh/rcar/rsnd.h | 3 ++- sound/soc/sh/rcar/ssi.c | 24 +++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-)
sound/soc/sh/rcar/rsnd.h +2 -1
@@ -280,7 +280,8 @@ struct rsnd_priv {/* * below value will be filled on rsnd_ssi_probe() */ -void *ssiu; +void *ssi; +int ssi_nr;/* * below value will be filled on rsnd_dai_probe()
sound/soc/sh/rcar/ssi.c +7 -17
@@ -74,18 +74,13 @@ struct rsnd_ssi {unsigned int rate; }; -struct rsnd_ssiu { -int ssi_nr; -struct rsnd_ssi *ssi; -}; -#define for_each_rsnd_ssi (pos, priv, i) \ for (i = 0; \ (i < rsnd_ssi_nr(priv)) && \ - ((pos) = ((struct rsnd_ssiu *)((priv)->ssiu))->ssi + i); \ + ((pos) = ((struct rsnd_ssi *)(priv)->ssi + i)); \ i++) -#define rsnd_ssi_nr (priv) (((struct rsnd_ssiu *)((priv)->ssiu))->ssi_nr) +#define rsnd_ssi_nr (priv) ((priv)->ssi_nr)#define rsnd_mod_to_ssi (_mod) container_of((_mod), struct rsnd_ssi, mod)#define rsnd_dma_to_ssi (dma) rsnd_mod_to_ssi(rsnd_dma_to_mod(dma))#define rsnd_ssi_pio_available (ssi) ((ssi)->info->pio_irq > 0)
@@ -94,8 +89,6 @@ struct rsnd_ssiu {#define rsnd_ssi_clk_from_parent (ssi) ((ssi)->parent)#define rsnd_ssi_mode_flags (p) ((p)->info->flags)#define rsnd_ssi_dai_id (ssi) ((ssi)->info->dai_id) -#define rsnd_ssi_to_ssiu (ssi)\ - (((struct rsnd_ssiu *)((ssi) - rsnd_mod_id(&(ssi)->mod))) - 1)static void rsnd_ssi_status_check (struct rsnd_mod *mod,u32 bit)
@@ -515,7 +508,7 @@ struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id)if (WARN_ON (id <0 || id >=rsnd_ssi_nr (priv))) id =0 ; -return &(((struct rsnd_ssiu *)(priv->ssiu))->ssi + id)->mod; +return &((struct rsnd_ssi *)(priv->ssi) + id)->mod; }int rsnd_ssi_is_pin_sharing (struct rsnd_mod *mod)
@@ -552,7 +545,6 @@ int rsnd_ssi_probe(struct platform_device *pdev,struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_mod_ops *ops;struct clk *clk; -struct rsnd_ssiu *ssiu;struct rsnd_ssi *ssi;char name[RSND_SSI_NAME_SIZE ];int i, nr, ret;
@@ -561,16 +553,14 @@ int rsnd_ssi_probe(struct platform_device *pdev,* init SSI */ nr = info->ssi_info_nr; - ssiu =devm_kzalloc (dev,sizeof (*ssiu) + (sizeof (*ssi) * nr), -GFP_KERNEL ); -if (!ssiu) { + ssi =devm_kzalloc (dev,sizeof (*ssi) * nr,GFP_KERNEL ); +if (!ssi) {dev_err (dev,"SSI allocate failed\n" );return -ENOMEM ; } - priv->ssiu = ssiu; - ssiu->ssi = (struct rsnd_ssi *)(ssiu +1 ); - ssiu->ssi_nr = nr; + priv->ssi = ssi; + priv->ssi_nr = nr;for_each_rsnd_ssi (ssi, priv, i) { pinfo = &info->ssi_info[i];
Signature · 1 line
1.7.9.5
PATCH 12/27 ASoC: rsnd: rename rsnd_scu_convert_rate_ctrl()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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()
--- sound/soc/sh/rcar/scu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/scu.c +4 -5
@@ -190,10 +190,9 @@ unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,return rate; } -static int rsnd_scu_convert_rate_ctrl ( -struct rsnd_mod *mod, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) +static int rsnd_scu_set_convert_rate (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io);
@@ -283,7 +282,7 @@ static int rsnd_scu_init(struct rsnd_mod *mod,if (ret <0 )return ret; - ret =rsnd_scu_convert_rate_ctrl (mod, rdai, io); + ret =rsnd_scu_set_convert_rate (mod, rdai, io);if (ret <0 )return ret;
Signature · 1 line
1.7.9.5
PATCH 13/27 ASoC: rsnd: explain SRC bypass mode settings in comment
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
SRC bypass mode is useful for debugging.
This patch explains SRC bypass mode settings in comment
--- sound/soc/sh/rcar/scu.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
sound/soc/sh/rcar/scu.c +45 -0
@@ -40,6 +40,51 @@ struct rsnd_scu {* */ +/* +* How to use SRC bypass mode for debugging +* +* SRC has bypass mode, and it is useful for debugging. +* In Gen2 case, +* SRCm_MODE controls whether SRC is used or not +* SSI_MODE0 controls whether SSIU which receives SRC data +* is used or not. +* Both SRCm_MODE/SSI_MODE0 settings are needed if you use SRC, +* but SRC bypass mode needs SSI_MODE0 only. +* +* This driver request +* struct rsnd_scu_platform_info { +* u32 flags; +* u32 convert_rate; +* } +* +* rsnd_scu_hpbif_is_enable() will be true +* if flags had RSND_SCU_USE_HPBIF, +* and it controls whether SSIU is used or not. +* +* rsnd_scu_convert_rate() indicates +* above convert_rate, and it controls +* whether SRC is used or not. +* +* ex) doesn't use SRC +* struct rsnd_scu_platform_info info = { +* .flags = 0, +* .convert_rate = 0, +* }; +* +* ex) uses SRC +* struct rsnd_scu_platform_info info = { +* .flags = RSND_SCU_USE_HPBIF, +* .convert_rate = 48000, +* }; +* +* ex) uses SRC bypass mode +* struct rsnd_scu_platform_info info = { +* .flags = RSND_SCU_USE_HPBIF, +* .convert_rate = 0, +* }; +* +*/ +#define rsnd_mod_to_scu (_mod) \ container_of((_mod), struct rsnd_scu, mod)
Signature · 1 line
1.7.9.5
Mark Brown
maintainerRe: [PATCH 13/27] ASoC: rsnd: explain SRC bypass mode settings in comment
Quoted 4 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
SRC bypass mode is useful for debugging.
This patch explains SRC bypass mode settings in comment
Surely it's also useful for providing a power saving in cases where the SRC is not required? Depending on the implementation it may also end up resulting in a small improvement in audio quality in such cases.
Re: [PATCH 13/27] ASoC: rsnd: explain SRC bypass mode settings in comment
Hi Mark
Quoted 6 lines
Quoted 2 lines
SRC bypass mode is useful for debugging.
This patch explains SRC bypass mode settings in commentSurely it's also useful for providing a power saving in cases where the SRC is not required? Depending on the implementation it may also end up resulting in a small improvement in audio quality in such cases.
If user don't use SRC, SRC power is OFF in current implementation. But, I'll send new patch if I noticed about PM on SRC.
Best regards
---
Kuninori Morimoto
Mark Brown
maintainerRe: [PATCH 13/27] ASoC: rsnd: explain SRC bypass mode settings in comment
Quoted 9 lines · Kuninori Morimoto
Quoted 6 lines
Quoted 2 lines
SRC bypass mode is useful for debugging.
This patch explains SRC bypass mode settings in commentSurely it's also useful for providing a power saving in cases where the SRC is not required? Depending on the implementation it may also end up resulting in a small improvement in audio quality in such cases.
If user don't use SRC, SRC power is OFF in current implementation. But, I'll send new patch if I noticed about PM on SRC.
OK - that's good. I'd have expected that before powering off you'd have needed to bypass the SRC but if you don't that's fine.
PATCH 14/27 ASoC: rsnd: remove duplicate *priv from rsnd_dma
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
*priv pointer exists under rsnd_mod,
and, it can get rsnd_mod pointer from rsnd_dma.
remove duplicate rsnd_dma :: priv
--- sound/soc/sh/rcar/core.c | 5 ++--- sound/soc/sh/rcar/rsnd.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/core.c +2 -3
@@ -156,7 +156,7 @@ void rsnd_dma_stop(struct rsnd_dma *dma)static void rsnd_dma_complete (void *data) {struct rsnd_dma *dma = (struct rsnd_dma *)data; -struct rsnd_priv *priv = dma->priv; +struct rsnd_priv *priv =rsnd_mod_to_priv (rsnd_dma_to_mod (dma));unsigned long flags;rsnd_lock (priv, flags);
@@ -172,7 +172,7 @@ static void rsnd_dma_complete(void *data)static void rsnd_dma_do_work (struct work_struct *work) { struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work); -struct rsnd_priv *priv = dma->priv; +struct rsnd_priv *priv =rsnd_mod_to_priv (rsnd_dma_to_mod (dma));struct device *dev =rsnd_priv_to_dev (priv);struct dma_async_tx_descriptor *desc;dma_addr_t buf;
@@ -246,7 +246,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, goto rsnd_dma_init_err; dma->dir = is_play ?DMA_TO_DEVICE :DMA_FROM_DEVICE ; - dma->priv = priv; dma->inquiry = inquiry; dma->complete = complete;INIT_WORK (&dma->work, rsnd_dma_do_work);
sound/soc/sh/rcar/rsnd.h +0 -1
@@ -96,7 +96,6 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,* R-Car DMA */ struct rsnd_dma { -struct rsnd_priv *priv;struct sh_dmae_slave slave;struct work_struct work;struct dma_chan *chan;
Signature · 1 line
1.7.9.5
PATCH 15/27 ASoC: rsnd: non 0 is error on probe
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Some xxx_probe() returns not only -Exx, but also PTR_ERR().
--- sound/soc/sh/rcar/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/core.c +5 -5
@@ -737,23 +737,23 @@ static int rsnd_probe(struct platform_device *pdev)* init each module */ ret =rsnd_gen_probe (pdev, info, priv); -if (ret <0 ) +if (ret)return ret; ret =rsnd_scu_probe (pdev, info, priv); -if (ret <0 ) +if (ret)return ret; ret =rsnd_adg_probe (pdev, info, priv); -if (ret <0 ) +if (ret)return ret; ret =rsnd_ssi_probe (pdev, info, priv); -if (ret <0 ) +if (ret)return ret; ret =rsnd_dai_probe (pdev, info, priv); -if (ret <0 ) +if (ret)return ret;/*
Signature · 1 line
1.7.9.5
PATCH 16/27 ASoC: rsnd: fixup Gen2 module naming
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Gen2 has SCU, not SRU
--- sound/soc/sh/rcar/gen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rcar/gen.c +1 -1
@@ -283,7 +283,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,return ret;dev_dbg (dev,"Gen2 device probed\n" ); -dev_dbg (dev,"SRU : %08x => %p\n" , scu_res->start, +dev_dbg (dev,"SCU : %08x => %p\n" , scu_res->start, gen->base[RSND_GEN2_SCU ]);dev_dbg (dev,"ADG : %08x => %p\n" , adg_res->start, gen->base[RSND_GEN2_ADG ]);
Signature · 1 line
1.7.9.5
PATCH 17/27 ASoC: rsnd: don't use schedule_work() when rsnd_dma_start()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/core.c +10 -3
@@ -132,6 +132,7 @@ void rsnd_mod_init(struct rsnd_priv *priv,/* * rsnd_dma functions */ +static void __rsnd_dma_start (struct rsnd_dma *dma);static void rsnd_dma_continue (struct rsnd_dma *dma) {/* push next A or B plane */
@@ -143,7 +144,7 @@ void rsnd_dma_start(struct rsnd_dma *dma) {/* push both A and B plane*/ dma->submit_loop =2 ; -schedule_work (&dma->work); +__rsnd_dma_start (dma); }void rsnd_dma_stop (struct rsnd_dma *dma)
@@ -169,9 +170,8 @@ static void rsnd_dma_complete(void *data)rsnd_unlock (priv, flags); } -static void rsnd_dma_do_work (struct work_struct *work) +static void __rsnd_dma_start (struct rsnd_dma *dma) { - struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);struct rsnd_priv *priv =rsnd_mod_to_priv (rsnd_dma_to_mod (dma));struct device *dev =rsnd_priv_to_dev (priv);struct dma_async_tx_descriptor *desc;
@@ -204,6 +204,13 @@ static void rsnd_dma_do_work(struct work_struct *work) } } +static void rsnd_dma_do_work (struct work_struct *work) +{ + struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work); + +__rsnd_dma_start (dma); +} +int rsnd_dma_available (struct rsnd_dma *dma) {return !!dma->chan;
Signature · 1 line
1.7.9.5
PATCH 18/27 ASoC: rsnd: SCU should be called before SSI
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/gen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/gen.c +4 -4
@@ -182,14 +182,14 @@ int rsnd_gen_path_init(struct rsnd_priv *priv, rsnd_dai_is_play(rdai, io)); id =rsnd_mod_id (mod); -/* SSI */ - mod =rsnd_ssi_mod_get (priv, id); +/* SCU */ + mod =rsnd_scu_mod_get (priv, id); ret =rsnd_dai_connect (rdai, mod, io);if (ret <0 )return ret; -/* SCU */ - mod =rsnd_scu_mod_get (priv, id); +/* SSI */ + mod =rsnd_ssi_mod_get (priv, id); ret =rsnd_dai_connect (rdai, mod, io);return ret;
Signature · 1 line
1.7.9.5
PATCH 19/27 ASoC: rsnd: clarify scu.c area
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
scu.c cares SRU(Gen1) / SCU(Gen2) / SSIU(Gen2)
--- sound/soc/sh/rcar/scu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/soc/sh/rcar/scu.c +14 -0
@@ -41,6 +41,20 @@ struct rsnd_scu {*/ /* +* scu.c is caring... +* +* Gen1 +* +* [mem] -> [SRU] -> [SSI] +* |--------| +* +* Gen2 +* +* [mem] -> [SCU] -> [SSIU] -> [SSI] +* |-----------------| +*/ + +/* * How to use SRC bypass mode for debugging * * SRC has bypass mode, and it is useful for debugging.
Signature · 1 line
1.7.9.5
PATCH 20/27 ASoC: rsnd: Merge macros in scu.c
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Merge #define lines, since these are defined
in the scattering place
--- sound/soc/sh/rcar/scu.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
sound/soc/sh/rcar/scu.c +12 -12
@@ -16,9 +16,6 @@ struct rsnd_scu {struct clk *clk; }; -#define rsnd_scu_mode_flags (p) ((p)->info->flags) -#define rsnd_scu_convert_rate (p) ((p)->info->convert_rate) -#define RSND_SCU_NAME_SIZE 16/*
@@ -30,6 +27,18 @@ struct rsnd_scu {#define OTBL_18 (6 << 16)#define OTBL_16 (8 << 16) +#define rsnd_scu_mode_flags (p) ((p)->info->flags) +#define rsnd_scu_convert_rate (p) ((p)->info->convert_rate) +#define rsnd_mod_to_scu (_mod) \ + container_of((_mod), struct rsnd_scu, mod) + +#define for_each_rsnd_scu (pos, priv, i) \ + for ((i) = 0; \ + ((i) < rsnd_scu_nr(priv)) && \ + ((pos) = (struct rsnd_scu *)(priv)->scu + i); \ + i++) + +/* * image of SRC (Sampling Rate Converter) *
@@ -99,15 +108,6 @@ struct rsnd_scu {* */ -#define rsnd_mod_to_scu (_mod) \ - container_of((_mod), struct rsnd_scu, mod) - -#define for_each_rsnd_scu (pos, priv, i) \ - for ((i) = 0; \ - ((i) < rsnd_scu_nr(priv)) && \ - ((pos) = (struct rsnd_scu *)(priv)->scu + i); \ - i++) -static int rsnd_scu_ssi_mode_init (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
Signature · 1 line
1.7.9.5
PATCH 21/27 ASoC: rsnd: rsnd_scu_hpbif_is_enable() become macro
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
rsnd_scu_hpbif_is_enable() is used only scu.c now. It can be local macro
--- sound/soc/sh/rcar/rsnd.h | 1 - sound/soc/sh/rcar/scu.c | 15 +++++---------- 2 files changed, 5 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/rsnd.h +0 -1
@@ -303,7 +303,6 @@ int rsnd_scu_probe(struct platform_device *pdev,void rsnd_scu_remove (struct platform_device *pdev,struct rsnd_priv *priv);struct rsnd_mod *rsnd_scu_mod_get (struct rsnd_priv *priv,int id); -bool rsnd_scu_hpbif_is_enable (struct rsnd_mod *mod);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_mod *ssi_mod,struct snd_pcm_runtime *runtime);
sound/soc/sh/rcar/scu.c +5 -10
@@ -31,6 +31,8 @@ struct rsnd_scu {#define rsnd_scu_convert_rate (p) ((p)->info->convert_rate)#define rsnd_mod_to_scu (_mod) \ container_of((_mod), struct rsnd_scu, mod) +#define rsnd_scu_hpbif_is_enable (scu) \ + (rsnd_scu_mode_flags(scu) & RSND_SCU_USE_HPBIF)#define for_each_rsnd_scu (pos, priv, i) \ for ((i) = 0; \
@@ -113,13 +115,14 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io) {struct rsnd_priv *priv =rsnd_mod_to_priv (mod); +struct rsnd_scu *scu =rsnd_mod_to_scu (mod);int id =rsnd_mod_id (mod);/* * SSI_MODE0 */ rsnd_mod_bset (mod,SSI_MODE0 , (1 << id), -rsnd_scu_hpbif_is_enable (mod) ?0 : (1 << id)); +rsnd_scu_hpbif_is_enable (scu) ?0 : (1 << id));/* * SSI_MODE1
@@ -316,14 +319,6 @@ static int rsnd_scu_set_convert_rate(struct rsnd_mod *mod,return 0 ; } -bool rsnd_scu_hpbif_is_enable (struct rsnd_mod *mod) -{ -struct rsnd_scu *scu =rsnd_mod_to_scu (mod); -u32 flags =rsnd_scu_mode_flags (scu); - -return !!(flags &RSND_SCU_USE_HPBIF ); -} -static int rsnd_scu_init (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -449,7 +444,7 @@ int rsnd_scu_probe(struct platform_device *pdev, scu->clk = clk; ops = &rsnd_scu_non_ops; -if (rsnd_scu_hpbif_is_enable (&scu->mod)) +if (rsnd_scu_hpbif_is_enable (scu)) ops = &rsnd_scu_ops;rsnd_mod_init (priv, &scu->mod, ops, i);
Signature · 1 line
1.7.9.5
PATCH 22/27 ASoC: rsnd: merge SRC clock timing/setting
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/adg.c | 20 ++++--------------- sound/soc/sh/rcar/rsnd.h | 8 ++++---- sound/soc/sh/rcar/scu.c | 48 +++++++++++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 33 deletions(-)
sound/soc/sh/rcar/adg.c +4 -16
@@ -30,10 +30,10 @@ struct rsnd_adg { i++, (pos) = adg->clk[i])#define rsnd_priv_to_adg (priv) ((struct rsnd_adg *)(priv)->adg) -static int rsnd_adg_set_convert_clk_gen1 (struct rsnd_priv *priv, -struct rsnd_mod *mod, -unsigned int src_rate, -unsigned int dst_rate) +int rsnd_adg_set_convert_clk_gen1 (struct rsnd_priv *priv, +struct rsnd_mod *mod, +unsigned int src_rate, +unsigned int dst_rate) {struct rsnd_adg *adg =rsnd_priv_to_adg (priv);struct device *dev =rsnd_priv_to_dev (priv);
@@ -91,18 +91,6 @@ find_rate:return 0 ; } -int rsnd_adg_set_convert_clk (struct rsnd_priv *priv, -struct rsnd_mod *mod, -unsigned int src_rate, -unsigned int dst_rate) -{ -if (rsnd_is_gen1 (priv)) -return rsnd_adg_set_convert_clk_gen1 (priv, mod, - src_rate, dst_rate); - -return -EINVAL ; -} -static void rsnd_adg_set_ssi_clk (struct rsnd_mod *mod,u32 val) {int id =rsnd_mod_id (mod);
sound/soc/sh/rcar/rsnd.h +4 -4
@@ -246,10 +246,10 @@ int rsnd_adg_probe(struct platform_device *pdev, struct rsnd_priv *priv);void rsnd_adg_remove (struct platform_device *pdev,struct rsnd_priv *priv); -int rsnd_adg_set_convert_clk (struct rsnd_priv *priv, -struct rsnd_mod *mod, -unsigned int src_rate, -unsigned int dst_rate); +int rsnd_adg_set_convert_clk_gen1 (struct rsnd_priv *priv, +struct rsnd_mod *mod, +unsigned int src_rate, +unsigned int dst_rate);/* * R-Car sound priv
sound/soc/sh/rcar/scu.c +35 -13
89 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 23/27 ASoC: rsnd: add rsnd_ssi_is_play()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
SCU needs SSI direction if Gen2.
Add rsnd_ssi_is_play() function for it.
--- sound/soc/sh/rcar/rsnd.h | 1 + sound/soc/sh/rcar/ssi.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -321,5 +321,6 @@ struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);struct rsnd_mod *rsnd_ssi_mod_get_frm_dai (struct rsnd_priv *priv,int dai_id,int is_play);int rsnd_ssi_is_pin_sharing (struct rsnd_mod *mod); +int rsnd_ssi_is_play (struct rsnd_mod *mod);#endif
sound/soc/sh/rcar/ssi.c +9 -2
@@ -494,7 +494,7 @@ struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv,if (rsnd_ssi_dai_id (ssi) != dai_id)continue ; - has_play = !!(rsnd_ssi_mode_flags (ssi) &RSND_SSI_PLAY ); + has_play =rsnd_ssi_is_play (&ssi->mod);if (is_play == has_play)return &ssi->mod;
@@ -518,6 +518,13 @@ int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod)return !!(rsnd_ssi_mode_flags (ssi) &RSND_SSI_CLK_PIN_SHARE ); } +int rsnd_ssi_is_play (struct rsnd_mod *mod) +{ +struct rsnd_ssi *ssi =rsnd_mod_to_ssi (mod); + +return !!(rsnd_ssi_mode_flags (ssi) &RSND_SSI_PLAY ); +} +static void rsnd_ssi_parent_clk_setup (struct rsnd_priv *priv,struct rsnd_ssi *ssi) {if (!rsnd_ssi_is_pin_sharing (&ssi->mod))
@@ -582,7 +589,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,if (pinfo->dma_id >0 ) { ret =rsnd_dma_init ( priv,rsnd_mod_to_dma (&ssi->mod), - (rsnd_ssi_mode_flags (ssi) &RSND_SSI_PLAY ), +rsnd_ssi_is_play (&ssi->mod), pinfo->dma_id, rsnd_ssi_dma_inquiry, rsnd_ssi_dma_complete);
Signature · 1 line
1.7.9.5
PATCH 24/27 ASoC: rsnd: extracts Gen1/Gen2 common parts
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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)
--- sound/soc/sh/rcar/rsnd.h | 2 +- sound/soc/sh/rcar/scu.c | 336 ++++++++++++++++++++++++++++------------------ sound/soc/sh/rcar/ssi.c | 5 - 3 files changed, 205 insertions(+), 138 deletions(-)
sound/soc/sh/rcar/rsnd.h +1 -1
@@ -48,7 +48,7 @@ enum rsnd_reg {RSND_REG_SRC_IFSCR ,RSND_REG_SRC_IFSVR ,RSND_REG_SRC_SRCCR , -RSND_REG_SRC_MNFSR , +RSND_REG_SRC_MNFSR ,/* for Gen1 */ /* ADG */ RSND_REG_BRRA,
sound/soc/sh/rcar/scu.c +204 -132
412 lines not on this page · raw message
sound/soc/sh/rcar/ssi.c +0 -5
@@ -363,16 +363,11 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);/* enable PIO IRQ */ ssi->cr_etc =UIEN |OIEN |DIEN ; -/* enable PIO interrupt if gen2 */ -if (rsnd_is_gen2 (priv)) -rsnd_mod_write (&ssi->mod,INT_ENABLE ,0x0f000000 ); -rsnd_ssi_hw_start (ssi, rdai, io);return 0 ;
Signature · 1 line
1.7.9.5
PATCH 25/27 ASoC: rsnd: remove SSI dependent DMAEngine callback
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- sound/soc/sh/rcar/core.c | 38 ++++++++++++++++++++++++++----------- sound/soc/sh/rcar/rsnd.h | 10 +++++----- sound/soc/sh/rcar/ssi.c | 47 ++++++++-------------------------------------- 3 files changed, 40 insertions(+), 55 deletions(-)
sound/soc/sh/rcar/core.c +27 -11
@@ -143,6 +143,7 @@ static void rsnd_dma_continue(struct rsnd_dma *dma)void rsnd_dma_start (struct rsnd_dma *dma) {/* push both A and B plane*/ + dma->offset =0 ; dma->submit_loop =2 ;__rsnd_dma_start (dma); }
@@ -157,12 +158,26 @@ void rsnd_dma_stop(struct rsnd_dma *dma)static void rsnd_dma_complete (void *data) {struct rsnd_dma *dma = (struct rsnd_dma *)data; +struct rsnd_mod *mod =rsnd_dma_to_mod (dma);struct rsnd_priv *priv =rsnd_mod_to_priv (rsnd_dma_to_mod (dma)); +struct rsnd_dai_stream *io =rsnd_mod_to_io (mod);unsigned long flags;rsnd_lock (priv, flags); - dma->complete (dma); +/* +* Renesas sound Gen1 needs 1 DMAC, +* Gen2 needs 2 DMAC. +* In Gen2 case, it are Audio-DMAC, and Audio-DMAC-peri-peri. +* But, Audio-DMAC-peri-peri doesn't have interrupt, +* and this driver is assuming that here. +* +* If Audio-DMAC-peri-peri has interrpt, +* rsnd_dai_pointer_update() will be called twice, +* ant it will breaks io->byte_pos +*/ + +rsnd_dai_pointer_update (io, io->byte_per_period);if (dma->submit_loop)rsnd_dma_continue (dma);
@@ -172,17 +187,21 @@ static void rsnd_dma_complete(void *data)static void __rsnd_dma_start (struct rsnd_dma *dma) { -struct rsnd_priv *priv =rsnd_mod_to_priv (rsnd_dma_to_mod (dma)); +struct rsnd_mod *mod =rsnd_dma_to_mod (dma); +struct rsnd_priv *priv =rsnd_mod_to_priv (mod); +struct rsnd_dai_stream *io =rsnd_mod_to_io (mod); +struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io);struct device *dev =rsnd_priv_to_dev (priv);struct dma_async_tx_descriptor *desc;dma_addr_t buf; -size_t len; +size_t len = io->byte_per_period;int i;for (i =0 ; i < dma->submit_loop; i++) { -if (dma->inquiry (dma, &buf, &len) <0 ) -return ; + buf = runtime->dma_addr + +rsnd_dai_pointer_offset (io, dma->offset + len); + dma->offset = len; desc = dmaengine_prep_slave_single( dma->chan, buf, len, dma->dir,
@@ -217,10 +236,7 @@ int rsnd_dma_available(struct rsnd_dma *dma) }int rsnd_dma_init (struct rsnd_priv *priv,struct rsnd_dma *dma, -int is_play,int id, -int (*inquiry)(struct rsnd_dma *dma, -dma_addr_t *buf,int *len), -int (*complete)(struct rsnd_dma *dma)) +int is_play,int id) {struct device *dev =rsnd_priv_to_dev (priv);struct dma_slave_config cfg;
@@ -253,8 +269,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, goto rsnd_dma_init_err; dma->dir = is_play ?DMA_TO_DEVICE :DMA_FROM_DEVICE ; - dma->inquiry = inquiry; - dma->complete = complete;INIT_WORK (&dma->work, rsnd_dma_do_work);return 0 ;
@@ -307,6 +321,7 @@ int rsnd_dai_connect(struct rsnd_dai *rdai, }list_add_tail (&mod->list, &io->head); + mod->io = io;return 0 ; }
@@ -314,6 +329,7 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,int rsnd_dai_disconnect (struct rsnd_mod *mod) {list_del_init (&mod->list); + mod->io =NULL ;return 0 ; }
sound/soc/sh/rcar/rsnd.h +5 -5
@@ -100,19 +100,16 @@ struct rsnd_dma {struct work_struct work;struct dma_chan *chan;enum dma_data_direction dir; -int (*inquiry)(struct rsnd_dma *dma,dma_addr_t *buf,int *len); -int (*complete)(struct rsnd_dma *dma);int submit_loop; +int offset;/* it cares A/B plane */ };void rsnd_dma_start (struct rsnd_dma *dma);void rsnd_dma_stop (struct rsnd_dma *dma);int rsnd_dma_available (struct rsnd_dma *dma);int rsnd_dma_init (struct rsnd_priv *priv,struct rsnd_dma *dma, -int is_play,int id, -int (*inquiry)(struct rsnd_dma *dma,dma_addr_t *buf,int *len), -int (*complete)(struct rsnd_dma *dma)); +int is_play,int id);void rsnd_dma_quit (struct rsnd_priv *priv,struct rsnd_dma *dma);
@@ -137,17 +134,20 @@ struct rsnd_mod_ops { struct rsnd_dai_stream *io); }; +struct rsnd_dai_stream ;struct rsnd_mod {int id;struct rsnd_priv *priv;struct rsnd_mod_ops *ops;struct list_head list;/* connect to rsnd_dai playback/capture */ struct rsnd_dma dma; +struct rsnd_dai_stream *io; };#define rsnd_mod_to_priv (mod) ((mod)->priv)#define rsnd_mod_to_dma (mod) (&(mod)->dma)#define rsnd_dma_to_mod (_dma) container_of((_dma), struct rsnd_mod, dma) +#define rsnd_mod_to_io (mod) ((mod)->io)#define rsnd_mod_id (mod) ((mod)->id)#define for_each_rsnd_mod (pos, n, io) \ list_for_each_entry_safe(pos, n, &(io)->head, list)
sound/soc/sh/rcar/ssi.c +8 -39
106 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 26/27 ASoC: rsnd: rsnd_ssi_probe() goes forwarder than rsnd_scu_probe()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
rsnd_ssi_probe() goes forwarder than rsnd_scu_probe(), since scu will need ssi information on Gen2
--- sound/soc/sh/rcar/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/core.c +3 -3
@@ -763,15 +763,15 @@ static int rsnd_probe(struct platform_device *pdev)if (ret)return ret; - ret =rsnd_scu_probe (pdev, info, priv); + ret =rsnd_ssi_probe (pdev, info, priv);if (ret)return ret; - ret =rsnd_adg_probe (pdev, info, priv); + ret =rsnd_scu_probe (pdev, info, priv);if (ret)return ret; - ret =rsnd_ssi_probe (pdev, info, priv); + ret =rsnd_adg_probe (pdev, info, priv);if (ret)return ret;
Signature · 1 line
1.7.9.5
PATCH 27/27 ASoC: rsnd: add Gen2 SRC and DMAEngine support
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- include/sound/rcar_snd.h | 6 ++ sound/soc/sh/rcar/adg.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/sh/rcar/gen.c | 26 +++++++++ sound/soc/sh/rcar/rsnd.h | 25 +++++++++ sound/soc/sh/rcar/scu.c | 117 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 312 insertions(+)
include/sound/rcar_snd.h +6 -0
@@ -55,9 +55,15 @@ struct rsnd_ssi_platform_info {*/ #define RSND_SCU_USE_HPBIF (1 << 31)/* it needs RSND_SSI_DEPENDENT */ +#define RSND_SCU_SET (rate, _dma_id) \ + { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } +#define RSND_SCU_UNUSED \ + { .flags = 0, .convert_rate = 0, .dma_id = 0, } +struct rsnd_scu_platform_info {u32 flags;u32 convert_rate;/* sampling rate convert */ +int dma_id;/* for Gen2 SCU */ };/*
sound/soc/sh/rcar/adg.c +138 -0
144 lines not on this page · raw message
sound/soc/sh/rcar/gen.c +26 -0
@@ -229,14 +229,40 @@ static int rsnd_gen2_regmap_init(struct rsnd_priv *priv, struct rsnd_gen *gen)RSND_GEN2_S_REG (gen,SSIU ,SSI_MODE0 ,0x800 ),RSND_GEN2_S_REG (gen,SSIU ,SSI_MODE1 ,0x804 ),/* FIXME: it needs SSI_MODE2/3 in the future */ +RSND_GEN2_S_REG (gen,SSIU ,SSI_CONTROL ,0x810 ), +RSND_GEN2_M_REG (gen,SSIU ,SSI_BUSIF_MODE ,0x0 ,0x80 ), +RSND_GEN2_M_REG (gen,SSIU ,SSI_BUSIF_ADINR ,0x4 ,0x80 ), +RSND_GEN2_M_REG (gen,SSIU ,SSI_CTRL ,0x10 ,0x80 ),RSND_GEN2_M_REG (gen,SSIU ,INT_ENABLE ,0x18 ,0x80 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_BUSIF_MODE ,0x0 ,0x20 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_ROUTE_MODE0 ,0xc ,0x20 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_CTRL ,0x10 ,0x20 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_SWRSR ,0x200 ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_SRCIR ,0x204 ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_ADINR ,0x214 ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_IFSCR ,0x21c ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_IFSVR ,0x220 ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_SRCCR ,0x224 ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_BSDSR ,0x22c ,0x40 ), +RSND_GEN2_M_REG (gen,SCU ,SRC_BSISR ,0x238 ,0x40 ), +RSND_GEN2_S_REG (gen,ADG ,BRRA ,0x00 ),RSND_GEN2_S_REG (gen,ADG ,BRRB ,0x04 ),RSND_GEN2_S_REG (gen,ADG ,SSICKR ,0x08 ),RSND_GEN2_S_REG (gen,ADG ,AUDIO_CLK_SEL0 ,0x0c ),RSND_GEN2_S_REG (gen,ADG ,AUDIO_CLK_SEL1 ,0x10 ),RSND_GEN2_S_REG (gen,ADG ,AUDIO_CLK_SEL2 ,0x14 ), +RSND_GEN2_S_REG (gen,ADG ,SRCIN_TIMSEL0 ,0x34 ), +RSND_GEN2_S_REG (gen,ADG ,SRCIN_TIMSEL1 ,0x38 ), +RSND_GEN2_S_REG (gen,ADG ,SRCIN_TIMSEL2 ,0x3c ), +RSND_GEN2_S_REG (gen,ADG ,SRCIN_TIMSEL3 ,0x40 ), +RSND_GEN2_S_REG (gen,ADG ,SRCIN_TIMSEL4 ,0x44 ), +RSND_GEN2_S_REG (gen,ADG ,SRCOUT_TIMSEL0 ,0x48 ), +RSND_GEN2_S_REG (gen,ADG ,SRCOUT_TIMSEL1 ,0x4c ), +RSND_GEN2_S_REG (gen,ADG ,SRCOUT_TIMSEL2 ,0x50 ), +RSND_GEN2_S_REG (gen,ADG ,SRCOUT_TIMSEL3 ,0x54 ), +RSND_GEN2_S_REG (gen,ADG ,SRCOUT_TIMSEL4 ,0x58 ),RSND_GEN2_M_REG (gen,SSI ,SSICR ,0x00 ,0x40 ), RSND_GEN2_M_REG(gen, SSI, SSISR, 0x04, 0x40),
sound/soc/sh/rcar/rsnd.h +25 -0
@@ -37,6 +37,11 @@ enum rsnd_reg {RSND_REG_SRC_TMG_SEL1 ,/* for Gen1 */ RSND_REG_SRC_TMG_SEL2 ,/* for Gen1 */ RSND_REG_SRC_ROUTE_CTRL ,/* for Gen1 */ +RSND_REG_SRC_CTRL ,/* for Gen2 */ +RSND_REG_SSI_CTRL ,/* for Gen2 */ +RSND_REG_SSI_CONTROL , +RSND_REG_SSI_BUSIF_MODE ,/* for Gen2 */ +RSND_REG_SSI_BUSIF_ADINR ,/* for Gen2 */ RSND_REG_SSI_MODE0 ,RSND_REG_SSI_MODE1 , RSND_REG_INT_ENABLE, /* for Gen2 */
@@ -49,6 +54,8 @@ enum rsnd_reg {RSND_REG_SRC_IFSVR ,RSND_REG_SRC_SRCCR ,RSND_REG_SRC_MNFSR ,/* for Gen1 */ +RSND_REG_SRC_BSDSR ,/* for Gen2 */ +RSND_REG_SRC_BSISR ,/* for Gen2 */ /* ADG */ RSND_REG_BRRA,
@@ -60,6 +67,16 @@ enum rsnd_reg {RSND_REG_AUDIO_CLK_SEL3 ,/* for Gen1 */ RSND_REG_AUDIO_CLK_SEL4 ,/* for Gen1 */ RSND_REG_AUDIO_CLK_SEL5 ,/* for Gen1 */ +RSND_REG_SRCIN_TIMSEL0 ,/* for Gen2 */ +RSND_REG_SRCIN_TIMSEL1 ,/* for Gen2 */ +RSND_REG_SRCIN_TIMSEL2 ,/* for Gen2 */ +RSND_REG_SRCIN_TIMSEL3 ,/* for Gen2 */ +RSND_REG_SRCIN_TIMSEL4 ,/* for Gen2 */ +RSND_REG_SRCOUT_TIMSEL0 ,/* for Gen2 */ +RSND_REG_SRCOUT_TIMSEL1 ,/* for Gen2 */ +RSND_REG_SRCOUT_TIMSEL2 ,/* for Gen2 */ +RSND_REG_SRCOUT_TIMSEL3 ,/* for Gen2 */ +RSND_REG_SRCOUT_TIMSEL4 ,/* for Gen2 */ /* SSI */ RSND_REG_SSICR,
@@ -250,6 +267,14 @@ int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv,struct rsnd_mod *mod, unsigned int src_rate, unsigned int dst_rate); +int rsnd_adg_set_convert_clk_gen2 (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io, +unsigned int src_rate, +unsigned int dst_rate); +int rsnd_adg_set_convert_timing_gen2 (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);/* * R-Car sound priv
sound/soc/sh/rcar/scu.c +117 -0
139 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 8 lines · Kuninori Morimoto
Hi Mark
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.These patches are based on asoc-v3.14-3 tag
Hi, will these be needed for audio support on the R8A7790?
If possible, could you please publish a git tree with the patches in to make it easier to add these to our development trees for testing.
Signature · 3 lines
Ben Dooks, [email protected], http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.
Hi Ben
Quoted 7 lines
Quoted 5 lines
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.These patches are based on asoc-v3.14-3 tag
Hi, will these be needed for audio support on the R8A7790?
If you want to use sound via DMA transfer, YES.
If you don't care about it, you can use PIO transfer version.
Then, can you check these patches ?
Subject: [PATCH] ARM: shmobile: r8a7790/r8a7778: audio support
Date: Mon, 13 Jan 2014 18:24:40 -0800 (PST)
Quoted 2 lines
If possible, could you please publish a git tree with the patches in to make it easier to add these to our development trees for testing.
I'm happy to send r8a7790 sound support patches.
But, it has many branch dependency.
Do you need it immediately ?
Best regards
---
Kuninori Morimoto
Hi Ben again
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.These patches are based on asoc-v3.14-3 tag
Hi, will these be needed for audio support on the R8A7790?
If you want to use sound via DMA transfer, YES.
I'm sorry, this was fault.
If you want to use SRC, you need these patches.
If you want to use just DMA transfer, these are not needed.
Mark Brown
maintainerQuoted 6 lines · Kuninori Morimoto
Hi Mark
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.
I've applied all these but as discussed please do work towards using the generic dmaengine code (with extensions to handle non-cyclic DMA) and DPCM.
Hi Mark
Quoted 7 lines
Quoted 3 lines
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.I've applied all these but as discussed please do work towards using the generic dmaengine code (with extensions to handle non-cyclic DMA) and DPCM.
Thank you for your help.
I'll try to update non-cyclic DMA code as next step. (DPCM is next next step)
Best regards
---
Kuninori Morimoto
Quoted 7 lines · Kuninori Morimoto
Hi Mark
Quoted 4 lines
Quoted 3 lines
These are Renesas Gen2 DMAEngine support patches.
#1 - #26 are cleanup/prepare patches.
#27 adds Gen2 DMAEngine support.
Quoted 6 lines
Quoted 3 lines
I've applied all these but as discussed please do work towards using the generic dmaengine code (with extensions to handle non-cyclic DMA) and DPCM.
Thank you for your help.
I'll try to update non-cyclic DMA code as next step.
I still think the emulation of the transfers is better done in the DMA driver rather than in the audio driver. The DMA driver has much more state information available than the audio driver, which should make the implementation on one hand simpler and on the other hand more reliable.
- Lars
Mark Brown
maintainerQuoted 5 lines · Lars-Peter Clausen
I still think the emulation of the transfers is better done in the DMA driver rather than in the audio driver. The DMA driver has much more state information available than the audio driver, which should make the implementation on one hand simpler and on the other hand more reliable.
On the other hand it's a problem that several devices have so we should be able to factor out the interface matching so it should have at least some of the code in one of the frameworks, dmaengine would seem natural too me too but apparently audio is about the only user of cyclic DMA so IIRC the DMA guys were pushing back on doing it there.
Quoted 8 lines · Mark Brown
Quoted 5 lines · Lars-Peter Clausen
I still think the emulation of the transfers is better done in the DMA driver rather than in the audio driver. The DMA driver has much more state information available than the audio driver, which should make the implementation on one hand simpler and on the other hand more reliable.
Quoted 6 lines
On the other hand it's a problem that several devices have so we should be able to factor out the interface matching so it should have at least some of the code in one of the frameworks, dmaengine would seem natural too me too but apparently audio is about the only user of cyclic DMA so IIRC the DMA guys were pushing back on doing it there.
The virt_dma helper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users of virt_dma already implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.
- Lars
Mark Brown
maintainerQuoted 7 lines · Lars-Peter Clausen
The
virt_dmahelper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users ofvirt_dmaalready implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.
OK, I had a brief look and that does seem like the way forwards - I had been remembering the last time this was discussed when the DMA guys were pretty uncomfortable with the idea of doing things there but it seems things are different now.
Quoted 10 lines · Mark Brown
Quoted 7 lines · Lars-Peter Clausen
The
virt_dmahelper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users ofvirt_dmaalready implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.
Quoted 4 lines
OK, I had a brief look and that does seem like the way forwards - I had been remembering the last time this was discussed when the DMA guys were pretty uncomfortable with the idea of doing things there but it seems things are different now.
I don't want virt_dma to do any tracking of which part of the descriptor is to be submitted next, because that needlessly makes virt_dma harder to use on hardware which you can generate the scatterlist in memory and have the hardware walk it, only notifying when it reaches the end of the list.
I also want to leave the door open for DMA implementations that decide to extend such a list when the next descriptor(s) is/are issued, thereby allowing hardware to move on to the next DMA task with the software only taking care of the status update and callback notification.
Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad. Estimate before purchase was "up to 13.2Mbit".
Quoted 16 lines · Russell King - ARM Linux
Quoted 10 lines · Mark Brown
Quoted 7 lines · Lars-Peter Clausen
The
virt_dmahelper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users ofvirt_dmaalready implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.Quoted 4 lines
OK, I had a brief look and that does seem like the way forwards - I had been remembering the last time this was discussed when the DMA guys were pretty uncomfortable with the idea of doing things there but it seems things are different now.
Quoted 4 lines
I don't want
virt_dmato do any tracking of which part of the descriptor is to be submitted next, because that needlessly makesvirt_dmaharder to use on hardware which you can generate the scatterlist in memory and have the hardware walk it, only notifying when it reaches the end of the list.
Or maybe make it a lib orthogonal to or on top of virt_dma. A soft sg lib for devices that don't have hardware support for scatterlist is definitely something that would be beneficial to the dmaengine framework as there are quite a few of those driver which all have more or less the same code over and over again. With such a lib cyclic support comes for free.
- Lars