aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c30
-rw-r--r--sound/soc/au1x/db1200.c19
-rw-r--r--sound/soc/codecs/cs42l73.c4
-rw-r--r--sound/soc/davinci/Kconfig3
-rw-r--r--sound/soc/davinci/davinci-evm.c6
-rw-r--r--sound/soc/davinci/davinci-mcasp.c103
-rw-r--r--sound/soc/fsl/eukrea-tlv320.c21
-rw-r--r--sound/soc/fsl/mx27vis-aic32x4.c12
-rw-r--r--sound/soc/fsl/wm1133-ev1.c12
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c27
-rw-r--r--sound/soc/omap/ams-delta.c18
-rw-r--r--sound/soc/omap/omap-twl4030.c20
-rw-r--r--sound/soc/pxa/raumfeld.c35
-rw-r--r--sound/soc/pxa/zylonite.c12
-rw-r--r--sound/soc/samsung/goni_wm8994.c23
-rw-r--r--sound/soc/samsung/h1940_uda1380.c15
-rw-r--r--sound/soc/samsung/jive_wm8750.c16
-rw-r--r--sound/soc/samsung/neo1973_wm8753.c25
-rw-r--r--sound/soc/samsung/rx1950_uda1380.c15
-rw-r--r--sound/soc/samsung/s3c24xx_simtec.c20
-rw-r--r--sound/soc/samsung/s3c24xx_uda134x.c12
-rw-r--r--sound/soc/samsung/smartq_wm8987.c16
-rw-r--r--sound/soc/samsung/smdk_wm8580.c21
-rw-r--r--sound/soc/samsung/smdk_wm8580pcm.c19
-rw-r--r--sound/soc/samsung/smdk_wm8994pcm.c16
-rw-r--r--sound/soc/sh/migor.c12
-rw-r--r--sound/soc/soc-core.c126
-rw-r--r--sound/soc/ux500/mop500_ab8500.c16
28 files changed, 211 insertions, 463 deletions
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 531728975bbb..f5ad214663f9 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -63,33 +63,6 @@
63 63
64static struct clk *mclk; 64static struct clk *mclk;
65 65
66static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream,
67 struct snd_pcm_hw_params *params)
68{
69 struct snd_soc_pcm_runtime *rtd = substream->private_data;
70 struct snd_soc_dai *codec_dai = rtd->codec_dai;
71 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
72 int ret;
73
74 /* set codec DAI configuration */
75 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
76 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
77 if (ret < 0)
78 return ret;
79
80 /* set cpu DAI configuration */
81 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
82 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
83 if (ret < 0)
84 return ret;
85
86 return 0;
87}
88
89static struct snd_soc_ops at91sam9g20ek_ops = {
90 .hw_params = at91sam9g20ek_hw_params,
91};
92
93static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, 66static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card,
94 struct snd_soc_dapm_context *dapm, 67 struct snd_soc_dapm_context *dapm,
95 enum snd_soc_bias_level level) 68 enum snd_soc_bias_level level)
@@ -172,7 +145,8 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = {
172 .init = at91sam9g20ek_wm8731_init, 145 .init = at91sam9g20ek_wm8731_init,
173 .platform_name = "at91rm9200_ssc.0", 146 .platform_name = "at91rm9200_ssc.0",
174 .codec_name = "wm8731.0-001b", 147 .codec_name = "wm8731.0-001b",
175 .ops = &at91sam9g20ek_ops, 148 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
149 SND_SOC_DAIFMT_CBM_CFM,
176}; 150};
177 151
178static struct snd_soc_card snd_soc_at91sam9g20ek = { 152static struct snd_soc_card snd_soc_at91sam9g20ek = {
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c
index a747ac0b399f..c75995f2779c 100644
--- a/sound/soc/au1x/db1200.c
+++ b/sound/soc/au1x/db1200.c
@@ -91,27 +91,12 @@ static int db1200_i2s_startup(struct snd_pcm_substream *substream)
91{ 91{
92 struct snd_soc_pcm_runtime *rtd = substream->private_data; 92 struct snd_soc_pcm_runtime *rtd = substream->private_data;
93 struct snd_soc_dai *codec_dai = rtd->codec_dai; 93 struct snd_soc_dai *codec_dai = rtd->codec_dai;
94 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
95 int ret;
96 94
97 /* WM8731 has its own 12MHz crystal */ 95 /* WM8731 has its own 12MHz crystal */
98 snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, 96 snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL,
99 12000000, SND_SOC_CLOCK_IN); 97 12000000, SND_SOC_CLOCK_IN);
100 98
101 /* codec is bitclock and lrclk master */ 99 return 0;
102 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J |
103 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
104 if (ret < 0)
105 goto out;
106
107 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_LEFT_J |
108 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
109 if (ret < 0)
110 goto out;
111
112 ret = 0;
113out:
114 return ret;
115} 100}
116 101
117static struct snd_soc_ops db1200_i2s_wm8731_ops = { 102static struct snd_soc_ops db1200_i2s_wm8731_ops = {
@@ -125,6 +110,8 @@ static struct snd_soc_dai_link db1200_i2s_dai = {
125 .cpu_dai_name = "au1xpsc_i2s.1", 110 .cpu_dai_name = "au1xpsc_i2s.1",
126 .platform_name = "au1xpsc-pcm.1", 111 .platform_name = "au1xpsc-pcm.1",
127 .codec_name = "wm8731.0-001b", 112 .codec_name = "wm8731.0-001b",
113 .dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF |
114 SND_SOC_DAIFMT_CBM_CFM,
128 .ops = &db1200_i2s_wm8731_ops, 115 .ops = &db1200_i2s_wm8731_ops,
129}; 116};
130 117
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 7c55537c69cf..8ecedba79606 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -1347,7 +1347,7 @@ static int cs42l73_probe(struct snd_soc_codec *codec)
1347 return 0; 1347 return 0;
1348} 1348}
1349 1349
1350static struct snd_soc_codec_driver soc_codec_dev_cs42l73 = { 1350static const struct snd_soc_codec_driver soc_codec_dev_cs42l73 = {
1351 .probe = cs42l73_probe, 1351 .probe = cs42l73_probe,
1352 .set_bias_level = cs42l73_set_bias_level, 1352 .set_bias_level = cs42l73_set_bias_level,
1353 .suspend_bias_off = true, 1353 .suspend_bias_off = true,
@@ -1361,7 +1361,7 @@ static struct snd_soc_codec_driver soc_codec_dev_cs42l73 = {
1361 .num_controls = ARRAY_SIZE(cs42l73_snd_controls), 1361 .num_controls = ARRAY_SIZE(cs42l73_snd_controls),
1362}; 1362};
1363 1363
1364static struct regmap_config cs42l73_regmap = { 1364static const struct regmap_config cs42l73_regmap = {
1365 .reg_bits = 8, 1365 .reg_bits = 8,
1366 .val_bits = 8, 1366 .val_bits = 8,
1367 1367
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig
index 8e948c63f3d9..2b81ca418d2a 100644
--- a/sound/soc/davinci/Kconfig
+++ b/sound/soc/davinci/Kconfig
@@ -58,13 +58,12 @@ choice
58 depends on MACH_DAVINCI_DM365_EVM 58 depends on MACH_DAVINCI_DM365_EVM
59 59
60config SND_DM365_AIC3X_CODEC 60config SND_DM365_AIC3X_CODEC
61 bool "Audio Codec - AIC3101" 61 tristate "Audio Codec - AIC3101"
62 help 62 help
63 Say Y if you want to add support for AIC3101 audio codec 63 Say Y if you want to add support for AIC3101 audio codec
64 64
65config SND_DM365_VOICE_CODEC 65config SND_DM365_VOICE_CODEC
66 tristate "Voice Codec - CQ93VC" 66 tristate "Voice Codec - CQ93VC"
67 depends on SND_DAVINCI_SOC
68 select MFD_DAVINCI_VOICECODEC 67 select MFD_DAVINCI_VOICECODEC
69 select SND_DAVINCI_SOC_VCIF 68 select SND_DAVINCI_SOC_VCIF
70 select SND_SOC_CQ0093VC 69 select SND_SOC_CQ0093VC
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 158cb3d1db70..b6bb5947a8a8 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -14,7 +14,6 @@
14#include <linux/timer.h> 14#include <linux/timer.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/platform_data/edma.h>
18#include <linux/i2c.h> 17#include <linux/i2c.h>
19#include <linux/of_platform.h> 18#include <linux/of_platform.h>
20#include <linux/clk.h> 19#include <linux/clk.h>
@@ -25,11 +24,6 @@
25#include <asm/dma.h> 24#include <asm/dma.h>
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
27 26
28#include <linux/edma.h>
29
30#include "davinci-pcm.h"
31#include "davinci-i2s.h"
32
33struct snd_soc_card_drvdata_davinci { 27struct snd_soc_card_drvdata_davinci {
34 struct clk *mclk; 28 struct clk *mclk;
35 unsigned sysclk; 29 unsigned sysclk;
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 30b94d4f9c5d..de3b155a5011 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -364,6 +364,20 @@ static irqreturn_t davinci_mcasp_rx_irq_handler(int irq, void *data)
364 return IRQ_RETVAL(handled_mask); 364 return IRQ_RETVAL(handled_mask);
365} 365}
366 366
367static irqreturn_t davinci_mcasp_common_irq_handler(int irq, void *data)
368{
369 struct davinci_mcasp *mcasp = (struct davinci_mcasp *)data;
370 irqreturn_t ret = IRQ_NONE;
371
372 if (mcasp->substreams[SNDRV_PCM_STREAM_PLAYBACK])
373 ret = davinci_mcasp_tx_irq_handler(irq, data);
374
375 if (mcasp->substreams[SNDRV_PCM_STREAM_CAPTURE])
376 ret |= davinci_mcasp_rx_irq_handler(irq, data);
377
378 return ret;
379}
380
367static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, 381static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
368 unsigned int fmt) 382 unsigned int fmt)
369{ 383{
@@ -1313,16 +1327,19 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of(
1313 1327
1314 pdata->tx_dma_channel = dma_spec.args[0]; 1328 pdata->tx_dma_channel = dma_spec.args[0];
1315 1329
1316 ret = of_property_match_string(np, "dma-names", "rx"); 1330 /* RX is not valid in DIT mode */
1317 if (ret < 0) 1331 if (pdata->op_mode != DAVINCI_MCASP_DIT_MODE) {
1318 goto nodata; 1332 ret = of_property_match_string(np, "dma-names", "rx");
1333 if (ret < 0)
1334 goto nodata;
1319 1335
1320 ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, 1336 ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
1321 &dma_spec); 1337 &dma_spec);
1322 if (ret < 0) 1338 if (ret < 0)
1323 goto nodata; 1339 goto nodata;
1324 1340
1325 pdata->rx_dma_channel = dma_spec.args[0]; 1341 pdata->rx_dma_channel = dma_spec.args[0];
1342 }
1326 1343
1327 ret = of_property_read_u32(np, "tx-num-evt", &val); 1344 ret = of_property_read_u32(np, "tx-num-evt", &val);
1328 if (ret >= 0) 1345 if (ret >= 0)
@@ -1441,6 +1458,23 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1441 1458
1442 mcasp->dev = &pdev->dev; 1459 mcasp->dev = &pdev->dev;
1443 1460
1461 irq = platform_get_irq_byname(pdev, "common");
1462 if (irq >= 0) {
1463 irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_common\n",
1464 dev_name(&pdev->dev));
1465 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
1466 davinci_mcasp_common_irq_handler,
1467 IRQF_ONESHOT | IRQF_SHARED,
1468 irq_name, mcasp);
1469 if (ret) {
1470 dev_err(&pdev->dev, "common IRQ request failed\n");
1471 goto err;
1472 }
1473
1474 mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK] = XUNDRN;
1475 mcasp->irq_request[SNDRV_PCM_STREAM_CAPTURE] = ROVRN;
1476 }
1477
1444 irq = platform_get_irq_byname(pdev, "rx"); 1478 irq = platform_get_irq_byname(pdev, "rx");
1445 if (irq >= 0) { 1479 if (irq >= 0) {
1446 irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_rx\n", 1480 irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_rx\n",
@@ -1501,19 +1535,34 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1501 else 1535 else
1502 dma_data->filter_data = &dma_params->channel; 1536 dma_data->filter_data = &dma_params->channel;
1503 1537
1504 dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE]; 1538 /* RX is not valid in DIT mode */
1505 dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE]; 1539 if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) {
1506 dma_params->asp_chan_q = pdata->asp_chan_q; 1540 dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE];
1507 dma_params->ram_chan_q = pdata->ram_chan_q; 1541 dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
1508 dma_params->sram_pool = pdata->sram_pool; 1542 dma_params->asp_chan_q = pdata->asp_chan_q;
1509 dma_params->sram_size = pdata->sram_size_capture; 1543 dma_params->ram_chan_q = pdata->ram_chan_q;
1510 if (dat) 1544 dma_params->sram_pool = pdata->sram_pool;
1511 dma_params->dma_addr = dat->start; 1545 dma_params->sram_size = pdata->sram_size_capture;
1512 else 1546 if (dat)
1513 dma_params->dma_addr = mem->start + pdata->rx_dma_offset; 1547 dma_params->dma_addr = dat->start;
1514 1548 else
1515 /* Unconditional dmaengine stuff */ 1549 dma_params->dma_addr = mem->start + pdata->rx_dma_offset;
1516 dma_data->addr = dma_params->dma_addr; 1550
1551 /* Unconditional dmaengine stuff */
1552 dma_data->addr = dma_params->dma_addr;
1553
1554 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1555 if (res)
1556 dma_params->channel = res->start;
1557 else
1558 dma_params->channel = pdata->rx_dma_channel;
1559
1560 /* dmaengine filter data for DT and non-DT boot */
1561 if (pdev->dev.of_node)
1562 dma_data->filter_data = "rx";
1563 else
1564 dma_data->filter_data = &dma_params->channel;
1565 }
1517 1566
1518 if (mcasp->version < MCASP_VERSION_3) { 1567 if (mcasp->version < MCASP_VERSION_3) {
1519 mcasp->fifo_base = DAVINCI_MCASP_V2_AFIFO_BASE; 1568 mcasp->fifo_base = DAVINCI_MCASP_V2_AFIFO_BASE;
@@ -1523,18 +1572,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1523 mcasp->fifo_base = DAVINCI_MCASP_V3_AFIFO_BASE; 1572 mcasp->fifo_base = DAVINCI_MCASP_V3_AFIFO_BASE;
1524 } 1573 }
1525 1574
1526 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1527 if (res)
1528 dma_params->channel = res->start;
1529 else
1530 dma_params->channel = pdata->rx_dma_channel;
1531
1532 /* dmaengine filter data for DT and non-DT boot */
1533 if (pdev->dev.of_node)
1534 dma_data->filter_data = "rx";
1535 else
1536 dma_data->filter_data = &dma_params->channel;
1537
1538 dev_set_drvdata(&pdev->dev, mcasp); 1575 dev_set_drvdata(&pdev->dev, mcasp);
1539 1576
1540 mcasp_reparent_fck(pdev); 1577 mcasp_reparent_fck(pdev);
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index 9ce70fc67b09..8c9e9006dd84 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -42,25 +42,6 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
43 int ret; 43 int ret;
44 44
45 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
46 SND_SOC_DAIFMT_NB_NF |
47 SND_SOC_DAIFMT_CBM_CFM);
48 /* fsl_ssi lacks the set_fmt ops. */
49 if (ret && ret != -ENOTSUPP) {
50 dev_err(cpu_dai->dev,
51 "Failed to set the cpu dai format.\n");
52 return ret;
53 }
54
55 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
56 SND_SOC_DAIFMT_NB_NF |
57 SND_SOC_DAIFMT_CBM_CFM);
58 if (ret) {
59 dev_err(cpu_dai->dev,
60 "Failed to set the codec format.\n");
61 return ret;
62 }
63
64 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 45 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
65 CODEC_CLOCK, SND_SOC_CLOCK_OUT); 46 CODEC_CLOCK, SND_SOC_CLOCK_OUT);
66 if (ret) { 47 if (ret) {
@@ -91,6 +72,8 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = {
91 .name = "tlv320aic23", 72 .name = "tlv320aic23",
92 .stream_name = "TLV320AIC23", 73 .stream_name = "TLV320AIC23",
93 .codec_dai_name = "tlv320aic23-hifi", 74 .codec_dai_name = "tlv320aic23-hifi",
75 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
76 SND_SOC_DAIFMT_CBM_CFM,
94 .ops = &eukrea_tlv320_snd_ops, 77 .ops = &eukrea_tlv320_snd_ops,
95}; 78};
96 79
diff --git a/sound/soc/fsl/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c
index b1ced7b8d80c..198eeb3f3f7a 100644
--- a/sound/soc/fsl/mx27vis-aic32x4.c
+++ b/sound/soc/fsl/mx27vis-aic32x4.c
@@ -55,16 +55,6 @@ static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream,
55 struct snd_soc_dai *codec_dai = rtd->codec_dai; 55 struct snd_soc_dai *codec_dai = rtd->codec_dai;
56 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 56 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
57 int ret; 57 int ret;
58 u32 dai_format;
59
60 dai_format = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
61 SND_SOC_DAIFMT_CBM_CFM;
62
63 /* set codec DAI configuration */
64 snd_soc_dai_set_fmt(codec_dai, dai_format);
65
66 /* set cpu DAI configuration */
67 snd_soc_dai_set_fmt(cpu_dai, dai_format);
68 58
69 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 59 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
70 25000000, SND_SOC_CLOCK_OUT); 60 25000000, SND_SOC_CLOCK_OUT);
@@ -164,6 +154,8 @@ static struct snd_soc_dai_link mx27vis_aic32x4_dai = {
164 .platform_name = "imx-ssi.0", 154 .platform_name = "imx-ssi.0",
165 .codec_name = "tlv320aic32x4.0-0018", 155 .codec_name = "tlv320aic32x4.0-0018",
166 .cpu_dai_name = "imx-ssi.0", 156 .cpu_dai_name = "imx-ssi.0",
157 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
158 SND_SOC_DAIFMT_CBM_CFM,
167 .ops = &mx27vis_aic32x4_snd_ops, 159 .ops = &mx27vis_aic32x4_snd_ops,
168}; 160};
169 161
diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c
index 804749a6c61e..d072bd13db09 100644
--- a/sound/soc/fsl/wm1133-ev1.c
+++ b/sound/soc/fsl/wm1133-ev1.c
@@ -87,7 +87,6 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream,
87 snd_pcm_format_t format = params_format(params); 87 snd_pcm_format_t format = params_format(params);
88 unsigned int rate = params_rate(params); 88 unsigned int rate = params_rate(params);
89 unsigned int channels = params_channels(params); 89 unsigned int channels = params_channels(params);
90 u32 dai_format;
91 90
92 /* find the correct audio parameters */ 91 /* find the correct audio parameters */
93 for (i = 0; i < ARRAY_SIZE(wm8350_audio); i++) { 92 for (i = 0; i < ARRAY_SIZE(wm8350_audio); i++) {
@@ -104,15 +103,6 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream,
104 /* codec FLL input is 14.75 MHz from MCLK */ 103 /* codec FLL input is 14.75 MHz from MCLK */
105 snd_soc_dai_set_pll(codec_dai, 0, 0, 14750000, wm8350_audio[i].sysclk); 104 snd_soc_dai_set_pll(codec_dai, 0, 0, 14750000, wm8350_audio[i].sysclk);
106 105
107 dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
108 SND_SOC_DAIFMT_CBM_CFM;
109
110 /* set codec DAI configuration */
111 snd_soc_dai_set_fmt(codec_dai, dai_format);
112
113 /* set cpu DAI configuration */
114 snd_soc_dai_set_fmt(cpu_dai, dai_format);
115
116 /* TODO: The SSI driver should figure this out for us */ 106 /* TODO: The SSI driver should figure this out for us */
117 switch (channels) { 107 switch (channels) {
118 case 2: 108 case 2:
@@ -244,6 +234,8 @@ static struct snd_soc_dai_link wm1133_ev1_dai = {
244 .init = wm1133_ev1_init, 234 .init = wm1133_ev1_init,
245 .ops = &wm1133_ev1_ops, 235 .ops = &wm1133_ev1_ops,
246 .symmetric_rates = 1, 236 .symmetric_rates = 1,
237 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
238 SND_SOC_DAIFMT_CBM_CFM,
247}; 239};
248 240
249static struct snd_soc_card wm1133_ev1 = { 241static struct snd_soc_card wm1133_ev1 = {
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 6f1916b71815..6e6fce6a14ba 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -36,7 +36,7 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
36 struct snd_soc_dai *codec_dai = rtd->codec_dai; 36 struct snd_soc_dai *codec_dai = rtd->codec_dai;
37 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 37 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
38 unsigned int rate = params_rate(params); 38 unsigned int rate = params_rate(params);
39 u32 dai_format, mclk; 39 u32 mclk;
40 int ret; 40 int ret;
41 41
42 /* sgtl5000 does not support 512*rate when in 96000 fs */ 42 /* 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,
65 return ret; 65 return ret;
66 } 66 }
67 67
68 /* set codec to slave mode */
69 dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
70 SND_SOC_DAIFMT_CBS_CFS;
71
72 /* set codec DAI configuration */
73 ret = snd_soc_dai_set_fmt(codec_dai, dai_format);
74 if (ret) {
75 dev_err(codec_dai->dev, "Failed to set dai format to %08x\n",
76 dai_format);
77 return ret;
78 }
79
80 /* set cpu DAI configuration */
81 ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
82 if (ret) {
83 dev_err(cpu_dai->dev, "Failed to set dai format to %08x\n",
84 dai_format);
85 return ret;
86 }
87
88 return 0; 68 return 0;
89} 69}
90 70
@@ -92,17 +72,22 @@ static struct snd_soc_ops mxs_sgtl5000_hifi_ops = {
92 .hw_params = mxs_sgtl5000_hw_params, 72 .hw_params = mxs_sgtl5000_hw_params,
93}; 73};
94 74
75#define MXS_SGTL5000_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
76 SND_SOC_DAIFMT_CBS_CFS)
77
95static struct snd_soc_dai_link mxs_sgtl5000_dai[] = { 78static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
96 { 79 {
97 .name = "HiFi Tx", 80 .name = "HiFi Tx",
98 .stream_name = "HiFi Playback", 81 .stream_name = "HiFi Playback",
99 .codec_dai_name = "sgtl5000", 82 .codec_dai_name = "sgtl5000",
83 .dai_fmt = MXS_SGTL5000_DAI_FMT,
100 .ops = &mxs_sgtl5000_hifi_ops, 84 .ops = &mxs_sgtl5000_hifi_ops,
101 .playback_only = true, 85 .playback_only = true,
102 }, { 86 }, {
103 .name = "HiFi Rx", 87 .name = "HiFi Rx",
104 .stream_name = "HiFi Capture", 88 .stream_name = "HiFi Capture",
105 .codec_dai_name = "sgtl5000", 89 .codec_dai_name = "sgtl5000",
90 .dai_fmt = MXS_SGTL5000_DAI_FMT,
106 .ops = &mxs_sgtl5000_hifi_ops, 91 .ops = &mxs_sgtl5000_hifi_ops,
107 .capture_only = true, 92 .capture_only = true,
108 }, 93 },
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 4c6afb75eea6..706613077c15 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -412,21 +412,7 @@ static struct tty_ldisc_ops cx81801_ops = {
412 * over the modem port. 412 * over the modem port.
413 */ 413 */
414 414
415static int ams_delta_hw_params(struct snd_pcm_substream *substream, 415static struct snd_soc_ops ams_delta_ops;
416 struct snd_pcm_hw_params *params)
417{
418 struct snd_soc_pcm_runtime *rtd = substream->private_data;
419
420 /* Set cpu DAI configuration */
421 return snd_soc_dai_set_fmt(rtd->cpu_dai,
422 SND_SOC_DAIFMT_DSP_A |
423 SND_SOC_DAIFMT_NB_NF |
424 SND_SOC_DAIFMT_CBM_CFM);
425}
426
427static struct snd_soc_ops ams_delta_ops = {
428 .hw_params = ams_delta_hw_params,
429};
430 416
431 417
432/* Digital mute implemented using modem/CPU multiplexer. 418/* Digital mute implemented using modem/CPU multiplexer.
@@ -546,6 +532,8 @@ static struct snd_soc_dai_link ams_delta_dai_link = {
546 .platform_name = "omap-mcbsp.1", 532 .platform_name = "omap-mcbsp.1",
547 .codec_name = "cx20442-codec", 533 .codec_name = "cx20442-codec",
548 .ops = &ams_delta_ops, 534 .ops = &ams_delta_ops,
535 .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF |
536 SND_SOC_DAIFMT_CBM_CFM,
549}; 537};
550 538
551/* Audio card driver */ 539/* Audio card driver */
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c
index 5e551c762b7a..fb1f6bb87cd4 100644
--- a/sound/soc/omap/omap-twl4030.c
+++ b/sound/soc/omap/omap-twl4030.c
@@ -53,11 +53,7 @@ static int omap_twl4030_hw_params(struct snd_pcm_substream *substream,
53 struct snd_pcm_hw_params *params) 53 struct snd_pcm_hw_params *params)
54{ 54{
55 struct snd_soc_pcm_runtime *rtd = substream->private_data; 55 struct snd_soc_pcm_runtime *rtd = substream->private_data;
56 struct snd_soc_dai *codec_dai = rtd->codec_dai;
57 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
58 struct snd_soc_card *card = rtd->card;
59 unsigned int fmt; 56 unsigned int fmt;
60 int ret;
61 57
62 switch (params_channels(params)) { 58 switch (params_channels(params)) {
63 case 2: /* Stereo I2S mode */ 59 case 2: /* Stereo I2S mode */
@@ -74,21 +70,7 @@ static int omap_twl4030_hw_params(struct snd_pcm_substream *substream,
74 return -EINVAL; 70 return -EINVAL;
75 } 71 }
76 72
77 /* Set codec DAI configuration */ 73 return snd_soc_runtime_set_dai_fmt(rtd, fmt);
78 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
79 if (ret < 0) {
80 dev_err(card->dev, "can't set codec DAI configuration\n");
81 return ret;
82 }
83
84 /* Set cpu DAI configuration */
85 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
86 if (ret < 0) {
87 dev_err(card->dev, "can't set cpu DAI configuration\n");
88 return ret;
89 }
90
91 return 0;
92} 74}
93 75
94static struct snd_soc_ops omap_twl4030_ops = { 76static struct snd_soc_ops omap_twl4030_ops = {
diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c
index 083706595495..552b763005ed 100644
--- a/sound/soc/pxa/raumfeld.c
+++ b/sound/soc/pxa/raumfeld.c
@@ -88,7 +88,7 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
88 struct snd_soc_pcm_runtime *rtd = substream->private_data; 88 struct snd_soc_pcm_runtime *rtd = substream->private_data;
89 struct snd_soc_dai *codec_dai = rtd->codec_dai; 89 struct snd_soc_dai *codec_dai = rtd->codec_dai;
90 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 90 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
91 unsigned int fmt, clk = 0; 91 unsigned int clk = 0;
92 int ret = 0; 92 int ret = 0;
93 93
94 switch (params_rate(params)) { 94 switch (params_rate(params)) {
@@ -112,15 +112,6 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
112 return -EINVAL; 112 return -EINVAL;
113 } 113 }
114 114
115 fmt = SND_SOC_DAIFMT_I2S |
116 SND_SOC_DAIFMT_NB_NF |
117 SND_SOC_DAIFMT_CBS_CFS;
118
119 /* setup the CODEC DAI */
120 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
121 if (ret < 0)
122 return ret;
123
124 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 0); 115 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 0);
125 if (ret < 0) 116 if (ret < 0)
126 return ret; 117 return ret;
@@ -130,10 +121,6 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
130 if (ret < 0) 121 if (ret < 0)
131 return ret; 122 return ret;
132 123
133 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
134 if (ret < 0)
135 return ret;
136
137 ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4); 124 ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4);
138 if (ret < 0) 125 if (ret < 0)
139 return ret; 126 return ret;
@@ -169,9 +156,8 @@ static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream,
169 struct snd_pcm_hw_params *params) 156 struct snd_pcm_hw_params *params)
170{ 157{
171 struct snd_soc_pcm_runtime *rtd = substream->private_data; 158 struct snd_soc_pcm_runtime *rtd = substream->private_data;
172 struct snd_soc_dai *codec_dai = rtd->codec_dai;
173 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 159 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
174 int fmt, ret = 0, clk = 0; 160 int ret = 0, clk = 0;
175 161
176 switch (params_rate(params)) { 162 switch (params_rate(params)) {
177 case 44100: 163 case 44100:
@@ -194,22 +180,11 @@ static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream,
194 return -EINVAL; 180 return -EINVAL;
195 } 181 }
196 182
197 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF;
198
199 /* setup the CODEC DAI */
200 ret = snd_soc_dai_set_fmt(codec_dai, fmt | SND_SOC_DAIFMT_CBS_CFS);
201 if (ret < 0)
202 return ret;
203
204 /* setup the CPU DAI */ 183 /* setup the CPU DAI */
205 ret = snd_soc_dai_set_pll(cpu_dai, 0, 0, 0, clk); 184 ret = snd_soc_dai_set_pll(cpu_dai, 0, 0, 0, clk);
206 if (ret < 0) 185 if (ret < 0)
207 return ret; 186 return ret;
208 187
209 ret = snd_soc_dai_set_fmt(cpu_dai, fmt | SND_SOC_DAIFMT_CBS_CFS);
210 if (ret < 0)
211 return ret;
212
213 ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4); 188 ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4);
214 if (ret < 0) 189 if (ret < 0)
215 return ret; 190 return ret;
@@ -233,6 +208,9 @@ static struct snd_soc_ops raumfeld_ak4104_ops = {
233 .platform_name = "pxa-pcm-audio", \ 208 .platform_name = "pxa-pcm-audio", \
234 .codec_dai_name = "cs4270-hifi", \ 209 .codec_dai_name = "cs4270-hifi", \
235 .codec_name = "cs4270.0-0048", \ 210 .codec_name = "cs4270.0-0048", \
211 .dai_fmt = SND_SOC_DAIFMT_I2S | \
212 SND_SOC_DAIFMT_NB_NF | \
213 SND_SOC_DAIFMT_CBS_CFS, \
236 .ops = &raumfeld_cs4270_ops, \ 214 .ops = &raumfeld_cs4270_ops, \
237} 215}
238 216
@@ -243,6 +221,9 @@ static struct snd_soc_ops raumfeld_ak4104_ops = {
243 .cpu_dai_name = "pxa-ssp-dai.1", \ 221 .cpu_dai_name = "pxa-ssp-dai.1", \
244 .codec_dai_name = "ak4104-hifi", \ 222 .codec_dai_name = "ak4104-hifi", \
245 .platform_name = "pxa-pcm-audio", \ 223 .platform_name = "pxa-pcm-audio", \
224 .dai_fmt = SND_SOC_DAIFMT_I2S | \
225 SND_SOC_DAIFMT_NB_NF | \
226 SND_SOC_DAIFMT_CBS_CFS, \
246 .ops = &raumfeld_ak4104_ops, \ 227 .ops = &raumfeld_ak4104_ops, \
247 .codec_name = "spi0.0", \ 228 .codec_name = "spi0.0", \
248} 229}
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c
index 23bf991e95d5..8f301c72ee5e 100644
--- a/sound/soc/pxa/zylonite.c
+++ b/sound/soc/pxa/zylonite.c
@@ -130,16 +130,6 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
130 if (ret < 0) 130 if (ret < 0)
131 return ret; 131 return ret;
132 132
133 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
134 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
135 if (ret < 0)
136 return ret;
137
138 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
139 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
140 if (ret < 0)
141 return ret;
142
143 return 0; 133 return 0;
144} 134}
145 135
@@ -172,6 +162,8 @@ static struct snd_soc_dai_link zylonite_dai[] = {
172 .platform_name = "pxa-pcm-audio", 162 .platform_name = "pxa-pcm-audio",
173 .cpu_dai_name = "pxa-ssp-dai.2", 163 .cpu_dai_name = "pxa-ssp-dai.2",
174 .codec_dai_name = "wm9713-voice", 164 .codec_dai_name = "wm9713-voice",
165 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
166 SND_SOC_DAIFMT_CBS_CFS,
175 .ops = &zylonite_voice_ops, 167 .ops = &zylonite_voice_ops,
176}, 168},
177}; 169};
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c
index 3b527dcfc0aa..fad56b9e7369 100644
--- a/sound/soc/samsung/goni_wm8994.c
+++ b/sound/soc/samsung/goni_wm8994.c
@@ -136,22 +136,9 @@ static int goni_hifi_hw_params(struct snd_pcm_substream *substream,
136{ 136{
137 struct snd_soc_pcm_runtime *rtd = substream->private_data; 137 struct snd_soc_pcm_runtime *rtd = substream->private_data;
138 struct snd_soc_dai *codec_dai = rtd->codec_dai; 138 struct snd_soc_dai *codec_dai = rtd->codec_dai;
139 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
140 unsigned int pll_out = 24000000; 139 unsigned int pll_out = 24000000;
141 int ret = 0; 140 int ret = 0;
142 141
143 /* set the cpu DAI configuration */
144 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
145 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
146 if (ret < 0)
147 return ret;
148
149 /* set codec DAI configuration */
150 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
151 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
152 if (ret < 0)
153 return ret;
154
155 /* set the codec FLL */ 142 /* set the codec FLL */
156 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, 0, pll_out, 143 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, 0, pll_out,
157 params_rate(params) * 256); 144 params_rate(params) * 256);
@@ -182,12 +169,6 @@ static int goni_voice_hw_params(struct snd_pcm_substream *substream,
182 if (params_rate(params) != 8000) 169 if (params_rate(params) != 8000)
183 return -EINVAL; 170 return -EINVAL;
184 171
185 /* set codec DAI configuration */
186 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J |
187 SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
188 if (ret < 0)
189 return ret;
190
191 /* set the codec FLL */ 172 /* set the codec FLL */
192 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL2, 0, pll_out, 173 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL2, 0, pll_out,
193 params_rate(params) * 256); 174 params_rate(params) * 256);
@@ -234,6 +215,8 @@ static struct snd_soc_dai_link goni_dai[] = {
234 .codec_dai_name = "wm8994-aif1", 215 .codec_dai_name = "wm8994-aif1",
235 .platform_name = "samsung-i2s.0", 216 .platform_name = "samsung-i2s.0",
236 .codec_name = "wm8994-codec.0-001a", 217 .codec_name = "wm8994-codec.0-001a",
218 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
219 SND_SOC_DAIFMT_CBM_CFM,
237 .init = goni_wm8994_init, 220 .init = goni_wm8994_init,
238 .ops = &goni_hifi_ops, 221 .ops = &goni_hifi_ops,
239}, { 222}, {
@@ -242,6 +225,8 @@ static struct snd_soc_dai_link goni_dai[] = {
242 .cpu_dai_name = "goni-voice-dai", 225 .cpu_dai_name = "goni-voice-dai",
243 .codec_dai_name = "wm8994-aif2", 226 .codec_dai_name = "wm8994-aif2",
244 .codec_name = "wm8994-codec.0-001a", 227 .codec_name = "wm8994-codec.0-001a",
228 .dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_IB_IF |
229 SND_SOC_DAIFMT_CBM_CFM,
245 .ops = &goni_voice_ops, 230 .ops = &goni_voice_ops,
246}, 231},
247}; 232};
diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c
index f2d7980d7ddc..59b044255b78 100644
--- a/sound/soc/samsung/h1940_uda1380.c
+++ b/sound/soc/samsung/h1940_uda1380.c
@@ -76,7 +76,6 @@ static int h1940_hw_params(struct snd_pcm_substream *substream,
76{ 76{
77 struct snd_soc_pcm_runtime *rtd = substream->private_data; 77 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 78 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
79 struct snd_soc_dai *codec_dai = rtd->codec_dai;
80 int div; 79 int div;
81 int ret; 80 int ret;
82 unsigned int rate = params_rate(params); 81 unsigned int rate = params_rate(params);
@@ -95,18 +94,6 @@ static int h1940_hw_params(struct snd_pcm_substream *substream,
95 return -EINVAL; 94 return -EINVAL;
96 } 95 }
97 96
98 /* set codec DAI configuration */
99 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
100 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
101 if (ret < 0)
102 return ret;
103
104 /* set cpu DAI configuration */
105 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
106 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
107 if (ret < 0)
108 return ret;
109
110 /* select clock source */ 97 /* select clock source */
111 ret = snd_soc_dai_set_sysclk(cpu_dai, S3C24XX_CLKSRC_PCLK, rate, 98 ret = snd_soc_dai_set_sysclk(cpu_dai, S3C24XX_CLKSRC_PCLK, rate,
112 SND_SOC_CLOCK_OUT); 99 SND_SOC_CLOCK_OUT);
@@ -207,6 +194,8 @@ static struct snd_soc_dai_link h1940_uda1380_dai[] = {
207 .init = h1940_uda1380_init, 194 .init = h1940_uda1380_init,
208 .platform_name = "s3c24xx-iis", 195 .platform_name = "s3c24xx-iis",
209 .codec_name = "uda1380-codec.0-001a", 196 .codec_name = "uda1380-codec.0-001a",
197 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
198 SND_SOC_DAIFMT_CBS_CFS,
210 .ops = &h1940_ops, 199 .ops = &h1940_ops,
211 }, 200 },
212}; 201};
diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c
index b5f6abd9d221..6c3b359bb4c1 100644
--- a/sound/soc/samsung/jive_wm8750.c
+++ b/sound/soc/samsung/jive_wm8750.c
@@ -61,20 +61,6 @@ static int jive_hw_params(struct snd_pcm_substream *substream,
61 s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), 61 s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params),
62 s3c_i2sv2_get_clock(cpu_dai)); 62 s3c_i2sv2_get_clock(cpu_dai));
63 63
64 /* set codec DAI configuration */
65 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
66 SND_SOC_DAIFMT_NB_NF |
67 SND_SOC_DAIFMT_CBS_CFS);
68 if (ret < 0)
69 return ret;
70
71 /* set cpu DAI configuration */
72 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
73 SND_SOC_DAIFMT_NB_NF |
74 SND_SOC_DAIFMT_CBS_CFS);
75 if (ret < 0)
76 return ret;
77
78 /* set the codec system clock for DAC and ADC */ 64 /* set the codec system clock for DAC and ADC */
79 ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk, 65 ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
80 SND_SOC_CLOCK_IN); 66 SND_SOC_CLOCK_IN);
@@ -121,6 +107,8 @@ static struct snd_soc_dai_link jive_dai = {
121 .platform_name = "s3c2412-i2s", 107 .platform_name = "s3c2412-i2s",
122 .codec_name = "wm8750.0-001a", 108 .codec_name = "wm8750.0-001a",
123 .init = jive_wm8750_init, 109 .init = jive_wm8750_init,
110 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
111 SND_SOC_DAIFMT_CBS_CFS,
124 .ops = &jive_ops, 112 .ops = &jive_ops,
125}; 113};
126 114
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c
index 9b4a09f14b6c..65602b935377 100644
--- a/sound/soc/samsung/neo1973_wm8753.c
+++ b/sound/soc/samsung/neo1973_wm8753.c
@@ -70,20 +70,6 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream,
70 break; 70 break;
71 } 71 }
72 72
73 /* set codec DAI configuration */
74 ret = snd_soc_dai_set_fmt(codec_dai,
75 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
76 SND_SOC_DAIFMT_CBM_CFM);
77 if (ret < 0)
78 return ret;
79
80 /* set cpu DAI configuration */
81 ret = snd_soc_dai_set_fmt(cpu_dai,
82 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
83 SND_SOC_DAIFMT_CBM_CFM);
84 if (ret < 0)
85 return ret;
86
87 /* set the codec system clock for DAC and ADC */ 73 /* set the codec system clock for DAC and ADC */
88 ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_MCLK, pll_out, 74 ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_MCLK, pll_out,
89 SND_SOC_CLOCK_IN); 75 SND_SOC_CLOCK_IN);
@@ -151,13 +137,6 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream,
151 137
152 pcmdiv = WM8753_PCM_DIV_6; /* 2.048 MHz */ 138 pcmdiv = WM8753_PCM_DIV_6; /* 2.048 MHz */
153 139
154 /* todo: gg check mode (DSP_B) against CSR datasheet */
155 /* set codec DAI configuration */
156 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B |
157 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
158 if (ret < 0)
159 return ret;
160
161 /* set the codec system clock for DAC and ADC */ 140 /* set the codec system clock for DAC and ADC */
162 ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_PCMCLK, 12288000, 141 ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_PCMCLK, 12288000,
163 SND_SOC_CLOCK_IN); 142 SND_SOC_CLOCK_IN);
@@ -300,6 +279,8 @@ static struct snd_soc_dai_link neo1973_dai[] = {
300 .cpu_dai_name = "s3c24xx-iis", 279 .cpu_dai_name = "s3c24xx-iis",
301 .codec_dai_name = "wm8753-hifi", 280 .codec_dai_name = "wm8753-hifi",
302 .codec_name = "wm8753.0-001a", 281 .codec_name = "wm8753.0-001a",
282 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
283 SND_SOC_DAIFMT_CBM_CFM,
303 .init = neo1973_wm8753_init, 284 .init = neo1973_wm8753_init,
304 .ops = &neo1973_hifi_ops, 285 .ops = &neo1973_hifi_ops,
305}, 286},
@@ -309,6 +290,8 @@ static struct snd_soc_dai_link neo1973_dai[] = {
309 .cpu_dai_name = "bt-sco-pcm", 290 .cpu_dai_name = "bt-sco-pcm",
310 .codec_dai_name = "wm8753-voice", 291 .codec_dai_name = "wm8753-voice",
311 .codec_name = "wm8753.0-001a", 292 .codec_name = "wm8753.0-001a",
293 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
294 SND_SOC_DAIFMT_CBS_CFS,
312 .ops = &neo1973_voice_ops, 295 .ops = &neo1973_voice_ops,
313}, 296},
314}; 297};
diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c
index 37688ebbb2b4..873f2cb4bebe 100644
--- a/sound/soc/samsung/rx1950_uda1380.c
+++ b/sound/soc/samsung/rx1950_uda1380.c
@@ -89,6 +89,8 @@ static struct snd_soc_dai_link rx1950_uda1380_dai[] = {
89 .init = rx1950_uda1380_init, 89 .init = rx1950_uda1380_init,
90 .platform_name = "s3c24xx-iis", 90 .platform_name = "s3c24xx-iis",
91 .codec_name = "uda1380-codec.0-001a", 91 .codec_name = "uda1380-codec.0-001a",
92 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
93 SND_SOC_DAIFMT_CBS_CFS,
92 .ops = &rx1950_ops, 94 .ops = &rx1950_ops,
93 }, 95 },
94}; 96};
@@ -154,7 +156,6 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
154{ 156{
155 struct snd_soc_pcm_runtime *rtd = substream->private_data; 157 struct snd_soc_pcm_runtime *rtd = substream->private_data;
156 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 158 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
157 struct snd_soc_dai *codec_dai = rtd->codec_dai;
158 int div; 159 int div;
159 int ret; 160 int ret;
160 unsigned int rate = params_rate(params); 161 unsigned int rate = params_rate(params);
@@ -181,18 +182,6 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
181 return -EINVAL; 182 return -EINVAL;
182 } 183 }
183 184
184 /* set codec DAI configuration */
185 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
186 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
187 if (ret < 0)
188 return ret;
189
190 /* set cpu DAI configuration */
191 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
192 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
193 if (ret < 0)
194 return ret;
195
196 /* select clock source */ 185 /* select clock source */
197 ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source, rate, 186 ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source, rate,
198 SND_SOC_CLOCK_OUT); 187 SND_SOC_CLOCK_OUT);
diff --git a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c
index 2c015f62ead6..dcc008d1e1ab 100644
--- a/sound/soc/samsung/s3c24xx_simtec.c
+++ b/sound/soc/samsung/s3c24xx_simtec.c
@@ -169,24 +169,6 @@ static int simtec_hw_params(struct snd_pcm_substream *substream,
169 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 169 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
170 int ret; 170 int ret;
171 171
172 /* Set the CODEC as the bus clock master, I2S */
173 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
174 SND_SOC_DAIFMT_NB_NF |
175 SND_SOC_DAIFMT_CBM_CFM);
176 if (ret) {
177 pr_err("%s: failed set cpu dai format\n", __func__);
178 return ret;
179 }
180
181 /* Set the CODEC as the bus clock master */
182 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
183 SND_SOC_DAIFMT_NB_NF |
184 SND_SOC_DAIFMT_CBM_CFM);
185 if (ret) {
186 pr_err("%s: failed set codec dai format\n", __func__);
187 return ret;
188 }
189
190 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 172 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
191 CODEC_CLOCK, SND_SOC_CLOCK_IN); 173 CODEC_CLOCK, SND_SOC_CLOCK_IN);
192 if (ret) { 174 if (ret) {
@@ -320,6 +302,8 @@ int simtec_audio_core_probe(struct platform_device *pdev,
320 int ret; 302 int ret;
321 303
322 card->dai_link->ops = &simtec_snd_ops; 304 card->dai_link->ops = &simtec_snd_ops;
305 card->dai_link->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
306 SND_SOC_DAIFMT_CBM_CFM;
323 307
324 pdata = pdev->dev.platform_data; 308 pdata = pdev->dev.platform_data;
325 if (!pdata) { 309 if (!pdata) {
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
index 9c6f7db56f60..50849e137fc0 100644
--- a/sound/soc/samsung/s3c24xx_uda134x.c
+++ b/sound/soc/samsung/s3c24xx_uda134x.c
@@ -173,16 +173,6 @@ static int s3c24xx_uda134x_hw_params(struct snd_pcm_substream *substream,
173 return -EINVAL; 173 return -EINVAL;
174 } 174 }
175 175
176 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
177 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
178 if (ret < 0)
179 return ret;
180
181 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
182 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
183 if (ret < 0)
184 return ret;
185
186 ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source , clk, 176 ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source , clk,
187 SND_SOC_CLOCK_IN); 177 SND_SOC_CLOCK_IN);
188 if (ret < 0) 178 if (ret < 0)
@@ -223,6 +213,8 @@ static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = {
223 .codec_name = "uda134x-codec", 213 .codec_name = "uda134x-codec",
224 .codec_dai_name = "uda134x-hifi", 214 .codec_dai_name = "uda134x-hifi",
225 .cpu_dai_name = "s3c24xx-iis", 215 .cpu_dai_name = "s3c24xx-iis",
216 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
217 SND_SOC_DAIFMT_CBS_CFS,
226 .ops = &s3c24xx_uda134x_ops, 218 .ops = &s3c24xx_uda134x_ops,
227 .platform_name = "s3c24xx-iis", 219 .platform_name = "s3c24xx-iis",
228}; 220};
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
index 9b0ffacab790..8291d2a5f152 100644
--- a/sound/soc/samsung/smartq_wm8987.c
+++ b/sound/soc/samsung/smartq_wm8987.c
@@ -56,20 +56,6 @@ static int smartq_hifi_hw_params(struct snd_pcm_substream *substream,
56 break; 56 break;
57 } 57 }
58 58
59 /* set codec DAI configuration */
60 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
61 SND_SOC_DAIFMT_NB_NF |
62 SND_SOC_DAIFMT_CBS_CFS);
63 if (ret < 0)
64 return ret;
65
66 /* set cpu DAI configuration */
67 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
68 SND_SOC_DAIFMT_NB_NF |
69 SND_SOC_DAIFMT_CBS_CFS);
70 if (ret < 0)
71 return ret;
72
73 /* Use PCLK for I2S signal generation */ 59 /* Use PCLK for I2S signal generation */
74 ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0, 60 ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0,
75 0, SND_SOC_CLOCK_IN); 61 0, SND_SOC_CLOCK_IN);
@@ -199,6 +185,8 @@ static struct snd_soc_dai_link smartq_dai[] = {
199 .platform_name = "samsung-i2s.0", 185 .platform_name = "samsung-i2s.0",
200 .codec_name = "wm8750.0-0x1a", 186 .codec_name = "wm8750.0-0x1a",
201 .init = smartq_wm8987_init, 187 .init = smartq_wm8987_init,
188 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
189 SND_SOC_DAIFMT_CBS_CFS,
202 .ops = &smartq_hifi_ops, 190 .ops = &smartq_hifi_ops,
203 }, 191 },
204}; 192};
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c
index b1a519f83b29..17a2f717ec02 100644
--- a/sound/soc/samsung/smdk_wm8580.c
+++ b/sound/soc/samsung/smdk_wm8580.c
@@ -32,7 +32,6 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
32 struct snd_pcm_hw_params *params) 32 struct snd_pcm_hw_params *params)
33{ 33{
34 struct snd_soc_pcm_runtime *rtd = substream->private_data; 34 struct snd_soc_pcm_runtime *rtd = substream->private_data;
35 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
36 struct snd_soc_dai *codec_dai = rtd->codec_dai; 35 struct snd_soc_dai *codec_dai = rtd->codec_dai;
37 unsigned int pll_out; 36 unsigned int pll_out;
38 int bfs, rfs, ret; 37 int bfs, rfs, ret;
@@ -77,20 +76,6 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
77 } 76 }
78 pll_out = params_rate(params) * rfs; 77 pll_out = params_rate(params) * rfs;
79 78
80 /* Set the Codec DAI configuration */
81 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
82 | SND_SOC_DAIFMT_NB_NF
83 | SND_SOC_DAIFMT_CBM_CFM);
84 if (ret < 0)
85 return ret;
86
87 /* Set the AP DAI configuration */
88 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
89 | SND_SOC_DAIFMT_NB_NF
90 | SND_SOC_DAIFMT_CBM_CFM);
91 if (ret < 0)
92 return ret;
93
94 /* Set WM8580 to drive MCLK from its PLLA */ 79 /* Set WM8580 to drive MCLK from its PLLA */
95 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_MCLK, 80 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_MCLK,
96 WM8580_CLKSRC_PLLA); 81 WM8580_CLKSRC_PLLA);
@@ -168,6 +153,9 @@ enum {
168 SEC_PLAYBACK, 153 SEC_PLAYBACK,
169}; 154};
170 155
156#define SMDK_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
157 SND_SOC_DAIFMT_CBM_CFM)
158
171static struct snd_soc_dai_link smdk_dai[] = { 159static struct snd_soc_dai_link smdk_dai[] = {
172 [PRI_PLAYBACK] = { /* Primary Playback i/f */ 160 [PRI_PLAYBACK] = { /* Primary Playback i/f */
173 .name = "WM8580 PAIF RX", 161 .name = "WM8580 PAIF RX",
@@ -176,6 +164,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
176 .codec_dai_name = "wm8580-hifi-playback", 164 .codec_dai_name = "wm8580-hifi-playback",
177 .platform_name = "samsung-i2s.0", 165 .platform_name = "samsung-i2s.0",
178 .codec_name = "wm8580.0-001b", 166 .codec_name = "wm8580.0-001b",
167 .dai_fmt = SMDK_DAI_FMT,
179 .ops = &smdk_ops, 168 .ops = &smdk_ops,
180 }, 169 },
181 [PRI_CAPTURE] = { /* Primary Capture i/f */ 170 [PRI_CAPTURE] = { /* Primary Capture i/f */
@@ -185,6 +174,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
185 .codec_dai_name = "wm8580-hifi-capture", 174 .codec_dai_name = "wm8580-hifi-capture",
186 .platform_name = "samsung-i2s.0", 175 .platform_name = "samsung-i2s.0",
187 .codec_name = "wm8580.0-001b", 176 .codec_name = "wm8580.0-001b",
177 .dai_fmt = SMDK_DAI_FMT,
188 .init = smdk_wm8580_init_paiftx, 178 .init = smdk_wm8580_init_paiftx,
189 .ops = &smdk_ops, 179 .ops = &smdk_ops,
190 }, 180 },
@@ -195,6 +185,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
195 .codec_dai_name = "wm8580-hifi-playback", 185 .codec_dai_name = "wm8580-hifi-playback",
196 .platform_name = "samsung-i2s-sec", 186 .platform_name = "samsung-i2s-sec",
197 .codec_name = "wm8580.0-001b", 187 .codec_name = "wm8580.0-001b",
188 .dai_fmt = SMDK_DAI_FMT,
198 .ops = &smdk_ops, 189 .ops = &smdk_ops,
199 }, 190 },
200}; 191};
diff --git a/sound/soc/samsung/smdk_wm8580pcm.c b/sound/soc/samsung/smdk_wm8580pcm.c
index 05c609c62de9..6deec5234c92 100644
--- a/sound/soc/samsung/smdk_wm8580pcm.c
+++ b/sound/soc/samsung/smdk_wm8580pcm.c
@@ -62,20 +62,6 @@ static int smdk_wm8580_pcm_hw_params(struct snd_pcm_substream *substream,
62 62
63 rfs = mclk_freq / params_rate(params) / 2; 63 rfs = mclk_freq / params_rate(params) / 2;
64 64
65 /* Set the codec DAI configuration */
66 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B
67 | SND_SOC_DAIFMT_IB_NF
68 | SND_SOC_DAIFMT_CBS_CFS);
69 if (ret < 0)
70 return ret;
71
72 /* Set the cpu DAI configuration */
73 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_B
74 | SND_SOC_DAIFMT_IB_NF
75 | SND_SOC_DAIFMT_CBS_CFS);
76 if (ret < 0)
77 return ret;
78
79 if (mclk_freq == xtal_freq) { 65 if (mclk_freq == xtal_freq) {
80 ret = snd_soc_dai_set_sysclk(codec_dai, WM8580_CLKSRC_MCLK, 66 ret = snd_soc_dai_set_sysclk(codec_dai, WM8580_CLKSRC_MCLK,
81 mclk_freq, SND_SOC_CLOCK_IN); 67 mclk_freq, SND_SOC_CLOCK_IN);
@@ -121,6 +107,9 @@ static struct snd_soc_ops smdk_wm8580_pcm_ops = {
121 .hw_params = smdk_wm8580_pcm_hw_params, 107 .hw_params = smdk_wm8580_pcm_hw_params,
122}; 108};
123 109
110#define SMDK_DAI_FMT (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF | \
111 SND_SOC_DAIFMT_CBS_CFS)
112
124static struct snd_soc_dai_link smdk_dai[] = { 113static struct snd_soc_dai_link smdk_dai[] = {
125 { 114 {
126 .name = "WM8580 PAIF PCM RX", 115 .name = "WM8580 PAIF PCM RX",
@@ -129,6 +118,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
129 .codec_dai_name = "wm8580-hifi-playback", 118 .codec_dai_name = "wm8580-hifi-playback",
130 .platform_name = "samsung-audio", 119 .platform_name = "samsung-audio",
131 .codec_name = "wm8580.0-001b", 120 .codec_name = "wm8580.0-001b",
121 .dai_fmt = SMDK_DAI_FMT,
132 .ops = &smdk_wm8580_pcm_ops, 122 .ops = &smdk_wm8580_pcm_ops,
133 }, { 123 }, {
134 .name = "WM8580 PAIF PCM TX", 124 .name = "WM8580 PAIF PCM TX",
@@ -137,6 +127,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
137 .codec_dai_name = "wm8580-hifi-capture", 127 .codec_dai_name = "wm8580-hifi-capture",
138 .platform_name = "samsung-pcm.0", 128 .platform_name = "samsung-pcm.0",
139 .codec_name = "wm8580.0-001b", 129 .codec_name = "wm8580.0-001b",
130 .dai_fmt = SMDK_DAI_FMT,
140 .ops = &smdk_wm8580_pcm_ops, 131 .ops = &smdk_wm8580_pcm_ops,
141 }, 132 },
142}; 133};
diff --git a/sound/soc/samsung/smdk_wm8994pcm.c b/sound/soc/samsung/smdk_wm8994pcm.c
index c470e8eed6e1..b1c89ec2d999 100644
--- a/sound/soc/samsung/smdk_wm8994pcm.c
+++ b/sound/soc/samsung/smdk_wm8994pcm.c
@@ -68,20 +68,6 @@ static int smdk_wm8994_pcm_hw_params(struct snd_pcm_substream *substream,
68 68
69 mclk_freq = params_rate(params) * rfs; 69 mclk_freq = params_rate(params) * rfs;
70 70
71 /* Set the codec DAI configuration */
72 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B
73 | SND_SOC_DAIFMT_IB_NF
74 | SND_SOC_DAIFMT_CBS_CFS);
75 if (ret < 0)
76 return ret;
77
78 /* Set the cpu DAI configuration */
79 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_B
80 | SND_SOC_DAIFMT_IB_NF
81 | SND_SOC_DAIFMT_CBS_CFS);
82 if (ret < 0)
83 return ret;
84
85 ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, 71 ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1,
86 mclk_freq, SND_SOC_CLOCK_IN); 72 mclk_freq, SND_SOC_CLOCK_IN);
87 if (ret < 0) 73 if (ret < 0)
@@ -118,6 +104,8 @@ static struct snd_soc_dai_link smdk_dai[] = {
118 .codec_dai_name = "wm8994-aif1", 104 .codec_dai_name = "wm8994-aif1",
119 .platform_name = "samsung-pcm.0", 105 .platform_name = "samsung-pcm.0",
120 .codec_name = "wm8994-codec", 106 .codec_name = "wm8994-codec",
107 .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF |
108 SND_SOC_DAIFMT_CBS_CFS,
121 .ops = &smdk_wm8994_pcm_ops, 109 .ops = &smdk_wm8994_pcm_ops,
122 }, 110 },
123}; 111};
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c
index c58c2529f103..82f582344fe7 100644
--- a/sound/soc/sh/migor.c
+++ b/sound/soc/sh/migor.c
@@ -63,16 +63,6 @@ static int migor_hw_params(struct snd_pcm_substream *substream,
63 if (ret < 0) 63 if (ret < 0)
64 return ret; 64 return ret;
65 65
66 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_NB_IF |
67 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS);
68 if (ret < 0)
69 return ret;
70
71 ret = snd_soc_dai_set_fmt(rtd->cpu_dai, SND_SOC_DAIFMT_NB_IF |
72 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS);
73 if (ret < 0)
74 return ret;
75
76 codec_freq = rate * 512; 66 codec_freq = rate * 512;
77 /* 67 /*
78 * This propagates the parent frequency change to children and 68 * This propagates the parent frequency change to children and
@@ -144,6 +134,8 @@ static struct snd_soc_dai_link migor_dai = {
144 .codec_dai_name = "wm8978-hifi", 134 .codec_dai_name = "wm8978-hifi",
145 .platform_name = "siu-pcm-audio", 135 .platform_name = "siu-pcm-audio",
146 .codec_name = "wm8978.0-001a", 136 .codec_name = "wm8978.0-001a",
137 .dai_fmt = SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_I2S |
138 SND_SOC_DAIFMT_CBS_CFS,
147 .ops = &migor_dai_ops, 139 .ops = &migor_dai_ops,
148}; 140};
149 141
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9f6641bc1e17..678823d2e14a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1437,11 +1437,76 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec)
1437 return 0; 1437 return 0;
1438} 1438}
1439 1439
1440/**
1441 * snd_soc_runtime_set_dai_fmt() - Change DAI link format for a ASoC runtime
1442 * @rtd: The runtime for which the DAI link format should be changed
1443 * @dai_fmt: The new DAI link format
1444 *
1445 * This function updates the DAI link format for all DAIs connected to the DAI
1446 * link for the specified runtime.
1447 *
1448 * Note: For setups with a static format set the dai_fmt field in the
1449 * corresponding snd_dai_link struct instead of using this function.
1450 *
1451 * Returns 0 on success, otherwise a negative error code.
1452 */
1453int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
1454 unsigned int dai_fmt)
1455{
1456 struct snd_soc_dai **codec_dais = rtd->codec_dais;
1457 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
1458 unsigned int i;
1459 int ret;
1460
1461 for (i = 0; i < rtd->num_codecs; i++) {
1462 struct snd_soc_dai *codec_dai = codec_dais[i];
1463
1464 ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
1465 if (ret != 0 && ret != -ENOTSUPP) {
1466 dev_warn(codec_dai->dev,
1467 "ASoC: Failed to set DAI format: %d\n", ret);
1468 return ret;
1469 }
1470 }
1471
1472 /* Flip the polarity for the "CPU" end of a CODEC<->CODEC link */
1473 if (cpu_dai->codec) {
1474 unsigned int inv_dai_fmt;
1475
1476 inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK;
1477 switch (dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1478 case SND_SOC_DAIFMT_CBM_CFM:
1479 inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
1480 break;
1481 case SND_SOC_DAIFMT_CBM_CFS:
1482 inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
1483 break;
1484 case SND_SOC_DAIFMT_CBS_CFM:
1485 inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
1486 break;
1487 case SND_SOC_DAIFMT_CBS_CFS:
1488 inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
1489 break;
1490 }
1491
1492 dai_fmt = inv_dai_fmt;
1493 }
1494
1495 ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
1496 if (ret != 0 && ret != -ENOTSUPP) {
1497 dev_warn(cpu_dai->dev,
1498 "ASoC: Failed to set DAI format: %d\n", ret);
1499 return ret;
1500 }
1501
1502 return 0;
1503}
1504EXPORT_SYMBOL_GPL(snd_soc_runtime_set_dai_fmt);
1505
1440static int snd_soc_instantiate_card(struct snd_soc_card *card) 1506static int snd_soc_instantiate_card(struct snd_soc_card *card)
1441{ 1507{
1442 struct snd_soc_codec *codec; 1508 struct snd_soc_codec *codec;
1443 struct snd_soc_dai_link *dai_link; 1509 int ret, i, order;
1444 int ret, i, order, dai_fmt;
1445 1510
1446 mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT); 1511 mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
1447 1512
@@ -1552,60 +1617,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1552 card->num_dapm_routes); 1617 card->num_dapm_routes);
1553 1618
1554 for (i = 0; i < card->num_links; i++) { 1619 for (i = 0; i < card->num_links; i++) {
1555 struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; 1620 if (card->dai_link[i].dai_fmt)
1556 dai_link = &card->dai_link[i]; 1621 snd_soc_runtime_set_dai_fmt(&card->rtd[i],
1557 dai_fmt = dai_link->dai_fmt; 1622 card->dai_link[i].dai_fmt);
1558
1559 if (dai_fmt) {
1560 struct snd_soc_dai **codec_dais = rtd->codec_dais;
1561 int j;
1562
1563 for (j = 0; j < rtd->num_codecs; j++) {
1564 struct snd_soc_dai *codec_dai = codec_dais[j];
1565
1566 ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
1567 if (ret != 0 && ret != -ENOTSUPP)
1568 dev_warn(codec_dai->dev,
1569 "ASoC: Failed to set DAI format: %d\n",
1570 ret);
1571 }
1572 }
1573
1574 /* If this is a regular CPU link there will be a platform */
1575 if (dai_fmt &&
1576 (dai_link->platform_name || dai_link->platform_of_node)) {
1577 ret = snd_soc_dai_set_fmt(card->rtd[i].cpu_dai,
1578 dai_fmt);
1579 if (ret != 0 && ret != -ENOTSUPP)
1580 dev_warn(card->rtd[i].cpu_dai->dev,
1581 "ASoC: Failed to set DAI format: %d\n",
1582 ret);
1583 } else if (dai_fmt) {
1584 /* Flip the polarity for the "CPU" end */
1585 dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
1586 switch (dai_link->dai_fmt &
1587 SND_SOC_DAIFMT_MASTER_MASK) {
1588 case SND_SOC_DAIFMT_CBM_CFM:
1589 dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
1590 break;
1591 case SND_SOC_DAIFMT_CBM_CFS:
1592 dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
1593 break;
1594 case SND_SOC_DAIFMT_CBS_CFM:
1595 dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
1596 break;
1597 case SND_SOC_DAIFMT_CBS_CFS:
1598 dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
1599 break;
1600 }
1601
1602 ret = snd_soc_dai_set_fmt(card->rtd[i].cpu_dai,
1603 dai_fmt);
1604 if (ret != 0 && ret != -ENOTSUPP)
1605 dev_warn(card->rtd[i].cpu_dai->dev,
1606 "ASoC: Failed to set DAI format: %d\n",
1607 ret);
1608 }
1609 } 1623 }
1610 1624
1611 snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname), 1625 snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname),
diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c
index be4f1ac7cd5e..aa65370db82a 100644
--- a/sound/soc/ux500/mop500_ab8500.c
+++ b/sound/soc/ux500/mop500_ab8500.c
@@ -290,21 +290,9 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream,
290 SND_SOC_DAIFMT_GATED; 290 SND_SOC_DAIFMT_GATED;
291 } 291 }
292 292
293 ret = snd_soc_dai_set_fmt(codec_dai, fmt); 293 ret = snd_soc_runtime_set_dai_fmt(rtd, fmt);
294 if (ret < 0) { 294 if (ret)
295 dev_err(dev,
296 "%s: ERROR: snd_soc_dai_set_fmt failed for codec_dai (ret = %d)!\n",
297 __func__, ret);
298 return ret;
299 }
300
301 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
302 if (ret < 0) {
303 dev_err(dev,
304 "%s: ERROR: snd_soc_dai_set_fmt failed for cpu_dai (ret = %d)!\n",
305 __func__, ret);
306 return ret; 295 return ret;
307 }
308 296
309 /* Setup TDM-slots */ 297 /* Setup TDM-slots */
310 298