diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-19 13:17:32 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-19 13:17:32 -0400 |
| commit | 4992fa1fd425f1934f503ffa96b68e235b89db9a (patch) | |
| tree | 4710bcfe3eddc876c8243ff8fd8b5bca13946168 | |
| parent | 115e4bfd5bc68f870b3c889ab8f2d2733bcda452 (diff) | |
| parent | 46eda3e96a65b378041c79c51ff2e02009f7e2d0 (diff) | |
Merge tag 'topic/twl' into regulator-next
TWL specific changes, cross-merged with OMAP due to arch/arm wanting to
use the new ability to override the voltage set and get operations to
support the in-CPU voltage management. The other changes are minor
fixes, the addition of a few new regulators and device tree support.
| -rw-r--r-- | Documentation/devicetree/bindings/regulator/twl-regulator.txt | 68 | ||||
| -rw-r--r-- | drivers/mfd/twl-core.c | 41 | ||||
| -rw-r--r-- | drivers/regulator/twl-regulator.c | 327 | ||||
| -rw-r--r-- | include/linux/i2c/twl.h | 14 |
4 files changed, 366 insertions, 84 deletions
diff --git a/Documentation/devicetree/bindings/regulator/twl-regulator.txt b/Documentation/devicetree/bindings/regulator/twl-regulator.txt new file mode 100644 index 000000000000..0c3395d55ac1 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/twl-regulator.txt | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | TWL family of regulators | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | For twl6030 regulators/LDOs | ||
| 5 | - compatible: | ||
| 6 | - "ti,twl6030-vaux1" for VAUX1 LDO | ||
| 7 | - "ti,twl6030-vaux2" for VAUX2 LDO | ||
| 8 | - "ti,twl6030-vaux3" for VAUX3 LDO | ||
| 9 | - "ti,twl6030-vmmc" for VMMC LDO | ||
| 10 | - "ti,twl6030-vpp" for VPP LDO | ||
| 11 | - "ti,twl6030-vusim" for VUSIM LDO | ||
| 12 | - "ti,twl6030-vana" for VANA LDO | ||
| 13 | - "ti,twl6030-vcxio" for VCXIO LDO | ||
| 14 | - "ti,twl6030-vdac" for VDAC LDO | ||
| 15 | - "ti,twl6030-vusb" for VUSB LDO | ||
| 16 | - "ti,twl6030-v1v8" for V1V8 LDO | ||
| 17 | - "ti,twl6030-v2v1" for V2V1 LDO | ||
| 18 | - "ti,twl6030-clk32kg" for CLK32KG RESOURCE | ||
| 19 | - "ti,twl6030-vdd1" for VDD1 SMPS | ||
| 20 | - "ti,twl6030-vdd2" for VDD2 SMPS | ||
| 21 | - "ti,twl6030-vdd3" for VDD3 SMPS | ||
| 22 | For twl6025 regulators/LDOs | ||
| 23 | - compatible: | ||
| 24 | - "ti,twl6025-ldo1" for LDO1 LDO | ||
| 25 | - "ti,twl6025-ldo2" for LDO2 LDO | ||
| 26 | - "ti,twl6025-ldo3" for LDO3 LDO | ||
| 27 | - "ti,twl6025-ldo4" for LDO4 LDO | ||
| 28 | - "ti,twl6025-ldo5" for LDO5 LDO | ||
| 29 | - "ti,twl6025-ldo6" for LDO6 LDO | ||
| 30 | - "ti,twl6025-ldo7" for LDO7 LDO | ||
| 31 | - "ti,twl6025-ldoln" for LDOLN LDO | ||
| 32 | - "ti,twl6025-ldousb" for LDOUSB LDO | ||
| 33 | - "ti,twl6025-smps3" for SMPS3 SMPS | ||
| 34 | - "ti,twl6025-smps4" for SMPS4 SMPS | ||
| 35 | - "ti,twl6025-vio" for VIO SMPS | ||
| 36 | For twl4030 regulators/LDOs | ||
| 37 | - compatible: | ||
| 38 | - "ti,twl4030-vaux1" for VAUX1 LDO | ||
| 39 | - "ti,twl4030-vaux2" for VAUX2 LDO | ||
| 40 | - "ti,twl5030-vaux2" for VAUX2 LDO | ||
| 41 | - "ti,twl4030-vaux3" for VAUX3 LDO | ||
| 42 | - "ti,twl4030-vaux4" for VAUX4 LDO | ||
| 43 | - "ti,twl4030-vmmc1" for VMMC1 LDO | ||
| 44 | - "ti,twl4030-vmmc2" for VMMC2 LDO | ||
| 45 | - "ti,twl4030-vpll1" for VPLL1 LDO | ||
| 46 | - "ti,twl4030-vpll2" for VPLL2 LDO | ||
| 47 | - "ti,twl4030-vsim" for VSIM LDO | ||
| 48 | - "ti,twl4030-vdac" for VDAC LDO | ||
| 49 | - "ti,twl4030-vintana2" for VINTANA2 LDO | ||
| 50 | - "ti,twl4030-vio" for VIO LDO | ||
| 51 | - "ti,twl4030-vdd1" for VDD1 SMPS | ||
| 52 | - "ti,twl4030-vdd2" for VDD2 SMPS | ||
| 53 | - "ti,twl4030-vintana1" for VINTANA1 LDO | ||
| 54 | - "ti,twl4030-vintdig" for VINTDIG LDO | ||
| 55 | - "ti,twl4030-vusb1v5" for VUSB1V5 LDO | ||
| 56 | - "ti,twl4030-vusb1v8" for VUSB1V8 LDO | ||
| 57 | - "ti,twl4030-vusb3v1" for VUSB3V1 LDO | ||
| 58 | |||
| 59 | Optional properties: | ||
| 60 | - Any optional property defined in bindings/regulator/regulator.txt | ||
| 61 | |||
| 62 | Example: | ||
| 63 | |||
| 64 | xyz: regulator@0 { | ||
| 65 | compatible = "ti,twl6030-vaux1"; | ||
| 66 | regulator-min-microvolt = <1000000>; | ||
| 67 | regulator-max-microvolt = <3000000>; | ||
| 68 | }; | ||
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index c1e4f1a277e9..6cb10610a161 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
| @@ -621,6 +621,8 @@ add_regulator_linked(int num, struct regulator_init_data *pdata, | |||
| 621 | unsigned num_consumers, unsigned long features) | 621 | unsigned num_consumers, unsigned long features) |
| 622 | { | 622 | { |
| 623 | unsigned sub_chip_id; | 623 | unsigned sub_chip_id; |
| 624 | struct twl_regulator_driver_data drv_data; | ||
| 625 | |||
| 624 | /* regulator framework demands init_data ... */ | 626 | /* regulator framework demands init_data ... */ |
| 625 | if (!pdata) | 627 | if (!pdata) |
| 626 | return NULL; | 628 | return NULL; |
| @@ -630,7 +632,19 @@ add_regulator_linked(int num, struct regulator_init_data *pdata, | |||
| 630 | pdata->num_consumer_supplies = num_consumers; | 632 | pdata->num_consumer_supplies = num_consumers; |
| 631 | } | 633 | } |
| 632 | 634 | ||
| 633 | pdata->driver_data = (void *)features; | 635 | if (pdata->driver_data) { |
| 636 | /* If we have existing drv_data, just add the flags */ | ||
| 637 | struct twl_regulator_driver_data *tmp; | ||
| 638 | tmp = pdata->driver_data; | ||
| 639 | tmp->features |= features; | ||
| 640 | } else { | ||
| 641 | /* add new driver data struct, used only during init */ | ||
| 642 | drv_data.features = features; | ||
| 643 | drv_data.set_voltage = NULL; | ||
| 644 | drv_data.get_voltage = NULL; | ||
| 645 | drv_data.data = NULL; | ||
| 646 | pdata->driver_data = &drv_data; | ||
| 647 | } | ||
| 634 | 648 | ||
| 635 | /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */ | 649 | /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */ |
| 636 | sub_chip_id = twl_map[TWL_MODULE_PM_MASTER].sid; | 650 | sub_chip_id = twl_map[TWL_MODULE_PM_MASTER].sid; |
| @@ -937,6 +951,31 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) | |||
| 937 | /* twl6030 regulators */ | 951 | /* twl6030 regulators */ |
| 938 | if (twl_has_regulator() && twl_class_is_6030() && | 952 | if (twl_has_regulator() && twl_class_is_6030() && |
| 939 | !(features & TWL6025_SUBCLASS)) { | 953 | !(features & TWL6025_SUBCLASS)) { |
| 954 | child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, | ||
| 955 | features); | ||
| 956 | if (IS_ERR(child)) | ||
| 957 | return PTR_ERR(child); | ||
| 958 | |||
| 959 | child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2, | ||
| 960 | features); | ||
| 961 | if (IS_ERR(child)) | ||
| 962 | return PTR_ERR(child); | ||
| 963 | |||
| 964 | child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3, | ||
| 965 | features); | ||
| 966 | if (IS_ERR(child)) | ||
| 967 | return PTR_ERR(child); | ||
| 968 | |||
| 969 | child = add_regulator(TWL6030_REG_V1V8, pdata->v1v8, | ||
| 970 | features); | ||
| 971 | if (IS_ERR(child)) | ||
| 972 | return PTR_ERR(child); | ||
| 973 | |||
| 974 | child = add_regulator(TWL6030_REG_V2V1, pdata->v2v1, | ||
| 975 | features); | ||
| 976 | if (IS_ERR(child)) | ||
| 977 | return PTR_ERR(child); | ||
| 978 | |||
| 940 | child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, | 979 | child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, |
| 941 | features); | 980 | features); |
| 942 | if (IS_ERR(child)) | 981 | if (IS_ERR(child)) |
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 181a2cfe180c..9cdfc389ca26 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
| @@ -14,8 +14,11 @@ | |||
| 14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/of.h> | ||
| 18 | #include <linux/of_device.h> | ||
| 17 | #include <linux/regulator/driver.h> | 19 | #include <linux/regulator/driver.h> |
| 18 | #include <linux/regulator/machine.h> | 20 | #include <linux/regulator/machine.h> |
| 21 | #include <linux/regulator/of_regulator.h> | ||
| 19 | #include <linux/i2c/twl.h> | 22 | #include <linux/i2c/twl.h> |
| 20 | 23 | ||
| 21 | 24 | ||
| @@ -58,6 +61,16 @@ struct twlreg_info { | |||
| 58 | 61 | ||
| 59 | /* chip specific features */ | 62 | /* chip specific features */ |
| 60 | unsigned long features; | 63 | unsigned long features; |
| 64 | |||
| 65 | /* | ||
| 66 | * optional override functions for voltage set/get | ||
| 67 | * these are currently only used for SMPS regulators | ||
| 68 | */ | ||
| 69 | int (*get_voltage)(void *data); | ||
| 70 | int (*set_voltage)(void *data, int target_uV); | ||
| 71 | |||
| 72 | /* data passed from board for external get/set voltage */ | ||
| 73 | void *data; | ||
| 61 | }; | 74 | }; |
| 62 | 75 | ||
| 63 | 76 | ||
| @@ -522,15 +535,25 @@ twl4030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, | |||
| 522 | struct twlreg_info *info = rdev_get_drvdata(rdev); | 535 | struct twlreg_info *info = rdev_get_drvdata(rdev); |
