mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: adc: ad7606: enable Vdrive and Vrefin power supply voltages
@ 2025-05-29  9:13 Angelo Dureghello
  2025-05-29  9:13 ` [PATCH 1/2] iio: adc: ad7606: enable Vdrive power supply Angelo Dureghello
  2025-05-29  9:13 ` [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage Angelo Dureghello
  0 siblings, 2 replies; 7+ messages in thread
From: Angelo Dureghello @ 2025-05-29  9:13 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá,
	Andy Shevchenko
  Cc: linux-iio, linux-kernel, Angelo Dureghello

Enable Vdrive and Vrefin power supply voltages. Related fdt properties
are already defined in ad7606 dt_schema.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
---
Angelo Dureghello (2):
      iio: adc: ad7606: enable Vdrive power supply
      iio: adc: ad7606: add enabling of optional Vrefin voltage

 drivers/iio/adc/ad7606.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
base-commit: aa1b3efb8425b572d67df2f5d47ee4ed25571428
change-id: 20250529-wip-bl-ad7606-reference-voltages-26f49520d12c

Best regards,
-- 
Angelo Dureghello <adureghello@baylibre.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] iio: adc: ad7606: enable Vdrive power supply
  2025-05-29  9:13 [PATCH 0/2] iio: adc: ad7606: enable Vdrive and Vrefin power supply voltages Angelo Dureghello
