hwmon: INA219: Keep the device in power-down after init
Aly Hirani [Tue, 13 Nov 2012 01:40:05 +0000 (17:40 -0800)]
Change the init sequence to reset first and then power-down the INA

Bug 1174904

Change-Id: Ic337e10d9799e21329b08adab3011ba17dea2844
Signed-off-by: Aly Hirani <ahirani@nvidia.com>
Reviewed-on: http://git-master/r/163179
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/hwmon/ina219.c

index e11c148..d1ca194 100644 (file)
@@ -525,7 +525,6 @@ static int ina219_probe(struct i2c_client *client,
        i2c_set_clientdata(client, data);
        data->pInfo = client->dev.platform_data;
        mutex_init(&data->mutex);
-       power_down_INA219(client);
        data->state = STOPPED;
        /* reset ina219 */
        err = i2c_smbus_write_word_data(client, INA219_CONFIG,
@@ -550,6 +549,13 @@ static int ina219_probe(struct i2c_client *client,
                goto exit_remove;
        }
 
+       err = power_down_INA219(client);
+       if (err < 0) {
+               dev_err(&client->dev, "ina219 power-down failure status: 0x%x\n",
+                       err);
+               goto exit_remove;
+       }
+
        return 0;
 
 exit_remove: