Re: [PATCH 0/2] iio: ak8975: Fix calculation formula and add device name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

>  Three months ago Lars-Peter revised description of device driver[1].

me, not Lars-Peter

> Correctly, device's sensitivity is 0.3 uT/LSB typ and One micro tesla equal 0.01 gauss[2].
> So I have fixed calculation formula,And then add RAW_TO_GAUSS macro.
> Scale are returned as VAL_INT_PLUS_MICRO.
> Additionally, I have add device name.

+#define RAW_TO_GAUSS(asa) ((((asa) + 128) * 3000) / 256)

  *
  * Since 1uT = 0.01 gauss, our final scale factor becomes:
  *
- * Hadj = H * ((ASA + 128) / 256) * 3/10 * 100
- * Hadj = H * ((ASA + 128) * 30 / 256
+ * Hadj = H * ((ASA + 128) / 256) * 3/10 * 1/100
+ * Hadj = H * ((ASA + 128) * 0.003) / 256
  *
  * Since ASA doesn't change, we cache the resultant scale factor into the
  * device context in ak8975_setup().
  */
-       data->raw_to_gauss[0] = ((data->asa[0] + 128) * 30) >> 8;
+       data->raw_to_gauss[0] = RAW_TO_GAUSS(data->asa[0]);

thank you for following up on this; I don't have the hardware, so I didn't 
dare to change the driver...

the RAW_TO_GAUSS() macro doesn't match the comment Hadj = H * ... anymore

maybe put this explanation in the patch comment, not the cover letter?

regards, p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux