diff options
author | Tony Lindgren <tony@atomide.com> | 2014-05-20 14:17:54 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-05-28 03:06:04 -0400 |
commit | 482e7db160df713a2d1d4c7ee9fffad92008283f (patch) | |
tree | 00930502166ed05190e628cdc59f9ef7ce1c5ea0 /drivers | |
parent | 76714d2c090f836fe005008116075a7b5bfde852 (diff) |
mfd: twl4030-power: Add support for board specific configuration
With the recommended twl4030 configuration added, we can now add
board specific changes as modifications to the recommended
configuration.
Note that the data is private to this driver, and the data must
always have a NULL resource in the sentinel.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/twl4030-power.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 2bfbb40ca9d2..4846c7b48ebb 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -567,13 +567,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata) | |||
567 | return 0; | 567 | return 0; |
568 | } | 568 | } |
569 | 569 | ||
570 | static void twl4030_patch_rconfig(struct twl4030_resconfig *common, | ||
571 | struct twl4030_resconfig *board) | ||
572 | { | ||
573 | while (common->resource) { | ||
574 | struct twl4030_resconfig *b = board; | ||
575 | |||
576 | while (b->resource) { | ||
577 | if (b->resource == common->resource) { | ||
578 | *common = *b; | ||
579 | break; | ||
580 | } | ||
581 | b++; | ||
582 | } | ||
583 | common++; | ||
584 | } | ||
585 | } | ||
586 | |||
570 | static int | 587 | static int |
571 | twl4030_power_configure_resources(const struct twl4030_power_data *pdata) | 588 | twl4030_power_configure_resources(const struct twl4030_power_data *pdata) |
572 | { | 589 | { |
573 | struct twl4030_resconfig *resconfig = pdata->resource_config; | 590 | struct twl4030_resconfig *resconfig = pdata->resource_config; |
591 | struct twl4030_resconfig *boardconf = pdata->board_config; | ||
574 | int err; | 592 | int err; |
575 | 593 | ||
576 | if (resconfig) { | 594 | if (resconfig) { |
595 | if (boardconf) | ||
596 | twl4030_patch_rconfig(resconfig, boardconf); | ||
597 | |||
577 | while (resconfig->resource) { | 598 | while (resconfig->resource) { |
578 | err = twl4030_configure_resource(resconfig); | 599 | err = twl4030_configure_resource(resconfig); |
579 | if (err) | 600 | if (err) |