@ 2025-05-29  9:13 ` Angelo Dureghello
  2025-05-29  9:13 ` [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage Angelo Dureghello
  1 sibling, 0 replies; 7+ messages in thread
From: Angelo Dureghello @ 2025-05-29  9:13 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá,
	Andy Shevchenko
  Cc: linux-iio, linux-kernel, Angelo Dureghello

From: Angelo Dureghello <adureghello@baylibre.com>

Enable Vdrive power supply. The "vdrive-supply" property is mandatory,
already declared in fdt dt_schema.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
---
 drivers/iio/adc/ad7606.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index 185243dee86ed2e9ebc43b578003d0c010e97a9f..3bbe9c05b5edbc11e8016c995c6ab64104836e7b 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -1330,6 +1330,11 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
 		return dev_err_probe(dev, ret,
 				     "Failed to enable specified AVcc supply\n");
 
+	ret = devm_regulator_get_enable(dev, "vdrive");
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "Failed to enable Vdrive supply\n");
+
 	st->chip_info = chip_info;
 
 	if (st->chip_info->oversampling_num) {

-- 
2.49.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage
  2025-05-29  9:13 [PATCH 0/2] iio: adc: ad7606: enable Vdrive and Vrefin power supply voltages Angelo Dureghello
  2025-05-29  9:13 ` [PATCH 1/2] iio: adc: ad7606: enable Vdrive power supply Angelo Dureghello
@ 2025-05-29  9:13 ` Angelo Dureghello
  2025-05-29 17:52   ` David Lechner
  1 sibling, 1 reply; 7+ messages in thread
From: Angelo Dureghello @ 2025-05-29  9:13 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá,
	Andy Shevchenko
  Cc: linux-iio, linux-kernel, Angelo Dureghello

From: Angelo Dureghello <adureghello@baylibre.com>

Add optional refin voltage enabling. The property "refin-supply" is
already available and optional in the current fdt dt_schema.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
---
 drivers/iio/adc/ad7606.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index 3bbe9c05b5edbc11e8016c995c6ab64104836e7b..21e63260965c32988d0ab3b8bb1201aa2396f1ba 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -1335,6 +1335,10 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
 		return dev_err_probe(dev, ret,
 				     "Failed to enable Vdrive supply\n");
 
+	ret = devm_regulator_get_enable_optional(dev, "refin");
+	if (ret < 0 && ret != -ENODEV)
+		return dev_err_probe(dev, ret, "failed to get refin voltage\n");
+
 	st->chip_info = chip_info;
 
 	if (st->chip_info->oversampling_num) {

-- 
2.49.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage
  2025-05-29  9:13 ` [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage Angelo Dureghello
@ 2025-05-29 17:52   ` David Lechner
  2025-05-30  7:39     ` Angelo Dureghello
  0 siblings, 1 reply; 7+ messages in thread
From: David Lechner @ 2025-05-29 17:52 UTC (permalink / raw)
  To: Angelo Dureghello, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Nuno Sá,
	Andy Shevchenko
  Cc: linux-iio, linux-kernel

On 5/29/25 4:13 AM, Angelo Dureghello wrote:
> From: Angelo Dureghello <adureghello@baylibre.com>
> 
> Add optional refin voltage enabling. The property "refin-supply" is
> already available and optional in the current fdt dt_schema.
> 
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> ---
>  drivers/iio/adc/ad7606.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index 3bbe9c05b5edbc11e8016c995c6ab64104836e7b..21e63260965c32988d0ab3b8bb1201aa2396f1ba 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -1335,6 +1335,10 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
>  		return dev_err_probe(dev, ret,
>  				     "Failed to enable Vdrive supply\n");
>  
> +	ret = devm_regulator_get_enable_optional(dev, "refin");
> +	if (ret < 0 && ret != -ENODEV)

< 0 is probably not needed.

> +		return dev_err_probe(dev, ret, "failed to get refin voltage\n");

We aren't reading the voltage, so the message doesn't make sense.

> +
>  	st->chip_info = chip_info;
>  
>  	if (st->chip_info->oversampling_num) {
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage
  2025-05-29 17:52   ` David Lechner
@ 2025-05-30  7:39     ` Angelo Dureghello
  2025-05-30 11:35       ` Nuno Sá
  2025-05-30 13:49       ` David Lechner
  0 siblings, 2 replies; 7+ messages in thread
From: Angelo Dureghello @ 2025-05-30  7:39 UTC (permalink / raw)
  To: David Lechner
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

On 29.05.2025 12:52, David Lechner wrote:
> On 5/29/25 4:13 AM, Angelo Dureghello wrote:
> > From: Angelo Dureghello <adureghello@baylibre.com>
> > 
> > Add optional refin voltage enabling. The property "refin-supply" is
> > already available and optional in the current fdt dt_schema.
> > 
> > Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> > ---
> >  drivers/iio/adc/ad7606.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> > index 3bbe9c05b5edbc11e8016c995c6ab64104836e7b..21e63260965c32988d0ab3b8bb1201aa2396f1ba 100644
> > --- a/drivers/iio/adc/ad7606.c
> > +++ b/drivers/iio/adc/ad7606.c
> > @@ -1335,6 +1335,10 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
> >  		return dev_err_probe(dev, ret,
> >  				     "Failed to enable Vdrive supply\n");
> >  
> > +	ret = devm_regulator_get_enable_optional(dev, "refin");
> > +	if (ret < 0 && ret != -ENODEV)
> 
> < 0 is probably not needed.
>
The above code looks correct to me. What is the issue ?
 
> > +		return dev_err_probe(dev, ret, "failed to get refin voltage\n");
> 
> We aren't reading the voltage, so the message doesn't make sense.
> 
Is it better a 
"failed to get refin-supply\n" or
"failed to enable refin voltage\n"

?

> > +
> >  	st->chip_info = chip_info;
> >  
> >  	if (st->chip_info->oversampling_num) {
> > 
> 
Regards,
angelo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage
  2025-05-30  7:39     ` Angelo Dureghello
@ 2025-05-30 11:35       ` Nuno Sá
  2025-05-30 13:49       ` David Lechner
  1 sibling, 0 replies; 7+ messages in thread
From: Nuno Sá @ 2025-05-30 11:35 UTC (permalink / raw)
  To: Angelo Dureghello, David Lechner
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

On Fri, 2025-05-30 at 09:39 +0200, Angelo Dureghello wrote:
> On 29.05.2025 12:52, David Lechner wrote:
> > On 5/29/25 4:13 AM, Angelo Dureghello wrote:
> > > From: Angelo Dureghello <adureghello@baylibre.com>
> > > 
> > > Add optional refin voltage enabling. The property "refin-supply" is
> > > already available and optional in the current fdt dt_schema.
> > > 
> > > Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> > > ---
> > >  drivers/iio/adc/ad7606.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> > > index
> > > 3bbe9c05b5edbc11e8016c995c6ab64104836e7b..21e63260965c32988d0ab3b8bb1201aa
> > > 2396f1ba 100644
> > > --- a/drivers/iio/adc/ad7606.c
> > > +++ b/drivers/iio/adc/ad7606.c
> > > @@ -1335,6 +1335,10 @@ int ad7606_probe(struct device *dev, int irq, void
> > > __iomem *base_address,
> > >  		return dev_err_probe(dev, ret,
> > >  				     "Failed to enable Vdrive supply\n");
> > >  
> > > +	ret = devm_regulator_get_enable_optional(dev, "refin");
> > > +	if (ret < 0 && ret != -ENODEV)
> > 
> > < 0 is probably not needed.
> > 
> The above code looks correct to me. What is the issue ?
>  

Not that there's an issue with the code. I think David means that ret > 0 has no
meaning (function on return values <= 0) which means that if (ret) is enough. 

- Nuno Sá

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage
  2025-05-30  7:39     ` Angelo Dureghello
  2025-05-30 11:35       ` Nuno Sá
@ 2025-05-30 13:49       ` David Lechner
  1 sibling, 0 replies; 7+ messages in thread
From: David Lechner @ 2025-05-30 13:49 UTC (permalink / raw)
  To: Angelo Dureghello
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

On 5/30/25 2:39 AM, Angelo Dureghello wrote:
> On 29.05.2025 12:52, David Lechner wrote:
>> On 5/29/25 4:13 AM, Angelo Dureghello wrote:
>>> From: Angelo Dureghello <adureghello@baylibre.com>
>>>
>>> Add optional refin voltage enabling. The property "refin-supply" is
>>> already available and optional in the current fdt dt_schema.
>>>
>>> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
>>> ---
>>>  drivers/iio/adc/ad7606.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
>>> index 3bbe9c05b5edbc11e8016c995c6ab64104836e7b..21e63260965c32988d0ab3b8bb1201aa2396f1ba 100644
>>> --- a/drivers/iio/adc/ad7606.c
>>> +++ b/drivers/iio/adc/ad7606.c
>>> @@ -1335,6 +1335,10 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
>>>  		return dev_err_probe(dev, ret,
>>>  				     "Failed to enable Vdrive supply\n");
>>>  
>>> +	ret = devm_regulator_get_enable_optional(dev, "refin");
>>> +	if (ret < 0 && ret != -ENODEV)
>>
>> < 0 is probably not needed.
>>
> The above code looks correct to me. What is the issue ?

Like Nuno said, it can't be > 0, so if (ret && ret != -ENODEV)

>  
>>> +		return dev_err_probe(dev, ret, "failed to get refin voltage\n");
>>
>> We aren't reading the voltage, so the message doesn't make sense.
>>
> Is it better a 
> "failed to get refin-supply\n" or
> "failed to enable refin voltage\n"

I would make the message the same as Vdrive.

 "Failed to enable REFIN supply\n");

> 
> ?
> 
>>> +
>>>  	st->chip_info = chip_info;
>>>  
>>>  	if (st->chip_info->oversampling_num) {
>>>
>>
> Regards,
> angelo


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-05-30 13:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-29  9:13 [PATCH 0/2] iio: adc: ad7606: enable Vdrive and Vrefin power supply voltages Angelo Dureghello
2025-05-29  9:13 ` [PATCH 1/2] iio: adc: ad7606: enable Vdrive power supply Angelo Dureghello
2025-05-29  9:13 ` [PATCH 2/2] iio: adc: ad7606: add enabling of optional Vrefin voltage Angelo Dureghello
2025-05-29 17:52   ` David Lechner
2025-05-30  7:39     ` Angelo Dureghello
2025-05-30 11:35       ` Nuno Sá
2025-05-30 13:49       ` David Lechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®