All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: How exactly snd_pcm_hw_rule_add() should to be used?
Date: Tue, 5 Feb 2013 11:24:45 +0100	[thread overview]
Message-ID: <5110DDED.8030305@ti.com> (raw)

Hi,

I got confused (again) regarding to how to use correctly the
snd_pcm_hw_rule_add(). Looking at the documentation [1] and to the code in
kernel seams to be suggesting the opposite.

[A]
using the 5.6. example from [1]:
snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
		    hw_rule_channels_by_format, 0, SNDRV_PCM_HW_PARAM_FORMAT,
		    -1);

The [1] tells me that the SNDRV_PCM_HW_PARAM_FORMAT will be refined based on
the SNDRV_PCM_HW_PARAM_CHANNELS.

In 5.7. of [1] the reverse rule is placed:
snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT,
		    hw_rule_channels_by_format, 0,
		    SNDRV_PCM_HW_PARAM_CHANNELS, -1);

Which according to the example will refine the SNDRV_PCM_HW_PARAM_CHANNELS
based on the SNDRV_PCM_HW_PARAM_FORMAT.

However when looking at the code in the kernel the opposite seams to be what
is actually happening.

[B]
using the same 5.6. example from [1]:
snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
		    hw_rule_channels_by_format, 0, SNDRV_PCM_HW_PARAM_FORMAT,
		    -1);

It looks like the SNDRV_PCM_HW_PARAM_CHANNELS should be refined based on the
SNDRV_PCM_HW_PARAM_FORMAT.

Which one is the correct interpretation?

The reason I'm asking is that I need to have a rule which would place
constraint (step) on the BUFFER_SIZE based on the used RATE, but I can not use
a single snd_pcm_hw_constraint_step(,,BUFFER_TIME,) because of HW limitation.

Thank you,
Péter

[1] http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s09.html

             reply	other threads:[~2013-02-05 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 10:24 Peter Ujfalusi [this message]
2013-02-05 11:13 ` How exactly snd_pcm_hw_rule_add() should to be used? Takashi Iwai

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=5110DDED.8030305@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /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.