[alsa-devel] [PATCH 0/5] ASoC: rsnd: tidyup patches
Hi Mark
These are not so very important, but tidyup patches for Renesas R-Car driver.
Kuninori Morimoto (5): ASoC: rsnd: add rsnd_dai_to_priv() macro ASoC: rsnd: make sure it uses lock when it calls rsnd_dai_call ASoC: rsnd: tidyup SSI parent related function/macro names ASoC: rsnd: make sure SSI parent/child uses same number of sound channel. ASoC: rsnd: care snd_kcontrol's index
sound/soc/sh/rcar/core.c | 34 +++++++++++++++++++++++++++------- sound/soc/sh/rcar/ssi.c | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 72 insertions(+), 14 deletions(-)
Best regards --- Kuninori Morimoto
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Using standardized function/macro name is useful in driver
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 9f48d75..a2a0b57 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -272,9 +272,10 @@ struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id) return priv->rdai + id; }
+#define rsnd_dai_to_priv(dai) snd_soc_dai_get_drvdata(dai) static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai) { - struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai); + struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
return rsnd_rdai_get(priv, dai->id); } @@ -351,7 +352,7 @@ struct rsnd_dai_stream *rsnd_rdai_to_io(struct rsnd_dai *rdai, static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { - struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai); + struct rsnd_priv *priv = rsnd_dai_to_priv(dai); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); int ssi_id = rsnd_mod_id(rsnd_io_to_mod_ssi(io));
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
rsnd_dai_call() should be called under rsnd_lock
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/core.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index a2a0b57..164653c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -731,10 +731,15 @@ static int rsnd_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); + struct rsnd_priv *priv = rsnd_dai_to_priv(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); + unsigned long flags; int ret;
+ rsnd_lock(priv, flags); ret = rsnd_dai_call(hw_params, io, substream, hw_params); + rsnd_unlock(priv, flags); + if (ret) return ret;
@@ -919,14 +924,16 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod, static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai = rtd->cpu_dai; + struct rsnd_priv *priv = rsnd_dai_to_priv(dai); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); - int ret; + unsigned long flags; + int ret = 0;
- ret = rsnd_dai_call(pcm_new, &rdai->playback, rtd); - if (ret) - return ret; + rsnd_lock(priv, flags); + ret |= rsnd_dai_call(pcm_new, &rdai->playback, rtd); + ret |= rsnd_dai_call(pcm_new, &rdai->capture, rtd); + rsnd_unlock(priv, flags);
- ret = rsnd_dai_call(pcm_new, &rdai->capture, rtd); if (ret) return ret;
@@ -949,8 +956,11 @@ static const struct snd_soc_component_driver rsnd_soc_component = { static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, struct rsnd_dai_stream *io) { + unsigned long flags; int ret;
+ rsnd_lock(priv, flags); + ret = rsnd_dai_call(probe, io, priv); if (ret == -EAGAIN) { /* @@ -983,6 +993,7 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, */ ret = rsnd_dai_call(probe, io, priv); } + rsnd_unlock(priv, flags);
return ret; } @@ -998,6 +1009,7 @@ static int rsnd_probe(struct platform_device *pdev) struct rsnd_dai *rdai; const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev); const struct rsnd_of_data *of_data; + unsigned long flags; int (*probe_func[])(struct platform_device *pdev, const struct rsnd_of_data *of_data, struct rsnd_priv *priv) = { @@ -1084,10 +1096,12 @@ static int rsnd_probe(struct platform_device *pdev) exit_snd_soc: snd_soc_unregister_platform(dev); exit_snd_probe: + rsnd_lock(priv, flags); for_each_rsnd_dai(rdai, priv, i) { rsnd_dai_call(remove, &rdai->playback, priv); rsnd_dai_call(remove, &rdai->capture, priv); } + rsnd_unlock(priv, flags);
return ret; } @@ -1096,6 +1110,7 @@ static int rsnd_remove(struct platform_device *pdev) { struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev); struct rsnd_dai *rdai; + unsigned long flags; void (*remove_func[])(struct platform_device *pdev, struct rsnd_priv *priv) = { rsnd_ssi_remove, @@ -1106,10 +1121,12 @@ static int rsnd_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
+ rsnd_lock(priv, flags); for_each_rsnd_dai(rdai, priv, i) { ret |= rsnd_dai_call(remove, &rdai->playback, priv); ret |= rsnd_dai_call(remove, &rdai->capture, priv); } + rsnd_unlock(priv, flags);
for (i = 0; i < ARRAY_SIZE(remove_func); i++) remove_func[i](pdev, priv);
Hi Morimoto-san,
On Fri, 10 Apr 2015, Kuninori Morimoto wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
rsnd_dai_call() should be called under rsnd_lock
Always? Why?
@@ -949,8 +956,11 @@ static const struct snd_soc_component_driver rsnd_soc_component = { static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, struct rsnd_dai_stream *io) {
unsigned long flags; int ret;
rsnd_lock(priv, flags);
ret = rsnd_dai_call(probe, io, priv); if (ret == -EAGAIN) { /*
This causes the following warning on r8a7791/koelsch:
WARNING: CPU: 1 PID: 1 at kernel/locking/lockdep.c:2755 lockdep_trace_alloc+0xd4/0x118() DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.1.0-rc2-koelsch-00564-g1817f2746e13e08e #1081 Hardware name: Generic R8A7791 (Flattened Device Tree) Backtrace: [<c00135e0>] (dump_backtrace) from [<c0013800>] (show_stack+0x18/0x1c) r6:c0546ece r5:00000009 r4:00000000 r3:00204140 [<c00137e8>] (show_stack) from [<c04483ec>] (dump_stack+0x78/0x94) [<c0448374>] (dump_stack) from [<c002d368>] (warn_slowpath_common+0x90/0xbc) r4:eec59c90 r3:00000001 [<c002d2d8>] (warn_slowpath_common) from [<c002d3cc>] (warn_slowpath_fmt+0x38/0x40) r8:eed90010 r7:000001a1 r6:000080d0 r5:000080d0 r4:60000193 [<c002d398>] (warn_slowpath_fmt) from [<c0069e94>] (lockdep_trace_alloc+0xd4/0x118) r3:c054c535 r2:c0547435 [<c0069dc0>] (lockdep_trace_alloc) from [<c00e3acc>] (__kmalloc_track_caller+0x34/0x11c) r5:eec000c0 r4:00000000 [<c00e3a98>] (__kmalloc_track_caller) from [<c02678b4>] (devres_alloc+0x20/0x48) r7:000001a1 r6:ee7e2138 r5:c007a3d8 r4:00000000 [<c0267894>] (devres_alloc) from [<c007a378>] (devm_request_threaded_irq+0x34/0x94) r5:ee7ea8d0 r4:00000000 [<c007a344>] (devm_request_threaded_irq) from [<c036ad4c>] (rsnd_src_probe_gen2+0x68/0x7c) r9:eef61120 r8:a0000113 r7:ee7ea8d8 r6:eef6113c r5:ee7ea8d0 r4:ee7e2138 [<c036ace4>] (rsnd_src_probe_gen2) from [<c0367e1c>] (rsnd_rdai_continuance_probe+0x80/0x29c) r5:eef61130 r4:c036ace4 [<c0367d9c>] (rsnd_rdai_continuance_probe) from [<c0368a80>] (rsnd_probe+0x114/0x304) r10:eef61110 r9:00000000 r8:ee7ea8d8 r7:eed90000 r6:eed90010 r5:ee7ea8d0 r4:c048e960 [<c036896c>] (rsnd_probe) from [<c02667f4>] (platform_drv_probe+0x50/0xa0) r10:00000000 r9:c062f000 r8:c0624dec r7:00000000 r6:c0624dec r5:eed90010 r4:fffffffe [<c02667a4>] (platform_drv_probe) from [<c0264fac>] (driver_probe_device+0xfc/0x264) r6:00000000 r5:c0e1e9fc r4:eed90010 r3:c02667a4 [<c0264eb0>] (driver_probe_device) from [<c02651d8>] (__driver_attach+0x78/0x9c) r8:c0606460 r7:c0619e98 r6:c0624dec r5:eed90044 r4:eed90010 r3:00000000 [<c0265160>] (__driver_attach) from [<c02635c8>] (bus_for_each_dev+0x74/0x98) r6:c0265160 r5:c0624dec r4:00000000 r3:00000001 [<c0263554>] (bus_for_each_dev) from [<c0264a98>] (driver_attach+0x20/0x28) r6:ee7ea9c0 r5:00000000 r4:c0624dec [<c0264a78>] (driver_attach) from [<c0264728>] (bus_add_driver+0xe8/0x1d0) [<c0264640>] (bus_add_driver) from [<c0265868>] (driver_register+0xa4/0xe8) r7:c0606460 r6:00000000 r5:c05e6abc r4:c0624dec [<c02657c4>] (driver_register) from [<c0266728>] (__platform_driver_register+0x50/0x64) r5:c05e6abc r4:ee7eec40 [<c02666d8>] (__platform_driver_register) from [<c05e6ad4>] (rsnd_driver_init+0x18/0x20) [<c05e6abc>] (rsnd_driver_init) from [<c000a7d8>] (do_one_initcall+0x108/0x1bc) [<c000a6d0>] (do_one_initcall) from [<c05c7dc8>] (kernel_init_freeable+0x11c/0x1e4) r9:c062f000 r8:c062f000 r7:c05fb160 r6:c05f3a40 r5:00000084 r4:00000006 [<c05c7cac>] (kernel_init_freeable) from [<c0445120>] (kernel_init+0x10/0xec) r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0445110 r4:00000000 [<c0445110>] (kernel_init) from [<c000fef0>] (ret_from_fork+0x14/0x24) r4:00000000 r3:00000000
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert
static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, struct rsnd_dai_stream *io) {
unsigned long flags; int ret;
rsnd_lock(priv, flags);
ret = rsnd_dai_call(probe, io, priv); if (ret == -EAGAIN) { /*
This causes the following warning on r8a7791/koelsch:
Thank you for pointing this. I will check/fixup it.
WARNING: CPU: 1 PID: 1 at kernel/locking/lockdep.c:2755 lockdep_trace_alloc+0xd4/0x118() DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.1.0-rc2-koelsch-00564-g1817f2746e13e08e #1081 Hardware name: Generic R8A7791 (Flattened Device Tree) Backtrace: [<c00135e0>] (dump_backtrace) from [<c0013800>] (show_stack+0x18/0x1c) r6:c0546ece r5:00000009 r4:00000000 r3:00204140 [<c00137e8>] (show_stack) from [<c04483ec>] (dump_stack+0x78/0x94) [<c0448374>] (dump_stack) from [<c002d368>] (warn_slowpath_common+0x90/0xbc) r4:eec59c90 r3:00000001 [<c002d2d8>] (warn_slowpath_common) from [<c002d3cc>] (warn_slowpath_fmt+0x38/0x40) r8:eed90010 r7:000001a1 r6:000080d0 r5:000080d0 r4:60000193 [<c002d398>] (warn_slowpath_fmt) from [<c0069e94>] (lockdep_trace_alloc+0xd4/0x118) r3:c054c535 r2:c0547435 [<c0069dc0>] (lockdep_trace_alloc) from [<c00e3acc>] (__kmalloc_track_caller+0x34/0x11c) r5:eec000c0 r4:00000000 [<c00e3a98>] (__kmalloc_track_caller) from [<c02678b4>] (devres_alloc+0x20/0x48) r7:000001a1 r6:ee7e2138 r5:c007a3d8 r4:00000000 [<c0267894>] (devres_alloc) from [<c007a378>] (devm_request_threaded_irq+0x34/0x94) r5:ee7ea8d0 r4:00000000 [<c007a344>] (devm_request_threaded_irq) from [<c036ad4c>] (rsnd_src_probe_gen2+0x68/0x7c) r9:eef61120 r8:a0000113 r7:ee7ea8d8 r6:eef6113c r5:ee7ea8d0 r4:ee7e2138 [<c036ace4>] (rsnd_src_probe_gen2) from [<c0367e1c>] (rsnd_rdai_continuance_probe+0x80/0x29c) r5:eef61130 r4:c036ace4 [<c0367d9c>] (rsnd_rdai_continuance_probe) from [<c0368a80>] (rsnd_probe+0x114/0x304) r10:eef61110 r9:00000000 r8:ee7ea8d8 r7:eed90000 r6:eed90010 r5:ee7ea8d0 r4:c048e960 [<c036896c>] (rsnd_probe) from [<c02667f4>] (platform_drv_probe+0x50/0xa0) r10:00000000 r9:c062f000 r8:c0624dec r7:00000000 r6:c0624dec r5:eed90010 r4:fffffffe [<c02667a4>] (platform_drv_probe) from [<c0264fac>] (driver_probe_device+0xfc/0x264) r6:00000000 r5:c0e1e9fc r4:eed90010 r3:c02667a4 [<c0264eb0>] (driver_probe_device) from [<c02651d8>] (__driver_attach+0x78/0x9c) r8:c0606460 r7:c0619e98 r6:c0624dec r5:eed90044 r4:eed90010 r3:00000000 [<c0265160>] (__driver_attach) from [<c02635c8>] (bus_for_each_dev+0x74/0x98) r6:c0265160 r5:c0624dec r4:00000000 r3:00000001 [<c0263554>] (bus_for_each_dev) from [<c0264a98>] (driver_attach+0x20/0x28) r6:ee7ea9c0 r5:00000000 r4:c0624dec [<c0264a78>] (driver_attach) from [<c0264728>] (bus_add_driver+0xe8/0x1d0) [<c0264640>] (bus_add_driver) from [<c0265868>] (driver_register+0xa4/0xe8) r7:c0606460 r6:00000000 r5:c05e6abc r4:c0624dec [<c02657c4>] (driver_register) from [<c0266728>] (__platform_driver_register+0x50/0x64) r5:c05e6abc r4:ee7eec40 [<c02666d8>] (__platform_driver_register) from [<c05e6ad4>] (rsnd_driver_init+0x18/0x20) [<c05e6abc>] (rsnd_driver_init) from [<c000a7d8>] (do_one_initcall+0x108/0x1bc) [<c000a6d0>] (do_one_initcall) from [<c05c7dc8>] (kernel_init_freeable+0x11c/0x1e4) r9:c062f000 r8:c062f000 r7:c05fb160 r6:c05f3a40 r5:00000084 r4:00000006 [<c05c7cac>] (kernel_init_freeable) from [<c0445120>] (kernel_init+0x10/0xec) r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0445110 r4:00000000 [<c0445110>] (kernel_init) from [<c000fef0>] (ret_from_fork+0x14/0x24) r4:00000000 r3:00000000
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Mark, Geert
static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, struct rsnd_dai_stream *io) {
unsigned long flags; int ret;
rsnd_lock(priv, flags);
ret = rsnd_dai_call(probe, io, priv); if (ret == -EAGAIN) { /*
This causes the following warning on r8a7791/koelsch:
Thank you for pointing this. I will check/fixup it.
I checked about this issue. Indeed these locks are not needed. # 2 lock have issue when boot, # 2 lock has issue when unbind/rmmod/probe fail # 1 lock is not needed
Mark, is it possible to revert this patch ?
e9c390df671fadc829550935ffb6b23549f26ded (ASoC: rsnd: make sure it uses lock when it calls rsnd_dai_call)
Best regards --- Kuninori Morimoto
On Mon, May 11, 2015 at 05:44:14PM +0900, Kuninori Morimoto wrote:
Mark, is it possible to revert this patch ?
e9c390df671fadc829550935ffb6b23549f26ded (ASoC: rsnd: make sure it uses lock when it calls rsnd_dai_call)
Sure, please send a patch for that with a changelog explaining why the revert is being done.
Hi Mark
Mark, is it possible to revert this patch ?
e9c390df671fadc829550935ffb6b23549f26ded (ASoC: rsnd: make sure it uses lock when it calls rsnd_dai_call)
Sure, please send a patch for that with a changelog explaining why the revert is being done.
OK, I will send it.
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current rsnd driver is using SSI parent related function/macro as "clock" related. but it is not only clock related. tidyup function/macro naming.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/ssi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 7bb9c08..2ef48a4 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -80,7 +80,7 @@ struct rsnd_ssi { #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod) #define rsnd_dma_to_ssi(dma) rsnd_mod_to_ssi(rsnd_dma_to_mod(dma)) #define rsnd_ssi_pio_available(ssi) ((ssi)->info->irq > 0) -#define rsnd_ssi_clk_from_parent(ssi) ((ssi)->parent) +#define rsnd_ssi_parent(ssi) ((ssi)->parent) #define rsnd_ssi_mode_flags(p) ((p)->info->flags) #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id) #define rsnd_ssi_of_node(priv) \ @@ -189,8 +189,10 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, rsnd_mod_hw_start(&ssi->mod);
if (rsnd_rdai_is_clk_master(rdai)) { - if (rsnd_ssi_clk_from_parent(ssi)) - rsnd_ssi_hw_start(ssi->parent, io); + struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi); + + if (ssi_parent) + rsnd_ssi_hw_start(ssi_parent, io); else rsnd_ssi_master_clk_start(ssi, io); } @@ -253,8 +255,10 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi) rsnd_ssi_status_check(&ssi->mod, IIRQ);
if (rsnd_rdai_is_clk_master(rdai)) { - if (rsnd_ssi_clk_from_parent(ssi)) - rsnd_ssi_hw_stop(ssi->parent); + struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi); + + if (ssi_parent) + rsnd_ssi_hw_stop(ssi_parent); else rsnd_ssi_master_clk_stop(ssi); } @@ -598,7 +602,7 @@ int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) return !!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_CLK_PIN_SHARE); }
-static void rsnd_ssi_parent_clk_setup(struct rsnd_priv *priv, struct rsnd_ssi *ssi) +static void rsnd_ssi_parent_setup(struct rsnd_priv *priv, struct rsnd_ssi *ssi) { if (!rsnd_ssi_is_pin_sharing(&ssi->mod)) return; @@ -732,7 +736,7 @@ int rsnd_ssi_probe(struct platform_device *pdev, if (ret) return ret;
- rsnd_ssi_parent_clk_setup(priv, ssi); + rsnd_ssi_parent_setup(priv, ssi); }
return 0;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
SSI parent/child need to use same number of sound data channel if these are sharing clock/ws pin. this patch makes it sure.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/ssi.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 2ef48a4..5b89723 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -66,6 +66,7 @@ struct rsnd_ssi {
u32 cr_own; u32 cr_clk; + int chan; int err; unsigned int usrcnt; }; @@ -264,6 +265,8 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi) }
rsnd_mod_hw_stop(&ssi->mod); + + ssi->chan = 0; }
dev_dbg(dev, "%s[%d] hw stopped\n", @@ -340,6 +343,35 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, return 0; }
+static int rsnd_ssi_hw_params(struct rsnd_mod *mod, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); + struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi); + int chan = params_channels(params); + + /* + * Already working. + * It will happen if SSI has parent/child connection. + */ + if (ssi->usrcnt) { + /* + * it is error if child <-> parent SSI uses + * different channels. + */ + if (ssi->chan != chan) + return -EIO; + } + + /* It will be removed on rsnd_ssi_hw_stop */ + ssi->chan = chan; + if (ssi_parent) + return rsnd_ssi_hw_params(&ssi_parent->mod, substream, params); + + return 0; +} + static void rsnd_ssi_record_error(struct rsnd_ssi *ssi, u32 status) { /* under/over flow error */ @@ -460,6 +492,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = { .quit = rsnd_ssi_quit, .start = rsnd_ssi_start, .stop = rsnd_ssi_stop, + .hw_params = rsnd_ssi_hw_params, };
static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, @@ -569,6 +602,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = { .start = rsnd_ssi_dma_start, .stop = rsnd_ssi_dma_stop, .fallback = rsnd_ssi_fallback, + .hw_params = rsnd_ssi_hw_params, };
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
rsnd might be used in multi-codec sound card. Then, same name kcontrol will be registered many times, and it will be error. This patch fixes this issue by using .index
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/rcar/core.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 164653c..99eb109 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -839,12 +839,14 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod, struct rsnd_kctrl_cfg *cfg, void (*update)(struct rsnd_mod *mod)) { + struct snd_soc_card *soc_card = rtd->card; struct snd_card *card = rtd->card->snd_card; struct snd_kcontrol *kctrl; struct snd_kcontrol_new knew = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = name, .info = rsnd_kctrl_info, + .index = rtd - soc_card->rtd, .get = rsnd_kctrl_get, .put = rsnd_kctrl_put, .private_value = (unsigned long)cfg,
participants (3)
-
Geert Uytterhoeven
-
Kuninori Morimoto
-
Mark Brown