iio: imu: nvi: Fix false error message
Erik Lilliebjerg [Sat, 31 Dec 2016 21:37:41 +0000 (14:37 -0700)]
- Due to Invensense parts being register incompatible (even the HW ID),
  there were false error messages during the driver process of identifying
  the part.  This patch suppresses those error messages until the part is
  identified and the errors become legitimate.

Bug 200260974

Change-Id: Ibd7c6fe6e4b6424cfc2f7bf04f1a64405b03e539
Signed-off-by: Erik Lilliebjerg <elilliebjerg@nvidia.com>
Reviewed-on: http://git-master/r/1278897
(cherry picked from commit 010a8eaf597e519d5c1a258bf0015c719e0928c6)
Reviewed-on: http://git-master/r/1282258
Reviewed-by: Akhilesh Khumbum <akhumbum@nvidia.com>
Tested-by: Robert Collins <rcollins@nvidia.com>
Reviewed-by: Robert Collins <rcollins@nvidia.com>

drivers/iio/imu/nvi_mpu/nvi.c
drivers/iio/imu/nvi_mpu/nvi.h

index 905f765..8ad8b16 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "nvi.h"
 
-#define NVI_DRIVER_VERSION             (340)
+#define NVI_DRIVER_VERSION             (341)
 #define NVI_VENDOR                     "Invensense"
 #define NVI_NAME                       "mpu6xxx"
 #define NVI_NAME_MPU6050               "mpu6050"
@@ -1276,7 +1276,9 @@ static int nvi_dmp_fw(struct nvi_state *st)
                         st->hal->dmp->fw_len,
                         (u8 *)st->hal->dmp->fw, true);
        if (ret) {
-               dev_err(&st->i2c->dev, "%s ERR: nvi_mem_wr\n", __func__);
+               if (st->sts & NVI_STS_PART_ID_VALID)
+                       dev_err(&st->i2c->dev, "%s ERR: nvi_mem_wr\n",
+                               __func__);
                return ret;
        }
 
@@ -3954,7 +3956,7 @@ static int nvi_id_dev(struct nvi_state *st,
                dev_info(&st->i2c->dev, "%s: USING DEVICE TREE: %s\n",
                         __func__, i2c_dev_id->name);
        else
-               dev_info(&st->i2c->dev, "%s: FOUND HW ID=%x  USING: %s\n",
+               dev_info(&st->i2c->dev, "%s: FOUND HW ID=0x%X  USING: %s\n",
                         __func__, hw_id, st->snsr[0].cfg.part);
        return ret;
 }
@@ -4177,6 +4179,7 @@ static int nvi_init(struct nvi_state *st,
        if (ret)
                return ret;
 
+       st->sts |= NVI_STS_PART_ID_VALID;
        if (st->i2c->dev.of_node) {
                nvi_of_dt_post(st, st->i2c->dev.of_node);
        } else {
index cd67554..eec373f 100644 (file)
 #define INV_CLK_INTERNAL               (0)
 #define INV_CLK_PLL                    (1)
 
-#define NVI_DBG_SPEW_MSG               (1 << NVS_STS_EXT_N)
-#define NVI_DBG_SPEW_AUX               (1 << (NVS_STS_EXT_N + 1))
-#define NVI_DBG_SPEW_FIFO              (1 << (NVS_STS_EXT_N + 2))
-#define NVI_DBG_SPEW_TS                        (1 << (NVS_STS_EXT_N + 3))
-#define NVI_DBG_SPEW_SNSR              (1 << (NVS_STS_EXT_N + 4))
+#define NVI_STS_PART_ID_VALID          (1 << NVS_STS_EXT_N)
+#define NVI_DBG_SPEW_MSG               (1 << (NVS_STS_EXT_N + 1))
+#define NVI_DBG_SPEW_AUX               (1 << (NVS_STS_EXT_N + 2))
+#define NVI_DBG_SPEW_FIFO              (1 << (NVS_STS_EXT_N + 3))
+#define NVI_DBG_SPEW_TS                        (1 << (NVS_STS_EXT_N + 4))
+#define NVI_DBG_SPEW_SNSR              (1 << (NVS_STS_EXT_N + 5))
 
 #define NVI_RC_BANK_REG_BANK           (0x7F / 64)
 #define NVI_RC_MSK_REG_BANK            ((u64)(1ULL << (0x7F % 64)))