regulator: ROHM BDxxxxx minor print improvements

Merge series from Matti Vaittinen <mazziesaccount@gmail.com>:

Minor (printing) improvements for ROHM regulator drivers.

This series:

 - Drops an unnecessary info print from bd718x7.
   (Added a fixes tag for this but not really sure if worth
   adding to stable)
 - Convert the ROHM BDxxxxx PMIC regulator drivers to use dev_err_probe().
 - Change the probe logic for bd718x7 to favor the more usual devm-style
   where errors are returned immediately.
This commit is contained in:
Mark Brown 2022-11-23 17:22:52 +00:00
commit c23fdf9e50
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
4 changed files with 57 additions and 81 deletions

View file

@ -602,12 +602,10 @@ static int bd7181x_probe(struct platform_device *pdev)
config.ena_gpiod = NULL;
rdev = devm_regulator_register(&pdev->dev, desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev,
"failed to register %s regulator\n",
desc->name);
return PTR_ERR(rdev);
}
if (IS_ERR(rdev))
return dev_err_probe(&pdev->dev, PTR_ERR(rdev),
"failed to register %s regulator\n",
desc->name);
}
return 0;
}

View file

@ -750,23 +750,20 @@ static int bd71828_probe(struct platform_device *pdev)
rd = &bd71828_rdata[i];
rdev = devm_regulator_register(&pdev->dev,
&rd->desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev,
"failed to register %s regulator\n",
rd->desc.name);
return PTR_ERR(rdev);
}
if (IS_ERR(rdev))
return dev_err_probe(&pdev->dev, PTR_ERR(rdev),
"failed to register %s regulator\n",
rd->desc.name);
for (j = 0; j < rd->reg_init_amnt; j++) {
ret = regmap_update_bits(config.regmap,
rd->reg_inits[j].reg,
rd->reg_inits[j].mask,
rd->reg_inits[j].val);
if (ret) {
dev_err(&pdev->dev,
"regulator %s init failed\n",
rd->desc.name);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret,
"regulator %s init failed\n",
rd->desc.name);
}
}
return 0;

View file

