* [PATCH v6] ASoC: Apply msbits constraint for sample size bigger than the msbits
@ 2012-01-19 16:06 Peter Ujfalusi
2012-01-19 17:51 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Peter Ujfalusi @ 2012-01-19 16:06 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel
In order to avoid confusing the applications with msbits bigger
than the selected sample size apply the msbits constraint only
to sample size bigger than the requested msbits.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Hi Mark,
Let's try this way.
I think this implementation is quete clear for the first look to understand what
it is doing.
Regards,
Peter
sound/soc/soc-pcm.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 8bb1793..d6fdde2 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -68,7 +68,7 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
* like the DAC/ADC resolution to use but there isn't right now.
*/
static int sample_sizes[] = {
- 8, 16, 24, 32,
+ 32, 24, 16, 8,
};
static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
@@ -85,13 +85,20 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
return;
for (i = 0; i < ARRAY_SIZE(sample_sizes); i++) {
- ret = snd_pcm_hw_constraint_msbits(substream->runtime,
- 0, sample_sizes[i],
- bits);
- if (ret != 0)
- dev_warn(dai->dev,
- "Failed to set MSB %d/%d: %d\n",
- bits, sample_sizes[i], ret);
+ if (sample_sizes[i] > bits) {
+ ret = snd_pcm_hw_constraint_msbits(substream->runtime,
+ 0, sample_sizes[i], bits);
+ if (ret != 0)
+ dev_warn(dai->dev,
+ "Failed to set MSB %d/%d: %d\n",
+ bits, sample_sizes[i], ret);
+ } else {
+ /*
+ * The remaining sample sizes are smaller than the
+ * requested msbits, we can bail out from the loop.
+ */
+ break;
+ }
}
}
--
1.7.8.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v6] ASoC: Apply msbits constraint for sample size bigger than the msbits
2012-01-19 16:06 [PATCH v6] ASoC: Apply msbits constraint for sample size bigger than the msbits Peter Ujfalusi
@ 2012-01-19 17:51 ` Mark Brown
2012-01-19 18:23 ` Peter Ujfalusi
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2012-01-19 17:51 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Liam Girdwood
On Thu, Jan 19, 2012 at 05:06:03PM +0100, Peter Ujfalusi wrote:
> Let's try this way.
> I think this implementation is quete clear for the first look to understand what
> it is doing.
> for (i = 0; i < ARRAY_SIZE(sample_sizes); i++) {
> + if (sample_sizes[i] > bits) {
> + ret = snd_pcm_hw_constraint_msbits(substream->runtime,
> + 0, sample_sizes[i], bits);
> + if (ret != 0)
> + dev_warn(dai->dev,
> + "Failed to set MSB %d/%d: %d\n",
> + bits, sample_sizes[i], ret);
> + } else {
> + /*
> + * The remaining sample sizes are smaller than the
> + * requested msbits, we can bail out from the loop.
> + */
> + break;
> + }
*sigh* I think from the tone of the above you know that's not really
addressing the issue.
My yak is getting pretty bald now and I'm running out of razors.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v6] ASoC: Apply msbits constraint for sample size bigger than the msbits
2012-01-19 17:51 ` Mark Brown
@ 2012-01-19 18:23 ` Peter Ujfalusi
0 siblings, 0 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2012-01-19 18:23 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Liam Girdwood
On 01/19/2012 06:51 PM, Mark Brown wrote:
> *sigh* I think from the tone of the above you know that's not really
> addressing the issue.
>
> My yak is getting pretty bald now and I'm running out of razors.
Mine still have plenty of hair, and I have some spare razors left.
But it is getting it cold over here. I don't want it to fall sick.
I gave up.
--
Péter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-19 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-19 16:06 [PATCH v6] ASoC: Apply msbits constraint for sample size bigger than the msbits Peter Ujfalusi
2012-01-19 17:51 ` Mark Brown
2012-01-19 18:23 ` Peter Ujfalusi
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.