]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
ASoC: davinci-mcasp: Remove AFIFO hw_rule
authorMisael Lopez Cruz <misael.lopez@ti.com>
Wed, 10 Jun 2015 20:37:41 +0000 (15:37 -0500)
committerMisael Lopez Cruz <misael.lopez@ti.com>
Fri, 19 Jun 2015 19:07:23 +0000 (14:07 -0500)
There hw_rule for the buffer size when AFIFO is used is no longer needed
as the driver now recalculates the FIFO threshold based on the size of
the ALSA period.

This patch reverts the following commits:
53bd6a90 ASoC: davinci-mcasp: Add hw_rule for buffer_size when using AFIFO
8190bd62 ALSA: pcm: export 'snd_interval_step' symbol

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
include/sound/pcm.h
sound/core/pcm_lib.c
sound/soc/davinci/davinci-mcasp.c

index 9264ae0fe20f8c226a74e1f353d0a71ee48c9d5b..4883499ab38b07834dc6b4ee3fe085bf93b0efdf 100644 (file)
@@ -792,8 +792,6 @@ void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
                          const struct snd_interval *b, struct snd_interval *c);
 int snd_interval_list(struct snd_interval *i, unsigned int count,
                      const unsigned int *list, unsigned int mask);
-int snd_interval_step(struct snd_interval *i,
-                     unsigned int min, unsigned int step);
 int snd_interval_ratnum(struct snd_interval *i,
                        unsigned int rats_count, struct snd_ratnum *rats,
                        unsigned int *nump, unsigned int *denp);
index 92d1fcc6e45e89771d82f35093639911f400b8a0..e1ef106c8a6f05882156c4be8e805af16d4c6895 100644 (file)
@@ -1115,7 +1115,7 @@ int snd_interval_list(struct snd_interval *i, unsigned int count,
 
 EXPORT_SYMBOL(snd_interval_list);
 
-int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int step)
+static int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int step)
 {
        unsigned int n;
        int changed = 0;
@@ -1135,7 +1135,6 @@ int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int ste
        }
        return changed;
 }
-EXPORT_SYMBOL(snd_interval_step);
 
 /* Info constraints helpers */
 
index 2bd9e6c7990537eeff2ef4266492a3889f682e73..401daee1567822232b1945a22905470805eb652e 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include <linux/math64.h>
-#include <linux/lcm.h>
 
 #include <sound/asoundef.h>
 #include <sound/core.h>
@@ -1047,67 +1046,6 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
        return snd_mask_refine(fmt, &nfmt);
 }
 
-static int davinci_mcasp_hwrule_buffersize(struct snd_pcm_hw_params *params,
-                                          struct snd_pcm_hw_rule *rule,
-                                          int stream)
-{
-       struct snd_interval *buffer_size = hw_param_interval(params,
-                       SNDRV_PCM_HW_PARAM_BUFFER_SIZE);
-       struct davinci_mcasp *dev = rule->private;
-       int channels = params_channels(params);
-       int periods = params_periods(params);
-       int i;
-       u8 slots = dev->tdm_slots;
-       u8 max_active_serializers = (channels + slots - 1) / slots;
-       u8 num_ser = 0;
-       u8 num_evt = 0;
-       unsigned long step = 1;
-
-       if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
-               for (i = 0; i < dev->num_serializer; i++) {
-                       if (dev->serial_dir[i] == TX_MODE &&
-                                       num_ser < max_active_serializers)
-                               num_ser++;
-               }
-               num_evt = dev->txnumevt * num_ser;
-       } else {
-               for (i = 0; i < dev->num_serializer; i++) {
-                       if (dev->serial_dir[i] == RX_MODE &&
-                                       num_ser < max_active_serializers)
-                               num_ser++;
-               }
-               num_evt = dev->rxnumevt * num_ser;
-       }
-
-       /*
-        * The buffersize (in samples), must be a multiple of num_evt.  The
-        * buffersize (in frames) is the product of the period_size and the
-        * number of periods. Therefore, the buffersize should be a multiple
-        * of the number of periods. The below finds the least common
-        * multiple of num_evt and channels (since the number of samples
-        * per frame is equal to the number of channels). It also makes sure
-        * that the resulting step value (LCM / channels) is a multiple of the
-        * number of periods.
-        */
-       step = lcm((lcm(num_evt, channels) / channels), periods);
-
-       return snd_interval_step(buffer_size, 0, step);
-}
-
-static int davinci_mcasp_hwrule_txbuffersize(struct snd_pcm_hw_params *params,
-                                            struct snd_pcm_hw_rule *rule)
-{
-       return davinci_mcasp_hwrule_buffersize(params, rule,
-                                              SNDRV_PCM_STREAM_PLAYBACK);
-}
-
-static int davinci_mcasp_hwrule_rxbuffersize(struct snd_pcm_hw_params *params,
-                                                 struct snd_pcm_hw_rule *rule)
-{
-       return davinci_mcasp_hwrule_buffersize(params, rule,
-                                              SNDRV_PCM_STREAM_CAPTURE);
-}
-
 static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
                                 struct snd_soc_dai *cpu_dai)
 {
@@ -1131,24 +1069,6 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
        else
                dir = RX_MODE;
 
-       if (mcasp->version == MCASP_VERSION_4) {
-               if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-                       if (mcasp->txnumevt)
-                               snd_pcm_hw_rule_add(substream->runtime, 0,
-                                       SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
-                                       davinci_mcasp_hwrule_txbuffersize,
-                                       mcasp,
-                                       SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
-               } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
-                       if (mcasp->rxnumevt)
-                               snd_pcm_hw_rule_add(substream->runtime, 0,
-                                       SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
-                                       davinci_mcasp_hwrule_rxbuffersize,
-                                       mcasp,
-                                       SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
-               }
-       }
-
        for (i = 0; i < mcasp->num_serializer; i++) {
                if (mcasp->serial_dir[i] == dir)
                        max_channels++;