diff options
Diffstat (limited to 'sound/soc/pxa/pxa-ssp.c')
-rw-r--r-- | sound/soc/pxa/pxa-ssp.c | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 19c45409d94..5b9ed646478 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 | */ |
377 | static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | 377 | static 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); | ||
392 | |||
393 | if (slots > 1) { | ||
394 | /* enable network mode */ | ||
395 | sscr0 |= SSCR0_MOD; | ||
385 | 396 | ||
386 | /* set number of active slots */ | 397 | /* set number of active slots */ |
387 | sscr0 |= SSCR0_SlotsPerFrm(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 | ||
@@ -457,31 +470,27 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
457 | return -EINVAL; | 470 | return -EINVAL; |
458 | } | 471 | } |
459 | 472 | ||
460 | ssp_write_reg(ssp, SSCR0, sscr0); | 473 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
461 | ssp_write_reg(ssp, SSCR1, sscr1); | 474 | case SND_SOC_DAIFMT_NB_NF: |
462 | ssp_write_reg(ssp, SSPSP, sspsp); | 475 | sspsp |= SSPSP_SFRMP; |
476 | break; | ||
477 | case SND_SOC_DAIFMT_NB_IF: | ||
478 | break; | ||
479 | case SND_SOC_DAIFMT_IB_IF: | ||
480 | sspsp |= SSPSP_SCMODE(2); | ||
481 | break; | ||
482 | case SND_SOC_DAIFMT_IB_NF: | ||
483 | sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP; | ||
484 | break; | ||
485 | default: | ||
486 | return -EINVAL; | ||
487 | } | ||
463 | 488 | ||
464 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 489 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
465 | case SND_SOC_DAIFMT_I2S: | 490 | case SND_SOC_DAIFMT_I2S: |
466 | sscr0 |= SSCR0_PSP; | 491 | sscr0 |= SSCR0_PSP; |
467 | sscr1 |= SSCR1_RWOT | SSCR1_TRAIL; | 492 | sscr1 |= SSCR1_RWOT | SSCR1_TRAIL; |
468 | |||
469 | /* See hw_params() */ | 493 | /* See hw_params() */ |
470 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
471 | case SND_SOC_DAIFMT_NB_NF: | ||
472 | sspsp |= SSPSP_SFRMP; | ||
473 | break; | ||
474 | case SND_SOC_DAIFMT_NB_IF: | ||
475 | break; | ||
476 | case SND_SOC_DAIFMT_IB_IF: | ||
477 | sspsp |= SSPSP_SCMODE(2); | ||
478 | break; | ||
479 | case SND_SOC_DAIFMT_IB_NF: | ||
480 | sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP; | ||
481 | break; | ||
482 | default: | ||
483 | return -EINVAL; | ||
484 | } | ||
485 | break; | 494 | break; |
486 | 495 | ||
487 | case SND_SOC_DAIFMT_DSP_A: | 496 | case SND_SOC_DAIFMT_DSP_A: |
@@ -489,22 +498,6 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
489 | case SND_SOC_DAIFMT_DSP_B: | 498 | case SND_SOC_DAIFMT_DSP_B: |
490 | sscr0 |= SSCR0_MOD | SSCR0_PSP; | 499 | sscr0 |= SSCR0_MOD | SSCR0_PSP; |
491 | sscr1 |= SSCR1_TRAIL | SSCR1_RWOT; | 500 | sscr1 |= SSCR1_TRAIL | SSCR1_RWOT; |
492 | |||
493 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
494 | case SND_SOC_DAIFMT_NB_NF: | ||
495 | sspsp |= SSPSP_SFRMP; | ||
496 | break; | ||
497 | case SND_SOC_DAIFMT_NB_IF: | ||
498 | break; | ||
499 | case SND_SOC_DAIFMT_IB_IF: | ||
500 | sspsp |= SSPSP_SCMODE(2); | ||
501 | break; | ||
502 | case SND_SOC_DAIFMT_IB_NF: | ||
503 | sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP; | ||
504 | break; | ||
505 | default: | ||
506 | return -EINVAL; | ||
507 | } | ||
508 | break; | 501 | break; |
509 | 502 | ||
510 | default: | 503 | default: |