Commit deed1d44 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regulator-fix-v5.4-rc4' of...

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

Pull regulator fixes from Mark Brown:
 "There are a few core fixes here around error handling and handling if
  suspend mode configuration and some driver specific fixes here but the
  most important change is the fix to the fixed-regulator DT schema
  conversion introduced during the last merge window.

  That fixes one of the last two errors preventing successful execution
  of "make dt_binding_check" which will be enormously helpful for DT
  schema development"

* tag 'regulator-fix-v5.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: qcom-rpmh: Fix PMIC5 BoB min voltage
  regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
  regulator: lochnagar: Add on_off_delay for VDDCORE
  regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone
  regulator: da9062: fix suspend_enable/disable preparation
  dt-bindings: fixed-regulator: fix compatible enum
  regulator: fixed: Prevent NULL pointer dereference when !CONFIG_OF
  regulator: core: make regulator_register() EPROBE_DEFER aware
  regulator: of: fix suspend-min/max-voltage parsing
parents 13b86bc4 77fd66c9
...@@ -30,8 +30,8 @@ if: ...@@ -30,8 +30,8 @@ if:
properties: properties:
compatible: compatible:
enum: enum:
- const: regulator-fixed - regulator-fixed
- const: regulator-fixed-clock - regulator-fixed-clock
regulator-name: true regulator-name: true
......
...@@ -5053,6 +5053,19 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -5053,6 +5053,19 @@ regulator_register(const struct regulator_desc *regulator_desc,
init_data = regulator_of_get_init_data(dev, regulator_desc, config, init_data = regulator_of_get_init_data(dev, regulator_desc, config,
&rdev->dev.of_node); &rdev->dev.of_node);
/*
* Sometimes not all resources are probed already so we need to take
* that into account. This happens most the time if the ena_gpiod comes
* from a gpio extender or something else.
*/
if (PTR_ERR(init_data) == -EPROBE_DEFER) {
kfree(config);
kfree(rdev);
ret = -EPROBE_DEFER;
goto rinse;
}
/* /*
* We need to keep track of any GPIO descriptor coming from the * We need to keep track of any GPIO descriptor coming from the
* device tree until we have handled it over to the core. If the * device tree until we have handled it over to the core. If the
......
This diff is collapsed.
...@@ -144,8 +144,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -144,8 +144,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct fixed_voltage_config *config; struct fixed_voltage_config *config;
struct fixed_voltage_data *drvdata; struct fixed_voltage_data *drvdata;
const struct fixed_dev_type *drvtype = const struct fixed_dev_type *drvtype = of_device_get_match_data(dev);
of_match_device(dev->driver->of_match_table, dev)->data;
struct regulator_config cfg = { }; struct regulator_config cfg = { };
enum gpiod_flags gflags; enum gpiod_flags gflags;
int ret; int ret;
...@@ -177,7 +176,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -177,7 +176,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->desc.type = REGULATOR_VOLTAGE; drvdata->desc.type = REGULATOR_VOLTAGE;
drvdata->desc.owner = THIS_MODULE; drvdata->desc.owner = THIS_MODULE;
if (drvtype->has_enable_clock) { if (drvtype && drvtype->has_enable_clock) {
drvdata->desc.ops = &fixed_voltage_clkenabled_ops; drvdata->desc.ops = &fixed_voltage_clkenabled_ops;
drvdata->enable_clock = devm_clk_get(dev, NULL); drvdata->enable_clock = devm_clk_get(dev, NULL);
......
...@@ -210,6 +210,7 @@ static const struct regulator_desc lochnagar_regulators[] = { ...@@ -210,6 +210,7 @@ static const struct regulator_desc lochnagar_regulators[] = {
.enable_time = 3000, .enable_time = 3000,
.ramp_delay = 1000, .ramp_delay = 1000,
.off_on_delay = 15000,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
......
...@@ -231,12 +231,12 @@ static int of_get_regulation_constraints(struct device *dev, ...@@ -231,12 +231,12 @@ static int of_get_regulation_constraints(struct device *dev,
"regulator-off-in-suspend")) "regulator-off-in-suspend"))
suspend_state->enabled = DISABLE_IN_SUSPEND; suspend_state->enabled = DISABLE_IN_SUSPEND;
if (!of_property_read_u32(np, "regulator-suspend-min-microvolt", if (!of_property_read_u32(suspend_np,
&pval)) "regulator-suspend-min-microvolt", &pval))
suspend_state->min_uV = pval; suspend_state->min_uV = pval;
if (!of_property_read_u32(np, "regulator-suspend-max-microvolt", if (!of_property_read_u32(suspend_np,
&pval)) "regulator-suspend-max-microvolt", &pval))
suspend_state->max_uV = pval; suspend_state->max_uV = pval;
if (!of_property_read_u32(suspend_np, if (!of_property_read_u32(suspend_np,
...@@ -445,11 +445,20 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, ...@@ -445,11 +445,20 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
goto error; goto error;
} }
if (desc->of_parse_cb && desc->of_parse_cb(child, desc, config)) { if (desc->of_parse_cb) {
dev_err(dev, int ret;
"driver callback failed to parse DT for regulator %pOFn\n",
child); ret = desc->of_parse_cb(child, desc, config);
goto error; if (ret) {
if (ret == -EPROBE_DEFER) {
of_node_put(child);
return ERR_PTR(-EPROBE_DEFER);
}
dev_err(dev,
"driver callback failed to parse DT for regulator %pOFn\n",
child);
goto error;
}
} }
*node = child; *node = child;
......
...@@ -788,7 +788,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client, ...@@ -788,7 +788,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
/* SW2~SW4 high bit check and modify the voltage value table */ /* SW2~SW4 high bit check and modify the voltage value table */
if (i >= sw_check_start && i <= sw_check_end) { if (i >= sw_check_start && i <= sw_check_end) {
regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val); ret = regmap_read(pfuze_chip->regmap,
desc->vsel_reg, &val);
if (ret) {
dev_err(&client->dev, "Fails to read from the register.\n");
return ret;
}
if (val & sw_hi) { if (val & sw_hi) {
if (pfuze_chip->chip_id == PFUZE3000 || if (pfuze_chip->chip_id == PFUZE3000 ||
pfuze_chip->chip_id == PFUZE3001) { pfuze_chip->chip_id == PFUZE3001) {
......
...@@ -735,8 +735,8 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { ...@@ -735,8 +735,8 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = {
static const struct rpmh_vreg_hw_data pmic5_bob = { static const struct rpmh_vreg_hw_data pmic5_bob = {
.regulator_type = VRM, .regulator_type = VRM,
.ops = &rpmh_regulator_vrm_bypass_ops, .ops = &rpmh_regulator_vrm_bypass_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 135, 32000), .voltage_range = REGULATOR_LINEAR_RANGE(3000000, 0, 31, 32000),
.n_voltages = 136, .n_voltages = 32,
.pmic_mode_map = pmic_mode_map_pmic5_bob, .pmic_mode_map = pmic_mode_map_pmic5_bob,
.of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode, .of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode,
}; };
......
...@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb) ...@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb)
while (timeout++ <= abb->settling_time) { while (timeout++ <= abb->settling_time) {
status = ti_abb_check_txdone(abb); status = ti_abb_check_txdone(abb);
if (status) if (status)
break; return 0;
udelay(1); udelay(1);
} }
if (timeout > abb->settling_time) { dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
dev_warn_ratelimited(dev, __func__, timeout, readl(abb->int_base));
"%s:TRANXDONE timeout(%duS) int=0x%08x\n", return -ETIMEDOUT;
__func__, timeout, readl(abb->int_base));
return -ETIMEDOUT;
}
return 0;
} }
/** /**
...@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb) ...@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb)
status = ti_abb_check_txdone(abb); status = ti_abb_check_txdone(abb);
if (!status) if (!status)
break; return 0;
udelay(1); udelay(1);
} }
if (timeout > abb->settling_time) { dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
dev_warn_ratelimited(dev, __func__, timeout, readl(abb->int_base));
"%s:TRANXDONE timeout(%duS) int=0x%08x\n", return -ETIMEDOUT;
__func__, timeout, readl(abb->int_base));
return -ETIMEDOUT;
}
return 0;
} }
/** /**
......
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