linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roberta Dobrescu <roberta.dobrescu@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: daniel.baluta@intel.com, octavian.purdila@intel.com,
	knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net
Subject: Re: [PATCH 4/4] staging: iio: light: isl29018: Use standard sysfs attributes for range and scale
Date: Mon, 09 Mar 2015 10:57:37 +0200	[thread overview]
Message-ID: <54FD6081.6000001@gmail.com> (raw)
In-Reply-To: <54FC3786.5000000@kernel.org>

On 08.03.2015 13:50, Jonathan Cameron wrote:
> On 23/02/15 19:35, Roberta Dobrescu wrote:
>> This patch refactors the isl29018 driver code in order to use standard
>> sysfs attributes for range and scale.
>>
>> ISL29018 light sensor uses four ranges and four ADC's resolutions
>> which influence the calculated lux.
>>
>> This patch eliminates the resolution (adc bits) and introduces scale.
>> Each range (1k, 4k, 16k or 64k) has a corresponding set of 4 scales
>> (for 16, 12, 8 or 4 bits). Both range and scale can be changed by the
>> user according to the corresponding set of values (exposed by the attributes
>> in_illuminance_range_available and in_illuminance_scale_available).
>>
>> When the range is changed, the set of available scales is set accordingly and
>> by default the scale used is the one for 16 adc bits. Scale can be changed
>> anytime with one of the available values.
> So we have 3 things interacting here.
>
> range - absolutely controlled for the device
> scale - from current range, with the adc resolution confusing things - we could just
>          multiply the output result up and not need to report this to userspace at all
> integration_time - This is the one element that's really being controlled by the adc
>                     resolution. This adc resolution is really effecting our sensitivity
>                     not the accuracy of measurement of the signal.
>
> Hence I'd have your adc resolution controlled by in_illuminance0_integration_time
> and the full scale range controlled by scale.
>
> For the lower adc resolutions simply apply the relevant scaling to get the output
> value to be on the same scale (assuming the range has not changed)
>
> How does that sound?

Sounds good :D.

Thanks for reviewing this.

Roberta

      parent reply	other threads:[~2015-03-09  8:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 19:35 [PATCH 0/4] staging: iio: light: isl29018: Remove non-standard sysfs attributes Roberta Dobrescu
2015-02-23 19:35 ` [PATCH 1/4] " Roberta Dobrescu
2015-03-08 11:53   ` Jonathan Cameron
2015-02-23 19:35 ` [PATCH 2/4] iio: Introduce IIO_CHAN_INFO_RANGE Roberta Dobrescu
2015-03-08 11:42   ` Jonathan Cameron
2015-03-08 11:51     ` Jonathan Cameron
2015-03-08 20:36     ` Daniel Baluta
2015-02-23 19:35 ` [PATCH 3/4] staging: iio: light: isl29018: Rename lux_scale to calibscale Roberta Dobrescu
2015-02-23 19:35 ` [PATCH 4/4] staging: iio: light: isl29018: Use standard sysfs attributes for range and scale Roberta Dobrescu
2015-03-08 11:50   ` Jonathan Cameron
2015-03-08 20:44     ` Daniel Baluta
2015-03-09  8:57     ` Roberta Dobrescu [this message]

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=54FD6081.6000001@gmail.com \
    --to=roberta.dobrescu@gmail.com \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=octavian.purdila@intel.com \
    --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).