Audio: add dts property(i2s format) and delete them from menuconfig, add sound card info parsing, fix i2s lock error.

This commit is contained in:
陈金泉
2014-02-19 16:00:17 +08:00
parent 6edcb1a604
commit 3b1938fb71
33 changed files with 508 additions and 766 deletions

View File

@@ -36,10 +36,34 @@
rockchip-rt5631 {
compatible = "rockchip-rt5631";
dais {
dai0 {
codec-name = "rt5631.0-001a";
cpu-dai-name = "rockchip-i2s.1";
format = "i2s";
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
//bitclock-master;
//frame-master;
};
};
};
rockchip-hdmi-i2s {
compatible = "rockchip-hdmi-i2s";
dais {
dai0 {
codec-name = "hdmi-i2s";
cpu-dai-name = "rockchip-i2s.1";
format = "i2s";
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
//bitclock-master;
//frame-master;
};
};
};
rockchip-hdmi-spdif {

View File

@@ -601,6 +601,7 @@ static int rk610_codec_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec *codec = rtd->codec;
struct rk610_codec_priv *rk610_codec =snd_soc_codec_get_drvdata(codec);
unsigned int dai_fmt = snd_soc_pcm_runtime->card->dai_link[0].dai_fmt
u16 iface = rk610_codec_read_reg_cache(codec, ACCELCODEC_R09) & 0x1f3;
u16 srate = rk610_codec_read_reg_cache(codec, ACCELCODEC_R00) & 0x180;
@@ -631,9 +632,9 @@ static int rk610_codec_pcm_hw_params(struct snd_pcm_substream *substream,
rk610_codec_write(codec,ACCELCODEC_R0B, ASC_DEC_DISABLE|ASC_INT_DISABLE); //0x00
/* set iface & srate */
#ifdef CONFIG_SND_RK_CODEC_SOC_MASTER
iface |= ASC_INVERT_BCLK;//<2F><>תBCLK master״̬<D7B4>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD>ʱ<EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
iface |= ASC_INVERT_BCLK;//<2F><>תBCLK master״̬<D7B4>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD>ʱ<EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
rk610_codec_write(codec, ACCELCODEC_R09, iface);
if (coeff >= 0){
// rk610_codec_write(codec, ACCELCODEC_R00, srate|coeff_div[coeff].bclk);

View File

@@ -13,62 +13,7 @@ config SND_RK_SOC_I2S
config SND_RK_SOC_SPDIF
tristate
config SND_RK_SOC_I2S_8CH
bool "Soc RK I2S 8 Channel support(I2S0)"
default y
depends on SND_RK_SOC_I2S && !ARCH_RK3066B && !ARCH_RK3188 && !ARCH_RK319X
help
This supports the use of the 8 Channel I2S interface on rk processors.
if SND_RK_SOC_I2S_8CH
choice
bool "Set I2S0 using the number of channels"
default SND_I2SO_USE_DOUBLE_CHANNELS
config SND_I2SO_USE_EIGHT_CHANNELS
tristate "I2S0 use 8 channels"
config SND_I2SO_USE_DOUBLE_CHANNELS
tristate "I2S0 use 2 channels"
endchoice
endif
config SND_RK_SOC_I2S_2CH
bool "Soc RK I2S 2 Channel support(I2S1)"
depends on SND_RK_SOC_I2S && !ARCH_RK2928 && !ARCH_RK3026
default y if (ARCH_RK3066B || ARCH_RK3188)
help
This supports the use of the 2 Channel I2S interface on rk processors.
choice
bool "Set I2S GRF Output Voltage"
depends on (ARCH_RK3066B || ARCH_RK3188) && SND_RK_SOC_I2S_2CH
default SND_I2S_USE_33V
config SND_I2S_USE_33V
bool "I2S use 3.3V"
config SND_I2S_USE_18V
bool "I2S use 1.8V"
endchoice
config SND_RK_SOC_I2S2_2CH
bool "Soc RK I2S 2 Channel support(I2S2)"
default n
depends on SND_RK_SOC_I2S && ARCH_RK30 && !ARCH_RK2928 && !ARCH_RK3066B && !ARCH_RK3026
help
This supports the use of the 2 Channel I2S2 interface on rk30 processors.
if SND_RK_SOC_I2S_2CH || SND_RK_SOC_I2S_8CH || SND_RK_SOC_I2S2_2CH
choice
bool "Set i2s on DMA event mode"
default SND_I2S_DMA_EVENT_STATIC
config SND_I2S_DMA_EVENT_DYNAMIC
tristate "dynamic mode"
config SND_I2S_DMA_EVENT_STATIC
tristate "static mode"
endchoice
endif
if SND_RK_SOC
if SND_RK_SOC && RK_HDMI
choice
@@ -86,7 +31,7 @@ choice
select SND_SOC_HDMI_SPDIF
tristate "HDMI use SPDIF"
endchoice
endif
endif #SND_RK_SOC && RK_HDMI
config SND_RK_SOC_AK4396
tristate "SoC I2S Audio support for rockchip - AK4396"
@@ -343,28 +288,4 @@ config SND_RK_SOC_RK3190
Say Y if you want to add support for SoC audio on rockchip
with the RK3190 internal codec.
if SND_RK_SOC_I2S_2CH || SND_RK_SOC_I2S_8CH || SND_RK_SOC_I2S2_2CH
choice
bool "Set i2s type"
default SND_RK_CODEC_SOC_SLAVE
config SND_RK_CODEC_SOC_MASTER
tristate "Codec run in Master"
config SND_RK_CODEC_SOC_SLAVE
tristate "Codec run in Slave"
endchoice
config ADJUST_VOL_BY_CODEC
bool "Adjust volume by codec"
default n
help
adjust volume by codec
config PHONE_INCALL_IS_SUSPEND
bool "Incalling Whether suspend codec"
default n
help
set "y" phone incall status cannot into suspend codec
endif
endif #SND_RK_SOC

View File

@@ -1,5 +1,5 @@
# ROCKCHIP Platform Support
snd-soc-rockchip-objs := rk_pcm.o
snd-soc-rockchip-objs := rk_pcm.o card_info.o
ifdef CONFIG_ARCH_RK29
snd-soc-rockchip-i2s-objs := rk29_i2s.o
else

105
sound/soc/rockchip/card_info.c Executable file
View File

@@ -0,0 +1,105 @@
/*
* card_info.c
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*/
#include <linux/module.h>
#include <linux/device.h>
#include <linux/of.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
/*
Get sound card infos:
codec-name
cpu-dai-name
format
continuous-clock
bitclock-inversion
frame-inversion
bitclock-master
frame-master
Get codec-name and cpu-dai-name 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";
format = "i2s";
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
//bitclock-master;
//frame-master;
};
dai1 {
codec-name = "codec_name.i2c_bus-i2c_addr";
cpu-dai-name = "cpu_dai_name";
};
};
*/
int rockchip_of_get_sound_card_info(struct snd_soc_card *card)
{
struct device_node *dai_node, *child_dai_node;
int ret, dai_num;
dai_node = of_get_child_by_name(card->dev->of_node, "dais");
if (!dai_node) {
dev_err(card->dev, "%s() Can not get child: dais\n", __FUNCTION__);
return -EINVAL;
}
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);
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;
}
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;
}
//platform_name is same with cpu_dai_name.
card->dai_link[dai_num].platform_name= card->dai_link[dai_num].cpu_dai_name;
if (++dai_num >= card->num_links)
break;
}
if (dai_num < card->num_links) {
dev_err(card->dev, "%s() Can not get enough property for dais, dai: %d, max dai num: %d\n",
__FUNCTION__, dai_num, card->num_links);
return -EINVAL;
}
return 0;
}
EXPORT_SYMBOL_GPL(rockchip_of_get_sound_card_info);
/* Module information */
MODULE_AUTHOR("Jear <Jear.Chen@rock-chips.com>");
MODULE_DESCRIPTION("ROCKCHIP ASoC Interface");
MODULE_LICENSE("GPL");

