ASoC: omap: Convert bunch of machine drivers to use init time DAI format
authorJarkko Nikula <jarkko.nikula@bitmer.com>
Fri, 30 Sep 2011 13:07:45 +0000 (16:07 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 2 Oct 2011 18:57:07 +0000 (19:57 +0100)
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/omap/am3517evm.c
sound/soc/omap/igep0020.c
sound/soc/omap/n810.c
sound/soc/omap/omap3evm.c
sound/soc/omap/omap3pandora.c
sound/soc/omap/osk5912.c
sound/soc/omap/overo.c
sound/soc/omap/rx51.c
sound/soc/omap/sdp3430.c
sound/soc/omap/zoom2.c

index 73dde4a..48af0f8 100644 (file)
@@ -43,26 +43,6 @@ static int am3517evm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_DSP_B |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_DSP_B |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0,
                        CODEC_CLOCK, SND_SOC_CLOCK_IN);
@@ -140,6 +120,8 @@ static struct snd_soc_dai_link am3517evm_dai = {
        .codec_dai_name = "tlv320aic23-hifi",
        .platform_name = "omap-pcm-audio",
        .codec_name = "tlv320aic23-codec.2-001a",
+       .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
+                  SND_SOC_DAIFMT_CBM_CFM,
        .init = am3517evm_aic23_init,
        .ops = &am3517evm_ops,
 };
index 0ae3470..84615a7 100644 (file)
@@ -38,29 +38,8 @@ static int igep2_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                            SND_SOC_CLOCK_IN);
@@ -84,6 +63,8 @@ static struct snd_soc_dai_link igep2_dai = {
        .codec_dai_name = "twl4030-hifi",
        .platform_name = "omap-pcm-audio",
        .codec_name = "twl4030-codec",
+       .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                  SND_SOC_DAIFMT_CBM_CFM,
        .ops = &igep2_ops,
 };
 
index 62e292f..c10d356 100644 (file)
@@ -115,25 +115,8 @@ static int n810_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int err;
 
-       /* Set codec DAI configuration */
-       err = snd_soc_dai_set_fmt(codec_dai,
-                                        SND_SOC_DAIFMT_I2S |
-                                        SND_SOC_DAIFMT_NB_NF |
-                                        SND_SOC_DAIFMT_CBM_CFM);
-       if (err < 0)
-               return err;
-
-       /* Set cpu DAI configuration */
-       err = snd_soc_dai_set_fmt(cpu_dai,
-                                      SND_SOC_DAIFMT_I2S |
-                                      SND_SOC_DAIFMT_NB_NF |
-                                      SND_SOC_DAIFMT_CBM_CFM);
-       if (err < 0)
-               return err;
-
        /* Set the codec system clock for DAC and ADC */
        err = snd_soc_dai_set_sysclk(codec_dai, 0, 12000000,
                                            SND_SOC_CLOCK_IN);
@@ -312,6 +295,8 @@ static struct snd_soc_dai_link n810_dai = {
        .platform_name = "omap-pcm-audio",
        .codec_name = "tlv320aic3x-codec.2-0018",
        .codec_dai_name = "tlv320aic3x-hifi",
+       .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                  SND_SOC_DAIFMT_CBM_CFM,
        .init = n810_aic33_init,
        .ops = &n810_ops,
 };
index 0daa044..bf9ae2a 100644 (file)
@@ -36,29 +36,8 @@ static int omap3evm_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "Can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "Can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                     SND_SOC_CLOCK_IN);
@@ -82,6 +61,8 @@ static struct snd_soc_dai_link omap3evm_dai = {
        .codec_dai_name = "twl4030-hifi",
        .platform_name = "omap-pcm-audio",
        .codec_name = "twl4030-codec",
+       .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                  SND_SOC_DAIFMT_CBM_CFM,
        .ops            = &omap3evm_ops,
 };
 
