aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl-core.c
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2012-02-16 05:27:52 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-11 16:08:45 -0400
commit63bfff4e20211b464cbea6e79e5fd36df227c154 (patch)
tree4ea7a62c37820578be7ecbc943f6e62a017c64e4 /drivers/mfd/twl-core.c
parenta33b6e5a8fb5fadeef206bacef13117e8a3080c4 (diff)
regulator: twl4030: add support for external voltage get/set
This is needed for SMPS regulators, which use the OMAP voltage processor for voltage get/set functions instead of the normal I2C channel. For this purpose, regulator_init_data->driver_data contents are expanded, it is now a struct which contains function pointers for the set/get voltage operations, a data pointer for these, and the previously used features bitmask. Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> [for the MFD part] Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/mfd/twl-core.c')
-rw-r--r--drivers/mfd/twl-core.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index e04e04ddc15e..fae5f76d6ccb 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -619,6 +619,8 @@ add_regulator_linked(int num, struct regulator_init_data *pdata,
619 unsigned num_consumers, unsigned long features) 619 unsigned num_consumers, unsigned long features)
620{ 620{
621 unsigned sub_chip_id; 621 unsigned sub_chip_id;
622 struct twl_regulator_driver_data drv_data;
623
622 /* regulator framework demands init_data ... */ 624 /* regulator framework demands init_data ... */
623 if (!pdata) 625 if (!pdata)
624 return NULL; 626 return NULL;
@@ -628,7 +630,19 @@ add_regulator_linked(int num, struct regulator_init_data *pdata,
628 pdata->num_consumer_supplies = num_consumers; 630 pdata->num_consumer_supplies = num_consumers;
629 } 631 }
630 632
631 pdata->driver_data = (void *)features; 633 if (pdata->driver_data) {
634 /* If we have existing drv_data, just add the flags */
635 struct twl_regulator_driver_data *tmp;
636 tmp = pdata->driver_data;
637 tmp->features |= features;
638 } else {
639 /* add new driver data struct, used only during init */
640 drv_data.features = features;
641 drv_data.set_voltage = NULL;
642 drv_data.get_voltage = NULL;
643 drv_data.data = NULL;
644 pdata->driver_data = &drv_data;
645 }
632 646
633 /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */ 647 /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */
634 sub_chip_id = twl_map[TWL_MODULE_PM_MASTER].sid; 648 sub_chip_id = twl_map[TWL_MODULE_PM_MASTER].sid;