aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-08-11 08:09:27 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-08-11 08:09:27 -0400
commit1921bab217c2c21e4b8dc78332f6ae11515fc014 (patch)
tree0577922c34d491b34c6a5aa47dab950c073ada12 /sound
parent17244c24f95ba61a12b6afeab5780a1e3f1a4c57 (diff)
parenta5479e389e989acfeca9c32eeb0083d086202280 (diff)
Merge commit 'a5479e389e989acfeca9c32eeb0083d086202280' into for-2.6.32
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm9081.c5
-rw-r--r--sound/soc/pxa/magician.c2
-rw-r--r--sound/soc/pxa/pxa-ssp.c27
-rw-r--r--sound/soc/soc-core.c9
4 files changed, 30 insertions, 13 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index 1f51dd542a46..c147f2b8723d 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1149,8 +1149,9 @@ static int wm9081_set_sysclk(struct snd_soc_dai *codec_dai,
1149 return 0; 1149 return 0;
1150} 1150}
1151 1151
1152/* FIXME: Needs to handle slot_width */
1152static int wm9081_set_tdm_slot(struct snd_soc_dai *dai, 1153static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
1153 unsigned int mask, int slots) 1154 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
1154{ 1155{
1155 struct snd_soc_codec *codec = dai->codec; 1156 struct snd_soc_codec *codec = dai->codec;
1156 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1); 1157 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1);
@@ -1162,7 +1163,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
1162 1163
1163 aif1 |= (slots - 1) << WM9081_AIFDAC_TDM_MODE_SHIFT; 1164 aif1 |= (slots - 1) << WM9081_AIFDAC_TDM_MODE_SHIFT;
1164 1165
1165 switch (mask) { 1166 switch (rx_mask) {
1166 case 1: 1167 case 1:
1167 break; 1168 break;
1168 case 2: 1169 case 2:
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index 8889cd371608..9f7c61e23daf 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -190,7 +190,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
190 if (ret < 0) 190 if (ret < 0)
191 return ret; 191 return ret;
192 192
193 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 1, 1); 193 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 1, 0, 1, width);
194 if (ret < 0) 194 if (ret < 0)
195 return ret; 195 return ret;
196 196
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index e22c5cef8fec..5b9ed6464789 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -375,21 +375,34 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai,
375 * Set the active slots in TDM/Network mode 375 * Set the active slots in TDM/Network mode
376 */ 376 */
377static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, 377static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
378 unsigned int mask, int slots) 378 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
379{ 379{
380 struct ssp_priv *priv = cpu_dai->private_data; 380 struct ssp_priv *priv = cpu_dai->private_data;
381 struct ssp_device *ssp = priv->dev.ssp; 381 struct ssp_device *ssp = priv->dev.ssp;
382 u32 sscr0; 382 u32 sscr0;
383 383
384 sscr0 = ssp_read_reg(ssp, SSCR0) & ~SSCR0_SlotsPerFrm(7); 384 sscr0 = ssp_read_reg(ssp, SSCR0);
385 sscr0 &= ~(SSCR0_MOD | SSCR0_SlotsPerFrm(8) | SSCR0_EDSS | SSCR0_DSS);
386
387 /* set slot width */
388 if (slot_width > 16)
389 sscr0 |= SSCR0_EDSS | SSCR0_DataSize(slot_width - 16);
390 else
391 sscr0 |= SSCR0_DataSize(slot_width);
385 392
386 /* set number of active slots */ 393 if (slots > 1) {
387 sscr0 |= SSCR0_SlotsPerFrm(slots); 394 /* enable network mode */
395 sscr0 |= SSCR0_MOD;
396
397 /* set number of active slots */
398 sscr0 |= SSCR0_SlotsPerFrm(slots);
399
400 /* set active slot mask */
401 ssp_write_reg(ssp, SSTSA, tx_mask);
402 ssp_write_reg(ssp, SSRSA, rx_mask);
403 }
388 ssp_write_reg(ssp, SSCR0, sscr0); 404 ssp_write_reg(ssp, SSCR0, sscr0);
389 405
390 /* set active slot mask */
391 ssp_write_reg(ssp, SSTSA, mask);
392 ssp_write_reg(ssp, SSRSA, mask);
393 return 0; 406 return 0;
394} 407}
395 408
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fb8d7a766155..e984a17cd656 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2223,17 +2223,20 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt);
2223/** 2223/**
2224 * snd_soc_dai_set_tdm_slot - configure DAI TDM. 2224 * snd_soc_dai_set_tdm_slot - configure DAI TDM.
2225 * @dai: DAI 2225 * @dai: DAI
2226 * @mask: DAI specific mask representing used slots. 2226 * @tx_mask: bitmask representing active TX slots.
2227 * @rx_mask: bitmask representing active RX slots.
2227 * @slots: Number of slots in use. 2228 * @slots: Number of slots in use.
2229 * @slot_width: Width in bits for each slot.
2228 * 2230 *
2229 * Configures a DAI for TDM operation. Both mask and slots are codec and DAI 2231 * Configures a DAI for TDM operation. Both mask and slots are codec and DAI
2230 * specific. 2232 * specific.
2231 */ 2233 */
2232int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, 2234int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
2233 unsigned int mask, int slots) 2235 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
2234{ 2236{
2235 if (dai->ops && dai->ops->set_tdm_slot) 2237 if (dai->ops && dai->ops->set_tdm_slot)
2236 return dai->ops->set_tdm_slot(dai, mask, slots); 2238 return dai->ops->set_tdm_slot(dai, tx_mask, rx_mask,
2239 slots, slot_width);
2237 else 2240 else
2238 return -EINVAL; 2241 return -EINVAL;
2239} 2242}