aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
authorDaniel Ribeiro <drwyrm@gmail.com>2009-06-15 20:44:31 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-08-06 10:52:24 -0400
commita5479e389e989acfeca9c32eeb0083d086202280 (patch)
tree5bcc8940b9e7981916d1e9812957b72d6b82b8af /sound/soc/pxa
parent9029bb316bb99ccc7f0518c4d3e0d6adc0729c4f (diff)
ASoC: change set_tdm_slot api to allow slot_width override.
Extend set_tdm_slot to allow the user to arbitrarily set the frame width and active TX/RX slots. Updates magician.c and wm9081.c for the new set_tdm_slot(). wm9081.c still doesn't handle the slot_width override. While being there, correct an incorrect use of SlotsPerFrm(7) use in bitmask on pxa-ssp.c (SSCR0_SlotsPerFrm(x) is (((x) - 1) << 24)) ). (this series is meant for Mark's for-2.6.32 branch) Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/magician.c2
-rw-r--r--sound/soc/pxa/pxa-ssp.c27
2 files changed, 21 insertions, 8 deletions
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