]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
usb: gadget: tegra: update vbus status properly tegra-l4t-r23.2
authorRakesh Babu Bodla <rbodla@nvidia.com>
Wed, 3 Feb 2016 10:37:53 +0000 (16:07 +0530)
committerWinnie Hsu <whsu@nvidia.com>
Fri, 5 Feb 2016 05:39:40 +0000 (21:39 -0800)
vbus status needs to be set to true, even if
charger is connected.

Bug 200105851

Change-Id: I02a32e9372f526c16b4448cf8ded67ef8fd8c7b2
Signed-off-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/1002306
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
drivers/usb/gadget/tegra_udc.c

index 0902a925575f6295de5cab26944b042d3182cef2..7063ebaabd00d873d3bfaaafa41d2c1d6b4a63b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2016, NVIDIA CORPORATION.  All rights reserved.
  *
  * Description:
  * High-speed USB device controller driver.
@@ -167,10 +167,28 @@ static inline bool vbus_enabled(struct tegra_udc *udc)
                 * of VBUS status.*/
                status = (udc_readl(udc, VBUS_SENSOR_REG_OFFSET)
                                                & USB_SYS_VBUS_ASESSION);
-       } else if (!udc->support_pmu_vbus) {
+       } else if (udc->support_pmu_vbus) {
+               if (udc->vbus_extcon_dev &&
+                       extcon_get_cable_state(udc->vbus_extcon_dev, "USB"))
+                       return true;
+
+               if (udc->aca_nv_extcon_cable &&
+                       extcon_get_cable_state_(udc->aca_nv_extcon_dev,
+                       udc->aca_nv_extcon_cable->cable_index))
+                       return true;
+
+               if (udc->aca_rid_b_ecable &&
+                       extcon_get_cable_state_(udc->aca_rid_b_ecable->edev,
+                       udc->aca_rid_b_ecable->cable_index))
+                       return true;
+
+               if (udc->aca_rid_c_ecable &&
+                       extcon_get_cable_state_(udc->aca_rid_c_ecable->edev,
+                       udc->aca_rid_c_ecable->cable_index))
+                       return true;
+       } else
                status = (udc_readl(udc, VBUS_WAKEUP_REG_OFFSET)
                                                & USB_SYS_VBUS_STATUS);
-       }
 
        return status;
 }