diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-07-22 14:32:00 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-07-22 14:32:00 -0400 |
| commit | 3384fb98845dc014770caa224d61a2effd258ca5 (patch) | |
| tree | 8189134a4938632e2d06e93af04c9fc1f3c2d4c9 /include/linux/regulator | |
| parent | 8cfc545e0e3e6cc82acfdc79321b41eeeab0ca45 (diff) | |
| parent | ade7515fefad9af13f6dd469f35bb413b6a5b473 (diff) | |
Merge branch 'regulator-drivers' into regulator-next
Diffstat (limited to 'include/linux/regulator')
| -rw-r--r-- | include/linux/regulator/driver.h | 23 | ||||
| -rw-r--r-- | include/linux/regulator/fixed.h | 2 | ||||
| -rw-r--r-- | include/linux/regulator/lp872x.h | 90 | ||||
| -rw-r--r-- | include/linux/regulator/machine.h | 3 |
4 files changed, 118 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 2513a54ca2e8..bac4c871f3bd 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -69,6 +69,8 @@ enum regulator_status { | |||
| 69 | * | 69 | * |
| 70 | * @enable_time: Time taken for the regulator voltage output voltage to | 70 | * @enable_time: Time taken for the regulator voltage output voltage to |
| 71 | * stabilise after being enabled, in microseconds. | 71 | * stabilise after being enabled, in microseconds. |
| 72 | * @set_ramp_delay: Set the ramp delay for the regulator. The driver should | ||
| 73 | * select ramp delay equal to or less than(closest) ramp_delay. | ||
| 72 | * @set_voltage_time_sel: Time taken for the regulator voltage output voltage | 74 | * @set_voltage_time_sel: Time taken for the regulator voltage output voltage |
| 73 | * to stabilise after being set to a new value, in microseconds. | 75 | * to stabilise after being set to a new value, in microseconds. |
| 74 | * The function provides the from and to voltage selector, the | 76 | * The function provides the from and to voltage selector, the |
| @@ -115,6 +117,7 @@ struct regulator_ops { | |||
| 115 | 117 | ||
| 116 | /* Time taken to enable or set voltage on the regulator */ | 118 | /* Time taken to enable or set voltage on the regulator */ |
| 117 | int (*enable_time) (struct regulator_dev *); | 119 | int (*enable_time) (struct regulator_dev *); |
| 120 | int (*set_ramp_delay) (struct regulator_dev *, int ramp_delay); | ||
| 118 | int (*set_voltage_time_sel) (struct regulator_dev *, | 121 | int (*set_voltage_time_sel) (struct regulator_dev *, |
| 119 | unsigned int old_selector, | 122 | unsigned int old_selector, |
| 120 | unsigned int new_selector); | 123 | unsigned int new_selector); |
| @@ -172,12 +175,15 @@ enum regulator_type { | |||
| 172 | * | 175 | * |
| 173 | * @min_uV: Voltage given by the lowest selector (if linear mapping) | 176 | * @min_uV: Voltage given by the lowest selector (if linear mapping) |
| 174 | * @uV_step: Voltage increase with each selector (if linear mapping) | 177 | * @uV_step: Voltage increase with each selector (if linear mapping) |
| 178 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) | ||
| 175 | * @volt_table: Voltage mapping table (if table based mapping) | 179 | * @volt_table: Voltage mapping table (if table based mapping) |
| 176 | * | 180 | * |
| 177 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ | 181 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ |
| 178 | * @vsel_mask: Mask for register bitfield used for selector | 182 | * @vsel_mask: Mask for register bitfield used for selector |
| 179 | * @enable_reg: Register for control when using regmap enable/disable ops | 183 | * @enable_reg: Register for control when using regmap enable/disable ops |
| 180 | * @enable_mask: Mask for control when using regmap enable/disable ops | 184 | * @enable_mask: Mask for control when using regmap enable/disable ops |
| 185 | * | ||
| 186 | * @enable_time: Time taken for initial enable of regulator (in uS). | ||
| 181 | */ | 187 | */ |
| 182 | struct regulator_desc { | 188 | struct regulator_desc { |
| 183 | const char *name; | 189 | const char *name; |
| @@ -191,6 +197,7 @@ struct regulator_desc { | |||
| 191 | 197 | ||
| 192 | unsigned int min_uV; | 198 | unsigned int min_uV; |
| 193 | unsigned int uV_step; | 199 | unsigned int uV_step; |
| 200 | unsigned int ramp_delay; | ||
| 194 | 201 | ||
| 195 | const unsigned int *volt_table; | 202 | const unsigned int *volt_table; |
| 196 | 203 | ||
| @@ -198,6 +205,8 @@ struct regulator_desc { | |||
| 198 | unsigned int vsel_mask; | 205 | unsigned int vsel_mask; |
| 199 | unsigned int enable_reg; | 206 | unsigned int enable_reg; |
| 200 | unsigned int enable_mask; | 207 | unsigned int enable_mask; |
| 208 | |||
| 209 | unsigned int enable_time; | ||
| 201 | }; | 210 | }; |
| 202 | 211 | ||
| 203 | /** | 212 | /** |
| @@ -213,6 +222,9 @@ struct regulator_desc { | |||
| 213 | * @of_node: OpenFirmware node to parse for device tree bindings (may be | 222 | * @of_node: OpenFirmware node to parse for device tree bindings (may be |
| 214 | * NULL). | 223 | * NULL). |
| 215 | * @regmap: regmap to use for core regmap helpers | 224 | * @regmap: regmap to use for core regmap helpers |
| 225 | * @ena_gpio: GPIO controlling regulator enable. | ||
| 226 | * @ena_gpio_invert: Sense for GPIO enable control. | ||
| 227 | * @ena_gpio_flags: Flags to use when calling gpio_request_one() | ||
| 216 | */ | 228 | */ |
| 217 | struct regulator_config { | 229 | struct regulator_config { |
| 218 | struct device *dev; | 230 | struct device *dev; |
| @@ -220,6 +232,10 @@ struct regulator_config { | |||
| 220 | void *driver_data; | 232 | void *driver_data; |
| 221 | struct device_node *of_node; | 233 | struct device_node *of_node; |
| 222 | struct regmap *regmap; | 234 | struct regmap *regmap; |
| 235 | |||
| 236 | int ena_gpio; | ||
| 237 | unsigned int ena_gpio_invert:1; | ||
| 238 | unsigned int ena_gpio_flags; | ||
| 223 | }; | 239 | }; |
| 224 | 240 | ||
| 225 | /* | 241 | /* |
| @@ -258,6 +274,10 @@ struct regulator_dev { | |||
| 258 | void *reg_data; /* regulator_dev data */ | 274 | void *reg_data; /* regulator_dev data */ |
| 259 | 275 | ||
| 260 | struct dentry *debugfs; | 276 | struct dentry *debugfs; |
| 277 | |||
| 278 | int ena_gpio; | ||
| 279 | unsigned int ena_gpio_invert:1; | ||
| 280 | unsigned int ena_gpio_state:1; | ||
| 261 | }; | 281 | }; |
| 262 | 282 | ||
| 263 | struct regulator_dev * | 283 | struct regulator_dev * |
| @@ -287,6 +307,9 @@ int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); | |||
| 287 | int regulator_is_enabled_regmap(struct regulator_dev *rdev); | 307 | int regulator_is_enabled_regmap(struct regulator_dev *rdev); |
| 288 | int regulator_enable_regmap(struct regulator_dev *rdev); | 308 | int regulator_enable_regmap(struct regulator_dev *rdev); |
| 289 | int regulator_disable_regmap(struct regulator_dev *rdev); | 309 | int regulator_disable_regmap(struct regulator_dev *rdev); |
| 310 | int regulator_set_voltage_time_sel(struct regulator_dev *rdev, | ||
| 311 | unsigned int old_selector, | ||
| 312 | unsigned int new_selector); | ||
| 290 | 313 | ||
| 291 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); | 314 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); |
| 292 | 315 | ||
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index 680f24e08af2..48918be649d4 100644 --- a/include/linux/regulator/fixed.h +++ b/include/linux/regulator/fixed.h | |||
| @@ -22,6 +22,7 @@ struct regulator_init_data; | |||
| 22 | /** | 22 | /** |
| 23 | * struct fixed_voltage_config - fixed_voltage_config structure | 23 | * struct fixed_voltage_config - fixed_voltage_config structure |
| 24 | * @supply_name: Name of the regulator supply | 24 | * @supply_name: Name of the regulator supply |
| 25 | * @input_supply: Name of the input regulator supply | ||
| 25 | * @microvolts: Output voltage of regulator | 26 | * @microvolts: Output voltage of regulator |
| 26 | * @gpio: GPIO to use for enable control | 27 | * @gpio: GPIO to use for enable control |
| 27 | * set to -EINVAL if not used | 28 | * set to -EINVAL if not used |
| @@ -46,6 +47,7 @@ struct regulator_init_data; | |||
| 46 | */ | 47 | */ |
| 47 | struct fixed_voltage_config { | 48 | struct fixed_voltage_config { |
| 48 | const char *supply_name; | 49 | const char *supply_name; |
| 50 | const char *input_supply; | ||
| 49 | int microvolts; | 51 | int microvolts; |
| 50 | int gpio; | 52 | int gpio; |
| 51 | unsigned startup_delay; | 53 | unsigned startup_delay; |
diff --git a/include/linux/regulator/lp872x.h b/include/linux/regulator/lp872x.h new file mode 100644 index 000000000000..132e05c46661 --- /dev/null +++ b/include/linux/regulator/lp872x.h | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2012 Texas Instruments | ||
| 3 | * | ||
| 4 | * Author: Milo(Woogyom) Kim <milo.kim@ti.com> | ||
| 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 version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __LP872X_REGULATOR_H__ | ||
| 13 | #define __LP872X_REGULATOR_H__ | ||
| 14 | |||
| 15 | #include <linux/regulator/machine.h> | ||
| 16 | #include <linux/platform_device.h> | ||
| 17 | #include <linux/gpio.h> | ||
| 18 | |||
| 19 | #define LP872X_MAX_REGULATORS 9 | ||
| 20 | |||
| 21 | enum lp872x_regulator_id { | ||
| 22 | LP8720_ID_BASE, | ||
| 23 | LP8720_ID_LDO1 = LP8720_ID_BASE, | ||
| 24 | LP8720_ID_LDO2, | ||
| 25 | LP8720_ID_LDO3, | ||
| 26 | LP8720_ID_LDO4, | ||
| 27 | LP8720_ID_LDO5, | ||
| 28 | LP8720_ID_BUCK, | ||
| 29 | |||
| 30 | LP8725_ID_BASE, | ||
| 31 | LP8725_ID_LDO1 = LP8725_ID_BASE, | ||
| 32 | LP8725_ID_LDO2, | ||
| 33 | LP8725_ID_LDO3, | ||
| 34 | LP8725_ID_LDO4, | ||
| 35 | LP8725_ID_LDO5, | ||
| 36 | LP8725_ID_LILO1, | ||
| 37 | LP8725_ID_LILO2, | ||
| 38 | LP8725_ID_BUCK1, | ||
| 39 | LP8725_ID_BUCK2, | ||
| 40 | |||
| 41 | LP872X_ID_MAX, | ||
| 42 | }; | ||
| 43 | |||
| 44 | enum lp872x_dvs_state { | ||
| 45 | DVS_LOW = GPIOF_OUT_INIT_LOW, | ||
| 46 | DVS_HIGH = GPIOF_OUT_INIT_HIGH, | ||
| 47 | }; | ||
| 48 | |||
| 49 | enum lp872x_dvs_sel { | ||
| 50 | SEL_V1, | ||
| 51 | SEL_V2, | ||
| 52 | }; | ||
| 53 | |||
| 54 | /** | ||
| 55 | * lp872x_dvs | ||
| 56 | * @gpio : gpio pin number for dvs control | ||
| 57 | * @vsel : dvs selector for buck v1 or buck v2 register | ||
| 58 | * @init_state : initial dvs pin state | ||
| 59 | */ | ||
| 60 | struct lp872x_dvs { | ||
| 61 | int gpio; | ||
| 62 | enum lp872x_dvs_sel vsel; | ||
| 63 | enum lp872x_dvs_state init_state; | ||
| 64 | }; | ||
| 65 | |||
| 66 | /** | ||
| 67 | * lp872x_regdata | ||
| 68 | * @id : regulator id | ||
| 69 | * @init_data : init data for each regulator | ||
| 70 | */ | ||
| 71 | struct lp872x_regulator_data { | ||
| 72 | enum lp872x_regulator_id id; | ||
| 73 | struct regulator_init_data *init_data; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /** | ||
| 77 | * lp872x_platform_data | ||
| 78 | * @general_config : the value of LP872X_GENERAL_CFG register | ||
| 79 | * @update_config : if LP872X_GENERAL_CFG register is updated, set true | ||
| 80 | * @regulator_data : platform regulator id and init data | ||
| 81 | * @dvs : dvs data for buck voltage control | ||
| 82 | */ | ||
| 83 | struct lp872x_platform_data { | ||
| 84 | u8 general_config; | ||
| 85 | bool update_config; | ||
| 86 | struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS]; | ||
| 87 | struct lp872x_dvs *dvs; | ||
| 88 | }; | ||
| 89 | |||
| 90 | #endif | ||
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index b02108446be7..40dd0a394cfa 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -92,6 +92,7 @@ struct regulator_state { | |||
| 92 | * mode. | 92 | * mode. |
| 93 | * @initial_state: Suspend state to set by default. | 93 | * @initial_state: Suspend state to set by default. |
| 94 | * @initial_mode: Mode to set at startup. | 94 | * @initial_mode: Mode to set at startup. |
| 95 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) | ||
| 95 | */ | 96 | */ |
| 96 | struct regulation_constraints { | 97 | struct regulation_constraints { |
| 97 | 98 | ||
| @@ -125,6 +126,8 @@ struct regulation_constraints { | |||
| 125 | /* mode to set on startup */ | 126 | /* mode to set on startup */ |
| 126 | unsigned int initial_mode; | 127 | unsigned int initial_mode; |
| 127 | 128 | ||
| 129 | unsigned int ramp_delay; | ||
| 130 | |||
| 128 | /* constraint flags */ | 131 | /* constraint flags */ |
| 129 | unsigned always_on:1; /* regulator never off when system is on */ | 132 | unsigned always_on:1; /* regulator never off when system is on */ |
| 130 | unsigned boot_on:1; /* bootloader/firmware enabled regulator */ | 133 | unsigned boot_on:1; /* bootloader/firmware enabled regulator */ |
