usb: otg: tegra: callback for otg plug/un-plug notificaton
Syed Rafiuddin [Thu, 19 Apr 2012 04:56:41 +0000 (09:56 +0530)]
Addition of callback function to nofity the plug and
un-plug of OTG cable to charger driver.

Change-Id: I6b16d051cafe0799cffe8a05d1510da27e841f8b
Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com>
Reviewed-on: http://git-master/r/97514
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Chandler Zhang <chazhang@nvidia.com>
Tested-by: Chandler Zhang <chazhang@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/usb/otg/tegra-otg.c

index 45d26c2..4c138f1 100644 (file)
@@ -231,6 +231,9 @@ static void tegra_change_otg_state(struct tegra_otg_data *tegra,
                dev_info(&tegra->pdev->dev, "%s --> %s\n", tegra_state_name(from),
                                              tegra_state_name(to));
 
+               if (tegra->charger_cb)
+                       tegra->charger_cb(to, from, tegra->charger_cb_data);
+
                if (from == OTG_STATE_A_SUSPEND) {
                        if (to == OTG_STATE_B_PERIPHERAL && otg->gadget)
                                usb_gadget_vbus_connect(otg->gadget);