From: 陈金泉 Date: Thu, 6 Mar 2014 02:48:47 +0000 (+0800) Subject: Audio: add codec-of-node and cpu-of-node, delete CODEC_NAME_CMP, codec-name, cpu... X-Git-Tag: firefly_0821_release~6192 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6ed71bab976d5973b18f6a5e7608231ae8f22e82;p=firefly-linux-kernel-4.4.55.git Audio: add codec-of-node and cpu-of-node, delete CODEC_NAME_CMP, codec-name, cpu-dai-name --- diff --git a/arch/arm/boot/dts/rk3188-tb.dts b/arch/arm/boot/dts/rk3188-tb.dts index a9fe3696676a..8155baaa6d6d 100755 --- a/arch/arm/boot/dts/rk3188-tb.dts +++ b/arch/arm/boot/dts/rk3188-tb.dts @@ -56,11 +56,11 @@ enable-gpios = <&gpio0 GPIO_A2 GPIO_ACTIVE_HIGH>; }; - codec-hdmi-i2s { + codec_hdmi_i2s: codec-hdmi-i2s { compatible = "hdmi-i2s"; }; - codec-hdmi-spdif { + codec_hdmi_spdif: codec-hdmi-spdif { compatible = "hdmi-spdif"; }; @@ -68,8 +68,8 @@ compatible = "rockchip-rt5631"; dais { dai0 { - codec-name = "rt5631.0-001a"; - cpu-dai-name = "rockchip-i2s.0"; + codec-of-node = <&rt5631>; + cpu-of-node = <&i2s0>; format = "i2s"; //continuous-clock; //bitclock-inversion; @@ -84,8 +84,8 @@ compatible = "rockchip-rk610"; dais { dai0 { - codec-name = "rk610_codec.0-0060"; - cpu-dai-name = "rockchip-i2s.0"; + codec-of-node = <&rk610_codec>; + cpu-of-node = <&i2s0>; format = "i2s"; //continuous-clock; //bitclock-inversion; @@ -100,8 +100,8 @@ compatible = "rockchip-hdmi-i2s"; dais { dai0 { - codec-name = "hdmi-i2s"; - cpu-dai-name = "rockchip-i2s.0"; + codec-of-node = <&codec_hdmi_i2s>; + cpu-of-node = <&i2s0>; format = "i2s"; //continuous-clock; //bitclock-inversion; @@ -136,7 +136,7 @@ &i2c0 { status = "okay"; - rt5631@1a { + rt5631: rt5631@1a { compatible = "rt5631"; reg = <0x1a>; }; @@ -149,7 +149,7 @@ clock-names = "i2s_clk"; }; - rk610codec@60 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80) + rk610_codec: rk610codec@60 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80) compatible = "rk610_codec"; reg = <0x60>; spk_ctl_io = <&gpio2 GPIO_D7 GPIO_ACTIVE_HIGH>; diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index b8284ced8f31..79da82eb7621 100755 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi @@ -459,7 +459,6 @@ clocks = <&clk_spdif>; interrupts = ; dmas = <&pdma0 8>; - #dma-cells = <1>; dma-names = "tx"; pinctrl-names = "default"; pinctrl-0 = <&spdif_tx>; @@ -474,7 +473,6 @@ interrupts = ; dmas = <&pdma0 6>, <&pdma0 7>; - #dma-cells = <2>; dma-names = "tx", "rx"; pinctrl-names = "default", "sleep"; pinctrl-0 = <&i2s0_mclk &i2s0_sclk &i2s0_lrckrx &i2s0_lrcktx &i2s0_sdi &i2s0_sdo>; diff --git a/sound/soc/rockchip/card_info.c b/sound/soc/rockchip/card_info.c index dd56afa6296b..d07c7f15eadb 100755 --- a/sound/soc/rockchip/card_info.c +++ b/sound/soc/rockchip/card_info.c @@ -55,7 +55,7 @@ int rockchip_of_get_sound_card_info(struct snd_soc_card *card) { struct device_node *dai_node, *child_dai_node; - int ret, dai_num; + int dai_num; dai_node = of_get_child_by_name(card->dev->of_node, "dais"); if (!dai_node) { @@ -70,20 +70,28 @@ int rockchip_of_get_sound_card_info(struct snd_soc_card *card) if (dai_num == 0) card->dai_link[dai_num].dai_fmt = snd_soc_of_parse_daifmt(child_dai_node, NULL); - ret = of_property_read_string(child_dai_node, "codec-name", &card->dai_link[dai_num].codec_name); - if (ret) { - dev_err(card->dev, "%s() Can not read property: codec-name for dai %d\n", __FUNCTION__, dai_num); - return ret; + + 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].codec_of_node= of_parse_phandle(child_dai_node, + "codec-of-node", 0); + if (!card->dai_link[dai_num].codec_of_node) { + dev_err(card->dev, + "Property 'codec-of-node' missing or invalid\n"); + return -EINVAL; } - ret = of_property_read_string(child_dai_node, "cpu-dai-name", &card->dai_link[dai_num].cpu_dai_name); - if (ret) { - dev_err(card->dev, "%s() Can not read property: cpu-dai-name for dai %d\n", __FUNCTION__, dai_num); - return ret; + card->dai_link[dai_num].cpu_of_node= of_parse_phandle(child_dai_node, + "cpu-of-node", 0); + if (!card->dai_link[dai_num].cpu_of_node) { + dev_err(card->dev, + "Property 'cpu-of-node' missing or invalid\n"); + return -EINVAL; } - //platform_name is same with cpu_dai_name. - card->dai_link[dai_num].platform_name= card->dai_link[dai_num].cpu_dai_name; + card->dai_link[dai_num].platform_of_node = card->dai_link[dai_num].cpu_of_node; if (++dai_num >= card->num_links) break; diff --git a/sound/soc/rockchip/rk_hdmi_i2s.c b/sound/soc/rockchip/rk_hdmi_i2s.c index c9bfc64f36cb..15d4f4683c4d 100644 --- a/sound/soc/rockchip/rk_hdmi_i2s.c +++ b/sound/soc/rockchip/rk_hdmi_i2s.c @@ -30,7 +30,6 @@ 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; unsigned int pll_out = 0; - int ret; DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4a63b19d2c78..d56bbea6e75e 100755 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -815,7 +815,6 @@ EXPORT_SYMBOL_GPL(snd_soc_resume); static const struct snd_soc_dai_ops null_dai_ops = { }; -#define CODEC_NAME_CMP static int soc_bind_dai_link(struct snd_soc_card *card, int num) { struct snd_soc_dai_link *dai_link = &card->dai_link[num]; @@ -825,14 +824,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) struct snd_soc_dai *codec_dai, *cpu_dai; const char *platform_name; -#ifdef CODEC_NAME_CMP - char *p_codec_name; - char *p_dai_codec_name; - char tmp_codec_name[50]; - char tmp_dai_codec_name[50]; - p_codec_name = tmp_codec_name; - p_dai_codec_name = tmp_dai_codec_name; -#endif dev_dbg(card->dev, "ASoC: binding %s at idx %d\n", dai_link->name, num); /* Find CPU DAI from registered DAIs*/ @@ -862,15 +853,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) if (codec->dev->of_node != dai_link->codec_of_node) continue; } else { - #ifdef CODEC_NAME_CMP - strcpy(p_codec_name,codec->name); - strcpy(p_dai_codec_name,dai_link->codec_name); - #endif - if (strcmp(codec->name, dai_link->codec_name) - #ifdef CODEC_NAME_CMP - && strcmp(strsep(&p_codec_name,"."), strsep(&p_dai_codec_name,".")) - #endif - ) + if (strcmp(codec->name, dai_link->codec_name)) continue; }