Commit 7c3d49b0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regulator-fix-v5.14-rc2' of...

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

Pull regulator fixes from Mark Brown:
 "A few driver specific fixes that came in since the merge window, plus
  a change to mark the regulator-fixed-domain DT binding as deprecated
  in order to try to to discourage any new users while a better solution
  is put in place"

* tag 'regulator-fix-v5.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: hi6421: Fix getting wrong drvdata
  regulator: mtk-dvfsrc: Fix wrong dev pointer for devm_regulator_register
  regulator: fixed: Mark regulator-fixed-domain as deprecated
  regulator: bd9576: Fix testing wrong flag in check_temp_flag_mismatch
  regulator: hi6421v600: Fix getting wrong drvdata that causes boot failure
  regulator: rt5033: Fix n_voltages settings for BUCK and LDO
  regulator: rtmv20: Fix wrong mask for strobe-polarity-high
parents b4e62aaf 1c73daee
...@@ -57,12 +57,14 @@ properties: ...@@ -57,12 +57,14 @@ properties:
maxItems: 1 maxItems: 1
power-domains: power-domains:
deprecated: true
description: description:
Power domain to use for enable control. This binding is only Power domain to use for enable control. This binding is only
available if the compatible is chosen to regulator-fixed-domain. available if the compatible is chosen to regulator-fixed-domain.
maxItems: 1 maxItems: 1
required-opps: required-opps:
deprecated: true
description: description:
Performance state to use for enable control. This binding is only Performance state to use for enable control. This binding is only
available if the compatible is chosen to regulator-fixed-domain. The available if the compatible is chosen to regulator-fixed-domain. The
......
...@@ -294,9 +294,9 @@ static bool check_temp_flag_mismatch(struct regulator_dev *rdev, int severity, ...@@ -294,9 +294,9 @@ static bool check_temp_flag_mismatch(struct regulator_dev *rdev, int severity,
struct bd957x_regulator_data *r) struct bd957x_regulator_data *r)
{ {
if ((severity == REGULATOR_SEVERITY_ERR && if ((severity == REGULATOR_SEVERITY_ERR &&
r->ovd_notif != REGULATOR_EVENT_OVER_TEMP) || r->temp_notif != REGULATOR_EVENT_OVER_TEMP) ||
(severity == REGULATOR_SEVERITY_WARN && (severity == REGULATOR_SEVERITY_WARN &&
r->ovd_notif != REGULATOR_EVENT_OVER_TEMP_WARN)) { r->temp_notif != REGULATOR_EVENT_OVER_TEMP_WARN)) {
dev_warn(rdev_get_dev(rdev), dev_warn(rdev_get_dev(rdev),
"Can't support both thermal WARN and ERR\n"); "Can't support both thermal WARN and ERR\n");
if (severity == REGULATOR_SEVERITY_WARN) if (severity == REGULATOR_SEVERITY_WARN)
......
...@@ -366,9 +366,8 @@ static struct hi6421_regulator_info ...@@ -366,9 +366,8 @@ static struct hi6421_regulator_info
static int hi6421_regulator_enable(struct regulator_dev *rdev) static int hi6421_regulator_enable(struct regulator_dev *rdev)
{ {
struct hi6421_regulator_pdata *pdata; struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev);
pdata = dev_get_drvdata(rdev->dev.parent);
/* hi6421 spec requires regulator enablement must be serialized: /* hi6421 spec requires regulator enablement must be serialized:
* - Because when BUCK, LDO switching from off to on, it will have * - Because when BUCK, LDO switching from off to on, it will have
* a huge instantaneous current; so you can not turn on two or * a huge instantaneous current; so you can not turn on two or
...@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev) ...@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev)
static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int reg_val; unsigned int reg_val;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
if (reg_val & info->mode_mask) if (reg_val & info->mode_mask)
return REGULATOR_MODE_IDLE; return REGULATOR_MODE_IDLE;
...@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) ...@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int reg_val; unsigned int reg_val;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
if (reg_val & info->mode_mask) if (reg_val & info->mode_mask)
return REGULATOR_MODE_STANDBY; return REGULATOR_MODE_STANDBY;
...@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) ...@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int new_mode; unsigned int new_mode;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
switch (mode) { switch (mode) {
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
new_mode = 0; new_mode = 0;
...@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, ...@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int new_mode; unsigned int new_mode;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
switch (mode) { switch (mode) {
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
new_mode = 0; new_mode = 0;
...@@ -459,7 +462,9 @@ static unsigned int ...@@ -459,7 +462,9 @@ static unsigned int
hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev,
int input_uV, int output_uV, int load_uA) int input_uV, int output_uV, int load_uA)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
if (load_uA > info->eco_microamp) if (load_uA > info->eco_microamp)
return REGULATOR_MODE_NORMAL; return REGULATOR_MODE_NORMAL;
...@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev) ...@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
mutex_init(&pdata->lock); mutex_init(&pdata->lock);
platform_set_drvdata(pdev, pdata);
for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) {
/* assign per-regulator data */ /* assign per-regulator data */
info = &hi6421_regulator_info[i]; info = &hi6421_regulator_info[i];
config.dev = pdev->dev.parent; config.dev = pdev->dev.parent;
config.driver_data = info; config.driver_data = pdata;
config.regmap = pmic->regmap; config.regmap = pmic->regmap;
rdev = devm_regulator_register(&pdev->dev, &info->desc, rdev = devm_regulator_register(&pdev->dev, &info->desc,
......
...@@ -98,10 +98,9 @@ static const unsigned int ldo34_voltages[] = { ...@@ -98,10 +98,9 @@ static const unsigned int ldo34_voltages[] = {
static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
{ {
struct hi6421_spmi_reg_priv *priv; struct hi6421_spmi_reg_priv *priv = rdev_get_drvdata(rdev);
int ret; int ret;
priv = dev_get_drvdata(rdev->dev.parent);
/* cannot enable more than one regulator at one time */ /* cannot enable more than one regulator at one time */
mutex_lock(&priv->enable_mutex); mutex_lock(&priv->enable_mutex);
...@@ -119,9 +118,10 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) ...@@ -119,9 +118,10 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev) static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)
{ {
struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev); struct hi6421_spmi_reg_info *sreg;
unsigned int reg_val; unsigned int reg_val;
sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
if (reg_val & sreg->eco_mode_mask) if (reg_val & sreg->eco_mode_mask)
...@@ -133,9 +133,10 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev) ...@@ -133,9 +133,10 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)
static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev, static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev); struct hi6421_spmi_reg_info *sreg;
unsigned int val; unsigned int val;
sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
switch (mode) { switch (mode) {
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
val = 0; val = 0;
...@@ -159,7 +160,9 @@ hi6421_spmi_regulator_get_optimum_mode(struct regulator_dev *rdev, ...@@ -159,7 +160,9 @@ hi6421_spmi_regulator_get_optimum_mode(struct regulator_dev *rdev,
int input_uV, int output_uV, int input_uV, int output_uV,
int load_uA) int load_uA)
{ {
struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev); struct hi6421_spmi_reg_info *sreg;
sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
if (!sreg->eco_uA || ((unsigned int)load_uA > sreg->eco_uA)) if (!sreg->eco_uA || ((unsigned int)load_uA > sreg->eco_uA))
return REGULATOR_MODE_NORMAL; return REGULATOR_MODE_NORMAL;
...@@ -252,13 +255,12 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) ...@@ -252,13 +255,12 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
mutex_init(&priv->enable_mutex); mutex_init(&priv->enable_mutex);
platform_set_drvdata(pdev, priv);
for (i = 0; i < ARRAY_SIZE(regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
info = &regulator_info[i]; info = &regulator_info[i];
config.dev = pdev->dev.parent; config.dev = pdev->dev.parent;
config.driver_data = info; config.driver_data = priv;
config.regmap = pmic->regmap; config.regmap = pmic->regmap;
rdev = devm_regulator_register(dev, &info->desc, &config); rdev = devm_regulator_register(dev, &info->desc, &config);
......
...@@ -179,8 +179,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev) ...@@ -179,8 +179,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev)
for (i = 0; i < regulator_init_data->size; i++) { for (i = 0; i < regulator_init_data->size; i++) {
config.dev = dev->parent; config.dev = dev->parent;
config.driver_data = (mt_regulators + i); config.driver_data = (mt_regulators + i);
rdev = devm_regulator_register(dev->parent, rdev = devm_regulator_register(dev, &(mt_regulators + i)->desc,
&(mt_regulators + i)->desc,
&config); &config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
dev_err(dev, "failed to register %s\n", dev_err(dev, "failed to register %s\n",
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#define RTMV20_WIDTH2_MASK GENMASK(7, 0) #define RTMV20_WIDTH2_MASK GENMASK(7, 0)
#define RTMV20_LBPLVL_MASK GENMASK(3, 0) #define RTMV20_LBPLVL_MASK GENMASK(3, 0)
#define RTMV20_LBPEN_MASK BIT(7) #define RTMV20_LBPEN_MASK BIT(7)
#define RTMV20_STROBEPOL_MASK BIT(1) #define RTMV20_STROBEPOL_MASK BIT(0)
#define RTMV20_VSYNPOL_MASK BIT(1) #define RTMV20_VSYNPOL_MASK BIT(1)
#define RTMV20_FSINEN_MASK BIT(7) #define RTMV20_FSINEN_MASK BIT(7)
#define RTMV20_ESEN_MASK BIT(6) #define RTMV20_ESEN_MASK BIT(6)
......
...@@ -200,13 +200,13 @@ enum rt5033_reg { ...@@ -200,13 +200,13 @@ enum rt5033_reg {
#define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U
#define RT5033_REGULATOR_BUCK_VOLTAGE_MAX 3000000U #define RT5033_REGULATOR_BUCK_VOLTAGE_MAX 3000000U
#define RT5033_REGULATOR_BUCK_VOLTAGE_STEP 100000U #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP 100000U
#define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 32 #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 21
/* RT5033 regulator LDO output voltage uV */ /* RT5033 regulator LDO output voltage uV */
#define RT5033_REGULATOR_LDO_VOLTAGE_MIN 1200000U #define RT5033_REGULATOR_LDO_VOLTAGE_MIN 1200000U
#define RT5033_REGULATOR_LDO_VOLTAGE_MAX 3000000U #define RT5033_REGULATOR_LDO_VOLTAGE_MAX 3000000U
#define RT5033_REGULATOR_LDO_VOLTAGE_STEP 100000U #define RT5033_REGULATOR_LDO_VOLTAGE_STEP 100000U
#define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 32 #define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 19
/* RT5033 regulator SAFE LDO output voltage uV */ /* RT5033 regulator SAFE LDO output voltage uV */
#define RT5033_REGULATOR_SAFE_LDO_VOLTAGE 4900000U #define RT5033_REGULATOR_SAFE_LDO_VOLTAGE 4900000U
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment