linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Roberta Dobrescu <roberta.dobrescu@gmail.com>, 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 2/4] iio: Introduce IIO_CHAN_INFO_RANGE
Date: Sun, 08 Mar 2015 11:51:56 +0000	[thread overview]
Message-ID: <54FC37DC.4010608@kernel.org> (raw)
In-Reply-To: <54FC35A0.6000901@kernel.org>

On 08/03/15 11:42, Jonathan Cameron wrote:
> On 23/02/15 19:35, Roberta Dobrescu wrote:
>> Some ambient light sensors have hardware dependent ranges and
>> resolutions. In this case user won't be able to calculate illuminance
>> (lux) using only scale attribute.
>>
>> For instance, a device that uses a Full Scale Range is the
>> light sensor ISL29018. In this case, IIO_CHAN_INFO_RANGE is
>> needed since the number of ADC bits can be 4, 8, 12 or 16 and
>> using just scales would result in too similar values for different
>> ranges and resolutions.
> This is always an interesting corner.  The big question is what is
> to be gained by ever running these sensors in their lower resolutions?
> 
> The reason I've always resisted range is that it's too easy
> for people to be lazy and go with which ever of scale / range
> is presented in the datasheet.  Most of the time they are really
> the same thing.
> 
> The exception as you've noted here is in variable resolution devices.
> There is no way that any generic code is ever going to know the right
> option for the combinations of scaling and adc resolution vs time
> requirements.  So we are dealing here with parameters that might
> be hand tweaked for a particular board.
> 
> Anyhow, I'd like more opinions on this before I take it.
> 
> Lars, Peter, Hartmut - what you guys think on this?
> 
Actually please see my comments on patch 4.
This device has tight coupling between the integration time
and the adc resolution.  Hence that's the parameter to provide
/ control in my view.

Jonathan
> 
>>
>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>> ---
>>  Documentation/ABI/testing/sysfs-bus-iio | 13 +++++++++++++
>>  drivers/iio/industrialio-core.c         |  1 +
>>  include/linux/iio/iio.h                 |  1 +
>>  3 files changed, 15 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
>> index 9a70c31..ad1541f 100644
>> --- a/Documentation/ABI/testing/sysfs-bus-iio
>> +++ b/Documentation/ABI/testing/sysfs-bus-iio
>> @@ -1249,3 +1249,16 @@ Contact:	linux-iio@vger.kernel.org
>>  Description:
>>  		Specifies number of seconds in which we compute the steps
>>  		that occur in order to decide if the consumer is making steps.
>> +
>> +What:		/sys/bus/iio/devices/deviceX/in_illuminance0_range
>> +KernelVersion:	3.21
>> +Contact:	linux-iio@vger.kernel.org
>> +Description:
>> +		Hardware dependent ADC Full Scale Range used for some ambient
>> +		light sensors in calculating lux.
>> +
>> +What:		/sys/bus/iio/devices/deviceX/in_illuminance_range_available
>> +KernelVersion:	3.21
>> +Contact:	linux-iio@vger.kernel.org
>> +Description:
>> +		Hardware dependent supported values for ADC Full Scale Range.
>> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
>> index aaba9d3..4138042 100644
>> --- a/drivers/iio/industrialio-core.c
>> +++ b/drivers/iio/industrialio-core.c
>> @@ -128,6 +128,7 @@ static const char * const iio_chan_info_postfix[] = {
>>  	[IIO_CHAN_INFO_CALIBWEIGHT] = "calibweight",
>>  	[IIO_CHAN_INFO_DEBOUNCE_COUNT] = "debounce_count",
>>  	[IIO_CHAN_INFO_DEBOUNCE_TIME] = "debounce_time",
>> +	[IIO_CHAN_INFO_RANGE] = "range",
>>  };
>>  
>>  /**
>> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
>> index 80d8550..fbdd434 100644
>> --- a/include/linux/iio/iio.h
>> +++ b/include/linux/iio/iio.h
>> @@ -43,6 +43,7 @@ enum iio_chan_info_enum {
>>  	IIO_CHAN_INFO_CALIBWEIGHT,
>>  	IIO_CHAN_INFO_DEBOUNCE_COUNT,
>>  	IIO_CHAN_INFO_DEBOUNCE_TIME,
>> +	IIO_CHAN_INFO_RANGE,
>>  };
>>  
>>  enum iio_shared_by {
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2015-03-08 11:51 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 [this message]
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

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