Skip to content

Commit 482e7db

Browse files
tmlindLee Jones
authored andcommitted
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>
1 parent 76714d2 commit 482e7db

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎drivers/mfd/twl4030-power.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
567567
return 0;
568568
}
569569

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+
570587
static int
571588
twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
572589
{
573590
struct twl4030_resconfig *resconfig = pdata->resource_config;
591+
struct twl4030_resconfig *boardconf = pdata->board_config;
574592
int err;
575593

576594
if (resconfig) {
595+
if (boardconf)
596+
twl4030_patch_rconfig(resconfig, boardconf);
597+
577598
while (resconfig->resource) {
578599
err = twl4030_configure_resource(resconfig);
579600
if (err)

‎include/linux/i2c/twl.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ struct twl4030_power_data {
662662
struct twl4030_script **scripts;
663663
unsigned num;
664664
struct twl4030_resconfig *resource_config;
665+
struct twl4030_resconfig *board_config;
665666
#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
666667
bool use_poweroff; /* Board is wired for TWL poweroff */
667668
};

0 commit comments

Comments
 (0)