ASoC: rsnd: new module path method and DT support
Subsystems (5)
cover ASoC: rsnd: new module path method and DT support
Hi Mark
These are Renesas R-Car sound driver patches.
#1 - #7 are clean up patches.
#8 - #18 adds new module path method
#19 adds DT support
Now, Mark's ALSA branch doesn't include SH-ARM platform branch. Thus, these patches are keeping compatible for it at this point. Compatible code will be removed after merge.
Kuninori Morimoto (19):
1) ASoC: rsnd: move priv member settings to upper side
2) ASoC: rsnd: move rsnd_mod_call() macro
3) ASoC: rsnd: remove verbose function parameter
4) ASoC: rsnd: remove verbose debug message from scu/ssi
5) ASoC: rsnd: unify rdai naming
6) ASoC: rsnd: add .set_sysclk on snd_soc_dai_ops
7) ASoC: rsnd: tidyup RSND_SSI_xxx flags
8) ASoC: rsnd: run rsnd_path_init() when probe() timing
9) ASoC: rsnd: use mod array instead of list on rdai
10) ASoC: rsnd: get ssi/scu from rsnd_dai_stream
11) ASoC: rsnd: add struct rsnd_dai_platform_info
12) ASoC: rsnd: use function pointer for each probe
13) ASoC: rsnd: Get correct SCU ID
14) ASoC: rsnd: add rsnd_scu_enable_ssi_irq()
15) ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI
16) ASoC: rsnd: add probe/remove callback on rsnd_mod_ops
17) ASoC: rsnd: use mod probe method on SCU
18) ASoC: rsnd: use mod probe method on SSI
19) ASoC: rsnd: add DeviceTree support
.../devicetree/bindings/sound/renesas,rsnd.txt | 101 ++++++ include/sound/rcar_snd.h | 21 +- sound/soc/sh/rcar/adg.c | 2 +- sound/soc/sh/rcar/core.c | 380 ++++++++++++++++---- sound/soc/sh/rcar/gen.c | 78 +--- sound/soc/sh/rcar/rsnd.h | 86 +++-- sound/soc/sh/rcar/scu.c | 188 ++++++---- sound/soc/sh/rcar/ssi.c | 191 +++++++--- 8 files changed, 759 insertions(+), 288 deletions(-)
PATCH 1/19 ASoC: rsnd: move priv member settings to upper side
From: Kuninori Morimoto <[email protected]>
There is no big meaning, but preparation for platform dai support
--- sound/soc/sh/rcar/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/core.c +4 -4
@@ -594,6 +594,10 @@ static int rsnd_dai_probe(struct platform_device *pdev,return -ENOMEM ; } + priv->dai_nr = dai_nr; + priv->daidrv = drv; + priv->rdai = rdai; +for (i =0 ; i < dai_nr; i++) { pmod =rsnd_ssi_mod_get_frm_dai (priv, i,1 );
@@ -630,10 +634,6 @@ static int rsnd_dai_probe(struct platform_device *pdev, cmod ? "capture" : " -- "); } - priv->dai_nr = dai_nr; - priv->daidrv = drv; - priv->rdai = rdai; -return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 2/19 ASoC: rsnd: move rsnd_mod_call() macro
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
core.c is the only user of rsnd_mod_call() macro.
Move it to core.c from rsnd.h
--- sound/soc/sh/rcar/core.c | 34 ++++++++++++++++++++++++---------- sound/soc/sh/rcar/rsnd.h | 13 ------------- 2 files changed, 24 insertions(+), 23 deletions(-)
sound/soc/sh/rcar/core.c +24 -10
@@ -291,16 +291,30 @@ void rsnd_dma_quit(struct rsnd_priv *priv,/* * rsnd_dai functions */ -#define rsnd_dai_call (rdai, io, fn) \ -({ \ - struct rsnd_mod *mod, *n; \ - int ret = 0; \ - for_each_rsnd_mod(mod, n, io) { \ - ret = rsnd_mod_call(mod, fn, rdai, io); \ - if (ret < 0) \ - break; \ - } \ - ret; \ +#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 : \ + __rsnd_mod_call(mod, func, (rdai), (io))) + +#define rsnd_dai_call (rdai, io, fn) \ +({ \ + struct rsnd_mod *mod, *n; \ + int ret = 0; \ + for_each_rsnd_mod(mod, n, (io)) { \ + ret = rsnd_mod_call(mod, fn, (rdai), (io)); \ + if (ret < 0) \ + break; \ + } \ + ret; \ }) int rsnd_dai_connect(struct rsnd_dai *rdai,
sound/soc/sh/rcar/rsnd.h +0 -13
@@ -169,19 +169,6 @@ 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 : \ - __rsnd_mod_call(mod, func, rdai, io)) void rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod,
Signature · 1 line
1.7.9.5
PATCH 3/19 ASoC: rsnd: remove verbose function parameter
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
priv has rcar_snd_info pointer.
having priv and info in same time is verbose.
--- sound/soc/sh/rcar/adg.c | 1 - sound/soc/sh/rcar/core.c | 11 +++++------ sound/soc/sh/rcar/gen.c | 7 ++----- sound/soc/sh/rcar/rsnd.h | 5 +---- sound/soc/sh/rcar/scu.c | 2 +- sound/soc/sh/rcar/ssi.c | 2 +- 6 files changed, 10 insertions(+), 18 deletions(-)
sound/soc/sh/rcar/adg.c +0 -1
@@ -391,7 +391,6 @@ static void rsnd_adg_ssi_clk_init(struct rsnd_priv *priv, struct rsnd_adg *adg) }int rsnd_adg_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) {struct rsnd_adg *adg;
sound/soc/sh/rcar/core.c +5 -6
@@ -577,7 +577,6 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { };static int rsnd_dai_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) {struct snd_soc_dai_driver *drv;
@@ -773,23 +772,23 @@ static int rsnd_probe(struct platform_device *pdev)/* * init each module */ - ret =rsnd_gen_probe (pdev, info, priv); + ret =rsnd_gen_probe (pdev, priv);if (ret)return ret; - ret =rsnd_ssi_probe (pdev, info, priv); + ret =rsnd_ssi_probe (pdev, priv);if (ret)return ret; - ret =rsnd_scu_probe (pdev, info, priv); + ret =rsnd_scu_probe (pdev, priv);if (ret)return ret; - ret =rsnd_adg_probe (pdev, info, priv); + ret =rsnd_adg_probe (pdev, priv);if (ret)return ret; - ret =rsnd_dai_probe (pdev, info, priv); + ret =rsnd_dai_probe (pdev, priv);if (ret)return ret;
sound/soc/sh/rcar/gen.c +2 -5
@@ -276,7 +276,6 @@ static int rsnd_gen2_regmap_init(struct rsnd_priv *priv, struct rsnd_gen *gen) }static int rsnd_gen2_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);
@@ -374,7 +373,6 @@ static int rsnd_gen1_regmap_init(struct rsnd_priv *priv, struct rsnd_gen *gen) }static int rsnd_gen1_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);
@@ -419,7 +417,6 @@ static int rsnd_gen1_probe(struct platform_device *pdev,* Gen */ int rsnd_gen_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);
@@ -436,9 +433,9 @@ int rsnd_gen_probe(struct platform_device *pdev, ret = -ENODEV ;if (rsnd_is_gen1 (priv)) - ret =rsnd_gen1_probe (pdev, info, priv); + ret =rsnd_gen1_probe (pdev, priv);else if (rsnd_is_gen2 (priv)) - ret =rsnd_gen2_probe (pdev, info, priv); + ret =rsnd_gen2_probe (pdev, priv);if (ret <0 )dev_err (dev,"unknown generation R-Car sound device\n" );
sound/soc/sh/rcar/rsnd.h +1 -4
@@ -226,7 +226,6 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);* R-Car Gen1/Gen2 */ int rsnd_gen_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv);void rsnd_gen_remove (struct platform_device *pdev,struct rsnd_priv *priv);
@@ -248,7 +247,6 @@ void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,int rsnd_adg_ssi_clk_stop (struct rsnd_mod *mod);int rsnd_adg_ssi_clk_try_start (struct rsnd_mod *mod,unsigned int rate);int rsnd_adg_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv);void rsnd_adg_remove (struct platform_device *pdev,struct rsnd_priv *priv);
@@ -305,6 +303,7 @@ struct rsnd_priv { };#define rsnd_priv_to_dev (priv) ((priv)->dev) +#define rsnd_priv_to_info (priv) ((priv)->info)#define rsnd_lock (priv, flags) spin_lock_irqsave(&priv->lock, flags)#define rsnd_unlock (priv, flags) spin_unlock_irqrestore(&priv->lock, flags)
@@ -312,7 +311,6 @@ struct rsnd_priv {* R-Car SCU */ int rsnd_scu_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv);void rsnd_scu_remove (struct platform_device *pdev,struct rsnd_priv *priv);
@@ -327,7 +325,6 @@ unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,* R-Car SSI */ int rsnd_ssi_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv);void rsnd_ssi_remove (struct platform_device *pdev,struct rsnd_priv *priv);
sound/soc/sh/rcar/scu.c +1 -1
@@ -604,9 +604,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) }int rsnd_scu_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) { +struct rcar_snd_info *info =rsnd_priv_to_info (priv);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_scu *scu;struct rsnd_mod_ops *ops;
sound/soc/sh/rcar/ssi.c +1 -1
@@ -511,9 +511,9 @@ static void rsnd_ssi_parent_clk_setup(struct rsnd_priv *priv, struct rsnd_ssi *s }int rsnd_ssi_probe (struct platform_device *pdev, -struct rcar_snd_info *info,struct rsnd_priv *priv) { +struct rcar_snd_info *info =rsnd_priv_to_info (priv);struct rsnd_ssi_platform_info *pinfo;struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_mod_ops *ops;
Signature · 1 line
1.7.9.5
PATCH 4/19 ASoC: rsnd: remove verbose debug message from scu/ssi
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
scu/ssi probe() already have more detail debug message.
--- sound/soc/sh/rcar/scu.c | 1 - sound/soc/sh/rcar/ssi.c | 2 -- 2 files changed, 3 deletions(-)
sound/soc/sh/rcar/scu.c +0 -1
@@ -663,7 +663,6 @@ int rsnd_scu_probe(struct platform_device *pdev,dev_dbg (dev,"SCU%d probed\n" , i); } -dev_dbg (dev,"scu probed\n" );return 0 ; }
sound/soc/sh/rcar/ssi.c +0 -2
@@ -589,8 +589,6 @@ int rsnd_ssi_probe(struct platform_device *pdev,rsnd_ssi_parent_clk_setup (priv, ssi); } -dev_dbg (dev,"ssi probed\n" ); -return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 5/19 ASoC: rsnd: unify rdai naming
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
struct rsnd_dai is called as "rdai",
but its size has been called as "dai_nr".
Unify these as "rdai"
--- sound/soc/sh/rcar/core.c | 8 ++++---- sound/soc/sh/rcar/rsnd.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
sound/soc/sh/rcar/core.c +4 -4
@@ -352,7 +352,7 @@ int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai) {int id = rdai - priv->rdai; -if ((id <0 ) || (id >=rsnd_dai_nr (priv))) +if ((id <0 ) || (id >=rsnd_rdai_nr (priv)))return -EINVAL ;return id;
@@ -360,7 +360,7 @@ int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai)struct rsnd_dai *rsnd_dai_get (struct rsnd_priv *priv,int id) { -if ((id <0 ) || (id >=rsnd_dai_nr (priv))) +if ((id <0 ) || (id >=rsnd_rdai_nr (priv)))return NULL ;return priv->rdai + id;
@@ -607,7 +607,7 @@ static int rsnd_dai_probe(struct platform_device *pdev,return -ENOMEM ; } - priv->dai_nr = dai_nr; + priv->rdai_nr = dai_nr; priv->daidrv = drv; priv->rdai = rdai;
@@ -802,7 +802,7 @@ static int rsnd_probe(struct platform_device *pdev) } ret =snd_soc_register_component (dev, &rsnd_soc_component, - priv->daidrv,rsnd_dai_nr (priv)); + priv->daidrv,rsnd_rdai_nr (priv));if (ret <0 ) {dev_err (dev,"cannot snd dai register\n" ); goto exit_snd_soc;
sound/soc/sh/rcar/rsnd.h +3 -3
@@ -202,10 +202,10 @@ struct rsnd_dai { unsigned int data_alignment:1; }; -#define rsnd_dai_nr (priv) ((priv)->dai_nr) +#define rsnd_rdai_nr (priv) ((priv)->rdai_nr)#define for_each_rsnd_dai (rdai, priv, i) \ for (i = 0; \ - (i < rsnd_dai_nr(priv)) && \ + (i < rsnd_rdai_nr(priv)) && \ ((rdai) = rsnd_dai_get(priv, i)); \ i++)
@@ -299,7 +299,7 @@ struct rsnd_priv {*/ struct snd_soc_dai_driver *daidrv;struct rsnd_dai *rdai; -int dai_nr; +int rdai_nr; };#define rsnd_priv_to_dev (priv) ((priv)->dev)
Signature · 1 line
1.7.9.5
PATCH 6/19 ASoC: rsnd: add .set_sysclk on snd_soc_dai_ops
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
This patch adds struct snd_soc_dai_ops :: set_sysclk. But, it do nothing, since rsnd sysclk is controlled by ADG. Without this patch, simple-card init will be failed if DT case.
--- sound/soc/sh/rcar/core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/soc/sh/rcar/core.c +8 -0
@@ -571,9 +571,17 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)return 0 ; } +static int rsnd_soc_dai_set_sysclk (struct snd_soc_dai *codec_dai, +int clk_id,unsigned int freq,int dir) +{ +/* rsnd sysclk is controlled by ADG */ +return 0 ; +} +static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .trigger = rsnd_soc_dai_trigger, .set_fmt = rsnd_soc_dai_set_fmt, + .set_sysclk = rsnd_soc_dai_set_sysclk, }; static int rsnd_dai_probe(struct platform_device *pdev,
Signature · 1 line
1.7.9.5
PATCH 7/19 ASoC: rsnd: tidyup RSND_SSI_xxx flags
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
6f3ab6c1c022e7a4877d38940cd45ae7804a15e2
(ASoC: rsnd: remove pin sync option)
added unused RSND_SSI_CLK_FROM_ADG flag.
It should remove RSND_SSI_SYNC.
--- include/sound/rcar_snd.h | 3 --- 1 file changed, 3 deletions(-)
include/sound/rcar_snd.h +0 -3
@@ -34,9 +34,6 @@* B : SSI direction */ #define RSND_SSI_CLK_PIN_SHARE (1 << 31) -#define RSND_SSI_SYNC (1 << 29)/* SSI34_sync etc */ -#define RSND_SSI_CLK_FROM_ADG (1 << 30)/* clock parent is master */ -#define RSND_SSI_PLAY (1 << 24)#define RSND_SSI_SET (_dai_id, _dma_id, _pio_irq, _flags) \
Signature · 1 line
1.7.9.5
PATCH 8/19 ASoC: rsnd: run rsnd_path_init() when probe() timing
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 94 ++++++++++++++++++++++++++++++++++++++-------- sound/soc/sh/rcar/gen.c | 56 --------------------------- sound/soc/sh/rcar/rsnd.h | 9 ----- 3 files changed, 78 insertions(+), 81 deletions(-)
sound/soc/sh/rcar/core.c +78 -16
@@ -317,9 +317,9 @@ void rsnd_dma_quit(struct rsnd_priv *priv, ret; \ }) -int rsnd_dai_connect (struct rsnd_dai *rdai, -struct rsnd_mod *mod, -struct rsnd_dai_stream *io) +static int rsnd_dai_connect (struct rsnd_dai *rdai, +struct rsnd_mod *mod, +struct rsnd_dai_stream *io) {if (!mod)return -EIO ;
@@ -340,7 +340,7 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,return 0 ; } -int rsnd_dai_disconnect (struct rsnd_mod *mod) +static int rsnd_dai_disconnect (struct rsnd_mod *mod) {list_del_init (&mod->list); mod->io =NULL ;
@@ -418,10 +418,6 @@ static int rsnd_dai_stream_init(struct rsnd_dai_stream *io, {struct snd_pcm_runtime *runtime = substream->runtime; -if (!list_empty (&io->head)) -return -EIO ; - -INIT_LIST_HEAD (&io->head); io->substream = substream; io->byte_pos =0 ; io->period_pos =0 ;
@@ -476,10 +472,6 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,if (ret <0 ) goto dai_trigger_end; - ret =rsnd_gen_path_init (priv, rdai, io); -if (ret <0 ) - goto dai_trigger_end; - ret =rsnd_dai_call (rdai, io, init);if (ret <0 ) goto dai_trigger_end;
@@ -497,10 +489,6 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,if (ret <0 ) goto dai_trigger_end; - ret =rsnd_gen_path_exit (priv, rdai, io); -if (ret <0 ) - goto dai_trigger_end; - ret =rsnd_platform_call (priv, dai, stop, ssi_id);if (ret <0 ) goto dai_trigger_end;
@@ -584,6 +572,70 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .set_sysclk = rsnd_soc_dai_set_sysclk, }; +static int rsnd_path_init (struct rsnd_priv *priv, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_mod *mod; +int ret; +int id; + +/* +* Gen1 is created by SRU/SSI, and this SRU is base module of +* Gen2's SCU/SSIU/SSI. (Gen2 SCU/SSIU came from SRU) +* +* Easy image is.. +* Gen1 SRU = Gen2 SCU + SSIU + etc +* +* Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is +* using fixed path. +* +* Then, SSI id = SCU id here +*/ +/* get SSI's ID */ + mod =rsnd_ssi_mod_get_frm_dai (priv, +rsnd_dai_id (priv, rdai), +rsnd_dai_is_play (rdai, io)); +if (!mod) +return 0 ; + id =rsnd_mod_id (mod); + ret =0 ; + +/* SCU */ + mod =rsnd_scu_mod_get (priv, id); +if (mod) { + ret =rsnd_dai_connect (rdai, mod, io); +if (ret <0 ) +return ret; + } + +/* SSI */ + mod =rsnd_ssi_mod_get (priv, id); +if (mod) { + ret =rsnd_dai_connect (rdai, mod, io); +if (ret <0 ) +return ret; + } + +return ret; +} + +static int rsnd_path_exit (struct rsnd_priv *priv, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_mod *mod, *n; +int ret =0 ; + +/* +* remove all mod from rdai +*/ +for_each_rsnd_mod (mod, n, io) + ret |=rsnd_dai_disconnect (mod); + +return ret; +} +static int rsnd_dai_probe (struct platform_device *pdev,struct rsnd_priv *priv) {
@@ -642,12 +694,14 @@ static int rsnd_dai_probe(struct platform_device *pdev, drv[i].playback.formats =RSND_FMTS ; drv[i].playback.channels_min =2 ; drv[i].playback.channels_max =2 ; +rsnd_path_init (priv, &rdai[i], &rdai[i].playback); }if (cmod) { drv[i].capture.rates =RSND_RATES ; drv[i].capture.formats =RSND_FMTS ; drv[i].capture.channels_min =2 ; drv[i].capture.channels_max =2 ; +rsnd_path_init (priv, &rdai[i], &rdai[i].capture); } dev_dbg(dev, "%s (%s/%s)\n", rdai[i].name,
@@ -661,6 +715,14 @@ static int rsnd_dai_probe(struct platform_device *pdev,static void rsnd_dai_remove (struct platform_device *pdev,struct rsnd_priv *priv) { +struct rsnd_dai *rdai; +int i; + +for (i =0 ; i <rsnd_rdai_nr (priv); i++) { + rdai =rsnd_dai_get (priv, i); +rsnd_path_exit (priv, rdai, &rdai->playback); +rsnd_path_exit (priv, rdai, &rdai->capture); + } }/*
sound/soc/sh/rcar/gen.c +0 -56
62 lines not on this page · raw message
sound/soc/sh/rcar/rsnd.h +0 -9
@@ -210,9 +210,6 @@ struct rsnd_dai { i++)struct rsnd_dai *rsnd_dai_get (struct rsnd_priv *priv,int id); -int rsnd_dai_disconnect (struct rsnd_mod *mod); -int rsnd_dai_connect (struct rsnd_dai *rdai,struct rsnd_mod *mod, -struct rsnd_dai_stream *io);int rsnd_dai_is_play (struct rsnd_dai *rdai,struct rsnd_dai_stream *io);int rsnd_dai_id (struct rsnd_priv *priv,struct rsnd_dai *rdai);#define rsnd_dai_get_platform_info (rdai) ((rdai)->info)
@@ -229,12 +226,6 @@ int rsnd_gen_probe(struct platform_device *pdev, struct rsnd_priv *priv);void rsnd_gen_remove (struct platform_device *pdev,struct rsnd_priv *priv); -int rsnd_gen_path_init (struct rsnd_priv *priv, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io); -int rsnd_gen_path_exit (struct rsnd_priv *priv, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io);void __iomem *rsnd_gen_reg_get (struct rsnd_priv *priv,struct rsnd_mod *mod,enum rsnd_reg reg);
Signature · 1 line
1.7.9.5
PATCH 9/19 ASoC: rsnd: use mod array instead of list on rdai
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 42 +++++++++++++++++++++++------------------- sound/soc/sh/rcar/rsnd.h | 12 ++++++++---- sound/soc/sh/rcar/scu.c | 2 +- sound/soc/sh/rcar/ssi.c | 2 +- 4 files changed, 33 insertions(+), 25 deletions(-)
sound/soc/sh/rcar/core.c +23 -19
@@ -121,12 +121,13 @@ char *rsnd_mod_name(struct rsnd_mod *mod)void rsnd_mod_init (struct rsnd_priv *priv,struct rsnd_mod *mod,struct rsnd_mod_ops *ops, +enum rsnd_mod_type type,int id) { mod->priv = priv; mod->id = id; mod->ops = ops; -INIT_LIST_HEAD (&mod->list); + mod->type = type; }/*
@@ -307,9 +308,12 @@ void rsnd_dma_quit(struct rsnd_priv *priv,#define rsnd_dai_call (rdai, io, fn) \ ({ \ - struct rsnd_mod *mod, *n; \ - int ret = 0; \ - for_each_rsnd_mod(mod, n, (io)) { \ + struct rsnd_mod *mod; \ + int ret = 0, i; \ + for (i = 0; i < RSND_MOD_MAX; i++) { \ + mod = (io)->mod[i]; \ + if (!mod) \ + continue; \ ret = rsnd_mod_call(mod, fn, (rdai), (io)); \ if (ret < 0) \ break; \
@@ -317,14 +321,13 @@ void rsnd_dma_quit(struct rsnd_priv *priv, ret; \ }) -static int rsnd_dai_connect (struct rsnd_dai *rdai, -struct rsnd_mod *mod, +static int rsnd_dai_connect (struct rsnd_mod *mod,struct rsnd_dai_stream *io) {if (!mod)return -EIO ; -if (!list_empty (&mod->list)) { +if (io->mod[mod->type]) {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);
@@ -334,15 +337,15 @@ static int rsnd_dai_connect(struct rsnd_dai *rdai,return -EIO ; } -list_add_tail (&mod->list, &io->head); + io->mod[mod->type] = mod; mod->io = io;return 0 ; } -static int rsnd_dai_disconnect (struct rsnd_mod *mod) +static int rsnd_dai_disconnect (struct rsnd_mod *mod,struct rsnd_dai_stream *io) { -list_del_init (&mod->list); + io->mod[mod->type] =NULL ; mod->io =NULL ;return 0 ;
@@ -604,7 +607,7 @@ static int rsnd_path_init(struct rsnd_priv *priv,/* SCU */ mod =rsnd_scu_mod_get (priv, id);if (mod) { - ret =rsnd_dai_connect (rdai, mod, io); + ret =rsnd_dai_connect (mod, io);if (ret <0 )return ret; }
@@ -612,7 +615,7 @@ static int rsnd_path_init(struct rsnd_priv *priv,/* SSI */ mod =rsnd_ssi_mod_get (priv, id);if (mod) { - ret =rsnd_dai_connect (rdai, mod, io); + ret =rsnd_dai_connect (mod, io);if (ret <0 )return ret; }
@@ -624,14 +627,18 @@ static int rsnd_path_exit(struct rsnd_priv *priv,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - struct rsnd_mod *mod, *n; -int ret =0 ; + struct rsnd_mod *mod; +int ret =0 , i;/* * remove all mod from rdai */ -for_each_rsnd_mod (mod, n, io) - ret |=rsnd_dai_disconnect (mod); +for (i =0 ; i <RSND_MOD_MAX ; i++) { + mod = io->mod[i]; +if (!mod) +continue ; + ret |=rsnd_dai_disconnect (mod, io); + }return ret; }
@@ -679,9 +686,6 @@ static int rsnd_dai_probe(struct platform_device *pdev,/* * init rsnd_dai */ -INIT_LIST_HEAD (&rdai[i].playback.head); -INIT_LIST_HEAD (&rdai[i].capture.head); -snprintf (rdai[i].name,RSND_DAI_NAME_SIZE ,"rsnd-dai.%d" , i);/*
sound/soc/sh/rcar/rsnd.h +8 -4
@@ -135,6 +135,11 @@ void rsnd_dma_quit(struct rsnd_priv *priv,/* * R-Car sound mod */ +enum rsnd_mod_type { +RSND_MOD_SCU =0 , +RSND_MOD_SSI , +RSND_MOD_MAX , +};struct rsnd_mod_ops {char *name;
@@ -155,9 +160,9 @@ struct rsnd_mod_ops {struct rsnd_dai_stream ;struct rsnd_mod {int id; +enum rsnd_mod_type type;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; };
@@ -167,12 +172,11 @@ struct rsnd_mod {#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)void rsnd_mod_init (struct rsnd_priv *priv,struct rsnd_mod *mod,struct rsnd_mod_ops *ops, +enum rsnd_mod_type type,int id);char *rsnd_mod_name (struct rsnd_mod *mod);
@@ -181,8 +185,8 @@ char *rsnd_mod_name(struct rsnd_mod *mod);*/ #define RSND_DAI_NAME_SIZE 16struct rsnd_dai_stream { -struct list_head head;/* head of rsnd_mod list */ struct snd_pcm_substream *substream; +struct rsnd_mod *mod[RSND_MOD_MAX ];int byte_pos;int period_pos;int byte_per_period;
sound/soc/sh/rcar/scu.c +1 -1
@@ -659,7 +659,7 @@ int rsnd_scu_probe(struct platform_device *pdev, ops = &rsnd_scu_non_gen2_ops; } -rsnd_mod_init (priv, &scu->mod, ops, i); +rsnd_mod_init (priv, &scu->mod, ops,RSND_MOD_SCU , i);dev_dbg (dev,"SCU%d probed\n" , i); }
sound/soc/sh/rcar/ssi.c +1 -1
@@ -584,7 +584,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,dev_dbg (dev,"SSI%d use PIO transfer\n" , i); } -rsnd_mod_init (priv, &ssi->mod, ops, i); +rsnd_mod_init (priv, &ssi->mod, ops,RSND_MOD_SSI , i);rsnd_ssi_parent_clk_setup (priv, ssi); }
Signature · 1 line
1.7.9.5
PATCH 10/19 ASoC: rsnd: get ssi/scu from rsnd_dai_stream
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Current driver is assuming that SSI id = SCU id.
But, now, it can get correct SSI/SCU fromrsnd_dai_stream. use it.
--- sound/soc/sh/rcar/rsnd.h | 4 +++- sound/soc/sh/rcar/scu.c | 20 +++++++++++--------- sound/soc/sh/rcar/ssi.c | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/rsnd.h +3 -1
@@ -192,6 +192,8 @@ struct rsnd_dai_stream {int byte_per_period;int next_period_byte; }; +#define rsnd_io_to_mod_ssi (io) ((io)->mod[RSND_MOD_SSI]) +#define rsnd_io_to_mod_scu (io) ((io)->mod[RSND_MOD_SCU])struct rsnd_dai {char name[RSND_DAI_NAME_SIZE ];
@@ -311,7 +313,7 @@ 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);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv, -struct rsnd_mod *ssi_mod, +struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime);#define rsnd_scu_nr (priv) ((priv)->scu_nr)
sound/soc/sh/rcar/scu.c +11 -9
@@ -121,7 +121,8 @@ static int rsnd_scu_ssi_mode_init(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); +struct rsnd_mod *ssi_mod =rsnd_io_to_mod_ssi (io); +int ssi_id =rsnd_mod_id (ssi_mod);u32 convert_rate =rsnd_scu_convert_rate (scu);if (convert_rate && !rsnd_dai_is_clk_master (rdai)) {
@@ -134,15 +135,15 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,/* * SSI_MODE0 */ -rsnd_mod_bset (mod,SSI_MODE0 , (1 << id), -rsnd_scu_hpbif_is_enable (scu) ?0 : (1 << id)); +rsnd_mod_bset (mod,SSI_MODE0 , (1 << ssi_id), +rsnd_scu_hpbif_is_enable (scu) ?0 : (1 << ssi_id));/* * SSI_MODE1 */ -if (rsnd_ssi_is_pin_sharing (rsnd_ssi_mod_get (priv, id))) { +if (rsnd_ssi_is_pin_sharing (ssi_mod)) {int shift =-1 ; -switch (id) { +switch (ssi_id) {case 1 : shift =0 ;break ;
@@ -165,14 +166,13 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod, }unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv, -struct rsnd_mod *ssi_mod, +struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime) {struct rsnd_scu *scu;unsigned int rate; -/* this function is assuming SSI id = SCU id here */ - scu =rsnd_mod_to_scu (rsnd_scu_mod_get (priv,rsnd_mod_id (ssi_mod))); + scu =rsnd_mod_to_scu (rsnd_io_to_mod_scu (io));/* * return convert rate if SRC is used,
@@ -583,8 +583,10 @@ static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { + struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io); +/* enable PIO interrupt */ - rsnd_mod_write(mod, INT_ENABLE, 0x0f000000); +rsnd_mod_write (ssi_mod,INT_ENABLE ,0x0f000000 );return 0 ; }
sound/soc/sh/rcar/ssi.c +1 -1
@@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, 1, 2, 4, 8, 16, 6, 12, };unsigned int main_rate; -unsigned int rate =rsnd_scu_get_ssi_rate (priv, &ssi->mod, runtime); +unsigned int rate =rsnd_scu_get_ssi_rate (priv, io, runtime);/* * Find best clock, and try to start ADG
Signature · 1 line
1.7.9.5
PATCH 11/19 ASoC: rsnd: add struct rsnd_dai_platform_info
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- include/sound/rcar_snd.h | 17 ++++++++++++++++- sound/soc/sh/rcar/core.c | 23 ++++++++++++++++------- sound/soc/sh/rcar/ssi.c | 14 ++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-)
include/sound/rcar_snd.h +16 -1
@@ -36,13 +36,15 @@#define RSND_SSI_CLK_PIN_SHARE (1 << 31)#define RSND_SSI_PLAY (1 << 24) +#define RSND_SSI (_dma_id, _pio_irq, _flags) \ +{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }#define RSND_SSI_SET (_dai_id, _dma_id, _pio_irq, _flags) \ { .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }#define RSND_SSI_UNUSED \ { .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }struct rsnd_ssi_platform_info { -int dai_id; +int dai_id;/* will be removed */ int dma_id;int pio_irq;u32 flags;
@@ -53,6 +55,8 @@ struct rsnd_ssi_platform_info {*/ #define RSND_SCU_USE_HPBIF (1 << 31)/* it needs RSND_SSI_DEPENDENT */ +#define RSND_SCU (rate, _dma_id) \ +{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }#define RSND_SCU_SET (rate, _dma_id) \ { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }#define RSND_SCU_UNUSED \
@@ -64,6 +68,15 @@ struct rsnd_scu_platform_info {int dma_id;/* for Gen2 SCU */ }; +struct rsnd_dai_path_info { +struct rsnd_ssi_platform_info *ssi; +}; + +struct rsnd_dai_platform_info { +struct rsnd_dai_path_info playback; +struct rsnd_dai_path_info capture; +}; +/* * flags *
@@ -81,6 +94,8 @@ struct rcar_snd_info {int ssi_info_nr;struct rsnd_scu_platform_info *scu_info;int scu_info_nr; +struct rsnd_dai_platform_info *dai_info; +int dai_info_nr;int (*start)(int id);int (*stop)(int id); };
sound/soc/sh/rcar/core.c +16 -7
@@ -647,19 +647,26 @@ static int rsnd_dai_probe(struct platform_device *pdev, struct rsnd_priv *priv) {struct snd_soc_dai_driver *drv; +struct rcar_snd_info *info =rsnd_priv_to_info (priv);struct rsnd_dai *rdai;struct rsnd_mod *pmod, *cmod;struct device *dev =rsnd_priv_to_dev (priv); -int dai_nr; +int dai_nr = info->dai_info_nr;int i; -/* get max dai nr */ -for (dai_nr =0 ; dai_nr <32 ; dai_nr++) { - pmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,1 ); - cmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,0 ); +/* +* dai_nr should be set via dai_info_nr, +* but allow it to keeping compatible +*/ +if (!dai_nr) { +/* get max dai nr */ +for (dai_nr =0 ; dai_nr <32 ; dai_nr++) { + pmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,1 ); + cmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,0 ); -if (!pmod && !cmod) -break ; +if (!pmod && !cmod) +break ; + } }if (!dai_nr) {
@@ -679,6 +686,8 @@ static int rsnd_dai_probe(struct platform_device *pdev, priv->rdai = rdai;for (i =0 ; i < dai_nr; i++) { +if (info->dai_info) + rdai[i].info = &info->dai_info[i]; pmod =rsnd_ssi_mod_get_frm_dai (priv, i,1 ); cmod =rsnd_ssi_mod_get_frm_dai (priv, i,0 );
sound/soc/sh/rcar/ssi.c +14 -0
@@ -451,12 +451,26 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = {struct rsnd_mod *rsnd_ssi_mod_get_frm_dai (struct rsnd_priv *priv,int dai_id,int is_play) { +struct rsnd_dai_platform_info *dai_info =NULL ; +struct rsnd_dai_path_info *path_info =NULL ; +struct rsnd_ssi_platform_info *target_info =NULL ;struct rsnd_ssi *ssi;int i, has_play; +if (priv->rdai) + dai_info = priv->rdai[dai_id].info; +if (dai_info) + path_info = (is_play) ? &dai_info->playback : &dai_info->capture; +if (path_info) + target_info = path_info->ssi; + is_play = !!is_play;for_each_rsnd_ssi (ssi, priv, i) { +if (target_info == ssi->info) +return &ssi->mod; + +/* for compatible */ if (rsnd_ssi_dai_id (ssi) != dai_id)continue ;
Signature · 1 line
1.7.9.5
PATCH 12/19 ASoC: rsnd: use function pointer for each probe
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-)
sound/soc/sh/rcar/core.c +14 -20
@@ -831,7 +831,15 @@ static int rsnd_probe(struct platform_device *pdev)struct rcar_snd_info *info;struct rsnd_priv *priv;struct device *dev = &pdev->dev; -int ret; +int (*probe_func[])(struct platform_device *pdev, +struct rsnd_priv *priv) = { + rsnd_gen_probe, + rsnd_ssi_probe, + rsnd_scu_probe, + rsnd_adg_probe, + rsnd_dai_probe, + }; +int ret, i; info = pdev->dev.platform_data;if (!info) {
@@ -855,25 +863,11 @@ static int rsnd_probe(struct platform_device *pdev)/* * init each module */ - ret =rsnd_gen_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_ssi_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_scu_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_adg_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_dai_probe (pdev, priv); -if (ret) -return ret; +for (i =0 ; i <ARRAY_SIZE (probe_func); i++) { + ret = probe_func[i](pdev, priv); +if (ret) +return ret; + }/* * asoc register
Signature · 1 line
1.7.9.5
PATCH 13/19 ASoC: rsnd: Get correct SCU ID
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- include/sound/rcar_snd.h | 1 + sound/soc/sh/rcar/core.c | 47 ++++++++++++++++++++++++++++++++-------------- sound/soc/sh/rcar/rsnd.h | 14 ++++++++++++++ sound/soc/sh/rcar/scu.c | 21 ++++++++++++++++----- sound/soc/sh/rcar/ssi.c | 9 ++++++++- 5 files changed, 72 insertions(+), 20 deletions(-)
include/sound/rcar_snd.h +1 -0
@@ -70,6 +70,7 @@ struct rsnd_scu_platform_info {struct rsnd_dai_path_info {struct rsnd_ssi_platform_info *ssi; +struct rsnd_scu_platform_info *scu; };struct rsnd_dai_platform_info {
sound/soc/sh/rcar/core.c +33 -14
88 lines not on this page · raw message
sound/soc/sh/rcar/rsnd.h +14 -0
@@ -187,6 +187,7 @@ char *rsnd_mod_name(struct rsnd_mod *mod);struct rsnd_dai_stream {struct snd_pcm_substream *substream;struct rsnd_mod *mod[RSND_MOD_MAX ]; +struct rsnd_dai_path_info *info;/* rcar_snd.h */ int byte_pos;int period_pos;int byte_per_period;
@@ -304,6 +305,19 @@ struct rsnd_priv {#define rsnd_lock (priv, flags) spin_lock_irqsave(&priv->lock, flags)#define rsnd_unlock (priv, flags) spin_unlock_irqrestore(&priv->lock, flags) +#define rsnd_info_is_playback (priv, type) \ +({ \ + struct rcar_snd_info *info = rsnd_priv_to_info(priv); \ + int i, is_play = 0; \ + for (i = 0; i < info->dai_info_nr; i++) { \ + if (info->dai_info[i].playback.type == (type)->info) { \ + is_play = 1; \ + break; \ + } \ + } \ + is_play; \ +}) +/* * R-Car SCU */
sound/soc/sh/rcar/scu.c +16 -5
@@ -620,6 +620,9 @@ int rsnd_scu_probe(struct platform_device *pdev,* init SCU */ nr = info->scu_info_nr; +if (!nr) +return 0 ; + scu =devm_kzalloc (dev,sizeof (*scu) * nr,GFP_KERNEL );if (!scu) {dev_err (dev,"SCU allocate failed\n" );
@@ -644,11 +647,19 @@ int rsnd_scu_probe(struct platform_device *pdev,if (rsnd_is_gen1 (priv)) ops = &rsnd_scu_gen1_ops;if (rsnd_is_gen2 (priv)) { -struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv, i); -int ret =rsnd_dma_init (priv, -rsnd_mod_to_dma (&scu->mod), -rsnd_ssi_is_play (ssi), - scu->info->dma_id); +int ret; +int is_play; + +if (info->dai_info) { + is_play =rsnd_info_is_playback (priv, scu); + }else { +struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv, i); + is_play =rsnd_ssi_is_play (ssi); + } + ret =rsnd_dma_init (priv, +rsnd_mod_to_dma (&scu->mod), + is_play, + scu->info->dma_id);if (ret <0 )return ret;
sound/soc/sh/rcar/ssi.c +8 -1
@@ -567,9 +567,16 @@ int rsnd_ssi_probe(struct platform_device *pdev,* SSI DMA case */ if (pinfo->dma_id >0 ) { +int is_play; + +if (info->dai_info) + is_play =rsnd_info_is_playback (priv, ssi); +else + is_play =rsnd_ssi_is_play (&ssi->mod); + ret =rsnd_dma_init ( priv,rsnd_mod_to_dma (&ssi->mod), -rsnd_ssi_is_play (&ssi->mod), + is_play, pinfo->dma_id);if (ret <0 )dev_info (dev,"SSI DMA failed. try PIO transter\n" );
Signature · 1 line
1.7.9.5
PATCH 14/19 ASoC: rsnd: add rsnd_scu_enable_ssi_irq()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/rsnd.h | 3 +++ sound/soc/sh/rcar/scu.c | 26 +++++++++++++------------- sound/soc/sh/rcar/ssi.c | 2 ++ 3 files changed, 18 insertions(+), 13 deletions(-)
sound/soc/sh/rcar/rsnd.h +3 -0
@@ -329,6 +329,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime); +int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);#define rsnd_scu_nr (priv) ((priv)->scu_nr)
sound/soc/sh/rcar/scu.c +13 -13
@@ -165,6 +165,19 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,return 0 ; } +int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_priv *priv =rsnd_mod_to_priv (ssi_mod); + +/* enable PIO interrupt if Gen2 */ +if (rsnd_is_gen2 (priv)) +rsnd_mod_write (ssi_mod,INT_ENABLE ,0x0f000000 ); + +return 0 ; +} +unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime)
@@ -579,22 +592,9 @@ static struct rsnd_mod_ops rsnd_scu_gen2_ops = { .stop = rsnd_scu_stop_gen2, }; -static int rsnd_scu_start_non_gen2 (struct rsnd_mod *mod, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) -{ -struct rsnd_mod *ssi_mod =rsnd_io_to_mod_ssi (io); - -/* enable PIO interrupt */ -rsnd_mod_write (ssi_mod,INT_ENABLE ,0x0f000000 ); - -return 0 ; -} -static struct rsnd_mod_ops rsnd_scu_non_gen2_ops = { .name ="non-scu (gen2)" , .init = rsnd_scu_ssi_mode_init, - .start = rsnd_scu_start_non_gen2, };struct rsnd_mod *rsnd_scu_mod_get (struct rsnd_priv *priv,int id)
sound/soc/sh/rcar/ssi.c +2 -0
@@ -365,6 +365,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,/* enable PIO IRQ */ ssi->cr_etc =UIEN |OIEN |DIEN ; +rsnd_scu_enable_ssi_irq (mod, rdai, io); +rsnd_ssi_hw_start (ssi, rdai, io);return 0 ;
Signature · 1 line
1.7.9.5
PATCH 15/19 ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/rsnd.h | 3 +++ sound/soc/sh/rcar/scu.c | 54 +++++++++++++++------------------------------- sound/soc/sh/rcar/ssi.c | 2 ++ 3 files changed, 22 insertions(+), 37 deletions(-)
sound/soc/sh/rcar/rsnd.h +3 -0
@@ -329,6 +329,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime); +int rsnd_scu_ssi_mode_init (struct rsnd_mod *ssi_mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io);
sound/soc/sh/rcar/scu.c +17 -37
99 lines not on this page · raw message
sound/soc/sh/rcar/ssi.c +2 -0
@@ -287,6 +287,8 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ssi->cr_own = cr; ssi->err =-1 ;/* ignore 1st error */ +rsnd_scu_ssi_mode_init (mod, rdai, io); +return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 16/19 ASoC: rsnd: add probe/remove callback on rsnd_mod_ops
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 23 +++++++++++++++++++++++ sound/soc/sh/rcar/rsnd.h | 6 ++++++ 2 files changed, 29 insertions(+)
sound/soc/sh/rcar/core.c +23 -0
@@ -850,6 +850,7 @@ static int rsnd_probe(struct platform_device *pdev)struct rcar_snd_info *info;struct rsnd_priv *priv;struct device *dev = &pdev->dev; +struct rsnd_dai *rdai;int (*probe_func[])(struct platform_device *pdev,struct rsnd_priv *priv) = { rsnd_gen_probe,
@@ -888,6 +889,16 @@ static int rsnd_probe(struct platform_device *pdev)return ret; } +for_each_rsnd_dai (rdai, priv, i) { + ret =rsnd_dai_call (rdai, &rdai->playback, probe); +if (ret) +return ret; + + ret =rsnd_dai_call (rdai, &rdai->capture, probe); +if (ret) +return ret; + } +/* * asoc register */
@@ -920,9 +931,21 @@ exit_snd_soc:static int rsnd_remove (struct platform_device *pdev) {struct rsnd_priv *priv =dev_get_drvdata (&pdev->dev); +struct rsnd_dai *rdai; +int ret, i;pm_runtime_disable (&pdev->dev); +for_each_rsnd_dai (rdai, priv, i) { + ret =rsnd_dai_call (rdai, &rdai->playback, probe); +if (ret) +return ret; + + ret =rsnd_dai_call (rdai, &rdai->capture, probe); +if (ret) +return ret; + } +/* * remove each module */
sound/soc/sh/rcar/rsnd.h +6 -0
@@ -143,6 +143,12 @@ enum rsnd_mod_type {struct rsnd_mod_ops {char *name; +int (*probe)(struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io); +int (*remove)(struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);int (*init)(struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io);
Signature · 1 line
1.7.9.5
PATCH 17/19 ASoC: rsnd: use mod probe method on SCU
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Now, it can use .probe
--- sound/soc/sh/rcar/scu.c | 64 +++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 25 deletions(-)
sound/soc/sh/rcar/scu.c +39 -25
@@ -525,6 +525,42 @@ static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod,return ret; } +static int rsnd_scu_probe_gen2 (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_priv *priv =rsnd_mod_to_priv (mod); +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_scu *scu =rsnd_mod_to_scu (mod); +struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv,rsnd_mod_id (mod)); +struct device *dev =rsnd_priv_to_dev (priv); +int ret; +int is_play; + +if (info->dai_info) + is_play =rsnd_info_is_playback (priv, scu); +else + is_play =rsnd_ssi_is_play (ssi); + + ret =rsnd_dma_init (priv, +rsnd_mod_to_dma (mod), + is_play, + scu->info->dma_id); +if (ret <0 ) +dev_err (dev,"SCU DMA failed\n" ); + +return ret; +} + +static int rsnd_scu_remove_gen2 (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +rsnd_dma_quit (rsnd_mod_to_priv (mod),rsnd_mod_to_dma (mod)); + +return 0 ; +} +static int rsnd_scu_init_gen2 (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -576,6 +612,8 @@ static int rsnd_scu_stop_gen2(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_scu_gen2_ops = { .name ="scu (gen2)" , + .probe = rsnd_scu_probe_gen2, + .remove = rsnd_scu_remove_gen2, .init = rsnd_scu_init_gen2, .quit = rsnd_scu_quit, .start = rsnd_scu_start_gen2,
@@ -631,25 +669,8 @@ int rsnd_scu_probe(struct platform_device *pdev,if (rsnd_scu_hpbif_is_enable (scu)) {if (rsnd_is_gen1 (priv)) ops = &rsnd_scu_gen1_ops; -if (rsnd_is_gen2 (priv)) { -int ret; -int is_play; - -if (info->dai_info) { - is_play =rsnd_info_is_playback (priv, scu); - }else { -struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv, i); - is_play =rsnd_ssi_is_play (ssi); - } - ret =rsnd_dma_init (priv, -rsnd_mod_to_dma (&scu->mod), - is_play, - scu->info->dma_id); -if (ret <0 ) -return ret; - +if (rsnd_is_gen2 (priv)) ops = &rsnd_scu_gen2_ops; - } }rsnd_mod_init (priv, &scu->mod, ops,RSND_MOD_SCU , i);
@@ -663,11 +684,4 @@ int rsnd_scu_probe(struct platform_device *pdev,void rsnd_scu_remove (struct platform_device *pdev,struct rsnd_priv *priv) { -struct rsnd_scu *scu; -int i; - -for_each_rsnd_scu (scu, priv, i) { -if (rsnd_scu_dma_available (scu)) -rsnd_dma_quit (priv,rsnd_mod_to_dma (&scu->mod)); - } }
Signature · 1 line
1.7.9.5
PATCH 18/19 ASoC: rsnd: use mod probe method on SSI
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Now, it can use .probe
--- sound/soc/sh/rcar/ssi.c | 116 ++++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 51 deletions(-)
sound/soc/sh/rcar/ssi.c +65 -51
@@ -358,6 +358,26 @@ static irqreturn_t rsnd_ssi_pio_interrupt(int irq, void *data)return ret; } +static int rsnd_ssi_pio_probe (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); +int irq = ssi->info->pio_irq; +int ret; + + ret =devm_request_irq (dev, irq, + rsnd_ssi_pio_interrupt, +IRQF_SHARED , +dev_name (dev), ssi); +if (ret) +dev_err (dev,"SSI request interrupt failed\n" ); + +return ret; +} +static int rsnd_ssi_pio_start (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -389,12 +409,50 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_ssi_pio_ops = { .name ="ssi (pio)" , + .probe = rsnd_ssi_pio_probe, .init = rsnd_ssi_init, .quit = rsnd_ssi_quit, .start = rsnd_ssi_pio_start, .stop = rsnd_ssi_pio_stop, }; +static int rsnd_ssi_dma_probe (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); +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct device *dev =rsnd_priv_to_dev (priv); +int dma_id = ssi->info->dma_id; +int is_play; +int ret; + +if (info->dai_info) + is_play =rsnd_info_is_playback (priv, ssi); +else + is_play =rsnd_ssi_is_play (&ssi->mod); + + ret =rsnd_dma_init ( + priv,rsnd_mod_to_dma (mod), + is_play, + dma_id); + +if (ret <0 ) +dev_err (dev,"SSI DMA failed\n" ); + +return ret; +} + +static int rsnd_ssi_dma_remove (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +rsnd_dma_quit (rsnd_mod_to_priv (mod),rsnd_mod_to_dma (mod)); + +return 0 ; +} +static int rsnd_ssi_dma_start (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -436,6 +494,8 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_ssi_dma_ops = { .name ="ssi (dma)" , + .probe = rsnd_ssi_dma_probe, + .remove = rsnd_ssi_dma_remove, .init = rsnd_ssi_init, .quit = rsnd_ssi_quit, .start = rsnd_ssi_dma_start,
@@ -538,7 +598,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,struct clk *clk;struct rsnd_ssi *ssi;char name[RSND_SSI_NAME_SIZE ]; -int i, nr, ret; +int i, nr;/* * init SSI
@@ -566,48 +626,10 @@ int rsnd_ssi_probe(struct platform_device *pdev, ssi->clk = clk; ops = &rsnd_ssi_non_ops; - -/* -* SSI DMA case -*/ -if (pinfo->dma_id >0 ) { -int is_play; - -if (info->dai_info) - is_play =rsnd_info_is_playback (priv, ssi); -else - is_play =rsnd_ssi_is_play (&ssi->mod); - - ret =rsnd_dma_init ( - priv,rsnd_mod_to_dma (&ssi->mod), - is_play, - pinfo->dma_id); -if (ret <0 ) -dev_info (dev,"SSI DMA failed. try PIO transter\n" ); -else - ops = &rsnd_ssi_dma_ops; - -dev_dbg (dev,"SSI%d use DMA transfer\n" , i); - } - -/* -* SSI PIO case -*/ -if (!rsnd_ssi_dma_available (ssi) && -rsnd_ssi_pio_available (ssi)) { - ret =devm_request_irq (dev, pinfo->pio_irq, - &rsnd_ssi_pio_interrupt, -IRQF_SHARED , -dev_name (dev), ssi); -if (ret) { -dev_err (dev,"SSI request interrupt failed\n" ); -return ret; - } - - ops = &rsnd_ssi_pio_ops; - -dev_dbg (dev,"SSI%d use PIO transfer\n" , i); - } +if (pinfo->dma_id >0 ) + ops = &rsnd_ssi_dma_ops; +else if (rsnd_ssi_pio_available (ssi)) + ops = &rsnd_ssi_pio_ops;rsnd_mod_init (priv, &ssi->mod, ops,RSND_MOD_SSI , i);
@@ -620,12 +642,4 @@ int rsnd_ssi_probe(struct platform_device *pdev,void rsnd_ssi_remove (struct platform_device *pdev,struct rsnd_priv *priv) { -struct rsnd_ssi *ssi; -int i; - -for_each_rsnd_ssi (ssi, priv, i) { -if (rsnd_ssi_dma_available (ssi)) -rsnd_dma_quit (priv,rsnd_mod_to_dma (&ssi->mod)); - } - }
Signature · 1 line
1.7.9.5
PATCH 19/19 ASoC: rsnd: add DeviceTree support
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
--- .../devicetree/bindings/sound/renesas,rsnd.txt | 101 ++++++++++++++++ sound/soc/sh/rcar/adg.c | 1 + sound/soc/sh/rcar/core.c | 122 +++++++++++++++++++- sound/soc/sh/rcar/gen.c | 15 +++ sound/soc/sh/rcar/rsnd.h | 11 ++ sound/soc/sh/rcar/scu.c | 36 ++++++ sound/soc/sh/rcar/ssi.c | 56 +++++++++ 7 files changed, 339 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd.txt
Documentation/devicetree/bindings/sound/renesas,rsnd.txt new file +101 -0
@@ -0,0 +1,101 @@ +Renesas R-Car sound + +Required properties: +- compatible : "renesas,rcar_sound-gen1" if generation1 + "renesas,rcar_sound-gen2" if generation2 +- reg : Should contain the register physical address. + required register is + SRU/ADG/SSI if generation1 + SRU/ADG/SSIU/SSI if generation2 +- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode + +SSI subnode properties: +- interrupt-parent : Should contain SSI interrup parent +- interrupts : Should contain SSI interrupt for PIO transfer +- shared-pin : if shared clock pin + +DAI subnode properties: +- playback : list of playback modules +- capture : list of capture modules + +Example: + +rcar_sound: rcar_sound@0xffd90000 { + #sound-dai-cells = <1>; + compatible = "renesas,rcar_sound"; + reg = <0xffd90000 0x1000>, /* SRU */ + <0xfffe0000 0x24>, /* ADG */ + <0xffd91000 0x1240>; /* SSI */ + + rcar_sound,scu { + scu0: scu@0 { }; + scu1: scu@1 { }; + scu2: scu@2 { }; + scu3: scu@3 { }; + scu4: scu@4 { }; + scu5: scu@5 { }; + scu6: scu@6 { }; + scu7: scu@7 { }; + scu8: scu@8 { }; + }; + + rcar_sound,ssi { + ssi0: ssi@0 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi1: ssi@1 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi2: ssi@2 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi3: ssi@3 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi4: ssi@4 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi5: ssi@5 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi6: ssi@6 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi7: ssi@7 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi8: ssi@8 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + }; + + rcar_sound,dai { + dai0 { + playback = <&ssi5 &scu5>; + capture = <&ssi6 &scu6>; + }; + dai1 { + playback = <&ssi3>; + }; + dai2 { + capture = <&ssi4>; + }; + dai3 { + playback = <&ssi7>; + }; + dai4 { + capture = <&ssi8>; + }; + }; +};
sound/soc/sh/rcar/adg.c +1 -0
@@ -391,6 +391,7 @@ static void rsnd_adg_ssi_clk_init(struct rsnd_priv *priv, struct rsnd_adg *adg) }int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rsnd_adg *adg;
sound/soc/sh/rcar/core.c +119 -3
172 lines not on this page · raw message
sound/soc/sh/rcar/gen.c +15 -0
@@ -360,13 +360,28 @@ static int rsnd_gen1_probe(struct platform_device *pdev,/* * Gen */ +static void rsnd_of_parse_gen (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct rcar_snd_info *info = priv->info; + +if (!of_data) +return ; + + info->flags = of_data->flags; +} +int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen;int ret; +rsnd_of_parse_gen (pdev, of_data, priv); + gen =devm_kzalloc (dev,sizeof (*gen),GFP_KERNEL );if (!gen) {dev_err (dev,"GEN allocate failed\n" );
sound/soc/sh/rcar/rsnd.h +11 -0
@@ -17,6 +17,8 @@#include <linux/io.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/of_device.h> +#include <linux/of_irq.h> #include <linux/sh_dma.h> #include <linux/workqueue.h> #include <sound/rcar_snd.h>
@@ -89,6 +91,7 @@ enum rsnd_reg { RSND_REG_MAX, }; +struct rsnd_of_data ;struct rsnd_priv ;struct rsnd_mod ;struct rsnd_dai ;
@@ -236,6 +239,7 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);* R-Car Gen1/Gen2 */ int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);void rsnd_gen_remove (struct platform_device *pdev,struct rsnd_priv *priv);
@@ -251,6 +255,7 @@ void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,int rsnd_adg_ssi_clk_stop (struct rsnd_mod *mod);int rsnd_adg_ssi_clk_try_start (struct rsnd_mod *mod,unsigned int rate);int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);void rsnd_adg_remove (struct platform_device *pdev,struct rsnd_priv *priv);
@@ -270,6 +275,10 @@ int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,/* * R-Car sound priv */ +struct rsnd_of_data { +u32 flags; +}; +struct rsnd_priv {struct device *dev;
@@ -328,6 +337,7 @@ struct rsnd_priv {* R-Car SCU */ int rsnd_scu_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);void rsnd_scu_remove (struct platform_device *pdev,struct rsnd_priv *priv);
@@ -348,6 +358,7 @@ int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod,* R-Car SSI */ int rsnd_ssi_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);void rsnd_ssi_remove (struct platform_device *pdev,struct rsnd_priv *priv);
sound/soc/sh/rcar/scu.c +36 -0
@@ -628,7 +628,41 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id)return &((struct rsnd_scu *)(priv->scu) + id)->mod; } +static void rsnd_of_parse_scu (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct device_node *scu_node; +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_scu_platform_info *scu_info; +struct device *dev = &pdev->dev; +int nr; + +if (!of_data) +return ; + + scu_node =of_get_child_by_name (dev->of_node,"rcar_sound,scu" ); +if (!scu_node) +return ; + + nr =of_get_child_count (scu_node); +if (!nr) +return ; + + scu_info =devm_kzalloc (dev, +sizeof (struct rsnd_scu_platform_info ) * nr, +GFP_KERNEL ); +if (!scu_info) { +dev_err (dev,"scu info allocation error\n" ); +return ; + } + + info->scu_info = scu_info; + info->scu_info_nr = nr; +} +int rsnd_scu_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rcar_snd_info *info =rsnd_priv_to_info (priv);
@@ -639,6 +673,8 @@ int rsnd_scu_probe(struct platform_device *pdev,char name[RSND_SCU_NAME_SIZE ];int i, nr; +rsnd_of_parse_scu (pdev, of_data, priv); +/* * init SCU */
sound/soc/sh/rcar/ssi.c +56 -0
69 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Mark Brown
maintainerQuoted 3 lines · Kuninori Morimoto
Now, Mark's ALSA branch doesn't include SH-ARM platform branch. Thus, these patches are keeping compatible for it at this point. Compatible code will be removed after merge.
Would it make sense to do a cross tree merge of some of this code?
Hi Mark
Quoted 5 lines
Quoted 3 lines
Now, Mark's ALSA branch doesn't include SH-ARM platform branch. Thus, these patches are keeping compatible for it at this point. Compatible code will be removed after merge.
Would it make sense to do a cross tree merge of some of this code?
Thank you for your help.
I tested these well. it can keep compatibility. Thus, mark/topic/rcar is no problem I think.
But, can you please drop last [19/19] DT patch ? I noticed not good point on this.
Mark Brown
maintainerQuoted 2 lines · Kuninori Morimoto
But, can you please drop last [19/19] DT patch ?
I noticed not good point on this.
Sure, I'll skip it - still not read the full series yet anyway.
Re: [PATCH 01/19] ASoC: rsnd: move priv member settings to upper side
In reply to Kuninori MorimotoQuoted 3 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
There is no big meaning, but preparation for platform dai support
Applied, thanks.
Re: [PATCH 07/19] ASoC: rsnd: tidyup RSND_SSI_xxx flags
In reply to Kuninori MorimotoQuoted 6 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
6f3ab6c1c022e7a4877d38940cd45ae7804a15e2
(ASoC: rsnd: remove pin sync option)
added unusedRSND_SSI_CLK_FROM_ADGflag.
It should removeRSND_SSI_SYNC.
Applied, thanks.
Mark Brown
maintainerQuoted 7 lines · Kuninori Morimoto
Hi Mark
These are Renesas R-Car sound driver patches.
#1 - #7 are clean up patches.
#8 - #18 adds new module path method
#19 adds DT support
The ones I didn't comment on look broadly OK but there's dependencies on earlier patches.
Re: [PATCH 02/19] ASoC: rsnd: move rsnd_mod_call() macro
In reply to Kuninori MorimotoQuoted 4 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
core.cis the only user ofrsnd_mod_call()macro.
Move it tocore.cfromrsnd.h
Applied, thanks.
Mark Brown
maintainerRe: [PATCH 06/19] ASoC: rsnd: add .set_sysclk on snd_soc_dai_ops
In reply to Kuninori MorimotoQuoted 6 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
This patch adds struct
snd_soc_dai_ops::set_sysclk. But, it do nothing, since rsnd sysclk is controlled by ADG. Without this patch, simple-card init will be failed if DT case.
We should fix the simple-card code so that it does not need this rather than adding empty functions to all the drivers - I'd expect it to handle -ENOTSUPP as not an error.
Re: [PATCH 03/19] ASoC: rsnd: remove verbose function parameter
In reply to Kuninori MorimotoQuoted 4 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
priv has
rcar_snd_infopointer.
having priv and info in same time is verbose.
Applied, thanks.
Mark Brown
maintainerRe: [PATCH 08/19] ASoC: rsnd: run rsnd_path_init() when probe() timing
In reply to Kuninori MorimotoQuoted 7 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
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 inprobe()timing. This patch sets the path onprobe()timing.
This is fine but it depends on the set_sysclk() patch.
Re: [PATCH 04/19] ASoC: rsnd: remove verbose debug message from scu/ssi
In reply to Kuninori MorimotoQuoted 3 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
scu/ssi
probe()already have more detail debug message.
Applied, thanks.
Re: [PATCH 06/19] ASoC: rsnd: add .set_sysclk on snd_soc_dai_ops
In reply to Mark BrownHi Mark
Quoted 8 lines
Quoted 4 lines
This patch adds struct
snd_soc_dai_ops::set_sysclk. But, it do nothing, since rsnd sysclk is controlled by ADG. Without this patch, simple-card init will be failed if DT case.We should fix the simple-card code so that it does not need this rather than adding empty functions to all the drivers - I'd expect it to handle
-ENOTSUPPas not an error.
Ahh...
Current simple-card will get sysclk absolutely in normal (?) way. Can you see end of asoc_simple_card_sub_parse_of() ?
rsnd got sysclk from it, but it is "module" clock, not "sysclk".
I guess I can avoid this issue if dtsi has
system-clock-frequency = 0;
but it is strange.
Re: [PATCH 06/19] ASoC: rsnd: add .set_sysclk on snd_soc_dai_ops
Hi Mark again
Quoted 14 lines
Quoted 8 lines
Quoted 4 lines
This patch adds struct
snd_soc_dai_ops::set_sysclk. But, it do nothing, since rsnd sysclk is controlled by ADG. Without this patch, simple-card init will be failed if DT case.We should fix the simple-card code so that it does not need this rather than adding empty functions to all the drivers - I'd expect it to handle
-ENOTSUPPas not an error.Ahh...
Current simple-card will get sysclk absolutely in normal (?) way. Can you see end of
asoc_simple_card_sub_parse_of()?
Quoted 7 lines
rsnd got sysclk from it, but it is "module" clock, not "sysclk".
I guess I can avoid this issue if dtsi has
system-clock-frequency = 0;but it is strange.
Oops, I was misunderstanding.
I see, I will add -ENOTSUPP support.
Re: [PATCH 05/19] ASoC: rsnd: unify rdai naming
In reply to Kuninori MorimotoQuoted 5 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
struct
rsnd_daiis called as "rdai",
but its size has been called as "dai_nr".
Unify these as "rdai"
Applied, thanks.
Hi Mark
These are Renesas R-Car sound driver patches v2. But I separated these into
1) cleanup patches
2) new feature patches
Because 1) + 2) becomes large number patches. These are 1) part patches.
I will send 2) part patches if 1) are accepted
Kuninori Morimoto (8):
ASoC: rsnd: run rsnd_path_init() when probe() timing
ASoC: rsnd: use mod array instead of list on rdai
ASoC: rsnd: get ssi/scu from rsnd_dai_stream
ASoC: rsnd: use devm_clk_get() instead of clk_get()
ASoC: rsnd: use function pointer for each probe
ASoC: rsnd: remove unused SSI_CONTROL
ASoC: rsnd: modify rsnd_adg_ssi_ws_timing_gen2() parameter
ASoC: rsnd: share reg_field and reduce memory
sound/soc/sh/rcar/adg.c | 31 ++++------ sound/soc/sh/rcar/core.c | 152 ++++++++++++++++++++++++++++++++-------------- sound/soc/sh/rcar/gen.c | 57 ----------------- sound/soc/sh/rcar/rsnd.h | 107 +++++++++++++++++++------------- sound/soc/sh/rcar/scu.c | 22 ++++--- sound/soc/sh/rcar/ssi.c | 4 +- 6 files changed, 197 insertions(+), 176 deletions(-)
PATCH 1/8 ASoC: rsnd: run rsnd_path_init() when probe() timing
From: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 94 ++++++++++++++++++++++++++++++++++++++-------- sound/soc/sh/rcar/gen.c | 56 --------------------------- sound/soc/sh/rcar/rsnd.h | 9 ----- 3 files changed, 78 insertions(+), 81 deletions(-)
sound/soc/sh/rcar/core.c +78 -16
@@ -317,9 +317,9 @@ void rsnd_dma_quit(struct rsnd_priv *priv, ret; \ }) -int rsnd_dai_connect (struct rsnd_dai *rdai, -struct rsnd_mod *mod, -struct rsnd_dai_stream *io) +static int rsnd_dai_connect (struct rsnd_dai *rdai, +struct rsnd_mod *mod, +struct rsnd_dai_stream *io) {if (!mod)return -EIO ;
@@ -340,7 +340,7 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,return 0 ; } -int rsnd_dai_disconnect (struct rsnd_mod *mod) +static int rsnd_dai_disconnect (struct rsnd_mod *mod) {list_del_init (&mod->list); mod->io =NULL ;
@@ -418,10 +418,6 @@ static int rsnd_dai_stream_init(struct rsnd_dai_stream *io, {struct snd_pcm_runtime *runtime = substream->runtime; -if (!list_empty (&io->head)) -return -EIO ; - -INIT_LIST_HEAD (&io->head); io->substream = substream; io->byte_pos =0 ; io->period_pos =0 ;
@@ -476,10 +472,6 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,if (ret <0 ) goto dai_trigger_end; - ret =rsnd_gen_path_init (priv, rdai, io); -if (ret <0 ) - goto dai_trigger_end; - ret =rsnd_dai_call (rdai, io, init);if (ret <0 ) goto dai_trigger_end;
@@ -497,10 +489,6 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,if (ret <0 ) goto dai_trigger_end; - ret =rsnd_gen_path_exit (priv, rdai, io); -if (ret <0 ) - goto dai_trigger_end; - ret =rsnd_platform_call (priv, dai, stop, ssi_id);if (ret <0 ) goto dai_trigger_end;
@@ -576,6 +564,70 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .set_fmt = rsnd_soc_dai_set_fmt, }; +static int rsnd_path_init (struct rsnd_priv *priv, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_mod *mod; +int ret; +int id; + +/* +* Gen1 is created by SRU/SSI, and this SRU is base module of +* Gen2's SCU/SSIU/SSI. (Gen2 SCU/SSIU came from SRU) +* +* Easy image is.. +* Gen1 SRU = Gen2 SCU + SSIU + etc +* +* Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is +* using fixed path. +* +* Then, SSI id = SCU id here +*/ +/* get SSI's ID */ + mod =rsnd_ssi_mod_get_frm_dai (priv, +rsnd_dai_id (priv, rdai), +rsnd_dai_is_play (rdai, io)); +if (!mod) +return 0 ; + id =rsnd_mod_id (mod); + ret =0 ; + +/* SCU */ + mod =rsnd_scu_mod_get (priv, id); +if (mod) { + ret =rsnd_dai_connect (rdai, mod, io); +if (ret <0 ) +return ret; + } + +/* SSI */ + mod =rsnd_ssi_mod_get (priv, id); +if (mod) { + ret =rsnd_dai_connect (rdai, mod, io); +if (ret <0 ) +return ret; + } + +return ret; +} + +static int rsnd_path_exit (struct rsnd_priv *priv, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_mod *mod, *n; +int ret =0 ; + +/* +* remove all mod from rdai +*/ +for_each_rsnd_mod (mod, n, io) + ret |=rsnd_dai_disconnect (mod); + +return ret; +} +static int rsnd_dai_probe (struct platform_device *pdev,struct rsnd_priv *priv) {
@@ -634,12 +686,14 @@ static int rsnd_dai_probe(struct platform_device *pdev, drv[i].playback.formats =RSND_FMTS ; drv[i].playback.channels_min =2 ; drv[i].playback.channels_max =2 ; +rsnd_path_init (priv, &rdai[i], &rdai[i].playback); }if (cmod) { drv[i].capture.rates =RSND_RATES ; drv[i].capture.formats =RSND_FMTS ; drv[i].capture.channels_min =2 ; drv[i].capture.channels_max =2 ; +rsnd_path_init (priv, &rdai[i], &rdai[i].capture); } dev_dbg(dev, "%s (%s/%s)\n", rdai[i].name,
@@ -653,6 +707,14 @@ static int rsnd_dai_probe(struct platform_device *pdev,static void rsnd_dai_remove (struct platform_device *pdev,struct rsnd_priv *priv) { +struct rsnd_dai *rdai; +int i; + +for (i =0 ; i <rsnd_rdai_nr (priv); i++) { + rdai =rsnd_dai_get (priv, i); +rsnd_path_exit (priv, rdai, &rdai->playback); +rsnd_path_exit (priv, rdai, &rdai->capture); + } }/*
sound/soc/sh/rcar/gen.c +0 -56
62 lines not on this page · raw message
sound/soc/sh/rcar/rsnd.h +0 -9
@@ -210,9 +210,6 @@ struct rsnd_dai { i++)struct rsnd_dai *rsnd_dai_get (struct rsnd_priv *priv,int id); -int rsnd_dai_disconnect (struct rsnd_mod *mod); -int rsnd_dai_connect (struct rsnd_dai *rdai,struct rsnd_mod *mod, -struct rsnd_dai_stream *io);int rsnd_dai_is_play (struct rsnd_dai *rdai,struct rsnd_dai_stream *io);int rsnd_dai_id (struct rsnd_priv *priv,struct rsnd_dai *rdai);#define rsnd_dai_get_platform_info (rdai) ((rdai)->info)
@@ -229,12 +226,6 @@ int rsnd_gen_probe(struct platform_device *pdev, struct rsnd_priv *priv);void rsnd_gen_remove (struct platform_device *pdev,struct rsnd_priv *priv); -int rsnd_gen_path_init (struct rsnd_priv *priv, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io); -int rsnd_gen_path_exit (struct rsnd_priv *priv, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io);void __iomem *rsnd_gen_reg_get (struct rsnd_priv *priv,struct rsnd_mod *mod,enum rsnd_reg reg);
Signature · 1 line
1.7.9.5
PATCH 2/8 ASoC: rsnd: use mod array instead of list on rdai
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 42 +++++++++++++++++++++++------------------- sound/soc/sh/rcar/rsnd.h | 12 ++++++++---- sound/soc/sh/rcar/scu.c | 2 +- sound/soc/sh/rcar/ssi.c | 2 +- 4 files changed, 33 insertions(+), 25 deletions(-)
sound/soc/sh/rcar/core.c +23 -19
@@ -121,12 +121,13 @@ char *rsnd_mod_name(struct rsnd_mod *mod)void rsnd_mod_init (struct rsnd_priv *priv,struct rsnd_mod *mod,struct rsnd_mod_ops *ops, +enum rsnd_mod_type type,int id) { mod->priv = priv; mod->id = id; mod->ops = ops; -INIT_LIST_HEAD (&mod->list); + mod->type = type; }/*
@@ -307,9 +308,12 @@ void rsnd_dma_quit(struct rsnd_priv *priv,#define rsnd_dai_call (rdai, io, fn) \ ({ \ - struct rsnd_mod *mod, *n; \ - int ret = 0; \ - for_each_rsnd_mod(mod, n, (io)) { \ + struct rsnd_mod *mod; \ + int ret = 0, i; \ + for (i = 0; i < RSND_MOD_MAX; i++) { \ + mod = (io)->mod[i]; \ + if (!mod) \ + continue; \ ret = rsnd_mod_call(mod, fn, (rdai), (io)); \ if (ret < 0) \ break; \
@@ -317,14 +321,13 @@ void rsnd_dma_quit(struct rsnd_priv *priv, ret; \ }) -static int rsnd_dai_connect (struct rsnd_dai *rdai, -struct rsnd_mod *mod, +static int rsnd_dai_connect (struct rsnd_mod *mod,struct rsnd_dai_stream *io) {if (!mod)return -EIO ; -if (!list_empty (&mod->list)) { +if (io->mod[mod->type]) {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);
@@ -334,15 +337,15 @@ static int rsnd_dai_connect(struct rsnd_dai *rdai,return -EIO ; } -list_add_tail (&mod->list, &io->head); + io->mod[mod->type] = mod; mod->io = io;return 0 ; } -static int rsnd_dai_disconnect (struct rsnd_mod *mod) +static int rsnd_dai_disconnect (struct rsnd_mod *mod,struct rsnd_dai_stream *io) { -list_del_init (&mod->list); + io->mod[mod->type] =NULL ; mod->io =NULL ;return 0 ;
@@ -596,7 +599,7 @@ static int rsnd_path_init(struct rsnd_priv *priv,/* SCU */ mod =rsnd_scu_mod_get (priv, id);if (mod) { - ret =rsnd_dai_connect (rdai, mod, io); + ret =rsnd_dai_connect (mod, io);if (ret <0 )return ret; }
@@ -604,7 +607,7 @@ static int rsnd_path_init(struct rsnd_priv *priv,/* SSI */ mod =rsnd_ssi_mod_get (priv, id);if (mod) { - ret =rsnd_dai_connect (rdai, mod, io); + ret =rsnd_dai_connect (mod, io);if (ret <0 )return ret; }
@@ -616,14 +619,18 @@ static int rsnd_path_exit(struct rsnd_priv *priv,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - struct rsnd_mod *mod, *n; -int ret =0 ; + struct rsnd_mod *mod; +int ret =0 , i;/* * remove all mod from rdai */ -for_each_rsnd_mod (mod, n, io) - ret |=rsnd_dai_disconnect (mod); +for (i =0 ; i <RSND_MOD_MAX ; i++) { + mod = io->mod[i]; +if (!mod) +continue ; + ret |=rsnd_dai_disconnect (mod, io); + }return ret; }
@@ -671,9 +678,6 @@ static int rsnd_dai_probe(struct platform_device *pdev,/* * init rsnd_dai */ -INIT_LIST_HEAD (&rdai[i].playback.head); -INIT_LIST_HEAD (&rdai[i].capture.head); -snprintf (rdai[i].name,RSND_DAI_NAME_SIZE ,"rsnd-dai.%d" , i);/*
sound/soc/sh/rcar/rsnd.h +8 -4
@@ -135,6 +135,11 @@ void rsnd_dma_quit(struct rsnd_priv *priv,/* * R-Car sound mod */ +enum rsnd_mod_type { +RSND_MOD_SCU =0 , +RSND_MOD_SSI , +RSND_MOD_MAX , +};struct rsnd_mod_ops {char *name;
@@ -155,9 +160,9 @@ struct rsnd_mod_ops {struct rsnd_dai_stream ;struct rsnd_mod {int id; +enum rsnd_mod_type type;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; };
@@ -167,12 +172,11 @@ struct rsnd_mod {#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)void rsnd_mod_init (struct rsnd_priv *priv,struct rsnd_mod *mod,struct rsnd_mod_ops *ops, +enum rsnd_mod_type type,int id);char *rsnd_mod_name (struct rsnd_mod *mod);
@@ -181,8 +185,8 @@ char *rsnd_mod_name(struct rsnd_mod *mod);*/ #define RSND_DAI_NAME_SIZE 16struct rsnd_dai_stream { -struct list_head head;/* head of rsnd_mod list */ struct snd_pcm_substream *substream; +struct rsnd_mod *mod[RSND_MOD_MAX ];int byte_pos;int period_pos;int byte_per_period;
sound/soc/sh/rcar/scu.c +1 -1
@@ -659,7 +659,7 @@ int rsnd_scu_probe(struct platform_device *pdev, ops = &rsnd_scu_non_gen2_ops; } -rsnd_mod_init (priv, &scu->mod, ops, i); +rsnd_mod_init (priv, &scu->mod, ops,RSND_MOD_SCU , i);dev_dbg (dev,"SCU%d probed\n" , i); }
sound/soc/sh/rcar/ssi.c +1 -1
@@ -584,7 +584,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,dev_dbg (dev,"SSI%d use PIO transfer\n" , i); } -rsnd_mod_init (priv, &ssi->mod, ops, i); +rsnd_mod_init (priv, &ssi->mod, ops,RSND_MOD_SSI , i);rsnd_ssi_parent_clk_setup (priv, ssi); }
Signature · 1 line
1.7.9.5
PATCH 3/8 ASoC: rsnd: get ssi/scu from rsnd_dai_stream
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Current driver is assuming that SSI id = SCU id.
But, now, it can get correct SSI/SCU fromrsnd_dai_stream. use it.
--- sound/soc/sh/rcar/rsnd.h | 4 +++- sound/soc/sh/rcar/scu.c | 20 +++++++++++--------- sound/soc/sh/rcar/ssi.c | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/rsnd.h +3 -1
@@ -192,6 +192,8 @@ struct rsnd_dai_stream {int byte_per_period;int next_period_byte; }; +#define rsnd_io_to_mod_ssi (io) ((io)->mod[RSND_MOD_SSI]) +#define rsnd_io_to_mod_scu (io) ((io)->mod[RSND_MOD_SCU])struct rsnd_dai {char name[RSND_DAI_NAME_SIZE ];
@@ -311,7 +313,7 @@ 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);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv, -struct rsnd_mod *ssi_mod, +struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime);#define rsnd_scu_nr (priv) ((priv)->scu_nr)
sound/soc/sh/rcar/scu.c +11 -9
@@ -121,7 +121,8 @@ static int rsnd_scu_ssi_mode_init(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); +struct rsnd_mod *ssi_mod =rsnd_io_to_mod_ssi (io); +int ssi_id =rsnd_mod_id (ssi_mod);u32 convert_rate =rsnd_scu_convert_rate (scu);if (convert_rate && !rsnd_dai_is_clk_master (rdai)) {
@@ -134,15 +135,15 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,/* * SSI_MODE0 */ -rsnd_mod_bset (mod,SSI_MODE0 , (1 << id), -rsnd_scu_hpbif_is_enable (scu) ?0 : (1 << id)); +rsnd_mod_bset (mod,SSI_MODE0 , (1 << ssi_id), +rsnd_scu_hpbif_is_enable (scu) ?0 : (1 << ssi_id));/* * SSI_MODE1 */ -if (rsnd_ssi_is_pin_sharing (rsnd_ssi_mod_get (priv, id))) { +if (rsnd_ssi_is_pin_sharing (ssi_mod)) {int shift =-1 ; -switch (id) { +switch (ssi_id) {case 1 : shift =0 ;break ;
@@ -165,14 +166,13 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod, }unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv, -struct rsnd_mod *ssi_mod, +struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime) {struct rsnd_scu *scu;unsigned int rate; -/* this function is assuming SSI id = SCU id here */ - scu =rsnd_mod_to_scu (rsnd_scu_mod_get (priv,rsnd_mod_id (ssi_mod))); + scu =rsnd_mod_to_scu (rsnd_io_to_mod_scu (io));/* * return convert rate if SRC is used,
@@ -583,8 +583,10 @@ static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { + struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io); +/* enable PIO interrupt */ - rsnd_mod_write(mod, INT_ENABLE, 0x0f000000); +rsnd_mod_write (ssi_mod,INT_ENABLE ,0x0f000000 );return 0 ; }
sound/soc/sh/rcar/ssi.c +1 -1
@@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, 1, 2, 4, 8, 16, 6, 12, };unsigned int main_rate; -unsigned int rate =rsnd_scu_get_ssi_rate (priv, &ssi->mod, runtime); +unsigned int rate =rsnd_scu_get_ssi_rate (priv, io, runtime);/* * Find best clock, and try to start ADG
Signature · 1 line
1.7.9.5
PATCH 4/8 ASoC: rsnd: use devm_clk_get() instead of clk_get()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/adg.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
sound/soc/sh/rcar/adg.c +9 -15
@@ -405,11 +405,11 @@ int rsnd_adg_probe(struct platform_device *pdev,return -ENOMEM ; } - clk_orig =clk_get (dev,NULL ); - adg->clk[CLKA ] =clk_get (dev,"clk_a" ); - adg->clk[CLKB ] =clk_get (dev,"clk_b" ); - adg->clk[CLKC ] =clk_get (dev,"clk_c" ); - adg->clk[CLKI ] =clk_get (dev,"clk_i" ); + clk_orig =devm_clk_get (dev,NULL ); + adg->clk[CLKA ] =devm_clk_get (dev,"clk_a" ); + adg->clk[CLKB ] =devm_clk_get (dev,"clk_b" ); + adg->clk[CLKC ] =devm_clk_get (dev,"clk_c" ); + adg->clk[CLKI ] =devm_clk_get (dev,"clk_i" );/* * It request device dependent audio clock.
@@ -432,10 +432,10 @@ int rsnd_adg_probe(struct platform_device *pdev,* but will be removed soon */ if (use_old_style) { - adg->clk[CLKA ] =clk_get (NULL ,"audio_clk_a" ); - adg->clk[CLKB ] =clk_get (NULL ,"audio_clk_b" ); - adg->clk[CLKC ] =clk_get (NULL ,"audio_clk_c" ); - adg->clk[CLKI ] =clk_get (NULL ,"audio_clk_internal" ); + adg->clk[CLKA ] =devm_clk_get (NULL ,"audio_clk_a" ); + adg->clk[CLKB ] =devm_clk_get (NULL ,"audio_clk_b" ); + adg->clk[CLKC ] =devm_clk_get (NULL ,"audio_clk_c" ); + adg->clk[CLKI ] =devm_clk_get (NULL ,"audio_clk_internal" ); }for_each_rsnd_clk (clk, adg, i) {
@@ -457,10 +457,4 @@ int rsnd_adg_probe(struct platform_device *pdev,void rsnd_adg_remove (struct platform_device *pdev,struct rsnd_priv *priv) { -struct rsnd_adg *adg = priv->adg; -struct clk *clk; -int i; - -for_each_rsnd_clk (clk, adg, i) -clk_put (clk); }
Signature · 1 line
1.7.9.5
PATCH 5/8 ASoC: rsnd: use function pointer for each probe
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-)
sound/soc/sh/rcar/core.c +14 -20
@@ -814,7 +814,15 @@ static int rsnd_probe(struct platform_device *pdev)struct rcar_snd_info *info;struct rsnd_priv *priv;struct device *dev = &pdev->dev; -int ret; +int (*probe_func[])(struct platform_device *pdev, +struct rsnd_priv *priv) = { + rsnd_gen_probe, + rsnd_ssi_probe, + rsnd_scu_probe, + rsnd_adg_probe, + rsnd_dai_probe, + }; +int ret, i; info = pdev->dev.platform_data;if (!info) {
@@ -838,25 +846,11 @@ static int rsnd_probe(struct platform_device *pdev)/* * init each module */ - ret =rsnd_gen_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_ssi_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_scu_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_adg_probe (pdev, priv); -if (ret) -return ret; - - ret =rsnd_dai_probe (pdev, priv); -if (ret) -return ret; +for (i =0 ; i <ARRAY_SIZE (probe_func); i++) { + ret = probe_func[i](pdev, priv); +if (ret) +return ret; + }/* * asoc register
Signature · 1 line
1.7.9.5
PATCH 6/8 ASoC: rsnd: remove unused SSI_CONTROL
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/gen.c | 1 - sound/soc/sh/rcar/rsnd.h | 1 - 2 files changed, 2 deletions(-)
sound/soc/sh/rcar/gen.c +0 -1
@@ -173,7 +173,6 @@ 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),
sound/soc/sh/rcar/rsnd.h +0 -1
@@ -39,7 +39,6 @@ enum rsnd_reg {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,
Signature · 1 line
1.7.9.5
PATCH 7/8 ASoC: rsnd: modify rsnd_adg_ssi_ws_timing_gen2() parameter
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- sound/soc/sh/rcar/adg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/adg.c +4 -3
@@ -32,8 +32,9 @@ struct rsnd_adg {#define rsnd_priv_to_adg (priv) ((struct rsnd_adg *)(priv)->adg) -static u32 rsnd_adg_ssi_ws_timing_gen2 (struct rsnd_mod *mod) +static u32 rsnd_adg_ssi_ws_timing_gen2 (struct rsnd_dai_stream *io) { +struct rsnd_mod *mod =rsnd_io_to_mod_ssi (io);struct rsnd_priv *priv =rsnd_mod_to_priv (mod);int id =rsnd_mod_id (mod);int ws = id;
@@ -67,7 +68,7 @@ static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai,u32 mask, ws;u32 in, out; - ws =rsnd_adg_ssi_ws_timing_gen2 (mod); + ws =rsnd_adg_ssi_ws_timing_gen2 (io); in = (is_play) ? timsel : ws; out = (is_play) ? ws : timsel;
@@ -174,7 +175,7 @@ int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - u32 val = rsnd_adg_ssi_ws_timing_gen2(mod); + u32 val = rsnd_adg_ssi_ws_timing_gen2(io);return rsnd_adg_set_src_timsel_gen2 (rdai, mod, io, val); }
Signature · 1 line
1.7.9.5
PATCH 8/8 ASoC: rsnd: share reg_field and reduce memory
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/rsnd.h | 81 ++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 28 deletions(-)
sound/soc/sh/rcar/rsnd.h +53 -28
@@ -32,18 +32,8 @@*/ enum rsnd_reg {/* SRU/SCU/SSIU */ -RSND_REG_SRC_ROUTE_SEL ,/* for Gen1 */ -RSND_REG_SRC_TMG_SEL0 ,/* for Gen1 */ -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_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 */ RSND_REG_SRC_BUSIF_MODE ,RSND_REG_SRC_ROUTE_MODE0 ,RSND_REG_SRC_SWRSR ,
@@ -52,9 +42,6 @@ enum rsnd_reg {RSND_REG_SRC_IFSCR ,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,
@@ -62,21 +49,6 @@ enum rsnd_reg {RSND_REG_SSICKR ,RSND_REG_AUDIO_CLK_SEL0 ,RSND_REG_AUDIO_CLK_SEL1 , -RSND_REG_AUDIO_CLK_SEL2 , -RSND_REG_AUDIO_CLK_SEL3 ,/* for Gen1 */ -RSND_REG_AUDIO_CLK_SEL4 ,/* for Gen1 */ -RSND_REG_AUDIO_CLK_SEL5 ,/* for Gen1 */ -RSND_REG_DIV_EN ,/* for Gen2 */ -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,
@@ -85,9 +57,62 @@ enum rsnd_reg {RSND_REG_SSIRDR ,RSND_REG_SSIWSR , +/* SHARE see below */ +RSND_REG_SHARE01 , +RSND_REG_SHARE02 , +RSND_REG_SHARE03 , +RSND_REG_SHARE04 , +RSND_REG_SHARE05 , +RSND_REG_SHARE06 , +RSND_REG_SHARE07 , +RSND_REG_SHARE08 , +RSND_REG_SHARE09 , +RSND_REG_SHARE10 , +RSND_REG_SHARE11 , +RSND_REG_SHARE12 , +RSND_REG_SHARE13 , +RSND_REG_SHARE14 , +RSND_REG_SHARE15 , +RSND_REG_SHARE16 , +RSND_REG_SHARE17 , +RSND_REG_SHARE18 , +RSND_REG_SHARE19 , + RSND_REG_MAX, }; +/* Gen1 only */ +#define RSND_REG_SRC_ROUTE_SEL RSND_REG_SHARE01 +#define RSND_REG_SRC_TMG_SEL0 RSND_REG_SHARE02 +#define RSND_REG_SRC_TMG_SEL1 RSND_REG_SHARE03 +#define RSND_REG_SRC_TMG_SEL2 RSND_REG_SHARE04 +#define RSND_REG_SRC_ROUTE_CTRL RSND_REG_SHARE05 +#define RSND_REG_SRC_MNFSR RSND_REG_SHARE06 +#define RSND_REG_AUDIO_CLK_SEL3 RSND_REG_SHARE07 +#define RSND_REG_AUDIO_CLK_SEL4 RSND_REG_SHARE08 +#define RSND_REG_AUDIO_CLK_SEL5 RSND_REG_SHARE09 + +/* Gen2 only */ +#define RSND_REG_SRC_CTRL RSND_REG_SHARE01 +#define RSND_REG_SSI_CTRL RSND_REG_SHARE02 +#define RSND_REG_SSI_BUSIF_MODE RSND_REG_SHARE03 +#define RSND_REG_SSI_BUSIF_ADINR RSND_REG_SHARE04 +#define RSND_REG_INT_ENABLE RSND_REG_SHARE05 +#define RSND_REG_SRC_BSDSR RSND_REG_SHARE06 +#define RSND_REG_SRC_BSISR RSND_REG_SHARE07 +#define RSND_REG_DIV_EN RSND_REG_SHARE08 +#define RSND_REG_SRCIN_TIMSEL0 RSND_REG_SHARE09 +#define RSND_REG_SRCIN_TIMSEL1 RSND_REG_SHARE10 +#define RSND_REG_SRCIN_TIMSEL2 RSND_REG_SHARE11 +#define RSND_REG_SRCIN_TIMSEL3 RSND_REG_SHARE12 +#define RSND_REG_SRCIN_TIMSEL4 RSND_REG_SHARE13 +#define RSND_REG_SRCOUT_TIMSEL0 RSND_REG_SHARE14 +#define RSND_REG_SRCOUT_TIMSEL1 RSND_REG_SHARE15 +#define RSND_REG_SRCOUT_TIMSEL2 RSND_REG_SHARE16 +#define RSND_REG_SRCOUT_TIMSEL3 RSND_REG_SHARE17 +#define RSND_REG_SRCOUT_TIMSEL4 RSND_REG_SHARE18 +#define RSND_REG_AUDIO_CLK_SEL2 RSND_REG_SHARE19 +struct rsnd_priv ;struct rsnd_mod ;struct rsnd_dai ;
Signature · 1 line
1.7.9.5
Re: [PATCH 06/19] ASoC: rsnd: add .set_sysclk on snd_soc_dai_ops
In reply to Kuninori MorimotoHi Mark again
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
We should fix the simple-card code so that it does not need this rather than adding empty functions to all the drivers - I'd expect it to handle
-ENOTSUPPas not an error.
(snip)
Quoted 2 lines
Oops, I was misunderstanding.
I see, I will add-ENOTSUPPsupport.
Current mark/topic/simple already has -ENOTSUPP support. Thank you
Re: [PATCH 1/8] ASoC: rsnd: run rsnd_path_init() when probe() timing
In reply to Kuninori MorimotoQuoted 7 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
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 inprobe()timing. This patch sets the path onprobe()timing.
Applied all, thanks.
Hi Mark
These are Renesas R-Car sound driver patches v2.
1) cleanup patches
2) new feature patches
These are 2) part patches.
#1, #2 patches add new style (= rsnd_dai_platform_info) to driver. Current driver is still keeping compatible to old style, but it will be removed after marge.
#10 is big patch, since it renames scu to src.
These #1, #2, and #10 are important for DT support
These are based on latest mark/topic/rcar
Kuninori Morimoto (11):
1) ASoC: rsnd: add struct rsnd_dai_platform_info
2) ASoC: rsnd: Get correct SCU ID
3) ASoC: rsnd: add rsnd_scu_enable_ssi_irq()
4) ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI
5) ASoC: rsnd: add probe/remove callback on rsnd_mod_ops
6) ASoC: rsnd: use mod probe method on SCU
7) ASoC: rsnd: use mod probe method on SSI
8) ASoC: rsnd: nothing to do on rsnd_dai_remove()
9) ASoC: rsnd: remove all rsnd_xxx_remove()
10) ASoC: rsnd: rename scu to src
11) ASoC: rsnd: add DeviceTree support
.../devicetree/bindings/sound/renesas,rsnd.txt | 101 +++ include/sound/rcar_snd.h | 32 +- sound/soc/sh/rcar/Makefile | 2 +- sound/soc/sh/rcar/adg.c | 6 +- sound/soc/sh/rcar/core.c | 259 +++++-- sound/soc/sh/rcar/gen.c | 20 +- sound/soc/sh/rcar/rsnd.h | 65 +- sound/soc/sh/rcar/scu.c | 682 ------------------ sound/soc/sh/rcar/src.c | 723 ++++++++++++++++++++ sound/soc/sh/rcar/ssi.c | 190 +++-- 10 files changed, 1242 insertions(+), 838 deletions(-)
PATCH 1/11 ASoC: rsnd: add struct rsnd_dai_platform_info
From: Kuninori Morimoto <[email protected]>
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.
--- include/sound/rcar_snd.h | 17 ++++++++++++++++- sound/soc/sh/rcar/core.c | 23 ++++++++++++++++------- sound/soc/sh/rcar/ssi.c | 14 ++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-)
include/sound/rcar_snd.h +16 -1
@@ -36,13 +36,15 @@#define RSND_SSI_CLK_PIN_SHARE (1 << 31)#define RSND_SSI_PLAY (1 << 24) +#define RSND_SSI (_dma_id, _pio_irq, _flags) \ +{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }#define RSND_SSI_SET (_dai_id, _dma_id, _pio_irq, _flags) \ { .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }#define RSND_SSI_UNUSED \ { .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }struct rsnd_ssi_platform_info { -int dai_id; +int dai_id;/* will be removed */ int dma_id;int pio_irq;u32 flags;
@@ -53,6 +55,8 @@ struct rsnd_ssi_platform_info {*/ #define RSND_SCU_USE_HPBIF (1 << 31)/* it needs RSND_SSI_DEPENDENT */ +#define RSND_SCU (rate, _dma_id) \ +{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }#define RSND_SCU_SET (rate, _dma_id) \ { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }#define RSND_SCU_UNUSED \
@@ -64,6 +68,15 @@ struct rsnd_scu_platform_info {int dma_id;/* for Gen2 SCU */ }; +struct rsnd_dai_path_info { +struct rsnd_ssi_platform_info *ssi; +}; + +struct rsnd_dai_platform_info { +struct rsnd_dai_path_info playback; +struct rsnd_dai_path_info capture; +}; +/* * flags *
@@ -81,6 +94,8 @@ struct rcar_snd_info {int ssi_info_nr;struct rsnd_scu_platform_info *scu_info;int scu_info_nr; +struct rsnd_dai_platform_info *dai_info; +int dai_info_nr;int (*start)(int id);int (*stop)(int id); };
sound/soc/sh/rcar/core.c +16 -7
@@ -639,19 +639,26 @@ static int rsnd_dai_probe(struct platform_device *pdev, struct rsnd_priv *priv) {struct snd_soc_dai_driver *drv; +struct rcar_snd_info *info =rsnd_priv_to_info (priv);struct rsnd_dai *rdai;struct rsnd_mod *pmod, *cmod;struct device *dev =rsnd_priv_to_dev (priv); -int dai_nr; +int dai_nr = info->dai_info_nr;int i; -/* get max dai nr */ -for (dai_nr =0 ; dai_nr <32 ; dai_nr++) { - pmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,1 ); - cmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,0 ); +/* +* dai_nr should be set via dai_info_nr, +* but allow it to keeping compatible +*/ +if (!dai_nr) { +/* get max dai nr */ +for (dai_nr =0 ; dai_nr <32 ; dai_nr++) { + pmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,1 ); + cmod =rsnd_ssi_mod_get_frm_dai (priv, dai_nr,0 ); -if (!pmod && !cmod) -break ; +if (!pmod && !cmod) +break ; + } }if (!dai_nr) {
@@ -671,6 +678,8 @@ static int rsnd_dai_probe(struct platform_device *pdev, priv->rdai = rdai;for (i =0 ; i < dai_nr; i++) { +if (info->dai_info) + rdai[i].info = &info->dai_info[i]; pmod =rsnd_ssi_mod_get_frm_dai (priv, i,1 ); cmod =rsnd_ssi_mod_get_frm_dai (priv, i,0 );
sound/soc/sh/rcar/ssi.c +14 -0
@@ -451,12 +451,26 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = {struct rsnd_mod *rsnd_ssi_mod_get_frm_dai (struct rsnd_priv *priv,int dai_id,int is_play) { +struct rsnd_dai_platform_info *dai_info =NULL ; +struct rsnd_dai_path_info *path_info =NULL ; +struct rsnd_ssi_platform_info *target_info =NULL ;struct rsnd_ssi *ssi;int i, has_play; +if (priv->rdai) + dai_info = priv->rdai[dai_id].info; +if (dai_info) + path_info = (is_play) ? &dai_info->playback : &dai_info->capture; +if (path_info) + target_info = path_info->ssi; + is_play = !!is_play;for_each_rsnd_ssi (ssi, priv, i) { +if (target_info == ssi->info) +return &ssi->mod; + +/* for compatible */ if (rsnd_ssi_dai_id (ssi) != dai_id)continue ;
Signature · 1 line
1.7.9.5
PATCH 2/11 ASoC: rsnd: Get correct SCU ID
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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
--- include/sound/rcar_snd.h | 1 + sound/soc/sh/rcar/core.c | 47 ++++++++++++++++++++++++++++++++-------------- sound/soc/sh/rcar/rsnd.h | 14 ++++++++++++++ sound/soc/sh/rcar/scu.c | 21 ++++++++++++++++----- sound/soc/sh/rcar/ssi.c | 9 ++++++++- 5 files changed, 72 insertions(+), 20 deletions(-)
include/sound/rcar_snd.h +1 -0
@@ -70,6 +70,7 @@ struct rsnd_scu_platform_info {struct rsnd_dai_path_info {struct rsnd_ssi_platform_info *ssi; +struct rsnd_scu_platform_info *scu; };struct rsnd_dai_platform_info {
sound/soc/sh/rcar/core.c +33 -14
88 lines not on this page · raw message
sound/soc/sh/rcar/rsnd.h +14 -0
@@ -211,6 +211,7 @@ char *rsnd_mod_name(struct rsnd_mod *mod);struct rsnd_dai_stream {struct snd_pcm_substream *substream;struct rsnd_mod *mod[RSND_MOD_MAX ]; +struct rsnd_dai_path_info *info;/* rcar_snd.h */ int byte_pos;int period_pos;int byte_per_period;
@@ -328,6 +329,19 @@ struct rsnd_priv {#define rsnd_lock (priv, flags) spin_lock_irqsave(&priv->lock, flags)#define rsnd_unlock (priv, flags) spin_unlock_irqrestore(&priv->lock, flags) +#define rsnd_info_is_playback (priv, type) \ +({ \ + struct rcar_snd_info *info = rsnd_priv_to_info(priv); \ + int i, is_play = 0; \ + for (i = 0; i < info->dai_info_nr; i++) { \ + if (info->dai_info[i].playback.type == (type)->info) { \ + is_play = 1; \ + break; \ + } \ + } \ + is_play; \ +}) +/* * R-Car SCU */
sound/soc/sh/rcar/scu.c +16 -5
@@ -620,6 +620,9 @@ int rsnd_scu_probe(struct platform_device *pdev,* init SCU */ nr = info->scu_info_nr; +if (!nr) +return 0 ; + scu =devm_kzalloc (dev,sizeof (*scu) * nr,GFP_KERNEL );if (!scu) {dev_err (dev,"SCU allocate failed\n" );
@@ -644,11 +647,19 @@ int rsnd_scu_probe(struct platform_device *pdev,if (rsnd_is_gen1 (priv)) ops = &rsnd_scu_gen1_ops;if (rsnd_is_gen2 (priv)) { -struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv, i); -int ret =rsnd_dma_init (priv, -rsnd_mod_to_dma (&scu->mod), -rsnd_ssi_is_play (ssi), - scu->info->dma_id); +int ret; +int is_play; + +if (info->dai_info) { + is_play =rsnd_info_is_playback (priv, scu); + }else { +struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv, i); + is_play =rsnd_ssi_is_play (ssi); + } + ret =rsnd_dma_init (priv, +rsnd_mod_to_dma (&scu->mod), + is_play, + scu->info->dma_id);if (ret <0 )return ret;
sound/soc/sh/rcar/ssi.c +8 -1
@@ -567,9 +567,16 @@ int rsnd_ssi_probe(struct platform_device *pdev,* SSI DMA case */ if (pinfo->dma_id >0 ) { +int is_play; + +if (info->dai_info) + is_play =rsnd_info_is_playback (priv, ssi); +else + is_play =rsnd_ssi_is_play (&ssi->mod); + ret =rsnd_dma_init ( priv,rsnd_mod_to_dma (&ssi->mod), -rsnd_ssi_is_play (&ssi->mod), + is_play, pinfo->dma_id);if (ret <0 )dev_info (dev,"SSI DMA failed. try PIO transter\n" );
Signature · 1 line
1.7.9.5
PATCH 3/11 ASoC: rsnd: add rsnd_scu_enable_ssi_irq()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/rsnd.h | 3 +++ sound/soc/sh/rcar/scu.c | 26 +++++++++++++------------- sound/soc/sh/rcar/ssi.c | 2 ++ 3 files changed, 18 insertions(+), 13 deletions(-)
sound/soc/sh/rcar/rsnd.h +3 -0
@@ -353,6 +353,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime); +int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);#define rsnd_scu_nr (priv) ((priv)->scu_nr)
sound/soc/sh/rcar/scu.c +13 -13
@@ -165,6 +165,19 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,return 0 ; } +int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_priv *priv =rsnd_mod_to_priv (ssi_mod); + +/* enable PIO interrupt if Gen2 */ +if (rsnd_is_gen2 (priv)) +rsnd_mod_write (ssi_mod,INT_ENABLE ,0x0f000000 ); + +return 0 ; +} +unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime)
@@ -579,22 +592,9 @@ static struct rsnd_mod_ops rsnd_scu_gen2_ops = { .stop = rsnd_scu_stop_gen2, }; -static int rsnd_scu_start_non_gen2 (struct rsnd_mod *mod, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) -{ -struct rsnd_mod *ssi_mod =rsnd_io_to_mod_ssi (io); - -/* enable PIO interrupt */ -rsnd_mod_write (ssi_mod,INT_ENABLE ,0x0f000000 ); - -return 0 ; -} -static struct rsnd_mod_ops rsnd_scu_non_gen2_ops = { .name ="non-scu (gen2)" , .init = rsnd_scu_ssi_mode_init, - .start = rsnd_scu_start_non_gen2, };struct rsnd_mod *rsnd_scu_mod_get (struct rsnd_priv *priv,int id)
sound/soc/sh/rcar/ssi.c +2 -0
@@ -365,6 +365,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,/* enable PIO IRQ */ ssi->cr_etc =UIEN |OIEN |DIEN ; +rsnd_scu_enable_ssi_irq (mod, rdai, io); +rsnd_ssi_hw_start (ssi, rdai, io);return 0 ;
Signature · 1 line
1.7.9.5
PATCH 4/11 ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/rsnd.h | 3 +++ sound/soc/sh/rcar/scu.c | 54 +++++++++++++++------------------------------- sound/soc/sh/rcar/ssi.c | 2 ++ 3 files changed, 22 insertions(+), 37 deletions(-)
sound/soc/sh/rcar/rsnd.h +3 -0
@@ -353,6 +353,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime); +int rsnd_scu_ssi_mode_init (struct rsnd_mod *ssi_mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io);
sound/soc/sh/rcar/scu.c +17 -37
99 lines not on this page · raw message
sound/soc/sh/rcar/ssi.c +2 -0
@@ -287,6 +287,8 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ssi->cr_own = cr; ssi->err =-1 ;/* ignore 1st error */ +rsnd_scu_ssi_mode_init (mod, rdai, io); +return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 5/11 ASoC: rsnd: add probe/remove callback on rsnd_mod_ops
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- sound/soc/sh/rcar/core.c | 23 +++++++++++++++++++++++ sound/soc/sh/rcar/rsnd.h | 6 ++++++ 2 files changed, 29 insertions(+)
sound/soc/sh/rcar/core.c +23 -0
@@ -842,6 +842,7 @@ static int rsnd_probe(struct platform_device *pdev)struct rcar_snd_info *info;struct rsnd_priv *priv;struct device *dev = &pdev->dev; +struct rsnd_dai *rdai;int (*probe_func[])(struct platform_device *pdev,struct rsnd_priv *priv) = { rsnd_gen_probe,
@@ -880,6 +881,16 @@ static int rsnd_probe(struct platform_device *pdev)return ret; } +for_each_rsnd_dai (rdai, priv, i) { + ret =rsnd_dai_call (rdai, &rdai->playback, probe); +if (ret) +return ret; + + ret =rsnd_dai_call (rdai, &rdai->capture, probe); +if (ret) +return ret; + } +/* * asoc register */
@@ -912,9 +923,21 @@ exit_snd_soc:static int rsnd_remove (struct platform_device *pdev) {struct rsnd_priv *priv =dev_get_drvdata (&pdev->dev); +struct rsnd_dai *rdai; +int ret, i;pm_runtime_disable (&pdev->dev); +for_each_rsnd_dai (rdai, priv, i) { + ret =rsnd_dai_call (rdai, &rdai->playback, remove); +if (ret) +return ret; + + ret =rsnd_dai_call (rdai, &rdai->capture, remove); +if (ret) +return ret; + } +/* * remove each module */
sound/soc/sh/rcar/rsnd.h +6 -0
@@ -167,6 +167,12 @@ enum rsnd_mod_type {struct rsnd_mod_ops {char *name; +int (*probe)(struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io); +int (*remove)(struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io);int (*init)(struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io);
Signature · 1 line
1.7.9.5
PATCH 6/11 ASoC: rsnd: use mod probe method on SCU
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Now, it can use .probe
--- sound/soc/sh/rcar/scu.c | 64 +++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 25 deletions(-)
sound/soc/sh/rcar/scu.c +39 -25
@@ -525,6 +525,42 @@ static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod,return ret; } +static int rsnd_scu_probe_gen2 (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +struct rsnd_priv *priv =rsnd_mod_to_priv (mod); +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_scu *scu =rsnd_mod_to_scu (mod); +struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv,rsnd_mod_id (mod)); +struct device *dev =rsnd_priv_to_dev (priv); +int ret; +int is_play; + +if (info->dai_info) + is_play =rsnd_info_is_playback (priv, scu); +else + is_play =rsnd_ssi_is_play (ssi); + + ret =rsnd_dma_init (priv, +rsnd_mod_to_dma (mod), + is_play, + scu->info->dma_id); +if (ret <0 ) +dev_err (dev,"SCU DMA failed\n" ); + +return ret; +} + +static int rsnd_scu_remove_gen2 (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +rsnd_dma_quit (rsnd_mod_to_priv (mod),rsnd_mod_to_dma (mod)); + +return 0 ; +} +static int rsnd_scu_init_gen2 (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -576,6 +612,8 @@ static int rsnd_scu_stop_gen2(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_scu_gen2_ops = { .name ="scu (gen2)" , + .probe = rsnd_scu_probe_gen2, + .remove = rsnd_scu_remove_gen2, .init = rsnd_scu_init_gen2, .quit = rsnd_scu_quit, .start = rsnd_scu_start_gen2,
@@ -631,25 +669,8 @@ int rsnd_scu_probe(struct platform_device *pdev,if (rsnd_scu_hpbif_is_enable (scu)) {if (rsnd_is_gen1 (priv)) ops = &rsnd_scu_gen1_ops; -if (rsnd_is_gen2 (priv)) { -int ret; -int is_play; - -if (info->dai_info) { - is_play =rsnd_info_is_playback (priv, scu); - }else { -struct rsnd_mod *ssi =rsnd_ssi_mod_get (priv, i); - is_play =rsnd_ssi_is_play (ssi); - } - ret =rsnd_dma_init (priv, -rsnd_mod_to_dma (&scu->mod), - is_play, - scu->info->dma_id); -if (ret <0 ) -return ret; - +if (rsnd_is_gen2 (priv)) ops = &rsnd_scu_gen2_ops; - } }rsnd_mod_init (priv, &scu->mod, ops,RSND_MOD_SCU , i);
@@ -663,11 +684,4 @@ int rsnd_scu_probe(struct platform_device *pdev,void rsnd_scu_remove (struct platform_device *pdev,struct rsnd_priv *priv) { -struct rsnd_scu *scu; -int i; - -for_each_rsnd_scu (scu, priv, i) { -if (rsnd_scu_dma_available (scu)) -rsnd_dma_quit (priv,rsnd_mod_to_dma (&scu->mod)); - } }
Signature · 1 line
1.7.9.5
PATCH 7/11 ASoC: rsnd: use mod probe method on SSI
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Now, it can use .probe
--- sound/soc/sh/rcar/ssi.c | 116 ++++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 51 deletions(-)
sound/soc/sh/rcar/ssi.c +65 -51
@@ -358,6 +358,26 @@ static irqreturn_t rsnd_ssi_pio_interrupt(int irq, void *data)return ret; } +static int rsnd_ssi_pio_probe (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); +int irq = ssi->info->pio_irq; +int ret; + + ret =devm_request_irq (dev, irq, + rsnd_ssi_pio_interrupt, +IRQF_SHARED , +dev_name (dev), ssi); +if (ret) +dev_err (dev,"SSI request interrupt failed\n" ); + +return ret; +} +static int rsnd_ssi_pio_start (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -389,12 +409,50 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_ssi_pio_ops = { .name ="ssi (pio)" , + .probe = rsnd_ssi_pio_probe, .init = rsnd_ssi_init, .quit = rsnd_ssi_quit, .start = rsnd_ssi_pio_start, .stop = rsnd_ssi_pio_stop, }; +static int rsnd_ssi_dma_probe (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); +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct device *dev =rsnd_priv_to_dev (priv); +int dma_id = ssi->info->dma_id; +int is_play; +int ret; + +if (info->dai_info) + is_play =rsnd_info_is_playback (priv, ssi); +else + is_play =rsnd_ssi_is_play (&ssi->mod); + + ret =rsnd_dma_init ( + priv,rsnd_mod_to_dma (mod), + is_play, + dma_id); + +if (ret <0 ) +dev_err (dev,"SSI DMA failed\n" ); + +return ret; +} + +static int rsnd_ssi_dma_remove (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct rsnd_dai_stream *io) +{ +rsnd_dma_quit (rsnd_mod_to_priv (mod),rsnd_mod_to_dma (mod)); + +return 0 ; +} +static int rsnd_ssi_dma_start (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io)
@@ -436,6 +494,8 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_ssi_dma_ops = { .name ="ssi (dma)" , + .probe = rsnd_ssi_dma_probe, + .remove = rsnd_ssi_dma_remove, .init = rsnd_ssi_init, .quit = rsnd_ssi_quit, .start = rsnd_ssi_dma_start,
@@ -538,7 +598,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,struct clk *clk;struct rsnd_ssi *ssi;char name[RSND_SSI_NAME_SIZE ]; -int i, nr, ret; +int i, nr;/* * init SSI
@@ -566,48 +626,10 @@ int rsnd_ssi_probe(struct platform_device *pdev, ssi->clk = clk; ops = &rsnd_ssi_non_ops; - -/* -* SSI DMA case -*/ -if (pinfo->dma_id >0 ) { -int is_play; - -if (info->dai_info) - is_play =rsnd_info_is_playback (priv, ssi); -else - is_play =rsnd_ssi_is_play (&ssi->mod); - - ret =rsnd_dma_init ( - priv,rsnd_mod_to_dma (&ssi->mod), - is_play, - pinfo->dma_id); -if (ret <0 ) -dev_info (dev,"SSI DMA failed. try PIO transter\n" ); -else - ops = &rsnd_ssi_dma_ops; - -dev_dbg (dev,"SSI%d use DMA transfer\n" , i); - } - -/* -* SSI PIO case -*/ -if (!rsnd_ssi_dma_available (ssi) && -rsnd_ssi_pio_available (ssi)) { - ret =devm_request_irq (dev, pinfo->pio_irq, - &rsnd_ssi_pio_interrupt, -IRQF_SHARED , -dev_name (dev), ssi); -if (ret) { -dev_err (dev,"SSI request interrupt failed\n" ); -return ret; - } - - ops = &rsnd_ssi_pio_ops; - -dev_dbg (dev,"SSI%d use PIO transfer\n" , i); - } +if (pinfo->dma_id >0 ) + ops = &rsnd_ssi_dma_ops; +else if (rsnd_ssi_pio_available (ssi)) + ops = &rsnd_ssi_pio_ops;rsnd_mod_init (priv, &ssi->mod, ops,RSND_MOD_SSI , i);
@@ -620,12 +642,4 @@ int rsnd_ssi_probe(struct platform_device *pdev,void rsnd_ssi_remove (struct platform_device *pdev,struct rsnd_priv *priv) { -struct rsnd_ssi *ssi; -int i; - -for_each_rsnd_ssi (ssi, priv, i) { -if (rsnd_ssi_dma_available (ssi)) -rsnd_dma_quit (priv,rsnd_mod_to_dma (&ssi->mod)); - } - }
Signature · 1 line
1.7.9.5
PATCH 8/11 ASoC: rsnd: nothing to do on rsnd_dai_remove()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
rsnd_dai_remove() called rsnd_path_exit(),
but these memory will be cleaned automatically.
Because it is created by devm_kzalloc().
nothing to do on rsnd_dai_remove()
--- sound/soc/sh/rcar/core.c | 36 ------------------------------------ 1 file changed, 36 deletions(-)
sound/soc/sh/rcar/core.c +0 -36
@@ -348,14 +348,6 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,return 0 ; } -static int rsnd_dai_disconnect (struct rsnd_mod *mod,struct rsnd_dai_stream *io) -{ - io->mod[mod->type] =NULL ; - mod->io =NULL ; - -return 0 ; -} -int rsnd_dai_id (struct rsnd_priv *priv,struct rsnd_dai *rdai) {int id = rdai - priv->rdai;
@@ -628,26 +620,6 @@ static int rsnd_path_init(struct rsnd_priv *priv,return ret; } -static int rsnd_path_exit (struct rsnd_priv *priv, -struct rsnd_dai *rdai, -struct rsnd_dai_stream *io) -{ -struct rsnd_mod *mod; -int ret =0 , i; - -/* -* remove all mod from rdai -*/ -for (i =0 ; i <RSND_MOD_MAX ; i++) { - mod = io->mod[i]; -if (!mod) -continue ; - ret |=rsnd_dai_disconnect (mod, io); - } - -return ret; -} -static int rsnd_dai_probe (struct platform_device *pdev,struct rsnd_priv *priv) {
@@ -739,14 +711,6 @@ static int rsnd_dai_probe(struct platform_device *pdev,static void rsnd_dai_remove (struct platform_device *pdev,struct rsnd_priv *priv) { -struct rsnd_dai *rdai; -int i; - -for (i =0 ; i <rsnd_rdai_nr (priv); i++) { - rdai =rsnd_dai_get (priv, i); -rsnd_path_exit (priv, rdai, &rdai->playback); -rsnd_path_exit (priv, rdai, &rdai->capture); - } }/*
Signature · 1 line
1.7.9.5
PATCH 9/11 ASoC: rsnd: remove all rsnd_xxx_remove()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Now, rsnd_xxx_remove() do nothing.
remove these
--- sound/soc/sh/rcar/adg.c | 5 ----- sound/soc/sh/rcar/core.c | 14 -------------- sound/soc/sh/rcar/gen.c | 5 ----- sound/soc/sh/rcar/rsnd.h | 8 -------- sound/soc/sh/rcar/scu.c | 5 ----- sound/soc/sh/rcar/ssi.c | 5 ----- 6 files changed, 42 deletions(-)
sound/soc/sh/rcar/adg.c +0 -5
@@ -454,8 +454,3 @@ int rsnd_adg_probe(struct platform_device *pdev,return 0 ; } - -void rsnd_adg_remove (struct platform_device *pdev, -struct rsnd_priv *priv) -{ -}
sound/soc/sh/rcar/core.c +0 -14
@@ -708,11 +708,6 @@ static int rsnd_dai_probe(struct platform_device *pdev,return 0 ; } -static void rsnd_dai_remove (struct platform_device *pdev, -struct rsnd_priv *priv) -{ -} -/* * pcm ops */
@@ -902,15 +897,6 @@ static int rsnd_remove(struct platform_device *pdev)return ret; } -/* -* remove each module -*/ -rsnd_ssi_remove (pdev, priv); -rsnd_adg_remove (pdev, priv); -rsnd_scu_remove (pdev, priv); -rsnd_dai_remove (pdev, priv); -rsnd_gen_remove (pdev, priv); -return 0 ; }
sound/soc/sh/rcar/gen.c +0 -5
@@ -385,8 +385,3 @@ int rsnd_gen_probe(struct platform_device *pdev,return ret; } - -void rsnd_gen_remove (struct platform_device *pdev, -struct rsnd_priv *priv) -{ -}
sound/soc/sh/rcar/rsnd.h +0 -8
@@ -261,8 +261,6 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);*/ int rsnd_gen_probe (struct platform_device *pdev,struct rsnd_priv *priv); -void rsnd_gen_remove (struct platform_device *pdev, -struct rsnd_priv *priv);void __iomem *rsnd_gen_reg_get (struct rsnd_priv *priv,struct rsnd_mod *mod,enum rsnd_reg reg);
@@ -276,8 +274,6 @@ int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod);int rsnd_adg_ssi_clk_try_start (struct rsnd_mod *mod,unsigned int rate);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_gen1(struct rsnd_priv *priv, struct rsnd_mod *mod, unsigned int src_rate,
@@ -353,8 +349,6 @@ struct rsnd_priv {*/ int rsnd_scu_probe (struct platform_device *pdev,struct rsnd_priv *priv); -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); unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, struct rsnd_dai_stream *io,
@@ -373,8 +367,6 @@ int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod,*/ int rsnd_ssi_probe (struct platform_device *pdev,struct rsnd_priv *priv); -void rsnd_ssi_remove (struct platform_device *pdev, -struct rsnd_priv *priv);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);
sound/soc/sh/rcar/scu.c +0 -5
@@ -680,8 +680,3 @@ int rsnd_scu_probe(struct platform_device *pdev,return 0 ; } - -void rsnd_scu_remove (struct platform_device *pdev, -struct rsnd_priv *priv) -{ -}
sound/soc/sh/rcar/ssi.c +0 -5
@@ -638,8 +638,3 @@ int rsnd_ssi_probe(struct platform_device *pdev,return 0 ; } - -void rsnd_ssi_remove (struct platform_device *pdev, -struct rsnd_priv *priv) -{ -}
Signature · 1 line
1.7.9.5
PATCH 10/11 ASoC: rsnd: rename scu to src
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
R-Car sound has SCU unit which has SRC/CTU/MIX/DVC, and current rsnd driver has scu.c and scu module. Current scu.c has SRC support only.
My first concept was control these feature on scu.c but, it become difficult and un-understandable now. This patch rename scu to src
--- include/sound/rcar_snd.h | 18 +- sound/soc/sh/rcar/Makefile | 2 +- sound/soc/sh/rcar/core.c | 26 +- sound/soc/sh/rcar/rsnd.h | 24 +- sound/soc/sh/rcar/scu.c | 682 ------------------------------------------- sound/soc/sh/rcar/src.c | 687 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/sh/rcar/ssi.c | 6 +- 7 files changed, 727 insertions(+), 718 deletions(-) delete mode 100644 sound/soc/sh/rcar/scu.c create mode 100644 sound/soc/sh/rcar/src.c
include/sound/rcar_snd.h +11 -7
@@ -55,14 +55,18 @@ struct rsnd_ssi_platform_info {*/ #define RSND_SCU_USE_HPBIF (1 << 31)/* it needs RSND_SSI_DEPENDENT */ -#define RSND_SCU (rate, _dma_id) \ +#define RSND_SRC (rate, _dma_id) \ { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } -#define RSND_SCU_SET (rate, _dma_id) \ +#define RSND_SRC_SET (rate, _dma_id) \ { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } -#define RSND_SCU_UNUSED \ +#define RSND_SRC_UNUSED \ { .flags = 0, .convert_rate = 0, .dma_id = 0, } -struct rsnd_scu_platform_info { +#define rsnd_scu_platform_info rsnd_src_platform_info +#define src_info scu_info +#define src_info_nr scu_info_nr + +struct rsnd_src_platform_info {u32 flags;u32 convert_rate;/* sampling rate convert */ int dma_id;/* for Gen2 SCU */
@@ -70,7 +74,7 @@ struct rsnd_scu_platform_info {struct rsnd_dai_path_info {struct rsnd_ssi_platform_info *ssi; -struct rsnd_scu_platform_info *scu; +struct rsnd_src_platform_info *src; };struct rsnd_dai_platform_info {
@@ -93,8 +97,8 @@ struct rcar_snd_info {u32 flags;struct rsnd_ssi_platform_info *ssi_info;int ssi_info_nr; -struct rsnd_scu_platform_info *scu_info; -int scu_info_nr; +struct rsnd_src_platform_info *src_info; +int src_info_nr;struct rsnd_dai_platform_info *dai_info;int dai_info_nr;int (*start)(int id);
sound/soc/sh/rcar/Makefile +1 -1
@@ -1,2 +1,2 @@ -snd-soc-rcar-objs := core.o gen.o scu.o adg.o ssi.o +snd-soc-rcar-objs := core.o gen.o src.o adg.o ssi.o obj-$(CONFIG_SND_SOC_RCAR) += snd-soc-rcar.o
sound/soc/sh/rcar/core.c +13 -13
@@ -73,13 +73,13 @@* | +- ssi[2] * | ... * | -* | ** these control scu +* | ** these control src * | -* +- scu +* +- src * | -* +- scu[0] -* +- scu[1] -* +- scu[2] +* +- src[0] +* +- src[1] +* +- src[2] * ... * *
@@ -572,7 +572,7 @@ static int rsnd_path_init(struct rsnd_priv *priv,struct rsnd_dai_platform_info *dai_info = rdai->info;int ret;int ssi_id =-1 ; -int scu_id =-1 ; +int src_id =-1 ;/* * Gen1 is created by SRU/SSI, and this SRU is base module of
@@ -587,8 +587,8 @@ static int rsnd_path_init(struct rsnd_priv *priv,if (dai_info) {if (rsnd_is_enable_path (io, ssi)) ssi_id =rsnd_info_id (priv, io, ssi); -if (rsnd_is_enable_path (io, scu)) - scu_id =rsnd_info_id (priv, io, scu); +if (rsnd_is_enable_path (io, src)) + src_id =rsnd_info_id (priv, io, src); }else {/* get SSI's ID */ mod = rsnd_ssi_mod_get_frm_dai(priv,
@@ -596,14 +596,14 @@ static int rsnd_path_init(struct rsnd_priv *priv, rsnd_dai_is_play(rdai, io));if (!mod)return 0 ; - ssi_id = scu_id =rsnd_mod_id (mod); + ssi_id = src_id =rsnd_mod_id (mod); } ret =0 ; -/* SCU */ -if (scu_id >=0 ) { - mod =rsnd_scu_mod_get (priv, scu_id); +/* SRC */ +if (src_id >=0 ) { + mod =rsnd_src_mod_get (priv, src_id); ret =rsnd_dai_connect (mod, io);if (ret <0 )return ret;
@@ -806,7 +806,7 @@ static int rsnd_probe(struct platform_device *pdev) struct rsnd_priv *priv) = { rsnd_gen_probe, rsnd_ssi_probe, - rsnd_scu_probe, + rsnd_src_probe, rsnd_adg_probe, rsnd_dai_probe, };
sound/soc/sh/rcar/rsnd.h +12 -12
@@ -160,7 +160,7 @@ void rsnd_dma_quit(struct rsnd_priv *priv,* R-Car sound mod */ enum rsnd_mod_type { -RSND_MOD_SCU =0 , +RSND_MOD_SRC =0 ,RSND_MOD_SSI ,RSND_MOD_MAX , };
@@ -224,7 +224,7 @@ struct rsnd_dai_stream {int next_period_byte; };#define rsnd_io_to_mod_ssi (io) ((io)->mod[RSND_MOD_SSI]) -#define rsnd_io_to_mod_scu (io) ((io)->mod[RSND_MOD_SCU]) +#define rsnd_io_to_mod_src (io) ((io)->mod[RSND_MOD_SRC])struct rsnd_dai {char name[RSND_DAI_NAME_SIZE ];
@@ -302,10 +302,10 @@ struct rsnd_priv {void *gen;/* -* below value will be filled on rsnd_scu_probe() +* below value will be filled on rsnd_src_probe() */ -void *scu; -int scu_nr; +void *src; +int src_nr;/* * below value will be filled on rsnd_adg_probe()
@@ -345,22 +345,22 @@ struct rsnd_priv { })/* -* R-Car SCU +* R-Car SRC */ -int rsnd_scu_probe (struct platform_device *pdev, +int rsnd_src_probe (struct platform_device *pdev,struct rsnd_priv *priv); -struct rsnd_mod *rsnd_scu_mod_get (struct rsnd_priv *priv,int id); -unsigned int rsnd_scu_get_ssi_rate (struct rsnd_priv *priv, +struct rsnd_mod *rsnd_src_mod_get (struct rsnd_priv *priv,int id); +unsigned int rsnd_src_get_ssi_rate (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct snd_pcm_runtime *runtime); -int rsnd_scu_ssi_mode_init (struct rsnd_mod *ssi_mod, +int rsnd_src_ssi_mode_init (struct rsnd_mod *ssi_mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io); -int rsnd_scu_enable_ssi_irq (struct rsnd_mod *ssi_mod, +int rsnd_src_enable_ssi_irq (struct rsnd_mod *ssi_mod,struct rsnd_dai *rdai,struct rsnd_dai_stream *io); -#define rsnd_scu_nr (priv) ((priv)->scu_nr) +#define rsnd_src_nr (priv) ((priv)->src_nr)/* * R-Car SSI
sound/soc/sh/rcar/scu.c deleted +0 -682
682 lines not on this page · raw message
sound/soc/sh/rcar/src.c new file +687 -0
687 lines not on this page · raw message
sound/soc/sh/rcar/ssi.c +3 -3
@@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, 1, 2, 4, 8, 16, 6, 12, };unsigned int main_rate; -unsigned int rate =rsnd_scu_get_ssi_rate (priv, io, runtime); +unsigned int rate =rsnd_src_get_ssi_rate (priv, io, runtime);/* * Find best clock, and try to start ADG
@@ -287,7 +287,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ssi->cr_own = cr; ssi->err =-1 ;/* ignore 1st error */ -rsnd_scu_ssi_mode_init (mod, rdai, io); +rsnd_src_ssi_mode_init (mod, rdai, io);return 0 ; }
@@ -387,7 +387,7 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,/* enable PIO IRQ */ ssi->cr_etc =UIEN |OIEN |DIEN ; -rsnd_scu_enable_ssi_irq (mod, rdai, io); +rsnd_src_enable_ssi_irq (mod, rdai, io);rsnd_ssi_hw_start (ssi, rdai, io);
Signature · 1 line
1.7.9.5
PATCH 11/11 ASoC: rsnd: add DeviceTree support
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
--- .../devicetree/bindings/sound/renesas,rsnd.txt | 101 ++++++++++++++++ sound/soc/sh/rcar/adg.c | 1 + sound/soc/sh/rcar/core.c | 122 +++++++++++++++++++- sound/soc/sh/rcar/gen.c | 15 +++ sound/soc/sh/rcar/rsnd.h | 11 ++ sound/soc/sh/rcar/src.c | 36 ++++++ sound/soc/sh/rcar/ssi.c | 56 +++++++++ 7 files changed, 339 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd.txt
Documentation/devicetree/bindings/sound/renesas,rsnd.txt new file +101 -0
@@ -0,0 +1,101 @@ +Renesas R-Car sound + +Required properties: +- compatible : "renesas,rcar_sound-gen1" if generation1 + "renesas,rcar_sound-gen2" if generation2 +- reg : Should contain the register physical address. + required register is + SRU/ADG/SSI if generation1 + SRU/ADG/SSIU/SSI if generation2 +- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode + +SSI subnode properties: +- interrupt-parent : Should contain SSI interrup parent +- interrupts : Should contain SSI interrupt for PIO transfer +- shared-pin : if shared clock pin + +DAI subnode properties: +- playback : list of playback modules +- capture : list of capture modules + +Example: + +rcar_sound: rcar_sound@0xffd90000 { + #sound-dai-cells = <1>; + compatible = "renesas,rcar_sound"; + reg = <0xffd90000 0x1000>, /* SRU */ + <0xfffe0000 0x24>, /* ADG */ + <0xffd91000 0x1240>; /* SSI */ + + rcar_sound,src { + src0: src@0 { }; + src1: src@1 { }; + src2: src@2 { }; + src3: src@3 { }; + src4: src@4 { }; + src5: src@5 { }; + src6: src@6 { }; + src7: src@7 { }; + src8: src@8 { }; + }; + + rcar_sound,ssi { + ssi0: ssi@0 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi1: ssi@1 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi2: ssi@2 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi3: ssi@3 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi4: ssi@4 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi5: ssi@5 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi6: ssi@6 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi7: ssi@7 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi8: ssi@8 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + }; + + rcar_sound,dai { + dai0 { + playback = <&ssi5 &src5>; + capture = <&ssi6>; + }; + dai1 { + playback = <&ssi3>; + }; + dai2 { + capture = <&ssi4>; + }; + dai3 { + playback = <&ssi7>; + }; + dai4 { + capture = <&ssi8>; + }; + }; +};
sound/soc/sh/rcar/adg.c +1 -0
@@ -392,6 +392,7 @@ static void rsnd_adg_ssi_clk_init(struct rsnd_priv *priv, struct rsnd_adg *adg) }int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rsnd_adg *adg;
sound/soc/sh/rcar/core.c +119 -3
172 lines not on this page · raw message
sound/soc/sh/rcar/gen.c +15 -0
@@ -359,13 +359,28 @@ static int rsnd_gen1_probe(struct platform_device *pdev,/* * Gen */ +static void rsnd_of_parse_gen (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct rcar_snd_info *info = priv->info; + +if (!of_data) +return ; + + info->flags = of_data->flags; +} +int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen;int ret; +rsnd_of_parse_gen (pdev, of_data, priv); + gen =devm_kzalloc (dev,sizeof (*gen),GFP_KERNEL );if (!gen) {dev_err (dev,"GEN allocate failed\n" );
sound/soc/sh/rcar/rsnd.h +11 -0
@@ -17,6 +17,8 @@#include <linux/io.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/of_device.h> +#include <linux/of_irq.h> #include <linux/sh_dma.h> #include <linux/workqueue.h> #include <sound/rcar_snd.h>
@@ -113,6 +115,7 @@ enum rsnd_reg {#define RSND_REG_SRCOUT_TIMSEL4 RSND_REG_SHARE18#define RSND_REG_AUDIO_CLK_SEL2 RSND_REG_SHARE19 +struct rsnd_of_data ;struct rsnd_priv ;struct rsnd_mod ;struct rsnd_dai ;
@@ -260,6 +263,7 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);* R-Car Gen1/Gen2 */ int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv); void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, struct rsnd_mod *mod,
@@ -273,6 +277,7 @@ void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,int rsnd_adg_ssi_clk_stop (struct rsnd_mod *mod);int rsnd_adg_ssi_clk_try_start (struct rsnd_mod *mod,unsigned int rate);int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv); int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv, struct rsnd_mod *mod,
@@ -290,6 +295,10 @@ int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,/* * R-Car sound priv */ +struct rsnd_of_data { +u32 flags; +}; +struct rsnd_priv {struct device *dev;
@@ -348,6 +357,7 @@ struct rsnd_priv {* R-Car SRC */ int rsnd_src_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);struct rsnd_mod *rsnd_src_mod_get (struct rsnd_priv *priv,int id); unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
@@ -366,6 +376,7 @@ int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,* R-Car SSI */ int rsnd_ssi_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);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,
sound/soc/sh/rcar/src.c +36 -0
@@ -628,7 +628,41 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id)return &((struct rsnd_src *)(priv->src) + id)->mod; } +static void rsnd_of_parse_src (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct device_node *src_node; +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_src_platform_info *src_info; +struct device *dev = &pdev->dev; +int nr; + +if (!of_data) +return ; + + src_node =of_get_child_by_name (dev->of_node,"rcar_sound,src" ); +if (!src_node) +return ; + + nr =of_get_child_count (src_node); +if (!nr) +return ; + + src_info =devm_kzalloc (dev, +sizeof (struct rsnd_src_platform_info ) * nr, +GFP_KERNEL ); +if (!src_info) { +dev_err (dev,"src info allocation error\n" ); +return ; + } + + info->src_info = src_info; + info->src_info_nr = nr; +} +int rsnd_src_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rcar_snd_info *info =rsnd_priv_to_info (priv);
@@ -639,6 +673,8 @@ int rsnd_src_probe(struct platform_device *pdev,char name[RSND_SRC_NAME_SIZE ];int i, nr; +rsnd_of_parse_src (pdev, of_data, priv); +/* * init SRC */
sound/soc/sh/rcar/ssi.c +56 -0
69 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 10/11] ASoC: rsnd: rename scu to src
In reply to Kuninori MorimotoQuoted 5 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
R-Car sound has SCU unit which has SRC/CTU/MIX/DVC, and current rsnd driver has
scu.cand scu module. Currentscu.chas SRC support only.
Applied all up to here, thanks.
Forward: [PATCH 11/11] ASoC: rsnd: add DeviceTree support
In reply to Kuninori MorimotoI didn't add device tree ML on this patch.
Forward it.
From: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
--- .../devicetree/bindings/sound/renesas,rsnd.txt | 101 ++++++++++++++++ sound/soc/sh/rcar/adg.c | 1 + sound/soc/sh/rcar/core.c | 122 +++++++++++++++++++- sound/soc/sh/rcar/gen.c | 15 +++ sound/soc/sh/rcar/rsnd.h | 11 ++ sound/soc/sh/rcar/src.c | 36 ++++++ sound/soc/sh/rcar/ssi.c | 56 +++++++++ 7 files changed, 339 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd.txt
Documentation/devicetree/bindings/sound/renesas,rsnd.txt new file +101 -0
@@ -0,0 +1,101 @@ +Renesas R-Car sound + +Required properties: +- compatible : "renesas,rcar_sound-gen1" if generation1 + "renesas,rcar_sound-gen2" if generation2 +- reg : Should contain the register physical address. + required register is + SRU/ADG/SSI if generation1 + SRU/ADG/SSIU/SSI if generation2 +- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode + +SSI subnode properties: +- interrupt-parent : Should contain SSI interrup parent +- interrupts : Should contain SSI interrupt for PIO transfer +- shared-pin : if shared clock pin + +DAI subnode properties: +- playback : list of playback modules +- capture : list of capture modules + +Example: + +rcar_sound: rcar_sound@0xffd90000 { + #sound-dai-cells = <1>; + compatible = "renesas,rcar_sound"; + reg = <0xffd90000 0x1000>, /* SRU */ + <0xfffe0000 0x24>, /* ADG */ + <0xffd91000 0x1240>; /* SSI */ + + rcar_sound,src { + src0: src@0 { }; + src1: src@1 { }; + src2: src@2 { }; + src3: src@3 { }; + src4: src@4 { }; + src5: src@5 { }; + src6: src@6 { }; + src7: src@7 { }; + src8: src@8 { }; + }; + + rcar_sound,ssi { + ssi0: ssi@0 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi1: ssi@1 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi2: ssi@2 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi3: ssi@3 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi4: ssi@4 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>; + }; + ssi5: ssi@5 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi6: ssi@6 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi7: ssi@7 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + ssi8: ssi@8 { + interrupt-parent = <&gic>; + interrupts = <0 102 0x4>; + }; + }; + + rcar_sound,dai { + dai0 { + playback = <&ssi5 &src5>; + capture = <&ssi6>; + }; + dai1 { + playback = <&ssi3>; + }; + dai2 { + capture = <&ssi4>; + }; + dai3 { + playback = <&ssi7>; + }; + dai4 { + capture = <&ssi8>; + }; + }; +};
sound/soc/sh/rcar/adg.c +1 -0
@@ -392,6 +392,7 @@ static void rsnd_adg_ssi_clk_init(struct rsnd_priv *priv, struct rsnd_adg *adg) }int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rsnd_adg *adg;
sound/soc/sh/rcar/core.c +119 -3
172 lines not on this page · raw message
sound/soc/sh/rcar/gen.c +15 -0
@@ -359,13 +359,28 @@ static int rsnd_gen1_probe(struct platform_device *pdev,/* * Gen */ +static void rsnd_of_parse_gen (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct rcar_snd_info *info = priv->info; + +if (!of_data) +return ; + + info->flags = of_data->flags; +} +int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen;int ret; +rsnd_of_parse_gen (pdev, of_data, priv); + gen =devm_kzalloc (dev,sizeof (*gen),GFP_KERNEL );if (!gen) {dev_err (dev,"GEN allocate failed\n" );
sound/soc/sh/rcar/rsnd.h +11 -0
@@ -17,6 +17,8 @@#include <linux/io.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/of_device.h> +#include <linux/of_irq.h> #include <linux/sh_dma.h> #include <linux/workqueue.h> #include <sound/rcar_snd.h>
@@ -113,6 +115,7 @@ enum rsnd_reg {#define RSND_REG_SRCOUT_TIMSEL4 RSND_REG_SHARE18#define RSND_REG_AUDIO_CLK_SEL2 RSND_REG_SHARE19 +struct rsnd_of_data ;struct rsnd_priv ;struct rsnd_mod ;struct rsnd_dai ;
@@ -260,6 +263,7 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);* R-Car Gen1/Gen2 */ int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv); void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, struct rsnd_mod *mod,
@@ -273,6 +277,7 @@ void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,int rsnd_adg_ssi_clk_stop (struct rsnd_mod *mod);int rsnd_adg_ssi_clk_try_start (struct rsnd_mod *mod,unsigned int rate);int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv); int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv, struct rsnd_mod *mod,
@@ -290,6 +295,10 @@ int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,/* * R-Car sound priv */ +struct rsnd_of_data { +u32 flags; +}; +struct rsnd_priv {struct device *dev;
@@ -348,6 +357,7 @@ struct rsnd_priv {* R-Car SRC */ int rsnd_src_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);struct rsnd_mod *rsnd_src_mod_get (struct rsnd_priv *priv,int id); unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
@@ -366,6 +376,7 @@ int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,* R-Car SSI */ int rsnd_ssi_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);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,
sound/soc/sh/rcar/src.c +36 -0
@@ -628,7 +628,41 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id)return &((struct rsnd_src *)(priv->src) + id)->mod; } +static void rsnd_of_parse_src (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct device_node *src_node; +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_src_platform_info *src_info; +struct device *dev = &pdev->dev; +int nr; + +if (!of_data) +return ; + + src_node =of_get_child_by_name (dev->of_node,"rcar_sound,src" ); +if (!src_node) +return ; + + nr =of_get_child_count (src_node); +if (!nr) +return ; + + src_info =devm_kzalloc (dev, +sizeof (struct rsnd_src_platform_info ) * nr, +GFP_KERNEL ); +if (!src_info) { +dev_err (dev,"src info allocation error\n" ); +return ; + } + + info->src_info = src_info; + info->src_info_nr = nr; +} +int rsnd_src_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rcar_snd_info *info =rsnd_priv_to_info (priv);
@@ -639,6 +673,8 @@ int rsnd_src_probe(struct platform_device *pdev,char name[RSND_SRC_NAME_SIZE ];int i, nr; +rsnd_of_parse_src (pdev, of_data, priv); +/* * init SRC */
sound/soc/sh/rcar/ssi.c +56 -0
69 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: Forward: [PATCH 11/11] ASoC: rsnd: add DeviceTree support
Quoted 4 lines · Kuninori Morimoto
I didn't add device tree ML on this patch.
Forward it.
Date: Mon, 03 Mar 2014 20:51:29 -0800 (PST)
Message-ID: <87r46izhv5.wl%[email protected]>
From: Kuninori Morimoto <[email protected]>
Subject: [PATCH 11/11] ASoC: rsnd: add DeviceTree support
User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0
To: Mark Brown <[email protected]>
Cc: Linux-ALSA <[email protected]>,
Liam Girdwood <[email protected]>, Kuninori Morimoto <[email protected]>, Simon <[email protected]>
In-Reply-To: <878usq1scd.wl%[email protected]>
References: <87d2ib90t9.wl%[email protected]>
<878usq1scd.wl%[email protected]>
MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
Content-Type: text/plain; charset=US-ASCII
Quoted 60 lines
From: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
Signed-off-by Kuninori Morimoto <[email protected]>--- .../devicetree/bindings/sound/renesas,rsnd.txt | 101 ++++++++++++++++ sound/soc/sh/rcar/adg.c | 1 + sound/soc/sh/rcar/core.c | 122 +++++++++++++++++++- sound/soc/sh/rcar/gen.c | 15 +++ sound/soc/sh/rcar/rsnd.h | 11 ++ sound/soc/sh/rcar/src.c | 36 ++++++ sound/soc/sh/rcar/ssi.c | 56 +++++++++ 7 files changed, 339 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd.txtDocumentation/devicetree/bindings/sound/renesas,rsnd.txt new file +37
-0@@ -0,0 +1,101 @@ +Renesas R-Car sound + +Required properties: +- compatible : "renesas,rcar_sound-gen1" if generation1 + "renesas,rcar_sound-gen2" if generation2 +- reg : Should contain the register physical address. + required register is + SRU/ADG/SSI if generation1 + SRU/ADG/SSIU/SSI if generation2 +- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode + +SSI subnode properties: +- interrupt-parent : Should contain SSI interrup parent +- interrupts : Should contain SSI interrupt for PIO transfer +- shared-pin : if shared clock pin + +DAI subnode properties: +- playback : list of playback modules +- capture : list of capture modules + +Example: + +rcar_sound: rcar_sound@0xffd90000 { + #sound-dai-cells = <1>; + compatible = "renesas,rcar_sound"; + reg = <0xffd90000 0x1000>, /* SRU */ + <0xfffe0000 0x24>, /* ADG */ + <0xffd91000 0x1240>; /* SSI */ + + rcar_sound,src { + src0: src@0 { }; + src1: src@1 { }; + src2: src@2 { }; + src3: src@3 { }; + src4: src@4 { };
Documentation/devicetree/bindings/sound/renesas,rsnd.txt line 47
Quoted 10 lines
Documentation/devicetree/bindings/sound/renesas,rsnd.txt new file +10
-0+ src5: src@5 { }; + src6: src@6 { }; + src7: src@7 { }; + src8: src@8 { }; + }; + + rcar_sound,ssi { + ssi0: ssi@0 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>;
I thought interrupt parent was not required for the gic interrupts in the system?
Signature · 3 lines
Ben Dooks, [email protected], http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.
Quoted 11 lines · Kuninori Morimoto
Hi Mark
These are Renesas R-Car sound driver patches.
#1 - #7 are clean up patches.
#8 - #18 adds new module path method
#19 adds DT supportNow, Mark's ALSA branch doesn't include SH-ARM platform branch. Thus, these patches are keeping compatible for it at this point. Compatible code will be removed after merge.
I've merged the rcar branch that Mark Brown has pushed out, which has all of these except #19 and have been trying to get it to work.
I am currently seeing issues where the CODEC fails to start, thus there is no audio produced due to no audio bit or word clocks on the I2S bus (the CODEC is the clock master).
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
Thank you for your testing
Quoted 9 lines
Quoted 8 lines
These are Renesas R-Car sound driver patches.
#1 - #7 are clean up patches.
#8 - #18 adds new module path method
#19 adds DT supportNow, Mark's ALSA branch doesn't include SH-ARM platform branch. Thus, these patches are keeping compatible for it at this point. Compatible code will be removed after merge.
Quoted 6 lines
I've merged the rcar branch that Mark Brown has pushed out, which has all of these except #19 and have been trying to get it to work.
I am currently seeing issues where the CODEC fails to start, thus there is no audio produced due to no audio bit or word clocks on the I2S bus (the CODEC is the clock master).
Please show me more detail.
Are you using Lager board ? are you using DT ? or non-DT ? It needs Mark's mark/topic/simple branch too.
Can you show me error log ?
Best regards
---
Kuninori Morimoto
Re: [alsa-devel] Forward: [PATCH 11/11] ASoC: rsnd: add DeviceTree support
In reply to a message not in the archiveHi Ben
Thank you for your review.
This is quick question
Quoted 7 lines
Documentation/devicetree/bindings/sound/renesas,rsnd.txt line 47
Quoted 4 lines
Documentation/devicetree/bindings/sound/renesas,rsnd.txt new file +4
-0+ rcar_sound,ssi { + ssi0: ssi@0 { + interrupt-parent = <&gic>; + interrupts = <0 101 0x4>;I thought interrupt parent was not required for the gic interrupts in the system?
Does it mean it don't need "interrupt-parent" ?
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/1 ASoC: rsnd: add DeviceTree support
In reply to a message not in the archiveFrom: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
---
v1 -> v2
- removed interrupt parent from ssi
- tidyup example code on renesas,rsnd.txt
.../devicetree/bindings/sound/renesas,rsnd.txt | 96 +++++++++++++++ sound/soc/sh/rcar/adg.c | 1 + sound/soc/sh/rcar/core.c | 122 +++++++++++++++++++- sound/soc/sh/rcar/gen.c | 15 +++ sound/soc/sh/rcar/rsnd.h | 11 ++ sound/soc/sh/rcar/src.c | 36 ++++++ sound/soc/sh/rcar/ssi.c | 56 +++++++++ 7 files changed, 334 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd.txt
Documentation/devicetree/bindings/sound/renesas,rsnd.txt new file +96 -0
@@ -0,0 +1,96 @@ +Renesas R-Car sound + +Required properties: +- compatible : "renesas,rcar_sound-gen1" if generation1 + "renesas,rcar_sound-gen2" if generation2 +- reg : Should contain the register physical address. + required register is + SRU/ADG/SSI if generation1 + SRU/ADG/SSIU/SSI if generation2 +- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode + +SSI subnode properties: +- interrupts : Should contain SSI interrupt for PIO transfer +- shared-pin : if shared clock pin + +DAI subnode properties: +- playback : list of playback modules +- capture : list of capture modules + +Example: + +rcar_sound: rcar_sound@0xffd90000 { + #sound-dai-cells = <1>; + compatible = "renesas,rcar_sound-gen2"; + reg = <0 0xec500000 0 0x1000>, /* SCU */ + <0 0xec5a0000 0 0x100>, /* ADG */ + <0 0xec540000 0 0x1000>, /* SSIU */ + <0 0xec541000 0 0x1280>; /* SSI */ + + rcar_sound,src { + src0: src@0 { }; + src1: src@1 { }; + src2: src@2 { }; + src3: src@3 { }; + src4: src@4 { }; + src5: src@5 { }; + src6: src@6 { }; + src7: src@7 { }; + src8: src@8 { }; + src9: src@9 { }; + }; + + rcar_sound,ssi { + ssi0: ssi@0 { + interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi1: ssi@1 { + interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi2: ssi@2 { + interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi3: ssi@3 { + interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi4: ssi@4 { + interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi5: ssi@5 { + interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi6: ssi@6 { + interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi7: ssi@7 { + interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi8: ssi@8 { + interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>; + }; + ssi9: ssi@9 { + interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + rcar_sound,dai { + dai0 { + playback = <&ssi5 &src5>; + capture = <&ssi6>; + }; + dai1 { + playback = <&ssi3>; + }; + dai2 { + capture = <&ssi4>; + }; + dai3 { + playback = <&ssi7>; + }; + dai4 { + capture = <&ssi8>; + }; + }; +};
sound/soc/sh/rcar/adg.c +1 -0
@@ -392,6 +392,7 @@ static void rsnd_adg_ssi_clk_init(struct rsnd_priv *priv, struct rsnd_adg *adg) }int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rsnd_adg *adg;
sound/soc/sh/rcar/core.c +119 -3
172 lines not on this page · raw message
sound/soc/sh/rcar/gen.c +15 -0
@@ -359,13 +359,28 @@ static int rsnd_gen1_probe(struct platform_device *pdev,/* * Gen */ +static void rsnd_of_parse_gen (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct rcar_snd_info *info = priv->info; + +if (!of_data) +return ; + + info->flags = of_data->flags; +} +int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen;int ret; +rsnd_of_parse_gen (pdev, of_data, priv); + gen =devm_kzalloc (dev,sizeof (*gen),GFP_KERNEL );if (!gen) {dev_err (dev,"GEN allocate failed\n" );
sound/soc/sh/rcar/rsnd.h +11 -0
@@ -17,6 +17,8 @@#include <linux/io.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/of_device.h> +#include <linux/of_irq.h> #include <linux/sh_dma.h> #include <linux/workqueue.h> #include <sound/rcar_snd.h>
@@ -113,6 +115,7 @@ enum rsnd_reg {#define RSND_REG_SRCOUT_TIMSEL4 RSND_REG_SHARE18#define RSND_REG_AUDIO_CLK_SEL2 RSND_REG_SHARE19 +struct rsnd_of_data ;struct rsnd_priv ;struct rsnd_mod ;struct rsnd_dai ;
@@ -260,6 +263,7 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);* R-Car Gen1/Gen2 */ int rsnd_gen_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv); void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, struct rsnd_mod *mod,
@@ -273,6 +277,7 @@ void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,int rsnd_adg_ssi_clk_stop (struct rsnd_mod *mod);int rsnd_adg_ssi_clk_try_start (struct rsnd_mod *mod,unsigned int rate);int rsnd_adg_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv); int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv, struct rsnd_mod *mod,
@@ -290,6 +295,10 @@ int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,/* * R-Car sound priv */ +struct rsnd_of_data { +u32 flags; +}; +struct rsnd_priv {struct device *dev;
@@ -348,6 +357,7 @@ struct rsnd_priv {* R-Car SRC */ int rsnd_src_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);struct rsnd_mod *rsnd_src_mod_get (struct rsnd_priv *priv,int id); unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
@@ -366,6 +376,7 @@ int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,* R-Car SSI */ int rsnd_ssi_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv);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,
sound/soc/sh/rcar/src.c +36 -0
@@ -628,7 +628,41 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id)return &((struct rsnd_src *)(priv->src) + id)->mod; } +static void rsnd_of_parse_src (struct platform_device *pdev, +const struct rsnd_of_data *of_data, +struct rsnd_priv *priv) +{ +struct device_node *src_node; +struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_src_platform_info *src_info; +struct device *dev = &pdev->dev; +int nr; + +if (!of_data) +return ; + + src_node =of_get_child_by_name (dev->of_node,"rcar_sound,src" ); +if (!src_node) +return ; + + nr =of_get_child_count (src_node); +if (!nr) +return ; + + src_info =devm_kzalloc (dev, +sizeof (struct rsnd_src_platform_info ) * nr, +GFP_KERNEL ); +if (!src_info) { +dev_err (dev,"src info allocation error\n" ); +return ; + } + + info->src_info = src_info; + info->src_info_nr = nr; +} +int rsnd_src_probe (struct platform_device *pdev, +const struct rsnd_of_data *of_data,struct rsnd_priv *priv) {struct rcar_snd_info *info =rsnd_priv_to_info (priv);
@@ -639,6 +673,8 @@ int rsnd_src_probe(struct platform_device *pdev,char name[RSND_SRC_NAME_SIZE ];int i, nr; +rsnd_of_parse_src (pdev, of_data, priv); +/* * init SRC */
sound/soc/sh/rcar/ssi.c +56 -0
69 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] ASoC: rsnd: add DeviceTree support
In reply to a message not in the archiveQuoted 3 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
So, I've applied this but it needs some improvement - please do that incrementally. One thing you should have done here is CC the binding to the DT list and maintainers for review.
Quoted 3 lines
+- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode
This needs clearer documentation saying what the subnodes are - they're actually collections of further nodes, each of which represents something in the hardware. The examples are fairly clear but the text needs more than just "subnode". Someone should be able to tell how to write the DT just given the datasheet and this document.
Re: [PATCH v2] ASoC: rsnd: add DeviceTree support
In reply to a message not in the archiveHi Mark
Quoted 13 lines · Kuninori Morimoto
Quoted 3 lines
From: Kuninori Morimoto <[email protected]>
Support for loading the Renesas R-Car sound driver via DeviceTree.
So, I've applied this but it needs some improvement - please do that incrementally. One thing you should have done here is CC the binding to the DT list and maintainers for review.
Quoted 3 lines
+- rcar_sound,ssi : SSI subnode +- rcar_sound,scu : SCU subnode +- rcar_sound,dai : DAI subnode
Quoted 5 lines
This needs clearer documentation saying what the subnodes are - they're actually collections of further nodes, each of which represents something in the hardware. The examples are fairly clear but the text needs more than just "subnode". Someone should be able to tell how to write the DT just given the datasheet and this document.
I see. will do
Thank you for your advice
Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 ASoC: rcar: subnode tidyup for renesas,rsnd.txt
In reply to a message not in the archiveFrom: Kuninori Morimoto <[email protected]>
rcar_sound,ssi/src/dai subnode documentation
become more cleaner
--- .../devicetree/bindings/sound/renesas,rsnd.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sound/renesas,rsnd.txt +12 -3
@@ -7,14 +7,23 @@ Required properties: required register is SRU/ADG/SSI if generation1 SRU/ADG/SSIU/SSI if generation2 -- rcar_sound,ssi : SSI subnode -- rcar_sound,scu : SCU subnode -- rcar_sound,dai : DAI subnode +- rcar_sound,ssi : Should contain SSI feature. + The number of SSI subnode should be same as HW. + see below for detail. +- rcar_sound,src : Should contain SRC feature. + The number of SRC subnode should be same as HW. + see below for detail. +- rcar_sound,dai : DAI contents. + The number of DAI subnode should be same as HW. + see below for detail. SSI subnode properties: - interrupts : Should contain SSI interrupt for PIO transfer - shared-pin : if shared clock pin +SRC subnode properties: +no properties at this point + DAI subnode properties: - playback : list of playback modules - capture : list of capture modules
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
AppliedRe: [PATCH] ASoC: rcar: subnode tidyup for renesas,rsnd.txt
In reply to a message not in the archiveQuoted 4 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
rcar_sound,ssi/src/dai subnode documentation
become more cleaner
Applied, thanks.