Merge tag 'regulator-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "A couple of new features in the core, the most interesting one being
  support for complex regulator coupling configurations initially
  targeted at nVidia Tegra SoCs, and some new drivers but otherwise
  quite a quiet release.

  Summary:

   - Core support for gradual ramping of voltages for devices that can't
     manage large changes in hardware from Bartosz Golaszewski.

   - Core support for systems that have complex coupling requirements
     best described via code, contributed by Dmitry Osipenko.

   - New drivers for Dialog SLG51000, Qualcomm PM8005 and ST
     Microelectronics STM32-Booster"

* tag 'regulator-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (52 commits)
  regulator: max77650: use vsel_step
  regulator: implement selector stepping
  regulator: max77650: add MODULE_ALIAS()
  regulator: max77620: remove redundant assignment to variable ret
  dt-bindings: regulator: add support for the stm32-booster
  regulator: add support for the stm32-booster
  regulator: s2mps11: Adjust supported buck voltages to real values
  regulator: s2mps11: Fix buck7 and buck8 wrong voltages
  gpio: Fix return value mismatch of function gpiod_get_from_of_node()
  regulator: core: Expose some of core functions needed by couplers
  regulator: core: Introduce API for regulators coupling customization
  regulator: s2mps11: Add support for disabling S2MPS11 regulators in suspend
  regulator: s2mps11: Reduce number of rdev_get_id() calls
  regulator: qcom_spmi: Do NULL check for lvs
  regulator: qcom_spmi: Fix math of spmi_regulator_set_voltage_time_sel
  regulator: da9061/62: Adjust LDO voltage selection minimum value
  regulator: s2mps11: Fix ERR_PTR dereference on GPIO lookup failure
  regulator: qcom_spmi: add PMS405 SPMI regulator
  dt-bindings: qcom_spmi: Document pms405 support
  arm64: dts: msm8998-mtp: Add pm8005_s1 regulator
  ...
This commit is contained in:
Linus Torvalds
2019-07-09 09:15:03 -07:00
50 changed files with 2864 additions and 764 deletions

View File

@@ -797,6 +797,9 @@
#define DA9062AA_BUCK3_SL_A_SHIFT 7
#define DA9062AA_BUCK3_SL_A_MASK BIT(7)
/* DA9062AA_VLDO[1-4]_A common */
#define DA9062AA_VLDO_A_MIN_SEL 2
/* DA9062AA_VLDO1_A = 0x0A9 */
#define DA9062AA_VLDO1_A_SHIFT 0
#define DA9062AA_VLDO1_A_MASK 0x3f

View File

@@ -11,55 +11,6 @@
#ifndef __MFD_DA9063_PDATA_H__
#define __MFD_DA9063_PDATA_H__
#include <linux/regulator/machine.h>
/*
* Regulator configuration
*/
/* DA9063 and DA9063L regulator IDs */
enum {
/* BUCKs */
DA9063_ID_BCORE1,
DA9063_ID_BCORE2,
DA9063_ID_BPRO,
DA9063_ID_BMEM,
DA9063_ID_BIO,
DA9063_ID_BPERI,
/* BCORE1 and BCORE2 in merged mode */
DA9063_ID_BCORES_MERGED,
/* BMEM and BIO in merged mode */
DA9063_ID_BMEM_BIO_MERGED,
/* When two BUCKs are merged, they cannot be reused separately */
/* LDOs on both DA9063 and DA9063L */
DA9063_ID_LDO3,
DA9063_ID_LDO7,
DA9063_ID_LDO8,
DA9063_ID_LDO9,
DA9063_ID_LDO11,
/* DA9063-only LDOs */
DA9063_ID_LDO1,
DA9063_ID_LDO2,
DA9063_ID_LDO4,
DA9063_ID_LDO5,
DA9063_ID_LDO6,
DA9063_ID_LDO10,
};
/* Regulators platform data */
struct da9063_regulator_data {
int id;
struct regulator_init_data *initdata;
};
struct da9063_regulators_pdata {
unsigned n_regulators;
struct da9063_regulator_data *regulator_data;
};
/*
* RGB LED configuration
*/

View File

@@ -20,6 +20,7 @@
#define MIN_850_MV 850000
#define MIN_800_MV 800000
#define MIN_750_MV 750000
#define MIN_650_MV 650000
#define MIN_600_MV 600000
#define MIN_500_MV 500000

View File

