From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Sven Van Asbroeck <thesven73@gmail.com>,
alsa-devel@alsa-project.org, David Airlie <airlied@linux.ie>,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>, Jyri Sarha <jsarha@ti.com>,
Jaroslav Kysela <perex@perex.cz>,
Peter Ujfalusi <peter.ujfalusi@ti.com>,
Mark Brown <broonie@kernel.org>,
dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 1/2] ASoC: simple-card: add support for bclk_ratio
Date: Tue, 26 Feb 2019 09:11:04 +0000 [thread overview]
Message-ID: <20190226091104.xr27vsiayiq3dl2n@shell.armlinux.org.uk> (raw)
In-Reply-To: <877ednbdnz.wl-kuninori.morimoto.gx@renesas.com>
On Tue, Feb 26, 2019 at 09:35:47AM +0900, Kuninori Morimoto wrote:
> > @@ -97,7 +98,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
> > struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
> > struct simple_dai_props *dai_props =
> > simple_priv_to_props(priv, rtd->num);
> > - unsigned int mclk, mclk_fs = 0;
> > + unsigned int mclk, bclk_ratio, mclk_fs = 0, bclk_slot_ratio = 0;
> > int ret = 0;
> >
> > if (dai_props->mclk_fs)
> (snip)
> > + if (bclk_slot_ratio) {
> > + /* FIXME do we need to care about TDM slots here ? */
> > + bclk_ratio = snd_soc_calc_frame_size(bclk_slot_ratio,
> > + params_channels(params), 1);
> > +
> > + ret = snd_soc_dai_set_bclk_ratio(codec_dai, bclk_ratio);
> > + if (ret && ret != -ENOTSUPP)
> > + goto err;
> > +
> > + ret = snd_soc_dai_set_bclk_ratio(cpu_dai, bclk_ratio);
> > + if (ret && ret != -ENOTSUPP)
> > + goto err;
> > + }
>
> Not a big deal, but "bclk_ratio" is used only here.
> We can define it here
This code actually requires a lot more thought - while it may solve
Sven's issue, it isn't generic. So far, I have this table put
together from various sources of information:
bclk_ratio
sample width current mcasp fslssi kirkwood
16 32 32 64 64
24 48 48 64 64
32 64 64 64 64
Let's also consider whether it should depend on the number of channels.
I2S uses a WS/LRCLK signal to differentiate each channel and to demark
where the MSB bit is.
If userspace negotiates one channel, what happens - if WS becomes
static, then there is no signal indicating where the MSB bit is in
the stream, so there is no way for a receiver to synchronise. So,
it is highly unlikely that bclk_ratio = channels * sample_width.
If the signal continues toggling, what does it do for the inactive
channel - is that just one BCLK period long or does it assume there
is still the second channel? If the former, it means we could end
up with bclk_ratios of 17, 25, 33 which imho is unlikely, and
would mess up TDA998x's CTS measurement.
What about setups where we have multiple I2S data signals (to support
multi-channel audio) - if we have four channels transmitted on two
data lines (as would be required by the TDA998x), that doesn't mean
BCLK becomes sample_width * 4.
So, I don't think the number of channels comes into the bclk_ratio
calculation at all. Given the above code, it effectively means we'd
always specify channels = 2 to snd_soc_calc_frame_size().
Given that it is normal to talk about I2S being clocked at "64fs",
"32fs" etc, wouldn't it just be much neater to specify _this_ value
in DT, rather than half that value?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-02-26 9:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 16:42 [RFC PATCH 1/2] ASoC: simple-card: add support for bclk_ratio Sven Van Asbroeck
2019-02-25 16:42 ` [RFC PATCH 2/2] ASoC: core: standardize snd_soc_dai_set_bclk_ratio() behaviour Sven Van Asbroeck
2019-02-26 0:35 ` [RFC PATCH 1/2] ASoC: simple-card: add support for bclk_ratio Kuninori Morimoto
2019-02-26 9:11 ` Russell King - ARM Linux admin [this message]
2019-02-26 14:53 ` Sven Van Asbroeck
2019-02-26 15:23 ` Mark Brown
2019-02-26 15:45 ` Russell King - ARM Linux admin
2019-02-26 16:21 ` Mark Brown
2019-02-26 16:31 ` Sven Van Asbroeck
2019-02-26 16:41 ` Mark Brown
2019-02-26 17:03 ` Russell King - ARM Linux admin
2019-02-27 18:36 ` Mark Brown
2019-02-26 18:46 ` Sven Van Asbroeck
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=20190226091104.xr27vsiayiq3dl2n@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=airlied@linux.ie \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jsarha@ti.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@ti.com \
--cc=thesven73@gmail.com \
--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).