Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tony Lindgren and committed by
Lee Jones
482e7db1 76714d2c

+22
+21
drivers/mfd/twl4030-power.c
··· 567 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 587 static int 571 588 twl4030_power_configure_resources(const struct twl4030_power_data *pdata) 572 589 { 573 590 struct twl4030_resconfig *resconfig = pdata->resource_config; 591 + struct twl4030_resconfig *boardconf = pdata->board_config; 574 592 int err; 575 593 576 594 if (resconfig) { 595 + if (boardconf) 596 + twl4030_patch_rconfig(resconfig, boardconf); 597 + 577 598 while (resconfig->resource) { 578 599 err = twl4030_configure_resource(resconfig); 579 600 if (err)
+1
include/linux/i2c/twl.h
··· 662 662 struct twl4030_script **scripts; 663 663 unsigned num; 664 664 struct twl4030_resconfig *resource_config; 665 + struct twl4030_resconfig *board_config; 665 666 #define TWL4030_RESCONFIG_UNDEF ((u8)-1) 666 667 bool use_poweroff; /* Board is wired for TWL poweroff */ 667 668 };