pmaports/device/linux-samsung-i927/0004-iio-gyro-mpu3050-get-chip-ID-correctly.patch
Sergey Larin 53d13cb4c8
samsung-i927: various improvements (!238)
- Bluetooth is now working
- Audio works too (speaker/headphones/earpiece/mic - internal and headset)
- Keyboard layout for X11
- Xorg config for rotated screen
- Suspend issues fixed (tested on MATE)
- OTG bindings updated - not working yet
2019-02-28 15:18:50 +01:00

41 lines
1.2 KiB
Diff

From 081df7f8582115c7b87f3516946acb829a1aa357 Mon Sep 17 00:00:00 2001
From: Sergey Larin <cerg2010cerg2010@mail.ru>
Date: Sat, 26 Jan 2019 19:27:36 +0300
Subject: [PATCH] iio: gyro: mpu3050: get chip ID correctly
According to the datasheet, the first bit of CHIP_ID register specifies
the I2C bus state, and the last one does not belong to ID. Handle this
correctly.
Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
---
drivers/iio/gyro/mpu3050-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 77fac81a3adc..0c541cbf13a4 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -29,7 +29,7 @@
#include "mpu3050.h"
-#define MPU3050_CHIP_ID 0x69
+#define MPU3050_CHIP_ID 0x68
/*
* Register map: anything suffixed *_H is a big-endian high byte and always
@@ -1176,8 +1176,8 @@ 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 & 0x7E) != MPU3050_CHIP_ID) {
+ dev_err(dev, "unsupported chip id %02x\n", (u8)(val & 0x7E));
ret = -ENODEV;
goto err_power_down;
}
--
2.20.1