[alsa-devel] [PATCH] cs4270: add support for slave mode configurations

Timur Tabi timur at freescale.com
Fri Feb 27 22:51:58 CET 2009


On Wed, Feb 25, 2009 at 7:37 AM, Daniel Mack <daniel at caiaq.de> wrote:
> Added support for scenarios where the Cirrus CS4270 audio codec is slave
> to the bitclk and lrclk. Mixed setups are unsupported.
>
> Signed-off-by: Daniel Mack <daniel at caiaq.de>

FYI, it's customary to CC: the author of a driver when posting patches for it.

> +       /* set master/slave audio interface */
> +       switch (format & SND_SOC_DAIFMT_MASTER_MASK) {
> +       case SND_SOC_DAIFMT_CBS_CFS:
> +               cs4270->slave_mode = 1;
> +               break;
> +       case SND_SOC_DAIFMT_CBM_CFM:
> +               cs4270->slave_mode = 0;
> +               break;
> +       case SND_SOC_DAIFMT_CBM_CFS:
> +               /* unsupported - cs4270 can eigther be slave or master to

Typo.  However, I suggest you get rid of the "case
SND_SOC_DAIFMT_CBM_CFS" and in the "default:", just have this:

> +       default:
                   /* all other modes are unsupported by the hardware */
> +               ret = -EINVAL;
> +       }
> +

>
>        reg = snd_soc_read(codec, CS4270_MODE);
>        reg &= ~(CS4270_MODE_SPEED_MASK | CS4270_MODE_DIV_MASK);
> -       reg |= cs4270_mode_ratios[i].speed_mode | cs4270_mode_ratios[i].mclk;
> +       reg |= cs4270_mode_ratios[i].mclk;
> +
> +       if (cs4270->slave_mode)
> +               reg |= CS4270_MODE_SLAVE;
> +       else
> +               reg |= cs4270_mode_ratios[i].speed_mode;

Are you sure that the mclk bits are still correct in slave mode?  I'm
looking at table 5 in the CS4270 manual, and it lists settings for
1x,2x,4x speed even though the register is set to slave mode instead.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the Alsa-devel mailing list