Re: [PATCH 0/2] add AD8460 DAC driver

Jonathan Cameron
2024-05-11T16:22:08Z

On Fri, 10 May 2024 12:30:46 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On Fri, May 10, 2024 at 1:42 AM Mariel Tinaco <Mariel.Tinaco@analog.com> wrote:
> >
> > The AD8460 is a 14-bit, high power +-40V 1A, high-speed DAC,
> > with dual digital input modes, programmable supply current and
> > fault monitoring and protection settings for output current,
> > output voltage and junction temperature.
> >
> > The fault monitoring and shutdown protection features were
> > supported in the earlier versions of the IIO driver but was
> > scrapped due to uncertainties if the functionalities belong to
> > the IIO driver. However, it would be best to implement it for
> > the device's quality of life. I'd like to know if it's better
> > suited as a stand-alone HWMON driver.

That probably doesn't make sense. This reply btw is based on the
text here. I haven't yet looked in detail at the datasheet.

Some fault conditions are relatively easy to map to threshold events
on an input channel. The ones that are harder are things
like short circuit detectors where it's hard to know what the
actual threshold is.

The other place we are limited is in multiple levels for the
same thing. So warning and fault levels. That stuff is handled
much better by hwmon where these things are more common.
The issue we have is that the event encoding is a bit tight
but we could see if there is a way to add these.

> >
> > The following are the configurable and readable parameters
> > through SPI that could be implemented on the HWMON driver:
> > * An enable bit to arm/protect the device on overcurrent,
> > overvoltage or overtemperature events. The device is shut down
> > upon detection.

We don't have a good way to handle restarting from shutdown, but
perhaps we could use another action to signal that - maybe even
going as far as saying that the driver should be reloaded.

As for the thresholds, they sound like the map to IIO events
reasonably well.

> > * A configurable range/threshold for voltage, current and
> > temperature that raises alarm when exceeded while the device is
> > armed.

That maps fine to the IIO event threshold controls.

> > * Flags that can be polled to raise alarm upon detection of
> > overcurrent, overvoltage or overtemperature events, and apply
> > additional protective measures.
The specific need to poll is awkward but you could do it easily
enough in driver and use the IIO event stuff to signal any
events detected.

> > * Programmable quiescent current (optional)
Could probably figure out a suitable control for this, but I'm not
entirely sure what it is :)

> > * Thermal monitoring is done by measuring voltage on TMP pin
> > (unlikely to be included)

If you did want to, the usual trick for these is to include
an optional use as a consumer of an IIO provider which would be
a separate ADC.

> >
>
> Adding myself to the cc: here since I'm interested to see what
> Jonathan (or anyone else) has to say about the fault monitoring.

Jonathan