diff options
-rw-r--r-- | Documentation/devicetree/bindings/regulator/act8865-regulator.txt | 60 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt | 2 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/vendor-prefixes.txt | 1 | ||||
-rw-r--r-- | drivers/regulator/Kconfig | 8 | ||||
-rw-r--r-- | drivers/regulator/Makefile | 1 | ||||
-rw-r--r-- | drivers/regulator/ab8500.c | 126 | ||||
-rw-r--r-- | drivers/regulator/act8865-regulator.c | 349 | ||||
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 36 | ||||
-rw-r--r-- | drivers/regulator/arizona-micsupp.c | 52 | ||||
-rw-r--r-- | drivers/regulator/as3722-regulator.c | 34 | ||||
-rw-r--r-- | drivers/regulator/pfuze100-regulator.c | 2 | ||||
-rw-r--r-- | include/linux/mfd/as3722.h | 4 | ||||
-rw-r--r-- | include/linux/regulator/act8865.h | 53 |
13 files changed, 537 insertions, 191 deletions
diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt new file mode 100644 index 000000000000..bef1fbb647ca --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt | |||
@@ -0,0 +1,60 @@ | |||
1 | ACT8865 regulator | ||
2 | ------------------- | ||
3 | |||
4 | Required properties: | ||
5 | - compatible: "active-semi,act8865" | ||
6 | - reg: I2C slave address | ||
7 | |||
8 | Any standard regulator properties can be used to configure the single regulator. | ||
9 | |||
10 | The valid names for regulators are: | ||
11 | DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4. | ||
12 | |||
13 | Example: | ||
14 | -------- | ||
15 | |||
16 | i2c1: i2c@f0018000 { | ||
17 | pmic: act8865@5b { | ||
18 | compatible = "active-semi,act8865"; | ||
19 | reg = <0x5b>; | ||
20 | status = "disabled"; | ||
21 | |||
22 | regulators { | ||
23 | vcc_1v8_reg: DCDC_REG1 { | ||
24 | regulator-name = "VCC_1V8"; | ||
25 | regulator-min-microvolt = <1800000>; | ||
26 | regulator-max-microvolt = <1800000>; | ||
27 | regulator-always-on; | ||
28 | }; | ||
29 | |||
30 | vcc_1v2_reg: DCDC_REG2 { | ||
31 | regulator-name = "VCC_1V2"; | ||
32 | regulator-min-microvolt = <1100000>; | ||
33 | regulator-max-microvolt = <1300000>; | ||
34 | regulator-suspend-mem-microvolt = <1150000>; | ||
35 | regulator-suspend-standby-microvolt = <1150000>; | ||
36 | regulator-always-on; | ||
37 | }; | ||
38 | |||
39 | vcc_3v3_reg: DCDC_REG3 { | ||
40 | regulator-name = "VCC_3V3"; | ||
41 | regulator-min-microvolt = <3300000>; | ||
42 | regulator-max-microvolt = <3300000>; | ||
43 | regulator-always-on; | ||
44 | }; | ||
45 | |||
46 | vddana_reg: LDO_REG1 { | ||
47 | regulator-name = "VDDANA"; | ||
48 | regulator-min-microvolt = <3300000>; | ||
49 | regulator-max-microvolt = <3300000>; | ||
50 | regulator-always-on; | ||
51 | }; | ||
52 | |||
53 | vddfuse_reg: LDO_REG2 { | ||
54 | regulator-name = "FUSE_2V5"; | ||
55 | regulator-min-microvolt = <2500000>; | ||
56 | regulator-max-microvolt = <2500000>; | ||
57 | }; | ||
58 | }; | ||
59 | }; | ||
60 | }; | ||
diff --git a/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt b/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt index d1660a90fc06..fc6b38f035bd 100644 --- a/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt | |||
@@ -83,7 +83,7 @@ as per the datasheet of s5m8767. | |||
83 | 83 | ||
84 | - LDOn | 84 | - LDOn |
85 | - valid values for n are 1 to 28 | 85 | - valid values for n are 1 to 28 |
86 | - Example: LDO0, LD01, LDO28 | 86 | - Example: LDO1, LD02, LDO28 |
87 | - BUCKn | 87 | - BUCKn |
88 | - valid values for n are 1 to 9. | 88 | - valid values for n are 1 to 9. |
89 | - Example: BUCK1, BUCK2, BUCK9 | 89 | - Example: BUCK1, BUCK2, BUCK9 |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index edbb8d88c85e..519421f28691 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -3,6 +3,7 @@ Device tree binding vendor prefix registry. Keep list in alphabetical order. | |||
3 | This isn't an exhaustive list, but you should add new prefixes to it before | 3 | This isn't an exhaustive list, but you should add new prefixes to it before |
4 | using them to avoid name-space collisions. | 4 | using them to avoid name-space collisions. |
5 | 5 | ||
6 | active-semi Active-Semi International Inc | ||
6 | ad Avionic Design GmbH | 7 | ad Avionic Design GmbH |
7 | adi Analog Devices, Inc. | 8 | adi Analog Devices, Inc. |
8 | aeroflexgaisler Aeroflex Gaisler AB | 9 | aeroflexgaisler Aeroflex Gaisler AB |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index ce785f481281..63bc1bab37e3 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -70,6 +70,14 @@ config REGULATOR_88PM8607 | |||
70 | help | 70 | help |
71 | This driver supports 88PM8607 voltage regulator chips. | 71 | This driver supports 88PM8607 voltage regulator chips. |
72 | 72 | ||
73 | config REGULATOR_ACT8865 | ||
74 | tristate "Active-semi act8865 voltage regulator" | ||
75 | depends on I2C | ||
76 | select REGMAP_I2C | ||
77 | help | ||
78 | This driver controls a active-semi act8865 voltage output | ||
79 | regulator via I2C bus. | ||
80 | |||
73 | config REGULATOR_AD5398 | 81 | config REGULATOR_AD5398 |
74 | tristate "Analog Devices AD5398/AD5821 regulators" | 82 | tristate "Analog Devices AD5398/AD5821 regulators" |
75 | depends on I2C | 83 | depends on I2C |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 01c597ea1744..3bb3a5591b95 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o | |||
14 | obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o | 14 | obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o |
15 | obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o | 15 | obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o |
16 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o | 16 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o |
17 | obj-$(CONFIG_REGULATOR_ACT8865) += act8865-regulator.o | ||
17 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o | 18 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o |
18 | obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o | 19 | obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o |
19 | obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o | 20 | obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o |
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 603f192e84f1..c625468c7f2c 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -2998,37 +2998,6 @@ static void abx500_get_regulator_info(struct ab8500 *ab8500) | |||
2998 | } | 2998 | } |
2999 | } | 2999 | } |
3000 | 3000 | ||
3001 | static int ab8500_regulator_init_registers(struct platform_device *pdev, | ||
3002 | int id, int mask, int value) | ||
3003 | { | ||
3004 | struct ab8500_reg_init *reg_init = abx500_regulator.init; | ||
3005 | int err; | ||
3006 | |||
3007 | BUG_ON(value & ~mask); | ||
3008 | BUG_ON(mask & ~reg_init[id].mask); | ||
3009 | |||
3010 | /* initialize register */ | ||
3011 | err = abx500_mask_and_set_register_interruptible( | ||
3012 | &pdev->dev, | ||
3013 | reg_init[id].bank, | ||
3014 | reg_init[id].addr, | ||
3015 | mask, value); | ||
3016 | if (err < 0) { | ||
3017 | dev_err(&pdev->dev, | ||
3018 | "Failed to initialize 0x%02x, 0x%02x.\n", | ||
3019 | reg_init[id].bank, | ||
3020 | reg_init[id].addr); | ||
3021 | return err; | ||
3022 | } | ||
3023 | dev_vdbg(&pdev->dev, | ||
3024 | " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", | ||
3025 | reg_init[id].bank, | ||
3026 | reg_init[id].addr, | ||
3027 | mask, value); | ||
3028 | |||
3029 | return 0; | ||
3030 | } | ||
3031 | |||
3032 | static int ab8500_regulator_register(struct platform_device *pdev, | 3001 | static int ab8500_regulator_register(struct platform_device *pdev, |
3033 | struct regulator_init_data *init_data, | 3002 | struct regulator_init_data *init_data, |
3034 | int id, struct device_node *np) | 3003 | int id, struct device_node *np) |
@@ -3036,7 +3005,6 @@ static int ab8500_regulator_register(struct platform_device *pdev, | |||
3036 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); | 3005 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
3037 | struct ab8500_regulator_info *info = NULL; | 3006 | struct ab8500_regulator_info *info = NULL; |
3038 | struct regulator_config config = { }; | 3007 | struct regulator_config config = { }; |
3039 | int err; | ||
3040 | 3008 | ||
3041 | /* assign per-regulator data */ | 3009 | /* assign per-regulator data */ |
3042 | info = &abx500_regulator.info[id]; | 3010 | info = &abx500_regulator.info[id]; |
@@ -3058,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev, | |||
3058 | } | 3026 | } |
3059 | 3027 | ||
3060 | /* register regulator with framework */ | 3028 | /* register regulator with framework */ |
3061 | info->regulator = regulator_register(&info->desc, &config); | 3029 | info->regulator = devm_regulator_register(&pdev->dev, &info->desc, |
3030 | &config); | ||
3062 | if (IS_ERR(info->regulator)) { | 3031 | if (IS_ERR(info->regulator)) { |
3063 | err = PTR_ERR(info->regulator); | ||
3064 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 3032 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
3065 | info->desc.name); | 3033 | info->desc.name); |
3066 | /* when we fail, un-register all earlier regulators */ | 3034 | return PTR_ERR(info->regulator); |
3067 | while (--id >= 0) { | ||
3068 | info = &abx500_regulator.info[id]; | ||
3069 | regulator_unregister(info->regulator); | ||
3070 | } | ||
3071 | return err; | ||
3072 | } | 3035 | } |
3073 | 3036 | ||
3074 | return 0; | 3037 | return 0; |
@@ -3095,9 +3058,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) | |||
3095 | { | 3058 | { |
3096 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); | 3059 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
3097 | struct device_node *np = pdev->dev.of_node; | 3060 | struct device_node *np = pdev->dev.of_node; |
3098 | struct ab8500_platform_data *ppdata; | 3061 | int err; |
3099 | struct ab8500_regulator_platform_data *pdata; | ||
3100 | int i, err; | ||
3101 | 3062 | ||
3102 | if (!ab8500) { | 3063 | if (!ab8500) { |
3103 | dev_err(&pdev->dev, "null mfd parent\n"); | 3064 | dev_err(&pdev->dev, "null mfd parent\n"); |
@@ -3106,83 +3067,20 @@ static int ab8500_regulator_probe(struct platform_device *pdev) | |||
3106 | 3067 | ||
3107 | abx500_get_regulator_info(ab8500); | 3068 | abx500_get_regulator_info(ab8500); |
3108 | 3069 | ||
3109 | if (np) { | 3070 | err = of_regulator_match(&pdev->dev, np, |
3110 | err = of_regulator_match(&pdev->dev, np, | 3071 | abx500_regulator.match, |
3111 | abx500_regulator.match, | 3072 | abx500_regulator.match_size); |
3112 | abx500_regulator.match_size); | 3073 | if (err < 0) { |
3113 | if (err < 0) { | 3074 | dev_err(&pdev->dev, |
3114 | dev_err(&pdev->dev, | 3075 | "Error parsing regulator init data: %d\n", err); |
3115 | "Error parsing regulator init data: %d\n", err); | ||
3116 | return err; | ||
3117 | } | ||
3118 | |||
3119 | err = ab8500_regulator_of_probe(pdev, np); | ||
3120 | return err; | ||
3121 | } | ||
3122 | |||
3123 | ppdata = dev_get_platdata(ab8500->dev); | ||
3124 | if (!ppdata) { | ||
3125 | dev_err(&pdev->dev, "null parent pdata\n"); | ||
3126 | return -EINVAL; | ||
3127 | } | ||
3128 | |||
3129 | pdata = ppdata->regulator; | ||
3130 | if (!pdata) { | ||
3131 | dev_err(&pdev->dev, "null pdata\n"); | ||
3132 | return -EINVAL; | ||
3133 | } | ||
3134 | |||
3135 | /* make sure the platform data has the correct size */ | ||
3136 | if (pdata->num_regulator != abx500_regulator.info_size) { | ||
3137 | dev_err(&pdev->dev, "Configuration error: size mismatch.\n"); | ||
3138 | return -EINVAL; | ||
3139 | } | ||
3140 | |||
3141 | /* initialize debug (initial state is recorded with this call) */ | ||
3142 | err = ab8500_regulator_debug_init(pdev); | ||
3143 | if (err) | ||
3144 | return err; | 3076 | return err; |
3145 | |||
3146 | /* initialize registers */ | ||
3147 | for (i = 0; i < pdata->num_reg_init; i++) { | ||
3148 | int id, mask, value; | ||
3149 | |||
3150 | id = pdata->reg_init[i].id; | ||
3151 | mask = pdata->reg_init[i].mask; | ||
3152 | value = pdata->reg_init[i].value; | ||
3153 | |||
3154 | /* check for configuration errors */ | ||
3155 | BUG_ON(id >= abx500_regulator.init_size); | ||
3156 | |||
3157 | err = ab8500_regulator_init_registers(pdev, id, mask, value); | ||
3158 | if (err < 0) | ||
3159 | return err; | ||
3160 | } | 3077 | } |
3161 | 3078 | return ab8500_regulator_of_probe(pdev, np); | |
3162 | /* register all regulators */ | ||
3163 | for (i = 0; i < abx500_regulator.info_size; i++) { | ||
3164 | err = ab8500_regulator_register(pdev, &pdata->regulator[i], | ||
3165 | i, NULL); | ||
3166 | if (err < 0) | ||
3167 | return err; | ||
3168 | } | ||
3169 | |||
3170 | return 0; | ||
3171 | } | 3079 | } |
3172 | 3080 | ||
3173 | static int ab8500_regulator_remove(struct platform_device *pdev) | 3081 | static int ab8500_regulator_remove(struct platform_device *pdev) |
3174 | { | 3082 | { |
3175 | int i, err; | 3083 | int err; |
3176 | |||
3177 | for (i = 0; i < abx500_regulator.info_size; i++) { | ||
3178 | struct ab8500_regulator_info *info = NULL; | ||
3179 | info = &abx500_regulator.info[i]; | ||
3180 | |||
3181 | dev_vdbg(rdev_get_dev(info->regulator), | ||
3182 | "%s-remove\n", info->desc.name); | ||
3183 | |||
3184 | regulator_unregister(info->regulator); | ||
3185 | } | ||
3186 | 3084 | ||
3187 | /* remove regulator debug */ | 3085 | /* remove regulator debug */ |
3188 | err = ab8500_regulator_debug_exit(pdev); | 3086 | err = ab8500_regulator_debug_exit(pdev); |
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c new file mode 100644 index 000000000000..084cc0819a52 --- /dev/null +++ b/drivers/regulator/act8865-regulator.c | |||
@@ -0,0 +1,349 @@ | |||
1 | /* | ||
2 | * act8865-regulator.c - Voltage regulation for the active-semi ACT8865 | ||
3 | * http://www.active-semi.com/sheets/ACT8865_Datasheet.pdf | ||
4 | * | ||
5 | * Copyright (C) 2013 Atmel Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/i2c.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/regulator/driver.h> | ||
24 | #include <linux/regulator/act8865.h> | ||
25 | #include <linux/of.h> | ||
26 | #include <linux/of_device.h> | ||
27 | #include <linux/regulator/of_regulator.h> | ||
28 | #include <linux/regmap.h> | ||
29 | |||
30 | /* | ||
31 | * ACT8865 Global Register Map. | ||
32 | */ | ||
33 | #define ACT8865_SYS_MODE 0x00 | ||
34 | #define ACT8865_SYS_CTRL 0x01 | ||
35 | #define ACT8865_DCDC1_VSET1 0x20 | ||
36 | #define ACT8865_DCDC1_VSET2 0x21 | ||
37 | #define ACT8865_DCDC1_CTRL 0x22 | ||
38 | #define ACT8865_DCDC2_VSET1 0x30 | ||
39 | #define ACT8865_DCDC2_VSET2 0x31 | ||
40 | #define ACT8865_DCDC2_CTRL 0x32 | ||
41 | #define ACT8865_DCDC3_VSET1 0x40 | ||
42 | #define ACT8865_DCDC3_VSET2 0x41 | ||
43 | #define ACT8865_DCDC3_CTRL 0x42 | ||
44 | #define ACT8865_LDO1_VSET 0x50 | ||
45 | #define ACT8865_LDO1_CTRL 0x51 | ||
46 | #define ACT8865_LDO2_VSET 0x54 | ||
47 | #define ACT8865_LDO2_CTRL 0x55 | ||
48 | #define ACT8865_LDO3_VSET 0x60 | ||
49 | #define ACT8865_LDO3_CTRL 0x61 | ||
50 | #define ACT8865_LDO4_VSET 0x64 | ||
51 | #define ACT8865_LDO4_CTRL 0x65 | ||
52 | |||
53 | /* | ||
54 | * Field Definitions. | ||
55 | */ | ||
56 | #define ACT8865_ENA 0x80 /* ON - [7] */ | ||
57 | #define ACT8865_VSEL_MASK 0x3F /* VSET - [5:0] */ | ||
58 | |||
59 | /* | ||
60 | * ACT8865 voltage number | ||
61 | */ | ||
62 | #define ACT8865_VOLTAGE_NUM 64 | ||
63 | |||
64 | struct act8865 { | ||
65 | struct regulator_dev *rdev[ACT8865_REG_NUM]; | ||
66 | struct regmap *regmap; | ||
67 | }; | ||
68 | |||
69 | static const struct regmap_config act8865_regmap_config = { | ||
70 | .reg_bits = 8, | ||
71 | .val_bits = 8, | ||
72 | }; | ||
73 | |||
74 | static const struct regulator_linear_range act8865_volatge_ranges[] = { | ||
75 | REGULATOR_LINEAR_RANGE(600000, 0, 23, 25000), | ||
76 | REGULATOR_LINEAR_RANGE(1200000, 24, 47, 50000), | ||
77 | REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000), | ||
78 | }; | ||
79 | |||
80 | static struct regulator_ops act8865_ops = { | ||
81 | .list_voltage = regulator_list_voltage_linear_range, | ||
82 | .map_voltage = regulator_map_voltage_linear_range, | ||
83 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
84 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
85 | .enable = regulator_enable_regmap, | ||
86 | .disable = regulator_disable_regmap, | ||
87 | .is_enabled = regulator_is_enabled_regmap, | ||
88 | }; | ||
89 | |||
90 | static const struct regulator_desc act8865_reg[] = { | ||
91 | { | ||
92 | .name = "DCDC_REG1", | ||
93 | .id = ACT8865_ID_DCDC1, | ||
94 | .ops = &act8865_ops, | ||
95 | .type = REGULATOR_VOLTAGE, | ||
96 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
97 | .linear_ranges = act8865_volatge_ranges, | ||
98 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
99 | .vsel_reg = ACT8865_DCDC1_VSET1, | ||
100 | .vsel_mask = ACT8865_VSEL_MASK, | ||
101 | .enable_reg = ACT8865_DCDC1_CTRL, | ||
102 | .enable_mask = ACT8865_ENA, | ||
103 | .owner = THIS_MODULE, | ||
104 | }, | ||
105 | { | ||
106 | .name = "DCDC_REG2", | ||
107 | .id = ACT8865_ID_DCDC2, | ||
108 | .ops = &act8865_ops, | ||
109 | .type = REGULATOR_VOLTAGE, | ||
110 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
111 | .linear_ranges = act8865_volatge_ranges, | ||
112 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
113 | .vsel_reg = ACT8865_DCDC2_VSET1, | ||
114 | .vsel_mask = ACT8865_VSEL_MASK, | ||
115 | .enable_reg = ACT8865_DCDC2_CTRL, | ||
116 | .enable_mask = ACT8865_ENA, | ||
117 | .owner = THIS_MODULE, | ||
118 | }, | ||
119 | { | ||
120 | .name = "DCDC_REG3", | ||
121 | .id = ACT8865_ID_DCDC3, | ||
122 | .ops = &act8865_ops, | ||
123 | .type = REGULATOR_VOLTAGE, | ||
124 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
125 | .linear_ranges = act8865_volatge_ranges, | ||
126 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
127 | .vsel_reg = ACT8865_DCDC3_VSET1, | ||
128 | .vsel_mask = ACT8865_VSEL_MASK, | ||
129 | .enable_reg = ACT8865_DCDC3_CTRL, | ||
130 | .enable_mask = ACT8865_ENA, | ||
131 | .owner = THIS_MODULE, | ||
132 | }, | ||
133 | { | ||
134 | .name = "LDO_REG1", | ||
135 | .id = ACT8865_ID_LDO1, | ||
136 | .ops = &act8865_ops, | ||
137 | .type = REGULATOR_VOLTAGE, | ||
138 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
139 | .linear_ranges = act8865_volatge_ranges, | ||
140 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
141 | .vsel_reg = ACT8865_LDO1_VSET, | ||
142 | .vsel_mask = ACT8865_VSEL_MASK, | ||
143 | .enable_reg = ACT8865_LDO1_CTRL, | ||
144 | .enable_mask = ACT8865_ENA, | ||
145 | .owner = THIS_MODULE, | ||
146 | }, | ||
147 | { | ||
148 | .name = "LDO_REG2", | ||
149 | .id = ACT8865_ID_LDO2, | ||
150 | .ops = &act8865_ops, | ||
151 | .type = REGULATOR_VOLTAGE, | ||
152 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
153 | .linear_ranges = act8865_volatge_ranges, | ||
154 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
155 | .vsel_reg = ACT8865_LDO2_VSET, | ||
156 | .vsel_mask = ACT8865_VSEL_MASK, | ||
157 | .enable_reg = ACT8865_LDO2_CTRL, | ||
158 | .enable_mask = ACT8865_ENA, | ||
159 | .owner = THIS_MODULE, | ||
160 | }, | ||
161 | { | ||
162 | .name = "LDO_REG3", | ||
163 | .id = ACT8865_ID_LDO3, | ||
164 | .ops = &act8865_ops, | ||
165 | .type = REGULATOR_VOLTAGE, | ||
166 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
167 | .linear_ranges = act8865_volatge_ranges, | ||
168 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
169 | .vsel_reg = ACT8865_LDO3_VSET, | ||
170 | .vsel_mask = ACT8865_VSEL_MASK, | ||
171 | .enable_reg = ACT8865_LDO3_CTRL, | ||
172 | .enable_mask = ACT8865_ENA, | ||
173 | .owner = THIS_MODULE, | ||
174 | }, | ||
175 | { | ||
176 | .name = "LDO_REG4", | ||
177 | .id = ACT8865_ID_LDO4, | ||
178 | .ops = &act8865_ops, | ||
179 | .type = REGULATOR_VOLTAGE, | ||
180 | .n_voltages = ACT8865_VOLTAGE_NUM, | ||
181 | .linear_ranges = act8865_volatge_ranges, | ||
182 | .n_linear_ranges = ARRAY_SIZE(act8865_volatge_ranges), | ||
183 | .vsel_reg = ACT8865_LDO4_VSET, | ||
184 | .vsel_mask = ACT8865_VSEL_MASK, | ||
185 | .enable_reg = ACT8865_LDO4_CTRL, | ||
186 | .enable_mask = ACT8865_ENA, | ||
187 | .owner = THIS_MODULE, | ||
188 | }, | ||
189 | }; | ||
190 | |||
191 | #ifdef CONFIG_OF | ||
192 | static const struct of_device_id act8865_dt_ids[] = { | ||
193 | { .compatible = "active-semi,act8865" }, | ||
194 | { } | ||
195 | }; | ||
196 | MODULE_DEVICE_TABLE(of, act8865_dt_ids); | ||
197 | |||
198 | static struct of_regulator_match act8865_matches[] = { | ||
199 | [ACT8865_ID_DCDC1] = { .name = "DCDC_REG1"}, | ||
200 | [ACT8865_ID_DCDC2] = { .name = "DCDC_REG2"}, | ||
201 | [ACT8865_ID_DCDC3] = { .name = "DCDC_REG3"}, | ||
202 | [ACT8865_ID_LDO1] = { .name = "LDO_REG1"}, | ||
203 | [ACT8865_ID_LDO2] = { .name = "LDO_REG2"}, | ||
204 | [ACT8865_ID_LDO3] = { .name = "LDO_REG3"}, | ||
205 | [ACT8865_ID_LDO4] = { .name = "LDO_REG4"}, | ||
206 | }; | ||
207 | |||
208 | static int act8865_pdata_from_dt(struct device *dev, | ||
209 | struct device_node **of_node, | ||
210 | struct act8865_platform_data *pdata) | ||
211 | { | ||
212 | int matched, i; | ||
213 | struct device_node *np; | ||
214 | struct act8865_regulator_data *regulator; | ||
215 | |||
216 | np = of_find_node_by_name(dev->of_node, "regulators"); | ||
217 | if (!np) { | ||
218 | dev_err(dev, "missing 'regulators' subnode in DT\n"); | ||
219 | return -EINVAL; | ||
220 | } | ||
221 | |||
222 | matched = of_regulator_match(dev, np, | ||
223 | act8865_matches, ARRAY_SIZE(act8865_matches)); | ||
224 | if (matched <= 0) | ||
225 | return matched; | ||
226 | |||
227 | pdata->regulators = devm_kzalloc(dev, | ||
228 | sizeof(struct act8865_regulator_data) * | ||
229 | ARRAY_SIZE(act8865_matches), GFP_KERNEL); | ||
230 | if (!pdata->regulators) { | ||
231 | dev_err(dev, "%s: failed to allocate act8865 registor\n", | ||
232 | __func__); | ||
233 | return -ENOMEM; | ||
234 | } | ||
235 | |||
236 | pdata->num_regulators = matched; | ||
237 | regulator = pdata->regulators; | ||
238 | |||
239 | for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) { | ||
240 | regulator->id = i; | ||
241 | regulator->name = act8865_matches[i].name; | ||
242 | regulator->platform_data = act8865_matches[i].init_data; | ||
243 | of_node[i] = act8865_matches[i].of_node; | ||
244 | regulator++; | ||
245 | } | ||
246 | |||
247 | return 0; | ||
248 | } | ||
249 | #else | ||
250 | static inline int act8865_pdata_from_dt(struct device *dev, | ||
251 | struct device_node **of_node, | ||
252 | struct act8865_platform_data *pdata) | ||
253 | { | ||
254 | return 0; | ||
255 | } | ||
256 | #endif | ||
257 | |||
258 | static int act8865_pmic_probe(struct i2c_client *client, | ||
259 | const struct i2c_device_id *i2c_id) | ||
260 | { | ||
261 | struct regulator_dev **rdev; | ||
262 | struct device *dev = &client->dev; | ||
263 | struct act8865_platform_data *pdata = dev_get_platdata(dev); | ||
264 | struct regulator_config config = { }; | ||
265 | struct act8865 *act8865; | ||
266 | struct device_node *of_node[ACT8865_REG_NUM]; | ||
267 | int i, id; | ||
268 | int ret = -EINVAL; | ||
269 | int error; | ||
270 | |||
271 | if (dev->of_node && !pdata) { | ||
272 | const struct of_device_id *id; | ||
273 | struct act8865_platform_data pdata_of; | ||
274 | |||
275 | id = of_match_device(of_match_ptr(act8865_dt_ids), dev); | ||
276 | if (!id) | ||
277 | return -ENODEV; | ||
278 | |||
279 | ret = act8865_pdata_from_dt(dev, of_node, &pdata_of); | ||
280 | if (ret < 0) | ||
281 | return ret; | ||
282 | |||
283 | pdata = &pdata_of; | ||
284 | } | ||
285 | |||
286 | if (pdata->num_regulators > ACT8865_REG_NUM) { | ||
287 | dev_err(dev, "Too many regulators found!\n"); | ||
288 | return -EINVAL; | ||
289 | } | ||
290 | |||
291 | act8865 = devm_kzalloc(dev, sizeof(struct act8865), GFP_KERNEL); | ||
292 | if (!act8865) | ||
293 | return -ENOMEM; | ||
294 | |||
295 | rdev = act8865->rdev; | ||
296 | |||
297 | act8865->regmap = devm_regmap_init_i2c(client, &act8865_regmap_config); | ||
298 | if (IS_ERR(act8865->regmap)) { | ||
299 | error = PTR_ERR(act8865->regmap); | ||
300 | dev_err(&client->dev, "Failed to allocate register map: %d\n", | ||
301 | error); | ||
302 | return error; | ||
303 | } | ||
304 | |||
305 | /* Finally register devices */ | ||
306 | for (i = 0; i < ACT8865_REG_NUM; i++) { | ||
307 | |||
308 | id = pdata->regulators[i].id; | ||
309 | |||
310 | config.dev = dev; | ||
311 | config.init_data = pdata->regulators[i].platform_data; | ||
312 | config.of_node = of_node[i]; | ||
313 | config.driver_data = act8865; | ||
314 | config.regmap = act8865->regmap; | ||
315 | |||
316 | rdev[i] = devm_regulator_register(&client->dev, | ||
317 | &act8865_reg[i], &config); | ||
318 | if (IS_ERR(rdev[i])) { | ||
319 | dev_err(dev, "failed to register %s\n", | ||
320 | act8865_reg[id].name); | ||
321 | return PTR_ERR(rdev[i]); | ||
322 | } | ||
323 | } | ||
324 | |||
325 | i2c_set_clientdata(client, act8865); | ||
326 | |||
327 | return 0; | ||
328 | } | ||
329 | |||
330 | static const struct i2c_device_id act8865_ids[] = { | ||
331 | { "act8865", 0 }, | ||
332 | { }, | ||
333 | }; | ||
334 | MODULE_DEVICE_TABLE(i2c, act8865_ids); | ||
335 | |||
336 | static struct i2c_driver act8865_pmic_driver = { | ||
337 | .driver = { | ||
338 | .name = "act8865", | ||
339 | .owner = THIS_MODULE, | ||
340 | }, | ||
341 | .probe = act8865_pmic_probe, | ||
342 | .id_table = act8865_ids, | ||
343 | }; | ||
344 | |||
345 | module_i2c_driver(act8865_pmic_driver); | ||
346 | |||
347 | MODULE_DESCRIPTION("active-semi act8865 voltage regulator driver"); | ||
348 | MODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>"); | ||
349 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index c734d0980826..862e63e451d0 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -122,10 +122,8 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
122 | if (!sreg) | 122 | if (!sreg) |
123 | return -ENOMEM; | 123 | return -ENOMEM; |
124 | sreg->initdata = initdata; | 124 | sreg->initdata = initdata; |
125 | sreg->name = kstrdup(of_get_property(np, "regulator-name", NULL), | 125 | sreg->name = of_get_property(np, "regulator-name", NULL); |
126 | GFP_KERNEL); | ||
127 | rdesc = &sreg->rdesc; | 126 | rdesc = &sreg->rdesc; |
128 | memset(rdesc, 0, sizeof(*rdesc)); | ||
129 | rdesc->name = sreg->name; | 127 | rdesc->name = sreg->name; |
130 | rdesc->ops = &anatop_rops; | 128 | rdesc->ops = &anatop_rops; |
131 | rdesc->type = REGULATOR_VOLTAGE; | 129 | rdesc->type = REGULATOR_VOLTAGE; |
@@ -143,37 +141,37 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
143 | &sreg->control_reg); | 141 | &sreg->control_reg); |
144 | if (ret) { | 142 | if (ret) { |
145 | dev_err(dev, "no anatop-reg-offset property set\n"); | 143 | dev_err(dev, "no anatop-reg-offset property set\n"); |
146 | goto anatop_probe_end; | 144 | return ret; |
147 | } | 145 | } |
148 | ret = of_property_read_u32(np, "anatop-vol-bit-width", | 146 | ret = of_property_read_u32(np, "anatop-vol-bit-width", |
149 | &sreg->vol_bit_width); | 147 | &sreg->vol_bit_width); |
150 | if (ret) { | 148 | if (ret) { |
151 | dev_err(dev, "no anatop-vol-bit-width property set\n"); | 149 | dev_err(dev, "no anatop-vol-bit-width property set\n"); |
152 | goto anatop_probe_end; | 150 | return ret; |
153 | } | 151 | } |
154 | ret = of_property_read_u32(np, "anatop-vol-bit-shift", | 152 | ret = of_property_read_u32(np, "anatop-vol-bit-shift", |
155 | &sreg->vol_bit_shift); | 153 | &sreg->vol_bit_shift); |
156 | if (ret) { | 154 | if (ret) { |
157 | dev_err(dev, "no anatop-vol-bit-shift property set\n"); | 155 | dev_err(dev, "no anatop-vol-bit-shift property set\n"); |
158 | goto anatop_probe_end; | 156 | return ret; |
159 | } | 157 | } |
160 | ret = of_property_read_u32(np, "anatop-min-bit-val", | 158 | ret = of_property_read_u32(np, "anatop-min-bit-val", |
161 | &sreg->min_bit_val); | 159 | &sreg->min_bit_val); |
162 | if (ret) { | 160 | if (ret) { |
163 | dev_err(dev, "no anatop-min-bit-val property set\n"); | 161 | dev_err(dev, "no anatop-min-bit-val property set\n"); |
164 | goto anatop_probe_end; | 162 | return ret; |
165 | } | 163 | } |
166 | ret = of_property_read_u32(np, "anatop-min-voltage", | 164 | ret = of_property_read_u32(np, "anatop-min-voltage", |
167 | &sreg->min_voltage); | 165 | &sreg->min_voltage); |
168 | if (ret) { | 166 | if (ret) { |
169 | dev_err(dev, "no anatop-min-voltage property set\n"); | 167 | dev_err(dev, "no anatop-min-voltage property set\n"); |
170 | goto anatop_probe_end; | 168 | return ret; |
171 | } | 169 | } |
172 | ret = of_property_read_u32(np, "anatop-max-voltage", | 170 | ret = of_property_read_u32(np, "anatop-max-voltage", |
173 | &sreg->max_voltage); | 171 | &sreg->max_voltage); |
174 | if (ret) { | 172 | if (ret) { |
175 | dev_err(dev, "no anatop-max-voltage property set\n"); | 173 | dev_err(dev, "no anatop-max-voltage property set\n"); |
176 | goto anatop_probe_end; | 174 | return ret; |
177 | } | 175 | } |
178 | 176 | ||
179 | /* read LDO ramp up setting, only for core reg */ | 177 | /* read LDO ramp up setting, only for core reg */ |
@@ -204,27 +202,11 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
204 | if (IS_ERR(rdev)) { | 202 | if (IS_ERR(rdev)) { |
205 | dev_err(dev, "failed to register %s\n", | 203 | dev_err(dev, "failed to register %s\n", |
206 | rdesc->name); | 204 | rdesc->name); |
207 | ret = PTR_ERR(rdev); | 205 | return PTR_ERR(rdev); |
208 | goto anatop_probe_end; | ||
209 | } | 206 | } |
210 | 207 | ||
211 | platform_set_drvdata(pdev, rdev); | 208 | platform_set_drvdata(pdev, rdev); |
212 | 209 | ||
213 | anatop_probe_end: | ||
214 | if (ret) | ||
215 | kfree(sreg->name); | ||
216 | |||
217 | return ret; | ||
218 | } | ||
219 | |||
220 | static int anatop_regulator_remove(struct platform_device *pdev) | ||
221 | { | ||
222 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | ||
223 | struct anatop_regulator *sreg = rdev_get_drvdata(rdev); | ||
224 | const char *name = sreg->name; | ||
225 | |||
226 | kfree(name); | ||
227 | |||
228 | return 0; | 210 | return 0; |
229 | } | 211 | } |
230 | 212 | ||
@@ -240,7 +222,6 @@ static struct platform_driver anatop_regulator_driver = { | |||
240 | .of_match_table = of_anatop_regulator_match_tbl, | 222 | .of_match_table = of_anatop_regulator_match_tbl, |
241 | }, | 223 | }, |
242 | .probe = anatop_regulator_probe, | 224 | .probe = anatop_regulator_probe, |
243 | .remove = anatop_regulator_remove, | ||
244 | }; | 225 | }; |
245 | 226 | ||
246 | static int __init anatop_regulator_init(void) | 227 | static int __init anatop_regulator_init(void) |
@@ -259,3 +240,4 @@ MODULE_AUTHOR("Nancy Chen <Nancy.Chen@freescale.com>"); | |||
259 | MODULE_AUTHOR("Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>"); | 240 | MODULE_AUTHOR("Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>"); |
260 | MODULE_DESCRIPTION("ANATOP Regulator driver"); | 241 | MODULE_DESCRIPTION("ANATOP Regulator driver"); |
261 | MODULE_LICENSE("GPL v2"); | 242 | MODULE_LICENSE("GPL v2"); |
243 | MODULE_ALIAS("platform:anatop_regulator"); | ||
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index fd3154d86901..034ece707083 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <linux/mfd/arizona/pdata.h> | 28 | #include <linux/mfd/arizona/pdata.h> |
29 | #include <linux/mfd/arizona/registers.h> | 29 | #include <linux/mfd/arizona/registers.h> |
30 | 30 | ||
31 | #define ARIZONA_MICSUPP_MAX_SELECTOR 0x1f | ||
32 | |||
33 | struct arizona_micsupp { | 31 | struct arizona_micsupp { |
34 | struct regulator_dev *regulator; | 32 | struct regulator_dev *regulator; |
35 | struct arizona *arizona; | 33 | struct arizona *arizona; |
@@ -40,42 +38,6 @@ struct arizona_micsupp { | |||
40 | struct work_struct check_cp_work; | 38 | struct work_struct check_cp_work; |
41 | }; | 39 | }; |
42 | 40 | ||
43 | static int arizona_micsupp_list_voltage(struct regulator_dev *rdev, | ||
44 | unsigned int selector) | ||
45 | { | ||
46 | if (selector > ARIZONA_MICSUPP_MAX_SELECTOR) | ||
47 | return -EINVAL; | ||
48 | |||
49 | if (selector == ARIZONA_MICSUPP_MAX_SELECTOR) | ||
50 | return 3300000; | ||
51 | else | ||
52 | return (selector * 50000) + 1700000; | ||
53 | } | ||
54 | |||
55 | static int arizona_micsupp_map_voltage(struct regulator_dev *rdev, | ||
56 | int min_uV, int max_uV) | ||
57 | { | ||
58 | unsigned int voltage; | ||
59 | int selector; | ||
60 | |||
61 | if (min_uV < 1700000) | ||
62 | min_uV = 1700000; | ||
63 | |||
64 | if (min_uV > 3200000) | ||
65 | selector = ARIZONA_MICSUPP_MAX_SELECTOR; | ||
66 | else | ||
67 | selector = DIV_ROUND_UP(min_uV - 1700000, 50000); | ||
68 | |||
69 | if (selector < 0) | ||
70 | return -EINVAL; | ||
71 | |||
72 | voltage = arizona_micsupp_list_voltage(rdev, selector); | ||
73 | if (voltage < min_uV || voltage > max_uV) | ||
74 | return -EINVAL; | ||
75 | |||
76 | return selector; | ||
77 | } | ||
78 | |||
79 | static void arizona_micsupp_check_cp(struct work_struct *work) | 41 | static void arizona_micsupp_check_cp(struct work_struct *work) |
80 | { | 42 | { |
81 | struct arizona_micsupp *micsupp = | 43 | struct arizona_micsupp *micsupp = |
@@ -145,8 +107,8 @@ static struct regulator_ops arizona_micsupp_ops = { | |||
145 | .disable = arizona_micsupp_disable, | 107 | .disable = arizona_micsupp_disable, |
146 | .is_enabled = regulator_is_enabled_regmap, | 108 | .is_enabled = regulator_is_enabled_regmap, |
147 | 109 | ||
148 | .list_voltage = arizona_micsupp_list_voltage, | 110 | .list_voltage = regulator_list_voltage_linear_range, |
149 | .map_voltage = arizona_micsupp_map_voltage, | 111 | .map_voltage = regulator_map_voltage_linear_range, |
150 | 112 | ||
151 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 113 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
152 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 114 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
@@ -155,11 +117,16 @@ static struct regulator_ops arizona_micsupp_ops = { | |||
155 | .set_bypass = arizona_micsupp_set_bypass, | 117 | .set_bypass = arizona_micsupp_set_bypass, |
156 | }; | 118 | }; |
157 | 119 | ||
120 | static const struct regulator_linear_range arizona_micsupp_ranges[] = { | ||
121 | REGULATOR_LINEAR_RANGE(1700000, 0, 0x1e, 50000), | ||
122 | REGULATOR_LINEAR_RANGE(3300000, 0x1f, 0x1f, 0), | ||
123 | }; | ||
124 | |||
158 | static const struct regulator_desc arizona_micsupp = { | 125 | static const struct regulator_desc arizona_micsupp = { |
159 | .name = "MICVDD", | 126 | .name = "MICVDD", |
160 | .supply_name = "CPVDD", | 127 | .supply_name = "CPVDD", |
161 | .type = REGULATOR_VOLTAGE, | 128 | .type = REGULATOR_VOLTAGE, |
162 | .n_voltages = ARIZONA_MICSUPP_MAX_SELECTOR + 1, | 129 | .n_voltages = 32, |
163 | .ops = &arizona_micsupp_ops, | 130 | .ops = &arizona_micsupp_ops, |
164 | 131 | ||
165 | .vsel_reg = ARIZONA_LDO2_CONTROL_1, | 132 | .vsel_reg = ARIZONA_LDO2_CONTROL_1, |
@@ -169,6 +136,9 @@ static const struct regulator_desc arizona_micsupp = { | |||
169 | .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, | 136 | .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, |
170 | .bypass_mask = ARIZONA_CPMIC_BYPASS, | 137 | .bypass_mask = ARIZONA_CPMIC_BYPASS, |
171 | 138 | ||
139 | .linear_ranges = arizona_micsupp_ranges, | ||
140 | .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ranges), | ||
141 | |||
172 | .enable_time = 3000, | 142 | .enable_time = 3000, |
173 | 143 | ||
174 | .owner = THIS_MODULE, | 144 | .owner = THIS_MODULE, |
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index b9f1d24c6812..8b17d786cb71 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c | |||
@@ -99,7 +99,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { | |||
99 | .sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK, | 99 | .sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK, |
100 | .control_reg = AS3722_SD0_CONTROL_REG, | 100 | .control_reg = AS3722_SD0_CONTROL_REG, |
101 | .mode_mask = AS3722_SD0_MODE_FAST, | 101 | .mode_mask = AS3722_SD0_MODE_FAST, |
102 | .n_voltages = AS3722_SD0_VSEL_MAX + 1, | ||
103 | }, | 102 | }, |
104 | { | 103 | { |
105 | .regulator_id = AS3722_REGULATOR_ID_SD1, | 104 | .regulator_id = AS3722_REGULATOR_ID_SD1, |
@@ -112,7 +111,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { | |||
112 | .sleep_ctrl_mask = AS3722_SD1_EXT_ENABLE_MASK, | 111 | .sleep_ctrl_mask = AS3722_SD1_EXT_ENABLE_MASK, |
113 | .control_reg = AS3722_SD1_CONTROL_REG, | 112 | .control_reg = AS3722_SD1_CONTROL_REG, |
114 | .mode_mask = AS3722_SD1_MODE_FAST, | 113 | .mode_mask = AS3722_SD1_MODE_FAST, |
115 | .n_voltages = AS3722_SD0_VSEL_MAX + 1, | ||
116 | }, | 114 | }, |
117 | { | 115 | { |
118 | .regulator_id = AS3722_REGULATOR_ID_SD2, | 116 | .regulator_id = AS3722_REGULATOR_ID_SD2, |
@@ -181,7 +179,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { | |||
181 | .sleep_ctrl_mask = AS3722_SD6_EXT_ENABLE_MASK, | 179 | .sleep_ctrl_mask = AS3722_SD6_EXT_ENABLE_MASK, |
182 | .control_reg = AS3722_SD6_CONTROL_REG, | 180 | .control_reg = AS3722_SD6_CONTROL_REG, |
183 | .mode_mask = AS3722_SD6_MODE_FAST, | 181 | .mode_mask = AS3722_SD6_MODE_FAST, |
184 | .n_voltages = AS3722_SD0_VSEL_MAX + 1, | ||
185 | }, | 182 | }, |
186 | { | 183 | { |
187 | .regulator_id = AS3722_REGULATOR_ID_LDO0, | 184 | .regulator_id = AS3722_REGULATOR_ID_LDO0, |
@@ -595,6 +592,22 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, | |||
595 | return as3722_update_bits(as3722, reg, mask, val); | 592 | return as3722_update_bits(as3722, reg, mask, val); |
596 | } | 593 | } |
597 | 594 | ||
595 | static bool as3722_sd0_is_low_voltage(struct as3722_regulators *as3722_regs) | ||
596 | { | ||
597 | int err; | ||
598 | unsigned val; | ||
599 | |||
600 | err = as3722_read(as3722_regs->as3722, AS3722_FUSE7_REG, &val); | ||
601 | if (err < 0) { | ||
602 | dev_err(as3722_regs->dev, "Reg 0x%02x read failed: %d\n", | ||
603 | AS3722_FUSE7_REG, err); | ||
604 | return false; | ||
605 | } | ||
606 | if (val & AS3722_FUSE7_SD0_LOW_VOLTAGE) | ||
607 | return true; | ||
608 | return false; | ||
609 | } | ||
610 | |||
598 | static const struct regulator_linear_range as3722_sd2345_ranges[] = { | 611 | static const struct regulator_linear_range as3722_sd2345_ranges[] = { |
599 | REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), | 612 | REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), |
600 | REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), | 613 | REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), |
@@ -820,9 +833,19 @@ static int as3722_regulator_probe(struct platform_device *pdev) | |||
820 | ops = &as3722_sd016_extcntrl_ops; | 833 | ops = &as3722_sd016_extcntrl_ops; |
821 | else | 834 | else |
822 | ops = &as3722_sd016_ops; | 835 | ops = &as3722_sd016_ops; |
823 | as3722_regs->desc[id].min_uV = 610000; | 836 | if (id == AS3722_REGULATOR_ID_SD0 && |
837 | as3722_sd0_is_low_voltage(as3722_regs)) { | ||
838 | as3722_regs->desc[id].n_voltages = | ||
839 | AS3722_SD0_VSEL_LOW_VOL_MAX + 1; | ||
840 | as3722_regs->desc[id].min_uV = 410000; | ||
841 | } else { | ||
842 | as3722_regs->desc[id].n_voltages = | ||
843 | AS3722_SD0_VSEL_MAX + 1, | ||
844 | as3722_regs->desc[id].min_uV = 610000; | ||
845 | } | ||
824 | as3722_regs->desc[id].uV_step = 10000; | 846 | as3722_regs->desc[id].uV_step = 10000; |
825 | as3722_regs->desc[id].linear_min_sel = 1; | 847 | as3722_regs->desc[id].linear_min_sel = 1; |
848 | as3722_regs->desc[id].enable_time = 600; | ||
826 | break; | 849 | break; |
827 | case AS3722_REGULATOR_ID_SD2: | 850 | case AS3722_REGULATOR_ID_SD2: |
828 | case AS3722_REGULATOR_ID_SD3: | 851 | case AS3722_REGULATOR_ID_SD3: |
@@ -842,9 +865,6 @@ static int as3722_regulator_probe(struct platform_device *pdev) | |||
842 | ops = &as3722_ldo_extcntrl_ops; | 865 | ops = &as3722_ldo_extcntrl_ops; |
843 | else | 866 | else |
844 | ops = &as3722_ldo_ops; | 867 | ops = &as3722_ldo_ops; |
845 | as3722_regs->desc[id].min_uV = 825000; | ||
846 | as3722_regs->desc[id].uV_step = 25000; | ||
847 | as3722_regs->desc[id].linear_min_sel = 1; | ||
848 | as3722_regs->desc[id].enable_time = 500; | 868 | as3722_regs->desc[id].enable_time = 500; |
849 | as3722_regs->desc[id].linear_ranges = as3722_ldo_ranges; | 869 | as3722_regs->desc[id].linear_ranges = as3722_ldo_ranges; |
850 | as3722_regs->desc[id].n_linear_ranges = | 870 | as3722_regs->desc[id].n_linear_ranges = |
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 8b5e4c712a01..c31e0485de25 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c | |||
@@ -323,7 +323,7 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip) | |||
323 | if (ret) | 323 | if (ret) |
324 | return ret; | 324 | return ret; |
325 | dev_info(pfuze_chip->dev, | 325 | dev_info(pfuze_chip->dev, |
326 | "Full lay: %x, Metal lay: %x\n", | 326 | "Full layer: %x, Metal layer: %x\n", |
327 | (value & 0xf0) >> 4, value & 0x0f); | 327 | (value & 0xf0) >> 4, value & 0x0f); |
328 | 328 | ||
329 | ret = regmap_read(pfuze_chip->regmap, PFUZE100_FABID, &value); | 329 | ret = regmap_read(pfuze_chip->regmap, PFUZE100_FABID, &value); |
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h index 16bf8a0dcd97..bb9616dc0efa 100644 --- a/include/linux/mfd/as3722.h +++ b/include/linux/mfd/as3722.h | |||
@@ -151,6 +151,7 @@ | |||
151 | #define AS3722_ASIC_ID1_REG 0x90 | 151 | #define AS3722_ASIC_ID1_REG 0x90 |
152 | #define AS3722_ASIC_ID2_REG 0x91 | 152 | #define AS3722_ASIC_ID2_REG 0x91 |
153 | #define AS3722_LOCK_REG 0x9E | 153 | #define AS3722_LOCK_REG 0x9E |
154 | #define AS3722_FUSE7_REG 0xA7 | ||
154 | #define AS3722_MAX_REGISTER 0xF4 | 155 | #define AS3722_MAX_REGISTER 0xF4 |
155 | 156 | ||
156 | #define AS3722_SD0_EXT_ENABLE_MASK 0x03 | 157 | #define AS3722_SD0_EXT_ENABLE_MASK 0x03 |
@@ -224,6 +225,7 @@ | |||
224 | #define AS3722_SD_VSEL_MASK 0x7F | 225 | #define AS3722_SD_VSEL_MASK 0x7F |
225 | #define AS3722_SD0_VSEL_MIN 0x01 | 226 | #define AS3722_SD0_VSEL_MIN 0x01 |
226 | #define AS3722_SD0_VSEL_MAX 0x5A | 227 | #define AS3722_SD0_VSEL_MAX 0x5A |
228 | #define AS3722_SD0_VSEL_LOW_VOL_MAX 0x6E | ||
227 | #define AS3722_SD2_VSEL_MIN 0x01 | 229 | #define AS3722_SD2_VSEL_MIN 0x01 |
228 | #define AS3722_SD2_VSEL_MAX 0x7F | 230 | #define AS3722_SD2_VSEL_MAX 0x7F |
229 | 231 | ||
@@ -341,6 +343,8 @@ | |||
341 | #define AS3722_EXT_CONTROL_ENABLE2 0x2 | 343 | #define AS3722_EXT_CONTROL_ENABLE2 0x2 |
342 | #define AS3722_EXT_CONTROL_ENABLE3 0x3 | 344 | #define AS3722_EXT_CONTROL_ENABLE3 0x3 |
343 | 345 | ||
346 | #define AS3722_FUSE7_SD0_LOW_VOLTAGE BIT(4) | ||
347 | |||
344 | /* Interrupt IDs */ | 348 | /* Interrupt IDs */ |
345 | enum as3722_irq { | 349 | enum as3722_irq { |
346 | AS3722_IRQ_LID, | 350 | AS3722_IRQ_LID, |
diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h new file mode 100644 index 000000000000..49206c1b4905 --- /dev/null +++ b/include/linux/regulator/act8865.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * act8865.h -- Voltage regulation for the active-semi act8865 | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __LINUX_REGULATOR_ACT8865_H | ||
17 | #define __LINUX_REGULATOR_ACT8865_H | ||
18 | |||
19 | #include <linux/regulator/machine.h> | ||
20 | |||
21 | enum { | ||
22 | ACT8865_ID_DCDC1, | ||
23 | ACT8865_ID_DCDC2, | ||
24 | ACT8865_ID_DCDC3, | ||
25 | ACT8865_ID_LDO1, | ||
26 | ACT8865_ID_LDO2, | ||
27 | ACT8865_ID_LDO3, | ||
28 | ACT8865_ID_LDO4, | ||
29 | ACT8865_REG_NUM, | ||
30 | }; | ||
31 | |||
32 | /** | ||
33 | * act8865_regulator_data - regulator data | ||
34 | * @id: regulator id | ||
35 | * @name: regulator name | ||
36 | * @platform_data: regulator init data | ||
37 | */ | ||
38 | struct act8865_regulator_data { | ||
39 | int id; | ||
40 | const char *name; | ||
41 | struct regulator_init_data *platform_data; | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * act8865_platform_data - platform data for act8865 | ||
46 | * @num_regulators: number of regulators used | ||
47 | * @regulators: pointer to regulators used | ||
48 | */ | ||
49 | struct act8865_platform_data { | ||
50 | int num_regulators; | ||
51 | struct act8865_regulator_data *regulators; | ||
52 | }; | ||
53 | #endif | ||