patch "iio: gyro: mpu3050: fix chip ID reading" added to staging-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: gyro: mpu3050: fix chip ID reading
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 409a51e0a4a5f908763191fae2c29008632eb712 Mon Sep 17 00:00:00 2001
From: Sergey Larin <[email protected]>
Date: Sat, 2 Mar 2019 19:54:55 +0300
Subject: iio: gyro: mpu3050: fix chip ID reading
According to the datasheet, the last bit of CHIP_ID register controls I2C bus, and the first one is unused. Handle this correctly.
Note that there are chips out there that have a value such that the id check currently fails.
--- drivers/iio/gyro/mpu3050-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/gyro/mpu3050-core.c +5 -3
@@ -29,7 +29,8 @@#include "mpu3050.h" -#define MPU3050_CHIP_ID 0x69 +#define MPU3050_CHIP_ID 0x68 +#define MPU3050_CHIP_ID_MASK 0x7E/* * Register map: anything suffixed *_H is a big-endian high byte and always
@@ -1176,8 +1177,9 @@ int mpu3050_common_probe(struct device *dev, goto err_power_down; } -if (val !=MPU3050_CHIP_ID ) { -dev_err (dev,"unsupported chip id %02x\n" , (u8 )val); +if ((val &MPU3050_CHIP_ID_MASK ) !=MPU3050_CHIP_ID ) { +dev_err (dev,"unsupported chip id %02x\n" , + (u8)(val &MPU3050_CHIP_ID_MASK )); ret = -ENODEV ; goto err_power_down; }
Signature · 1 line
2.21.0