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.