[alsa-devel] [PATCH 1/2] ASoC: omap-abe-mmap: Make the hwrule function to be more generic

Peter Ujfalusi peter.ujfalusi at ti.com
Wed Feb 6 16:10:08 CET 2013


Avoid using defines to get the snd_interval we are about to constrain.
rule->var holds the correct ID.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
---
 sound/soc/omap/omap-abe-mmap.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/soc/omap/omap-abe-mmap.c b/sound/soc/omap/omap-abe-mmap.c
index 92c240b..e5654c9 100644
--- a/sound/soc/omap/omap-abe-mmap.c
+++ b/sound/soc/omap/omap-abe-mmap.c
@@ -87,18 +87,17 @@ irqreturn_t abe_irq_handler(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int omap_abe_hwrule_period_step(struct snd_pcm_hw_params *params,
+static int omap_abe_hwrule_size_step(struct snd_pcm_hw_params *params,
 					struct snd_pcm_hw_rule *rule)
 {
-	struct snd_interval *period_size = hw_param_interval(params,
-				     SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
 	unsigned int rate = params_rate(params);
 
 	/* 44.1kHz has the same iteration number as 48kHz */
 	rate = (rate == 44100) ? 48000 : rate;
 
 	/* ABE requires chunks of 250us worth of data */
-	return snd_interval_step(period_size, 0, rate / 4000);
+	return snd_interval_step(hw_param_interval(params, rule->var), 0,
+				 rate / 4000);
 }
 
 static int aess_open(struct snd_pcm_substream *substream)
@@ -128,7 +127,7 @@ static int aess_open(struct snd_pcm_substream *substream)
 		 */
 		ret = snd_pcm_hw_rule_add(substream->runtime, 0,
 					SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
-					omap_abe_hwrule_period_step,
+					omap_abe_hwrule_size_step,
 					NULL,
 					SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
 		break;
-- 
1.8.1.1



More information about the Alsa-devel mailing list