diff options
author | Daniel Mack <zonque@gmail.com> | 2014-03-27 06:27:40 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-18 13:55:42 -0400 |
commit | 6479285d8aa1cbf22d21706370e812e7af51241c (patch) | |
tree | a5f21695a50bce22ec6c12af83feb255660e0534 | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
ASoC: davinci-mcasp: set up channel status bits for S/PDIF mode
In DIT (S/PDIF) mode, program the transmitted user bits to reflect the
configured sample rate, along with some other details.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 9afb14629a17..121971e1371e 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/of_platform.h> | 27 | #include <linux/of_platform.h> |
28 | #include <linux/of_device.h> | 28 | #include <linux/of_device.h> |
29 | 29 | ||
30 | #include <sound/asoundef.h> | ||
30 | #include <sound/core.h> | 31 | #include <sound/core.h> |
31 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
32 | #include <sound/pcm_params.h> | 33 | #include <sound/pcm_params.h> |
@@ -637,8 +638,12 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream) | |||
637 | } | 638 | } |
638 | 639 | ||
639 | /* S/PDIF */ | 640 | /* S/PDIF */ |
640 | static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp) | 641 | static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp, |
642 | unsigned int rate) | ||
641 | { | 643 | { |
644 | u32 cs_value = 0; | ||
645 | u8 *cs_bytes = (u8*) &cs_value; | ||
646 | |||
642 | /* Set the TX format : 24 bit right rotation, 32 bit slot, Pad 0 | 647 | /* Set the TX format : 24 bit right rotation, 32 bit slot, Pad 0 |
643 | and LSB first */ | 648 | and LSB first */ |
644 | mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(6) | TXSSZ(15)); | 649 | mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(6) | TXSSZ(15)); |
@@ -660,6 +665,46 @@ static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp) | |||
660 | /* Enable the DIT */ | 665 | /* Enable the DIT */ |
661 | mcasp_set_bits(mcasp, DAVINCI_MCASP_TXDITCTL_REG, DITEN); | 666 | mcasp_set_bits(mcasp, DAVINCI_MCASP_TXDITCTL_REG, DITEN); |
662 | 667 | ||
668 | /* Set S/PDIF channel status bits */ | ||
669 | cs_bytes[0] = IEC958_AES0_CON_NOT_COPYRIGHT; | ||
670 | cs_bytes[1] = IEC958_AES1_CON_PCM_CODER; | ||
671 | |||
672 | switch (rate) { | ||
673 | case 22050: | ||
674 | cs_bytes[3] |= IEC958_AES3_CON_FS_22050; | ||
675 | break; | ||
676 | case 24000: | ||
677 | cs_bytes[3] |= IEC958_AES3_CON_FS_24000; | ||
678 | break; | ||
679 | case 32000: | ||
680 | cs_bytes[3] |= IEC958_AES3_CON_FS_32000; | ||
681 | break; | ||
682 | case 44100: | ||
683 | cs_bytes[3] |= IEC958_AES3_CON_FS_44100; | ||
684 | break; | ||
685 | case 48000: | ||
686 | cs_bytes[3] |= IEC958_AES3_CON_FS_48000; | ||
687 | break; | ||
688 | case 88200: | ||
689 | cs_bytes[3] |= IEC958_AES3_CON_FS_88200; | ||
690 | break; | ||
691 | case 96000: | ||
692 | cs_bytes[3] |= IEC958_AES3_CON_FS_96000; | ||
693 | break; | ||
694 | case 176400: | ||
695 | cs_bytes[3] |= IEC958_AES3_CON_FS_176400; | ||
696 | break; | ||
697 | case 192000: | ||
698 | cs_bytes[3] |= IEC958_AES3_CON_FS_192000; | ||
699 | break; | ||
700 | default: | ||
701 | printk(KERN_WARNING "unsupported sampling rate: %d\n", rate); | ||
702 | return -EINVAL; | ||
703 | } | ||
704 | |||
705 | mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRA_REG, cs_value); | ||
706 | mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRB_REG, cs_value); | ||
707 | |||
663 | return 0; | 708 | return 0; |
664 | } | 709 | } |
665 | 710 | ||
@@ -692,7 +737,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
692 | return ret; | 737 | return ret; |
693 | 738 | ||
694 | if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) | 739 | if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) |
695 | ret = mcasp_dit_hw_param(mcasp); | 740 | ret = mcasp_dit_hw_param(mcasp, params_rate(params)); |
696 | else | 741 | else |
697 | ret = mcasp_i2s_hw_param(mcasp, substream->stream); | 742 | ret = mcasp_i2s_hw_param(mcasp, substream->stream); |
698 | 743 | ||