14
sound/soc/rockchip/card_info.h Executable file
View File

@@ -0,0 +1,14 @@
/*
* card_info.h - ALSA PCM interface for the Rockchip rk28 SoC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#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);
#endif /* _SND_SOC_ROCKCHIP_CARD_INFO_H */

View File

@@ -23,6 +23,7 @@
#include <sound/pcm.h>
#include <sound/soc.h>
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -38,7 +39,7 @@ static int rk2928_dai_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;
unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
int div_bclk,div_mclk;
int ret;
@@ -46,19 +47,16 @@ static int rk2928_dai_hw_params(struct snd_pcm_substream *substream,
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
pll_out = 256 * params_rate(params);
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
div_bclk = 63;
div_mclk = pll_out/(params_rate(params)*64) - 1;
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
#endif
}
return 0;
}
@@ -71,17 +69,8 @@ static struct snd_soc_dai_link rk2928_dai[] = {
{
.name = "RK2928",
.stream_name = "RK2928",
.cpu_dai_name = "rockchip-i2s.0",
.codec_name = "rk2928-codec",
.codec_dai_name = "rk2928-codec",
.ops = &rk2928_dai_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
};

View File

@@ -51,6 +51,8 @@
#define MAX_I2S 3
static DEFINE_SPINLOCK(lock);
struct rk30_i2s_info {
void __iomem *regs;
@@ -61,12 +63,12 @@ struct rk30_i2s_info {
bool i2s_tx_status;//active = true;
bool i2s_rx_status;
spinlock_t spinlock_wr;//write read reg spin_lock
};
#if defined (CONFIG_RK_HDMI) && defined (CONFIG_SND_RK_SOC_HDMI_I2S)
extern int hdmi_get_hotplug(void);
#else
#define hdmi_get_hotplug() 0
#endif
static inline struct rk30_i2s_info *to_info(struct snd_soc_dai *dai)
@@ -80,8 +82,10 @@ static inline struct rk30_i2s_info *to_info(struct snd_soc_dai *dai)
static void rockchip_snd_txctrl(struct rk30_i2s_info *i2s, int on)
{
u32 opr, xfer, clr;
unsigned long flags;
int is_need_delay = false;
spin_lock(&i2s->spinlock_wr);
spin_lock_irqsave(&lock, flags);
opr = readl(&(pheadi2s->I2S_DMACR));
xfer = readl(&(pheadi2s->I2S_XFER));
@@ -102,36 +106,40 @@ static void rockchip_snd_txctrl(struct rk30_i2s_info *i2s, int on)
}
i2s->i2s_tx_status = 1;
spin_unlock(&i2s->spinlock_wr);
} else { //stop tx
i2s->i2s_tx_status = 0;
opr &= ~I2S_TRAN_DMA_ENABLE;
writel(opr, &(pheadi2s->I2S_DMACR));
if (i2s->i2s_rx_status == 0//sync stop i2s rx tx lcrk
#if defined (CONFIG_RK_HDMI) && defined (CONFIG_SND_RK_SOC_HDMI_I2S)
&& hdmi_get_hotplug() == 0 //HDMI_HPD_REMOVED
#endif
) {
if (i2s->i2s_rx_status == 0 && hdmi_get_hotplug() == 0) {
xfer &= ~I2S_TX_TRAN_START;
xfer &= ~I2S_RX_TRAN_START;
writel(xfer, &(pheadi2s->I2S_XFER));
clr |= I2S_TX_CLEAR;
clr |= I2S_RX_CLEAR;
writel(clr, &(pheadi2s->I2S_CLR));
spin_unlock(&i2s->spinlock_wr);
udelay(1);
is_need_delay = true;
I2S_DBG("rockchip_snd_txctrl: stop xfer\n");
} else
spin_unlock(&i2s->spinlock_wr);
}
}
spin_unlock_irqrestore(&lock, flags);
if (is_need_delay)
udelay(1);
}
static void rockchip_snd_rxctrl(struct rk30_i2s_info *i2s, int on)
{
u32 opr, xfer, clr;
unsigned long flags;
int is_need_delay = false;
spin_lock(&i2s->spinlock_wr);
spin_lock_irqsave(&lock, flags);
opr = readl(&(pheadi2s->I2S_DMACR));
xfer = readl(&(pheadi2s->I2S_XFER));
@@ -152,30 +160,31 @@ static void rockchip_snd_rxctrl(struct rk30_i2s_info *i2s, int on)
}
i2s->i2s_rx_status = 1;
spin_unlock(&i2s->spinlock_wr);
} else {
i2s->i2s_rx_status = 0;
opr &= ~I2S_RECE_DMA_ENABLE;
writel(opr, &(pheadi2s->I2S_DMACR));
if (i2s->i2s_tx_status == 0//sync stop i2s rx tx lcrk
#if defined (CONFIG_RK_HDMI) && defined (CONFIG_SND_RK_SOC_HDMI_I2S)
&& hdmi_get_hotplug() == 0 //HDMI_HPD_REMOVED
#endif
) {
if (i2s->i2s_tx_status == 0 && hdmi_get_hotplug() == 0) {
xfer &= ~I2S_RX_TRAN_START;
xfer &= ~I2S_TX_TRAN_START;
writel(xfer, &(pheadi2s->I2S_XFER));
clr |= I2S_RX_CLEAR;
clr |= I2S_TX_CLEAR;
writel(clr, &(pheadi2s->I2S_CLR));
spin_unlock(&i2s->spinlock_wr);
udelay(1);
is_need_delay = true;
I2S_DBG("rockchip_snd_rxctrl: stop xfer\n");
} else
spin_unlock(&i2s->spinlock_wr);
}
}
spin_unlock_irqrestore(&lock, flags);
if (is_need_delay)
udelay(1);
}
/*
@@ -187,20 +196,23 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
struct rk30_i2s_info *i2s = to_info(cpu_dai);
u32 tx_ctl,rx_ctl;
u32 iis_ckr_value;//clock generation register
unsigned long flags;
I2S_DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
spin_lock(&i2s->spinlock_wr);
spin_lock_irqsave(&lock, flags);
tx_ctl = readl(&(pheadi2s->I2S_TXCR));
iis_ckr_value = readl(&(pheadi2s->I2S_CKR));
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM:
//Codec is master, so set cpu slave.
iis_ckr_value &= ~I2S_MODE_MASK;
iis_ckr_value |= I2S_SLAVE_MODE;
break;
case SND_SOC_DAIFMT_CBS_CFS:
//Codec is slave, so set cpu master.
iis_ckr_value &= ~I2S_MODE_MASK;
iis_ckr_value |= I2S_MASTER_MODE;
break;
@@ -236,7 +248,7 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
rx_ctl = tx_ctl & 0x00007FFF;
writel(rx_ctl, &(pheadi2s->I2S_RXCR));
spin_unlock(&i2s->spinlock_wr);
spin_unlock_irqrestore(&lock, flags);
return 0;
}
@@ -246,8 +258,8 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
struct rk30_i2s_info *i2s = to_info(dai);
u32 iismod;
u32 dmarc;
u32 iis_ckr_value;//clock generation register
unsigned long flags;
I2S_DBG("Enter %s, %d \n", __func__, __LINE__);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -255,7 +267,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
else
dai->capture_dma_data = &i2s->capture_dma_data;
spin_lock(&i2s->spinlock_wr);
spin_lock_irqsave(&lock, flags);
/* Working copies of register */
iismod = readl(&(pheadi2s->I2S_TXCR));
@@ -279,15 +291,6 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
break;
}
iis_ckr_value = readl(&(pheadi2s->I2S_CKR));
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
iis_ckr_value &= ~I2S_SLAVE_MODE;
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
iis_ckr_value |= I2S_SLAVE_MODE;
#endif
writel(iis_ckr_value, &(pheadi2s->I2S_CKR));
dmarc = readl(&(pheadi2s->I2S_DMACR));
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -304,7 +307,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
iismod = iismod & 0x00007FFF;
writel(iismod, &(pheadi2s->I2S_RXCR));
spin_unlock(&i2s->spinlock_wr);
spin_unlock_irqrestore(&lock, flags);
return 0;
}
@@ -364,10 +367,11 @@ static int rockchip_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
{
struct rk30_i2s_info *i2s;
u32 reg;
unsigned long flags;
i2s = to_info(cpu_dai);
spin_lock(&i2s->spinlock_wr);
spin_lock_irqsave(&lock, flags);
//stereo mode MCLK/SCK=4
reg = readl(&(pheadi2s->I2S_CKR));
@@ -392,7 +396,7 @@ static int rockchip_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
return -EINVAL;
}
writel(reg, &(pheadi2s->I2S_CKR));
spin_unlock(&i2s->spinlock_wr);
spin_unlock_irqrestore(&lock, flags);
return 0;
}
@@ -501,8 +505,6 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
goto err;
}
spin_lock_init(&i2s->spinlock_wr);
i2s->i2s_clk= clk_get(&pdev->dev, NULL);
if (IS_ERR(i2s->i2s_clk)) {
dev_err(&pdev->dev, "Can't retrieve i2s clock\n");
@@ -537,12 +539,12 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
regs_base = mem->start;
i2s->playback_dma_data.addr = regs_base + I2S_TXR_BUFF;
i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
i2s->playback_dma_data.maxburst = 4;
i2s->playback_dma_data.addr_width = 4;
i2s->playback_dma_data.maxburst = 1;
i2s->capture_dma_data.addr = regs_base + I2S_RXR_BUFF;
i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
i2s->capture_dma_data.maxburst = 4;
i2s->capture_dma_data.addr_width = 4;
i2s->capture_dma_data.maxburst = 1;
i2s->i2s_tx_status = false;
i2s->i2s_rx_status = false;

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/tlv320aic3111.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -122,18 +123,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "AIC3111",
.stream_name = "AIC3111 PCM",
.codec_name = "AIC3111.0-0018",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "AIC3111 HiFi",
.init = rk29_aic3111_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_aic3111_snd_card = {
@@ -149,8 +141,13 @@ static int rockchip_aic3111_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -36,6 +36,7 @@
#include <linux/device.h>
#include "../codecs/wm8994.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#include <linux/clk.h>
@@ -414,37 +415,14 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "AIC3262 I2S1",
.stream_name = "AIC3262 PCM",
.codec_name = "tlv320aic3262-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "aic326x-asi1",
.ops = &rk29_aif1_ops,
.init = rk29_aic3262_init,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "AIC3262 I2S2",
.stream_name = "AIC3262 PCM",
.codec_name = "tlv320aic3262-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "aic326x-asi2",
.ops = &rk29_aif2_ops,
},
@@ -453,14 +431,6 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "AIC3262 I2S3",
.stream_name = "AIC3262 PCM",
.codec_name = "tlv320aic3262-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "aic326x-asi3",
.ops = &rk29_aif3_ops,
},
@@ -481,8 +451,13 @@ static int rockchip_aic3262_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -20,6 +20,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -35,7 +36,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
int ret=-1;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -68,7 +69,8 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
return 0;
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (2 * 32 )-1); //bclk = 2 * 32 * lrck
@@ -86,7 +88,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
break;
}
snd_soc_dai_set_sysclk(codec_dai,0,pll_out,SND_SOC_CLOCK_IN);
#endif
return ret;
}
@@ -107,24 +109,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "AK4396",
.stream_name = "AK4396 PCM",
.codec_name = "spi1.0",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "AK4396 HiFi",
.init = rk29_ak4396_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_ak4396_snd_card = {
@@ -140,8 +127,13 @@ static int rockchip_ak4396_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -22,6 +22,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/cs42l52.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -51,7 +52,7 @@ static int rk29_cs42l52_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
unsigned int lrclk = 0;
int div_bclk,div_mclk;
struct clk *general_pll;
@@ -75,7 +76,7 @@ static int rk29_cs42l52_hw_params(struct snd_pcm_substream *substream,
break;
}
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
general_pll=clk_get(NULL, "general_pll");
if(clk_get_rate(general_pll)>260000000)
{
@@ -99,7 +100,7 @@ static int rk29_cs42l52_hw_params(struct snd_pcm_substream *substream,
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
#endif
}
return 0;
@@ -129,24 +130,9 @@ static struct snd_soc_ops rk29_cs42l52_ops = {
static struct snd_soc_dai_link rk29_cs42l52_dai_link = {
.name = "CS42L52",
.stream_name = "CS42L52 PCM",
.codec_name = "cs42l52.0-004a",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "cs42l52-hifi",
.init = rk29_cs42l52_dai_init,
.ops = &rk29_cs42l52_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_cs42l52_snd_card = {
@@ -162,8 +148,13 @@ static int rockchip_cs42l52_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -16,6 +16,7 @@
#include <sound/soc-dapm.h>
#include <sound/jack.h>
#include <linux/delay.h>
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#if 1
@@ -35,7 +36,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
//unsigned int pll_div;
int ret;
@@ -67,7 +68,8 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
break;
}
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
goto skip__;
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, 64-1);//bclk = 2*32*lrck; 2*32fs
switch(params_rate(params)) {
@@ -91,51 +93,10 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
DBG("rk29_hw_params_cx2070x:failed to set the sysclk for codec side\n");
return ret;
}
#endif
skip__:
#if 0
switch (params_rate(params))
{
case 8000:
pll_div = 12;
break;
case 16000:
pll_div = 6;
break;
case 32000:
pll_div = 3;
break;
case 48000:
pll_div = 2;
break;
case 96000:
pll_div = 1;
break;
case 11025:
pll_div = 8;
break;
case 22050:
pll_div = 4;
break;
case 44100:
pll_div = 2;
break;
case 88200:
pll_div = 1;
break;
default:
printk("Not yet supported!\n");
return -EINVAL;
}
ret = snd_soc_dai_set_clkdiv(codec_dai, cx2070x_CLK_DIV_ID, pll_div*4);
if (ret < 0)
return ret;
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
//snd_soc_dai_set_pll(codec_dai,0,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
return 0;
}
@@ -200,18 +161,9 @@ static struct snd_soc_dai_link rk29_dai[] = {
{ /* Primary DAI i/f */
.name = "CX2070X AIF1",
.stream_name = "CX2070X PCM",
.cpu_dai_name = "rockchip-i2s.1",
.codec_dai_name = "cx2070x-hifi",
.codec_name = "cx2070x.0-0014",
.init = cx2070x_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
};
@@ -231,8 +183,13 @@ static int rockchip_cx2070x_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/es8323.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -43,7 +44,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -68,11 +69,11 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
}
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
}
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
return 0;
@@ -135,24 +136,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "ES8323",
.stream_name = "ES8323 PCM",
.codec_name = "ES8323.0-0010", // ES8323.0-0010
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1", //Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD>ǽӵ<C7BD>IIS0<53>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xxԭ<78><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6><EFBFBD>ΪIIS1<53><31>
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "ES8323 HiFi",
.init = rk29_es8323_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_es8323_snd_card = {
@@ -168,8 +154,13 @@ static int rockchip_es8323_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -14,6 +14,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -72,21 +73,8 @@ static struct snd_soc_ops hdmi_i2s_hifi_ops = {
static struct snd_soc_dai_link hdmi_i2s_dai = {
.name = "HDMI I2S",
.stream_name = "HDMI PCM",
.codec_name = "hdmi-i2s",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk-hdmi-i2s-hifi",
.ops = &hdmi_i2s_hifi_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_hdmi_i2s_snd_card = {
@@ -102,8 +90,13 @@ static int rockchip_hdmi_i2s_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -20,6 +20,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "../codecs/rk610_codec.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#ifdef CONFIG_MACH_RK_FAC
@@ -40,7 +41,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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;
unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
int div_bclk,div_mclk;
// struct clk *general_pll;
@@ -75,10 +76,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, SND_SOC_CLOCK_IN);
// #if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
// snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
// #endif
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
div_bclk = 63;
div_mclk = pll_out/(params_rate(params)*64) - 1;
@@ -88,7 +86,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
// DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
#endif
}
return 0;
}
@@ -99,27 +97,8 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "RK610_CODEC",
.stream_name = "RK610 CODEC PCM",
#if defined(CONFIG_MACH_RK3168_DS1006H)|| defined(CONFIG_MACH_RK3168_LR097)
.codec_name = "RK610_CODEC.4-0060",
#else
.codec_name = "RK610_CODEC.0-0060",
#endif
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rk610_codec",
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_rk610_snd_card = {
.name = "RK_RK610",
@@ -134,8 +113,13 @@ static int rockchip_rk610_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -34,17 +34,9 @@ static const struct snd_pcm_hardware rockchip_pcm_hardware = {
SNDRV_PCM_FMTBIT_S16_LE,
.channels_min = 2,
.channels_max = 8,
#ifdef CONFIG_RK_SRAM_DMA
.buffer_bytes_max = 24*1024,//period_bytes_max * periods_max
#else
.buffer_bytes_max = 128*1024,
#endif
.period_bytes_min = 64, ///PAGE_SIZE,
#ifdef CONFIG_RK_SRAM_DMA
.period_bytes_max = 8*1024,
#else
.period_bytes_max = 2048*4,///PAGE_SIZE*2,
#endif
.periods_min = 3,///2,
.periods_max = 128,
.fifo_size = 16,

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rk1000_codec.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -59,22 +60,9 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "RK1000",
.stream_name = "RK1000 CODEC PCM",
.codec_name = "RK1000_CODEC.0-0060",
.codec_dai_name = "rk1000_codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.init = rk29_rk1000_codec_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
}
};
@@ -91,8 +79,13 @@ static int rockchip_rk1000_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rk3026_codec.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -197,32 +198,13 @@ static struct snd_soc_dai_link rk_dai[] = {
{
.name = "RK3026 I2S1",
.stream_name = "RK3026 PCM",
.codec_name = "rk3026-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk3026-hifi",
.init = rk3026_init,
.ops = &rk3026_hifi_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RK3026 I2S2",
.stream_name = "RK3026 PCM",
.codec_name = "rk3026-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk3026-voice",
.ops = &rk3026_voice_ops,
},
@@ -241,8 +223,13 @@ static int rockchip_rk3026_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -20,6 +20,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "../codecs/rk3190_codec.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -193,32 +194,13 @@ static struct snd_soc_dai_link rk_dai[] = {
{
.name = "RK3190 I2S1",
.stream_name = "RK3190 PCM",
.codec_name = "rk3190-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk3190-hifi",
.init = rk3190_init,
.ops = &rk3190_hifi_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RK3190 I2S2",
.stream_name = "RK3190 PCM",
.codec_name = "rk3190-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk3190-voice",
.ops = &rk3190_voice_ops,
},
@@ -237,8 +219,13 @@ static int rockchip_rk3190_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rk616_codec.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -101,7 +102,6 @@ static int rk_hifi_hw_params(struct snd_pcm_substream *substream,
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;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -224,35 +224,16 @@ static struct snd_soc_dai_link rk_dai[] = {
{
.name = "RK616 I2S1",
.stream_name = "RK616 PCM",
.codec_name = "rk616-codec.4-0050",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk616-hifi",
.init = rk616_init,
.ops = &rk616_hifi_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RK616 I2S2",
.stream_name = "RK616 PCM",
.codec_name = "rk616-codec.4-0050",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk616-voice",
.ops = &rk616_voice_ops,
.no_pcm = 1;
.no_pcm = 1,
},
};
@@ -269,8 +250,13 @@ static int rockchip_rk616_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -22,6 +22,7 @@
#include <linux/of_gpio.h>
#include "../codecs/rt3261.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -220,36 +221,17 @@ static struct snd_soc_ops rockchip_rt3261_voice_ops = {
static struct snd_soc_dai_link rockchip_rt3261_dai[] = {
{
.name = "RT3261 I2S1",
.stream_name = "RT3261 PCM",
.codec_name = "rt3261.0-001c",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.stream_name = "RT3261 PCM1",
.codec_dai_name = "rt3261-aif1",
.init = rockchip_rt3261_init,
.ops = &rockchip_rt3261_hifi_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RT3261 I2S2",
.stream_name = "RT3261 PCM",
.codec_name = "rt3261.0-001c",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.stream_name = "RT3261 PCM2",
.codec_dai_name = "rt3261-aif2",
.ops = &rockchip_rt3261_voice_ops,
.no_pcm = 1;
.no_pcm = 1,
},
};
@@ -264,6 +246,24 @@ static struct snd_soc_card rockchip_rt3261_snd_card = {
.num_links = ARRAY_SIZE(rockchip_rt3261_dai),
};
/*
dts:
rockchip-rt3261 {
compatible = "rockchip-rt3261";
dais {
dai0 {
codec-name = "rt3261.0-001c";
cpu-dai-name = "rockchip-i2s.1";
format = "i2s";
};
dai1 {
codec-name = "rt3261.0-001c";
cpu-dai-name = "rockchip-i2s.1";
};
};
};
*/
static int rockchip_rt3261_audio_probe(struct platform_device *pdev)
{
int ret;
@@ -271,8 +271,13 @@ static int rockchip_rt3261_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -16,6 +16,7 @@
#include <sound/soc-dapm.h>
#include <sound/jack.h>
#include <linux/delay.h>
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#if 1
@@ -35,7 +36,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
unsigned int pll_div;
int ret;
@@ -67,7 +68,8 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
break;
}
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
goto skip__;
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, 64-1);//bclk = 2*32*lrck; 2*32fs
switch(params_rate(params)) {
@@ -128,12 +130,10 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
ret = snd_soc_dai_set_clkdiv(codec_dai, RT5512_CLK_DIV_ID, pll_div*4);
if (ret < 0)
return ret;
#endif
skip__:
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
//snd_soc_dai_set_pll(codec_dai,0,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
return 0;
}
@@ -260,18 +260,9 @@ static struct snd_soc_dai_link rk29_dai[] = {
{ /* Primary DAI i/f */
.name = "RT5512 AIF1",
.stream_name = "RT5512 PCM",
.cpu_dai_name = "rockchip-i2s.1",
.codec_dai_name = "RT5512-aif1",
.codec_name = "rt5512.1-0018",
.init = rt5512_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
};
@@ -291,8 +282,13 @@ static int rockchip_rt5512_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rt5616.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -36,8 +37,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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;
int ret;
unsigned int pll_out = 0, dai_fmt = cpu_dai->card->dai_link[0].dai_fmt;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -60,41 +60,14 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
break;
}
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
#if 0 //use pll from blck
/*Set the pll of rt5616,the Pll source from BITCLK on CPU is master mode*/
//bitclk is 64fs
ret=snd_soc_dai_set_pll(codec_dai,0,params_rate(params)*64,pll_out);
if (ret < 0)
{
DBG("rk29_hw_params_rt5616:failed to set the pll for codec side\n");
return ret;
}
#endif
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5616:failed to set the sysclk for codec side\n");
return ret;
}
#endif
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
// snd_soc_dai_set_pll(codec_dai,0,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
}
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
@@ -157,24 +130,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "rt5616",
.stream_name = "rt5616 PCM",
.codec_name = "rt5616.0-001b",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rt5616-aif1",
.init = rk29_rt5616_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_rt5616_snd_card = {
@@ -190,8 +148,13 @@ static int rockchip_rt5616_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rt5621.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -36,7 +37,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
unsigned int lrclk = 0;
int ret;
@@ -62,46 +63,33 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
}
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
#if 0 //use pll from blck
/*Set the pll of rt5621,the Pll source from BITCLK on CPU is master mode*/
//bitclk is 64fs
ret=snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_BCLK,params_rate(params)*64,pll_out);
if (ret < 0) {
DBG("rk29_hw_params_rt5621:failed to set the pll for codec side\n");
return ret;
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM) {
if((24576000%params_rate(params))==0) //for 8k,16k,32k,48k
{
snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_MCLK,pll_out, 24576000);
snd_soc_dai_set_sysclk(codec_dai,0, 24576000, SND_SOC_CLOCK_IN);
}
else if((22579200%params_rate(params))==0) //for 11k,22k,44k
{
snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_MCLK,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0, 22579200, SND_SOC_CLOCK_IN);
}
}
#endif
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0) {
DBG("rk29_hw_params_rt5621:failed to set the sysclk for codec side\n");
return ret;
}
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
if((24576000%params_rate(params))==0) //for 8k,16k,32k,48k
{
snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_MCLK,pll_out, 24576000);
snd_soc_dai_set_sysclk(codec_dai,0, 24576000, SND_SOC_CLOCK_IN);
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0) {
DBG("rk29_hw_params_rt5621:failed to set the sysclk for codec side\n");
return ret;
}
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
}
else if((22579200%params_rate(params))==0) //for 11k,22k,44k
{
snd_soc_dai_set_pll(codec_dai,RT5621_PLL_FR_MCLK,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0, 22579200, SND_SOC_CLOCK_IN);
}
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
#endif
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
@@ -145,18 +133,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "RT5621",
.stream_name = "RT5621 PCM",
.codec_name = "RT5621.0-001a",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "RT5621 HiFi",
.init = rk29_rt5621_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_rt5621_snd_card = {
@@ -172,8 +151,13 @@ static int rockchip_rt5621_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rt5625.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -150,23 +151,12 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "RT5625 I2S1",
.stream_name = "RT5625 PCM",
.codec_name = "rt5625.0-001f",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "rt5625-aif1",
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RT5625 I2S2",
.stream_name = "RT5625 PCM",
.codec_name = "rt5625.0-001f",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "rt5625-aif2",
.ops = &rt5625_voice_ops,
},
@@ -185,8 +175,13 @@ static int rockchip_rt5625_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -20,14 +20,10 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "../codecs/rt5631.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#ifdef CONFIG_MACH_RK_FAC
#include <plat/config.h>
extern int codec_type;
#endif
#if 0
#define DBG(x...) printk(KERN_INFO x)
#else
@@ -40,7 +36,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -71,8 +67,21 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
break;
}
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
return ret;
}
//Codec is master, so is not need to set clkdiv for cpu.
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
return 0;
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, 64-1);//bclk = 2*32*lrck; 2*32fs
switch(params_rate(params)) {
case 176400:
@@ -86,31 +95,8 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
DBG("default:%s, %d, MCLK=%d BCLK=%d LRCK=%d\n",
__FUNCTION__,__LINE__,pll_out,pll_out/4,params_rate(params));
break;
}
#if 0 //use pll from blck
/*Set the pll of rt5631,the Pll source from BITCLK on CPU is master mode*/
//bitclk is 64fs
ret=snd_soc_dai_set_pll(codec_dai,0,params_rate(params)*64,pll_out);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the pll for codec side\n");
return ret;
}
#endif
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
return ret;
}
#endif
}
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
//snd_soc_dai_set_pll(codec_dai,0,pll_out, 22579200);
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#endif
return 0;
}
@@ -170,24 +156,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "rt5631",
.stream_name = "rt5631 PCM",
.codec_name = "rt5631.0-001a",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rt5631-hifi",
.init = rk29_rt5631_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_rt5631_snd_card = {
@@ -203,8 +174,13 @@ static int rockchip_rt5631_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -20,6 +20,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "../codecs/rt5631_phone.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -35,7 +36,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -60,22 +61,21 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
return ret;
}
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
return ret;
}
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
}
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
@@ -88,7 +88,7 @@ static int rk29_hw_params_voice(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
@@ -119,22 +119,21 @@ static int rk29_hw_params_voice(struct snd_pcm_substream *substream,
DBG("Enter:%s, %d, rate=%d\n",__FUNCTION__,__LINE__,params_rate(params));
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
return ret;
}
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
/*Set the system clk for codec*/
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
return ret;
}
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3);
}
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
#endif
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM)
snd_soc_dai_set_sysclk(codec_dai,0,pll_out, SND_SOC_CLOCK_IN);
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
@@ -202,36 +201,13 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "RT5631 hifi",
.stream_name = "RT5631 hifi stream",
.codec_name = "RT5631.0-001a",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "RT5631 HiFi",
.init = rk29_rt5631_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RT5631 voice",
.stream_name = "RT5631 voice stream",
.codec_name = "RT5631.0-001a",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#else
.cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rt5631-voice",
.ops = &rk29_ops_voice,
},
@@ -250,8 +226,13 @@ static int rockchip_rt5631_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rt5639.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -139,23 +140,12 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "RT5639 I2S1",
.stream_name = "RT5639 PCM",
.codec_name = "rt5639.0-001c",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "rt5639-aif1",
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RT5639 I2S2",
.stream_name = "RT5639 PCM",
.codec_name = "rt5639.0-001c",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "rt5639-aif2",
.ops = &rt5639_voice_ops,
},
@@ -174,8 +164,13 @@ static int rockchip_rt5639_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/rt5640.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -221,32 +222,13 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "RT5640 I2S1",
.stream_name = "RT5640 PCM",
.codec_name = "rt5640.0-001c",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.1",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rt5640-aif1",
.init = rk29_rt5640_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "RT5640 I2S2",
.stream_name = "RT5640 PCM",
.codec_name = "rt5640.0-001c",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.1",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rt5640-aif2",
.ops = &rt5640_voice_ops,
},
@@ -265,8 +247,13 @@ static int rockchip_rt5640_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/wm8900.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#include <linux/clk.h>
@@ -37,7 +38,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
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 = cpu_dai->card->dai_link[0].dai_fmt;
int div_bclk,div_mclk;
int ret;
struct clk *general_pll;
@@ -68,13 +69,11 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
//snd_soc_dai_set_pll(codec_dai, NULL, 12000000, pll_out);
snd_soc_dai_set_clkdiv(codec_dai, WM8900_LRCLK_MODE, 0x000);
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
snd_soc_dai_set_clkdiv(codec_dai, WM8900_BCLK_DIV, WM8900_BCLK_DIV_4);
snd_soc_dai_set_clkdiv(codec_dai, WM8900_DAC_LRCLK,(pll_out/4)/params_rate(params));
snd_soc_dai_set_clkdiv(codec_dai, WM8900_ADC_LRCLK,(pll_out/4)/params_rate(params));
#endif
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFM) {
snd_soc_dai_set_clkdiv(codec_dai, WM8900_BCLK_DIV, WM8900_BCLK_DIV_4);
snd_soc_dai_set_clkdiv(codec_dai, WM8900_DAC_LRCLK,(pll_out/4)/params_rate(params));
snd_soc_dai_set_clkdiv(codec_dai, WM8900_ADC_LRCLK,(pll_out/4)/params_rate(params));
} else {
general_pll=clk_get(NULL, "general_pll");
if(clk_get_rate(general_pll)>260000000)
{
@@ -97,7 +96,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
#endif
}
DBG("Enter:%s, %d, LRCK=%d\n",__FUNCTION__,__LINE__,(pll_out/4)/params_rate(params));
return 0;
@@ -154,18 +153,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "WM8900",
.stream_name = "WM8900 PCM",
.codec_name = "WM8900.0-001a",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "WM8900 HiFi",
.init = rk29_wm8900_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_wm8900_snd_card = {
@@ -181,8 +171,13 @@ static int rockchip_wm8900_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -21,6 +21,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/wm8988.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
@@ -97,18 +98,9 @@ static struct snd_soc_ops rk29_ops = {
static struct snd_soc_dai_link rk29_dai = {
.name = "WM8988",
.stream_name = "WM8988 PCM",
.codec_name = "WM8988.0-001a",
.cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "WM8988 HiFi",
.init = rk29_wm8988_init,
.ops = &rk29_ops,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
};
static struct snd_soc_card rockchip_wm8988_snd_card = {
@@ -124,8 +116,13 @@ static int rockchip_wm8988_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);

View File

@@ -22,6 +22,7 @@
#include <sound/soc-dapm.h>
#include "../codecs/wm8994.h"
#include "card_info.h"
#include "rk_pcm.h"
#include "rk_i2s.h"
#include <linux/clk.h>
@@ -352,32 +353,13 @@ static struct snd_soc_dai_link rk29_dai[] = {
{
.name = "WM8994 I2S1",
.stream_name = "WM8994 PCM",
.codec_name = "wm8994-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "wm8994-aif1",
.ops = &rk29_aif1_ops,
.init = rk29_wm8994_init,
#if defined (CONFIG_SND_RK_CODEC_SOC_MASTER)
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
#else
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
#endif
},
{
.name = "WM8994 I2S2",
.stream_name = "WM8994 PCM",
.codec_name = "wm8994-codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
.cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
.cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "wm8994-aif2",
.ops = &rk29_aif2_ops,
},
@@ -396,8 +378,13 @@ static int rockchip_wm8994_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
ret = rockchip_of_get_sound_card_info(card);
if (ret) {
printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret);
return ret;
}
ret = snd_soc_register_card(card);
if (ret)
printk("%s() register card failed:%d\n", __FUNCTION__, ret);