aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-20 07:45:40 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-20 07:45:40 -0400
commit9b5b0c01598f9782690b09ce6c49f4ba116dde44 (patch)
treedc8f4f66ed75f0b4843619362e088618e160847c /sound/soc/pxa
parent7154b3e80203ee91f9ba7d0a43d3daa05c49d9e9 (diff)
parentb08f7a62cafd7998862072a1c353219e3d84bbef (diff)
Merge branch 'for-2.6.30' into for-2.6.31
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/pxa-ssp.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 487079550e71..b9b61ddca6ba 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -280,12 +280,33 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
280 * ssp_set_clkdiv - set SSP clock divider 280 * ssp_set_clkdiv - set SSP clock divider
281 * @div: serial clock rate divider 281 * @div: serial clock rate divider
282 */ 282 */
283static void ssp_set_scr(struct ssp_dev *dev, u32 div) 283static void ssp_set_scr(struct ssp_device *ssp, u32 div)
284{ 284{
285 struct ssp_device *ssp = dev->ssp; 285 u32 sscr0 = ssp_read_reg(ssp, SSCR0);
286 u32 sscr0 = ssp_read_reg(dev->ssp, SSCR0) & ~SSCR0_SCR; 286
287 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) {
288 sscr0 &= ~0x0000ff00;
289 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */
290 } else {
291 sscr0 &= ~0x000fff00;
292 sscr0 |= (div - 1) << 8; /* 1..4096 */
293 }
294 ssp_write_reg(ssp, SSCR0, sscr0);
295}
296
297/**
298 * ssp_get_clkdiv - get SSP clock divider
299 */
300static u32 ssp_get_scr(struct ssp_device *ssp)
301{
302 u32 sscr0 = ssp_read_reg(ssp, SSCR0);
303 u32 div;
287 304
288 ssp_write_reg(ssp, SSCR0, (sscr0 | SSCR0_SerClkDiv(div))); 305 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP)
306 div = ((sscr0 >> 8) & 0xff) * 2 + 2;
307 else
308 div = ((sscr0 >> 8) & 0xfff) + 1;
309 return div;
289} 310}
290 311
291/* 312/*
@@ -326,7 +347,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
326 break; 347 break;
327 case PXA_SSP_CLK_AUDIO: 348 case PXA_SSP_CLK_AUDIO:
328 priv->sysclk = 0; 349 priv->sysclk = 0;
329 ssp_set_scr(&priv->dev, 1); 350 ssp_set_scr(ssp, 1);
330 sscr0 |= SSCR0_ACS; 351 sscr0 |= SSCR0_ACS;
331 break; 352 break;
332 default: 353 default:
@@ -387,7 +408,7 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
387 ssp_write_reg(ssp, SSACD, val); 408 ssp_write_reg(ssp, SSACD, val);
388 break; 409 break;
389 case PXA_SSP_DIV_SCR: 410 case PXA_SSP_DIV_SCR:
390 ssp_set_scr(&priv->dev, div); 411 ssp_set_scr(ssp, div);
391 break; 412 break;
392 default: 413 default:
393 return -ENODEV; 414 return -ENODEV;
@@ -683,8 +704,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
683 case SND_SOC_DAIFMT_I2S: 704 case SND_SOC_DAIFMT_I2S:
684 sspsp = ssp_read_reg(ssp, SSPSP); 705 sspsp = ssp_read_reg(ssp, SSPSP);
685 706
686 if (((sscr0 & SSCR0_SCR) == SSCR0_SerClkDiv(4)) && 707 if ((ssp_get_scr(ssp) == 4) && (width == 16)) {
687 (width == 16)) {
688 /* This is a special case where the bitclk is 64fs 708 /* This is a special case where the bitclk is 64fs
689 * and we're not dealing with 2*32 bits of audio 709 * and we're not dealing with 2*32 bits of audio
690 * samples. 710 * samples.