Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71275501 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

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: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent a7306e91
Loading
Loading
Loading
Loading
+7 −22
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ static int usb_extcon_probe(struct platform_device *pdev)
	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 @@ static int usb_extcon_probe(struct platform_device *pdev)
		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,6 +211,11 @@ static int usb_extcon_probe(struct platform_device *pdev)
	platform_set_drvdata(pdev, info);
	device_init_wakeup(dev, true);

	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);