[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPVz0n2KgUKi-m+kjvbxq8fA_G0+KNHtkNe4T0UGpmasMjWK2A@mail.gmail.com>
Date: Wed, 8 Mar 2023 12:35:54 +0200
From: Svyatoslav Ryhel <clamor95@...il.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Guenter Roeck <linux@...ck-us.net>,
Jean Delvare <jdelvare@...e.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, linux-hwmon@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] hwmon: ina2xx: add optional regulator support
ср, 8 бер. 2023 р. о 12:25 Krzysztof Kozlowski
<krzysztof.kozlowski@...aro.org> пише:
>
> On 08/03/2023 10:40, Svyatoslav Ryhel wrote:
> > Some devices may need a specific supply provided
> > for this sensor to work properly, like p895 does.
> >
> > Signed-off-by: Svyatoslav Ryhel <clamor95@...il.com>
> > ---
> > drivers/hwmon/ina2xx.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
> > index 00fc70305a89..4a3e2b1bbe8b 100644
> > --- a/drivers/hwmon/ina2xx.c
> > +++ b/drivers/hwmon/ina2xx.c
> > @@ -119,6 +119,7 @@ struct ina2xx_data {
> > long power_lsb_uW;
> > struct mutex config_lock;
> > struct regmap *regmap;
> > + struct regulator *vdd_supply;
> >
> > const struct attribute_group *groups[INA2XX_MAX_ATTRIBUTE_GROUPS];
> > };
> > @@ -656,6 +657,17 @@ static int ina2xx_probe(struct i2c_client *client)
> > return PTR_ERR(data->regmap);
> > }
> >
> > + data->vdd_supply = devm_regulator_get_optional(dev, "vdd");
> > + if (IS_ERR(data->vdd_supply))
> > + return dev_err_probe(dev, PTR_ERR(data->vdd_supply),
> > + "failed to get vdd regulator\n");
> > +
> > + ret = regulator_enable(data->vdd_supply);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to enable vdd power supply\n");
> > + return ret;
>
> And where is disable? On each error path, removal etc.
>
error path ok, should I create a remove function just to disable the regulator?
> Best regards,
> Krzysztof
>
Powered by blists - more mailing lists