index 8047c52..3ae87fd 100644 (file)
@@ -48,24 +48,8 @@ static int omap3pandora_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-       int fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
-                 SND_SOC_DAIFMT_CBS_CFS;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai, fmt);
-       if (ret < 0) {
-               pr_err(PREFIX "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
-       if (ret < 0) {
-               pr_err(PREFIX "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                            SND_SOC_CLOCK_IN);
@@ -231,6 +215,8 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
                .codec_dai_name = "twl4030-hifi",
                .platform_name = "omap-pcm-audio",
                .codec_name = "twl4030-codec",
+               .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                          SND_SOC_DAIFMT_CBS_CFS,
                .ops = &omap3pandora_ops,
                .init = omap3pandora_out_init,
        }, {
@@ -240,6 +226,8 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
                .codec_dai_name = "twl4030-hifi",
                .platform_name = "omap-pcm-audio",
                .codec_name = "twl4030-codec",
+               .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                          SND_SOC_DAIFMT_CBS_CFS,
                .ops = &omap3pandora_ops,
                .init = omap3pandora_in_init,
        }
index 7e75e77..5978332 100644 (file)
@@ -55,29 +55,8 @@ static int osk_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int err;
 
-       /* Set codec DAI configuration */
-       err = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_DSP_B |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (err < 0) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return err;
-       }
-
-       /* Set cpu DAI configuration */
-       err = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_DSP_B |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (err < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return err;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        err =
            snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_IN);
@@ -141,6 +120,8 @@ static struct snd_soc_dai_link osk_dai = {
        .codec_dai_name = "tlv320aic23-hifi",
        .platform_name = "omap-pcm-audio",
        .codec_name = "tlv320aic23-codec",
+       .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
+                  SND_SOC_DAIFMT_CBM_CFM,
        .init = osk_tlv320aic23_init,
        .ops = &osk_ops,
 };
index bbcf380..739efe9 100644 (file)
@@ -38,29 +38,8 @@ static int overo_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                            SND_SOC_CLOCK_IN);
@@ -84,6 +63,8 @@ static struct snd_soc_dai_link overo_dai = {
        .codec_dai_name = "twl4030-hifi",
        .platform_name = "omap-pcm-audio",
        .codec_name = "twl4030-codec",
+       .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                  SND_SOC_DAIFMT_CBM_CFM,
        .ops = &overo_ops,
 };
 
index 893300a..7164db5 100644 (file)
@@ -115,24 +115,6 @@ static int rx51_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-       int err;
-
-       /* Set codec DAI configuration */
-       err = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_DSP_A |
-                                 SND_SOC_DAIFMT_IB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (err < 0)
-               return err;
-
-       /* Set cpu DAI configuration */
-       err = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_DSP_A |
-                                 SND_SOC_DAIFMT_IB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (err < 0)
-               return err;
 
        /* Set the codec system clock for DAC and ADC */
        return snd_soc_dai_set_sysclk(codec_dai, 0, 19200000,
@@ -377,6 +359,8 @@ static struct snd_soc_dai_link rx51_dai[] = {
                .codec_dai_name = "tlv320aic3x-hifi",
                .platform_name = "omap-pcm-audio",
                .codec_name = "tlv320aic3x-codec.2-0018",
+               .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
+                          SND_SOC_DAIFMT_CBM_CFM,
                .init = rx51_aic34_init,
                .ops = &rx51_ops,
        },
index 9f6a758..2ff5f7b 100644 (file)
@@ -53,29 +53,8 @@ static int sdp3430_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                            SND_SOC_CLOCK_IN);
@@ -96,29 +75,8 @@ static int sdp3430_hw_voice_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                               SND_SOC_DAIFMT_DSP_A |
-                               SND_SOC_DAIFMT_IB_NF |
-                               SND_SOC_DAIFMT_CBM_CFM);
-       if (ret) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                               SND_SOC_DAIFMT_DSP_A |
-                               SND_SOC_DAIFMT_IB_NF |
-                               SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                            SND_SOC_CLOCK_IN);
@@ -267,6 +225,8 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
                .codec_dai_name = "twl4030-hifi",
                .platform_name = "omap-pcm-audio",
                .codec_name = "twl4030-codec",
+               .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                          SND_SOC_DAIFMT_CBM_CFM,
                .init = sdp3430_twl4030_init,
                .ops = &sdp3430_ops,
        },
@@ -277,6 +237,8 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
                .codec_dai_name = "twl4030-voice",
                .platform_name = "omap-pcm-audio",
                .codec_name = "twl4030-codec",
+               .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
+                          SND_SOC_DAIFMT_CBM_CFM,
                .init = sdp3430_twl4030_voice_init,
                .ops = &sdp3430_voice_ops,
        },
index 9a2666f..c124562 100644 (file)
@@ -44,29 +44,8 @@ static int zoom2_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                                 SND_SOC_DAIFMT_I2S |
-                                 SND_SOC_DAIFMT_NB_NF |
-                                 SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                        SND_SOC_CLOCK_IN);
@@ -87,29 +66,8 @@ static int zoom2_hw_voice_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        int ret;
 
-       /* Set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai,
-                               SND_SOC_DAIFMT_DSP_A |
-                               SND_SOC_DAIFMT_IB_NF |
-                               SND_SOC_DAIFMT_CBM_CFM);
-       if (ret) {
-               printk(KERN_ERR "can't set codec DAI configuration\n");
-               return ret;
-       }
-
-       /* Set cpu DAI configuration */
-       ret = snd_soc_dai_set_fmt(cpu_dai,
-                               SND_SOC_DAIFMT_DSP_A |
-                               SND_SOC_DAIFMT_IB_NF |
-                               SND_SOC_DAIFMT_CBM_CFM);
-       if (ret < 0) {
-               printk(KERN_ERR "can't set cpu DAI configuration\n");
-               return ret;
-       }
-
        /* Set the codec system clock for DAC and ADC */
        ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
                                        SND_SOC_CLOCK_IN);
@@ -217,6 +175,8 @@ static struct snd_soc_dai_link zoom2_dai[] = {
                .codec_dai_name = "twl4030-hifi",
                .platform_name = "omap-pcm-audio",
                .codec_name = "twl4030-codec",
+               .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+                          SND_SOC_DAIFMT_CBM_CFM,
                .init = zoom2_twl4030_init,
                .ops = &zoom2_ops,
        },
@@ -227,6 +187,8 @@ static struct snd_soc_dai_link zoom2_dai[] = {
                .codec_dai_name = "twl4030-voice",
                .platform_name = "omap-pcm-audio",
                .codec_name = "twl4030-codec",
+               .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
+                          SND_SOC_DAIFMT_CBM_CFM,
                .init = zoom2_twl4030_voice_init,
                .ops = &zoom2_voice_ops,
        },