diff options
author | Jarkko Nikula <jarkko.nikula@bitmer.com> | 2011-09-30 03:55:32 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-30 07:56:17 -0400 |
commit | 91a18ae8ffc05ffd445c5b40e5ca266888b360ce (patch) | |
tree | 55d232dd4c530a43a7e6ad751c825c7cf4cdea29 /sound/soc/omap/omap-mcbsp.c | |
parent | f34dafb287a33ffda2f2a122daecedea474a4181 (diff) |
ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formats
Commit 75d9ac4 ("ASoC: Allow DAI formats to be specified in the dai_link")
changed DAI format flag values and we cannot simply invert anymore e.g.
frame-sync with ^= SND_SOC_DAIFMT_NB_IF (which was anyway misuse) as there
is no anymore fixed bit position for bit-clock or frame-sync inversion.
Fix this by relying only on DAI format flag values passed to us and by not
making any assumption on individual bit positions.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap/omap-mcbsp.c')
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 1391ea0dd3ce..894f2f33f508 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -398,7 +398,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
398 | { | 398 | { |
399 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); | 399 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
400 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 400 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
401 | unsigned int temp_fmt = fmt; | 401 | bool inv_fs = false; |
402 | 402 | ||
403 | if (mcbsp_data->configured) | 403 | if (mcbsp_data->configured) |
404 | return 0; | 404 | return 0; |
@@ -430,21 +430,21 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
430 | regs->xcr2 |= XDATDLY(0); | 430 | regs->xcr2 |= XDATDLY(0); |
431 | regs->spcr1 |= RJUST(2); | 431 | regs->spcr1 |= RJUST(2); |
432 | /* Invert FS polarity configuration */ | 432 | /* Invert FS polarity configuration */ |
433 | temp_fmt ^= SND_SOC_DAIFMT_NB_IF; | 433 | inv_fs = true; |
434 | break; | 434 | break; |
435 | case SND_SOC_DAIFMT_DSP_A: | 435 | case SND_SOC_DAIFMT_DSP_A: |
436 | /* 1-bit data delay */ | 436 | /* 1-bit data delay */ |
437 | regs->rcr2 |= RDATDLY(1); | 437 | regs->rcr2 |= RDATDLY(1); |
438 | regs->xcr2 |= XDATDLY(1); | 438 | regs->xcr2 |= XDATDLY(1); |
439 | /* Invert FS polarity configuration */ | 439 | /* Invert FS polarity configuration */ |
440 | temp_fmt ^= SND_SOC_DAIFMT_NB_IF; | 440 | inv_fs = true; |
441 | break; | 441 | break; |
442 | case SND_SOC_DAIFMT_DSP_B: | 442 | case SND_SOC_DAIFMT_DSP_B: |
443 | /* 0-bit data delay */ | 443 | /* 0-bit data delay */ |
444 | regs->rcr2 |= RDATDLY(0); | 444 | regs->rcr2 |= RDATDLY(0); |
445 | regs->xcr2 |= XDATDLY(0); | 445 | regs->xcr2 |= XDATDLY(0); |
446 | /* Invert FS polarity configuration */ | 446 | /* Invert FS polarity configuration */ |
447 | temp_fmt ^= SND_SOC_DAIFMT_NB_IF; | 447 | inv_fs = true; |
448 | break; | 448 | break; |
449 | default: | 449 | default: |
450 | /* Unsupported data format */ | 450 | /* Unsupported data format */ |
@@ -468,7 +468,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
468 | } | 468 | } |
469 | 469 | ||
470 | /* Set bit clock (CLKX/CLKR) and FS polarities */ | 470 | /* Set bit clock (CLKX/CLKR) and FS polarities */ |
471 | switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) { | 471 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
472 | case SND_SOC_DAIFMT_NB_NF: | 472 | case SND_SOC_DAIFMT_NB_NF: |
473 | /* | 473 | /* |
474 | * Normal BCLK + FS. | 474 | * Normal BCLK + FS. |
@@ -489,6 +489,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
489 | default: | 489 | default: |
490 | return -EINVAL; | 490 | return -EINVAL; |
491 | } | 491 | } |
492 | if (inv_fs == true) | ||
493 | regs->pcr0 ^= FSXP | FSRP; | ||
492 | 494 | ||
493 | return 0; | 495 | return 0; |
494 | } | 496 | } |