All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Nathan Royer <nroyer@invensense.com>,
	Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Subject: Re: BUG: iio: mpu3050: Wrong temperature scale
Date: Mon, 19 Apr 2021 12:07:48 +0200	[thread overview]
Message-ID: <CACRpkdbEue3OLpU0L_SDAsxpLTY7aqRP5sOZ90pF=o-Yb0ot4Q@mail.gmail.com> (raw)
In-Reply-To: <483ac17b-705a-38c3-54ee-7f0089262c03@gmail.com>

On Mon, Apr 19, 2021 at 8:06 AM Dmitry Osipenko <digetx@gmail.com> wrote:

> The driver uses
> (x+23000)/280 formula for the conversion of raw temperature value, which
> gives 82C for x=0, thus apparently formula is wrong because x=50000
> should give us ~25C.
>
> I tried to search for the datasheet with the formula, but couldn't find it.

There is no public datasheet. I have never seen a non-public datasheet
either.

As the initial submission of the driver says:

"This driver is based on information from the rough input driver
 in drivers/input/misc/mpu3050.c and the scratch misc driver
 posted by Nathan Royer in 2011. Some years have passed but this
 is finally a fully-fledged driver for this gyroscope. It was
 developed and tested on the Qualcomm APQ8060 Dragonboard."

Nathans submission:
https://lore.kernel.org/lkml/1309486707-1658-1-git-send-email-nroyer@invensense.com/
(you find the threads at the bottom)

This submission came from inside Invensense so it is the closest
authoritative source we have.

> Linus, will you be able to check whether the formula used by the driver
> is correct? Thanks in advance.

Sadly the code is the documentation when it comes to Invensense stuff,
I am CC:ing Nathans Invensense address in the vain hope he is still
working there and could help, also CC to Jean-Baptiste who was
there last year and maybe can help out.

I don't anymore remember exactly how I found this equation,
but it wasn't from any datasheet. I vaguely remember browsing
through some Android userspace sensor code.

What I tend to do is dig around in old mobile
phone Android trees, and there you sometimes find this information
in different GPL code drops. I bet I got it from browsing some of
those.

Here is an example (Tegra):
https://android.googlesource.com/kernel/tegra/+/dba2740d025c8e7e7e3c61d84a4f964d2c1c0ac9/drivers/misc/inv_mpu

Worst case what one *can* do is to calibrate the scale, like put
the device in a controlled environment of some two reasonably
far apart temperatures and measure, assuming it is at least
linear. Some professionals use controlled environment
chambers for this. But I hope there is a better way.

Yours,
Linus Walleij

  reply	other threads:[~2021-04-19 10:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  6:06 BUG: iio: mpu3050: Wrong temperature scale Dmitry Osipenko
2021-04-19 10:07 ` Linus Walleij [this message]
2021-04-20 21:26   ` Dmitry Osipenko
2021-04-21  9:54     ` Linus Walleij
2021-04-21 19:05       ` Andy Shevchenko
2021-04-21 19:41         ` Andy Shevchenko
2021-04-21 20:00           ` Lars-Peter Clausen
2021-04-21 20:02             ` Andy Shevchenko
2021-04-21 20:04               ` Andy Shevchenko
2021-04-21 20:58                 ` Dmitry Osipenko
2021-04-21 20:11             ` Andy Shevchenko
2021-04-21 23:02             ` Linus Walleij
2021-04-21 23:10               ` Dmitry Osipenko

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='CACRpkdbEue3OLpU0L_SDAsxpLTY7aqRP5sOZ90pF=o-Yb0ot4Q@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=clamor95@gmail.com \
    --cc=digetx@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jmaneyrol@invensense.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nroyer@invensense.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.