compatible = "rockchip-rt5631";
dais {
dai0 {
- codec-of-node = <&rt5631>;
- cpu-of-node = <&i2s0>;
+ audio-codec = <&rt5631>;
+ i2s-controller = <&i2s0>;
format = "i2s";
//continuous-clock;
//bitclock-inversion;
compatible = "rockchip-rk610";
dais {
dai0 {
- codec-of-node = <&rk610_codec>;
- cpu-of-node = <&i2s0>;
+ audio-codec = <&rk610_codec>;
+ i2s-controller = <&i2s0>;
format = "i2s";
//continuous-clock;
//bitclock-inversion;
compatible = "rockchip-hdmi-i2s";
dais {
dai0 {
- codec-of-node = <&codec_hdmi_i2s>;
- cpu-of-node = <&i2s0>;
+ audio-codec = <&codec_hdmi_i2s>;
+ i2s-controller = <&i2s0>;
format = "i2s";
//continuous-clock;
//bitclock-inversion;
#ifdef CONFIG_OF
/*
dts:
- codec@1c {
+ rt3261: rt3261@1c {
compatible = "rt3261";
reg = <0x1c>;
codec-en-gpio = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>;
/*
Get sound card infos:
- codec-name
- cpu-dai-name
+ audio-codec
+ i2s-controller
format
bitclock-master
frame-master
- Get codec-name and cpu-dai-name in this fun,
+ Get audio-codec and i2s-controller in this fun,
and get oher infos in fun snd_soc_of_parse_daifmt().
Set in dts:
dais {
dai0 {
- codec-name = "codec_name.i2c_bus-i2c_addr";
- cpu-dai-name = "cpu_dai_name";
+ audio-codec = <&codec_of_node>;
+ i2s-controller = <&cpu_of_node>;
format = "i2s";
//continuous-clock;
//bitclock-inversion;
};
dai1 {
- codec-name = "codec_name.i2c_bus-i2c_addr";
- cpu-dai-name = "cpu_dai_name";
+ audio-codec = <&codec_of_node>;
+ i2s-controller = <&cpu_of_node>;
+ format = "dsp_a";
+ //continuous-clock;
+ bitclock-inversion;
+ //frame-inversion;
+ //bitclock-master;
+ //frame-master;
};
};
*/
dai_num = 0;
for_each_child_of_node(dai_node, child_dai_node) {
- //We only need to set fmt to cpu for dai 0.
- if (dai_num == 0)
- card->dai_link[dai_num].dai_fmt = snd_soc_of_parse_daifmt(child_dai_node, NULL);
+ 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].codec_of_node= of_parse_phandle(child_dai_node,
- "codec-of-node", 0);
+ "audio-codec", 0);
if (!card->dai_link[dai_num].codec_of_node) {
dev_err(card->dev,
- "Property 'codec-of-node' missing or invalid\n");
+ "Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
card->dai_link[dai_num].cpu_of_node= of_parse_phandle(child_dai_node,
- "cpu-of-node", 0);
+ "i2s-controller", 0);
if (!card->dai_link[dai_num].cpu_of_node) {
dev_err(card->dev,
- "Property 'cpu-of-node' missing or invalid\n");
+ "Property 'i2s-controller' missing or invalid\n");
return -EINVAL;
}
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ unsigned int pll_out = 0, dai_fmt = rtd->card->dai_link->dai_fmt;
int div_bclk,div_mclk;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
+
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
pll_out = 256 * params_rate(params);
u32 tx_ctl,rx_ctl;
u32 iis_ckr_value;//clock generation register
unsigned long flags;
+ int ret = 0;
I2S_DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
break;
default:
I2S_DBG("unknwon master/slave format\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_;
}
writel(iis_ckr_value, &(pheadi2s->I2S_CKR));
break;
default:
I2S_DBG("Unknown data format\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_;
}
I2S_DBG("Enter::%s----%d, I2S_TXCR=0x%X\n",__FUNCTION__,__LINE__,tx_ctl);
rx_ctl = tx_ctl & 0x00007FFF;
writel(rx_ctl, &(pheadi2s->I2S_RXCR));
+out_:
+
spin_unlock_irqrestore(&lock, flags);
- return 0;
+
+ return ret;
}
static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
struct rk30_i2s_info *i2s;
u32 reg;
unsigned long flags;
+ int ret = 0;
i2s = to_info(cpu_dai);
case ROCKCHIP_DIV_PRESCALER:
break;
default:
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_;
}
writel(reg, &(pheadi2s->I2S_CKR));
+
+out_:
spin_unlock_irqrestore(&lock, flags);
- return 0;
+ return ret;
}
static struct snd_soc_dai_ops rockchip_i2s_dai_ops = {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- AIC_DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ AIC_DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int div_bclk,div_mclk;
int ret;
- printk("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
- int ret=-1;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
+ int ret;
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
unsigned int lrclk = 0;
int div_bclk,div_mclk;
struct clk *general_pll;
int ret;
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
+
switch(params_rate(params)) {
case 8000:
case 16000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->card->dai_link->dai_fmt;
//unsigned int pll_div;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
+
switch(params_rate(params)) {
case 8000:
case 16000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->card->dai_link->dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
+
switch(params_rate(params)) {
case 8000:
case 16000:
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ 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__);
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned long pll_out, rclk_rate;
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ unsigned long pll_out, rclk_rate, dai_fmt = rtd->dai_link->dai_fmt;
int ret, ratio;
RK_SPDIF_DBG("spdif:Entered %s\n", __func__);
+
+ /* 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", __func__);
+ return ret;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __func__);
+ return ret;
+ }
switch (params_rate(params)) {
case 44100:
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int div_bclk,div_mclk;
// struct clk *general_pll;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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", __func__);
+ return ret;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __func__);
+ return ret;
+ }
+
switch(params_rate(params)) {
case 8000:
case 16000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ unsigned int dai_fmt = rtd->dai_link->dai_fmt;
int ret;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
return 0;
}
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
- if (ret < 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
/* set codec DAI configuration */
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
/* set codec DAI configuration */
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS);
+ 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;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, div = 4;
+ unsigned int pll_out = 0, div = 4, dai_fmt = rtd->dai_link->dai_fmt;
+ int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 16000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
/* set codec DAI configuration */
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS);
+ ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
+ if (ret < 0) {
+ printk("rk_voice_hw_params:failed to set the format for codec side\n");
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
/*Set the system clk for codec*/
ret = snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, SND_SOC_CLOCK_IN);
-
if (ret < 0) {
printk("rk_voice_hw_params:failed to set the sysclk for codec side\n");
return ret;
}
ret = snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
+ if (ret < 0) {
+ printk("rk_voice_hw_params:failed to set the sysclk for cpu side\n");
+ return ret;
+ }
return 0;
}
.stream_name = "RK616 PCM",
.codec_dai_name = "rk616-voice",
.ops = &rk616_voice_ops,
- .no_pcm = 1,
+ //.no_pcm = 1,
},
};
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS );
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
switch(params_rate(params)) {
case 8000:
.stream_name = "RT3261 PCM2",
.codec_dai_name = "rt3261-aif2",
.ops = &rockchip_rt3261_voice_ops,
- .no_pcm = 1,
},
};
compatible = "rockchip-rt3261";
dais {
dai0 {
- codec-name = "rt3261.0-001c";
- cpu-dai-name = "rockchip-i2s.1";
+ audio-codec = <&rt3261>;
+ i2s-controller = <&i2s0>;
format = "i2s";
+ //continuous-clock;
+ //bitclock-inversion;
+ //frame-inversion;
+ //bitclock-master;
+ //frame-master;
};
dai1 {
- codec-name = "rt3261.0-001c";
- cpu-dai-name = "rockchip-i2s.1";
+ audio-codec = <&rt3261>;
+ i2s-controller = <&i2s0>;
+ format = "dsp_a";
+ //continuous-clock;
+ bitclock-inversion;
+ //frame-inversion;
+ //bitclock-master;
+ //frame-master;
};
};
};
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
- unsigned int pll_div;
- int ret;
+ unsigned int pll_div, dai_fmt = rtd->dai_link->dai_fmt;
+ int ret;
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
#include "rk_i2s.h"
#if 0
-:#define DBG(x...) printk(KERN_INFO x)
+#define DBG(x...) printk(KERN_INFO x)
#else
#define DBG(x...)
#endif
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
+ int ret;
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
- unsigned int lrclk = 0;
+ unsigned int pll_out = 0;
+ unsigned int lrclk = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;\r
struct snd_soc_dai *codec_dai = rtd->codec_dai;\r
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;\r
- unsigned int pll_out = 0;\r
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;\r
int ret;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); \r
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);\r
+\r
+ /* set codec DAI configuration */
+ ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);\r
+ if (ret < 0) {
+ printk("%s():failed to set the format for codec side\n", __FUNCTION__);\r
+ return ret;
+ }\r
+\r
+ /* set cpu DAI configuration */\r
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);\r
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);\r
+ return ret;
+ } \r
\r
switch(params_rate(params)) {\r
case 8000:\r
struct snd_soc_pcm_runtime *rtd = substream->private_data;\r
struct snd_soc_dai *codec_dai = rtd->codec_dai;\r
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;\r
- unsigned int pll_out = 0;\r
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;\r
int ret;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); \r
- \r
- /* set codec DAI configuration */\r
- //#if defined (CONFIG_SND_CODEC_SOC_SLAVE) \r
- DBG("Enter::%s----codec slave\n",__FUNCTION__);\r
-\r
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |\r
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS);\r
- /*#endif\r
- //#if defined (CONFIG_SND_CODEC_SOC_MASTER) \r
- DBG("Enter::%s----codec master\n",__FUNCTION__);\r
-\r
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |\r
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBM_CFM ); \r
- #endif*/\r
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);\r
+\r
+ /* set codec DAI configuration */
+ ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);\r
+ if (ret < 0) {
+ printk("%s():failed to set the format for codec side\n", __FUNCTION__);\r
+ return ret;
+ }\r
\r
switch(params_rate(params)) {\r
case 8000:\r
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
- int ret;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
+ int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
//change to 8Khz
params->intervals[SNDRV_PCM_HW_PARAM_RATE - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL].min = 8000;
/* set codec DAI configuration */
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
+ 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;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;\r
struct snd_soc_dai *codec_dai = rtd->codec_dai;\r
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;\r
- unsigned int pll_out = 0;\r
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;\r
int ret;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); \r
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);\r
+\r
+ /* set codec DAI configuration */
+ ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);\r
+ if (ret < 0) {
+ printk("%s():failed to set the format for codec side\n", __FUNCTION__);\r
+ return ret;
+ }\r
+\r
+ /* set cpu DAI configuration */\r
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);\r
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);\r
+ return ret;
+ }\r
\r
switch(params_rate(params)) {\r
case 8000:\r
struct snd_soc_pcm_runtime *rtd = substream->private_data;\r
struct snd_soc_dai *codec_dai = rtd->codec_dai;\r
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;\r
- unsigned int pll_out = 0;\r
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;\r
int ret;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); \r
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);\r
\r
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |\r
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS);\r
+ /* set codec DAI configuration */
+ ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);\r
+ if (ret < 0) {
+ printk("%s():failed to set the format for codec side\n", __FUNCTION__);\r
+ return ret;
+ }\r
\r
switch(params_rate(params)) {\r
case 8000:\r
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |
- SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS );
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
switch(params_rate(params)) {
case 8000:
static int rk29_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
- int div_bclk,div_mclk;
- int ret;
- struct clk *general_pll;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
+ int div_bclk,div_mclk;
+ int ret;
+ struct clk *general_pll;
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
static int rk29_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ unsigned int dai_fmt = rtd->dai_link->dai_fmt;
+ int ret;
+
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
+
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
+
return 0;
}
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int pll_out = 0;
+ unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
int div_bclk,div_mclk;
int ret;
struct clk *general_pll;
+ DBG("Enter::%s----%d\n", __FUNCTION__, __LINE__);
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ /* 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;
+ }
+
+ /* set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+ if (ret < 0) {
+ printk("%s():failed to set the format for cpu side\n", __FUNCTION__);
+ return ret;
+ }
switch(params_rate(params)) {
case 8000:
struct snd_soc_codec *codec;
struct snd_soc_codec_conf *codec_conf;
enum snd_soc_compress_type compress_type;
+#ifndef CONFIG_SND_RK_SOC
struct snd_soc_dai_link *dai_link;
- int ret, i, order, dai_fmt;
+ int dai_fmt;
+#endif
+ int ret, i, order;
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
snd_soc_dapm_new_widgets(&card->dapm);
+//dai_fmt will and need to be setted in hw_parsms for codecs, so ingore here.
+#ifndef CONFIG_SND_RK_SOC
for (i = 0; i < card->num_links; i++) {
dai_link = &card->dai_link[i];
dai_fmt = dai_link->dai_fmt;
ret);
}
}
+#endif //CONFIG_SND_RK_SOC
snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname),
"%s", card->name);