All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Use snd_pcm_format_width() in snd_soc_params_to_frame_size()
@ 2011-02-01 13:30 Mark Brown
  2011-02-01 14:30 ` Liam Girdwood
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2011-02-01 13:30 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-utils.c |   23 +++--------------------
 1 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 1d07b93..3f45e6a 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -28,26 +28,9 @@ int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params)
 {
 	int sample_size;
 
-	switch (params_format(params)) {
-	case SNDRV_PCM_FORMAT_S16_LE:
-	case SNDRV_PCM_FORMAT_S16_BE:
-		sample_size = 16;
-		break;
-	case SNDRV_PCM_FORMAT_S20_3LE:
-	case SNDRV_PCM_FORMAT_S20_3BE:
-		sample_size = 20;
-		break;
-	case SNDRV_PCM_FORMAT_S24_LE:
-	case SNDRV_PCM_FORMAT_S24_BE:
-		sample_size = 24;
-		break;
-	case SNDRV_PCM_FORMAT_S32_LE:
-	case SNDRV_PCM_FORMAT_S32_BE:
-		sample_size = 32;
-		break;
-	default:
-		return -ENOTSUPP;
-	}
+	sample_size = snd_pcm_format_width(params_format(params));
+	if (sample_size < 0)
+		return sample_size;
 
 	return snd_soc_calc_frame_size(sample_size, params_channels(params),
 				       1);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: Use snd_pcm_format_width() in snd_soc_params_to_frame_size()
  2011-02-01 13:30 [PATCH] ASoC: Use snd_pcm_format_width() in snd_soc_params_to_frame_size() Mark Brown
@ 2011-02-01 14:30 ` Liam Girdwood
  0 siblings, 0 replies; 2+ messages in thread
From: Liam Girdwood @ 2011-02-01 14:30 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

On Tue, 2011-02-01 at 13:30 +0000, Mark Brown wrote:
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  sound/soc/soc-utils.c |   23 +++--------------------
>  1 files changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
> index 1d07b93..3f45e6a 100644
> --- a/sound/soc/soc-utils.c
> +++ b/sound/soc/soc-utils.c
> @@ -28,26 +28,9 @@ int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params)
>  {
>  	int sample_size;
>  
> -	switch (params_format(params)) {
> -	case SNDRV_PCM_FORMAT_S16_LE:
> -	case SNDRV_PCM_FORMAT_S16_BE:
> -		sample_size = 16;
> -		break;
> -	case SNDRV_PCM_FORMAT_S20_3LE:
> -	case SNDRV_PCM_FORMAT_S20_3BE:
> -		sample_size = 20;
> -		break;
> -	case SNDRV_PCM_FORMAT_S24_LE:
> -	case SNDRV_PCM_FORMAT_S24_BE:
> -		sample_size = 24;
> -		break;
> -	case SNDRV_PCM_FORMAT_S32_LE:
> -	case SNDRV_PCM_FORMAT_S32_BE:
> -		sample_size = 32;
> -		break;
> -	default:
> -		return -ENOTSUPP;
> -	}
> +	sample_size = snd_pcm_format_width(params_format(params));
> +	if (sample_size < 0)
> +		return sample_size;
>  
>  	return snd_soc_calc_frame_size(sample_size, params_channels(params),
>  				       1);

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-01 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 13:30 [PATCH] ASoC: Use snd_pcm_format_width() in snd_soc_params_to_frame_size() Mark Brown
2011-02-01 14:30 ` Liam Girdwood

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.