@ -1576,8 +1576,6 @@ static int setup_feedback_loop(struct device *dev, struct device_node *np,
if (!of_node_name_eq(np, desc->of_match))
continue;
pr_info("Looking at node '%s'\n", desc->of_match);
/* The feedback loop connection does not make sense for LDOs */
if (desc->id >= BD718XX_LDO1)
return -EINVAL;
@ -1708,20 +1706,17 @@ static int bd718xx_probe(struct platform_device *pdev)
break;
default:
dev_err(&pdev->dev, "Unsupported chip type\n");
err = -EINVAL;
goto err;
return -EINVAL;
}
/* Register LOCK release */
err = regmap_update_bits(regmap, BD718XX_REG_REGLOCK,
(REGLOCK_PWRSEQ | REGLOCK_VREG), 0);
if (err) {
dev_err(&pdev->dev, "Failed to unlock PMIC (%d)\n", err);
goto err;
} else {
dev_dbg(&pdev->dev, "Unlocked lock register 0x%x\n",
BD718XX_REG_REGLOCK);
}
if (err)
return dev_err_probe(&pdev->dev, err, "Failed to unlock PMIC\n");
dev_dbg(&pdev->dev, "Unlocked lock register 0x%x\n",
BD718XX_REG_REGLOCK);
use_snvs = of_property_read_bool(pdev->dev.parent->of_node,
"rohm,reset-snvs-powered");
@ -1738,13 +1733,11 @@ static int bd718xx_probe(struct platform_device *pdev)
BD718XX_WDOG_POWEROFF_MASK |
BD718XX_KEY_L_POWEROFF_MASK,
BD718XX_POWOFF_TO_RDY);
if (err) {
dev_err(&pdev->dev, "Failed to change reset target\n");
goto err;
} else {
dev_dbg(&pdev->dev,
"Changed all resets from SVNS to READY\n");
}
if (err)
return dev_err_probe(&pdev->dev, err,
"Failed to change reset target\n");
dev_dbg(&pdev->dev, "Changed all resets from SVNS to READY\n");
}
config.dev = pdev->dev.parent;
@ -1780,13 +1773,10 @@ static int bd718xx_probe(struct platform_device *pdev)
desc->ops = swops[i];
rdev = devm_regulator_register(&pdev->dev, desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev,
"failed to register %s regulator\n",
desc->name);
err = PTR_ERR(rdev);
goto err;
}
if (IS_ERR(rdev))
return dev_err_probe(&pdev->dev, PTR_ERR(rdev),
"failed to register %s regulator\n",
desc->name);
/*
* Regulator register gets the regulator constraints and
@ -1809,28 +1799,23 @@ static int bd718xx_probe(struct platform_device *pdev)
!rdev->constraints->boot_on)) {
err = regmap_update_bits(regmap, r->init.reg,
r->init.mask, r->init.val);
if (err) {
dev_err(&pdev->dev,
if (err)
return dev_err_probe(&pdev->dev, err,
"Failed to take control for (%s)\n",
desc->name);
goto err;
}
}
for (j = 0; j < r->additional_init_amnt; j++) {
err = regmap_update_bits(regmap,
r->additional_inits[j].reg,
r->additional_inits[j].mask,
r->additional_inits[j].val);
if (err) {
dev_err(&pdev->dev,
if (err)
return dev_err_probe(&pdev->dev, err,
"Buck (%s) initialization failed\n",
desc->name);
goto err;
}
}
}
err:
return err;
}

View file

@ -953,30 +953,28 @@ static int bd957x_probe(struct platform_device *pdev)
dev_fwnode(pdev->dev.parent),
"rohm,vout1-en", GPIOD_OUT_LOW,
"vout1-en");
if (!IS_ERR(en)) {
/* VOUT1_OPS gpio ctrl */
/*
* Regulator core prioritizes the ena_gpio over
* enable/disable/is_enabled callbacks so no need to
* clear them. We can still use same ops
*/
/* VOUT1_OPS gpio ctrl */
/*
* Regulator core prioritizes the ena_gpio over
* enable/disable/is_enabled callbacks so no need to clear them
* even if GPIO is used. So, we can still use same ops.
*
* In theory it is possible someone wants to set vout1-en LOW
* during OTP loading and set VOUT1 to be controlled by GPIO -
* but control the GPIO from some where else than this driver.
* For that to work we should unset the is_enabled callback
* here.
*
* I believe such case where rohm,vout1-en-low is set and
* vout1-en-gpios is not is likely to be a misconfiguration.
* So let's just err out for now.
*/
if (!IS_ERR(en))
config.ena_gpiod = en;
} else {
/*
* In theory it is possible someone wants to set
* vout1-en LOW during OTP loading and set VOUT1 to be
* controlled by GPIO - but control the GPIO from some
* where else than this driver. For that to work we
* should unset the is_enabled callback here.
*
* I believe such case where rohm,vout1-en-low is set
* and vout1-en-gpios is not is likely to be a
* misconfiguration. So let's just err out for now.
*/
dev_err(&pdev->dev,
"Failed to get VOUT1 control GPIO\n");
return PTR_ERR(en);
}
else
return dev_err_probe(&pdev->dev, PTR_ERR(en),
"Failed to get VOUT1 control GPIO\n");
}
/*
@ -1037,12 +1035,10 @@ static int bd957x_probe(struct platform_device *pdev)
r->rdev = devm_regulator_register(&pdev->dev, desc,
&config);
if (IS_ERR(r->rdev)) {
dev_err(&pdev->dev,
"failed to register %s regulator\n",
desc->name);
return PTR_ERR(r->rdev);
}
if (IS_ERR(r->rdev))
return dev_err_probe(&pdev->dev, PTR_ERR(r->rdev),
"failed to register %s regulator\n",
desc->name);
/*
* Clear the VOUT1 GPIO setting - rest of the regulators do not
* support GPIO control