From: Laxman Dewangan <ldewangan@nvidia.com>
To: "Paweł Jarosz" <paweljarosz3691@gmail.com>
Cc: <linux-iio@vger.kernel.org>, <rui.zhang@intel.com>,
<edubezval@gmail.com>
Subject: Re: [PATCH] thermal: generic-adc: Fix linear temperature approximation
Date: Thu, 20 Oct 2016 21:19:31 +0530 [thread overview]
Message-ID: <5808E78B.4060109@nvidia.com> (raw)
In-Reply-To: <8d2a5917-30b4-d9eb-304a-b96780de9f4c@gmail.com>
On Thursday 20 October 2016 08:26 PM, Paweł Jarosz wrote:
>
>
> W dniu 20.10.2016 o 14:40, Laxman Dewangan pisze:
>>
>> On Wednesday 19 October 2016 01:01 AM, Paweł Jarosz wrote:
>>> In current version of the driver there is error in temperature
>>> calculation.
>>>
>>> So lets fix it using proper linear function.
>>>
>>> Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
>>
>> Per my calculation, existing and your equation is same as both are
>> doing linear interpolation.
>>
>> Only think I have seen is that I have used 1000 for two consecutive
>> temp difference and you used (t2 - t1), so your is better in this
>> case but still the equation is same.
>>
>> The equation from you is
>>
>> t1 + (hi -val) * factor.
>>
>> and existing one is
>> t2 - (val -lo) * factor
>>
>>
>> factor is abs((t2-t1)/(hi-lo))
>>
>> If my analysis is not correct then can you please provide the example
>> with calculation for better understansing?
>
> Hi
>
> For example if we try to calculate temp for val = 8, i = 1 and table:
>
> <0 9
> 2 7>
>
> adc_hi = gti->lookup_table[2 * i - 1];
> adc_lo = gti->lookup_table[2 * i + 1];
> temp = gti->lookup_table[2 * i];
> temp -= ((val - adc_lo) * 1000) / (adc_hi - adc_lo);
>
> Your method gives temp = -498
>
>
The temp should be in the milli-centigrade in the table so it should be
<0 9
2000 7>;
and if you relplace 1000 with the t2 -t1 where
t1 = gti->lookup_table[2*i -2]
t2 = gti->lookup_table[2 *i]
then it will work perfectly.
So your change for replacing 1000 is correct as what I said but need not
to change whole equation altogether.
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
next prev parent reply other threads:[~2016-10-20 16:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 19:31 [PATCH] thermal: generic-adc: Fix linear temperature approximation Paweł Jarosz
2016-10-20 12:40 ` Laxman Dewangan
2016-10-20 14:56 ` Paweł Jarosz
2016-10-20 15:49 ` Laxman Dewangan [this message]
2016-10-20 16:14 ` Paweł Jarosz
2016-10-20 16:01 ` Laxman Dewangan
2016-10-20 17:10 ` Paweł Jarosz
2016-10-20 17:01 ` Laxman Dewangan
2016-10-20 17:26 ` Paweł Jarosz
2016-10-21 6:18 ` Laxman Dewangan
2016-10-21 7:00 ` Paweł Jarosz
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=5808E78B.4060109@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=edubezval@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=paweljarosz3691@gmail.com \
--cc=rui.zhang@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.