Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231202

Re: [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers

From Peter Rosin <peda@lysator.liu.se>
Newsgroups linux.kernel
Subject Re: [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers
Date 2015-09-23 09:50 +0200
Message-ID <qbMYp-686-1@gated-at.bofh.it> (permalink)
References <qbxPH-10s-3@gated-at.bofh.it> <qbxPI-10s-25@gated-at.bofh.it> <qbAue-4UA-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2015-09-22 20:22, Jonathan Cameron wrote:
> On 22 September 2015 16:36:49 BST, Peter Rosin <peda@lysator.liu.se> wrote:

*snip* lots of cosmetics that I'll fix in the next spin...

>> +
>> +static int mcp4531_read_raw(struct iio_dev *indio_dev,
>> +			    struct iio_chan_spec const *chan,
>> +			    int *val, int *val2, long mask)
>> +{
>> +	int err;
>> +
>> +	switch (mask) {
>> +	case IIO_CHAN_INFO_RAW:
>> +		err = mcp4531_get_value(indio_dev, chan->address, val);
>> +		if (err < 0)
>> +			return err;
>> +		return IIO_VAL_INT;
>> +	}
> No scale known? Be nice to relate to real world values.  I gather this may need
>  platform data of some type (can't open data sheet on phone for some reason)

...but I need more input on this.

Yes, it would be nice and yes it requires platform data, as there is
no way to retrieve if the driver is dealing with a 5, 10, 50 or 100 kOhms
pot/rheostat. You would also have to expose both the resistance between
A to W and between W to B, as you have no way to know how it's been
connected (or you'd need more platform data). Ok, for rheostats you
know how it's connected, since A isn't available, but for pots there
are two resistance values controlled with a single value X i.e.
X*scale/max and (max-X)*scale/max (ignoring the 75 Ohm wiper resistance).

But, I'd rather not go there, as I don't need any of it. Is it Ok to not
provide scaling?

Cheers,
Peter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/2] Driver for Microchip digital potentiometers Peter Rosin <peda@lysator.liu.se> - 2015-09-22 17:40 +0200
  [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers Peter Rosin <peda@lysator.liu.se> - 2015-09-22 17:40 +0200
    Re: [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers Jonathan Cameron <jic23@jic23.retrosnub.co.uk> - 2015-09-22 20:30 +0200
      Re: [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital  potentiometers Peter Rosin <peda@lysator.liu.se> - 2015-09-23 09:50 +0200
        Re: [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers Lars-Peter Clausen <lars@metafoo.de> - 2015-09-23 10:50 +0200
  [PATCH v4 1/2] iio: resistance: Document that resistance can be output Peter Rosin <peda@lysator.liu.se> - 2015-09-22 17:40 +0200

csiph-web