From: 陈金泉 Date: Tue, 1 Apr 2014 07:42:58 +0000 (+0800) Subject: Audio: delete format for spdif, update format for dai1 of rt3224 X-Git-Tag: firefly_0821_release~5674 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b8f4596efc87190830077b4f7ebdafb34f906cbd;p=firefly-linux-kernel-4.4.55.git Audio: delete format for spdif, update format for dai1 of rt3224 --- diff --git a/arch/arm/boot/dts/rk3188-tb.dts b/arch/arm/boot/dts/rk3188-tb.dts index 533ce5996f9d..60acca2cc54e 100755 --- a/arch/arm/boot/dts/rk3188-tb.dts +++ b/arch/arm/boot/dts/rk3188-tb.dts @@ -142,6 +142,12 @@ rockchip-hdmi-spdif { compatible = "rockchip-hdmi-spdif"; + dais { + dai0 { + audio-codec = <&codec_hdmi_spdif>; + i2s-controller = <&spdif>; + }; + }; }; vmac-phy { diff --git a/arch/arm/boot/dts/rk3288-tb.dts b/arch/arm/boot/dts/rk3288-tb.dts index d226a84b22b5..73668d710a81 100755 --- a/arch/arm/boot/dts/rk3288-tb.dts +++ b/arch/arm/boot/dts/rk3288-tb.dts @@ -109,14 +109,8 @@ dai0 { audio-codec = <&codec_hdmi_spdif>; i2s-controller = <&spdif>; - format = "spdif"; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - //bitclock-master; - //frame-master; }; - }; + }; }; rockchip-rt5631 { @@ -149,11 +143,11 @@ //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; diff --git a/sound/soc/rockchip/card_info.c b/sound/soc/rockchip/card_info.c index 8d0600d081ea..4d8771fb3cfa 100755 --- a/sound/soc/rockchip/card_info.c +++ b/sound/soc/rockchip/card_info.c @@ -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 */ diff --git a/sound/soc/rockchip/card_info.h b/sound/soc/rockchip/card_info.h index 0f2748112c01..f40c710c3d83 100755 --- a/sound/soc/rockchip/card_info.h +++ b/sound/soc/rockchip/card_info.h @@ -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 */ diff --git a/sound/soc/rockchip/rk_hdmi_i2s.c b/sound/soc/rockchip/rk_hdmi_i2s.c index 2eae0335501e..ae81712a1a7d 100644 --- a/sound/soc/rockchip/rk_hdmi_i2s.c +++ b/sound/soc/rockchip/rk_hdmi_i2s.c @@ -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) { diff --git a/sound/soc/rockchip/rk_hdmi_spdif.c b/sound/soc/rockchip/rk_hdmi_spdif.c index b8a0a98f509f..4875a4392b0f 100755 --- a/sound/soc/rockchip/rk_hdmi_spdif.c +++ b/sound/soc/rockchip/rk_hdmi_spdif.c @@ -37,9 +37,12 @@ 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;