]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00219926-1 ESAI ASRC: use ideal ratio for ASRC P2P playback
authorChen Liangjun <b36089@freescale.com>
Thu, 16 Aug 2012 11:20:51 +0000 (19:20 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:15 +0000 (08:35 +0200)
When use no ideal-ratio mode for ESAI playback, CPU should provide
accurate clock for input clock, which means input clock should be
divided by input sample rate. However, all our clock is from 24M crystal
and if the input sample rate equal to 44.1k or so, CPU can't provide
these clock.

In this patch, use ideal ratio mode thus CPU need not provide accurate
clock which can be divided by 44.1k.

Signed-off-by: Chen Liangjun <b36089@freescale.com>
drivers/mxc/asrc/mxc_asrc.c
sound/soc/imx/imx-cs42888.c

index ed3256906863fd054ed492c390d59fecbf5860de..cd4d9ee98a9fe6343bdba548125d46c83d04e663 100644 (file)
@@ -583,17 +583,23 @@ int asrc_config_pair(struct asrc_config *config)
                }
        }
 
-       if ((config->inclk == INCLK_ASRCK1_CLK) &&
+       if ((config->inclk == INCLK_NONE) &&
                        (config->outclk == OUTCLK_ESAI_TX)) {
                reg = __raw_readl(g_asrc->vaddr + ASRC_ASRCTR_REG);
-               reg |= (1 << (20 + config->pair));
-               reg |= (0x02 << (13 + (config->pair << 1)));
+               reg &= ~(1 << (20 + config->pair));
+               reg |= (0x03 << (13 + (config->pair << 1)));
                __raw_writel(reg, g_asrc->vaddr + ASRC_ASRCTR_REG);
                err = asrc_set_clock_ratio(config->pair,
                                           config->input_sample_rate,
                                           config->output_sample_rate);
                if (err < 0)
                        return err;
+               err = asrc_set_process_configuration(config->pair,
+                                                    config->input_sample_rate,
+                                                    config->
+                                                    output_sample_rate);
+               if (err < 0)
+                       return err;
        }
 
        /* Config input and output wordwidth */
index 11ba16511ce2881d2b7747ad7f92b9b806cea18b..acec900618b1365a61a85676e0c2be61f5ffd059 100644 (file)
@@ -94,7 +94,7 @@ static int config_asrc(struct snd_pcm_substream *substream,
        config.channel_num = channel;
        config.input_sample_rate = rate;
        config.output_sample_rate = iprtd->p2p->p2p_rate;
-       config.inclk = INCLK_ASRCK1_CLK;
+       config.inclk = INCLK_NONE;
        config.outclk = OUTCLK_ESAI_TX;
 
        ret = asrc_config_pair(&config);
@@ -131,7 +131,6 @@ static void imx_3stack_shutdown(struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-       struct imx_pcm_runtime_data *iprtd = substream->runtime->private_data;
 
        if (!cpu_dai->active)
                hw_state.hw = 0;