aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz2013-07-19 12:02:56 -0500
committerMisael Lopez Cruz2013-07-22 14:43:15 -0500
commit54cf9b418df25c633319a92779f74c77b2696d2e (patch)
tree77123eccea9bcc51d439fbce8076fb22b77c8c6e
parent800447757970875a01a5b268ece0c83808d0903a (diff)
downloadkernel-audio-54cf9b418df25c633319a92779f74c77b2696d2e.tar.gz
kernel-audio-54cf9b418df25c633319a92779f74c77b2696d2e.tar.xz
kernel-audio-54cf9b418df25c633319a92779f74c77b2696d2e.zip
ASoC: davinci-mcasp: Keep TX and RX format symmetric
[TR]XFMT and [TR]XFMTCTL registers are set symmetrically in most part of the driver, no need to keep it stream direction dependent only in one place. Change-Id: I8bacf75c8e5147d086ea67ab8ea5400a6affba99 Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
-rw-r--r--sound/soc/davinci/davinci-mcasp.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 6ec241335cc3..0072cfa26818 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -802,11 +802,15 @@ static int davinci_hw_param(struct davinci_audio_dev *dev, int stream,
802 int channels) 802 int channels)
803{ 803{
804 int i, active_slots; 804 int i, active_slots;
805 int total_slots; 805 int total_slots = dev->tdm_slots;
806 int active_serializers; 806 int active_serializers;
807 u32 mask = 0; 807 u32 mask = 0;
808 808
809 total_slots = (dev->tdm_slots > 31) ? 32 : dev->tdm_slots; 809 if ((total_slots < 2) || (total_slots > 32)) {
810 dev_err(dev->dev, "tdm slot count %d not supported\n",
811 total_slots);
812 return -EINVAL;
813 }
810 814
811 /* 815 /*
812 * If more than one serializer is needed, then use them with 816 * If more than one serializer is needed, then use them with
@@ -827,31 +831,17 @@ static int davinci_hw_param(struct davinci_audio_dev *dev, int stream,
827 831
828 mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC); 832 mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
829 833
830 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 834 /* bit stream is MSB first with no delay */
831 /* bit stream is MSB first with no delay */ 835 /* DSP_B mode */
832 /* DSP_B mode */ 836 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
833 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); 837 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD);
834 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); 838 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
835 839 FSXMOD(total_slots), FSXMOD(0x1FF));
836 if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) 840
837 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, 841 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
838 FSXMOD(total_slots), FSXMOD(0x1FF)); 842 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD);
839 else 843 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
840 printk(KERN_ERR "playback tdm slot %d not supported\n", 844 FSRMOD(total_slots), FSRMOD(0x1FF));
841 dev->tdm_slots);
842 } else {
843 /* bit stream is MSB first with no delay */
844 /* DSP_B mode */
845 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD);
846 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
847
848 if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32))
849 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
850 FSRMOD(total_slots), FSRMOD(0x1FF));
851 else
852 printk(KERN_ERR "capture tdm slot %d not supported\n",
853 dev->tdm_slots);
854 }
855 845
856 return 0; 846 return 0;
857} 847}