diff options
| author | Rajendra Nayak <rnayak@ti.com> | 2012-02-28 04:39:11 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-11 16:09:08 -0400 |
| commit | 2098e95ce9bb039ff2e7bf836df358d18a176139 (patch) | |
| tree | ed2c162f5b37325071fcc39778a60ce3fe9daed1 | |
| parent | 34a38440689b06a515104d668494e0ff8a4e1537 (diff) | |
regulator: twl: adapt twl-regulator driver to dt
Modify the twl regulator driver to extract the regulator_init_data from
device tree when passed, instead of getting it through platform_data
structures (on non-DT builds)
Also add documentation for TWL regulator specific bindings.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| -rw-r--r-- | Documentation/devicetree/bindings/regulator/twl-regulator.txt | 66 | ||||
| -rw-r--r-- | drivers/regulator/twl-regulator.c | 259 |
2 files changed, 238 insertions, 87 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..ba9d2ccf8fdc --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/twl-regulator.txt | |||
| @@ -0,0 +1,66 @@ | |||
| 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-clk32kg" for CLK32KG RESOURCE | ||
| 17 | - "ti,twl6030-vdd1" for VDD1 SMPS | ||
| 18 | - "ti,twl6030-vdd2" for VDD2 SMPS | ||
| 19 | - "ti,twl6030-vdd3" for VDD3 SMPS | ||
| 20 | For twl6025 regulators/LDOs | ||
| 21 | - compatible: | ||
| 22 | - "ti,twl6025-ldo1" for LDO1 LDO | ||
| 23 | - "ti,twl6025-ldo2" for LDO2 LDO | ||
| 24 | - "ti,twl6025-ldo3" for LDO3 LDO | ||
| 25 | - "ti,twl6025-ldo4" for LDO4 LDO | ||
| 26 | - "ti,twl6025-ldo5" for LDO5 LDO | ||
| 27 | - "ti,twl6025-ldo6" for LDO6 LDO | ||
| 28 | - "ti,twl6025-ldo7" for LDO7 LDO | ||
| 29 | - "ti,twl6025-ldoln" for LDOLN LDO | ||
| 30 | - "ti,twl6025-ldousb" for LDOUSB LDO | ||
| 31 | - "ti,twl6025-smps3" for SMPS3 SMPS | ||
| 32 | - "ti,twl6025-smps4" for SMPS4 SMPS | ||
| 33 | - "ti,twl6025-vio" for VIO SMPS | ||
| 34 | For twl4030 regulators/LDOs | ||
| 35 | - compatible: | ||
| 36 | - "ti,twl4030-vaux1" for VAUX1 LDO | ||
| 37 | - "ti,twl4030-vaux2" for VAUX2 LDO | ||
| 38 | - "ti,twl5030-vaux2" for VAUX2 LDO | ||
| 39 | - "ti,twl4030-vaux3" for VAUX3 LDO | ||
| 40 | - "ti,twl4030-vaux4" for VAUX4 LDO | ||
| 41 | - "ti,twl4030-vmmc1" for VMMC1 LDO | ||
| 42 | - "ti,twl4030-vmmc2" for VMMC2 LDO | ||
| 43 | - "ti,twl4030-vpll1" for VPLL1 LDO | ||
| 44 | - "ti,twl4030-vpll2" for VPLL2 LDO | ||
| 45 | - "ti,twl4030-vsim" for VSIM LDO | ||
| 46 | - "ti,twl4030-vdac" for VDAC LDO | ||
| 47 | - "ti,twl4030-vintana2" for VINTANA2 LDO | ||
| 48 | - "ti,twl4030-vio" for VIO LDO | ||
| 49 | - "ti,twl4030-vdd1" for VDD1 SMPS | ||
| 50 | - "ti,twl4030-vdd2" for VDD2 SMPS | ||
| 51 | - "ti,twl4030-vintana1" for VINTANA1 LDO | ||
| 52 | - "ti,twl4030-vintdig" for VINTDIG LDO | ||
| 53 | - "ti,twl4030-vusb1v5" for VUSB1V5 LDO | ||
| 54 | - "ti,twl4030-vusb1v8" for VUSB1V8 LDO | ||
| 55 | - "ti,twl4030-vusb3v1" for VUSB3V1 LDO | ||
| 56 | |||
| 57 | Optional properties: | ||
| 58 | - Any optional property defined in bindings/regulator/regulator.txt | ||
| 59 | |||
| 60 | Example: | ||
| 61 | |||
| 62 | xyz: regulator@0 { | ||
| 63 | compatible = "ti,twl6030-vaux1"; | ||
| 64 | regulator-min-microvolt = <1000000>; | ||
| 65 | regulator-max-microvolt = <3000000>; | ||
| 66 | }; | ||
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 8611282f1d20..2a1321135178 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 | ||
| @@ -920,7 +923,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 920 | TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \ | 923 | TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \ |
| 921 | 0x0, TWL6030, twl6030fixed_ops) | 924 | 0x0, TWL6030, twl6030fixed_ops) |
| 922 | 925 | ||
| 923 | #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) { \ | 926 | #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \ |
| 927 | static struct twlreg_info TWL4030_INFO_##label = { \ | ||
| 924 | .base = offset, \ | 928 | .base = offset, \ |
| 925 | .id = num, \ | 929 | .id = num, \ |
| 926 | .table_len = ARRAY_SIZE(label##_VSEL_table), \ | 930 | .table_len = ARRAY_SIZE(label##_VSEL_table), \ |
| @@ -938,7 +942,7 @@ static struct regulator_ops twlsmps_ops = { | |||
| 938 | } | 942 | } |
| 939 | 943 | ||
| 940 | #define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf) \ | 944 | #define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf) \ |
| 941 | { \ | 945 | static struct twlreg_info TWL4030_INFO_##label = { \ |
| 942 | .base = offset, \ | 946 | .base = offset, \ |
| 943 | .id = num, \ | 947 | .id = num, \ |
| 944 | .delay = turnon_delay, \ | 948 | .delay = turnon_delay, \ |
| @@ -952,7 +956,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 952 | }, \ | 956 | }, \ |
| 953 | } | 957 | } |
| 954 | 958 | ||
| 955 | #define TWL6030_ADJUSTABLE_SMPS(label) { \ | 959 | #define TWL6030_ADJUSTABLE_SMPS(label) \ |
| 960 | static struct twlreg_info TWL6030_INFO_##label = { \ | ||
| 956 | .desc = { \ | 961 | .desc = { \ |
| 957 | .name = #label, \ | 962 | .name = #label, \ |
| 958 | .id = TWL6030_REG_##label, \ | 963 | .id = TWL6030_REG_##label, \ |
| @@ -962,7 +967,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 962 | }, \ | 967 | }, \ |
| 963 | } | 968 | } |
| 964 | 969 | ||
| 965 | #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ | 970 | #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) \ |
| 971 | static struct twlreg_info TWL6030_INFO_##label = { \ | ||
| 966 | .base = offset, \ | 972 | .base = offset, \ |
| 967 | .min_mV = min_mVolts, \ | 973 | .min_mV = min_mVolts, \ |
| 968 | .max_mV = max_mVolts, \ | 974 | .max_mV = max_mVolts, \ |
| @@ -976,7 +982,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 976 | }, \ | 982 | }, \ |
| 977 | } | 983 | } |
| 978 | 984 | ||
| 979 | #define TWL6025_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ | 985 | #define TWL6025_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) \ |
| 986 | static struct twlreg_info TWL6025_INFO_##label = { \ | ||
| 980 | .base = offset, \ | 987 | .base = offset, \ |
| 981 | .min_mV = min_mVolts, \ | 988 | .min_mV = min_mVolts, \ |
| 982 | .max_mV = max_mVolts, \ | 989 | .max_mV = max_mVolts, \ |
| @@ -991,7 +998,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 991 | } | 998 | } |
| 992 | 999 | ||
| 993 | #define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \ | 1000 | #define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \ |
| 994 | family, operations) { \ | 1001 | family, operations) \ |
| 1002 | static struct twlreg_info TWLFIXED_INFO_##label = { \ | ||
| 995 | .base = offset, \ | 1003 | .base = offset, \ |
| 996 | .id = num, \ | 1004 | .id = num, \ |
| 997 | .min_mV = mVolts, \ | 1005 | .min_mV = mVolts, \ |
| @@ -1007,7 +1015,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 1007 | }, \ | 1015 | }, \ |
| 1008 | } | 1016 | } |
| 1009 | 1017 | ||
| 1010 | #define TWL6030_FIXED_RESOURCE(label, offset, turnon_delay) { \ | 1018 | #define TWL6030_FIXED_RESOURCE(label, offset, turnon_delay) \ |
| 1019 | static struct twlreg_info TWLRES_INFO_##label = { \ | ||
| 1011 | .base = offset, \ | 1020 | .base = offset, \ |
| 1012 | .delay = turnon_delay, \ | 1021 | .delay = turnon_delay, \ |
| 1013 | .desc = { \ | 1022 | .desc = { \ |
| @@ -1019,7 +1028,8 @@ static struct regulator_ops twlsmps_ops = { | |||
| 1019 | }, \ | 1028 | }, \ |
| 1020 | } | 1029 | } |
| 1021 | 1030 | ||
| 1022 | #define TWL6025_ADJUSTABLE_SMPS(label, offset) { \ | 1031 | #define TWL6025_ADJUSTABLE_SMPS(label, offset) \ |
| 1032 | static struct twlreg_info TWLSMPS_INFO_##label = { \ | ||
| 1023 | .base = offset, \ | 1033 | .base = offset, \ |
| 1024 | .min_mV = 600, \ | 1034 | .min_mV = 600, \ |
| 1025 | .max_mV = 2100, \ | 1035 | .max_mV = 2100, \ |
| @@ -1037,62 +1047,57 @@ static struct regulator_ops twlsmps_ops = { | |||
| 1037 | * We list regulators | ||
