ASoC: odroidx2_max98090: Move clock settings from ops to late_probe
authorChen Zhen <zhen1.chen@samsung.com>
Mon, 7 Jul 2014 02:50:01 +0000 (10:50 +0800)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 03:00:04 +0000 (12:00 +0900)
after move the clock operations to late_probe,the configuration of
clock would be done only once and the ops can be removed altogether.

Change-Id: I96b9ffc1374c9404d401728796c8abdfe70f020a
Signed-off-by: Chen Zhen <zhen1.chen@samsung.com>
sound/soc/samsung/odroidx2_max98090.c

index 2b1f691..8ce4873 100644 (file)
@@ -24,39 +24,22 @@ struct odroidx2_drv_data {
 /* Config I2S CDCLK output 19.2MHZ clock to Max98090 */
 #define MAX98090_MCLK 19200000
 
-static int odroidx2_hw_params(struct snd_pcm_substream *substream,
-       struct snd_pcm_hw_params *params)
+static int odroidx2_late_probe(struct snd_soc_card *card)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
+       struct snd_soc_dai *cpu_dai = card->rtd[0].cpu_dai;
        int ret;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, MAX98090_MCLK,
                                                SND_SOC_CLOCK_IN);
-       if (ret < 0) {
-               dev_err(codec_dai->dev,
-                       "Unable to switch to FLL1: %d\n", ret);
+       if (ret < 0)
                return ret;
-       }
 
        /* Set the cpu DAI configuration in order to use CDCLK */
-       ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
+       return snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
                                        0, SND_SOC_CLOCK_OUT);
-       if (ret < 0)
-               return ret;
-
-       dev_dbg(codec_dai->dev, "HiFi DAI %s params: channels: %d, rate: %d\n",
-               snd_pcm_stream_str(substream), params_channels(params),
-               params_rate(params));
-
-       return 0;
 }
 
-static struct snd_soc_ops odroidx2_ops = {
-       .hw_params      = odroidx2_hw_params,
-};
-
 static const struct snd_soc_dapm_widget odroidx2_dapm_widgets[] = {
        SND_SOC_DAPM_HP("Headphone Jack", NULL),
        SND_SOC_DAPM_MIC("Mic Jack", NULL),
@@ -86,7 +69,6 @@ static struct snd_soc_dai_link odroidx2_dai[] = {
                .codec_dai_name = "HiFi",
                .dai_fmt        = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
                                  SND_SOC_DAIFMT_CBM_CFM,
-               .ops            = &odroidx2_ops,
        }, {
                .name           = "MAX98090 SEC",
                .stream_name    = "MAX98090 PCM SEC",
@@ -95,15 +77,15 @@ static struct snd_soc_dai_link odroidx2_dai[] = {
                .platform_name  = "samsung-i2s-sec",
                .dai_fmt        = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
                                  SND_SOC_DAIFMT_CBM_CFM,
-               .ops            = &odroidx2_ops,
        },
 };
 
 static struct snd_soc_card odroidx2 = {
-       .owner          = THIS_MODULE,
-       .dai_link       = odroidx2_dai,
-       .num_links      = ARRAY_SIZE(odroidx2_dai),
+       .owner                  = THIS_MODULE,
+       .dai_link               = odroidx2_dai,
+       .num_links              = ARRAY_SIZE(odroidx2_dai),
        .fully_routed   = true,
+       .late_probe             = odroidx2_late_probe,
 };
 
 struct odroidx2_drv_data odroidx2_drvdata = {