@@ -170,7 +170,9 @@ enum s2mps11_regulators {
#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)
#define S2MPS11_ENABLE_SHIFT 0x06
#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
#define S2MPS11_BUCK12346_N_VOLTAGES 153
#define S2MPS11_BUCK5_N_VOLTAGES 216
#define S2MPS11_BUCK7810_N_VOLTAGES 225
#define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1)
#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
@@ -188,4 +190,9 @@ enum s2mps11_regulators {
#define S2MPS11_BUCK6_RAMP_EN_SHIFT 0
#define S2MPS11_PMIC_EN_SHIFT 6
/*
* Bits for "enable suspend" (On/Off controlled by PWREN)
* are the same as in S2MPS14: S2MPS14_ENABLE_SUSPEND
*/
#endif /* __LINUX_MFD_S2MPS11_H */

View File

@@ -47,7 +47,6 @@ struct wm831x_battery_pdata {
* I2C or SPI buses.
*/
struct wm831x_buckv_pdata {
int dvs_gpio; /** CPU GPIO to use for DVS switching */
int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
int dvs_init_state; /** DVS state to expect on startup */
int dvs_state_gpio; /** CPU GPIO to use for monitoring status */

View File

@@ -0,0 +1,97 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* coupler.h -- SoC Regulator support, coupler API.
*
* Regulator Coupler Interface.
*/
#ifndef __LINUX_REGULATOR_COUPLER_H_
#define __LINUX_REGULATOR_COUPLER_H_
#include <linux/kernel.h>
#include <linux/suspend.h>
struct regulator_coupler;
struct regulator_dev;
/**
* struct regulator_coupler - customized regulator's coupler
*
* Regulator's coupler allows to customize coupling algorithm.
*
* @list: couplers list entry
* @attach_regulator: Callback invoked on creation of a coupled regulator,
* couples are unresolved at this point. The callee should
* check that it could handle the regulator and return 0 on
* success, -errno on failure and 1 if given regulator is
* not suitable for this coupler (case of having multiple
* regulators in a system). Callback shall be implemented.
* @detach_regulator: Callback invoked on destruction of a coupled regulator.
* This callback is optional and could be NULL.
* @balance_voltage: Callback invoked when voltage of a coupled regulator is
* changing. Called with all of the coupled rdev's being held
* under "consumer lock". The callee should perform voltage
* balancing, changing voltage of the coupled regulators as
* needed. It's up to the coupler to verify the voltage
* before changing it in hardware, i.e. coupler should
* check consumer's min/max and etc. This callback is
* optional and could be NULL, in which case a generic
* voltage balancer will be used.
*/
struct regulator_coupler {
struct list_head list;
int (*attach_regulator)(struct regulator_coupler *coupler,
struct regulator_dev *rdev);
int (*detach_regulator)(struct regulator_coupler *coupler,
struct regulator_dev *rdev);
int (*balance_voltage)(struct regulator_coupler *coupler,
struct regulator_dev *rdev,
suspend_state_t state);
};
#ifdef CONFIG_REGULATOR
int regulator_coupler_register(struct regulator_coupler *coupler);
const char *rdev_get_name(struct regulator_dev *rdev);
int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV,
suspend_state_t state);
int regulator_check_voltage(struct regulator_dev *rdev,
int *min_uV, int *max_uV);
int regulator_get_voltage_rdev(struct regulator_dev *rdev);
int regulator_set_voltage_rdev(struct regulator_dev *rdev,
int min_uV, int max_uV,
suspend_state_t state);
#else
static inline int regulator_coupler_register(struct regulator_coupler *coupler)
{
return 0;
}
static inline const char *rdev_get_name(struct regulator_dev *rdev)
{
return NULL;
}
static inline int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV,
suspend_state_t state)
{
return -EINVAL;
}
static inline int regulator_check_voltage(struct regulator_dev *rdev,
int *min_uV, int *max_uV)
{
return -EINVAL;
}
static inline int regulator_get_voltage_rdev(struct regulator_dev *rdev)
{
return -EINVAL;
}
static inline int regulator_set_voltage_rdev(struct regulator_dev *rdev,
int min_uV, int max_uV,
suspend_state_t state)
{
return -EINVAL;
}
#endif
#endif

View File

@@ -12,8 +12,6 @@
#ifndef __LINUX_REGULATOR_DRIVER_H_
#define __LINUX_REGULATOR_DRIVER_H_
#define MAX_COUPLED 2
#include <linux/device.h>
#include <linux/notifier.h>
#include <linux/regulator/consumer.h>
@@ -283,6 +281,11 @@ enum regulator_type {
* @vsel_range_mask: Mask for register bitfield used for range selector
* @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
* @vsel_mask: Mask for register bitfield used for selector
* @vsel_step: Specify the resolution of selector stepping when setting
* voltage. If 0, then no stepping is done (requested selector is
* set directly), if >0 then the regulator API will ramp the
* voltage up/down gradually each time increasing/decreasing the
* selector by the specified step value.
* @csel_reg: Register for current limit selector using regmap set_current_limit
* @csel_mask: Mask for register bitfield used for current limit selector
* @apply_reg: Register for initiate voltage change on the output when
@@ -357,6 +360,7 @@ struct regulator_desc {
unsigned int vsel_range_mask;
unsigned int vsel_reg;
unsigned int vsel_mask;
unsigned int vsel_step;
unsigned int csel_reg;
unsigned int csel_mask;
unsigned int apply_reg;
@@ -423,7 +427,8 @@ struct regulator_config {
* incremented.
*/
struct coupling_desc {
struct regulator_dev *coupled_rdevs[MAX_COUPLED];
struct regulator_dev **coupled_rdevs;
struct regulator_coupler *coupler;
int n_resolved;
int n_coupled;
};
@@ -549,4 +554,5 @@ void regulator_unlock(struct regulator_dev *rdev);
*/
int regulator_desc_list_voltage_linear_range(const struct regulator_desc *desc,
unsigned int selector);
#endif

View File

@@ -153,7 +153,7 @@ struct regulation_constraints {
int system_load;
/* used for coupled regulators */
int max_spread;
u32 *max_spread;
/* used for changing voltage in steps */
int max_uV_step;

View File

@@ -105,9 +105,6 @@ enum {
#define MAX8952_NUM_DVS_MODE 4
struct max8952_platform_data {
int gpio_vid0;
int gpio_vid1;
u32 default_mode;
u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */