From: Sven Van Asbroeck <thesven73@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
Jyri Sarha <jsarha@ti.com>, Takashi Iwai <tiwai@suse.com>,
Peter Ujfalusi <peter.ujfalusi@ti.com>,
Russell King <rmk+kernel@armlinux.org.uk>
Subject: [RFC PATCH 4/4] ASoC: fsl_ssi: constrain bclk_ratio in i2s master mode
Date: Mon, 4 Mar 2019 11:59:55 -0500 [thread overview]
Message-ID: <20190304165955.21696-4-TheSven73@gmail.com> (raw)
In-Reply-To: <20190304165955.21696-1-TheSven73@gmail.com>
The fsl_ssi always has a bclk_ratio of 64 in ssi master
mode, no matter the configured word length.
Add a rule which constrains the bclk_ratio to 64 in
ssi master mode.
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
---
sound/soc/fsl/fsl_ssi.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 0a648229e643..1c5b674fe253 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -627,6 +627,29 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi *ssi)
regmap_write(regs, REG_SSI_SOR, SSI_SOR_WAIT(3));
}
+static int fsl_ssi_hw_rule_i2s_master(struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
+{
+ struct snd_interval *it = hw_param_interval(params,
+ SNDRV_PCM_HW_PARAM_BCLK_RATIO);
+ struct fsl_ssi *ssi = rule->private;
+ struct snd_interval t;
+
+ if (!fsl_ssi_is_i2s_master(ssi))
+ return 0;
+
+ /*
+ * In i2s master mode, the ssi always generates 32 physical
+ * bits/channel. This mode always has 2 channels.
+ * This results in a fixed bclk_ratio of 64.
+ */
+ memset(&t, 0, sizeof(t));
+ t.min = t.max = 64;
+ t.integer = 1;
+
+ return snd_interval_refine(it, &t);
+}
+
static int fsl_ssi_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -648,6 +671,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
+ snd_pcm_hw_rule_add(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_BCLK_RATIO,
+ fsl_ssi_hw_rule_i2s_master, ssi,
+ SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_CHANNELS,
+ -1);
+
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2019-03-04 17:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-04 16:59 [RFC PATCH 1/4] alsa: make hw_params negotiation infrastructure 'bclk_ratio aware' Sven Van Asbroeck
2019-03-04 16:59 ` [RFC PATCH 2/4] ASoC: hdmi-codec: add support for bclk_ratio Sven Van Asbroeck
2019-03-04 16:59 ` [RFC PATCH 3/4] drm/i2c: tda998x: calculate CTS_N directly from the bclk_ratio Sven Van Asbroeck
2019-03-04 16:59 ` Sven Van Asbroeck [this message]
2019-03-05 4:42 ` [RFC PATCH 1/4] alsa: make hw_params negotiation infrastructure 'bclk_ratio aware' Takashi Sakamoto
2019-03-05 9:35 ` Russell King - ARM Linux admin
2019-03-05 14:23 ` Sven Van Asbroeck
2019-03-06 15:53 ` Jaroslav Kysela
2019-03-08 4:10 ` Takashi Sakamoto
2019-03-08 12:59 ` Russell King - ARM Linux admin
2019-03-08 13:37 ` Russell King - ARM Linux admin
2019-03-08 14:29 ` Takashi Sakamoto
2019-03-08 14:55 ` Russell King - ARM Linux admin
2019-03-08 17:22 ` Mark Brown
2019-03-08 19:54 ` Jaroslav Kysela
2019-03-08 20:07 ` Sven Van Asbroeck
2019-03-08 20:49 ` Pierre-Louis Bossart
2019-03-08 21:13 ` Mark Brown
2019-03-08 21:54 ` Pierre-Louis Bossart
2019-03-11 8:15 ` Takashi Sakamoto
2019-03-11 15:43 ` Jaroslav Kysela
2019-03-12 15:03 ` Mark Brown
2019-03-13 5:57 ` Takashi Sakamoto
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=20190304165955.21696-4-TheSven73@gmail.com \
--to=thesven73@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jsarha@ti.com \
--cc=lgirdwood@gmail.com \
--cc=peter.ujfalusi@ti.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).