Pull regulator updates from Mark Brown: "The bulk of the standout changes in this release are cleanups, with the core work being a combination of factoring out common code into helpers and the completion of the conversion of the core to use GPIO descriptors. Summary: - Addition of helper functions for current limits and conversion of drivers to use them by Axel Lin. - Lots and lots of cleanups from Axel Lin. - Conversion of the core to use GPIO descriptors rather than numbers by Linus Walleij. - New drivers for Maxim MAX77650 and ROHM BD70528" * tag 'regulator-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (131 commits) regulator: mc13xxx: Constify regulator_ops variables regulator: palmas: Constify palmas_smps_ramp_delay array regulator: wm831x-dcdc: Convert to use regulator_set/get_current_limit_regmap regulator: pv88090: Convert to use regulator_set/get_current_limit_regmap regulator: pv88080: Convert to use regulator_set/get_current_limit_regmap regulator: pv88060: Convert to use regulator_set/get_current_limit_regmap regulator: max77650: Convert to use regulator_set/get_current_limit_regmap regulator: lp873x: Convert to use regulator_set/get_current_limit_regmap regulator: lp872x: Convert to use regulator_set/get_current_limit_regmap regulator: da9210: Convert to use regulator_set/get_current_limit_regmap regulator: da9055: Convert to use regulator_set/get_current_limit_regmap regulator: core: Add set/get_current_limit helpers for regmap users regulator: Fix comment for csel_reg and csel_mask regulator: stm32-vrefbuf: add power management support regulator: 88pm8607: Remove unused fields from struct pm8607_regulator_info regulator: 88pm8607: Simplify pm8607_list_voltage implementation regulator: cpcap: Constify omap4_regulators and xoom_regulators regulator: cpcap: Remove unused vsel_shift from struct cpcap_regulator dt-bindings: regulator: tps65218: rectify units of LS3 dt-bindings: regulator: add LS2 load switch documentation ...
Showing the changes to include/linux (4 of 94 files). Show all
Unified · Split
| @@ -208,6 +208,7 @@ enum tps65218_regulator_id { · 207 unmodified lines | ||
| 208 | 208 | /* LDOs */ |
| 209 | 209 | TPS65218_LDO_1, |
| 210 | 210 | /* LS's */ |
| 211 | + TPS65218_LS_2, | |
| 211 | 212 | TPS65218_LS_3, |
| 212 | 213 | }; |
| 213 | 214 | |
| @@ -218,7 +219,7 @@ enum tps65218_regulator_id { · 4 unmodified lines | ||
| 218 | 219 | /* Number of LDO voltage regulators available */ |
| 219 | 220 | #define TPS65218_NUM_LDO 1 |
| 220 | 221 | /* Number of total LS current regulators available */ |
| 221 | −#define TPS65218_NUM_LS 1 | |
| 222 | +#define TPS65218_NUM_LS 2 | |
| 222 | 223 | /* Number of total regulators available */ |
| 223 | 224 | #define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO \ |
| 224 | 225 | + TPS65218_NUM_LS) |
| @@ -264,6 +264,7 @@ enum regulator_type { · 263 unmodified lines | ||
| 264 | 264 | * @continuous_voltage_range: Indicates if the regulator can set any |
| 265 | 265 | * voltage within constrains range. |
| 266 | 266 | * @n_voltages: Number of selectors available for ops.list_voltage(). |
| 267 | + * @n_current_limits: Number of selectors available for current limits | |
| 267 | 268 | * |
| 268 | 269 | * @min_uV: Voltage given by the lowest selector (if linear mapping) |
| 269 | 270 | * @uV_step: Voltage increase with each selector (if linear mapping) |
| @@ -278,14 +279,15 @@ enum regulator_type { · 8 unmodified lines | ||
| 278 | 279 | * @n_linear_ranges: Number of entries in the @linear_ranges (and in |
| 279 | 280 | * linear_range_selectors if used) table(s). |
| 280 | 281 | * @volt_table: Voltage mapping table (if table based mapping) |
| 282 | + * @curr_table: Current limit mapping table (if table based mapping) | |
| 281 | 283 | * |
| 282 | 284 | * @vsel_range_reg: Register for range selector when using pickable ranges |
| 283 | 285 | * and regulator_regmap_X_voltage_X_pickable functions. |
| 284 | 286 | * @vsel_range_mask: Mask for register bitfield used for range selector |
| 285 | 287 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ |
| 286 | 288 | * @vsel_mask: Mask for register bitfield used for selector |
| 287 | − * @csel_reg: Register for TPS65218 LS3 current regulator | |
| 288 | − * @csel_mask: Mask for TPS65218 LS3 current regulator | |
| 289 | + * @csel_reg: Register for current limit selector using regmap set_current_limit | |
| 290 | + * @csel_mask: Mask for register bitfield used for current limit selector | |
| 289 | 291 | * @apply_reg: Register for initiate voltage change on the output when |
| 290 | 292 | * using regulator_set_voltage_sel_regmap |
| 291 | 293 | * @apply_bit: Register bitfield used for initiate voltage change on the |
| @@ -333,6 +335,7 @@ struct regulator_desc { · 41 unmodified lines | ||
| 333 | 335 | int id; |
| 334 | 336 | unsigned int continuous_voltage_range:1; |
| 335 | 337 | unsigned n_voltages; |
| 338 | + unsigned int n_current_limits; | |
| 336 | 339 | const struct regulator_ops *ops; |
| 337 | 340 | int irq; |
| 338 | 341 | enum regulator_type type; |
| @@ -351,6 +354,7 @@ struct regulator_desc { · 12 unmodified lines | ||
| 351 | 354 | int n_linear_ranges; |
| 352 | 355 | |
| 353 | 356 | const unsigned int *volt_table; |
| 357 | + const unsigned int *curr_table; | |
| 354 | 358 | |
| 355 | 359 | unsigned int vsel_range_reg; |
| 356 | 360 | unsigned int vsel_range_mask; |
| @@ -401,13 +405,7 @@ struct regulator_desc { · 44 unmodified lines | ||
| 401 | 405 | * NULL). |
| 402 | 406 | * @regmap: regmap to use for core regmap helpers if dev_get_regmap() is |
| 403 | 407 | * insufficient. |
| 404 | − * @ena_gpio_initialized: GPIO controlling regulator enable was properly | |
| 405 | − * initialized, meaning that >= 0 is a valid gpio | |
| 406 | − * identifier and < 0 is a non existent gpio. | |
| 407 | − * @ena_gpio: GPIO controlling regulator enable. | |
| 408 | − * @ena_gpiod: GPIO descriptor controlling regulator enable. | |
| 409 | − * @ena_gpio_invert: Sense for GPIO enable control. | |
| 410 | − * @ena_gpio_flags: Flags to use when calling gpio_request_one() | |
| 408 | + * @ena_gpiod: GPIO controlling regulator enable. | |
| 411 | 409 | */ |
| 412 | 410 | struct regulator_config { |
| 413 | 411 | struct device *dev; |
| @@ -416,11 +414,7 @@ struct regulator_config { · 2 unmodified lines | ||
| 416 | 414 | struct device_node *of_node; |
| 417 | 415 | struct regmap *regmap; |
| 418 | 416 | |
| 419 | − bool ena_gpio_initialized; | |
| 420 | − int ena_gpio; | |
| 421 | 417 | struct gpio_desc *ena_gpiod; |
| 422 | − unsigned int ena_gpio_invert:1; | |
| 423 | − unsigned int ena_gpio_flags; | |
| 424 | 418 | }; |
| 425 | 419 | |
| 426 | 420 | /* |
| @@ -503,6 +497,7 @@ int regulator_notifier_call_chain(struct regulator_dev *rdev, · 76 unmodified lines | ||
| 503 | 497 | |
| 504 | 498 | void *rdev_get_drvdata(struct regulator_dev *rdev); |
| 505 | 499 | struct device *rdev_get_dev(struct regulator_dev *rdev); |
| 500 | +struct regmap *rdev_get_regmap(struct regulator_dev *rdev); | |
| 506 | 501 | int rdev_get_id(struct regulator_dev *rdev); |
| 507 | 502 | |
| 508 | 503 | int regulator_mode_to_status(unsigned int); |
| @@ -543,9 +538,18 @@ int regulator_set_pull_down_regmap(struct regulator_dev *rdev); · 34 unmodified lines | ||
| 543 | 538 | |
| 544 | 539 | int regulator_set_active_discharge_regmap(struct regulator_dev *rdev, |
| 545 | 540 | bool enable); |
| 541 | +int regulator_set_current_limit_regmap(struct regulator_dev *rdev, | |
| 542 | + int min_uA, int max_uA); | |
| 543 | +int regulator_get_current_limit_regmap(struct regulator_dev *rdev); | |
| 546 | 544 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); |
| 547 | 545 | |
| 548 | 546 | void regulator_lock(struct regulator_dev *rdev); |
| 549 | 547 | void regulator_unlock(struct regulator_dev *rdev); |
| 550 | 548 | |
| 549 | +/* | |
| 550 | + * Helper functions intended to be used by regulator drivers prior registering | |
| 551 | + * their regulators. | |
| 552 | + */ | |
| 553 | +int regulator_desc_list_voltage_linear_range(const struct regulator_desc *desc, | |
| 554 | + unsigned int selector); | |
| 551 | 555 | #endif |
| @@ -25,14 +25,6 @@ struct regulator_init_data; · 24 unmodified lines | ||
| 25 | 25 | * @input_supply: Name of the input regulator supply |
| 26 | 26 | * @microvolts: Output voltage of regulator |
| 27 | 27 | * @startup_delay: Start-up time in microseconds |
| 28 | − * @gpio_is_open_drain: Gpio pin is open drain or normal type. | |
| 29 | − * If it is open drain type then HIGH will be set | |
| 30 | − * through PULL-UP with setting gpio as input | |
| 31 | − * and low will be set as gpio-output with driven | |
| 32 | − * to low. For non-open-drain case, the gpio will | |
| 33 | − * will be in output and drive to low/high accordingly. | |
| 34 | − * @enable_high: Polarity of enable GPIO | |
| 35 | − * 1 = Active high, 0 = Active low | |
| 36 | 28 | * @enabled_at_boot: Whether regulator has been enabled at |
| 37 | 29 | * boot or not. 1 = Yes, 0 = No |
| 38 | 30 | * This is used to keep the regulator at |
| @@ -48,8 +40,6 @@ struct fixed_voltage_config { · 9 unmodified lines | ||
| 48 | 40 | const char *input_supply; |
| 49 | 41 | int microvolts; |
| 50 | 42 | unsigned startup_delay; |
| 51 | − unsigned gpio_is_open_drain:1; | |
| 52 | − unsigned enable_high:1; | |
| 53 | 43 | unsigned enabled_at_boot:1; |
| 54 | 44 | struct regulator_init_data *init_data; |
| 55 | 45 | }; |
| @@ -21,6 +21,8 @@ · 20 unmodified lines | ||
| 21 | 21 | #ifndef __REGULATOR_GPIO_H |
| 22 | 22 | #define __REGULATOR_GPIO_H |
| 23 | 23 | |
| 24 | +#include <linux/gpio/consumer.h> | |
| 25 | + | |
| 24 | 26 | struct regulator_init_data; |
| 25 | 27 | |
| 26 | 28 | enum regulator_type; |
| @@ -44,18 +46,14 @@ struct gpio_regulator_state { · 17 unmodified lines | ||
| 44 | 46 | /** |
| 45 | 47 | * struct gpio_regulator_config - config structure |
| 46 | 48 | * @supply_name: Name of the regulator supply |
| 47 | − * @enable_gpio: GPIO to use for enable control | |
| 48 | − * set to -EINVAL if not used | |
| 49 | − * @enable_high: Polarity of enable GPIO | |
| 50 | − * 1 = Active high, 0 = Active low | |
| 51 | 49 | * @enabled_at_boot: Whether regulator has been enabled at |
| 52 | 50 | * boot or not. 1 = Yes, 0 = No |
| 53 | 51 | * This is used to keep the regulator at |
| 54 | 52 | * the default state |
| 55 | 53 | * @startup_delay: Start-up time in microseconds |
| 56 | − * @gpios: Array containing the gpios needed to control | |
| 57 | − * the setting of the regulator | |
| 58 | − * @nr_gpios: Number of gpios | |
| 54 | + * @gflags: Array of GPIO configuration flags for initial | |
| 55 | + * states | |
| 56 | + * @ngpios: Number of GPIOs and configurations available | |
| 59 | 57 | * @states: Array of gpio_regulator_state entries describing |
| 60 | 58 | * the gpio state for specific voltages |
| 61 | 59 | * @nr_states: Number of states available |
| @@ -69,13 +67,11 @@ struct gpio_regulator_state { · 7 unmodified lines | ||
| 69 | 67 | struct gpio_regulator_config { |
| 70 | 68 | const char *supply_name; |
| 71 | 69 | |
| 72 | − int enable_gpio; | |
| 73 | − unsigned enable_high:1; | |
| 74 | 70 | unsigned enabled_at_boot:1; |
| 75 | 71 | unsigned startup_delay; |
| 76 | 72 | |
| 77 | − struct gpio *gpios; | |
| 78 | − int nr_gpios; | |
| 73 | + enum gpiod_flags *gflags; | |
| 74 | + int ngpios; | |
| 79 | 75 | |
| 80 | 76 | struct gpio_regulator_state *states; |
| 81 | 77 | int nr_states; |