Merge branch 'for-2.6.30' into for-2.6.31
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 16 Apr 2009 13:14:35 +0000 (14:14 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 16 Apr 2009 13:14:35 +0000 (14:14 +0100)
1  2 
sound/soc/omap/omap-mcbsp.c
sound/soc/pxa/pxa-ssp.c

@@@ -214,9 -214,8 +214,9 @@@ static int omap_mcbsp_dai_hw_params(str
        struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
        struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
        int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id;
 -      int wlen, channels;
 +      int wlen, channels, wpf;
        unsigned long port;
 +      unsigned int format;
  
        if (cpu_class_is_omap1()) {
                dma = omap1_dma_reqs[bus_id][substream->stream];
                return 0;
        }
  
 -      channels = params_channels(params);
 +      format = mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
 +      wpf = channels = params_channels(params);
        switch (channels) {
        case 2:
 -              /* Use dual-phase frames */
 -              regs->rcr2      |= RPHASE;
 -              regs->xcr2      |= XPHASE;
 +              if (format == SND_SOC_DAIFMT_I2S) {
 +                      /* Use dual-phase frames */
 +                      regs->rcr2      |= RPHASE;
 +                      regs->xcr2      |= XPHASE;
 +                      /* Set 1 word per (McBSP) frame for phase1 and phase2 */
 +                      wpf--;
 +                      regs->rcr2      |= RFRLEN2(wpf - 1);
 +                      regs->xcr2      |= XFRLEN2(wpf - 1);
 +              }
        case 1:
 -              /* Set 1 word per (McBSP) frame */
 -              regs->rcr2      |= RFRLEN2(1 - 1);
 -              regs->rcr1      |= RFRLEN1(1 - 1);
 -              regs->xcr2      |= XFRLEN2(1 - 1);
 -              regs->xcr1      |= XFRLEN1(1 - 1);
 +              /* Set word per (McBSP) frame for phase1 */
 +              regs->rcr1      |= RFRLEN1(wpf - 1);
 +              regs->xcr1      |= XFRLEN1(wpf - 1);
                break;
        default:
                /* Unsupported number of channels */
        }
  
        /* Set FS period and length in terms of bit clock periods */
 -      switch (mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 +      switch (format) {
        case SND_SOC_DAIFMT_I2S:
 -              regs->srgr2     |= FPER(wlen * 2 - 1);
 +              regs->srgr2     |= FPER(wlen * channels - 1);
                regs->srgr1     |= FWID(wlen - 1);
                break;
 +      case SND_SOC_DAIFMT_DSP_A:
        case SND_SOC_DAIFMT_DSP_B:
                regs->srgr2     |= FPER(wlen * channels - 1);
-               regs->srgr1     |= FWID(wlen * channels - 2);
+               regs->srgr1     |= FWID(0);
                break;
        }
  
@@@ -309,6 -302,7 +309,7 @@@ static int omap_mcbsp_dai_set_dai_fmt(s
  {
        struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
        struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
+       unsigned int temp_fmt = fmt;
  
        if (mcbsp_data->configured)
                return 0;
                regs->rcr2      |= RDATDLY(1);
                regs->xcr2      |= XDATDLY(1);
                break;
 +      case SND_SOC_DAIFMT_DSP_A:
 +              /* 1-bit data delay */
 +              regs->rcr2      |= RDATDLY(1);
 +              regs->xcr2      |= XDATDLY(1);
 +              /* Invert FS polarity configuration */
 +              temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
 +              break;
        case SND_SOC_DAIFMT_DSP_B:
                /* 0-bit data delay */
                regs->rcr2      |= RDATDLY(0);
                regs->xcr2      |= XDATDLY(0);
+               /* Invert FS polarity configuration */
+               temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
                break;
        default:
                /* Unsupported data format */
        }
  
        /* Set bit clock (CLKX/CLKR) and FS polarities */
-       switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+       switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) {
        case SND_SOC_DAIFMT_NB_NF:
                /*
                 * Normal BCLK + FS.
diff --combined sound/soc/pxa/pxa-ssp.c
@@@ -30,7 -30,7 +30,7 @@@
  #include <sound/pxa2xx-lib.h>
  
  #include <mach/hardware.h>
 -#include <mach/pxa-regs.h>
 +#include <mach/dma.h>
  #include <mach/regs-ssp.h>
  #include <mach/audio.h>
  #include <mach/ssp.h>
@@@ -568,10 -568,7 +568,10 @@@ static int pxa_ssp_set_dai_fmt(struct s
                case SND_SOC_DAIFMT_NB_IF:
                        break;
                case SND_SOC_DAIFMT_IB_IF:
 -                      sspsp |= SSPSP_SCMODE(3);
 +                      sspsp |= SSPSP_SCMODE(2);
 +                      break;
 +              case SND_SOC_DAIFMT_IB_NF:
 +                      sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP;
                        break;
                default:
                        return -EINVAL;
                case SND_SOC_DAIFMT_NB_NF:
                        sspsp |= SSPSP_SFRMP;
                        break;
 +              case SND_SOC_DAIFMT_NB_IF:
 +                      break;
                case SND_SOC_DAIFMT_IB_IF:
 +                      sspsp |= SSPSP_SCMODE(2);
 +                      break;
 +              case SND_SOC_DAIFMT_IB_NF:
 +                      sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP;
                        break;
                default:
                        return -EINVAL;
@@@ -815,6 -806,7 +815,7 @@@ static int pxa_ssp_probe(struct platfor
                goto err_priv;
        }
  
+       priv->dai_fmt = (unsigned int) -1;
        dai->private_data = priv;
  
        return 0;