input: misc: mpu: reduce mpu init time
David Yu [Mon, 9 Dec 2013 12:11:49 +0000 (21:11 +0900)]
200 ms delay caused by i2c error is removed.
Max 40 ms delay caused by logical mistake is removed.
8 ms delay is added in order to avoid i2c error on mpu chip power up.

Bug 1412917

Change-Id: Iebbef275ea0e6ba6a38cf0d497a256068f100afa
Signed-off-by: David Yu <davyu@nvidia.com>
Reviewed-on: http://git-master/r/343587
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Robert Collins <rcollins@nvidia.com>
Reviewed-by: Harry Hong <hhong@nvidia.com>

drivers/input/misc/mpu/inv_gyro.c

index 039431a..aad2d07 100644 (file)
@@ -684,10 +684,10 @@ static int nvi_pwr_mgmt_1_war(struct inv_gyro_state_s *inf)
 
        for (i = 0; i < POWER_UP_TIME; i++) {
                err = inv_i2c_single_write(inf, inf->reg->pwr_mgmt_1, 0);
-               if (err > 0) {
+               if (!err) {
                        val = -1;
                        err = inv_i2c_read(inf, inf->reg->pwr_mgmt_1, 1, &val);
-                       if (err > 0 && !val)
+                       if (!err && !val)
                                break;
                }
                mdelay(1);
@@ -815,6 +815,8 @@ static int nvi_vreg_en_all(struct inv_gyro_state_s *inf)
 
        for (i = 0; i < ARRAY_SIZE(nvi_vregs); i++)
                err |= nvi_vreg_en(inf, i);
+       if (err == 1)
+               mdelay(8);
        return err;
 }