public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] iio: dac: ad5504: Inquiry regarding voltage scale calculation
@ 2026-02-10 12:10 Taha Ed-Dafili
  2026-02-10 16:45 ` David Lechner
  0 siblings, 1 reply; 3+ messages in thread
From: Taha Ed-Dafili @ 2026-02-10 12:10 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, Michael.Hennerich, jic23, dlechner, nuno.sa, andy

Greetings everyone,

I've been reviewing the ad5504 driver and comparing it with
the datasheet, and I want to verify my understanding of a potential
discrepancy.

Datasheet:

https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf

The Issue:

The driver currently uses the vcc regulator voltage to calculate the
output scale. However, the datasheet (Rev B, Page 1) states the device has
an integrated precision reference. The output range (0-30V or 0-60V) is
determined by the R_SEL pin, not the supply voltage.

If my understanding is correct, using vcc for scaling is flawed.
For example, a 40V supply currently results in a ~9.7mV scale
(40V / 4096), whereas the hardware output (in 30V mode) is fixed
at ~7.32mV (30V / 4096).

My Questions:

1. Is it correct to replace the VCC-based scaling with fixed constants?
2. To support the 60V range, the driver needs to know the state of the
`R_SEL` pin. What is the preferred way to handle this hardware
configuration in the bindings?

If you can confirm this and provide guidance on the binding, I would
be happy to prepare a patch to address it.

Thanks,
Taha

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

* Re: [RFC] iio: dac: ad5504: Inquiry regarding voltage scale calculation
  2026-02-10 12:10 [RFC] iio: dac: ad5504: Inquiry regarding voltage scale calculation Taha Ed-Dafili
@ 2026-02-10 16:45 ` David Lechner
  2026-02-11 11:06   ` Taha Ed-Dafili
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2026-02-10 16:45 UTC (permalink / raw)
  To: Taha Ed-Dafili, linux-iio; +Cc: lars, Michael.Hennerich, jic23, nuno.sa, andy

On 2/10/26 6:10 AM, Taha Ed-Dafili wrote:
> Greetings everyone,
> 
> I've been reviewing the ad5504 driver and comparing it with
> the datasheet, and I want to verify my understanding of a potential
> discrepancy.
> 
> Datasheet:
> 
> https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf
> 
> The Issue:
> 
> The driver currently uses the vcc regulator voltage to calculate the
> output scale. However, the datasheet (Rev B, Page 1) states the device has
> an integrated precision reference. The output range (0-30V or 0-60V) is
> determined by the R_SEL pin, not the supply voltage.
> 
> If my understanding is correct, using vcc for scaling is flawed.
> For example, a 40V supply currently results in a ~9.7mV scale
> (40V / 4096), whereas the hardware output (in 30V mode) is fixed
> at ~7.32mV (30V / 4096).
> 
> My Questions:
> 
> 1. Is it correct to replace the VCC-based scaling with fixed constants?

Yes, I think you are reading the datasheet correctly. I'm guessing past
users just put in raw values and didn't use the scale attribute.

> 2. To support the 60V range, the driver needs to know the state of the
> `R_SEL` pin. What is the preferred way to handle this hardware
> configuration in the bindings?

This is another one of those cases where the pin could be hard-wired or
controlled by a GPIO. We don't have to implement both cases in the driver,
but we should try to make the DT bindings complete.

properties:
  output-range-gpios:
    description:
      A GPIO connected to the /R_SEL pin to select the output voltage
      range.
  output-range-volts:
    description:
      Hard-wired /R_SEL pin state. 30 V when pin is high and 60 V when
      pin is low.
    enum: [30, 60]
    default: 60

allOf:
   # Can't have GPIO and hard-wired at the same time.
   - if:
       required: output-range-gpios
     then:
       output-range-volts: false
   - if:
       required: output-range-volts
     then:
       output-range-gpios: false
    

> 
> If you can confirm this and provide guidance on the binding, I would
> be happy to prepare a patch to address it.

And we should fix other trivial missing things in the bindings while we
are at it.

vlogic-supply: true

clear-gpios:
  description: GPIO that controls the /CLR pin

ldac-gpios: true

> 
> Thanks,
> Taha


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

* Re: [RFC] iio: dac: ad5504: Inquiry regarding voltage scale calculation
  2026-02-10 16:45 ` David Lechner
@ 2026-02-11 11:06   ` Taha Ed-Dafili
  0 siblings, 0 replies; 3+ messages in thread
From: Taha Ed-Dafili @ 2026-02-11 11:06 UTC (permalink / raw)
  To: dlechner
  Cc: 0rayn.dev, Michael.Hennerich, andy, jic23, lars, linux-iio,
	nuno.sa

Hi David,

Thank you for confirming the issue and for the detailed guidance
on the bindings.

I will prepare a patch series following your suggestions and send it as
soon as it is ready for review.

Best regards,
Taha

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

end of thread, other threads:[~2026-02-11 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 12:10 [RFC] iio: dac: ad5504: Inquiry regarding voltage scale calculation Taha Ed-Dafili
2026-02-10 16:45 ` David Lechner
2026-02-11 11:06   ` Taha Ed-Dafili

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