Audio: delete format for spdif, update format for dai1 of rt3224
author陈金泉 <jear.chen@rock-chips.com>
Tue, 1 Apr 2014 07:42:58 +0000 (15:42 +0800)
committer陈金泉 <jear.chen@rock-chips.com>
Tue, 1 Apr 2014 07:42:58 +0000 (15:42 +0800)
arch/arm/boot/dts/rk3188-tb.dts
arch/arm/boot/dts/rk3288-tb.dts
sound/soc/rockchip/card_info.c
sound/soc/rockchip/card_info.h
sound/soc/rockchip/rk_hdmi_i2s.c
sound/soc/rockchip/rk_hdmi_spdif.c

index 533ce5996f9dbf742780261893f01a15e1569ece..60acca2cc54eafe16022af6d3607ca72e107f9b9 100755 (executable)
 
        rockchip-hdmi-spdif {
                compatible = "rockchip-hdmi-spdif";
+               dais {
+                       dai0 {
+                               audio-codec = <&codec_hdmi_spdif>;
+                               i2s-controller = <&spdif>;
+                       };
+               };
        };
 
        vmac-phy {
index d226a84b22b5e87fc5b280d9f1305ac5b7bd3ee6..73668d710a8182c35bfc7d8d45c12e7be3c0a617 100755 (executable)
                        dai0 {
                                audio-codec = <&codec_hdmi_spdif>;
                                i2s-controller = <&spdif>;
-                               format = "spdif";
-                               //continuous-clock;
-                               //bitclock-inversion;
-                               //frame-inversion;
-                               //bitclock-master;
-                               //frame-master;
                        };
-               };              
+               };
        };
 
        rockchip-rt5631 {
                                //frame-master;
                        };
                        dai1 {
-                               audio-codec = <&rt3261>;
-                               i2s-controller = <&i2s>;
-                               format = "i2s";
+                               audio-codec = <&codec_of_node>;
+                               i2s-controller = <&cpu_of_node>;
+                               format = "dsp_a";
                                //continuous-clock;
-                               //bitclock-inversion;
+                               bitclock-inversion;
                                //frame-inversion;
                                //bitclock-master;
                                //frame-master;
index 8d0600d081ead018e762c934aa1ce37c83113229..4d8771fb3cfaa191f1c1639984fda71dcf9949a8 100755 (executable)
@@ -58,7 +58,7 @@
                        };
                };
  */
