From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
Liam Girdwood <lrg@ti.com>
Subject: Re: [PATCH 1/2] ASoC: Allow drivers to specify how many bits are significant on a DAI
Date: Tue, 17 Jan 2012 09:55:23 +0100 [thread overview]
Message-ID: <4F15377B.6080108@ti.com> (raw)
In-Reply-To: <1326739267-9678-1-git-send-email-broonie@opensource.wolfsonmicro.com>
On 01/16/2012 07:41 PM, Mark Brown wrote:
> /*
> + * List of sample sizes that might go over the bus for parameter
> + * application. There ought to be a wildcard sample size for things
> + * like the DAC/ADC resolution to use but there isn't right now.
> + */
> +static int sample_sizes[] = {
> + 8, 16, 24, 32,
> +};
> +
> +static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + int ret, i, bits;
> +
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + bits = dai->driver->playback.sig_bits;
> + else
> + bits = dai->driver->capture.sig_bits;
> +
> + if (!bits)
> + return;
> +
> + for (i = 0; i < ARRAY_SIZE(sample_sizes); i++) {
> + ret = snd_pcm_hw_constraint_msbits(substream->runtime,
> + 0, sample_sizes[i],
> + bits);
Should we apply the constraint only if the sample size is bigger than
the msbit request:
if (sample_sizes[i] > bits) {
ret = snd_pcm_hw_constraint_msbits();
}
Might be not an issue to say that we have 24msbit on the 8bit sample,
but it does not sound right.
> + if (ret != 0)
> + dev_warn(dai->dev,
> + "Failed to set MSB %d/%d: %d\n",
> + bits, sample_sizes[i], ret);
> + }
> +}
> +
> +/*
> * Called by ALSA when a PCM substream is opened, the runtime->hw record is
> * then initialized and any private data can be allocated. This also calls
> * startup for the cpu DAI, platform, machine and codec DAI.
> @@ -187,6 +220,9 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
> goto config_err;
> }
>
> + soc_pcm_apply_msb(substream, codec_dai);
> + soc_pcm_apply_msb(substream, cpu_dai);
> +
> /* Symmetry only applies if we've already got an active stream. */
> if (cpu_dai->active) {
> ret = soc_pcm_apply_symmetry(substream, cpu_dai);
--
Péter
next prev parent reply other threads:[~2012-01-17 8:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 18:41 [PATCH 1/2] ASoC: Allow drivers to specify how many bits are significant on a DAI Mark Brown
2012-01-16 18:41 ` [PATCH 2/2] ASoC: 24 bits are significant on the WM8996 audio interfaces Mark Brown
2012-01-16 22:26 ` [PATCH 1/2] ASoC: Allow drivers to specify how many bits are significant on a DAI Girdwood, Liam
2012-01-16 22:42 ` Mark Brown
2012-01-17 8:56 ` Peter Ujfalusi
2012-01-17 8:55 ` Peter Ujfalusi [this message]
2012-01-17 11:38 ` Mark Brown
2012-01-17 13:06 ` Peter Ujfalusi
2012-01-17 13:19 ` Mark Brown
2012-01-17 14:18 ` Peter Ujfalusi
2012-01-17 14:56 ` Mark Brown
2012-01-17 16:08 ` Peter Ujfalusi
2012-01-17 16:44 ` Mark Brown
2012-01-17 17:55 ` Peter Ujfalusi
2012-01-17 18:17 ` Mark Brown
2012-01-17 18:51 ` Peter Ujfalusi
2012-01-17 18:59 ` Mark Brown
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=4F15377B.6080108@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@ti.com \
--cc=patches@opensource.wolfsonmicro.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 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.