From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Jiada Wang <jiada_wang@mentor.com>
Cc: <lgirdwood@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>,
<tiwai@suse.com>, <twischer@de.adit-jv.com>,
<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/3] ASoC: rsnd: Allow reconfiguration of clock rate
Date: 23 Jul 2019 10:40:53 +0900 [thread overview]
Message-ID: <87tvbdr0nw.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87a7d6h3b2.wl-kuninori.morimoto.gx@renesas.com>
Hi Jiada, again
> The solution looks very over-kill to me,
> especiallyq [3/3] patch is too much to me.
>
> 1st, can we start clock at .hw_param, instead of .prepare ?
> and stop it at .hw_free ?
>
> 2nd, can we keep usrcnt setup as-is ?
> I guess we can just avoid rsnd_ssi_master_clk_start() if ssi->rate was not 0 ?
> similar for rsnd_ssi_master_clk_stop()
In my quick check, I used your [1/3] patch and below.
It works for me, but I don't know detail of your test case.
----------
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index f6a7466..f26ffd1 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -286,19 +286,8 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
if (rsnd_ssi_is_multi_slave(mod, io))
return 0;
- if (ssi->usrcnt > 0) {
- if (ssi->rate != rate) {
- dev_err(dev, "SSI parent/child should use same rate\n");
- return -EINVAL;
- }
-
- if (ssi->chan != chan) {
- dev_err(dev, "SSI parent/child should use same chan\n");
- return -EINVAL;
- }
-
+ if (ssi->rate)
return 0;
- }
if (rsnd_runtime_is_tdm_split(io))
chan = rsnd_io_converted_chan(io);
@@ -349,7 +338,7 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod,
if (!rsnd_ssi_can_output_clk(mod))
return;
- if (ssi->usrcnt > 1)
+ if (!ssi->rate)
return;
ssi->cr_clk = 0;
@@ -539,6 +528,17 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod,
return 0;
}
+static int rsnd_ssi_hw_free(struct rsnd_mod *mod, struct rsnd_dai_stream *io,
+ struct snd_pcm_substream *substream)
+{
+ if (!rsnd_ssi_is_run_mods(mod, io))
+ return 0;
+
+ rsnd_ssi_master_clk_stop(mod, io);
+
+ return 0;
+}
+
static int rsnd_ssi_start(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
@@ -925,6 +925,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
.pointer = rsnd_ssi_pio_pointer,
.pcm_new = rsnd_ssi_pcm_new,
.hw_params = rsnd_ssi_hw_params,
+ .hw_free = rsnd_ssi_hw_free,
.prepare = rsnd_ssi_prepare,
.get_status = rsnd_ssi_get_status,
};
@@ -1012,6 +1013,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
.pcm_new = rsnd_ssi_pcm_new,
.fallback = rsnd_ssi_fallback,
.hw_params = rsnd_ssi_hw_params,
+ .hw_free = rsnd_ssi_hw_free,
.prepare = rsnd_ssi_prepare,
.get_status = rsnd_ssi_get_status,
};
----------
next prev parent reply other threads:[~2019-07-23 1:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 7:24 [PATCH v1 0/3] " Jiada Wang
2019-07-22 7:24 ` [PATCH v1 1/3] ASoC: rsnd: Support hw_free() callback at DAI level Jiada Wang
2019-07-23 17:18 ` Applied "ASoC: rsnd: Support hw_free() callback at DAI level" to the asoc tree Mark Brown
2019-07-22 7:24 ` [PATCH v1 2/3] ASoC: rsnd: Allow reconfiguration of clock rate Jiada Wang
2019-07-22 8:41 ` Kuninori Morimoto
2019-07-23 1:40 ` Kuninori Morimoto [this message]
2019-08-06 7:21 ` Jiada Wang
2019-08-06 8:05 ` Kuninori Morimoto
2019-07-22 7:24 ` [PATCH v1 3/3] ASoC: rsnd: call .hw_{params,free} in pair for same stream Jiada Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tvbdr0nw.wl-kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx@renesas.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jiada_wang@mentor.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=twischer@de.adit-jv.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®