rockchip-hdmi-spdif {
compatible = "rockchip-hdmi-spdif";
+ dais {
+ dai0 {
+ audio-codec = <&codec_hdmi_spdif>;
+ i2s-controller = <&spdif>;
+ };
+ };
};
vmac-phy {
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;
};
};
*/
-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;
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,
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,
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 */
#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 */
{
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) {
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");
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,
};
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;