diff mbox series

[01/10] power: supply: bq25890: Only use pdata->regulator_init_data for vbus

Message ID 20221127180233.103678-2-hdegoede@redhat.com (mailing list archive)
State Superseded
Headers show
Series power: supply: bq25890: Fixes for 6.2 + further work for 6.3 | expand

Commit Message

Hans de Goede Nov. 27, 2022, 6:02 p.m. UTC
bq25890_platform_data.regulator_init_data is intended to only provide
regulator init_data for the vbus regulator.

Remove this from the regulator_config before registering the vsys
regulator. Otherwise the regulator_register() call for vsys will fail
because it tries to register duplicate consumer_dev_name + supply
names from init_data->consumer_supplies[], leading to the entire
probe of the bq25890 driver failing:

[   32.017501] bq25890-charger i2c-bq25892_main: Failed to set supply vbus
[   32.017525] bq25890-charger i2c-bq25892_main: error -EBUSY: registering vsys regulator
[   32.124978] bq25890-charger: probe of i2c-bq25892_main failed with error -16

Fixes: 14a3d159abf8 ("power: supply: bq25890: Add Vsys regulator")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/power/supply/bq25890_charger.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marek Vasut Nov. 27, 2022, 9:16 p.m. UTC | #1
On 11/27/22 19:02, Hans de Goede wrote:
> bq25890_platform_data.regulator_init_data is intended to only provide
> regulator init_data for the vbus regulator.
> 
> Remove this from the regulator_config before registering the vsys
> regulator. Otherwise the regulator_register() call for vsys will fail
> because it tries to register duplicate consumer_dev_name + supply
> names from init_data->consumer_supplies[], leading to the entire
> probe of the bq25890 driver failing:
> 
> [   32.017501] bq25890-charger i2c-bq25892_main: Failed to set supply vbus
> [   32.017525] bq25890-charger i2c-bq25892_main: error -EBUSY: registering vsys regulator
> [   32.124978] bq25890-charger: probe of i2c-bq25892_main failed with error -16
> 
> Fixes: 14a3d159abf8 ("power: supply: bq25890: Add Vsys regulator")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Marek Vasut <marex@denx.de>
Sebastian Reichel Nov. 27, 2022, 11:30 p.m. UTC | #2
Hi,

On Sun, Nov 27, 2022 at 10:16:20PM +0100, Marek Vasut wrote:
> On 11/27/22 19:02, Hans de Goede wrote:
> > bq25890_platform_data.regulator_init_data is intended to only provide
> > regulator init_data for the vbus regulator.
> > 
> > Remove this from the regulator_config before registering the vsys
> > regulator. Otherwise the regulator_register() call for vsys will fail
> > because it tries to register duplicate consumer_dev_name + supply
> > names from init_data->consumer_supplies[], leading to the entire
> > probe of the bq25890 driver failing:
> > 
> > [   32.017501] bq25890-charger i2c-bq25892_main: Failed to set supply vbus
> > [   32.017525] bq25890-charger i2c-bq25892_main: error -EBUSY: registering vsys regulator
> > [   32.124978] bq25890-charger: probe of i2c-bq25892_main failed with error -16
> > 
> > Fixes: 14a3d159abf8 ("power: supply: bq25890: Add Vsys regulator")
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Reviewed-by: Marek Vasut <marex@denx.de>

Thanks, queued.

-- Sebastian
diff mbox series

Patch

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index bfdd2213ba69..512c81662eea 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -1161,6 +1161,8 @@  static int bq25890_register_regulator(struct bq25890_device *bq)
 				     "registering vbus regulator");
 	}
 
+	/* pdata->regulator_init_data is for vbus only */
+	cfg.init_data = NULL;
 	reg = devm_regulator_register(bq->dev, &bq25890_vsys_desc, &cfg);
 	if (IS_ERR(reg)) {
 		return dev_err_probe(bq->dev, PTR_ERR(reg),