Hello, On Fri, Jul 08, 2022 at 11:28:35AM +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?) > > 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". The latter is usually not a good reason that the dt people would accept :-) > 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. Which driver would you recommend me to study for that approach? > Maybe the right solution is a mix of both, have the property writable by > default, but allow firmware to restrict the available options based on what > the system designer though makes sense. E.g. on some boards having the > ability to switch at runtime makes sense, on others it does not. I can imagine that the board designer says: The input range is 0..5V, so better don't restrict the range to 0..2.5V. And I'd expect the dt people to accept such a binding. Unfortunately for me that's the wrong direction :-) Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Attachment:
signature.asc
Description: PGP signature