diff mbox

[10/11] Staging: iio: accel: Add comments about units in data read function

Message ID 1520236170-14668-11-git-send-email-himanshujha199640@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Himanshu Jha March 5, 2018, 7:49 a.m. UTC
Clarify the conversion and formation of resultant data in the
adis16201_read_raw() with sufficient comments.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/staging/iio/accel/adis16201.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Jonathan Cameron March 7, 2018, 8:50 p.m. UTC | #1
On Mon,  5 Mar 2018 13:19:29 +0530
Himanshu Jha <himanshujha199640@gmail.com> wrote:

> Clarify the conversion and formation of resultant data in the
> adis16201_read_raw() with sufficient comments.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
This is fine but it needs to be in the original comment changing patch
rather than removing the comments first then a few patches later putting
back a different version.

So good change but in the wrong place in the series.  Learning to reorder
a series and merge down multiple patches into one is very useful when
working with git.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/accel/adis16201.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c
> index 8d795e2..946c7b1 100644
> --- a/drivers/staging/iio/accel/adis16201.c
> +++ b/drivers/staging/iio/accel/adis16201.c
> @@ -130,6 +130,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
>  			*val2 = 0;
>  			return IIO_VAL_INT_PLUS_MICRO;
>  		case IIO_ACCEL:
> +		       /*
> +			* IIO base unit for sensitivity of accelerometer
> +			* is milli g.
> +			* 1 LSB represents 0.244 mg.
> +			*/
>  			*val = 0;
>  			*val2 = IIO_G_TO_M_S_2(462400);
>  			return IIO_VAL_INT_PLUS_NANO;
> @@ -142,6 +147,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
>  		}
>  		break;
>  	case IIO_CHAN_INFO_OFFSET:
> +	       /*
> +		* The raw ADC value is 0x4FE when the temperature
> +		* is 25 degrees and the scale factor per milli
> +		* degree celcius is -470.
> +		*/
>  		*val = 25000 / -470 - 1278;
>  		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_CALIBBIAS:

--
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
Himanshu Jha March 8, 2018, 7:28 a.m. UTC | #2
On Wed, Mar 07, 2018 at 08:50:30PM +0000, Jonathan Cameron wrote:
> On Mon,  5 Mar 2018 13:19:29 +0530
> Himanshu Jha <himanshujha199640@gmail.com> wrote:
> 
> > Clarify the conversion and formation of resultant data in the
> > adis16201_read_raw() with sufficient comments.
> > 
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> This is fine but it needs to be in the original comment changing patch
> rather than removing the comments first then a few patches later putting
> back a different version.
> 
> So good change but in the wrong place in the series.  Learning to reorder
> a series and merge down multiple patches into one is very useful when
> working with git.

I will send v2 with all the updates!

What about sign_extend32 & reverse christmas ordering patch ? Will you
pick that up or shall I send them again ?
Jonathan Cameron March 10, 2018, 3:05 p.m. UTC | #3
On Thu, 8 Mar 2018 12:58:19 +0530
Himanshu Jha <himanshujha199640@gmail.com> wrote:

> On Wed, Mar 07, 2018 at 08:50:30PM +0000, Jonathan Cameron wrote:
> > On Mon,  5 Mar 2018 13:19:29 +0530
> > Himanshu Jha <himanshujha199640@gmail.com> wrote:
> >   
> > > Clarify the conversion and formation of resultant data in the
> > > adis16201_read_raw() with sufficient comments.
> > > 
> > > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>  
> > This is fine but it needs to be in the original comment changing patch
> > rather than removing the comments first then a few patches later putting
> > back a different version.
> > 
> > So good change but in the wrong place in the series.  Learning to reorder
> > a series and merge down multiple patches into one is very useful when
> > working with git.  
> 
> I will send v2 with all the updates!
> 
> What about sign_extend32 & reverse christmas ordering patch ? Will you
> pick that up or shall I send them again ?
Please repost anything not yet applied in V2 of the series.

Makes it much easier for me to avoid missing patches!

Thanks,

Jonathan

> 

--
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
diff mbox

Patch

diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c
index 8d795e2..946c7b1 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -130,6 +130,11 @@  static int adis16201_read_raw(struct iio_dev *indio_dev,
 			*val2 = 0;
 			return IIO_VAL_INT_PLUS_MICRO;
 		case IIO_ACCEL:
+		       /*
+			* IIO base unit for sensitivity of accelerometer
+			* is milli g.
+			* 1 LSB represents 0.244 mg.
+			*/
 			*val = 0;
 			*val2 = IIO_G_TO_M_S_2(462400);
 			return IIO_VAL_INT_PLUS_NANO;
@@ -142,6 +147,11 @@  static int adis16201_read_raw(struct iio_dev *indio_dev,
 		}
 		break;
 	case IIO_CHAN_INFO_OFFSET:
+	       /*
+		* The raw ADC value is 0x4FE when the temperature
+		* is 25 degrees and the scale factor per milli
+		* degree celcius is -470.
+		*/
 		*val = 25000 / -470 - 1278;
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_CALIBBIAS: