Re: [PATCH] media: video-i2c: add hwmon support for amg88xx

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

 



On 06/26/2018 08:20 PM, Matt Ranostay wrote:
On Tue, Jun 26, 2018 at 6:47 AM, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
On 06/25/2018 11:30 PM, Matt Ranostay wrote:

AMG88xx has an on-board thermistor which is used for more accurate
processing of its temperature readings from the 8x8 thermopile array

Cc: linux-hwmon@xxxxxxxxxxxxxxx
Signed-off-by: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx>
---
   drivers/media/i2c/video-i2c.c | 73 +++++++++++++++++++++++++++++++++++
   1 file changed, 73 insertions(+)

...


+               tmp = -(tmp & 0x7ff);


0x800 => 0x0 -> -0x0 -> 0x0

seems wrong. Maybe consider using sign_extend32() instead ?


Heh yes I knew someone was going to see this and scratch their head on this..

So the sign bit just says if the value is positive or negative, and
the value isn't two's (or even one's) complement value.
If it is negative you have to basically have to  invert the absolute
value (tested this with a freezer to be sure it wasn't a datasheet
mistake).

Datasheet: https://cdn-learn.adafruit.com/assets/assets/000/043/261/original/Grid-EYE_SPECIFICATIONS%28Reference%29.pdf


Outch, that hurts. Please add a comment into the code explaining this.
Also, to be on the safe side, it might make sense to mask tmp with
0x0fff - the upper bits seem to be undefined.

Thanks,
Guenter



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux