Commit deed1d44 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -30,8 +30,8 @@ if:
properties:
  compatible:
    enum:
      - const: regulator-fixed
      - const: regulator-fixed-clock
      - regulator-fixed
      - regulator-fixed-clock

  regulator-name: true

+13 −0
Original line number Diff line number Diff line
@@ -5053,6 +5053,19 @@ regulator_register(const struct regulator_desc *regulator_desc,

	init_data = regulator_of_get_init_data(dev, regulator_desc, config,
					       &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
	 * device tree until we have handled it over to the core. If the
+47 −71
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode)
static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
{
	struct da9062_regulator *regl = rdev_get_drvdata(rdev);
	struct regmap_field *field;
	unsigned int val, mode = 0;
	int ret;

@@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
		return REGULATOR_MODE_NORMAL;
	}

	/* Detect current regulator state */
	ret = regmap_field_read(regl->suspend, &val);
	if (ret < 0)
		return 0;

	/* Read regulator mode from proper register, depending on state */
	if (val)
		field = regl->suspend_sleep;
	else
		field = regl->sleep;

	ret = regmap_field_read(field, &val);
	ret = regmap_field_read(regl->sleep, &val);
	if (ret < 0)
		return 0;

@@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev *rdev, unsigned mode)
static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
{
	struct da9062_regulator *regl = rdev_get_drvdata(rdev);
	struct regmap_field *field;
	int ret, val;

	/* Detect current regulator state */
	ret = regmap_field_read(regl->suspend, &val);
	if (ret < 0)
		return 0;

	/* Read regulator mode from proper register, depending on state */
	if (val)
		field = regl->suspend_sleep;
	else
		field = regl->sleep;

	ret = regmap_field_read(field, &val);
	ret = regmap_field_read(regl->sleep, &val);
	if (ret < 0)
		return 0;

@@ -408,10 +384,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
			__builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9061_ID_BUCK2,
@@ -444,10 +420,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
			__builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9061_ID_BUCK3,
@@ -480,10 +456,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK4_CONT,
			__builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9061_ID_LDO1,
@@ -509,10 +485,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO1_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO1_CONT,
			__builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -542,10 +518,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO2_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO2_CONT,
			__builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -575,10 +551,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO3_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO3_CONT,
			__builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -608,10 +584,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO4_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO4_CONT,
			__builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -652,10 +628,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
			__builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9062_ID_BUCK2,
@@ -688,10 +664,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK2_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK2_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK2_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK2_CONT,
			__builtin_ffs((int)DA9062AA_BUCK2_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK2_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK2_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9062_ID_BUCK3,
@@ -724,10 +700,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
			__builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9062_ID_BUCK4,
@@ -760,10 +736,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			__builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1),
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_BUCK4_CONT,
			__builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1),
	},
	{
		.desc.id = DA9062_ID_LDO1,
@@ -789,10 +765,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO1_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO1_CONT,
			__builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -822,10 +798,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO2_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO2_CONT,
			__builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -855,10 +831,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO3_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO3_CONT,
			__builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
@@ -888,10 +864,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1),
		.suspend_vsel_reg = DA9062AA_VLDO4_B,
		.suspend = REG_FIELD(DA9062AA_DVC_1,
			__builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1,
		.suspend = REG_FIELD(DA9062AA_LDO4_CONT,
			__builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1,
			sizeof(unsigned int) * 8 -
			__builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1),
			__builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1),
		.oc_event = REG_FIELD(DA9062AA_STATUS_D,
			__builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1,
			sizeof(unsigned int) * 8 -
+2 −3
Original line number Diff line number Diff line
@@ -144,8 +144,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
	struct device *dev = &pdev->dev;
	struct fixed_voltage_config *config;
	struct fixed_voltage_data *drvdata;
	const struct fixed_dev_type *drvtype =
		of_match_device(dev->driver->of_match_table, dev)->data;
	const struct fixed_dev_type *drvtype = of_device_get_match_data(dev);
	struct regulator_config cfg = { };
	enum gpiod_flags gflags;
	int ret;
@@ -177,7 +176,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
	drvdata->desc.type = REGULATOR_VOLTAGE;
	drvdata->desc.owner = THIS_MODULE;

	if (drvtype->has_enable_clock) {
	if (drvtype && drvtype->has_enable_clock) {
		drvdata->desc.ops = &fixed_voltage_clkenabled_ops;

		drvdata->enable_clock = devm_clk_get(dev, NULL);
+1 −0
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ static const struct regulator_desc lochnagar_regulators[] = {

		.enable_time = 3000,
		.ramp_delay = 1000,
		.off_on_delay = 15000,

		.owner = THIS_MODULE,
	},
Loading