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";
};
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;
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;
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;
&i2c0 {
status = "okay";
- rt5631@1a {
+ rt5631: rt5631@1a {
compatible = "rt5631";
reg = <0x1a>;
};
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>;
clocks = <&clk_spdif>;
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&pdma0 8>;
- #dma-cells = <1>;
dma-names = "tx";
pinctrl-names = "default";
pinctrl-0 = <&spdif_tx>;
interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
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>;
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) {
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;
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__);
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];
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*/
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;
}