]> Git Repo - linux.git/commitdiff
Merge remote-tracking branches 'asoc/topic/fsl-asrc' and 'asoc/topic/fsl-ssi' into...
authorMark Brown <[email protected]>
Mon, 11 Jan 2016 13:54:36 +0000 (13:54 +0000)
committerMark Brown <[email protected]>
Mon, 11 Jan 2016 13:54:36 +0000 (13:54 +0000)
1  2  3 
sound/soc/fsl/fsl_asrc.c

diff --combined sound/soc/fsl/fsl_asrc.c
index dd1263b95dc78f5e882c541c14efddeb20e05ef6,73fd2c683b78f65b4e94d8c2e369831be8001af4,6d0636605ed25467e00ecc82f44b9f9cb5d28db1..c1a0e01cb8e79e1007c4b9ef7117206e4c891882
        dev_dbg(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
   
   /* Sample rates are aligned with that defined in pcm.h file */
  -static const u8 process_option[][8][2] = {
  -     /* 32kHz 44.1kHz 48kHz   64kHz   88.2kHz 96kHz   176kHz  192kHz */
  -     {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 5512Hz */
  -     {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 8kHz */
  -     {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 11025Hz */
  -     {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 16kHz */
  -     {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 22050Hz */
  -     {{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0},},      /* 32kHz */
  -     {{0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},},      /* 44.1kHz */
  -     {{0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},},      /* 48kHz */
  -     {{1, 2}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0},},      /* 64kHz */
  -     {{1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},},      /* 88.2kHz */
  -     {{1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},},      /* 96kHz */
  -     {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},},      /* 176kHz */
  -     {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},},      /* 192kHz */
  +static const u8 process_option[][12][2] = {
  +     /* 8kHz 11.025kHz 16kHz 22.05kHz 32kHz 44.1kHz 48kHz   64kHz   88.2kHz 96kHz   176kHz  192kHz */
  +     {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 5512Hz */
  +     {{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 8kHz */
  +     {{0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 11025Hz */
  +     {{1, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 16kHz */
  +     {{1, 2}, {1, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},},      /* 22050Hz */
  +     {{1, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0},},      /* 32kHz */
  +     {{2, 2}, {2, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},},      /* 44.1kHz */
  +     {{2, 2}, {2, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},},      /* 48kHz */
  +     {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {1, 2}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0},},      /* 64kHz */
  +     {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},},      /* 88.2kHz */
  +     {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},},      /* 96kHz */
  +     {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},},      /* 176kHz */
  +     {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},},      /* 192kHz */
   };
   
   /* Corresponding to process_option */
@@@@ -55,7 -55,7 -55,7 +55,7 @@@@ static int supported_input_rate[] = 
   };
   
   static int supported_asrc_rate[] = {
  -     32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000,
  +     8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000,
   };
   
   /**
@@@@ -286,13 -286,13 -286,6 +286,13 @@@@ static int fsl_asrc_config_pair(struct 
                return -EINVAL;
        }
   
  +     if ((outrate > 8000 && outrate < 30000) &&
  +         (outrate/inrate > 24 || inrate/outrate > 8)) {
  +             pair_err("exceed supported ratio range [1/24, 8] for \
  +                             inrate/outrate: %d/%d\n", inrate, outrate);
  +             return -EINVAL;
  +     }
  +
        /* Validate input and output clock sources */
        clk_index[IN] = clk_map[IN][config->inclk];
        clk_index[OUT] = clk_map[OUT][config->outclk];
@@@@ -454,7 -454,7 -447,7 +454,7 @@@@ static int fsl_asrc_dai_hw_params(struc
                                  struct snd_soc_dai *dai)
   {
        struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
 -      int width = snd_pcm_format_width(params_format(params));
 +      int width = params_width(params);
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct fsl_asrc_pair *pair = runtime->private_data;
        unsigned int channels = params_channels(params);
@@@@ -866,10 -866,10 -859,6 +866,10 @@@@ static int fsl_asrc_probe(struct platfo
                return PTR_ERR(asrc_priv->ipg_clk);
        }
   
  +     asrc_priv->spba_clk = devm_clk_get(&pdev->dev, "spba");
  +     if (IS_ERR(asrc_priv->spba_clk))
  +             dev_warn(&pdev->dev, "failed to get spba clock\n");
  +
        for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
                sprintf(tmp, "asrck_%x", i);
                asrc_priv->asrck_clk[i] = devm_clk_get(&pdev->dev, tmp);
@@@@ -950,11 -950,11 -939,6 +950,11 @@@@ static int fsl_asrc_runtime_resume(stru
        ret = clk_prepare_enable(asrc_priv->ipg_clk);
        if (ret)
                goto disable_mem_clk;
  +     if (!IS_ERR(asrc_priv->spba_clk)) {
  +             ret = clk_prepare_enable(asrc_priv->spba_clk);
  +             if (ret)
  +                     goto disable_ipg_clk;
  +     }
        for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
                ret = clk_prepare_enable(asrc_priv->asrck_clk[i]);
                if (ret)
   disable_asrck_clk:
        for (i--; i >= 0; i--)
                clk_disable_unprepare(asrc_priv->asrck_clk[i]);
  +     if (!IS_ERR(asrc_priv->spba_clk))
  +             clk_disable_unprepare(asrc_priv->spba_clk);
  +disable_ipg_clk:
        clk_disable_unprepare(asrc_priv->ipg_clk);
   disable_mem_clk:
        clk_disable_unprepare(asrc_priv->mem_clk);
@@@@ -982,8 -982,8 -963,6 +982,8 @@@@ static int fsl_asrc_runtime_suspend(str
   
        for (i = 0; i < ASRC_CLK_MAX_NUM; i++)
                clk_disable_unprepare(asrc_priv->asrck_clk[i]);
  +     if (!IS_ERR(asrc_priv->spba_clk))
  +             clk_disable_unprepare(asrc_priv->spba_clk);
        clk_disable_unprepare(asrc_priv->ipg_clk);
        clk_disable_unprepare(asrc_priv->mem_clk);
   
@@@@ -996,6 -996,9 -975,6 +996,9 @@@@ static int fsl_asrc_suspend(struct devi
   {
        struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
   
+ +     regmap_read(asrc_priv->regmap, REG_ASRCFG,
+ +                 &asrc_priv->regcache_cfg);
+ +
        regcache_cache_only(asrc_priv->regmap, true);
        regcache_mark_dirty(asrc_priv->regmap);
   
@@@@ -1016,6 -1019,10 -995,6 +1019,10 @@@@ static int fsl_asrc_resume(struct devic
        regcache_cache_only(asrc_priv->regmap, false);
        regcache_sync(asrc_priv->regmap);
   
+ +     regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
+ +                        ASRCFG_NDPRi_ALL_MASK | ASRCFG_POSTMODi_ALL_MASK |
+ +                        ASRCFG_PREMODi_ALL_MASK, asrc_priv->regcache_cfg);
+ +
        /* Restart enabled pairs */
        regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
                           ASRCTR_ASRCEi_ALL_MASK, asrctr);
This page took 0.242748 seconds and 4 git commands to generate.