-int rockchip_of_get_sound_card_info(struct snd_soc_card *card)
+int rockchip_of_get_sound_card_info_(struct snd_soc_card *card, bool is_need_fmt)
 {
        struct device_node *dai_node, *child_dai_node;
        int dai_num;
@@ -73,18 +73,20 @@ int rockchip_of_get_sound_card_info(struct snd_soc_card *card)
 
        for_each_child_of_node(dai_node, child_dai_node) {
 
-               card->dai_link[dai_num].dai_fmt = snd_soc_of_parse_daifmt(child_dai_node, NULL);
-               if ((card->dai_link[dai_num].dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == 0) {
-                       dev_err(card->dev,
-                               "Property 'format' missing or invalid\n");
-                       return -EINVAL;
+               if (is_need_fmt) {
+                       card->dai_link[dai_num].dai_fmt = snd_soc_of_parse_daifmt(child_dai_node, NULL);
+                       if ((card->dai_link[dai_num].dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == 0) {
+                               dev_err(card->dev,
+                                       "Property 'format' missing or invalid\n");
+                               return -EINVAL;
+                       }
                }
 
                card->dai_link[dai_num].codec_name = NULL;
                card->dai_link[dai_num].cpu_dai_name = NULL;
-               card->dai_link[dai_num].platform_name= NULL;
+               card->dai_link[dai_num].platform_name = NULL;
 
-               card->dai_link[dai_num].codec_of_node= of_parse_phandle(child_dai_node,
+               card->dai_link[dai_num].codec_of_node = of_parse_phandle(child_dai_node,
                        "audio-codec", 0);
                if (!card->dai_link[dai_num].codec_of_node) {
                        dev_err(card->dev,
@@ -92,7 +94,7 @@ int rockchip_of_get_sound_card_info(struct snd_soc_card *card)
                        return -EINVAL;
                }
 
-               card->dai_link[dai_num].cpu_of_node= of_parse_phandle(child_dai_node,
+               card->dai_link[dai_num].cpu_of_node = of_parse_phandle(child_dai_node,
                        "i2s-controller", 0);
                if (!card->dai_link[dai_num].cpu_of_node) {
                        dev_err(card->dev,
@@ -114,6 +116,12 @@ int rockchip_of_get_sound_card_info(struct snd_soc_card *card)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(rockchip_of_get_sound_card_info_);
+
+int rockchip_of_get_sound_card_info(struct snd_soc_card *card)
+{
+       return rockchip_of_get_sound_card_info_(card, true);
+}
 EXPORT_SYMBOL_GPL(rockchip_of_get_sound_card_info);
 
 /* Module information */
index 0f2748112c011d6ae7264e06eb038a50879f27b6..f40c710c3d83ea674b47e14ba2511615593ae006 100755 (executable)
@@ -9,6 +9,7 @@
 #ifndef _SND_SOC_ROCKCHIP_CARD_INFO_H
 #define _SND_SOC_ROCKCHIP_CARD_INFO_H
 
+int rockchip_of_get_sound_card_info_(struct snd_soc_card *card, bool is_need_fmt);
 int rockchip_of_get_sound_card_info(struct snd_soc_card *card);
 
 #endif /* _SND_SOC_ROCKCHIP_CARD_INFO_H */
index 2eae0335501e7ab377f0646b5cee2ee9c9b5f2cc..ae81712a1a7df356a2ca0a131ed5c9dc7bf8cf97 100644 (file)
@@ -29,19 +29,11 @@ static int hdmi_i2s_hifi_hw_params(struct snd_pcm_substream *substream,
 {
        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;
        unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
        int ret;
 
        DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
-#if 0
-       /* set codec DAI configuration */
-       ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
-       if (ret < 0) {
-               printk("%s():failed to set the format for codec side\n", __FUNCTION__);
-               return ret;
-       }
-#endif
+
        /* set cpu DAI configuration */
        ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
        if (ret < 0) {
index b8a0a98f509fc53d7e75d7e773e04eb723ed4fe6..4875a4392b0fc6ca4bb67714b9aef05c4c520d39 100755 (executable)
 static int set_audio_clock_rate(unsigned long pll_rate,
                                unsigned long audio_rate)
 {
-       struct clk *hclk_spdif, *sclk_spdif;
+       struct clk *sclk_spdif;
+#if defined (CONFIG_ARCH_RK30) || defined (CONFIG_ARCH_RK3188)
+       struct clk *hclk_spdif;
+#endif
 
-#if defined (CONFIG_ARCH_RK30) || (CONFIG_ARCH_RK3188) 
+#if defined (CONFIG_ARCH_RK30) || defined (CONFIG_ARCH_RK3188)
        hclk_spdif = clk_get(NULL, "hclk_spdif");
        if (IS_ERR(hclk_spdif)) {
                printk(KERN_ERR "spdif:failed to get hclk_spdif\n");
@@ -131,9 +134,7 @@ static struct snd_soc_ops rk_spdif_ops = {
 static struct snd_soc_dai_link rk_dai = {
        .name = "SPDIF",
        .stream_name = "SPDIF PCM Playback",
-       .cpu_dai_name = "rockchip-spdif",
        .codec_dai_name = "rk-hdmi-spdif-hifi",
-       .codec_name = "hdmi-spdif",
        .ops = &rk_spdif_ops,
 };
 
@@ -150,7 +151,7 @@ static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev)
 
        card->dev = &pdev->dev;
 
-       ret = rockchip_of_get_sound_card_info(card);
+       ret = rockchip_of_get_sound_card_info_(card, false);
        if (ret) {
                printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
                return ret;