[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR03MB63517D9E6EB47162D205E47FF1A42@PH0PR03MB6351.namprd03.prod.outlook.com>
Date: Mon, 24 Mar 2025 08:45:08 +0000
From: "Torreno, Alexis Czezar" <AlexisCzezar.Torreno@...log.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
CC: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Rob
Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor
Dooley <conor+dt@...nel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>
Subject: RE: [PATCH v2 2/2] regulator: adp5055: Add driver for adp5055
> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@...nel.org>
> Sent: Thursday, March 20, 2025 5:10 PM
> To: Torreno, Alexis Czezar <AlexisCzezar.Torreno@...log.com>
> Cc: Liam Girdwood <lgirdwood@...il.com>; Mark Brown
> <broonie@...nel.org>; Rob Herring <robh@...nel.org>; Krzysztof Kozlowski
> <krzk+dt@...nel.org>; Conor Dooley <conor+dt@...nel.org>; linux-
> kernel@...r.kernel.org; devicetree@...r.kernel.org
> Subject: Re: [PATCH v2 2/2] regulator: adp5055: Add driver for adp5055
>
> [External]
>
> On Thu, Mar 20, 2025 at 02:53:55PM +0800, Alexis Czezar Torreno wrote:
> > +#define ADP5055_REG(_name, _id, _ch) \
> > + ADP5055_REG_(_name, _id, _ch, &adp5055_ops)
> > +
> > +static struct regulator_desc adp5055_regulators[] = {
> > + ADP5055_REG("DCDC0", 0, 0),
> > + ADP5055_REG("DCDC1", 1, 1),
> > + ADP5055_REG("DCDC2", 2, 2),
>
> Nodenames are lowercase, always.
Noted on this, will apply.
I based this on the act8865 driver, which seems to be a rare case
now that I look at the others
>
> > +};
> > +
> > +static const struct of_device_id adp5055_dt_ids[] = {
> > + { .compatible = "adi,adp5055"},
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, adp5055_dt_ids);
> > +
> > +static int adp5055_probe(struct i2c_client *client) {
> > + struct regulator_init_data *init_data;
> > + struct device *dev = &client->dev;
> > + struct adp5055 *adp5055;
> > + int i, ret;
> > +
> > + init_data = of_get_regulator_init_data(dev, client->dev.of_node,
> > + &adp5055_regulators[0]);
> > + if (!init_data)
> > + return -EINVAL;
> > +
> > + adp5055 = devm_kzalloc(dev, sizeof(struct adp5055), GFP_KERNEL);
> > + if (!adp5055)
> > + return -ENOMEM;
> > +
> > + adp5055->regmap = devm_regmap_init_i2c(client,
> &adp5055_regmap_config);
> > + if (IS_ERR(adp5055->regmap))
> > + return dev_err_probe(dev, PTR_ERR(adp5055->regmap),
> "Failed to
> > +allocate reg map");
> > +
> > + for (i = 0; i < ADP5055_NUM_CH; i++) {
> > + const struct regulator_desc *desc;
> > + struct regulator_config config = { };
> > + struct regulator_dev *rdev;
> > +
>
> Where do you parse the 'reg' which you said is a channel number in the
> binding?
As stated in my [Patch v2 1/2] reply, I changed it from channel to regulator (but I failed
to update the bindings completely)
The 'reg' is no more, I now use the name and id of regulator_desc to differentiate
>
> > + if (adp5055->tset == 2600)
> > + adp5055_regulators[i].ramp_delay_table =
> adp5055_enable_delay_vals_2_6;
> > + else
> > + adp5055_regulators[i].ramp_delay_table =
> > +adp5055_enable_delay_vals_20_8;
> > +
> > + desc = &adp5055_regulators[i];
> > +
> > + config.dev = dev;
> > + config.driver_data = adp5055;
> > + config.regmap = adp5055->regmap;
> > + config.init_data = init_data;
> > +
> > + if (adp5055->hw_en_array_gpios)
> > + config.ena_gpiod = adp5055->hw_en_array_gpios-
> >desc[i];
>
> So a GPIO per node thus enable-gpios in each node.
Discussed in [Patch v2 1/2] reply
>
> Best regards,
> Krzysztof
Powered by blists - more mailing lists