From: Jonathan Cameron <jic23@kernel.org>
To: "Breana, Tiberiu A" <tiberiu.a.breana@intel.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: light: STK3310: un-invert proximity values
Date: Wed, 24 Jun 2015 19:01:58 +0100 [thread overview]
Message-ID: <558AF096.6060702@kernel.org> (raw)
In-Reply-To: <4586F61A4A291F4DA44D32824E7C0F402216B6EA@IRSMSX109.ger.corp.intel.com>
On 24/06/15 10:41, Breana, Tiberiu A wrote:
>> -----Original Message-----
>> From: Jonathan Cameron [mailto:jic23@kernel.org]
>> Sent: Sunday, June 21, 2015 1:06 PM
>> To: Breana, Tiberiu A; linux-iio@vger.kernel.org
>> Subject: Re: [PATCH] iio: light: STK3310: un-invert proximity values
>>
>> On 17/06/15 12:09, Tiberiu Breana wrote:
>>> In accordance with the recent ABI changes, STK3310's proximity
>>> readings should be un-inversed in order to return low values for
>>> far-away objects and high values for close ones.
>>>
>
> <snip>
>
>>> -/*
>>> - * Maximum PS values with regard to scale. Used to export the 'inverse'
>>> - * PS value (high values for far objects, low values for near objects).
>>> - */
>>> +
>>> +/* Estimate maximum proximity values with regard to measurement
>>> +scale. */
>>> static const int stk3310_ps_max[4] = {
>>> - STK3310_PS_MAX_VAL / 64,
>>> - STK3310_PS_MAX_VAL / 16,
>>> - STK3310_PS_MAX_VAL / 4,
>>> - STK3310_PS_MAX_VAL,
>>> + STK3310_PS_MAX_VAL / 640,
>>> + STK3310_PS_MAX_VAL / 160,
>>> + STK3310_PS_MAX_VAL / 40,
>>> + STK3310_PS_MAX_VAL / 10
>>> };
>> What's this change about? All uses of this array as present in this patch have
>> been removed. It is used elsewhere for parameter sanity checking, but I
>> can't follow why it now needs to be divided by 10.
>
> Indeed, these values are still used in _write_event for setting proximity interrupt
> threshold values. Truth is, they should have been divided by 10 from the start,
> but since all values were relative to the pre-defined maximum values, it didn't
> really matter. I used the higher max values because the readings would
> sometimes go over the expected range (when I press down on the sensor with
> my thumb), so the proximity readings became negative. But that shouldn't happen
> in the case of a real device, as the sensor is covered by at least a screen layer.
>
> For the default scale of 0.1 real proximity readings max out at around 6500,
> roughly a tenth of the maximum theoretical value, as expected. Now that we're
> using un-inverted measurements, we can't use the same reference values as
> before - e.g. if the real maximum value is 6500, we can't allow setting a threshold
> of 30000 - it will never be reached.
> If you think this change warrants a separate patch, I'll split it.
>
Perhaps just warrants a mention in the patch description!
prev parent reply other threads:[~2015-06-24 18:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 11:09 [PATCH] iio: light: STK3310: un-invert proximity values Tiberiu Breana
2015-06-17 13:18 ` Peter Meerwald
2015-06-18 8:09 ` Breana, Tiberiu A
2015-06-21 10:07 ` Jonathan Cameron
2015-06-21 10:05 ` Jonathan Cameron
2015-06-24 9:41 ` Breana, Tiberiu A
2015-06-24 18:01 ` Jonathan Cameron [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=558AF096.6060702@kernel.org \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=tiberiu.a.breana@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.