From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-iio@vger.kernel.org, kernel@pengutronix.de,
"Thorsten Scherer" <t.scherer@eckelmann.de>
Subject: Re: ti-ads7950: selecting the adc input range
Date: Sat, 16 Jul 2022 18:57:17 +0100 [thread overview]
Message-ID: <20220716185717.59e7fb5c@jic23-huawei> (raw)
In-Reply-To: <496f7dec852e556c44c065cd6dbbfd9c3032dd47.camel@gmail.com>
On Fri, 08 Jul 2022 12:35:19 +0200
Nuno Sá <noname.nuno@gmail.com> wrote:
> On Fri, 2022-07-08 at 11:28 +0200, Lars-Peter Clausen wrote:
> > On 7/8/22 10:02, Uwe Kleine-König wrote:
> > > Hello,
> > >
> > > the ADS7950 has a register bit (called TI_ADS7950_CR_RANGE_5V in
> > > the
> > > driver) that selects the input range. Depending on that bit the
> > > input
> > > range is either [0 .. V_{REF}] or [0 .. 2 * V_{REF}].
> > >
> > > The driver currently defaults to setting that bit, so the range is
> > > the
> > > big one.
> > >
> > > On a machine here however I know the input is in the smaller range
> > > and
> > > I'd like to benefit from the higher resolution of the small range.
> > > I
> > > wonder how to make this tunable. Should that be done using a
> > > firmware
> > > property? ("single-input-range" vs. "double-input-range"? Or input-
> > > range
> > > = <1> vs. input-range = <2> which better matches the data sheet
> > > that
> > > calls the two modes "Range 1 (0 to V_{REF})" and "Range 2 (0 to
> > > 2xV_{REF})") Or should this be made tunable via sysfs? (E.g. by
> > > writing
> > > to the scale property? Or a separate property?)
> >
> > Hi,
> >
> > Its a bit of a tricky one. You can find arguments for and against
> > either. Like "devicetree is for hardware description and not
> > application
> > specific configuration data", or "I know which setting I want to use,
> > having the kernel apply it makes it a lot easier".
> >
> > What we've done in the past in the IIO framework is to make the scale
> > property writable for such devices. Together with a scale_available
> > property to list valid options. This is the most flexible option as
> > it
> > allows to change the setting at runtime for applications where it is
> > required.
> >
>
> Yes, it's a tricky one and I have the feeling that thoughts about this
> are changing frequently :).
>
> Well, this feels identical to what I had in a DAC [1] I recently
> upstreamed. IIRC, on the first version of the series or during
> discussion on the RFC I also had in mind to make it configurable
> through sysfs but Jonathan advised me to go with a fw property.
DACs sometimes have a safety issue (you can fry boards if you set them wrong
and it's not unheard of for designers to make them safe for only a particular
range on a multirange DAC).
Assuming this ADC is sensible that shouldn't be the case here... (famous
last words ;)
Jonathan
>
> [1]:https://elixir.bootlin.com/linux/latest/source/drivers/iio/dac/ltc2688.c#L786
>
> - Nuno Sá
next prev parent reply other threads:[~2022-07-16 17:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 8:02 ti-ads7950: selecting the adc input range Uwe Kleine-König
2022-07-08 9:28 ` Lars-Peter Clausen
2022-07-08 10:35 ` Nuno Sá
2022-07-16 17:57 ` Jonathan Cameron [this message]
2022-07-09 17:10 ` Uwe Kleine-König
2022-07-09 18:17 ` Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220716185717.59e7fb5c@jic23-huawei \
--to=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=t.scherer@eckelmann.de \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox