Re: [PATCH v1] iio: gyro: mpu3050: Fix reported temperature value

From: Dmitry Osipenko
Date: Wed Apr 21 2021 - 21:10:31 EST


22.04.2021 03:38, Linus Walleij пишет:
> On Thu, Apr 22, 2021 at 1:49 AM Dmitry Osipenko <digetx@xxxxxxxxx> wrote:
>
>> The raw temperature value is a signed 16bit integer. The sign casting
>> is missed in the code, which results in a wrong temperature reported by
>> userspace tools, fix it.
>>
>> Cc: stable@xxxxxxxxxxxxxxx
>> Link: https://www.cdiweb.com/datasheets/invensense/mpu-3000a.pdf
>> Tested-by: Maxim Schwalm <maxim.schwalm@xxxxxxxxx> # Asus TF700T
>> Tested-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx> # Asus TF201
>> Reported-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
>> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
>
> +/- Andy's comments:
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> I never thought this driver would have so many users (3 people signed
> testing it!) but I realize it is more widely deployed than I thought.
>
> I have totally ignored the MPU3050's ability to act as a "sensor hub"
> and talk to accelerometers and magnetometers directly. I always
> thought it would be better to just route the I2C right through it and
> put Linux in direct control, but I realize this was not Invensese's
> intention. I don't know if it can be actually utilized in some generic
> way, all kernels using that have separate hacky drivers for all the
> sub-sensors duplicating the kernel drivers we already have ...

I don't think that MPU3050 could talk to the sensors behind it directly.
It's has "I2C gate" which allows to route the I2C communication to the
chained sensors, which is done in order to reduce noise on the I2C bus
such that only one sensor is active at a time. Those chained sensors are
working good using upstream kernel drivers, the accelerometer is
particularly useful for display autorotation. Modern DEs like Gnome and
KDE are using iio-sensor-proxy library that knows how to work with the
mainline sensor drivers.

Thank you and Andy for the review, I'll prepare v2.