[alsa-devel] [PATCH] ASoC: rt5677: Add the chip type to distinguish the setting of the clock source

Mark Brown broonie at kernel.org
Wed Feb 11 06:41:19 CET 2015


On Tue, Feb 10, 2015 at 06:14:34PM +0800, Oder Chiou wrote:

> +		if (rt5677->type == RT5677) {
> +			regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1,
> +				RT5677_MCLK_SRC_MASK, RT5677_MCLK2_SRC);
> +			regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2,
> +				RT5677_PLL2_PR_SRC_MASK |
> +				RT5677_DSP_CLK_SRC_MASK,
> +				RT5677_PLL2_PR_SRC_MCLK2 |
> +				RT5677_DSP_CLK_SRC_BYPASS);
> +		} else {
> +			regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2,
> +				RT5677_DSP_CLK_SRC_MASK,
> +				RT5677_DSP_CLK_SRC_BYPASS);
> +		}

This change looks good except for the above which is better written as a
switch statement - it's best to write choices between chip types like
that so that if a new variant comes up then it's easy to slot in.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150211/09643351/attachment.sig>


More information about the Alsa-devel mailing list