extcon-usb-gpio: Schedule delayed work in probe for ethernet connection

Schedule work with delay in probe() so that GPIO can toggled to reset
ethernet bridge after host mode start. Or else ethernet network device
is not detected on some platforms having onboard ethernet bridge.

Change-Id: Ia8369133206c69320ed95c3a7523dcc6e2667894
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index a7a29fb..b1ef5c4 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -117,7 +117,6 @@
 	struct device_node *np = dev->of_node;
 	struct usb_extcon_info *info;
 	int ret;
-	const char *name = NULL;
 
 	if (!np && !ACPI_HANDLE(dev))
 		return -EINVAL;
@@ -159,25 +158,6 @@
 		return ret;
 	}
 
-	if (info->trig_gpiod) {
-		ret = of_property_read_string_index(np, "gpio-names", 0, &name);
-		if (ret) {
-			dev_err(dev, "Could not get gpio name\n");
-			return ret;
-		}
-
-		ret = gpiod_export(info->trig_gpiod, 0);
-		if (ret) {
-			dev_err(dev, "failed to export gpio\n");
-			return ret;
-		}
-
-		ret = gpiod_export_link(dev, name, info->trig_gpiod);
-		if (ret) {
-		dev_err(dev, "failed to export gpio link\n");
-		return ret;
-		}
-	}
 	if (info->id_gpiod)
 		ret = gpiod_set_debounce(info->id_gpiod,
 					 USB_GPIO_DEBOUNCE_MS * 1000);
@@ -231,8 +211,13 @@
 	platform_set_drvdata(pdev, info);
 	device_init_wakeup(dev, true);
 
-	/* Perform initial detection */
-	usb_extcon_detect_cable(&info->wq_detcable.work);
+	if (info->trig_gpiod)
+		/* Schedule with delay to reset ethernet bridge */
+		queue_delayed_work(system_power_efficient_wq,
+			&info->wq_detcable, msecs_to_jiffies(1500));
+	else
+		/* Perform initial detection */
+		usb_extcon_detect_cable(&info->wq_detcable.work);
 
 	return 0;
 }