[alsa-devel] [PATCH 2/2] ASoC: rt286: Add customize setting for Dell Dino

Mark Brown broonie at kernel.org
Thu Feb 5 20:16:24 CET 2015


On Thu, Feb 05, 2015 at 04:40:34PM +0800, Bard Liao wrote:
> The patch add the customize setting for Dell Dino project.

I've applied this to get the support in for v3.20 but...

> +	if (dmi_check_system(dmi_dell_dino)) {
> +		regmap_update_bits(rt286->regmap,
> +			RT286_SET_GPIO_MASK, 0x40, 0x40);
> +		regmap_update_bits(rt286->regmap,
> +			RT286_SET_GPIO_DIRECTION, 0x40, 0x40);
> +		regmap_update_bits(rt286->regmap,
> +			RT286_SET_GPIO_DATA, 0x40, 0x40);
> +		regmap_update_bits(rt286->regmap,
> +			RT286_GPIO_CTRL, 0xc, 0x8);
> +	}

...this code is getting out of hand and really needs to become more data
driven instead of having open coded register writes of magic numbers for
each case.  As the number of machines increases it's going to become
difficult to manage and hard to restructure handling of features if the
driver changes.

What I'd suggest is to define a struct with all the quirks that might be
applied, put all the machines in a table and then figure out which one
matches the current one by looking at that table (dmi_first_match()
might be helpful here).  The code can then look at the struct and make
whatever configuration changes are required.
-------------- 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/20150205/5a063bc7/attachment.sig>


More information about the Alsa-devel mailing list