smb347_charger: Disable OTG during shutdown(Rebased from R3-main to R3-stable).
authormadhu <madhukumarx.kallappa.manjanna@intel.com>
Mon, 4 Jun 2012 16:51:06 +0000 (22:21 +0530)
committerbuildbot <buildbot@intel.com>
Tue, 5 Jun 2012 07:08:18 +0000 (00:08 -0700)
BZ: 37067

Adding a .shutdown function, which disables the OTG.
This is required for the case where we shutdown and OTG is removed.
Unless OTG is disabled during shutdown, OTG-Enable bit in Command Register A
is not cleared in the next boot.

Change-Id: I9110659253d6650ced0cf85af3ff9ff1689b3dfe
Signed-off-by: madhu <madhukumarx.kallappa.manjanna@intel.com>
Reviewed-on: http://android.intel.com:8080/51150
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/power/smb347-charger.c

index c7400ff..0a8ebeb 100644 (file)
@@ -1687,6 +1687,17 @@ static int smb347_remove(struct i2c_client *client)
        return 0;
 }
 
+static int smb347_shutdown(struct i2c_client *client)
+{
+       struct smb347_charger *smb = i2c_get_clientdata(client);
+
+       /* Disable OTG during shutdown */
+       if (smb)
+               smb347_otg_drive_vbus(smb, false);
+
+       return 0;
+}
+
 static const struct i2c_device_id smb347_id[] = {
        { "smb347", 0},
 };
@@ -1699,6 +1710,7 @@ static struct i2c_driver smb347_driver = {
        },
        .probe          = smb347_probe,
        .remove         = __devexit_p(smb347_remove),
+       .shutdown       = smb347_shutdown,
        .id_table       = smb347_id,
 };