linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Rosin <peda@lysator.liu.se>
To: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>,
	linux-iio@vger.kernel.org
Cc: Peter Rosin <peda@axentia.se>, Crt Mori <cmo@melexis.com>,
	Daniel Baluta <daniel.baluta@gmail.com>,
	Andreas Dannenberg <dannenberg@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers
Date: Wed, 23 Sep 2015 09:39:55 +0200	[thread overview]
Message-ID: <5602574B.5020205@lysator.liu.se> (raw)
In-Reply-To: <B61434B3-133C-4B9C-B451-85B90E55D77A@jic23.retrosnub.co.uk>

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


  reply	other threads:[~2015-09-23  7:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 15:36 [PATCH v4 0/2] Driver for Microchip digital potentiometers Peter Rosin
2015-09-22 15:36 ` [PATCH v4 1/2] iio: resistance: Document that resistance can be output Peter Rosin
2015-09-22 15:36 ` [PATCH v4 2/2] iio: mcp4531: Driver for Microchip digital potentiometers Peter Rosin
2015-09-22 18:22   ` Jonathan Cameron
2015-09-23  7:39     ` Peter Rosin [this message]
2015-09-23  8:42       ` 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=5602574B.5020205@lysator.liu.se \
    --to=peda@lysator.liu.se \
    --cc=cmo@melexis.com \
    --cc=daniel.baluta@gmail.com \
    --cc=dannenberg@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@jic23.retrosnub.co.uk \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).