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

Commit fd754c3d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "misc: liquid_dock: Make dock_enable GPIO optional"

parents 0e42e6cb 59337761
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -11,10 +11,12 @@ Required properties:
	       also supported but deprecated.
 - qcom,dock-detect-gpio: phandle to a GPIO node corresponding to the input
                         signal indicating when the dock is connected
 - qcom,dock-enable-gpio: phandle to a GPIO node corresponding to the output
                         signal that turns on/off power to the ports
 - qcom,dock-hub-reset-gpio: phandle to a GPIO node corresponding to the output
                            signal that resets the USB ports
 - qcom,dock-eth-reset-gpio: phandle to a GPIO node corresponding to the output
                            signal that resets the Ethernet ports
 - qcom,usb-host: phandle to the USB host controller connected to the dock port

Optional properties:
 - qcom,dock-enable-gpio: phandle to a GPIO node corresponding to the output
                         signal that turns on/off power to the ports
+16 −12
Original line number Diff line number Diff line
@@ -76,18 +76,22 @@ static void dock_detected_work(struct work_struct *w)
	struct liquid_dock *dock = container_of(w, struct liquid_dock,
						 dock_work);
	docked = gpio_get_value(dock->dock_detect);

	if (dock->dock_enable)
		gpio_direction_output(dock->dock_enable, 0);

	if (docked) {
		/* assert RESETs before turning on power */
		gpio_direction_output(dock->dock_hub_reset, 1);
		gpio_direction_output(dock->dock_eth_reset, 1);

		if (device_attach(&dock->usb3_pdev->dev) != 1) {
			dev_err(dock->dev, "Could not add USB driver 0x%p\n",
				dock->usb3_pdev);
			return;
		}

		/* assert RESETs before turning on power */
		gpio_direction_output(dock->dock_hub_reset, 1);
		gpio_direction_output(dock->dock_eth_reset, 1);
		if (dock->dock_enable)
			gpio_direction_output(dock->dock_enable, 1);

		msleep(20); /* short delay before de-asserting RESETs */
@@ -170,14 +174,14 @@ static int liquid_dock_probe(struct platform_device *pdev)
		return ret;

	dock->dock_enable = of_get_named_gpio(node, "qcom,dock-enable-gpio", 0);
	if (dock->dock_enable < 0) {
		dev_err(dock->dev, "unable to get dock-enable-gpio\n");
		return dock->dock_enable;
	}

	ret = devm_gpio_request(dock->dev, dock->dock_enable, "dock_enable");
	if (dock->dock_enable < 0) { /* optional */
		dock->dock_enable = 0;
	} else {
		ret = devm_gpio_request(dock->dev, dock->dock_enable,
					"dock_enable");
		if (ret)
			return ret;
	}

	usb3_node = of_parse_phandle(node, "qcom,usb-host", 0);
	if (!usb3_node) {