mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 15:11:50 +00:00
Merge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/dai' and 'asoc/topic/davinci' into asoc-next
This commit is contained in:
commit
6d5c729dab
@ -429,6 +429,9 @@ bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd);
|
||||
void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream);
|
||||
void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);
|
||||
|
||||
int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
|
||||
unsigned int dai_fmt);
|
||||
|
||||
/* Utility functions to get clock rates from various things */
|
||||
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
|
||||
int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
|
||||
|
@ -63,33 +63,6 @@
|
||||
|
||||
static struct clk *mclk;
|
||||
|
||||
static int at91sam9g20ek_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_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops at91sam9g20ek_ops = {
|
||||
.hw_params = at91sam9g20ek_hw_params,
|
||||
};
|
||||
|
||||
static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card,
|
||||
struct snd_soc_dapm_context *dapm,
|
||||
enum snd_soc_bias_level level)
|
||||
@ -172,7 +145,8 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = {
|
||||
.init = at91sam9g20ek_wm8731_init,
|
||||
.platform_name = "at91rm9200_ssc.0",
|
||||
.codec_name = "wm8731.0-001b",
|
||||
.ops = &at91sam9g20ek_ops,
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
};
|
||||
|
||||
static struct snd_soc_card snd_soc_at91sam9g20ek = {
|
||||
|
@ -91,27 +91,12 @@ static int db1200_i2s_startup(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;
|
||||
int ret;
|
||||
|
||||
/* WM8731 has its own 12MHz crystal */
|
||||
snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL,
|
||||
12000000, SND_SOC_CLOCK_IN);
|
||||
|
||||
/* codec is bitclock and lrclk master */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_LEFT_J |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops db1200_i2s_wm8731_ops = {
|
||||
@ -125,6 +110,8 @@ static struct snd_soc_dai_link db1200_i2s_dai = {
|
||||
.cpu_dai_name = "au1xpsc_i2s.1",
|
||||
.platform_name = "au1xpsc-pcm.1",
|
||||
.codec_name = "wm8731.0-001b",
|
||||
.dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
.ops = &db1200_i2s_wm8731_ops,
|
||||
};
|
||||
|
||||
|
@ -1347,7 +1347,7 @@ static int cs42l73_probe(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_cs42l73 = {
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs42l73 = {
|
||||
.probe = cs42l73_probe,
|
||||
.set_bias_level = cs42l73_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
@ -1361,7 +1361,7 @@ static struct snd_soc_codec_driver soc_codec_dev_cs42l73 = {
|
||||
.num_controls = ARRAY_SIZE(cs42l73_snd_controls),
|
||||
};
|
||||
|
||||
static struct regmap_config cs42l73_regmap = {
|
||||
static const struct regmap_config cs42l73_regmap = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
|
||||
|
@ -58,13 +58,12 @@ choice
|
||||
depends on MACH_DAVINCI_DM365_EVM
|
||||
|
||||
config SND_DM365_AIC3X_CODEC
|
||||
bool "Audio Codec - AIC3101"
|
||||
tristate "Audio Codec - AIC3101"
|
||||
help
|
||||
Say Y if you want to add support for AIC3101 audio codec
|
||||
|
||||
config SND_DM365_VOICE_CODEC
|
||||
tristate "Voice Codec - CQ93VC"
|
||||
depends on SND_DAVINCI_SOC
|
||||
select MFD_DAVINCI_VOICECODEC
|
||||
select SND_DAVINCI_SOC_VCIF
|
||||
select SND_SOC_CQ0093VC
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/platform_data/edma.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/clk.h>
|
||||
@ -25,11 +24,6 @@
|
||||
#include <asm/dma.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <linux/edma.h>
|
||||
|
||||
#include "davinci-pcm.h"
|
||||
#include "davinci-i2s.h"
|
||||
|
||||
struct snd_soc_card_drvdata_davinci {
|
||||
struct clk *mclk;
|
||||
unsigned sysclk;
|
||||
|
@ -364,6 +364,20 @@ static irqreturn_t davinci_mcasp_rx_irq_handler(int irq, void *data)
|
||||
return IRQ_RETVAL(handled_mask);
|
||||
}
|
||||
|
||||
static irqreturn_t davinci_mcasp_common_irq_handler(int irq, void *data)
|
||||
{
|
||||
struct davinci_mcasp *mcasp = (struct davinci_mcasp *)data;
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
|
||||
if (mcasp->substreams[SNDRV_PCM_STREAM_PLAYBACK])
|
||||
ret = davinci_mcasp_tx_irq_handler(irq, data);
|
||||
|
||||
if (mcasp->substreams[SNDRV_PCM_STREAM_CAPTURE])
|
||||
ret |= davinci_mcasp_rx_irq_handler(irq, data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
@ -1313,6 +1327,8 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
|
||||
|
||||
pdata->tx_dma_channel = dma_spec.args[0];
|
||||
|
||||
/* RX is not valid in DIT mode */
|
||||
if (pdata->op_mode != DAVINCI_MCASP_DIT_MODE) {
|
||||
ret = of_property_match_string(np, "dma-names", "rx");
|
||||
if (ret < 0)
|
||||
goto nodata;
|
||||
@ -1323,6 +1339,7 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
|
||||
goto nodata;
|
||||
|
||||
pdata->rx_dma_channel = dma_spec.args[0];
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(np, "tx-num-evt", &val);
|
||||
if (ret >= 0)
|
||||
@ -1441,6 +1458,23 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
|
||||
|
||||
mcasp->dev = &pdev->dev;
|
||||
|
||||
irq = platform_get_irq_byname(pdev, "common");
|
||||
if (irq >= 0) {
|
||||
irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_common\n",
|
||||
dev_name(&pdev->dev));
|
||||
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
|
||||
davinci_mcasp_common_irq_handler,
|
||||
IRQF_ONESHOT | IRQF_SHARED,
|
||||
irq_name, mcasp);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "common IRQ request failed\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK] = XUNDRN;
|
||||
mcasp->irq_request[SNDRV_PCM_STREAM_CAPTURE] = ROVRN;
|
||||
}
|
||||
|
||||
irq = platform_get_irq_byname(pdev, "rx");
|
||||
if (irq >= 0) {
|
||||
irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_rx\n",
|
||||
@ -1501,6 +1535,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
|
||||
else
|
||||
dma_data->filter_data = &dma_params->channel;
|
||||
|
||||
/* RX is not valid in DIT mode */
|
||||
if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) {
|
||||
dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE];
|
||||
dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
|
||||
dma_params->asp_chan_q = pdata->asp_chan_q;
|
||||
@ -1515,14 +1551,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
|
||||
/* Unconditional dmaengine stuff */
|
||||
dma_data->addr = dma_params->dma_addr;
|
||||
|
||||
if (mcasp->version < MCASP_VERSION_3) {
|
||||
mcasp->fifo_base = DAVINCI_MCASP_V2_AFIFO_BASE;
|
||||
/* dma_params->dma_addr is pointing to the data port address */
|
||||
mcasp->dat_port = true;
|
||||
} else {
|
||||
mcasp->fifo_base = DAVINCI_MCASP_V3_AFIFO_BASE;
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
|
||||
if (res)
|
||||
dma_params->channel = res->start;
|
||||
@ -1534,6 +1562,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
|
||||
dma_data->filter_data = "rx";
|
||||
else
|
||||
dma_data->filter_data = &dma_params->channel;
|
||||
}
|
||||
|
||||
if (mcasp->version < MCASP_VERSION_3) {
|
||||
mcasp->fifo_base = DAVINCI_MCASP_V2_AFIFO_BASE;
|
||||
/* dma_params->dma_addr is pointing to the data port address */
|
||||
mcasp->dat_port = true;
|
||||
} else {
|
||||
mcasp->fifo_base = DAVINCI_MCASP_V3_AFIFO_BASE;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, mcasp);
|
||||
|
||||
|
@ -42,25 +42,6 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
/* fsl_ssi lacks the set_fmt ops. */
|
||||
if (ret && ret != -ENOTSUPP) {
|
||||
dev_err(cpu_dai->dev,
|
||||
"Failed to set the cpu dai format.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret) {
|
||||
dev_err(cpu_dai->dev,
|
||||
"Failed to set the codec format.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, 0,
|
||||
CODEC_CLOCK, SND_SOC_CLOCK_OUT);
|
||||
if (ret) {
|
||||
@ -91,6 +72,8 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = {
|
||||
.name = "tlv320aic23",
|
||||
.stream_name = "TLV320AIC23",
|
||||
.codec_dai_name = "tlv320aic23-hifi",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
.ops = &eukrea_tlv320_snd_ops,
|
||||
};
|
||||
|
||||
|
@ -55,16 +55,6 @@ static int mx27vis_aic32x4_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;
|
||||
u32 dai_format;
|
||||
|
||||
dai_format = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
snd_soc_dai_set_fmt(codec_dai, dai_format);
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
snd_soc_dai_set_fmt(cpu_dai, dai_format);
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, 0,
|
||||
25000000, SND_SOC_CLOCK_OUT);
|
||||
@ -164,6 +154,8 @@ static struct snd_soc_dai_link mx27vis_aic32x4_dai = {
|
||||
.platform_name = "imx-ssi.0",
|
||||
.codec_name = "tlv320aic32x4.0-0018",
|
||||
.cpu_dai_name = "imx-ssi.0",
|
||||
.dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
.ops = &mx27vis_aic32x4_snd_ops,
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,6 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream,
|
||||
snd_pcm_format_t format = params_format(params);
|
||||
unsigned int rate = params_rate(params);
|
||||
unsigned int channels = params_channels(params);
|
||||
u32 dai_format;
|
||||
|
||||
/* find the correct audio parameters */
|
||||
for (i = 0; i < ARRAY_SIZE(wm8350_audio); i++) {
|
||||
@ -104,15 +103,6 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream,
|
||||
/* codec FLL input is 14.75 MHz from MCLK */
|
||||
snd_soc_dai_set_pll(codec_dai, 0, 0, 14750000, wm8350_audio[i].sysclk);
|
||||
|
||||
dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
snd_soc_dai_set_fmt(codec_dai, dai_format);
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
snd_soc_dai_set_fmt(cpu_dai, dai_format);
|
||||
|
||||
/* TODO: The SSI driver should figure this out for us */
|
||||
switch (channels) {
|
||||
case 2:
|
||||
@ -244,6 +234,8 @@ static struct snd_soc_dai_link wm1133_ev1_dai = {
|
||||
.init = wm1133_ev1_init,
|
||||
.ops = &wm1133_ev1_ops,
|
||||
.symmetric_rates = 1,
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
};
|
||||
|
||||
static struct snd_soc_card wm1133_ev1 = {
|
||||
|
@ -36,7 +36,7 @@ static int mxs_sgtl5000_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 rate = params_rate(params);
|
||||
u32 dai_format, mclk;
|
||||
u32 mclk;
|
||||
int ret;
|
||||
|
||||
/* sgtl5000 does not support 512*rate when in 96000 fs */
|
||||
@ -65,26 +65,6 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set codec to slave mode */
|
||||
dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, dai_format);
|
||||
if (ret) {
|
||||
dev_err(codec_dai->dev, "Failed to set dai format to %08x\n",
|
||||
dai_format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
|
||||
if (ret) {
|
||||
dev_err(cpu_dai->dev, "Failed to set dai format to %08x\n",
|
||||
dai_format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,17 +72,22 @@ static struct snd_soc_ops mxs_sgtl5000_hifi_ops = {
|
||||
.hw_params = mxs_sgtl5000_hw_params,
|
||||
};
|
||||
|
||||
#define MXS_SGTL5000_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
|
||||
SND_SOC_DAIFMT_CBS_CFS)
|
||||
|
||||
static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
|
||||
{
|
||||
.name = "HiFi Tx",
|
||||
.stream_name = "HiFi Playback",
|
||||
.codec_dai_name = "sgtl5000",
|
||||
.dai_fmt = MXS_SGTL5000_DAI_FMT,
|
||||
.ops = &mxs_sgtl5000_hifi_ops,
|
||||
.playback_only = true,
|
||||
}, {
|
||||
.name = "HiFi Rx",
|
||||
.stream_name = "HiFi Capture",
|
||||
.codec_dai_name = "sgtl5000",
|
||||
.dai_fmt = MXS_SGTL5000_DAI_FMT,
|
||||
.ops = &mxs_sgtl5000_hifi_ops,
|
||||
.capture_only = true,
|
||||
},
|
||||
|
@ -412,21 +412,7 @@ static struct tty_ldisc_ops cx81801_ops = {
|
||||
* over the modem port.
|
||||
*/
|
||||
|
||||
static int ams_delta_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
|
||||
/* Set cpu DAI configuration */
|
||||
return snd_soc_dai_set_fmt(rtd->cpu_dai,
|
||||
SND_SOC_DAIFMT_DSP_A |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops ams_delta_ops = {
|
||||
.hw_params = ams_delta_hw_params,
|
||||
};
|
||||
static struct snd_soc_ops ams_delta_ops;
|
||||
|
||||
|
||||
/* Digital mute implemented using modem/CPU multiplexer.
|
||||
@ -546,6 +532,8 @@ static struct snd_soc_dai_link ams_delta_dai_link = {
|
||||
.platform_name = "omap-mcbsp.1",
|
||||
.codec_name = "cx20442-codec",
|
||||
.ops = &ams_delta_ops,
|
||||
.dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
};
|
||||
|
||||
/* Audio card driver */
|
||||
|
@ -53,11 +53,7 @@ static int omap_twl4030_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_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
unsigned int fmt;
|
||||
int ret;
|
||||
|
||||
switch (params_channels(params)) {
|
||||
case 2: /* Stereo I2S mode */
|
||||
@ -74,21 +70,7 @@ static int omap_twl4030_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, fmt);
|
||||
if (ret < 0) {
|
||||
dev_err(card->dev, "can't set codec DAI configuration\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
||||
if (ret < 0) {
|
||||
dev_err(card->dev, "can't set cpu DAI configuration\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return snd_soc_runtime_set_dai_fmt(rtd, fmt);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops omap_twl4030_ops = {
|
||||
|
@ -88,7 +88,7 @@ static int raumfeld_cs4270_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 fmt, clk = 0;
|
||||
unsigned int clk = 0;
|
||||
int ret = 0;
|
||||
|
||||
switch (params_rate(params)) {
|
||||
@ -112,15 +112,6 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fmt = SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS;
|
||||
|
||||
/* setup the CODEC DAI */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, fmt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -130,10 +121,6 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -169,9 +156,8 @@ static int raumfeld_ak4104_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_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int fmt, ret = 0, clk = 0;
|
||||
int ret = 0, clk = 0;
|
||||
|
||||
switch (params_rate(params)) {
|
||||
case 44100:
|
||||
@ -194,22 +180,11 @@ static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF;
|
||||
|
||||
/* setup the CODEC DAI */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, fmt | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* setup the CPU DAI */
|
||||
ret = snd_soc_dai_set_pll(cpu_dai, 0, 0, 0, clk);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -233,6 +208,9 @@ static struct snd_soc_ops raumfeld_ak4104_ops = {
|
||||
.platform_name = "pxa-pcm-audio", \
|
||||
.codec_dai_name = "cs4270-hifi", \
|
||||
.codec_name = "cs4270.0-0048", \
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | \
|
||||
SND_SOC_DAIFMT_NB_NF | \
|
||||
SND_SOC_DAIFMT_CBS_CFS, \
|
||||
.ops = &raumfeld_cs4270_ops, \
|
||||
}
|
||||
|
||||
@ -243,6 +221,9 @@ static struct snd_soc_ops raumfeld_ak4104_ops = {
|
||||
.cpu_dai_name = "pxa-ssp-dai.1", \
|
||||
.codec_dai_name = "ak4104-hifi", \
|
||||
.platform_name = "pxa-pcm-audio", \
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | \
|
||||
SND_SOC_DAIFMT_NB_NF | \
|
||||
SND_SOC_DAIFMT_CBS_CFS, \
|
||||
.ops = &raumfeld_ak4104_ops, \
|
||||
.codec_name = "spi0.0", \
|
||||
}
|
||||
|
@ -130,16 +130,6 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -172,6 +162,8 @@ static struct snd_soc_dai_link zylonite_dai[] = {
|
||||
.platform_name = "pxa-pcm-audio",
|
||||
.cpu_dai_name = "pxa-ssp-dai.2",
|
||||
.codec_dai_name = "wm9713-voice",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &zylonite_voice_ops,
|
||||
},
|
||||
};
|
||||
|
@ -136,22 +136,9 @@ static int goni_hifi_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 = 24000000;
|
||||
int ret = 0;
|
||||
|
||||
/* set the cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set the codec FLL */
|
||||
ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, 0, pll_out,
|
||||
params_rate(params) * 256);
|
||||
@ -182,12 +169,6 @@ static int goni_voice_hw_params(struct snd_pcm_substream *substream,
|
||||
if (params_rate(params) != 8000)
|
||||
return -EINVAL;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J |
|
||||
SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set the codec FLL */
|
||||
ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL2, 0, pll_out,
|
||||
params_rate(params) * 256);
|
||||
@ -234,6 +215,8 @@ static struct snd_soc_dai_link goni_dai[] = {
|
||||
.codec_dai_name = "wm8994-aif1",
|
||||
.platform_name = "samsung-i2s.0",
|
||||
.codec_name = "wm8994-codec.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
.init = goni_wm8994_init,
|
||||
.ops = &goni_hifi_ops,
|
||||
}, {
|
||||
@ -242,6 +225,8 @@ static struct snd_soc_dai_link goni_dai[] = {
|
||||
.cpu_dai_name = "goni-voice-dai",
|
||||
.codec_dai_name = "wm8994-aif2",
|
||||
.codec_name = "wm8994-codec.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_IB_IF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
.ops = &goni_voice_ops,
|
||||
},
|
||||
};
|
||||
|
@ -76,7 +76,6 @@ static int h1940_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;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
int div;
|
||||
int ret;
|
||||
unsigned int rate = params_rate(params);
|
||||
@ -95,18 +94,6 @@ static int h1940_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* select clock source */
|
||||
ret = snd_soc_dai_set_sysclk(cpu_dai, S3C24XX_CLKSRC_PCLK, rate,
|
||||
SND_SOC_CLOCK_OUT);
|
||||
@ -207,6 +194,8 @@ static struct snd_soc_dai_link h1940_uda1380_dai[] = {
|
||||
.init = h1940_uda1380_init,
|
||||
.platform_name = "s3c24xx-iis",
|
||||
.codec_name = "uda1380-codec.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &h1940_ops,
|
||||
},
|
||||
};
|
||||
|
@ -61,20 +61,6 @@ static int jive_hw_params(struct snd_pcm_substream *substream,
|
||||
s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params),
|
||||
s3c_i2sv2_get_clock(cpu_dai));
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set the codec system clock for DAC and ADC */
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
|
||||
SND_SOC_CLOCK_IN);
|
||||
@ -121,6 +107,8 @@ static struct snd_soc_dai_link jive_dai = {
|
||||
.platform_name = "s3c2412-i2s",
|
||||
.codec_name = "wm8750.0-001a",
|
||||
.init = jive_wm8750_init,
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &jive_ops,
|
||||
};
|
||||
|
||||
|
@ -70,20 +70,6 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream,
|
||||
break;
|
||||
}
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai,
|
||||
SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai,
|
||||
SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set the codec system clock for DAC and ADC */
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_MCLK, pll_out,
|
||||
SND_SOC_CLOCK_IN);
|
||||
@ -151,13 +137,6 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
pcmdiv = WM8753_PCM_DIV_6; /* 2.048 MHz */
|
||||
|
||||
/* todo: gg check mode (DSP_B) against CSR datasheet */
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set the codec system clock for DAC and ADC */
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_PCMCLK, 12288000,
|
||||
SND_SOC_CLOCK_IN);
|
||||
@ -300,6 +279,8 @@ static struct snd_soc_dai_link neo1973_dai[] = {
|
||||
.cpu_dai_name = "s3c24xx-iis",
|
||||
.codec_dai_name = "wm8753-hifi",
|
||||
.codec_name = "wm8753.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
.init = neo1973_wm8753_init,
|
||||
.ops = &neo1973_hifi_ops,
|
||||
},
|
||||
@ -309,6 +290,8 @@ static struct snd_soc_dai_link neo1973_dai[] = {
|
||||
.cpu_dai_name = "bt-sco-pcm",
|
||||
.codec_dai_name = "wm8753-voice",
|
||||
.codec_name = "wm8753.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &neo1973_voice_ops,
|
||||
},
|
||||
};
|
||||
|
@ -89,6 +89,8 @@ static struct snd_soc_dai_link rx1950_uda1380_dai[] = {
|
||||
.init = rx1950_uda1380_init,
|
||||
.platform_name = "s3c24xx-iis",
|
||||
.codec_name = "uda1380-codec.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &rx1950_ops,
|
||||
},
|
||||
};
|
||||
@ -154,7 +156,6 @@ static int rx1950_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;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
int div;
|
||||
int ret;
|
||||
unsigned int rate = params_rate(params);
|
||||
@ -181,18 +182,6 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* select clock source */
|
||||
ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source, rate,
|
||||
SND_SOC_CLOCK_OUT);
|
||||
|
@ -169,24 +169,6 @@ static int simtec_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret;
|
||||
|
||||
/* Set the CODEC as the bus clock master, I2S */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret) {
|
||||
pr_err("%s: failed set cpu dai format\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set the CODEC as the bus clock master */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret) {
|
||||
pr_err("%s: failed set codec dai format\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, 0,
|
||||
CODEC_CLOCK, SND_SOC_CLOCK_IN);
|
||||
if (ret) {
|
||||
@ -320,6 +302,8 @@ int simtec_audio_core_probe(struct platform_device *pdev,
|
||||
int ret;
|
||||
|
||||
card->dai_link->ops = &simtec_snd_ops;
|
||||
card->dai_link->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
|
@ -173,16 +173,6 @@ static int s3c24xx_uda134x_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source , clk,
|
||||
SND_SOC_CLOCK_IN);
|
||||
if (ret < 0)
|
||||
@ -223,6 +213,8 @@ static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = {
|
||||
.codec_name = "uda134x-codec",
|
||||
.codec_dai_name = "uda134x-hifi",
|
||||
.cpu_dai_name = "s3c24xx-iis",
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &s3c24xx_uda134x_ops,
|
||||
.platform_name = "s3c24xx-iis",
|
||||
};
|
||||
|
@ -56,20 +56,6 @@ static int smartq_hifi_hw_params(struct snd_pcm_substream *substream,
|
||||
break;
|
||||
}
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Use PCLK for I2S signal generation */
|
||||
ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0,
|
||||
0, SND_SOC_CLOCK_IN);
|
||||
@ -199,6 +185,8 @@ static struct snd_soc_dai_link smartq_dai[] = {
|
||||
.platform_name = "samsung-i2s.0",
|
||||
.codec_name = "wm8750.0-0x1a",
|
||||
.init = smartq_wm8987_init,
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &smartq_hifi_ops,
|
||||
},
|
||||
};
|
||||
|
@ -32,7 +32,6 @@ static int smdk_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_dai *cpu_dai = rtd->cpu_dai;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
unsigned int pll_out;
|
||||
int bfs, rfs, ret;
|
||||
@ -77,20 +76,6 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
pll_out = params_rate(params) * rfs;
|
||||
|
||||
/* Set the Codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
|
||||
| SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set the AP DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
|
||||
| SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set WM8580 to drive MCLK from its PLLA */
|
||||
ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_MCLK,
|
||||
WM8580_CLKSRC_PLLA);
|
||||
@ -168,6 +153,9 @@ enum {
|
||||
SEC_PLAYBACK,
|
||||
};
|
||||
|
||||
#define SMDK_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
|
||||
SND_SOC_DAIFMT_CBM_CFM)
|
||||
|
||||
static struct snd_soc_dai_link smdk_dai[] = {
|
||||
[PRI_PLAYBACK] = { /* Primary Playback i/f */
|
||||
.name = "WM8580 PAIF RX",
|
||||
@ -176,6 +164,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
|
||||
.codec_dai_name = "wm8580-hifi-playback",
|
||||
.platform_name = "samsung-i2s.0",
|
||||
.codec_name = "wm8580.0-001b",
|
||||
.dai_fmt = SMDK_DAI_FMT,
|
||||
.ops = &smdk_ops,
|
||||
},
|
||||
[PRI_CAPTURE] = { /* Primary Capture i/f */
|
||||
@ -185,6 +174,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
|
||||
.codec_dai_name = "wm8580-hifi-capture",
|
||||
.platform_name = "samsung-i2s.0",
|
||||
.codec_name = "wm8580.0-001b",
|
||||
.dai_fmt = SMDK_DAI_FMT,
|
||||
.init = smdk_wm8580_init_paiftx,
|
||||
.ops = &smdk_ops,
|
||||
},
|
||||
@ -195,6 +185,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
|
||||
.codec_dai_name = "wm8580-hifi-playback",
|
||||
.platform_name = "samsung-i2s-sec",
|
||||
.codec_name = "wm8580.0-001b",
|
||||
.dai_fmt = SMDK_DAI_FMT,
|
||||
.ops = &smdk_ops,
|
||||
},
|
||||
};
|
||||
|
@ -62,20 +62,6 @@ static int smdk_wm8580_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
rfs = mclk_freq / params_rate(params) / 2;
|
||||
|
||||
/* Set the codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B
|
||||
| SND_SOC_DAIFMT_IB_NF
|
||||
| SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set the cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_B
|
||||
| SND_SOC_DAIFMT_IB_NF
|
||||
| SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (mclk_freq == xtal_freq) {
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, WM8580_CLKSRC_MCLK,
|
||||
mclk_freq, SND_SOC_CLOCK_IN);
|
||||
@ -121,6 +107,9 @@ static struct snd_soc_ops smdk_wm8580_pcm_ops = {
|
||||
.hw_params = smdk_wm8580_pcm_hw_params,
|
||||
};
|
||||
|
||||
#define SMDK_DAI_FMT (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF | \
|
||||
SND_SOC_DAIFMT_CBS_CFS)
|
||||
|
||||
static struct snd_soc_dai_link smdk_dai[] = {
|
||||
{
|
||||
.name = "WM8580 PAIF PCM RX",
|
||||
@ -129,6 +118,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
|
||||
.codec_dai_name = "wm8580-hifi-playback",
|
||||
.platform_name = "samsung-audio",
|
||||
.codec_name = "wm8580.0-001b",
|
||||
.dai_fmt = SMDK_DAI_FMT,
|
||||
.ops = &smdk_wm8580_pcm_ops,
|
||||
}, {
|
||||
.name = "WM8580 PAIF PCM TX",
|
||||
@ -137,6 +127,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
|
||||
.codec_dai_name = "wm8580-hifi-capture",
|
||||
.platform_name = "samsung-pcm.0",
|
||||
.codec_name = "wm8580.0-001b",
|
||||
.dai_fmt = SMDK_DAI_FMT,
|
||||
.ops = &smdk_wm8580_pcm_ops,
|
||||
},
|
||||
};
|
||||
|
@ -68,20 +68,6 @@ static int smdk_wm8994_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
mclk_freq = params_rate(params) * rfs;
|
||||
|
||||
/* Set the codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B
|
||||
| SND_SOC_DAIFMT_IB_NF
|
||||
| SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set the cpu DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_B
|
||||
| SND_SOC_DAIFMT_IB_NF
|
||||
| SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1,
|
||||
mclk_freq, SND_SOC_CLOCK_IN);
|
||||
if (ret < 0)
|
||||
@ -118,6 +104,8 @@ static struct snd_soc_dai_link smdk_dai[] = {
|
||||
.codec_dai_name = "wm8994-aif1",
|
||||
.platform_name = "samsung-pcm.0",
|
||||
.codec_name = "wm8994-codec",
|
||||
.dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &smdk_wm8994_pcm_ops,
|
||||
},
|
||||
};
|
||||
|
@ -63,16 +63,6 @@ static int migor_hw_params(struct snd_pcm_substream *substream,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_NB_IF |
|
||||
SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(rtd->cpu_dai, SND_SOC_DAIFMT_NB_IF |
|
||||
SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
codec_freq = rate * 512;
|
||||
/*
|
||||
* This propagates the parent frequency change to children and
|
||||
@ -144,6 +134,8 @@ static struct snd_soc_dai_link migor_dai = {
|
||||
.codec_dai_name = "wm8978-hifi",
|
||||
.platform_name = "siu-pcm-audio",
|
||||
.codec_name = "wm8978.0-001a",
|
||||
.dai_fmt = SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_I2S |
|
||||
SND_SOC_DAIFMT_CBS_CFS,
|
||||
.ops = &migor_dai_ops,
|
||||
};
|
||||
|
||||
|
@ -1437,11 +1437,76 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_runtime_set_dai_fmt() - Change DAI link format for a ASoC runtime
|
||||
* @rtd: The runtime for which the DAI link format should be changed
|
||||
* @dai_fmt: The new DAI link format
|
||||
*
|
||||
* This function updates the DAI link format for all DAIs connected to the DAI
|
||||
* link for the specified runtime.
|
||||
*
|
||||
* Note: For setups with a static format set the dai_fmt field in the
|
||||
* corresponding snd_dai_link struct instead of using this function.
|
||||
*
|
||||
* Returns 0 on success, otherwise a negative error code.
|
||||
*/
|
||||
int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
|
||||
unsigned int dai_fmt)
|
||||
{
|
||||
struct snd_soc_dai **codec_dais = rtd->codec_dais;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < rtd->num_codecs; i++) {
|
||||
struct snd_soc_dai *codec_dai = codec_dais[i];
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
|
||||
if (ret != 0 && ret != -ENOTSUPP) {
|
||||
dev_warn(codec_dai->dev,
|
||||
"ASoC: Failed to set DAI format: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Flip the polarity for the "CPU" end of a CODEC<->CODEC link */
|
||||
if (cpu_dai->codec) {
|
||||
unsigned int inv_dai_fmt;
|
||||
|
||||
inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK;
|
||||
switch (dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBM_CFS:
|
||||
inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFM:
|
||||
inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFS:
|
||||
inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
|
||||
break;
|
||||
}
|
||||
|
||||
dai_fmt = inv_dai_fmt;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
|
||||
if (ret != 0 && ret != -ENOTSUPP) {
|
||||
dev_warn(cpu_dai->dev,
|
||||
"ASoC: Failed to set DAI format: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_runtime_set_dai_fmt);
|
||||
|
||||
static int snd_soc_instantiate_card(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_dai_link *dai_link;
|
||||
int ret, i, order, dai_fmt;
|
||||
int ret, i, order;
|
||||
|
||||
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
|
||||
|
||||
@ -1552,60 +1617,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
|
||||
card->num_dapm_routes);
|
||||
|
||||
for (i = 0; i < card->num_links; i++) {
|
||||
struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
|
||||
dai_link = &card->dai_link[i];
|
||||
dai_fmt = dai_link->dai_fmt;
|
||||
|
||||
if (dai_fmt) {
|
||||
struct snd_soc_dai **codec_dais = rtd->codec_dais;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < rtd->num_codecs; j++) {
|
||||
struct snd_soc_dai *codec_dai = codec_dais[j];
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
|
||||
if (ret != 0 && ret != -ENOTSUPP)
|
||||
dev_warn(codec_dai->dev,
|
||||
"ASoC: Failed to set DAI format: %d\n",
|
||||
ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is a regular CPU link there will be a platform */
|
||||
if (dai_fmt &&
|
||||
(dai_link->platform_name || dai_link->platform_of_node)) {
|
||||
ret = snd_soc_dai_set_fmt(card->rtd[i].cpu_dai,
|
||||
dai_fmt);
|
||||
if (ret != 0 && ret != -ENOTSUPP)
|
||||
dev_warn(card->rtd[i].cpu_dai->dev,
|
||||
"ASoC: Failed to set DAI format: %d\n",
|
||||
ret);
|
||||
} else if (dai_fmt) {
|
||||
/* Flip the polarity for the "CPU" end */
|
||||
dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
|
||||
switch (dai_link->dai_fmt &
|
||||
SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBM_CFS:
|
||||
dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFM:
|
||||
dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFS:
|
||||
dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_fmt(card->rtd[i].cpu_dai,
|
||||
dai_fmt);
|
||||
if (ret != 0 && ret != -ENOTSUPP)
|
||||
dev_warn(card->rtd[i].cpu_dai->dev,
|
||||
"ASoC: Failed to set DAI format: %d\n",
|
||||
ret);
|
||||
}
|
||||
if (card->dai_link[i].dai_fmt)
|
||||
snd_soc_runtime_set_dai_fmt(&card->rtd[i],
|
||||
card->dai_link[i].dai_fmt);
|
||||
}
|
||||
|
||||
snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname),
|
||||
|
@ -290,21 +290,9 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream,
|
||||
SND_SOC_DAIFMT_GATED;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, fmt);
|
||||
if (ret < 0) {
|
||||
dev_err(dev,
|
||||
"%s: ERROR: snd_soc_dai_set_fmt failed for codec_dai (ret = %d)!\n",
|
||||
__func__, ret);
|
||||
ret = snd_soc_runtime_set_dai_fmt(rtd, fmt);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
||||
if (ret < 0) {
|
||||
dev_err(dev,
|
||||
"%s: ERROR: snd_soc_dai_set_fmt failed for cpu_dai (ret = %d)!\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Setup TDM-slots */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user