linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Phani A, Rama Krishna" <rphani-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Sricharan <sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	smohanad-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	mgautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	'Hartmut Knaack' <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
	'Lars-Peter Clausen'
	<lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	'Peter Meerwald-Stadler'
	<pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>,
	'Julia Lawall' <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>,
	'open list'
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH V1]iio: adc: spmi-vadc: Changes to support different scaling
Date: Wed, 26 Oct 2016 16:15:42 +0530	[thread overview]
Message-ID: <dfc205f9-172f-3407-272f-dcef8cacfc4d@codeaurora.org> (raw)
In-Reply-To: <001c01d22f72$25990c10$70cb2430$@codeaurora.org>

Hi Sricharan,

On 26-Oct-16 3:47 PM, Sricharan wrote:
> Hi Ramakrishna,
>
> [snip..]
>
>>>> +	u32 i = 0;
>>>> +
>>>> +	if (!pts)
>>>> +		return -EINVAL;
>>>> +
>>>> +	/* Check if table is descending or ascending */
>>>> +	if (tablesize > 1) {
>>>> +		if (pts[0].x < pts[1].x)
>>>> +			descending = 0;
>>>> +	}
>>>> +
>>>> +	while (i < tablesize) {
>>>> +		if ((descending == 1) && (pts[i].x < input)) {
>>>
>>>          Just if (descending) instead of (descending == 1) and so on for the below as well
>>
>> 	Will change in next patch.
>>
>>>
>>>> +			/* table entry is less than measured*/
>>>> +			 /* value and table is descending, stop */
>>>> +			break;
>>>> +		} else if ((descending == 0) &&
>>>> +				(pts[i].x > input)) {
>>>> +			/* table entry is greater than measured*/
>>>> +			/*value and table is ascending, stop */
>>>> +			break;
>>>> +		}
>>>> +		i++;
>>>> +	}
>>>> +
>>>> +	if (i == 0) {
>>>> +		*output = pts[0].y;
>>>> +	} else if (i == tablesize) {
>>>> +		*output = pts[tablesize - 1].y;
>>>> +	} else {
>>>> +		/* result is between search_index and search_index-1 */
>>>> +		/* interpolate linearly */
>>>> +		*output = (((s32)((pts[i].y - pts[i - 1].y) *
>>>> +			(input - pts[i - 1].x)) /
>>>> +			(pts[i].x - pts[i - 1].x)) +
>>>> +			pts[i - 1].y);
>>>> +	}
>>>
>>>                hmm, so for descending, input - pts[i -1].x is negative and
>>>                we are adding that to pts[i-1].y, is that correct ?
>>
>> 		The formula used is to interpolate between two points 	using linear
>> interpolation.
>
>  Right, agree. my question can be ignored.
>
> [snip..]
>
>>>> #define VADC_CHAN_TEMP(_dname, _pre)					\
>>>> -	VADC_CHAN(_dname, IIO_TEMP, BIT(IIO_CHAN_INFO_PROCESSED), _pre)	\
>>>> +	VADC_CHAN(_dname, IIO_TEMP,	\
>>>> +		BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_PROCESSED), \
>>>> +		_pre)	\
>>>>
>>>> #define VADC_CHAN_VOLT(_dname, _pre)					\
>>>> -	VADC_CHAN(_dname, IIO_VOLTAGE,					\
>>>> -		  BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),	\
>>>> +	VADC_CHAN(_dname, IIO_VOLTAGE,				\
>>>> +		  BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_PROCESSED),\
>>>> 		  _pre)							\
>>>>
>>>   For this and the below changes to VADC_CHAN_VOLT to TEMP, why is that done ?
>>>    Now both macros are setting the same flags.
>>
>> 	For Voltage channels IIO_VOLTAGE is needed where as for Temperature
>> channels IIO_TEMP is needed.
>>
>>>
>>>> /*
>>>> @@ -637,12 +811,11 @@ struct vadc_channels {
>>>> 	VADC_CHAN_TEMP(DIE_TEMP, 0)
>>>> 	VADC_CHAN_VOLT(REF_625MV, 0)
>>>> 	VADC_CHAN_VOLT(REF_1250MV, 0)
>>>> -	VADC_CHAN_VOLT(CHG_TEMP, 0)
>>>> +	VADC_CHAN_TEMP(CHG_TEMP, 0)
>>>> 	VADC_CHAN_VOLT(SPARE1, 0)
>>>> 	VADC_CHAN_VOLT(SPARE2, 0)
>>>> 	VADC_CHAN_VOLT(GND_REF, 0)
>>>> 	VADC_CHAN_VOLT(VDD_VADC, 0)
>>>> -
>
> And also looks like the deletion of these and below
> new lines are unnecessary ?

Agree, Will retain these new lines in next patch V2.
>
> Regards,
>  Sricharan
>

Thanks,
Ramakrishna

  reply	other threads:[~2016-10-26 10:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25  5:27 [PATCH V1]iio: adc: spmi-vadc: Changes to support different scaling Rama Krishna Phani A
2016-10-25 13:09 ` Sricharan
2016-10-26  9:27   ` Phani A, Rama Krishna
2016-10-26 10:17     ` Sricharan
2016-10-26 10:45       ` Phani A, Rama Krishna [this message]
2016-11-02  7:25 ` kbuild test robot

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=dfc205f9-172f-3407-272f-dcef8cacfc4d@codeaurora.org \
    --to=rphani-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=Julia.Lawall-L2FTfq7BK8M@public.gmane.org \
    --cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mgautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
    --cc=smohanad-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    /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).