[alsa-devel] [PATCH 2/2] ASoC: rt5677: Add the GPIO function

Mark Brown broonie at kernel.org
Mon Sep 15 23:46:42 CEST 2014


On Mon, Sep 15, 2014 at 07:58:45PM +0800, Oder Chiou wrote:

> +	switch (offset) {
> +	case RT5677_GPIO1:
> +		regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL2,
> +			RT5677_GPIO1_OUT_MASK, !!value << RT5677_GPIO1_OUT_SFT);
> +		break;

All these functions could be cut down quite a bit - rather than having
individual switch statements for every single operation for every single
GPIO we can calculate the required shifts, we just need to look up the
register to write into (or calculate it).  This would be much nicer from
a code point of view.
-------------- 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/20140915/953b6cd1/attachment.sig>


More information about the Alsa-devel mailing list