All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Subject: Re: How to handle stream rates if CPU supports many channels ?
Date: Tue, 6 Jun 2017 07:04:02 +0000	[thread overview]
Message-ID: <874lvtzjo5.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <6d1e2ca9-2a3f-ff12-28c4-c96224760913@sakamocchi.jp>


Hi Sakamoto-san

Thank you for detail explanation.

> static int hw_rule_rate()
> {
> unsigned int list[2]
> /* when the range of channels include 2, then 192000 is available. */
> /* when the range of channels include 8, then 48000 is available. */
> snd_interval_list(list)
> }
> 
> static int hw_rule_channels()
> {
> unsigned int list[2]
> /* when the range of rates include 48000, then 8ch is available. */
> /* when the range of rates include 192000, then 2ch is available. */
> snd_interval_list(list)
> }
> 
> static int startup()
> {
> ...
> snd_pcm_hw_rule_add(SNDRV_PCM_HW_PARAM_RATE, hw_rule_rate,
> SNDRV_PCM_HW_PARAM_CHANNELS)
> snd_pcm_hw_rule_add(SNDRV_PCM_HW_PARAM_CHANNELS, hw_rule_channels,
> SNDRV_PCM_HW_PARAM_RATE)
> ...
> }
> 
> struct snd_soc_dai.startup = startup;

I didn't know about this.
Thanks. I will implement it.

> Furthermore, PCM runtime require constraints for channels and
> rates. In ALSA SoC part, this is done by 'soc_pcm_init_runtime_hw()'
> in 'sound/soc/soc-pcm.c'. Your driver should have proper values in
> data of 'struct snd_soc_pcm_stream' as the constraints.
> 
> ```
> (struct snd_soc_dai_driver.playback or capture?)
> struct snd_soc_pcm_stream.channels_min = 2
> struct snd_soc_pcm_stream.channels_max = 8
> struct snd_soc_pcm_stream.rate_min = 48000
> struct snd_soc_pcm_stream.rate_max = 192000
> struct snd_soc_pcm_stream.rates =
>     SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_192000

Here, I'm not yet 100% understanding about these value.
I think, above are constraints of whole driver (= it supports both 2ch, 8ch).

About rate_min/max and rates.
is this "rate_min" 48000 (= maximum rate of min case = 8ch) ?? not 8000 ?
(For example, if 2ch supports 8000-192000, 8ch supports 8000-48000)

And is .rates "SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_192000" ?
not SNDRV_PCM_RATE_8000_192000 ?

Thank you for your help

Best regards
---
Kuninori Morimoto

  reply	other threads:[~2017-06-06  7:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  0:48 How to handle stream rates if CPU supports many channels ? Kuninori Morimoto
2017-06-06  3:41 ` Takashi Sakamoto
2017-06-06  7:04   ` Kuninori Morimoto [this message]
2017-06-06 15:22     ` Takashi Sakamoto
2017-06-06 23:41       ` Kuninori Morimoto

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=874lvtzjo5.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hiroyuki.yokoyama.vx@renesas.com \
    --cc=o-takashi@sakamocchi.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.